using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Lib; using CodeRebirth.src.Content.DevTools; using CodeRebirth.src.Content.Enemies; using CodeRebirth.src.Content.Items; using CodeRebirth.src.Content.Maps; using CodeRebirth.src.Content.Moons; using CodeRebirth.src.Content.Unlockables; using CodeRebirth.src.Content.Weapons; using CodeRebirth.src.MiscScripts; using CodeRebirth.src.MiscScripts.CustomPasses; using CodeRebirth.src.ModCompats; using CodeRebirth.src.Patches; using CodeRebirth.src.Util; using CodeRebirth.src.Util.Timer; using CullFactory.Behaviours.API; using Dawn; using Dawn.Internal; using Dawn.Utils; using DigitalRuby.ThunderAndLightning; using DunGen; using Dusk; using GameNetcodeStuff; using HarmonyLib; using IL; using IL.GameNetcodeStuff; using Imperium; using InjectionLibrary.Attributes; using LethalCompanyInputUtils.Api; using LethalMoonUnlocks; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MoreCompany.Cosmetics; using MoreCounterplay; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Store; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades; using On; using On.GameNetcodeStuff; using On.Unity.AI.Navigation; using OpenBodyCams; using TMPro; using TooManyEmotes.Patches; using Unity.AI.Navigation; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Experimental.Rendering; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.ProBuilder; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.RendererUtils; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.UI; using UnityEngine.VFX; using UnityEngine.Video; using WeatherRegistry; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RequiresInjections] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("BaronDrakula.MoreCounterplay")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib.dusk")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("giosuel.Imperium")] [assembly: IgnoresAccessChecksTo("MoreShipUpgrades")] [assembly: IgnoresAccessChecksTo("TooManyEmotes")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CodeRebirth")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Content mod that adds Custom Weathers, Items, Enemies and more.")] [assembly: AssemblyFileVersion("1.6.9.0")] [assembly: AssemblyInformationalVersion("1.6.9")] [assembly: AssemblyProduct("CodeRebirth")] [assembly: AssemblyTitle("CodeRebirth")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.9.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; } } } public class MonarchBeamController : MonoBehaviour { public Transform _raycastDirectionBeamTransform = null; public Transform _startBeamTransform = null; public AudioClip _beamSound = null; public VisualEffect? _monarchParticle = null; [SerializeField] private SkinnedMeshRenderer _wingMesh = null; [SerializeField] private Transform _endBeamTransform = null; public void OnValidate() { if (!((Object)(object)_monarchParticle == (Object)null)) { _monarchParticle.SetSkinnedMeshRenderer("wingMesh", _wingMesh); } } public void Start() { if (!((Object)(object)_monarchParticle == (Object)null)) { _monarchParticle.SetSkinnedMeshRenderer("wingMesh", _wingMesh); } } public void SetBeamPosition(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _endBeamTransform.position = position; } } public class SeeThroughCustomPass : CustomPass { [SerializeField] public Material seeThroughMaterial = new Material(CodeRebirthUtils.Instance.WireframeMaterial); public LayerMask seeThroughLayer; public float maxVisibilityDistance = 20f; [SerializeField] private readonly Shader stencilShader = CodeRebirthUtils.Instance.SeeThroughShader; private Material? stencilMaterial = null; private ShaderTagId[] shaderTags = Array.Empty(); public override bool executeInSceneView => true; public void ConfigureMaterial(Color edgeColor, Color fillColor, float thickness) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) seeThroughMaterial.SetColor("_EdgeColor", edgeColor); seeThroughMaterial.SetColor("_MainColor", fillColor); seeThroughMaterial.SetFloat("_WireframeVal", thickness); } public override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) stencilMaterial = CoreUtils.CreateEngineMaterial(stencilShader); shaderTags = (ShaderTagId[])(object)new ShaderTagId[4] { new ShaderTagId("Forward"), new ShaderTagId("ForwardOnly"), new ShaderTagId("SRPDefaultUnlit"), new ShaderTagId("FirstPass") }; } public override void Execute(CustomPassContext ctx) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)stencilMaterial == (Object)null) { stencilMaterial = CoreUtils.CreateEngineMaterial(stencilShader); } stencilMaterial.SetInt("_StencilWriteMask", 64); seeThroughMaterial.SetFloat("_MaxVisibilityDistance", Mathf.Max(0f, maxVisibilityDistance)); RenderObjects(ctx.renderContext, ctx.cmd, stencilMaterial, 0, (CompareFunction)4, ctx.cullingResults, ctx.hdCamera); StencilState value = default(StencilState); ((StencilState)(ref value))..ctor(true, (byte)64, byte.MaxValue, (CompareFunction)3, (StencilOp)0, (StencilOp)0, (StencilOp)0); RenderObjects(ctx.renderContext, ctx.cmd, seeThroughMaterial, seeThroughMaterial.FindPass("ForwardOnly"), (CompareFunction)7, ctx.cullingResults, ctx.hdCamera, value); } public override IEnumerable RegisterMaterialForInspector() { yield return seeThroughMaterial; } private void RenderObjects(ScriptableRenderContext renderContext, CommandBuffer cmd, Material overrideMaterial, int passIndex, CompareFunction depthCompare, CullingResults cullingResult, HDCamera hdCamera, StencilState? overrideStencil = null) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) RendererListDesc val = default(RendererListDesc); ((RendererListDesc)(ref val))..ctor(shaderTags, cullingResult, hdCamera.camera); val.rendererConfiguration = (PerObjectData)0; val.renderQueueRange = RenderQueueRange.opaque; val.sortingCriteria = (SortingCriteria)4; val.excludeObjectMotionVectors = false; val.overrideMaterial = overrideMaterial; val.overrideMaterialPassIndex = passIndex; val.layerMask = LayerMask.op_Implicit(seeThroughLayer); RenderStateBlock value = default(RenderStateBlock); ((RenderStateBlock)(ref value))..ctor((RenderStateMask)4); ((RenderStateBlock)(ref value)).depthState = new DepthState(false, depthCompare); val.stateBlock = value; RendererListDesc val2 = val; if (overrideStencil.HasValue) { RenderStateBlock value2 = val2.stateBlock.Value; ((RenderStateBlock)(ref value2)).mask = (RenderStateMask)(((RenderStateBlock)(ref value2)).mask | 8); ((RenderStateBlock)(ref value2)).stencilState = overrideStencil.Value; val2.stateBlock = value2; } CoreUtils.DrawRendererList(renderContext, cmd, ((ScriptableRenderContext)(ref renderContext)).CreateRendererList(val2)); } public override void Cleanup() { } } internal class TIPS : CustomPass { public Mesh? mesh = null; public float size = 5f; public float rotationSpeed = 5f; public float edgeDetectThreshold = 1f; public int edgeRadius = 2; public Color glowColor = Color.white; public const float kMaxDistance = 1000f; public Material tipsMeshMaterial; public Material fullscreenMaterial; private RTHandle tipsBuffer; private int compositingPass; private int blurPass; private static readonly int _TipsBuffer = Shader.PropertyToID("_TIPSBuffer"); private static readonly int _BypassMeshDepth = Shader.PropertyToID("_BypassMeshDepth"); private static readonly int _EdgeDetectThreshold = Shader.PropertyToID("_EdgeDetectThreshold"); private static readonly int _GlowColor = Shader.PropertyToID("_GlowColor"); private static readonly int _EdgeRadius = Shader.PropertyToID("_EdgeRadius"); private static readonly int _Intensity = Shader.PropertyToID("_Intensity"); public override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) tipsMeshMaterial = Resources.Load("Shader Graphs_TIPS_Effect"); tipsBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, (DepthBits)0, (GraphicsFormat)48, (FilterMode)0, (TextureWrapMode)0, TextureXR.dimension, false, false, true, false, 1, 0f, (MSAASamples)1, false, true, (RenderTextureMemoryless)0, (VRTextureUsage)0, "TIPS Buffer"); if ((Object)(object)fullscreenMaterial != (Object)null) { compositingPass = fullscreenMaterial.FindPass("Compositing"); blurPass = fullscreenMaterial.FindPass("Blur"); } base.targetColorBuffer = (TargetBuffer)1; base.targetDepthBuffer = (TargetBuffer)1; base.clearFlags = (ClearFlag)7; } public override void Execute(CustomPassContext ctx) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)fullscreenMaterial == (Object)null)) { if ((Object)(object)mesh != (Object)null && (Object)(object)tipsMeshMaterial != (Object)null) { Transform transform = ((Component)ctx.hdCamera.camera).transform; Matrix4x4 val = Matrix4x4.TRS(transform.position, Quaternion.Euler(0f, Time.realtimeSinceStartup * rotationSpeed, Time.realtimeSinceStartup * rotationSpeed * 0.5f), Vector3.one * size); tipsMeshMaterial.SetFloat(_Intensity, 0.2f / size * 1000f); ctx.cmd.DrawMesh(mesh, val, tipsMeshMaterial, 0, tipsMeshMaterial.FindPass("ForwardOnly")); } ctx.propertyBlock.SetFloat(_EdgeDetectThreshold, edgeDetectThreshold); ctx.propertyBlock.SetColor(_GlowColor, glowColor); ctx.propertyBlock.SetFloat(_EdgeRadius, (float)edgeRadius); ctx.propertyBlock.SetFloat(_BypassMeshDepth, ((Object)(object)mesh != (Object)null) ? 0f : size); CoreUtils.SetRenderTarget(ctx.cmd, tipsBuffer, (ClearFlag)1, 0, (CubemapFace)(-1), -1); CommandBuffer cmd = ctx.cmd; Material obj = fullscreenMaterial; int num = compositingPass; CoreUtils.DrawFullScreen(cmd, obj, ctx.propertyBlock, num); ctx.propertyBlock.SetTexture(_TipsBuffer, RTHandle.op_Implicit(tipsBuffer)); CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer, (ClearFlag)0, 0, (CubemapFace)(-1), -1); CommandBuffer cmd2 = ctx.cmd; Material obj2 = fullscreenMaterial; num = blurPass; CoreUtils.DrawFullScreen(cmd2, obj2, ctx.propertyBlock, num); } } public override void Cleanup() { tipsBuffer.Release(); } } namespace CodeRebirth { public static class MyPluginInfo { public const string PLUGIN_GUID = "CodeRebirth"; public const string PLUGIN_NAME = "CodeRebirth"; public const string PLUGIN_VERSION = "1.6.9"; } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthEnemyKeys { public static NamespacedKey DebtCollector = NamespacedKey.From("code_rebirth", "debt_collector"); public static NamespacedKey Guardsman = NamespacedKey.From("code_rebirth", "guardsman"); public static NamespacedKey CactusBudling = NamespacedKey.From("code_rebirth", "cactus_budling"); public static NamespacedKey CarnivorousPlant = NamespacedKey.From("code_rebirth", "carnivorous_plant"); public static NamespacedKey DriftwoodMenace = NamespacedKey.From("code_rebirth", "driftwood_menace"); public static NamespacedKey Duck = NamespacedKey.From("code_rebirth", "duck"); public static NamespacedKey Janitor = NamespacedKey.From("code_rebirth", "janitor"); public static NamespacedKey RabbitMagician = NamespacedKey.From("code_rebirth", "rabbit_magician"); public static NamespacedKey LordOfTheManor = NamespacedKey.From("code_rebirth", "lord_of_the_manor"); public static NamespacedKey Mistress = NamespacedKey.From("code_rebirth", "mistress"); public static NamespacedKey CutieFly = NamespacedKey.From("code_rebirth", "cutiefly"); public static NamespacedKey Monarch = NamespacedKey.From("code_rebirth", "monarch"); public static NamespacedKey Nancy = NamespacedKey.From("code_rebirth", "nancy"); public static NamespacedKey PeaceKeeper = NamespacedKey.From("code_rebirth", "peace_keeper"); public static NamespacedKey RedwoodTitan = NamespacedKey.From("code_rebirth", "redwood_titan"); public static NamespacedKey RealEnemySnailCat = NamespacedKey.From("code_rebirth", "real_enemy_snailcat"); public static NamespacedKey Transporter = NamespacedKey.From("code_rebirth", "transporter"); public static NamespacedKey Tornado = NamespacedKey.From("code_rebirth", "tornado"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthEnemyKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthWeatherKeys { public static NamespacedKey MeteorShower = NamespacedKey.From("code_rebirth", "meteor_shower"); public static NamespacedKey NightShift = NamespacedKey.From("code_rebirth", "night_shift"); public static NamespacedKey Tornado = NamespacedKey.From("code_rebirth", "tornado"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthWeatherKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthUnlockableItemKeys { public static NamespacedKey ToastyToaster = NamespacedKey.From("code_rebirth", "toasty_toaster"); public static NamespacedKey DenominationAnalyzer = NamespacedKey.From("code_rebirth", "denomination_analyzer"); public static NamespacedKey TrashHoop = NamespacedKey.From("code_rebirth", "trash_hoop"); public static NamespacedKey FancyCoatHanger = NamespacedKey.From("code_rebirth", "fancy_coat_hanger"); public static NamespacedKey TeddyBear = NamespacedKey.From("code_rebirth", "teddy_bear"); public static NamespacedKey CutieflyCase = NamespacedKey.From("code_rebirth", "cutiefly_case"); public static NamespacedKey JimPlaque = NamespacedKey.From("code_rebirth", "jim_plaque"); public static NamespacedKey AIRCONTROL = NamespacedKey.From("code_rebirth", "aircontrol"); public static NamespacedKey MISSCRUISER = NamespacedKey.From("code_rebirth", "miss_cruiser"); public static NamespacedKey BALD = NamespacedKey.From("code_rebirth", "bald"); public static NamespacedKey PlantPot = NamespacedKey.From("code_rebirth", "plantpot"); public static NamespacedKey LIZZIE = NamespacedKey.From("code_rebirth", "lizzie"); public static NamespacedKey SEAMOne = NamespacedKey.From("code_rebirth", "seamone"); public static NamespacedKey SWRDOne = NamespacedKey.From("code_rebirth", "swrdone"); public static NamespacedKey SHRIMP = NamespacedKey.From("code_rebirth", "shrimp"); public static NamespacedKey DAISY = NamespacedKey.From("code_rebirth", "daisy"); public static NamespacedKey TimmyBass = NamespacedKey.From("code_rebirth", "timmy_bass"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthUnlockableItemKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthItemKeys { public static NamespacedKey CharredBaby = NamespacedKey.From("code_rebirth", "charred_baby"); public static NamespacedKey CharredFork = NamespacedKey.From("code_rebirth", "charred_fork"); public static NamespacedKey SapsuckerOmelette = NamespacedKey.From("code_rebirth", "sapsucker_omelette"); public static NamespacedKey CharredSpork = NamespacedKey.From("code_rebirth", "charred_spork"); public static NamespacedKey FlattenedBody = NamespacedKey.From("code_rebirth", "flattened_body"); public static NamespacedKey SallyCube = NamespacedKey.From("code_rebirth", "sally_cube"); public static NamespacedKey BurntFleshArm = NamespacedKey.From("code_rebirth", "burnt_flesh_arm"); public static NamespacedKey BurntFleshEye = NamespacedKey.From("code_rebirth", "burnt_flesh_eye"); public static NamespacedKey BurntRubble = NamespacedKey.From("code_rebirth", "burnt_rubble"); public static NamespacedKey BurntFleshTeeth = NamespacedKey.From("code_rebirth", "burnt_flesh_teeth"); public static NamespacedKey BurntFleshTongue = NamespacedKey.From("code_rebirth", "burnt_flesh_tongue"); public static NamespacedKey Coin = NamespacedKey.From("code_rebirth", "coin"); public static NamespacedKey CrispDollarBill = NamespacedKey.From("code_rebirth", "crisp_dollar_bill"); public static NamespacedKey WayfarersWallet = NamespacedKey.From("code_rebirth", "wayfarers_wallet"); public static NamespacedKey AlarmClock = NamespacedKey.From("code_rebirth", "alarm_clock"); public static NamespacedKey Amber = NamespacedKey.From("code_rebirth", "amber"); public static NamespacedKey MusicBox = NamespacedKey.From("code_rebirth", "music_box"); public static NamespacedKey BirthdayCard = NamespacedKey.From("code_rebirth", "birthday_card"); public static NamespacedKey CreditPadOneZeroZerocc = NamespacedKey.From("code_rebirth", "credit_pad_onezerozerocc"); public static NamespacedKey CreditPadFiveZeroZerocc = NamespacedKey.From("code_rebirth", "credit_pad_fivezerozerocc"); public static NamespacedKey CreditPadOneZeroZeroZerocc = NamespacedKey.From("code_rebirth", "credit_pad_onezerozerozerocc"); public static NamespacedKey RemoteDetonator = NamespacedKey.From("code_rebirth", "remote_detonator"); public static NamespacedKey DisposableCamera = NamespacedKey.From("code_rebirth", "disposable_camera"); public static NamespacedKey DuckyTube = NamespacedKey.From("code_rebirth", "ducky_tube"); public static NamespacedKey EZBakeOven = NamespacedKey.From("code_rebirth", "ez_bake_oven"); public static NamespacedKey FogHorn = NamespacedKey.From("code_rebirth", "foghorn"); public static NamespacedKey GuardsmanPhone = NamespacedKey.From("code_rebirth", "guardsman_phone"); public static NamespacedKey HandDrill = NamespacedKey.From("code_rebirth", "hand_drill"); public static NamespacedKey HardHat = NamespacedKey.From("code_rebirth", "hard_hat"); public static NamespacedKey InfiniKey = NamespacedKey.From("code_rebirth", "infinikey"); public static NamespacedKey LifeformAnalyser = NamespacedKey.From("code_rebirth", "lifeform_analyser"); public static NamespacedKey MagicEightBall = NamespacedKey.From("code_rebirth", "magic_eight_ball"); public static NamespacedKey Mirror = NamespacedKey.From("code_rebirth", "mirror"); public static NamespacedKey MoleDigger = NamespacedKey.From("code_rebirth", "mole_digger"); public static NamespacedKey MouseTrap = NamespacedKey.From("code_rebirth", "mouse_trap"); public static NamespacedKey NitroglycerinCrate = NamespacedKey.From("code_rebirth", "nitroglycerin_crate"); public static NamespacedKey OldBooze = NamespacedKey.From("code_rebirth", "old_booze"); public static NamespacedKey OrbitalStrikeCaller = NamespacedKey.From("code_rebirth", "orbital_strike_caller"); public static NamespacedKey Oxidizer = NamespacedKey.From("code_rebirth", "oxidizer"); public static NamespacedKey PlasticCake = NamespacedKey.From("code_rebirth", "plastic_cake"); public static NamespacedKey RailSlugger = NamespacedKey.From("code_rebirth", "rail_slugger"); public static NamespacedKey Rocky = NamespacedKey.From("code_rebirth", "rocky"); public static NamespacedKey RollingDuck = NamespacedKey.From("code_rebirth", "rolling_duck"); public static NamespacedKey Rubberband = NamespacedKey.From("code_rebirth", "rubber_band"); public static NamespacedKey RustedPickHead = NamespacedKey.From("code_rebirth", "rusted_pick_head"); public static NamespacedKey SawBlade = NamespacedKey.From("code_rebirth", "saw_blade"); public static NamespacedKey Scrapapult = NamespacedKey.From("code_rebirth", "scrapapult"); public static NamespacedKey ShipUpgradeUnlocker = NamespacedKey.From("code_rebirth", "ship_upgrade_unlocker"); public static NamespacedKey Skull = NamespacedKey.From("code_rebirth", "skull"); public static NamespacedKey SpudTater = NamespacedKey.From("code_rebirth", "spud_tater"); public static NamespacedKey StoptimeWatch = NamespacedKey.From("code_rebirth", "stoptime_watch"); public static NamespacedKey TeddyBear = NamespacedKey.From("code_rebirth", "teddy_bear"); public static NamespacedKey WalkieYellie = NamespacedKey.From("code_rebirth", "walkieyellie"); public static NamespacedKey WalkingCane = NamespacedKey.From("code_rebirth", "walking_cane"); public static NamespacedKey WiltedRose = NamespacedKey.From("code_rebirth", "wilted_rose"); public static NamespacedKey ScribbledPaper = NamespacedKey.From("code_rebirth", "melanie_drawing"); public static NamespacedKey XrayGlasses = NamespacedKey.From("code_rebirth", "xray_glasses"); public static NamespacedKey Yoyo = NamespacedKey.From("code_rebirth", "yoyo"); public static NamespacedKey BloodyShreddedScraps = NamespacedKey.From("code_rebirth", "bloody_shredded_scraps"); public static NamespacedKey JimothyCore = NamespacedKey.From("code_rebirth", "jimothy_core"); public static NamespacedKey NormalShreddedScraps = NamespacedKey.From("code_rebirth", "normal_shredded_scraps"); public static NamespacedKey DebugStick = NamespacedKey.From("code_rebirth", "debug_stick"); public static NamespacedKey StoatGun = NamespacedKey.From("code_rebirth", "stoat_gun"); public static NamespacedKey CrispXuBuck = NamespacedKey.From("code_rebirth", "crisp_xubuck"); public static NamespacedKey Grape = NamespacedKey.From("code_rebirth", "grape"); public static NamespacedKey LemonadePitcher = NamespacedKey.From("code_rebirth", "lemonade_pitcher"); public static NamespacedKey PuppeteersNeedle = NamespacedKey.From("code_rebirth", "puppeteers_needle"); public static NamespacedKey PuppeteersVoodoo = NamespacedKey.From("code_rebirth", "puppeteers_voodoo"); public static NamespacedKey TalkingHead = NamespacedKey.From("code_rebirth", "talking_head"); public static NamespacedKey Ceasefire = NamespacedKey.From("code_rebirth", "ceasefire"); public static NamespacedKey GiantCallerHorn = NamespacedKey.From("code_rebirth", "giant_caller_horn"); public static NamespacedKey FakeSnailCat = NamespacedKey.From("code_rebirth", "fake_snailcat"); public static NamespacedKey SnailCat = NamespacedKey.From("code_rebirth", "snailcat"); public static NamespacedKey Hoverboard = NamespacedKey.From("code_rebirth", "hoverboard"); public static NamespacedKey ByrneJournalOne = NamespacedKey.From("code_rebirth", "byrne_journal_one"); public static NamespacedKey ByrneJournalTwo = NamespacedKey.From("code_rebirth", "byrne_journal_two"); public static NamespacedKey ByrneJournalThree = NamespacedKey.From("code_rebirth", "byrne_journal_three"); public static NamespacedKey ByrneJournalFour = NamespacedKey.From("code_rebirth", "byrne_journal_four"); public static NamespacedKey ByrneJournalFive = NamespacedKey.From("code_rebirth", "byrne_journal_five"); public static NamespacedKey ByrneJournalSix = NamespacedKey.From("code_rebirth", "byrne_journal_six"); public static NamespacedKey DirectorDiaryOne = NamespacedKey.From("code_rebirth", "director_diary_one"); public static NamespacedKey DirectorDiaryTwo = NamespacedKey.From("code_rebirth", "director_diary_two"); public static NamespacedKey DirectorDiaryThree = NamespacedKey.From("code_rebirth", "director_diary_three"); public static NamespacedKey DirectorDiaryFour = NamespacedKey.From("code_rebirth", "director_diary_four"); public static NamespacedKey DirectorDiaryFive = NamespacedKey.From("code_rebirth", "director_diary_five"); public static NamespacedKey DirectorDiarySix = NamespacedKey.From("code_rebirth", "director_diary_six"); public static NamespacedKey DirectorDiarySeven = NamespacedKey.From("code_rebirth", "director_diary_seven"); public static NamespacedKey DirectorDiaryEight = NamespacedKey.From("code_rebirth", "director_diary_eight"); public static NamespacedKey DirectorDiaryNine = NamespacedKey.From("code_rebirth", "director_diary_nine"); public static NamespacedKey DirectorDiaryOneZero = NamespacedKey.From("code_rebirth", "director_diary_onezero"); public static NamespacedKey ToDoList = NamespacedKey.From("code_rebirth", "todo_list"); public static NamespacedKey CactusBudlingDocument = NamespacedKey.From("code_rebirth", "cactusbudlingdocument"); public static NamespacedKey CutieMonarchDocument = NamespacedKey.From("code_rebirth", "cutiemonarchdocument"); public static NamespacedKey DriftwoodMenaceDocument = NamespacedKey.From("code_rebirth", "driftwoodmenacedocument"); public static NamespacedKey DuckDocument = NamespacedKey.From("code_rebirth", "duckdocument"); public static NamespacedKey GuardsmanDocument = NamespacedKey.From("code_rebirth", "guardsmandocument"); public static NamespacedKey IntroDocument = NamespacedKey.From("code_rebirth", "introdocument"); public static NamespacedKey JanitorDocument = NamespacedKey.From("code_rebirth", "janitordocument"); public static NamespacedKey MagicianDocument = NamespacedKey.From("code_rebirth", "magiciandocument"); public static NamespacedKey ManorLordDocument = NamespacedKey.From("code_rebirth", "manorlorddocument"); public static NamespacedKey MistressDocument = NamespacedKey.From("code_rebirth", "mistressdocument"); public static NamespacedKey NancyDocument = NamespacedKey.From("code_rebirth", "nancydocument"); public static NamespacedKey PeaceKeeperDocument = NamespacedKey.From("code_rebirth", "peacekeeperdocument"); public static NamespacedKey RedwoodDocument = NamespacedKey.From("code_rebirth", "redwooddocument"); public static NamespacedKey SnailCatDocument = NamespacedKey.From("code_rebirth", "snailcatdocument"); public static NamespacedKey TransporterDocument = NamespacedKey.From("code_rebirth", "transporterdocument"); public static NamespacedKey ComfortTape = NamespacedKey.From("code_rebirth", "comfort_tape"); public static NamespacedKey OxydeTrainingTape = NamespacedKey.From("code_rebirth", "oxyde_training_tape"); public static NamespacedKey HaemoglobinTablet = NamespacedKey.From("code_rebirth", "haemoglobin_tablet"); public static NamespacedKey OxydeTablet = NamespacedKey.From("code_rebirth", "oxyde_tablet"); public static NamespacedKey Plushie = NamespacedKey.From("code_rebirth", "plushie"); public static NamespacedKey ACUnitGalPlushie = NamespacedKey.From("code_rebirth", "acunit_gal_plushie"); public static NamespacedKey CactusBudlingPlushie = NamespacedKey.From("code_rebirth", "cactus_budling_plushie"); public static NamespacedKey CruiserGalPlushie = NamespacedKey.From("code_rebirth", "cruiser_gal_plushie"); public static NamespacedKey DriftwoodMenacePlushie = NamespacedKey.From("code_rebirth", "driftwood_menace_plushie"); public static NamespacedKey DuckPlushie = NamespacedKey.From("code_rebirth", "duck_plushie"); public static NamespacedKey GuardsmanPlushie = NamespacedKey.From("code_rebirth", "guardsman_plushie"); public static NamespacedKey JanitorPlushie = NamespacedKey.From("code_rebirth", "janitor_plushie"); public static NamespacedKey ManorLordPlushie = NamespacedKey.From("code_rebirth", "manorlord_plushie"); public static NamespacedKey MistressPlushie = NamespacedKey.From("code_rebirth", "mistress_plushie"); public static NamespacedKey MonarchPlushie = NamespacedKey.From("code_rebirth", "monarch_plushie"); public static NamespacedKey NancyPlushie = NamespacedKey.From("code_rebirth", "nancy_plushie"); public static NamespacedKey PeaceKeeperPlushie = NamespacedKey.From("code_rebirth", "peacekeeper_plushie"); public static NamespacedKey RabbitMagicianPlushie = NamespacedKey.From("code_rebirth", "rabbit_magician_plushie"); public static NamespacedKey RedwoodTitanPlushie = NamespacedKey.From("code_rebirth", "redwood_titan_plushie"); public static NamespacedKey SeamineTinkPlushie = NamespacedKey.From("code_rebirth", "seamine_tink_plushie"); public static NamespacedKey ShockwaveBotPlushie = NamespacedKey.From("code_rebirth", "shockwave_bot_plushie"); public static NamespacedKey SnailCatPlushie = NamespacedKey.From("code_rebirth", "snail_cat_plushie"); public static NamespacedKey TerminalBotPlushie = NamespacedKey.From("code_rebirth", "terminal_bot_plushie"); public static NamespacedKey TransporterPlushie = NamespacedKey.From("code_rebirth", "transporter_plushie"); public static NamespacedKey SnowGlobe = NamespacedKey.From("code_rebirth", "snow_globe"); public static NamespacedKey Brrreaker = NamespacedKey.From("code_rebirth", "brrreaker"); public static NamespacedKey MarrowSplitter = NamespacedKey.From("code_rebirth", "marrow_splitter"); public static NamespacedKey SWATTer = NamespacedKey.From("code_rebirth", "swatter"); public static NamespacedKey TomaHop = NamespacedKey.From("code_rebirth", "toma_hop"); public static NamespacedKey Turbulence = NamespacedKey.From("code_rebirth", "turbulence"); public static NamespacedKey SaltedBeef = NamespacedKey.From("code_rebirth", "salted_beef"); public static NamespacedKey KingRigo = NamespacedKey.From("code_rebirth", "kingrigo"); public static NamespacedKey Yeehawlanie = NamespacedKey.From("code_rebirth", "melicious_mel"); public static NamespacedKey Xui = NamespacedKey.From("code_rebirth", "xui"); public static NamespacedKey Accordion = NamespacedKey.From("code_rebirth", "accordion"); public static NamespacedKey Guitar = NamespacedKey.From("code_rebirth", "guitar"); public static NamespacedKey Recorder = NamespacedKey.From("code_rebirth", "recorder"); public static NamespacedKey Violin = NamespacedKey.From("code_rebirth", "violin"); public static NamespacedKey CruiserGalAssemblyParts = NamespacedKey.From("code_rebirth", "cruisergal_assembly_parts"); public static NamespacedKey GoldenTomato = NamespacedKey.From("code_rebirth", "golden_tomato"); public static NamespacedKey NormalTomato = NamespacedKey.From("code_rebirth", "normal_tomato"); public static NamespacedKey WoodenSeed = NamespacedKey.From("code_rebirth", "wooden_seed"); public static NamespacedKey JarofNineNineNine = NamespacedKey.From("code_rebirth", "jar_of_nineninenine"); public static NamespacedKey SeamineGalAssemblyParts = NamespacedKey.From("code_rebirth", "seaminegal_assembly_parts"); public static NamespacedKey ShockwaveGalAssemblyParts = NamespacedKey.From("code_rebirth", "shockwavegal_assembly_parts"); public static NamespacedKey BlueShrimp = NamespacedKey.From("code_rebirth", "blue_shrimp"); public static NamespacedKey TerminalGalAssemblyParts = NamespacedKey.From("code_rebirth", "terminalgal_assembly_parts"); public static NamespacedKey AmethystCrystal = NamespacedKey.From("code_rebirth", "amethyst_crystal"); public static NamespacedKey EmeraldCrystal = NamespacedKey.From("code_rebirth", "emerald_crystal"); public static NamespacedKey QuartzCrystal = NamespacedKey.From("code_rebirth", "quartz_crystal"); public static NamespacedKey RubyCrystal = NamespacedKey.From("code_rebirth", "ruby_crystal"); public static NamespacedKey SapphireCrystal = NamespacedKey.From("code_rebirth", "sapphire_crystal"); public static NamespacedKey TopazCrystal = NamespacedKey.From("code_rebirth", "topaz_crystal"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthItemKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthMapObjectKeys { public static NamespacedKey FlashTurret = NamespacedKey.From("code_rebirth", "flash_turret"); public static NamespacedKey FunctionalMicrowave = NamespacedKey.From("code_rebirth", "functional_microwave"); public static NamespacedKey LaserTurret = NamespacedKey.From("code_rebirth", "laser_turret"); public static NamespacedKey IndustrialFan = NamespacedKey.From("code_rebirth", "industrial_fan"); public static NamespacedKey BugZapper = NamespacedKey.From("code_rebirth", "bug_zapper"); public static NamespacedKey AirControlUnit = NamespacedKey.From("code_rebirth", "air_control_unit"); public static NamespacedKey AutonomousCrane = NamespacedKey.From("code_rebirth", "autonomous_crane"); public static NamespacedKey BoomTrap = NamespacedKey.From("code_rebirth", "boom_trap"); public static NamespacedKey GrassBearTrap = NamespacedKey.From("code_rebirth", "grass_bear_trap"); public static NamespacedKey GravelBearTrap = NamespacedKey.From("code_rebirth", "gravel_bear_trap"); public static NamespacedKey SnowBearTrap = NamespacedKey.From("code_rebirth", "snow_bear_trap"); public static NamespacedKey Biome = NamespacedKey.From("code_rebirth", "biome"); public static NamespacedKey CompactorToby = NamespacedKey.From("code_rebirth", "compactor_toby"); public static NamespacedKey OxydeCrashedShip = NamespacedKey.From("code_rebirth", "oxyde_crashed_ship"); public static NamespacedKey GunslingerGreg = NamespacedKey.From("code_rebirth", "gunslinger_greg"); public static NamespacedKey NormalMetalCrate = NamespacedKey.From("code_rebirth", "normal_metal_crate"); public static NamespacedKey MimicMetalCrate = NamespacedKey.From("code_rebirth", "mimic_metal_crate"); public static NamespacedKey MimicWoodenCrate = NamespacedKey.From("code_rebirth", "mimic_wooden_crate"); public static NamespacedKey NormalWoodenCrate = NamespacedKey.From("code_rebirth", "normal_wooden_crate"); public static NamespacedKey MilitaryPlane = NamespacedKey.From("code_rebirth", "military_plane"); public static NamespacedKey Coin = NamespacedKey.From("code_rebirth", "coin"); public static NamespacedKey CrispDollarBill = NamespacedKey.From("code_rebirth", "crisp_dollar_bill"); public static NamespacedKey Wallet = NamespacedKey.From("code_rebirth", "wallet"); public static NamespacedKey CommonVendingMachine = NamespacedKey.From("code_rebirth", "common_vending_machine"); public static NamespacedKey LegendaryVendingMachine = NamespacedKey.From("code_rebirth", "legendary_vending_machine"); public static NamespacedKey RareVendingMachine = NamespacedKey.From("code_rebirth", "rare_vending_machine"); public static NamespacedKey UncommonVendingMachine = NamespacedKey.From("code_rebirth", "uncommon_vending_machine"); public static NamespacedKey Merchant = NamespacedKey.From("code_rebirth", "merchant"); public static NamespacedKey KamikazeJimothy = NamespacedKey.From("code_rebirth", "kamikaze_jimothy"); public static NamespacedKey ShredderSarah = NamespacedKey.From("code_rebirth", "shredder_sarah"); public static NamespacedKey EmergingCactusOne = NamespacedKey.From("code_rebirth", "emerging_cactus_one"); public static NamespacedKey EmergingCactusTwo = NamespacedKey.From("code_rebirth", "emerging_cactus_two"); public static NamespacedKey EmergingCactusThree = NamespacedKey.From("code_rebirth", "emerging_cactus_three"); public static NamespacedKey TrashCan = NamespacedKey.From("code_rebirth", "trash_can"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthMapObjectKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthAchievementKeys { public static NamespacedKey LunchisServed = NamespacedKey.From("code_rebirth", "lunch_is_served"); public static NamespacedKey ShortFuse = NamespacedKey.From("code_rebirth", "short_fuse"); public static NamespacedKey Banzai = NamespacedKey.From("code_rebirth", "banzai"); public static NamespacedKey GreatestAsset = NamespacedKey.From("code_rebirth", "greatest_asset"); public static NamespacedKey Internship = NamespacedKey.From("code_rebirth", "internship"); public static NamespacedKey Crateapult = NamespacedKey.From("code_rebirth", "crateapult"); public static NamespacedKey SafeAndSound = NamespacedKey.From("code_rebirth", "safe_and_sound"); public static NamespacedKey Capitalism = NamespacedKey.From("code_rebirth", "capitalism"); public static NamespacedKey OhAPenny = NamespacedKey.From("code_rebirth", "oh_a_penny"); public static NamespacedKey OutOfStock = NamespacedKey.From("code_rebirth", "out_of_stock"); public static NamespacedKey YouMonster = NamespacedKey.From("code_rebirth", "you_monster"); public static NamespacedKey WildWest = NamespacedKey.From("code_rebirth", "wild_west"); public static NamespacedKey Bushwacked = NamespacedKey.From("code_rebirth", "bushwacked"); public static NamespacedKey TrashTrashTrash = NamespacedKey.From("code_rebirth", "trash_trash_trash"); public static NamespacedKey NightofBetrayal = NamespacedKey.From("code_rebirth", "night_of_betrayal"); public static NamespacedKey Igotaheadache = NamespacedKey.From("code_rebirth", "i_got_a_headache"); public static NamespacedKey PestControl = NamespacedKey.From("code_rebirth", "pest_control"); public static NamespacedKey PeaceKept = NamespacedKey.From("code_rebirth", "peace_kept"); public static NamespacedKey Timber = NamespacedKey.From("code_rebirth", "timber"); public static NamespacedKey CodeRebirthPlatinum = NamespacedKey.From("code_rebirth", "code_rebirth_platinum"); public static NamespacedKey LoreMaster = NamespacedKey.From("code_rebirth", "lore_master"); public static NamespacedKey CompanyCertified = NamespacedKey.From("code_rebirth", "company_certified"); public static NamespacedKey HappyFamily = NamespacedKey.From("code_rebirth", "happy_family"); public static NamespacedKey HoardingBug = NamespacedKey.From("code_rebirth", "hoarding_bug"); public static NamespacedKey Scalper = NamespacedKey.From("code_rebirth", "scalper"); public static NamespacedKey SomeAssemblyRequired = NamespacedKey.From("code_rebirth", "some_assembly_required"); public static NamespacedKey TheUprooted = NamespacedKey.From("code_rebirth", "the_uprooted"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthAchievementKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthEntityReplacementKeys { public static NamespacedKey BlackCat = NamespacedKey.From("code_rebirth", "black_cat"); public static NamespacedKey BogWood = NamespacedKey.From("code_rebirth", "bog_wood"); public static NamespacedKey Nuts = NamespacedKey.From("code_rebirth", "nuts"); public static NamespacedKey SnailKat = NamespacedKey.From("code_rebirth", "snail_kat"); public static NamespacedKey Lollipop = NamespacedKey.From("code_rebirth", "lollipop"); public static NamespacedKey CaramelApple = NamespacedKey.From("code_rebirth", "caramel_apple"); public static NamespacedKey Snarkies = NamespacedKey.From("code_rebirth", "snarkies"); public static NamespacedKey JimsChips = NamespacedKey.From("code_rebirth", "jims_chips"); public static NamespacedKey KingsTaffy = NamespacedKey.From("code_rebirth", "kings_taffy"); public static NamespacedKey CandyCorn = NamespacedKey.From("code_rebirth", "candy_corn"); public static NamespacedKey Baldys = NamespacedKey.From("code_rebirth", "baldys"); public static NamespacedKey CountWood = NamespacedKey.From("code_rebirth", "count_wood"); public static NamespacedKey FrankenCactoos = NamespacedKey.From("code_rebirth", "franken_cactoos"); public static NamespacedKey Graper = NamespacedKey.From("code_rebirth", "graper"); public static NamespacedKey LordoftheOpera = NamespacedKey.From("code_rebirth", "lord_of_the_opera"); public static NamespacedKey Neko = NamespacedKey.From("code_rebirth", "neko"); public static NamespacedKey OldWorldMonarch = NamespacedKey.From("code_rebirth", "old_world_monarch"); public static NamespacedKey PeaceMassacrer = NamespacedKey.From("code_rebirth", "peace_massacrer"); public static NamespacedKey Princess = NamespacedKey.From("code_rebirth", "princess"); public static NamespacedKey RealisticBunny = NamespacedKey.From("code_rebirth", "realistic_bunny"); public static NamespacedKey Roboman = NamespacedKey.From("code_rebirth", "roboman"); public static NamespacedKey Spacey = NamespacedKey.From("code_rebirth", "spacey"); public static NamespacedKey Spidey = NamespacedKey.From("code_rebirth", "spidey"); public static NamespacedKey Spookstress = NamespacedKey.From("code_rebirth", "spookstress"); public static NamespacedKey Spookyfly = NamespacedKey.From("code_rebirth", "spooky_fly"); public static NamespacedKey TransportingDutchman = NamespacedKey.From("code_rebirth", "transporting_dutchman"); public static NamespacedKey Widow = NamespacedKey.From("code_rebirth", "widow"); public static NamespacedKey Witchy = NamespacedKey.From("code_rebirth", "witchy"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthEntityReplacementKeys).GetField(name)?.GetValue(null)); } } [GeneratedCode("DawnLib", "0.2.2")] public static class CodeRebirthMoonKeys { public static NamespacedKey Haemoglobin = NamespacedKey.From("code_rebirth", "haemoglobin"); public static NamespacedKey Oxyde = NamespacedKey.From("code_rebirth", "oxyde"); public static NamespacedKey? GetByReflection(string name) { return (NamespacedKey)(typeof(CodeRebirthMoonKeys).GetField(name)?.GetValue(null)); } } } namespace CodeRebirth.src { public class CodeRebirthConfig { public ConfigEntry ConfigOxydeEnabledFromStart { get; private set; } public ConfigEntry ConfigDisableTrashCans { get; private set; } public ConfigEntry ConfigRemoveInteriorFog { get; private set; } public ConfigEntry ConfigDontTargetFarEnemies { get; private set; } public ConfigEntry ConfigHazardsDeleteBodies { get; private set; } public ConfigEntry ConfigOnlyOwnerDisablesGal { get; private set; } public ConfigEntry ConfigFloraEnabled { get; set; } public ConfigEntry ConfigRedwoodHeartEnabled { get; private set; } public ConfigEntry ConfigSnowGlobeMusic { get; private set; } public ConfigEntry ConfigRedwoodNormalVolume { get; private set; } public ConfigEntry ConfigRedwoodInShipVolume { get; private set; } public ConfigEntry ConfigRedwoodSpeed { get; private set; } public ConfigEntry ConfigRedwoodShipPadding { get; private set; } public ConfigEntry ConfigRedwoodEyesight { get; private set; } public ConfigEntry ConfigRedwoodCanEatOldBirds { get; private set; } public ConfigEntry ConfigMeteorShowerTimeToLeave { get; private set; } public ConfigEntry ConfigTornadoInsideBeforeThrow { get; private set; } public ConfigEntry ConfigTornadoPullStrength { get; private set; } public ConfigEntry ConfigTornadoSpeed { get; private set; } public ConfigEntry ConfigMeteorSpeed { get; private set; } public ConfigEntry ConfigMinMeteorSpawnCount { get; private set; } public ConfigEntry ConfigMaxMeteorSpawnCount { get; private set; } public ConfigEntry ConfigTornadoInShipVolume { get; private set; } public ConfigEntry ConfigTornadoDefaultVolume { get; private set; } public ConfigEntry ConfigMeteorShowerMeteoriteSpawnChance { get; private set; } public ConfigEntry ConfigMeteorShowerInShipVolume { get; private set; } public ConfigEntry ConfigMeteorHitShip { get; private set; } public ConfigEntry ConfigMeteorsDefaultVolume { get; private set; } public ConfigEntry ConfigTerminalScanFrequency { get; private set; } public ConfigEntry ConfigTerminalScanRange { get; private set; } public ConfigEntry ConfigSeamineScanFrequency { get; private set; } public ConfigEntry ConfigSeamineScanRange { get; private set; } public ConfigEntry ConfigBearTrapsPopTires { get; private set; } public ConfigEntry ConfigOnlyOwnerSeesScanEffects { get; private set; } public ConfigEntry ConfigSeamineTinkCharges { get; private set; } public ConfigEntry ConfigOnlyOwnerSeesScanEffectsTerminalGal { get; private set; } public ConfigEntry ConfigTerminalBotFlyingVolume { get; private set; } public ConfigEntry ConfigCruiserGalAutomatic { get; private set; } public ConfigEntry ConfigTerminalBotAutomatic { get; private set; } public ConfigEntry ConfigWoodenSeedTreeSpawnChance { get; private set; } public ConfigEntry ConfigShockwaveBotAutomatic { get; private set; } public ConfigEntry ConfigShockwaveBotPropellerVolume { get; private set; } public ConfigEntry ConfigShockwaveHoldsFourItems { get; private set; } public ConfigEntry ConfigShockwaveCharges { get; private set; } public ConfigEntry ConfigAllowPowerLevelChangesFromWeather { get; private set; } public ConfigEntry ConfigExtendedLogging { get; set; } public ConfigEntry ConfigFloraGrassCurveSpawnWeight { get; set; } public ConfigEntry ConfigFloraDesertCurveSpawnWeight { get; set; } public ConfigEntry ConfigFloraSnowCurveSpawnWeight { get; set; } public ConfigEntry ConfigSeamineTinkRidingBruceVolume { get; private set; } public ConfigEntry ConfigSeamineTinkAutomatic { get; private set; } public ConfigEntry ConfigMicrowaveVolume { get; private set; } public ConfigEntry ConfigBearTrapVolume { get; private set; } public ConfigEntry ConfigLaserTurretVolume { get; private set; } public ConfigEntry ConfigFlashTurretVolume { get; private set; } public ConfigEntry ConfigBugZapperVolume { get; private set; } public ConfigEntry ConfigACUVolume { get; private set; } public ConfigEntry Config999GalHealCooldown { get; private set; } public ConfigEntry Config999GalHealAmount { get; private set; } public ConfigEntry Config999GalHealSpeed { get; private set; } public ConfigEntry Config999GalHealOnlyInteractedPlayer { get; private set; } public ConfigEntry Config999GalReviveNearbyDeadPlayers { get; private set; } public ConfigEntry Config999GalHealTotalAmount { get; private set; } public ConfigEntry Config999GalReviveCharges { get; private set; } public ConfigEntry Config999GalCompanyMoonRecharge { get; private set; } public ConfigEntry Config999GalFailureChance { get; private set; } public ConfigEntry Config999GalScaleHealAndReviveWithPlayerCount { get; private set; } public ConfigEntry ConfigAirControlUnitKnockbackPower { get; private set; } public ConfigEntry ConfigAirControlUnitDamage { get; private set; } public ConfigEntry ConfigCleanUnusedConfigs { get; private set; } public ConfigEntry ConfigDebugMode { get; private set; } public void InitMainCodeRebirthConfig(ConfigFile configFile) { ConfigExtendedLogging = configFile.Bind("Debug Options", "Debug Mode | Extended Logging", false, "Whether ExtendedLogging is enabled."); ConfigDebugMode = configFile.Bind("Debug Options", "Debug Mode | Hazard Spawning Enabled", false, "Whether debug mode is enabled (for hazard spawning stuff)."); ConfigRemoveInteriorFog = configFile.Bind("Debug Options", "Debug Mode | Remove Interior Fog", false, "Whether zeekerss' horrible interior fog is removed."); ConfigAllowPowerLevelChangesFromWeather = configFile.Bind("General", "Allow Power Level Changes From Weather", true, "Whether power level changes from CodeRebirth weathers are allowed."); ConfigOnlyOwnerDisablesGal = configFile.Bind("General", "Gal AI | Owner Power", false, "Whether only the current owner of the gal can disable her."); ConfigDontTargetFarEnemies = configFile.Bind("General", "Gal AI | Dont Stray Too Far", false, "Whether the Gal AI should stop targetting enemies when she is far from her owner's position."); ConfigHazardsDeleteBodies = configFile.Bind("General", "Hazards | Delete Bodies", true, "Whether hazards like IndustrialFan and LaserTurret should delete player bodies."); ConfigCleanUnusedConfigs = configFile.Bind("General", "Clean Unusued Configs", true, "Whether CodeRebirth should delete old confing information that are unused."); ConfigFloraGrassCurveSpawnWeight = configFile.Bind("Flora Options", "Flora | Grass CurveSpawnWeight", "Vanilla - 0.00,30.00 ; 1.00,60.00 | Custom - 0.00,30.00 ; 1.00,60.00 | Oxyde - 0.00,0.00 ; 1.00,0.00", "MoonName - CurveSpawnWeight for Grass flora (moon tags also work)."); ConfigFloraDesertCurveSpawnWeight = configFile.Bind("Flora Options", "Flora | Desert CurveSpawnWeight", "Vanilla - 0.00,30.00 ; 1.00,60.00 | Custom - 0.00,30.00 ; 1.00,60.00 | Oxyde - 0.00,0.00 ; 1.00,0.00", "MoonName - CurveSpawnWeight for Desert flora (moon tags also work)."); ConfigFloraSnowCurveSpawnWeight = configFile.Bind("Flora Options", "Flora | Snow CurveSpawnWeight", "Vanilla - 0.00,30.00 ; 1.00,60.00 | Custom - 0.00,30.00 ; 1.00,60.00 | Oxyde - 0.00,0.00 ; 1.00,0.00", "MoonName - CurveSpawnWeight for Snowy flora (moon tags also work)."); } public void InitCodeRebirthConfig(ConfigFile configFile) { //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Expected O, but got Unknown //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Expected O, but got Unknown //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Expected O, but got Unknown //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Expected O, but got Unknown //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Expected O, but got Unknown //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Expected O, but got Unknown //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Expected O, but got Unknown //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Expected O, but got Unknown //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Expected O, but got Unknown //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Expected O, but got Unknown //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Expected O, but got Unknown //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Expected O, but got Unknown //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Expected O, but got Unknown //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Expected O, but got Unknown //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Expected O, but got Unknown //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Expected O, but got Unknown ConfigDisableTrashCans = configFile.Bind("Janitor Options", "Janitor | Disable Trash Cans", false, "Whether trash cans are disabled (this is only visually, trash cans still exist)."); ConfigMicrowaveVolume = configFile.Bind("FunctionalMicrowave Options", "Functional Microwave | Volume", 1f, "The volume of the Functional Microwave."); ConfigBearTrapsPopTires = configFile.Bind("BearTrap Options", "Bear Trap | Pop Tires", true, "Whether the bear trap can pop tires."); ConfigBearTrapVolume = configFile.Bind("BearTrap Options", "Bear Trap | Volume", 1f, "The volume of the Bear Trap."); ConfigLaserTurretVolume = configFile.Bind("LaserTurret Options", "Laser Turret | Volume", 1f, "The volume of the Laser Turret."); ConfigFlashTurretVolume = configFile.Bind("FlashTurret Options", "Flash Turret | Volume", 1f, "The volume of the Flash Turret."); ConfigBugZapperVolume = configFile.Bind("BugZapper Options", "Bug Zapper | Volume", 1f, "The volume of the Bug Zapper."); ConfigAirControlUnitDamage = configFile.Bind("AirControlUnit Options", "Air Control Unit | Damage", 15, "Damage that the ACUnit deals to a player on hit"); ConfigAirControlUnitKnockbackPower = configFile.Bind("AirControlUnit Options", "Air Control Unit | Knockback Power", 250f, "The knockback power of the ACUnit."); ConfigACUVolume = configFile.Bind("AirControlUnit Options", "Air Control Unit | Volume", 1f, "The volume of the Air Control Unit."); ConfigCruiserGalAutomatic = configFile.Bind("Cruiser Gal Options", "Cruiser Gal | Automatic Behaviour", false, "Whether the Cruiser Gal will automatically wake up and choose the nearest player as the owner."); ConfigShockwaveCharges = configFile.Bind("Shockwave Bot Options", "Shockwave Gal | Charges", 10, "How many charges the Shockwave Gal has."); ConfigShockwaveHoldsFourItems = configFile.Bind("Shockwave Bot Options", "Shockwave Gal | Holds Four Items", false, "Whether the Shockwave Gal holds four items regardless of singleplayer or multiplayer."); ConfigShockwaveBotPropellerVolume = configFile.Bind("Shockwave Bot Options", "Shockwave Gal | Propeller Volume", 0.75f, new ConfigDescription("Volume of the Shockwave Gal's propeller.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigShockwaveBotAutomatic = configFile.Bind("Shockwave Bot Options", "Shockwave Gal | Automatic Behaviour", false, "Whether the Shockwave Gal will automatically wake up and choose the nearest player as the owner."); ConfigSeamineTinkCharges = configFile.Bind("Seamine Tink Options", "Seamine Gal | Charges", 3, "How many charges the Seamine Gal has."); ConfigSeamineTinkRidingBruceVolume = configFile.Bind("Seamine Tink Options", "Seamine Gal | Riding Bruce Volume", 0.75f, new ConfigDescription("Volume of the Seamine Gal's Riding Bruce.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigSeamineTinkAutomatic = configFile.Bind("Seamine Tink Options", "Seamine Gal | Automatic Behaviour", false, "Whether the Seamine Gal will automatically wake up and choose the nearest player as the owner."); ConfigOnlyOwnerSeesScanEffects = configFile.Bind("Seamine Tink Options", "Seamine Gal | Only Owner Sees Scan Effects", false, "Whether only the owner of the Seamine Gal can see the scan effects."); ConfigSeamineScanRange = configFile.Bind("Seamine Tink Options", "Seamine Gal | Scan Range", 50f, "Range of the Seamine Gal's scan."); ConfigSeamineScanFrequency = configFile.Bind("Seamine Tink Options", "Seamine Gal | Scan Frequency", 17.5f, "The average Frequency time of the Seamine Gal's scan in seconds."); ConfigTerminalBotAutomatic = configFile.Bind("Terminal Bot Options", "Terminal Gal | Automatic Behaviour", false, "Whether the Terminal Gal will automatically wake up and choose the nearest player as the owner."); ConfigOnlyOwnerSeesScanEffectsTerminalGal = configFile.Bind("Terminal Bot Options", "Terminal Gal | Only Owner Sees Scan Effects", false, "Whether only the owner of the Terminal Gal can see the scan effects."); ConfigTerminalScanRange = configFile.Bind("Terminal Bot Options", "Terminal Gal | Scan Range", 50f, "Range of the Terminal Gal's scan."); ConfigTerminalScanFrequency = configFile.Bind("Terminal Bot Options", "Terminal Gal | Scan Frequency", 17.5f, "The average Frequency time of the Terminal Gal's scan in seconds."); ConfigTerminalBotFlyingVolume = configFile.Bind("Terminal Bot Options", "Terminal Gal | Flying Volume", 0.75f, "Volume of the Terminal Gal's Flying animation."); Config999GalHealCooldown = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Heal Cooldown", 10f, "Cooldown between heals by interacting on the gal."); Config999GalHealAmount = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Heal Amount", 100, "Amount healed by interacting on the gal."); Config999GalHealSpeed = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Heal Speed", 10f, "Speed of healing by interacting on the gal (amount of time in seconds it for the gal to finish healing)."); Config999GalHealTotalAmount = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Healing Capacity", 200, "How much healing the SCP 999 Gal has per orbit."); Config999GalReviveCharges = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Revive Charges", 2, "How many revive charges the SCP 999 Gal has per orbit."); Config999GalCompanyMoonRecharge = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Company Moon Recharge", true, "Whether the SCP 999 Gal recharges once per visiting company moon on last day."); Config999GalFailureChance = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Failure Chance", 15f, "Failure chance of the SCP 999 Gal."); Config999GalHealOnlyInteractedPlayer = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Heal Only Interacted Player", false, "Whether the gal can heal only the player that interacts with her."); Config999GalReviveNearbyDeadPlayers = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Revive Nearby Dead Players", true, "Whether the gal can revive nearby dead bodies."); Config999GalScaleHealAndReviveWithPlayerCount = configFile.Bind("SCP 999 Gal Options", "SCP 999 Gal | Scale Heal and Revive with Player Count", true, "Whether the gal scales the heals and revives with player count."); ConfigTornadoSpeed = configFile.Bind("Tornado Options", "Tornados | Speed", 7f, new ConfigDescription("Speed of tornados.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); ConfigTornadoPullStrength = configFile.Bind("Tornado Options", "Tornados | Pull Strength", 20f, new ConfigDescription("Pull strength of tornados.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); ConfigTornadoInsideBeforeThrow = configFile.Bind("Tornado Options", "Tornados | Inside Before Throw", 10f, new ConfigDescription("Timer of being inside tornado before you get flung the hell out (50 if you never wanna be thrown).", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 50f), Array.Empty())); ConfigTornadoDefaultVolume = configFile.Bind("Tornado Options", "Tornados | Default Volume", 1f, new ConfigDescription("Default volume of tornados.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigTornadoInShipVolume = configFile.Bind("Tornado Options", "Tornados | Volume in Ship", 1f, new ConfigDescription("Volume of tornados in the ship.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigRedwoodCanEatOldBirds = configFile.Bind("Redwood Options", "Redwood | Can Eat Old Birds", true, "Whether redwood can eat old birds."); ConfigRedwoodShipPadding = configFile.Bind("Redwood Options", "Redwood | Ship Padding", 10f, new ConfigDescription("How far away the redwood usually stays from the ship.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 999f), Array.Empty())); ConfigRedwoodSpeed = configFile.Bind("Redwood Options", "Redwood | Speed", 5f, new ConfigDescription("Redwood speed.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 999f), Array.Empty())); ConfigRedwoodEyesight = configFile.Bind("Redwood Options", "Redwood | Eyesight", 40f, new ConfigDescription("Redwood eyesight.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 999f), Array.Empty())); ConfigRedwoodNormalVolume = configFile.Bind("Redwood Options", "Redwood | Normal Volume", 1f, new ConfigDescription("Redwood Normal volume.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigRedwoodHeartEnabled = configFile.Bind("Redwood Options", "Redwood | Heart Enabled", true, "Whether redwood heart is enabled."); ConfigRedwoodInShipVolume = configFile.Bind("Redwood Options", "Redwood | In Ship Volume", 0.75f, new ConfigDescription("Redwood in ship volume.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigMaxMeteorSpawnCount = configFile.Bind("MeteorShower Options", "Meteors | Max Spawn Count", 3, new ConfigDescription("Maximum number of meteors to spawn at once every spawn cycle.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 999), Array.Empty())); ConfigMinMeteorSpawnCount = configFile.Bind("MeteorShower Options", "Meteors | Min Spawn Count", 1, new ConfigDescription("Minimum number of meteors to spawn at once every spawn cycle.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 999), Array.Empty())); ConfigMeteorSpeed = configFile.Bind("MeteorShower Options", "Meteors | Speed", 50f, new ConfigDescription("Speed of meteors.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); ConfigMeteorShowerTimeToLeave = configFile.Bind("MeteorShower Options", "MeteorShower | Time To Leave", 0.85f, new ConfigDescription("Normalised time it takes for the meteor shower to leave the moon, 1 being at 12PM~.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigMeteorHitShip = configFile.Bind("MeteorShower Options", "MeteorShower | Meteor Strikes Ship", false, "Allows striking the ship with a meteor."); ConfigMeteorShowerMeteoriteSpawnChance = configFile.Bind("MeteorShower Options", "MeteorShower | Meteorite Spawn Chance", 2.5f, new ConfigDescription("Chance of spawning a meteorite when a meteor is spawned (0 to 100 decimals included).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); ConfigMeteorsDefaultVolume = configFile.Bind("MeteorShower Options", "Meteors | Default Volume", 0.4f, new ConfigDescription("Default Volume of Meteors (between 0 and 1).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigMeteorShowerInShipVolume = configFile.Bind("MeteorShower Options", "MeteorShower | Meteor Volume", 0.3f, new ConfigDescription("Multiplier of the meteors volume for when the player is in the ship and the ship door is closed.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); ConfigSnowGlobeMusic = configFile.Bind("SnowGlobe Options", "Snow Globe | Music", true, "Enables/Disables the music in the snow globe."); } } public class IngameKeybinds : LcInputActions { [InputAction("/r", Name = "PullChain")] public InputAction PullChain { get; set; } = null; [InputAction("/r", Name = "JumpBoost")] public InputAction JumpBoost { get; set; } = null; [InputAction("/r", Name = "PumpSlugger")] public InputAction PumpSlugger { get; set; } = null; [InputAction("/r", Name = "ExhaustFuel")] public InputAction ExhaustFuel { get; set; } = null; [InputAction("/w", Name = "HoverForward")] public InputAction HoverForward { get; set; } = null; [InputAction("/shift", Name = "SprintForward")] public InputAction SprintForward { get; set; } = null; [InputAction("/a", Name = "HoverLeft")] public InputAction HoverLeft { get; set; } = null; [InputAction("/s", Name = "HoverBackward")] public InputAction HoverBackward { get; set; } = null; [InputAction("/d", Name = "HoverRight")] public InputAction HoverRight { get; set; } = null; [InputAction("/space", Name = "HoverUp")] public InputAction HoverUp { get; set; } = null; [InputAction("/c", Name = "DropHoverboard")] public InputAction DropHoverboard { get; set; } = null; [InputAction("/f", Name = "SwitchMode")] public InputAction SwitchMode { get; set; } = null; [InputAction(/*Could not decode attribute arguments.*/)] public InputAction MouseDelta { get; set; } = null; [InputAction(/*Could not decode attribute arguments.*/)] public InputAction MarrowHealPlayer { get; set; } = null; } [BepInPlugin("CodeRebirth", "CodeRebirth", "1.6.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal class MainAssets : AssetBundleLoader { [LoadFromBundle("CodeRebirthUtils.prefab")] public GameObject UtilsPrefab { get; private set; } = null; [LoadFromBundle("EmptyNetworkObject.prefab")] public GameObject EmptyNetworkObject { get; private set; } = null; public MainAssets(AssetBundle bundle) : base(bundle) { } } internal static ManualLogSource Logger = null; internal static readonly Harmony _harmony = new Harmony("CodeRebirth"); internal static IngameKeybinds InputActionsInstance = null; internal const ulong GLITCH_STEAM_ID = 9uL; internal const int BURN_HIT_ID = 745737; public static ConfigFile configFile { get; private set; } = null; public static CodeRebirthConfig ModConfig { get; private set; } = null; public static DuskMod Mod { get; private set; } = null; public static PersistentDataContainer PersistentDataContainer { get; private set; } = null; internal static MainAssets Assets { get; private set; } = null; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; PersistentDataContainer = BepInPluginExtensions.GetPersistentDataContainer((BaseUnityPlugin)(object)this); ((DataContainer)PersistentDataContainer).Set(NamespacedKey.From("code_rebirth", "last_version"), "1.6.9"); configFile = ((BaseUnityPlugin)this).Config; ModConfig = new CodeRebirthConfig { ConfigExtendedLogging = configFile.Bind("Debug Options", "Debug Mode | Extended Logging", false, "Whether ExtendedLogging is enabled.") }; _harmony.PatchAll(typeof(PlayerControllerBPatch)); _harmony.PatchAll(typeof(EnemyAIPatch)); _harmony.PatchAll(typeof(ShovelPatch)); _harmony.PatchAll(typeof(DoorLockPatch)); _harmony.PatchAll(typeof(KeyItemPatch)); _harmony.PatchAll(typeof(RoundManagerPatch)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(NetworkBehaviourPatch)); _harmony.PatchAll(typeof(HDAdditionalLightDataPatch)); ItemDropshipPatch.Init(); KnifeItemPatch.Init(); PlayerControllerBPatch.Init(); EnemyAIPatch.Init(); ShovelPatch.Init(); DoorLockPatch.Init(); SpikeTrapPatch.Init(); EnemyAICollisionDetectPatch.Init(); LandminePatch.Init(); ShotgunItemPatch.Init(); TurretPatch.Init(); SoccerBallPropPatch.Init(); VehicleControllerPatch.Init(); MerchantTipPad.Init(); StoatGun.Init(); CommitKeyToSave.Init(); HauntedTeddyBear.Init(); BearTrapWheelProxy.Init(); EntranceTeleportPatch.Init(); ((Registry)(object)LethalContent.Enemies).OnFreeze += PuppeteersVoodoo.CreateBlacklist; InputActionsInstance = new IngameKeybinds(); ModConfig.InitMainCodeRebirthConfig(configFile); AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "coderebirthasset"); Assets = new MainAssets(val); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); ModConfig.InitCodeRebirthConfig(configFile); Logger.LogInfo((object)"Registering CodeRebirth content."); if (OpenBodyCamCompatibilityChecker.Enabled) { OpenBodyCamCompatibilityChecker.Init(); } if (ModConfig.ConfigCleanUnusedConfigs.Value) { Logger.LogInfo((object)"Cleaning config"); ConfigFileExtensions.ClearUnusedEntries(((BaseUnityPlugin)this).Config); } ((BaseUnityPlugin)this).Config.Save(); Logger.LogInfo((object)"Plugin CodeRebirth is loaded!"); } internal static void ExtendedLogging(object text) { if (ModConfig.ConfigExtendedLogging.Value) { Logger.LogInfo(text); } } } } namespace CodeRebirth.src.Util { public enum CodeRebirthStatusEffects { None, Water, Fire, Smoke } public class CodeRebirthPlayerManager : NetworkSingleton { private bool previousDoorClosed; public static List triggersTampered = new List(); internal static Dictionary dataForPlayer = new Dictionary(); public static event EventHandler? OnDoorStateChange; public void Awake() { if ((Object)(object)StartOfRound.Instance != (Object)null) { previousDoorClosed = StartOfRound.Instance.hangarDoorsClosed; } } public void Update() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } if (previousDoorClosed != StartOfRound.Instance.hangarDoorsClosed) { Plugin.ExtendedLogging("Door opened/closed!!"); CodeRebirthPlayerManager.OnDoorStateChange?.Invoke(null, StartOfRound.Instance.hangarDoorsClosed); } previousDoorClosed = StartOfRound.Instance.hangarDoorsClosed; if (SlowDownEffect.isSlowDownEffectActive) { if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance.localPlayerController.hoveringOverTrigger) && (Object)(object)GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith != (Object)null && !triggersTampered.Contains(GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith)) { InteractTrigger currentTriggerInAnimationWith = GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith; currentTriggerInAnimationWith.timeToHold /= 5f; triggersTampered.Add(GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith); } } else { if (triggersTampered.Count <= 0) { return; } foreach (InteractTrigger item in triggersTampered) { item.timeToHold *= 5f; } triggersTampered.Clear(); } } public static void RevivePlayer(PlayerControllerB player, Vector3 position) { //IL_0040: 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) if (player.isPlayerDead) { if (((NetworkBehaviour)NetworkSingleton.Instance).IsHost) { NetworkSingleton.Instance.RevivePlayerClientRPC(PlayerControllerReference.op_Implicit(player), position); } else { NetworkSingleton.Instance.RevivePlayerServerRPC(PlayerControllerReference.op_Implicit(player), position); } } } [ServerRpc(RequireOwnership = false)] private void RevivePlayerServerRPC(PlayerControllerReference playerRef, Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) RevivePlayerClientRPC(playerRef, position); } [ClientRpc] private void RevivePlayerClientRPC(PlayerControllerReference playerRef, Vector3 position) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = PlayerControllerReference.op_Implicit(playerRef); val.isInsideFactory = false; val.isInElevator = true; val.isInHangarShipRoom = true; val.ResetPlayerBloodObjects(val.isPlayerDead); val.health = 5; val.isClimbingLadder = false; val.clampLooking = false; val.inVehicleAnimation = false; val.disableMoveInput = false; val.disableLookInput = false; val.disableInteract = false; val.ResetZAndXRotation(); ((Collider)val.thisController).enabled = true; if (val.isPlayerDead) { ((Collider)val.thisController).enabled = true; val.isPlayerDead = false; val.isPlayerControlled = true; val.health = 5; val.hasBeenCriticallyInjured = false; val.criticallyInjured = false; val.playerBodyAnimator.SetBool("Limp", false); val.TeleportPlayer(position, false, 0f, false, true); val.parentedToElevatorLastFrame = false; val.overrideGameOverSpectatePivot = null; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val.setPositionOfDeadPlayer = false; val.DisablePlayerModel(((Component)val).gameObject, true, true); ((Behaviour)val.helmetLight).enabled = false; val.Crouch(false); Animator playerBodyAnimator = val.playerBodyAnimator; if (playerBodyAnimator != null) { playerBodyAnimator.SetBool("Limp", false); } val.bleedingHeavily = false; if ((Object)(object)val.deadBody != (Object)null) { ((Behaviour)val.deadBody).enabled = false; ((Component)val.deadBody).gameObject.SetActive(false); } val.bleedingHeavily = true; val.deadBody = null; val.activatingItem = false; val.twoHanded = false; val.inShockingMinigame = false; val.inSpecialInteractAnimation = false; val.freeRotationInInteractAnimation = false; val.disableSyncInAnimation = false; val.inAnimationWithEnemy = null; val.holdingWalkieTalkie = false; val.speakingToWalkieTalkie = false; val.isSinking = false; val.isUnderwater = false; val.sinkingValue = 0f; val.statusEffectAudio.Stop(); val.DisableJetpackControlsLocally(); val.mapRadarDotAnimator.SetBool("dead", false); val.hasBegunSpectating = false; val.externalForceAutoFade = Vector3.zero; val.hinderedMultiplier = 1f; val.isMovementHindered = 0; val.sourcesCausingSinking = 0; val.reverbPreset = StartOfRound.Instance.shipReverb; SoundManager.Instance.earsRingingTimer = 0f; val.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)] = 1f; SoundManager.Instance.SetPlayerPitch(1f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)); if ((Object)(object)val.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent().overridingLowPass = false; } HUDManager.Instance.UpdateBoxesSpectateUI(); HUDManager.Instance.UpdateSpectateBoxSpeakerIcons(); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val) { val.bleedingHeavily = false; val.criticallyInjured = false; val.health = 5; HUDManager.Instance.UpdateHealthUI(5, true); Animator playerBodyAnimator2 = val.playerBodyAnimator; if (playerBodyAnimator2 != null) { playerBodyAnimator2.SetBool("Limp", false); } val.spectatedPlayerScript = null; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val); StartOfRound.Instance.SetPlayerObjectExtrapolate(false); ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); } StartOfRound.Instance.allPlayersDead = false; StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.UpdatePlayerVoiceEffects(); } } public class CRPlayerData { public bool Water = false; public bool Fire = false; public bool Smoke = false; public bool ridingHoverboard = false; public bool flingingAway = false; public bool flung = false; public bool pseudoDead = false; public bool isJumping = false; public Hoverboard? hoverboardRiding; public List playerColliders = new List(); } internal static class PlayerControllerBExtensions { internal enum ApplyEffectResults : sbyte { Applied, Removed, None } internal static ApplyEffectResults ApplyStatusEffect(this PlayerControllerB player, CodeRebirthStatusEffects effect, float range, float distance) { if (distance < range && !player.HasEffectActive(effect)) { player.ApplyStatusEffect(effect, isActive: true); return ApplyEffectResults.Applied; } if (distance >= range && player.HasEffectActive(effect)) { player.ApplyStatusEffect(effect, isActive: false); return ApplyEffectResults.Removed; } if (player.HasEffectActive(effect) && effect == CodeRebirthStatusEffects.Fire) { CodeRebirthUtils.Instance.FireyVolume.weight = Mathf.Clamp01(range / distance); } else if (player.HasEffectActive(effect) && effect == CodeRebirthStatusEffects.Smoke) { CodeRebirthUtils.Instance.SmokyVolume.weight = Mathf.Clamp01(range / distance); } return ApplyEffectResults.None; } internal static void ApplyStatusEffect(this PlayerControllerB player, CodeRebirthStatusEffects effect, bool isActive) { if (player.ContainsCRPlayerData()) { CRPlayerData cRPlayerData = player.GetCRPlayerData(); switch (effect) { case CodeRebirthStatusEffects.Water: cRPlayerData.Water = isActive; break; case CodeRebirthStatusEffects.Fire: CodeRebirthUtils.Instance.FireyVolume.weight = 0f; cRPlayerData.Fire = isActive; break; case CodeRebirthStatusEffects.Smoke: CodeRebirthUtils.Instance.SmokyVolume.weight = 0f; cRPlayerData.Smoke = isActive; break; } } } internal static bool HasEffectActive(this PlayerControllerB player, CodeRebirthStatusEffects effect) { if (!player.ContainsCRPlayerData()) { return false; } CRPlayerData cRPlayerData = player.GetCRPlayerData(); if (1 == 0) { } bool result = effect switch { CodeRebirthStatusEffects.Water => cRPlayerData.Water, CodeRebirthStatusEffects.Fire => cRPlayerData.Fire, CodeRebirthStatusEffects.Smoke => cRPlayerData.Smoke, _ => false, }; if (1 == 0) { } return result; } internal static CRPlayerData GetCRPlayerData(this PlayerControllerB player) { return CodeRebirthPlayerManager.dataForPlayer[player]; } internal static bool ContainsCRPlayerData(this PlayerControllerB player) { return CodeRebirthPlayerManager.dataForPlayer.ContainsKey(player); } internal static void AddCRPlayerData(this PlayerControllerB player) { CodeRebirthPlayerManager.dataForPlayer.Add(player, new CRPlayerData()); player.GetCRPlayerData().playerColliders = new List(((Component)player).GetComponentsInChildren()); } internal static bool IsJumping(this PlayerControllerB player) { return player.GetCRPlayerData().isJumping; } internal static void SetIsJumping(this PlayerControllerB player, bool isJumping) { player.GetCRPlayerData().isJumping = isJumping; } internal static bool IsPseudoDead(this PlayerControllerB player) { return player.GetCRPlayerData().pseudoDead; } internal static bool SetPseudoDead(this PlayerControllerB player, bool pseudoDead) { return player.GetCRPlayerData().pseudoDead = pseudoDead; } internal static Hoverboard? TryGetHoverboardRiding(this PlayerControllerB player) { return player.GetCRPlayerData().hoverboardRiding; } internal static void SetHoverboardRiding(this PlayerControllerB player, Hoverboard? hoverboard) { player.GetCRPlayerData().ridingHoverboard = Object.op_Implicit((Object)(object)hoverboard); } internal static bool IsRidingHoverboard(this PlayerControllerB player) { return player.GetCRPlayerData().ridingHoverboard; } internal static void SetRidingHoverboard(this PlayerControllerB player, bool ridingHoverboard) { player.GetCRPlayerData().ridingHoverboard = ridingHoverboard; } internal static bool HasFlung(this PlayerControllerB player) { return player.GetCRPlayerData().flung; } internal static void SetFlung(this PlayerControllerB player, bool flung) { player.GetCRPlayerData().flung = flung; } internal static bool IsFlingingAway(this PlayerControllerB player) { return player.GetCRPlayerData().flingingAway; } internal static void SetFlingingAway(this PlayerControllerB player, bool flingingAway) { player.GetCRPlayerData().flingingAway = flingingAway; } internal static IEnumerable GetPlayerColliders(this PlayerControllerB player) { return player.GetCRPlayerData().playerColliders; } } internal class CodeRebirthUtils : NetworkBehaviour { public Material WireframeMaterial = null; public Shader SeeThroughShader = null; public Volume FireyVolume = null; public Volume SmokyVolume = null; public Volume CloseEyeVolume = null; public static List EntrancePoints = new List(); internal ShipAnimator shipAnimator = null; internal static HashSet<(Light light, HDAdditionalLightData hDAdditionalLightData)> currentRoundLightData = new HashSet<(Light, HDAdditionalLightData)>(); internal Dictionary enemyDollarBillDropRate = new Dictionary(); internal Random CRRandom = new Random(); private int _indexToSpawn = 0; internal static CodeRebirthUtils Instance { get; private set; } = null; public override void OnNetworkSpawn() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); ((Component)this).gameObject.AddComponent(); if (ContentHandler.Instance.DevTools != null && Plugin.ModConfig.ConfigDebugMode.Value && ((NetworkBehaviour)this).IsHost) { NetworkObjectReference netObjRefXuBucket = SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.CrispXuBuck].Item, Vector3.zero); NetworkObjectReference netObjRefDebugStick = SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.DebugStick].Item, Vector3.zero); NetworkObjectReference netObjRefStoatGun = SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.StoatGun].Item, Vector3.zero); ((MonoBehaviour)this).StartCoroutine(GiveItemsToPlayer(netObjRefDebugStick, netObjRefXuBucket, netObjRefStoatGun)); } Instance = this; HandleEnemyDropRates(); CRRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); shipAnimator = ((Component)StartOfRound.Instance.shipAnimatorObject).gameObject.AddComponent(); } private IEnumerator GiveItemsToPlayer(NetworkObjectReference netObjRefDebugStick, NetworkObjectReference netObjRefXuBucket, NetworkObjectReference netObjRefStoatGun) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.15f); CRUtilities.MakePlayerGrabObject(GameNetworkManager.Instance.localPlayerController, NetworkObjectReference.op_Implicit(netObjRefXuBucket).GetComponent()); yield return (object)new WaitForSeconds(0.15f); CRUtilities.MakePlayerGrabObject(GameNetworkManager.Instance.localPlayerController, NetworkObjectReference.op_Implicit(netObjRefDebugStick).GetComponent()); yield return (object)new WaitForSeconds(0.15f); CRUtilities.MakePlayerGrabObject(GameNetworkManager.Instance.localPlayerController, NetworkObjectReference.op_Implicit(netObjRefStoatGun).GetComponent()); } private void HandleEnemyDropRates() { if (ContentHandler.Instance.Merchant == null) { return; } IEnumerable enumerable = from s in ((AssetBundleLoader)(object)ContentHandler.Instance.Merchant).GetConfig("Money | Enemy Drop Rates").Value.Split(',') select s.Trim(); foreach (string item in enumerable) { string[] split = item.Split(':'); DawnEnemyInfo? obj = ((Registry)(object)LethalContent.Enemies).Values.FirstOrDefault((Func)((DawnEnemyInfo et) => (Object)(object)et.EnemyType != (Object)null && !string.IsNullOrEmpty(et.EnemyType.enemyName) && et.EnemyType.enemyName.Equals(split[0], StringComparison.OrdinalIgnoreCase))); EnemyType val = ((obj != null) ? obj.EnemyType : null); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Couldn't find enemy of name '" + split[0] + "' for the money drop rate config!")); continue; } float num = float.Parse(split[1], NumberStyles.Float, CultureInfo.InvariantCulture); Plugin.ExtendedLogging($"{val.enemyName} has a drop rate of {num}"); enemyDollarBillDropRate.Add(val, num); } } public void PlayerPressedJump(PlayerControllerB player) { player.SetIsJumping(isJumping: true); foreach (Mountaineer instance in Mountaineer.Instances) { instance.JumpActionTriggered(player); } } public void PlayerPressedInteract(PlayerControllerB player) { foreach (Mountaineer instance in Mountaineer.Instances) { instance.InteractActionTriggered(player); } } [ServerRpc(RequireOwnership = false)] public void DamagePlayerOnOwnerServerRpc(PlayerControllerReference playerControllerB, int damageAmount, bool hasDamageSFX, int causeOfDeathInt, int deathAnimationInt, bool fallDamage, Vector3 force) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) DamagePlayerOnOwnerClientRpc(playerControllerB, damageAmount, hasDamageSFX, causeOfDeathInt, deathAnimationInt, fallDamage, force); } [ClientRpc] public void DamagePlayerOnOwnerClientRpc(PlayerControllerReference playerControllerB, int damageAmount, bool hasDamageSFX, int causeOfDeathInt, int deathAnimationInt, bool fallDamage, Vector3 force) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerBeingDamaged = PlayerControllerReference.op_Implicit(playerControllerB); DamagePlayerOnOwner(playerBeingDamaged, damageAmount, hasDamageSFX, causeOfDeathInt, deathAnimationInt, fallDamage, force); } private void DamagePlayerOnOwner(PlayerControllerB playerBeingDamaged, int damageNumber, bool hasDamageSFX, int causeOfDeathInt, int deathAnimationInt, bool fallDamage, Vector3 force) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) playerBeingDamaged.DamagePlayer(damageNumber, hasDamageSFX, true, (CauseOfDeath)causeOfDeathInt, deathAnimationInt, fallDamage, force); } [ServerRpc(RequireOwnership = false)] public void KillPlayerOnOwnerServerRpc(PlayerControllerReference playerControllerB, bool spawnBody, int causeOfDeathInt, int deathAnimationInt, Vector3 positionOffset) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) KillPlayerOnOwnerClientRpc(playerControllerB, spawnBody, causeOfDeathInt, deathAnimationInt, positionOffset); } [ClientRpc] public void KillPlayerOnOwnerClientRpc(PlayerControllerReference playerControllerB, bool spawnBody, int causeOfDeathInt, int deathAnimationInt, Vector3 positionOffset) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerBeingDamaged = PlayerControllerReference.op_Implicit(playerControllerB); KillPlayerOnOwner(playerBeingDamaged, spawnBody, causeOfDeathInt, deathAnimationInt, positionOffset); } private void KillPlayerOnOwner(PlayerControllerB playerBeingDamaged, bool spawnBody, int causeOfDeathInt, int deathAnimationInt, Vector3 positionOffset) { //IL_0003: 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) playerBeingDamaged.KillPlayer(playerBeingDamaged.velocityLastFrame, spawnBody, (CauseOfDeath)causeOfDeathInt, deathAnimationInt, positionOffset, false); } [ServerRpc(RequireOwnership = false)] public void KillEnemyOnOwnerServerRpc(NetworkBehaviourReference networkBehaviourReference, bool overrideDestroy) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) KillEnemyOnOwnerClientRpc(networkBehaviourReference, overrideDestroy); } [ClientRpc] public void KillEnemyOnOwnerClientRpc(NetworkBehaviourReference networkBehaviourReference, bool overrideDestroy) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown EnemyAI enemyAI = (EnemyAI)NetworkBehaviourReference.op_Implicit(networkBehaviourReference); KillEnemyOnOwner(enemyAI, overrideDestroy); } private void KillEnemyOnOwner(EnemyAI enemyAI, bool overrideDestroy) { if (((NetworkBehaviour)enemyAI).IsOwner) { enemyAI.KillEnemyOnOwnerClient(overrideDestroy); } } public void SpawnFakeSnailCat(PlayerControllerB lastOwner, Vector3 originalScale, string currentName, float shiftHash) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference val = Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.FakeSnailCat].Item, ((Component)this).transform.position); FakeSnailCat component = ((Component)NetworkObjectReference.op_Implicit(val)).GetComponent(); component.lastOwner = lastOwner; component.localScale = originalScale; component.snailCatName = currentName; component.shiftHash = shiftHash; } [ServerRpc(RequireOwnership = false)] public void ReactToVehicleCollisionServerRpc(int obstacleId) { ReactToVehicleCollisionClientRpc(obstacleId); } [ClientRpc] public void ReactToVehicleCollisionClientRpc(int obstacleId) { if (ReactToVehicleCollision.TryGetById(obstacleId, out ReactToVehicleCollision result) && (Object)(object)result != (Object)null) { result.InvokeCollisionEvent(); } else { Plugin.Logger.LogError((object)$"ReactToVehicleCollision with ID {obstacleId} not found!"); } } [ServerRpc(RequireOwnership = false)] public void SpawnRandomCRHazardServerRpc(Vector3 position) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging("Spawning CR Hazard with index: " + _indexToSpawn); if (position == Vector3.zero) { Plugin.Logger.LogError((object)"Trying to spawn a hazard at Vector3.zero!"); return; } List list = ((Registry)(object)LethalContent.MapObjects).Values.ToList(); GameObject mapObjectPrefab = list[_indexToSpawn].GetMapObjectPrefab(); if ((Object)(object)mapObjectPrefab != (Object)null) { GameObject val = Object.Instantiate(mapObjectPrefab, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); NetworkObject val2 = default(NetworkObject); if (val.TryGetComponent(ref val2)) { val2.Spawn(true); } } _indexToSpawn++; if (_indexToSpawn >= list.Count - 1) { _indexToSpawn = 0; } } [ServerRpc(RequireOwnership = false)] public void SpawnScrapServerRpc(NamespacedKey itemKey, Vector3 position, bool isQuest = false, bool defaultRotation = true, int valueIncrease = 0) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) DawnItemInfo val = default(DawnItemInfo); if (!((Registry)(object)LethalContent.Items).TryGetValue(itemKey, ref val)) { Plugin.Logger.LogError((object)$"'{itemKey}' is not registered through DawnLib!"); } else { SpawnScrap(val.Item, position, isQuest, defaultRotation, valueIncrease); } } public NetworkObjectReference SpawnScrap(Item? item, Vector3 position, bool isQuest = false, bool defaultRotation = true, int valueIncrease = 0, Quaternion rotation = default(Quaternion)) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)item == (Object)null) { return default(NetworkObjectReference); } Vector3 val = position; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 1f, Vector3.down, ref val2, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val2)).point + Vector3.up * item.verticalOffset; } GameObject val3 = Object.Instantiate(item.spawnPrefab, val, Quaternion.identity, (Transform)null); GrabbableObject component = val3.GetComponent(); NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject; networkObject.Spawn(false); int value = (int)((float)Random.Range(item.minValue, item.maxValue) * RoundManager.Instance.scrapValueMultiplier) + valueIncrease; SyncScanNodeParentRotationsAndFallRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)component), position, val, defaultRotation ? Quaternion.Euler(item.restingRotation) : rotation, value); if (isQuest) { StartUIForItemServerRpc(NetworkObjectReference.op_Implicit(val3)); } return new NetworkObjectReference(val3); } [Rpc(/*Could not decode attribute arguments.*/)] private void SyncScanNodeParentRotationsAndFallRpc(NetworkBehaviourReference grabbableObjectReference, Vector3 spawnPosition, Vector3 targetPosition, Quaternion rotation, int value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ((MonoBehaviour)this).StartCoroutine(SyncScanNodeParentRotationsAndFall((GrabbableObject)NetworkBehaviourReference.op_Implicit(grabbableObjectReference), spawnPosition, targetPosition, rotation, value)); } private IEnumerator SyncScanNodeParentRotationsAndFall(GrabbableObject grabbableObject, Vector3 spawnPosition, Vector3 targetPosition, Quaternion rotation, int value) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) NetworkObject netObj = ((NetworkBehaviour)grabbableObject).NetworkObject; yield return (object)new WaitUntil((Func)(() => netObj.IsSpawned)); grabbableObject.SetScrapValue(value); if (netObj.AutoObjectParentSync && ((NetworkBehaviour)this).IsServer) { ((Component)netObj).transform.SetParent(StartOfRound.Instance.propsContainer, true); } else if (!netObj.AutoObjectParentSync) { ((Component)netObj).transform.SetParent(StartOfRound.Instance.propsContainer, true); } Plugin.ExtendedLogging("This object just spawned: " + ((Object)((Component)netObj).gameObject).name); ((MonoBehaviour)this).StartCoroutine(ForceRotationForABit(((Component)netObj).gameObject, rotation)); ScanNodeProperties scanNodeProperties = ((Component)grabbableObject).GetComponentInChildren(); if ((Object)(object)scanNodeProperties != (Object)null) { scanNodeProperties.scrapValue = value; scanNodeProperties.subText = $"Value: ${value}"; grabbableObject.scrapValue = value; } yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)grabbableObject.scrapValue; grabbableObject.startFallingPosition = StartOfRound.Instance.propsContainer.InverseTransformPoint(spawnPosition); grabbableObject.targetFloorPosition = StartOfRound.Instance.propsContainer.InverseTransformPoint(targetPosition); grabbableObject.InitializeAfterPositioning(); grabbableObject.EnableItemMeshes(true); grabbableObject.EnablePhysics(true); } private IEnumerator ForceRotationForABit(GameObject go, Quaternion rotation) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return null; float duration = 0.25f; while (duration > 0f) { duration -= Time.deltaTime; go.transform.rotation = rotation; yield return null; } } [ServerRpc(RequireOwnership = false)] public void StartUIForItemServerRpc(NetworkObjectReference go) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) StartUIForItemClientRpc(go); } [ClientRpc] public void StartUIForItemClientRpc(NetworkObjectReference go) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) DuckUI.Instance.itemUI.StartUIforItem(NetworkObjectReference.op_Implicit(go).GetComponent()); NetworkObjectReference.op_Implicit(go).AddComponent(); } public T? CreateFallingObject(GameObject prefab, Vector3 origin, Vector3 target, float speed) where T : FallingObjectBehaviour { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"creating falling object: {((Object)prefab).name} going from {origin} to {target}"); GameObject val = Object.Instantiate(prefab, origin, Quaternion.identity); T fallingObjectBehaviour = val.GetComponent(); if ((Object)(object)fallingObjectBehaviour == (Object)null) { Plugin.Logger.LogError((object)$"FallingObjectBehaviour Component on GameObject: {prefab} does not exist."); return null; } NetworkObjectExtensions.OnSpawn(((NetworkBehaviour)fallingObjectBehaviour).NetworkObject, (Action)delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) fallingObjectBehaviour.SetupFallingObjectServerRpc(origin, target, speed); }); ((NetworkBehaviour)fallingObjectBehaviour).NetworkObject.Spawn(false); return fallingObjectBehaviour; } } } namespace CodeRebirth.src.Util.Timer { public enum TimerExecutionTime { Update, FixedUpdate, LateUpdate } public class TimerCreateParams(float duration, TimerExecutionTime executionTime, bool loop) { public float duration = duration; public TimerExecutionTime executionTime = executionTime; public bool loop = loop; } public class Timer { public TimerExecutionTime executionTime; private Func _conditionalUpdate = () => true; public float Elapsed { get; private set; } public float Duration { get; private set; } public bool IsPaused { get; private set; } = true; public bool IsFinished { get; private set; } public bool IsLooping { get; private set; } public bool IsRunning => !IsPaused && !IsFinished; public float NormalizedProgress => Mathf.Clamp01(Elapsed / Duration); public Func ConditionalUpdate { get { return _conditionalUpdate; } set { _conditionalUpdate = value ?? _conditionalUpdate; } } public event Action OnStart; public event Action OnUpdate; public event Action OnFinish; public Timer(TimerCreateParams createParams) : this(createParams.duration, createParams.executionTime, createParams.loop) { } public Timer(float duration, TimerExecutionTime executionTime, bool loop = false, bool autostart = false) { Duration = duration; this.executionTime = executionTime; IsLooping = loop; Elapsed = 0f; IsPaused = true; if (autostart) { Start(); } } public static Timer CreateTimer(TimerCreateParams createParams, Action onStart, Action onUpdate, Action onFinish) { Timer timer = new Timer(createParams); timer.OnStart += onStart; timer.OnUpdate += onUpdate; timer.OnFinish += onFinish; return timer; } public static Timer CreateAutoTimer(TimerCreateParams createParams, Action onStart, Action onUpdate, Action onFinish) { Timer timer = CreateTimer(createParams, onStart, onUpdate, onFinish); timer.Start(); return timer; } public void Start() { if (IsPaused) { IsPaused = false; IsFinished = false; this.OnStart?.Invoke(this); Singleton.Instance?.RegisterTimer(this); } } public void Pause() { if (!IsPaused) { IsPaused = true; } } public void Stop() { IsPaused = true; Elapsed = 0f; Singleton.Instance?.UnRegisterTimer(this); } public void Reset() { Elapsed = 0f; } public void Restart() { Elapsed = 0f; Start(); } public void SetDuration(float duration) { Duration = duration; } public void Update(float deltaTime) { if (!_conditionalUpdate() || IsPaused || IsFinished) { return; } Elapsed += deltaTime; if (Elapsed > Duration) { Elapsed = Duration; } this.OnUpdate?.Invoke(this); if (Elapsed >= Duration) { this.OnFinish?.Invoke(this); if (IsLooping) { Elapsed -= Duration; IsFinished = false; this.OnStart?.Invoke(this); } else { Elapsed = Duration; IsFinished = true; Singleton.Instance?.UnRegisterTimer(this); } } } } public class TimerExecutor : Singleton { public readonly HashSet ActiveTimers = new HashSet(); public readonly List UpdateTimers = new List(); public readonly List FixedUpdateTimers = new List(); public readonly List LateUpdateTimers = new List(); public void RegisterTimer(Timer timer) { if (ActiveTimers.Add(timer)) { switch (timer.executionTime) { case TimerExecutionTime.Update: UpdateTimers.Add(timer); break; case TimerExecutionTime.FixedUpdate: FixedUpdateTimers.Add(timer); break; case TimerExecutionTime.LateUpdate: LateUpdateTimers.Add(timer); break; } } } public void UnRegisterTimer(Timer timer) { ActiveTimers.Remove(timer); UpdateTimers.Remove(timer); FixedUpdateTimers.Remove(timer); LateUpdateTimers.Remove(timer); } private void Update() { RunTimers(UpdateTimers, Time.deltaTime); } private void FixedUpdate() { RunTimers(FixedUpdateTimers, Time.fixedDeltaTime); } private void LateUpdate() { RunTimers(LateUpdateTimers, Time.deltaTime); } private void RunTimers(List timerList, float delta) { for (int num = timerList.Count - 1; num >= 0; num--) { Timer timer = timerList[num]; try { timer.Update(delta); if (timer.IsFinished) { UnRegisterTimer(timer); } } catch (Exception ex) { Plugin.Logger.LogError((object)$"[TimerSystem]: {timer} failed during update: {ex.Message}\n{ex.StackTrace}"); UnRegisterTimer(timer); } } } } } namespace CodeRebirth.src.Util.PreloaderInjections { [HandleErrors(/*Could not decode attribute arguments.*/)] [InjectInterface(typeof(EntranceTeleport))] internal interface IOnDestroyMethod { [HandleErrors(/*Could not decode attribute arguments.*/)] void OnDestroy(); } } namespace CodeRebirth.src.Util.Extensions { public static class GameObjectUtils { public static bool RequiresComponent(this GameObject gameObject, Type componentType) { Component[] components = gameObject.GetComponents(); foreach (Component val in components) { object[] customAttributes = ((object)val).GetType().GetCustomAttributes(inherit: true); foreach (object obj in customAttributes) { RequireComponent val2 = (RequireComponent)((obj is RequireComponent) ? obj : null); if (val2 == null) { continue; } Type type = val2.m_Type0; if ((object)type == null || !type.IsAssignableFrom(componentType)) { Type type2 = val2.m_Type1; if ((object)type2 == null || !type2.IsAssignableFrom(componentType)) { Type type3 = val2.m_Type2; if ((object)type3 == null || !type3.IsAssignableFrom(componentType)) { continue; } } } return true; } } return false; } } public static class NetworkAnimatorExtensions { public static void SetTriggerOnServer(this NetworkAnimator animator, string triggerName) { if (NetworkManager.Singleton.IsServer) { animator.SetTrigger(triggerName); } } public static void SetTriggerOnServer(this NetworkAnimator animator, int triggerHash) { if (NetworkManager.Singleton.IsServer) { animator.SetTrigger(triggerHash, true); } } } } namespace CodeRebirth.src.Patches { public static class DoorLockPatch { [CompilerGenerated] private static class <>O { public static hook_OnTriggerStay <0>__DoorLock_OnTriggerStay; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__DoorLock_OnTriggerStay; if (obj == null) { hook_OnTriggerStay val = DoorLock_OnTriggerStay; <>O.<0>__DoorLock_OnTriggerStay = val; obj = (object)val; } DoorLock.OnTriggerStay += (hook_OnTriggerStay)obj; } private static void DoorLock_OnTriggerStay(orig_OnTriggerStay orig, DoorLock self, Collider other) { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)self).IsServer && !self.isLocked && !self.isDoorOpened) { if (((Component)other).gameObject.layer == 19 && ((Object)((Component)other).gameObject).name == "DoorCollider") { self.enemyDoorMeter += Time.deltaTime * 0.5f; if (self.enemyDoorMeter > 1f) { self.enemyDoorMeter = 0f; ((Component)self).gameObject.GetComponent().TriggerAnimationNonPlayer(false, true, false); self.OpenDoorAsEnemyServerRpc(); } } else if (((Component)other).gameObject.layer == 19 && ((Object)((Component)other).gameObject).name == "ShockwaveGalDoorCollider") { float num = 0f; GalAI component = ((Component)((Component)other).gameObject.transform.parent).GetComponent(); if ((Object)(object)component != (Object)null) { num = component.DoorOpeningSpeed; } self.enemyDoorMeter += Time.deltaTime * num; if (self.enemyDoorMeter > 1f) { self.enemyDoorMeter = 0f; ((Component)self).gameObject.GetComponent().TriggerAnimationNonPlayer(false, true, false); self.OpenDoorAsEnemyServerRpc(); } } else if (((Component)other).gameObject.layer == 19 && ((Object)((Component)other).gameObject).name == "MicrowaveCollider") { self.enemyDoorMeter += Time.deltaTime * 0.5f; if (self.enemyDoorMeter > 1f) { self.enemyDoorMeter = 0f; ((Component)self).gameObject.GetComponent().TriggerAnimationNonPlayer(false, true, false); self.OpenDoorAsEnemyServerRpc(); } } } orig.Invoke(self, other); } } public static class EnemyAICollisionDetectPatch { [CompilerGenerated] private static class <>O { public static hook_IHittable_Hit <0>__EnemyAICollisionDetect_IHittable_Hit; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__EnemyAICollisionDetect_IHittable_Hit; if (obj == null) { hook_IHittable_Hit val = EnemyAICollisionDetect_IHittable_Hit; <>O.<0>__EnemyAICollisionDetect_IHittable_Hit = val; obj = (object)val; } EnemyAICollisionDetect.IHittable_Hit += (hook_IHittable_Hit)obj; } private static bool EnemyAICollisionDetect_IHittable_Hit(orig_IHittable_Hit orig, EnemyAICollisionDetect self, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit.currentlyHeldObjectServer != (Object)null && playerWhoHit.currentlyHeldObjectServer is ScaryShrimp scaryShrimp) { if (scaryShrimp.hitEnemy.Value == 1) { return false; } scaryShrimp.hitEnemy.Value = 1; scaryShrimp.PastHitEnemyServerRpc(self.mainScript.enemyHP); self.mainScript.HitEnemyOnLocalClient(3, hitDirection, playerWhoHit, playHitSFX, hitID); return false; } if ((Object)(object)playerWhoHit != (Object)null) { foreach (PeaceKeeper instance in PeaceKeeper.Instances) { instance.AlertPeaceKeeperToLocalPlayer(playerWhoHit); } } return orig.Invoke(self, force, hitDirection, playerWhoHit, playHitSFX, hitID); } } internal static class EnemyAIPatch { [CompilerGenerated] private static class <>O { public static hook_Start <0>__EnemyAI_Start; public static hook_HitEnemy <1>__EnemyAI_HitEnemy; public static hook_KillEnemy <2>__EnemyAI_KillEnemy; public static hook_Update <3>__EnemyAI_Update; public static hook_OnCollideWithPlayer <4>__EnemyAI_OnCollideWithPlayer; public static Action <5>__FixManeaterForSeamine; } private static Dictionary _slowedEnemies = new Dictionary(); public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown object obj = <>O.<0>__EnemyAI_Start; if (obj == null) { hook_Start val = EnemyAI_Start; <>O.<0>__EnemyAI_Start = val; obj = (object)val; } EnemyAI.Start += (hook_Start)obj; object obj2 = <>O.<1>__EnemyAI_HitEnemy; if (obj2 == null) { hook_HitEnemy val2 = EnemyAI_HitEnemy; <>O.<1>__EnemyAI_HitEnemy = val2; obj2 = (object)val2; } EnemyAI.HitEnemy += (hook_HitEnemy)obj2; object obj3 = <>O.<2>__EnemyAI_KillEnemy; if (obj3 == null) { hook_KillEnemy val3 = EnemyAI_KillEnemy; <>O.<2>__EnemyAI_KillEnemy = val3; obj3 = (object)val3; } EnemyAI.KillEnemy += (hook_KillEnemy)obj3; object obj4 = <>O.<3>__EnemyAI_Update; if (obj4 == null) { hook_Update val4 = EnemyAI_Update; <>O.<3>__EnemyAI_Update = val4; obj4 = (object)val4; } EnemyAI.Update += (hook_Update)obj4; object obj5 = <>O.<4>__EnemyAI_OnCollideWithPlayer; if (obj5 == null) { hook_OnCollideWithPlayer val5 = EnemyAI_OnCollideWithPlayer; <>O.<4>__EnemyAI_OnCollideWithPlayer = val5; obj5 = (object)val5; } EnemyAI.OnCollideWithPlayer += (hook_OnCollideWithPlayer)obj5; ((Registry)(object)LethalContent.Enemies).OnFreeze += FixManeaterForSeamine; } private static void FixManeaterForSeamine() { ((Component)((Registry)(object)LethalContent.Enemies)[EnemyKeys.Maneater].EnemyType.enemyPrefab.transform.Find("BabyMeshContainer").Find("BabyManeaterMesh")).gameObject.layer = 19; } private static void EnemyAI_KillEnemy(orig_KillEnemy orig, EnemyAI self, bool destroy) { //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) orig.Invoke(self, destroy); DawnMapObjectInfo val = default(DawnMapObjectInfo); if (!NetworkManager.Singleton.IsServer || !self.isEnemyDead || !((Registry)(object)LethalContent.MapObjects).TryGetValue(CodeRebirthMapObjectKeys.CrispDollarBill, ref val)) { return; } DawnEnemyAdditionalData val2 = DawnEnemyAdditionalData.CreateOrGet(self); if (val2.KilledByPlayer && CodeRebirthUtils.Instance.enemyDollarBillDropRate.TryGetValue(self.enemyType, out var value)) { float num = value; Plugin.ExtendedLogging($"Rolling to drop Dollar Bill {num}"); if (!(Random.Range(0f, 100f) >= num)) { GameObject val3 = Object.Instantiate(val.GetMapObjectPrefab(), ((Component)self).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); val3.GetComponent().Spawn(true); } } } private static void EnemyAI_OnCollideWithPlayer(orig_OnCollideWithPlayer orig, EnemyAI self, Collider other) { //IL_00e8: 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) PuppeteersVoodoo puppeteersVoodoo = default(PuppeteersVoodoo); if (((Component)other).gameObject.layer != 19 || self.isEnemyDead || !((NetworkBehaviour)self).IsServer || self is Puppeteer || !((Component)other).TryGetComponent(ref puppeteersVoodoo)) { orig.Invoke(self, other); } else { if (puppeteersVoodoo.lastTimeTakenDamageFromEnemy <= 1f) { return; } foreach (EnemyType blacklistedEnemy in PuppeteersVoodoo.blacklistedEnemies) { if ((Object)(object)self.enemyType == (Object)(object)blacklistedEnemy) { return; } } if (self.enemyType.enemyName.Contains("SCP-999")) { puppeteersVoodoo.Hit(-1, ((Component)self).transform.position); } else { puppeteersVoodoo.Hit(1, ((Component)self).transform.position); } } } private static void EnemyAI_Start(orig_Start orig, EnemyAI self) { orig.Invoke(self); if (!StartOfRound.Instance.inShipPhase && RoundManager.Instance.currentLevel.sceneName.Equals("Oxyde")) { self.SetEnemyOutside(true); GameObject val = RoundManager.Instance.outsideAINodes.OrderBy((GameObject x) => Vector3.Distance(x.transform.position, ((Component)self).transform.position)).FirstOrDefault(); if (!((Object)(object)val == (Object)null)) { self.favoriteSpot = val.transform; } } } private static void EnemyAI_Update(orig_Update orig, EnemyAI self) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (_slowedEnemies.ContainsKey(self)) { self.agent.velocity = Vector3.zero; } } private static void EnemyAI_HitEnemy(orig_HitEnemy orig, EnemyAI self, int force, PlayerControllerB? playerWhoHit, bool playHitSFX, int hitID) { if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit.currentlyHeldObjectServer != (Object)null && (Object)(object)playerWhoHit.currentlyHeldObjectServer.itemProperties != (Object)null && playerWhoHit.currentlyHeldObjectServer.itemProperties.isDefensiveWeapon && playerWhoHit.currentlyHeldObjectServer is Mountaineer mountaineer && RandomExtensions.NextFloat(CodeRebirthUtils.Instance.CRRandom, 0f, 100f) <= mountaineer.FreezePercentile) { Plugin.ExtendedLogging("Slowed enemy"); if (_slowedEnemies.ContainsKey(self) && _slowedEnemies[self] != null) { ((MonoBehaviour)self).StopCoroutine(_slowedEnemies[self]); } _slowedEnemies[self] = ((MonoBehaviour)self).StartCoroutine(DelayResetSpeed(self)); } orig.Invoke(self, force, playerWhoHit, playHitSFX, hitID); } private static IEnumerator DelayResetSpeed(EnemyAI self) { yield return (object)new WaitForSeconds(4f); _slowedEnemies.Remove(self); } } public static class EntranceTeleportPatch { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__EntranceTeleport_Awake; public static Action, EntranceTeleport> <1>__EntranceTeleport_OnDestroy; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) object obj = <>O.<0>__EntranceTeleport_Awake; if (obj == null) { hook_Awake val = EntranceTeleport_Awake; <>O.<0>__EntranceTeleport_Awake = val; obj = (object)val; } EntranceTeleport.Awake += (hook_Awake)obj; new Hook((MethodBase)AccessTools.DeclaredMethod(typeof(EntranceTeleport), "OnDestroy", (Type[])null, (Type[])null), (Delegate)new Action, EntranceTeleport>(EntranceTeleport_OnDestroy)); } private static void EntranceTeleport_Awake(orig_Awake orig, EntranceTeleport self) { CodeRebirthUtils.EntrancePoints.Add(self); orig.Invoke(self); } private static void EntranceTeleport_OnDestroy(Action orig, EntranceTeleport self) { CodeRebirthUtils.EntrancePoints.Remove(self); ((NetworkBehaviour)self).OnDestroy(); orig.Invoke(self); } } public static class GiantKiwiPatch { public static void Init() { } } [HarmonyPatch(typeof(HDAdditionalLightData))] internal static class HDAdditionalLightDataPatch { [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void OnEnablePatch(HDAdditionalLightData __instance) { Light item = default(Light); if (((Component)__instance).gameObject.TryGetComponent(ref item)) { CodeRebirthUtils.currentRoundLightData.Add((item, __instance)); } } [HarmonyPatch("OnDisable")] [HarmonyPostfix] private static void OnDisablePatch(HDAdditionalLightData __instance) { Light item = default(Light); if (((Component)__instance).gameObject.TryGetComponent(ref item)) { CodeRebirthUtils.currentRoundLightData.Remove((item, __instance)); } } } public static class ItemDropshipPatch { [CompilerGenerated] private static class <>O { public static hook_Update <0>__ItemDropship_Update; public static hook_ShipLeave <1>__ItemDropship_ShipLeave; public static hook_DeliverVehicleOnServer <2>__ItemDropship_DeliverVehicleOnServer; public static hook_ShipLandedAnimationEvent <3>__ItemDropship_ShipLandedAnimationEvent; public static hook_OpenShipDoorsOnServer <4>__ItemDropship_OpenShipDoorsOnServer; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown object obj = <>O.<0>__ItemDropship_Update; if (obj == null) { hook_Update val = ItemDropship_Update; <>O.<0>__ItemDropship_Update = val; obj = (object)val; } ItemDropship.Update += (hook_Update)obj; object obj2 = <>O.<1>__ItemDropship_ShipLeave; if (obj2 == null) { hook_ShipLeave val2 = ItemDropship_ShipLeave; <>O.<1>__ItemDropship_ShipLeave = val2; obj2 = (object)val2; } ItemDropship.ShipLeave += (hook_ShipLeave)obj2; object obj3 = <>O.<2>__ItemDropship_DeliverVehicleOnServer; if (obj3 == null) { hook_DeliverVehicleOnServer val3 = ItemDropship_DeliverVehicleOnServer; <>O.<2>__ItemDropship_DeliverVehicleOnServer = val3; obj3 = (object)val3; } ItemDropship.DeliverVehicleOnServer += (hook_DeliverVehicleOnServer)obj3; object obj4 = <>O.<3>__ItemDropship_ShipLandedAnimationEvent; if (obj4 == null) { hook_ShipLandedAnimationEvent val4 = ItemDropship_ShipLandedAnimationEvent; <>O.<3>__ItemDropship_ShipLandedAnimationEvent = val4; obj4 = (object)val4; } ItemDropship.ShipLandedAnimationEvent += (hook_ShipLandedAnimationEvent)obj4; object obj5 = <>O.<4>__ItemDropship_OpenShipDoorsOnServer; if (obj5 == null) { hook_OpenShipDoorsOnServer val5 = ItemDropship_OpenShipDoorsOnServer; <>O.<4>__ItemDropship_OpenShipDoorsOnServer = val5; obj5 = (object)val5; } ItemDropship.OpenShipDoorsOnServer += (hook_OpenShipDoorsOnServer)obj5; } private static void ItemDropship_OpenShipDoorsOnServer(orig_OpenShipDoorsOnServer orig, ItemDropship self) { orig.Invoke(self); if ((Object)(object)((Registry)(object)LethalContent.Moons)[CodeRebirthMoonKeys.Oxyde].Level == (Object)(object)RoundManager.Instance.currentLevel) { Plugin.ExtendedLogging("OpenShipDoorsOnServer"); self.shipTimer = 0f; } } private static void ItemDropship_ShipLandedAnimationEvent(orig_ShipLandedAnimationEvent orig, ItemDropship self) { orig.Invoke(self); if (self is CRDropShip cRDropShip) { cRDropShip.audioSource.Stop(); cRDropShip.audioSource.clip = cRDropShip.musicSound; cRDropShip.audioSource.Play(); } } private static void ItemDropship_ShipLeave(orig_ShipLeave orig, ItemDropship self) { if (self is CRDropShip cRDropShip) { cRDropShip.audioSource.Stop(); cRDropShip.audioSource.clip = cRDropShip.leaveSound; cRDropShip.audioSource.Play(); cRDropShip.rumbleSource.Play(); ((ItemDropship)cRDropShip).shipTimer = 0f; } orig.Invoke(self); } private static void ItemDropship_Update(orig_Update orig, ItemDropship self) { orig.Invoke(self); if (self is CRDropShip cRDropShip) { if (!((ItemDropship)cRDropShip).deliveringOrder && ((NetworkBehaviour)cRDropShip).IsServer && ((ItemDropship)cRDropShip).shipTimer < 34f && ((ItemDropship)cRDropShip).shipTimer + cRDropShip.rumbleSource.clip.length >= 40f && !cRDropShip.rumbleSource.isPlaying) { Plugin.ExtendedLogging("PlayRumbleClientRpc"); cRDropShip.PlayRumbleClientRpc(); } if (cRDropShip.rumbleSource.isPlaying) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } } private static void ItemDropship_DeliverVehicleOnServer(orig_DeliverVehicleOnServer orig, ItemDropship self) { if (self is CRDropShip cRDropShip) { ((ItemDropship)cRDropShip).shipTimer = 0f; Plugin.ExtendedLogging("ItemDropship_DeliverVehicleOnServer"); ((ItemDropship)cRDropShip).shipAnimator.SetTrigger("landingVehicle"); } else { orig.Invoke(self); } } } [HarmonyPatch(typeof(KeyItem))] internal static class KeyItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] public static void CustomPickableObjects(KeyItem __instance) { //IL_0037: 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_0056: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || !((NetworkBehaviour)__instance).IsOwner) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward); RaycastHit val2 = default(RaycastHit); Pickable pickable = default(Pickable); if (Physics.Raycast(val, ref val2, 3f, 2816) && ((Component)((RaycastHit)(ref val2)).transform).TryGetComponent(ref pickable) && ((Behaviour)pickable).enabled && pickable.IsLocked) { pickable.UnlockStuffServerRpc(); if (((NetworkBehaviour)__instance).IsSpawned) { ((GrabbableObject)__instance).playerHeldBy.carryWeight = Mathf.Clamp(((GrabbableObject)__instance).playerHeldBy.carryWeight - (((GrabbableObject)__instance).itemProperties.weight - 1f), 1f, 10f); ((GrabbableObject)__instance).playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(((GrabbableObject)__instance).playerHeldBy.ItemSlots, (GrabbableObject)(object)__instance)); } } } } public static class KnifeItemPatch { [CompilerGenerated] private static class <>O { public static hook_HitKnife <0>__KnifeItem_HitKnife; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__KnifeItem_HitKnife; if (obj == null) { hook_HitKnife val = KnifeItem_HitKnife; <>O.<0>__KnifeItem_HitKnife = val; obj = (object)val; } KnifeItem.HitKnife += (hook_HitKnife)obj; } private static void KnifeItem_HitKnife(orig_HitKnife orig, KnifeItem self, bool cancel) { //IL_002d: 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) orig.Invoke(self, cancel); if (Plugin.ModConfig.ConfigDebugMode.Value) { ((GrabbableObject)self).playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)1, 0, false, default(Vector3)); } } } public static class LandminePatch { [CompilerGenerated] private static class <>O { public static hook_SpawnExplosion <0>__Landmine_SpawnExplosion; public static hook_OnTriggerExit <1>__Landmine_OnTriggerExit; public static Manipulator <2>__AffectIExplodeable; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown object obj = <>O.<0>__Landmine_SpawnExplosion; if (obj == null) { hook_SpawnExplosion val = Landmine_SpawnExplosion; <>O.<0>__Landmine_SpawnExplosion = val; obj = (object)val; } Landmine.SpawnExplosion += (hook_SpawnExplosion)obj; object obj2 = <>O.<1>__Landmine_OnTriggerExit; if (obj2 == null) { hook_OnTriggerExit val2 = Landmine_OnTriggerExit; <>O.<1>__Landmine_OnTriggerExit = val2; obj2 = (object)val2; } Landmine.OnTriggerExit += (hook_OnTriggerExit)obj2; object obj3 = <>O.<2>__AffectIExplodeable; if (obj3 == null) { Manipulator val3 = AffectIExplodeable; <>O.<2>__AffectIExplodeable = val3; obj3 = (object)val3; } Landmine.SpawnExplosion += (Manipulator)obj3; } private static void AffectIExplodeable(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[8] { (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 3), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 10), (Instruction i) => ILPatternMatchingExt.MatchLdelemRef(i), (Instruction i) => ILPatternMatchingExt.MatchCallvirt(i, "get_gameObject"), (Instruction i) => ILPatternMatchingExt.MatchCallvirt(i, "GetComponentInChildren"), (Instruction i) => ILPatternMatchingExt.MatchStloc(i, 13), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 13), (Instruction i) => ILPatternMatchingExt.MatchLdnull(i) })) { Plugin.Logger.LogError((object)"Failed to find GetComponentsInChildren etc in Landmine.SpawnExplosion 1"); return; } val.Emit(OpCodes.Ldloc_3); val.Emit(OpCodes.Ldloc_S, (byte)10); val.Emit(OpCodes.Ldelem_Ref); val.Emit(OpCodes.Castclass, typeof(Collider)); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)11); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(LandminePatch), "AffectIExplodeableFromLandmine", (Type[])null, (Type[])null)); if (!val.TryGotoNext((MoveType)0, new Func[8] { (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 3), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 10), (Instruction i) => ILPatternMatchingExt.MatchLdelemRef(i), (Instruction i) => ILPatternMatchingExt.MatchCallvirt(i, "get_gameObject"), (Instruction i) => ILPatternMatchingExt.MatchCallvirt(i, "GetComponentInChildren"), (Instruction i) => ILPatternMatchingExt.MatchStloc(i, 14), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 14), (Instruction i) => ILPatternMatchingExt.MatchLdnull(i) })) { Plugin.Logger.LogError((object)"Failed to find GetComponentsInChildren etc in Landmine.SpawnExplosion 2"); return; } val.Emit(OpCodes.Ldloc_3); val.Emit(OpCodes.Ldloc_S, (byte)10); val.Emit(OpCodes.Ldelem_Ref); val.Emit(OpCodes.Castclass, typeof(Collider)); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)11); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(LandminePatch), "AffectIExplodeableFromLandmine", (Type[])null, (Type[])null)); } private static void AffectIExplodeableFromLandmine(Collider collider, Vector3 explosionPosition, float distanceToExplosion) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) IExplodeable explodeable = default(IExplodeable); if (NetworkManager.Singleton.IsServer && ((Component)collider).TryGetComponent(ref explodeable)) { explodeable.OnExplosion(6, explosionPosition, distanceToExplosion); } } private static void Landmine_OnTriggerExit(orig_OnTriggerExit orig, Landmine self, Collider other) { orig.Invoke(self, other); if (((NetworkBehaviour)self).IsServer && PuppeteersVoodoo.puppeteerList.Count > 0 && ((Component)other).gameObject.layer == 19 && ((Object)((Component)other).gameObject).name.Contains("PuppeteerPuppet")) { self.TriggerMineOnLocalClientByExiting(); } } private static void Landmine_SpawnExplosion(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, GameObject overridePrefab, bool goThroughCar) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar); RaycastHit val = default(RaycastHit); for (int num = PuppeteersVoodoo.puppeteerList.Count - 1; num >= 0; num--) { PuppeteersVoodoo puppeteersVoodoo = PuppeteersVoodoo.puppeteerList[num]; float num2 = Vector3.Distance(((Component)puppeteersVoodoo).transform.position, explosionPosition); if (num2 > 5f) { break; } Plugin.ExtendedLogging($"Hit voodoo doll with landmine: {puppeteersVoodoo}"); if (!Physics.Linecast(explosionPosition, ((Component)puppeteersVoodoo).transform.position + Vector3.up * 0.3f, ref val, 1073742080, (QueryTriggerInteraction)1)) { Vector3 hitDirection = Vector3.Normalize(((Component)puppeteersVoodoo).transform.position - explosionPosition) * 80f / num2; if (num2 < killRange) { puppeteersVoodoo.Hit(10, hitDirection, null, playHitSFX: true); } else if (num2 < damageRange) { puppeteersVoodoo.Hit(2, hitDirection, null, playHitSFX: true); } } } } } [HarmonyPatch(typeof(NetworkBehaviour))] internal static class NetworkBehaviourPatch { [HarmonyPatch("OnNetworkSpawn")] [HarmonyPostfix] private static void OnNetworkSpawnPatch(NetworkBehaviour __instance) { if (__instance.NetworkObject.IsSpawned && ((Component)__instance.NetworkObject).gameObject.layer == 21 && !((Component)__instance.NetworkObject).CompareTag("DoNotSet")) { int priority = 5; if (((Object)((Component)__instance.NetworkObject).gameObject).name.EndsWith("BearTrap")) { priority = 1; } Transporter.objectsWithPriorityToTransport.Add(new GameObjectWithPriority(((Component)__instance.NetworkObject).gameObject, priority)); } } [HarmonyPatch("OnNetworkDespawn")] [HarmonyPostfix] private static void OnNetworkDespawnPatch(NetworkBehaviour __instance) { if (((Component)__instance.NetworkObject).gameObject.layer == 21 && !((Component)__instance.NetworkObject).CompareTag("DoNotSet")) { GameObjectWithPriority item = Transporter.objectsWithPriorityToTransport.FirstOrDefault((GameObjectWithPriority kv) => (Object)(object)kv.gameObject == (Object)(object)((Component)__instance.NetworkObject).gameObject); Transporter.objectsWithPriorityToTransport.Remove(item); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__PlayerControllerB_Awake; public static hook_ConnectClientToPlayerObject <1>__PlayerControllerB_ConnectClientToPlayerObject; public static Manipulator <2>__PlayerControllerB_CheckConditionsForSinkingInQuicksand; public static hook_SetItemInElevator <3>__PlayerControllerB_SetItemInElevator; public static hook_Update <4>__PlayerControllerB_Update; public static hook_LateUpdate <5>__PlayerControllerB_LateUpdate; public static hook_IHittable_Hit <6>__PlayerControllerB_IHittable_Hit; public static hook_DiscardHeldObject <7>__PlayerControllerB_DiscardHeldObject; public static hook_Jump_performed <8>__PlayerControllerB_Jump_performed; public static hook_Interact_performed <9>__PlayerControllerB_Interact_performed; public static hook_StopHoldInteractionOnTrigger <10>__PlayerControllerB_StopHoldInteractionOnTrigger; public static hook_PlayerHitGroundEffects <11>__PlayerControllerB_PlayerHitGroundEffects; } [HarmonyPatch("PlayerHitGroundEffects")] [HarmonyPrefix] public static void PlayerHitGroundEffects(PlayerControllerB __instance) { //IL_0069: 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 (!__instance.ContainsCRPlayerData()) { return; } if (__instance.HasFlung()) { Plugin.ExtendedLogging($"{__instance.playerUsername} is flinging away with fallvalue: {__instance.fallValue} and fallvalueuncapped: {__instance.fallValueUncapped}!"); if (__instance.fallValueUncapped <= -50f) { __instance.DamagePlayer(10, true, true, (CauseOfDeath)2, 0, false, default(Vector3)); } __instance.fallValue = 0f; __instance.fallValueUncapped = 0f; } if (!__instance.IsFlingingAway() && __instance.HasFlung()) { __instance.SetFlung(flung: false); } } [HarmonyPatch("PlayFootstepSound")] [HarmonyPrefix] public static bool PlayFootstepSound(PlayerControllerB __instance) { return !__instance.ContainsCRPlayerData() || !__instance.IsRidingHoverboard(); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] public static IEnumerable RemoveJumpDelay(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); while (val.IsValid) { val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Newobj, (object)typeof(WaitForSeconds).GetConstructor(new Type[1] { typeof(float) }), (string)null) }); if (val.IsInvalid) { break; } val.Advance(1); val.Set(OpCodes.Nop, (object)null); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)typeof(PlayerControllerBPatch).GetMethod("JumpDelay", BindingFlags.Static | BindingFlags.NonPublic)) }); } return val.InstructionEnumeration(); } private static float JumpDelay() { if (SlowDownEffect.isSlowDownEffectActive) { return 0f; } return 0.15f; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00f8: 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_0103: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_015b: 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_0166: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_Awake; if (obj == null) { hook_Awake val = PlayerControllerB_Awake; <>O.<0>__PlayerControllerB_Awake = val; obj = (object)val; } PlayerControllerB.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__PlayerControllerB_ConnectClientToPlayerObject; if (obj2 == null) { hook_ConnectClientToPlayerObject val2 = PlayerControllerB_ConnectClientToPlayerObject; <>O.<1>__PlayerControllerB_ConnectClientToPlayerObject = val2; obj2 = (object)val2; } PlayerControllerB.ConnectClientToPlayerObject += (hook_ConnectClientToPlayerObject)obj2; object obj3 = <>O.<2>__PlayerControllerB_CheckConditionsForSinkingInQuicksand; if (obj3 == null) { Manipulator val3 = PlayerControllerB_CheckConditionsForSinkingInQuicksand; <>O.<2>__PlayerControllerB_CheckConditionsForSinkingInQuicksand = val3; obj3 = (object)val3; } PlayerControllerB.CheckConditionsForSinkingInQuicksand += (Manipulator)obj3; object obj4 = <>O.<3>__PlayerControllerB_SetItemInElevator; if (obj4 == null) { hook_SetItemInElevator val4 = PlayerControllerB_SetItemInElevator; <>O.<3>__PlayerControllerB_SetItemInElevator = val4; obj4 = (object)val4; } PlayerControllerB.SetItemInElevator += (hook_SetItemInElevator)obj4; object obj5 = <>O.<4>__PlayerControllerB_Update; if (obj5 == null) { hook_Update val5 = PlayerControllerB_Update; <>O.<4>__PlayerControllerB_Update = val5; obj5 = (object)val5; } PlayerControllerB.Update += (hook_Update)obj5; object obj6 = <>O.<5>__PlayerControllerB_LateUpdate; if (obj6 == null) { hook_LateUpdate val6 = PlayerControllerB_LateUpdate; <>O.<5>__PlayerControllerB_LateUpdate = val6; obj6 = (object)val6; } PlayerControllerB.LateUpdate += (hook_LateUpdate)obj6; object obj7 = <>O.<6>__PlayerControllerB_IHittable_Hit; if (obj7 == null) { hook_IHittable_Hit val7 = PlayerControllerB_IHittable_Hit; <>O.<6>__PlayerControllerB_IHittable_Hit = val7; obj7 = (object)val7; } PlayerControllerB.IHittable_Hit += (hook_IHittable_Hit)obj7; object obj8 = <>O.<7>__PlayerControllerB_DiscardHeldObject; if (obj8 == null) { hook_DiscardHeldObject val8 = PlayerControllerB_DiscardHeldObject; <>O.<7>__PlayerControllerB_DiscardHeldObject = val8; obj8 = (object)val8; } PlayerControllerB.DiscardHeldObject += (hook_DiscardHeldObject)obj8; object obj9 = <>O.<8>__PlayerControllerB_Jump_performed; if (obj9 == null) { hook_Jump_performed val9 = PlayerControllerB_Jump_performed; <>O.<8>__PlayerControllerB_Jump_performed = val9; obj9 = (object)val9; } PlayerControllerB.Jump_performed += (hook_Jump_performed)obj9; object obj10 = <>O.<9>__PlayerControllerB_Interact_performed; if (obj10 == null) { hook_Interact_performed val10 = PlayerControllerB_Interact_performed; <>O.<9>__PlayerControllerB_Interact_performed = val10; obj10 = (object)val10; } PlayerControllerB.Interact_performed += (hook_Interact_performed)obj10; object obj11 = <>O.<10>__PlayerControllerB_StopHoldInteractionOnTrigger; if (obj11 == null) { hook_StopHoldInteractionOnTrigger val11 = PlayerControllerB_StopHoldInteractionOnTrigger; <>O.<10>__PlayerControllerB_StopHoldInteractionOnTrigger = val11; obj11 = (object)val11; } PlayerControllerB.StopHoldInteractionOnTrigger += (hook_StopHoldInteractionOnTrigger)obj11; object obj12 = <>O.<11>__PlayerControllerB_PlayerHitGroundEffects; if (obj12 == null) { hook_PlayerHitGroundEffects val12 = PlayerControllerB_PlayerHitGroundEffects; <>O.<11>__PlayerControllerB_PlayerHitGroundEffects = val12; obj12 = (object)val12; } PlayerControllerB.PlayerHitGroundEffects += (hook_PlayerHitGroundEffects)obj12; } private static void PlayerControllerB_ConnectClientToPlayerObject(orig_ConnectClientToPlayerObject orig, PlayerControllerB self) { orig.Invoke(self); if (ContentHandler.Instance.Merchant != null) { GameObject val = Object.Instantiate(ContentHandler.Instance.Merchant.CoinUIPrefab); ((Object)val).name = "CoinUI_" + self.playerUsername; } } private static void PlayerControllerB_Awake(orig_Awake orig, PlayerControllerB self) { orig.Invoke(self); if (!self.ContainsCRPlayerData()) { self.AddCRPlayerData(); } } private static void PlayerControllerB_PlayerHitGroundEffects(orig_PlayerHitGroundEffects orig, PlayerControllerB self) { if (self.fallValue < -9f) { self.SetIsJumping(isJumping: false); } orig.Invoke(self); } private static void PlayerControllerB_SetItemInElevator(orig_SetItemInElevator orig, PlayerControllerB self, bool droppedInShipRoom, bool droppedInElevator, GrabbableObject gObject) { orig.Invoke(self, droppedInShipRoom, droppedInElevator, gObject); if (gObject is WrittenDocument) { DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.LoreMaster, gObject.itemProperties.itemName); } else { if ((!(gObject is PlushieItem) && !(gObject is Xui) && !(gObject is GoldRigo)) || 1 == 0) { return; } DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.CompanyCertified, gObject.itemProperties.itemName); DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.SomeAssemblyRequired, gObject.itemProperties.itemName); DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.HappyFamily, gObject.itemProperties.itemName); DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.TheUprooted, gObject.itemProperties.itemName); DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.HoardingBug, gObject.itemProperties.itemName); if (!DuskModContent.Achievements[CodeRebirthAchievementKeys.Scalper].Completed && !RoundManagerPatch.plushiesCollectedToday.Contains(gObject)) { RoundManagerPatch.plushiesCollectedToday.Add(gObject); if (RoundManagerPatch.plushiesCollectedToday.Count >= 3) { RoundManagerPatch.plushiesCollectedToday.Clear(); DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Scalper); } } } } private static void PlayerControllerB_Interact_performed(orig_Interact_performed orig, PlayerControllerB self, CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, context); if (PlayerControllerBExtensions.IsLocalPlayer(self)) { Plugin.ExtendedLogging(self.playerUsername + " pressed interact."); CodeRebirthUtils.Instance.PlayerPressedInteract(self); } } private static void PlayerControllerB_Jump_performed(orig_Jump_performed orig, PlayerControllerB self, CallbackContext context) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, context); if (PlayerControllerBExtensions.IsLocalPlayer(self)) { Plugin.ExtendedLogging(self.playerUsername + " pressed jump."); CodeRebirthUtils.Instance.PlayerPressedJump(self); } } private static void PlayerControllerB_Update(orig_Update orig, PlayerControllerB self) { if (!PlayerControllerBExtensions.IsLocalPlayer(self) && self.IsPseudoDead()) { ((Component)self).gameObject.layer = 0; } orig.Invoke(self); SlowDownEffect.SlowTrigger(self.hoveringOverTrigger); } private static void PlayerControllerB_StopHoldInteractionOnTrigger(orig_StopHoldInteractionOnTrigger orig, PlayerControllerB self) { if (SlowDownEffect.isSlowDownEffectActive) { if ((Object)(object)self.previousHoveringOverTrigger != (Object)null) { SlowDownEffect.ResetSlowTrigger(self.previousHoveringOverTrigger); } if ((Object)(object)self.hoveringOverTrigger != (Object)null) { SlowDownEffect.ResetSlowTrigger(self.hoveringOverTrigger); } } orig.Invoke(self); } private static void PlayerControllerB_DiscardHeldObject(orig_DiscardHeldObject orig, PlayerControllerB self, bool placeObject, NetworkObject parentObjectTo, Vector3 placePosition, bool matchRotationOfParent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, placeObject, parentObjectTo, placePosition, matchRotationOfParent); foreach (Janitor janitor in Janitor.janitors) { if (!((Object)(object)janitor == (Object)null) && !((EnemyAI)janitor).isEnemyDead && (Object)(object)self != (Object)null && NetworkManager.Singleton.IsServer && ((EnemyAI)janitor).currentBehaviourStateIndex != 2 && ((EnemyAI)janitor).currentBehaviourStateIndex != 3) { if (!janitor.currentlyGrabbingPlayer && !janitor.currentlyGrabbingScrap && !janitor.currentlyThrowingPlayer) { janitor.DetectDroppedScrapServerRpc(((Component)self).transform.position, PlayerControllerReference.op_Implicit(self)); } else { ((MonoBehaviour)janitor).StartCoroutine(janitor.WaitUntilNotDoingAnythingCurrently(self)); } } } } private static bool PlayerControllerB_IHittable_Hit(orig_IHittable_Hit orig, PlayerControllerB self, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit.currentlyHeldObjectServer != (Object)null && playerWhoHit.currentlyHeldObjectServer is ScaryShrimp scaryShrimp) { scaryShrimp.PastHitPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, self)); self.DamagePlayerFromOtherClientServerRpc(60, hitDirection, (int)playerWhoHit.playerClientId); return false; } if ((Object)(object)playerWhoHit != (Object)null) { foreach (PeaceKeeper instance in PeaceKeeper.Instances) { instance.AlertPeaceKeeperToLocalPlayer(playerWhoHit); } } return orig.Invoke(self, force, hitDirection, playerWhoHit, playHitSFX, hitID); } private static void PlayerControllerB_LateUpdate(orig_LateUpdate orig, PlayerControllerB self) { orig.Invoke(self); if (!PlayerControllerBExtensions.IsLocalPlayer(self) && self.IsPseudoDead()) { ((Component)self).gameObject.layer = 0; } if (ContentHandler.Instance.Hoverboard != null && self.ContainsCRPlayerData() && (((Object)(object)self.currentlyHeldObjectServer != (Object)null && (Object)(object)self.currentlyHeldObjectServer.itemProperties != (Object)null && !self.currentlyHeldObjectServer.itemProperties.requiresBattery) || (Object)(object)self.currentlyHeldObjectServer == (Object)null)) { Hoverboard hoverboard = self.TryGetHoverboardRiding(); if ((Object)(object)hoverboard != (Object)null && (Object)(object)hoverboard.playerControlling != (Object)null && (Object)(object)hoverboard.playerControlling == (Object)(object)self && PlayerControllerBExtensions.IsLocalPlayer(self)) { HUDManager.Instance.batteryMeter.fillAmount = ((GrabbableObject)hoverboard).insertedBattery.charge / 1.3f; ((Component)HUDManager.Instance.batteryMeter).gameObject.SetActive(true); ((Behaviour)HUDManager.Instance.batteryIcon).enabled = true; float fillAmount = HUDManager.Instance.batteryMeter.fillAmount; HUDManager.Instance.batteryBlinkUI.SetBool("blink", fillAmount < 0.2f && fillAmount > 0f); } } } private static void PlayerControllerB_CheckConditionsForSinkingInQuicksand(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (!val.TryGotoNext((MoveType)2, new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "thisController"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "get_isGrounded"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2) })) { Plugin.Logger.LogError((object)"[ILHook:PlayerControllerB.CheckConditionsForSinkingInQuicksand] Couldn't find thisController.isGrounded check!"); return; } val.Index -= 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)((bool isGrounded, PlayerControllerB self) => isGrounded || self.HasEffectActive(CodeRebirthStatusEffects.Water))); } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { internal static List spawnableFlora = new List(); internal static List plushiesCollectedToday = new List(); internal static readonly NamespacedKey MilitaryAmountKey = NamespacedKey.From("code_rebirth", "military_plane_coverage"); [HarmonyPatch("SpawnOutsideHazards")] [HarmonyPrefix] private static void SpawnOutsideMapObjects() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ModConfig.ConfigFloraEnabled.Value) { SpawnFlora(); } if (NetworkManager.Singleton.IsServer && !((Object)(object)NetworkSingleton.Instance == (Object)null) && NetworkSingleton.Instance.MoneyStored() < 0) { PersistentDataContainer currentContract = DawnLib.GetCurrentContract(); for (int i = 0; i < ((DataContainer)currentContract).GetOrSetDefault(MilitaryAmountKey, 1); i++) { GameObject val = Object.Instantiate(((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.MilitaryPlane].GetMapObjectPrefab(), Vector3.zero, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); val.GetComponent().Spawn(true); } } } private static void SpawnFlora() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Plugin.ExtendedLogging("Spawning flora!!!"); Random random = new Random(StartOfRound.Instance.randomMapSeed + 2358); int spawnCount = 0; GameObject val = new GameObject("Flora Parent"); if ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { val.transform.SetParent(RoundManager.Instance.mapPropsContainer.transform); } foreach (SpawnableFlora item in spawnableFlora) { SpawnFlora(val, random, item, ref spawnCount); } } private static bool TryGetValidFloraSpawnPoint(Random random, out RaycastHit hit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Vector3 randomPointNearPointsOfInterest = GetRandomPointNearPointsOfInterest(random); hit = default(RaycastHit); NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(randomPointNearPointsOfInterest, ref val, 20f, -1)) { return false; } if (!Physics.Raycast(((NavMeshHit)(ref val)).position, Vector3.down, ref hit, 5f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { return false; } return true; } private static void SpawnFlora(GameObject staticBatchedParent, Random random, SpawnableFlora flora, ref int spawnCount) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0117: Unknown result type (might be due to invalid IL or missing references) AnimationCurve val = flora.spawnCurveFunction(SelectableLevelExtensions.GetDawnInfo(RoundManager.Instance.currentLevel)); int num = Mathf.FloorToInt(val.Evaluate(RandomExtensions.NextFloat(random, 0f, 1f)) + 0.5f); for (int i = 0; i < num; i++) { if (!TryGetValidFloraSpawnPoint(random, out var hit)) { continue; } switch (flora.floraTag) { case FloraTag.Grass: if (!((Component)((RaycastHit)(ref hit)).transform).gameObject.CompareTag("Grass")) { continue; } break; case FloraTag.Desert: if (!((Component)((RaycastHit)(ref hit)).transform).gameObject.CompareTag("Gravel")) { continue; } break; case FloraTag.Snow: if (!((Component)((RaycastHit)(ref hit)).transform).gameObject.CompareTag("Snow")) { continue; } break; } Vector3 point = ((RaycastHit)(ref hit)).point; GameObject val2 = Object.Instantiate(flora.prefab, point, Quaternion.identity, staticBatchedParent.transform); val2.transform.up = ((RaycastHit)(ref hit)).normal; spawnCount++; } } public static Vector3 GetRandomPointNearPointsOfInterest(Random random, float offsetRange = 20f) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; if (outsideAINodes.Length == 0) { Plugin.Logger.LogWarning((object)"No points of interest found."); return Vector3.zero; } Vector3 position = outsideAINodes[random.Next(outsideAINodes.Length)].transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(RandomExtensions.NextFloat(random, 0f - offsetRange, offsetRange), RandomExtensions.NextFloat(random, 0f, offsetRange), RandomExtensions.NextFloat(random, 0f - offsetRange, offsetRange)); return position + val; } [HarmonyPatch("UnloadSceneObjectsEarly")] [HarmonyPostfix] private static void ReturnToOrbitMiscPatch() { plushiesCollectedToday.Clear(); foreach (GalAI instance in GalAI.Instances) { instance.RefillChargesServerRpc(); } foreach (SCP999GalAI instance2 in SCP999GalAI.Instances) { instance2.MakeTriggerInteractableServerRpc(interactable: false); } } [HarmonyPatch("LoadNewLevelWait")] [HarmonyPrefix] public static void LoadNewLevelWaitPatch(RoundManager __instance) { if (!__instance.currentLevel.planetHasTime && TimeOfDay.Instance.daysUntilDeadline == 0 && Plugin.ModConfig.Config999GalCompanyMoonRecharge.Value) { foreach (SCP999GalAI instance in SCP999GalAI.Instances) { instance.RechargeGalHealsAndRevivesServerRpc(heal: true, revive: true); } } if (Plugin.ModConfig.Config999GalCompanyMoonRecharge.Value) { return; } foreach (SCP999GalAI instance2 in SCP999GalAI.Instances) { instance2.RechargeGalHealsAndRevivesServerRpc(heal: true, revive: true); } } } public static class ShotgunItemPatch { [CompilerGenerated] private static class <>O { public static hook_ShootGun <0>__ShotgunItem_ShootGun; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__ShotgunItem_ShootGun; if (obj == null) { hook_ShootGun val = ShotgunItem_ShootGun; <>O.<0>__ShotgunItem_ShootGun = val; obj = (object)val; } ShotgunItem.ShootGun += (hook_ShootGun)obj; } private static void ShotgunItem_ShootGun(orig_ShootGun orig, ShotgunItem self, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, shotgunPosition, shotgunForward); if (ContentHandler.Instance.ManorLord == null || self.enemyColliders == null || self.enemyColliders.Length == 0) { return; } RaycastHit[] enemyColliders = self.enemyColliders; PuppeteersVoodoo puppeteersVoodoo = default(PuppeteersVoodoo); RaycastHit val2 = default(RaycastHit); for (int i = 0; i < enemyColliders.Length; i++) { RaycastHit val = enemyColliders[i]; if (!((Object)(object)((RaycastHit)(ref val)).transform == (Object)null) && ((Component)((RaycastHit)(ref val)).transform).TryGetComponent(ref puppeteersVoodoo) && !Physics.Linecast(shotgunPosition, ((RaycastHit)(ref val)).point, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { float num = Vector3.Distance(shotgunPosition, ((RaycastHit)(ref val)).point); int force = 2; if (num < 3.7f) { force = 5; } else if (num < 6f) { force = 3; } puppeteersVoodoo.Hit(force, shotgunForward, ((GrabbableObject)self).playerHeldBy, playHitSFX: true); } } } } public static class ShovelPatch { [CompilerGenerated] private static class <>O { public static hook_HitShovel <0>__Shovel_HitShovel; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__Shovel_HitShovel; if (obj == null) { hook_HitShovel val = Shovel_HitShovel; <>O.<0>__Shovel_HitShovel = val; obj = (object)val; } Shovel.HitShovel += (hook_HitShovel)obj; } private static void Shovel_HitShovel(orig_HitShovel orig, Shovel self, bool cancel) { orig.Invoke(self, cancel); PostHitShovel(ref self); } private static void PostHitShovel(ref Shovel self) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (self is ScaryShrimp scaryShrimp) { ((GrabbableObject)scaryShrimp).playerHeldBy.twoHanded = true; if (DetermineIfShovelHitSomething(self)) { ((GrabbableObject)scaryShrimp).playerHeldBy.externalForceAutoFade = -((Component)((GrabbableObject)scaryShrimp).playerHeldBy.gameplayCamera).transform.forward * 10f; } } } private static bool DetermineIfShovelHitSomething(Shovel self) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) IHittable val2 = default(IHittable); for (int i = 0; i < self.objectsHitByShovelList.Count; i++) { RaycastHit val = self.objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = self.objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = self.objectsHitByShovelList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent(ref val2)) { continue; } val = self.objectsHitByShovelList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)self.previousPlayerHeldBy).transform) { continue; } val = self.objectsHitByShovelList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)self.previousPlayerHeldBy.gameplayCamera).transform.position; RaycastHit val3 = self.objectsHitByShovelList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } return true; } } val = self.objectsHitByShovelList[i]; if (!((RaycastHit)(ref val)).collider.isTrigger) { return true; } } return false; } } public static class SoccerBallPropPatch { [CompilerGenerated] private static class <>O { public static hook_KickBallLocalClient <0>__SoccerBallProp_KickBallLocalClient; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__SoccerBallProp_KickBallLocalClient; if (obj == null) { hook_KickBallLocalClient val = SoccerBallProp_KickBallLocalClient; <>O.<0>__SoccerBallProp_KickBallLocalClient = val; obj = (object)val; } SoccerBallProp.KickBallLocalClient += (hook_KickBallLocalClient)obj; } private static void SoccerBallProp_KickBallLocalClient(orig_KickBallLocalClient orig, SoccerBallProp self, Vector3 destinationPos, bool setInElevator, bool setInShipRoom) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, destinationPos, setInElevator, setInShipRoom); if (self is JimBall jimBall && ((NetworkBehaviour)self).IsOwner) { jimBall._animator.SetBool(JimBall.KickingAnimation, true); } } } public static class SpikeTrapPatch { [CompilerGenerated] private static class <>O { public static Action <0>__FixSpikeRoofTrap; public static hook_OnTriggerStay <1>__SpikeRoofTrap_OnTrigger; } public static void Init() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ((Registry)(object)LethalContent.MapObjects).OnFreeze += FixSpikeRoofTrap; object obj = <>O.<1>__SpikeRoofTrap_OnTrigger; if (obj == null) { hook_OnTriggerStay val = SpikeRoofTrap_OnTrigger; <>O.<1>__SpikeRoofTrap_OnTrigger = val; obj = (object)val; } SpikeRoofTrap.OnTriggerStay += (hook_OnTriggerStay)obj; } private static void FixSpikeRoofTrap() { Transform transform = ((Registry)(object)LethalContent.MapObjects)[MapObjectKeys.SpikeRoofTrapHazard].GetMapObjectPrefab().transform; ((Component)transform).gameObject.layer = 21; Transform val = transform.Find("Container/AnimContainer"); ((Component)val.Find("BaseSupport")).gameObject.layer = 21; ((Component)val.Find("SpikeRoof")).gameObject.layer = 21; ((Component)val.Find("SpikeRoof/MovingBar")).gameObject.layer = 21; } private static void SpikeRoofTrap_OnTrigger(orig_OnTriggerStay orig, SpikeRoofTrap self, Collider other) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, other); PuppeteersVoodoo puppeteersVoodoo = default(PuppeteersVoodoo); if (ContentHandler.Instance.ManorLord != null && ((NetworkBehaviour)self).IsServer && ((Component)other).TryGetComponent(ref puppeteersVoodoo) && !(puppeteersVoodoo.lastTimeTakenDamageFromEnemy <= 0.5f)) { puppeteersVoodoo.Hit(2, ((Component)self).transform.position); } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { private static bool _patched; [HarmonyPatch("Awake")] [HarmonyPostfix] public static void StartOfRound_Awake(ref StartOfRound __instance) { Plugin.ExtendedLogging("StartOfRound.Awake"); NetworkObjectExtensions.OnSpawn(((NetworkBehaviour)__instance).NetworkObject, (Action)CreateNetworkManager); if (!_patched) { _patched = true; if (LateGameUpgradesCompat.LateGameUpgradesExists) { LateGameUpgradesCompat.PatchDropshipUpgrades(); } } } private static void CreateNetworkManager() { //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)StartOfRound.Instance).IsServer || ((NetworkBehaviour)StartOfRound.Instance).IsHost) { if ((Object)(object)CodeRebirthUtils.Instance == (Object)null) { GameObject val = Object.Instantiate(Plugin.Assets.UtilsPrefab); SceneManager.MoveGameObjectToScene(val, ((Component)StartOfRound.Instance).gameObject.scene); val.GetComponent().Spawn(false); Scene scene = val.scene; Plugin.ExtendedLogging("Created CodeRebirthUtils. Scene is: '" + ((Scene)(ref scene)).name + "'"); } else { Plugin.Logger.LogWarning((object)"CodeRebirthUtils already exists?"); } } if (ContentHandler.Instance.DuckSong != null) { Plugin.ExtendedLogging("Creating duck UI"); GameObject val2 = GameObject.Find("Systems/UI/Canvas"); GameObject val3 = Object.Instantiate(ContentHandler.Instance.DuckSong.DuckUIPrefab, Vector3.zero, Quaternion.identity, val2.transform); } } [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] public static void OnShipLandedMiscEventsPatch(StartOfRound __instance) { foreach (SCP999GalAI instance in SCP999GalAI.Instances) { instance.MakeTriggerInteractable(interactable: true); } if (Plugin.ModConfig.ConfigRemoveInteriorFog.Value) { Plugin.ExtendedLogging("Disabling halloween fog"); if (((Component)RoundManager.Instance.indoorFog).gameObject.activeSelf) { ((Component)RoundManager.Instance.indoorFog).gameObject.SetActive(false); } } foreach (GalAI instance2 in GalAI.Instances) { if (instance2.IdleSounds.Length != 0) { instance2.GalVoice.PlayOneShot(instance2.IdleSounds[instance2.galRandom.Next(instance2.IdleSounds.Length)]); } } } } public static class TurretPatch { [CompilerGenerated] private static class <>O { public static hook_CheckForPlayersInLineOfSight <0>__Turret_CheckForPlayersInLineOfSight; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__Turret_CheckForPlayersInLineOfSight; if (obj == null) { hook_CheckForPlayersInLineOfSight val = Turret_CheckForPlayersInLineOfSight; <>O.<0>__Turret_CheckForPlayersInLineOfSight = val; obj = (object)val; } Turret.CheckForPlayersInLineOfSight += (hook_CheckForPlayersInLineOfSight)obj; } private static PlayerControllerB Turret_CheckForPlayersInLineOfSight(orig_CheckForPlayersInLineOfSight orig, Turret self, float radius, bool angleRangeCheck) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if ((int)self.turretMode == 2 || (int)self.turretMode == 3) { Ray val = default(Ray); ((Ray)(ref val))..ctor(self.centerPoint.position - Vector3.up * 0.3f, self.aimPoint.forward - Vector3.up * 0.3f); Plugin.ExtendedLogging($"Raycast from {self.centerPoint.position} to {self.aimPoint.forward}"); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 30f, MoreLayerMasks.EnemiesMask, (QueryTriggerInteraction)2)) { Plugin.ExtendedLogging("Raycast hit " + ((Object)((RaycastHit)(ref val2)).transform).name); PuppeteersVoodoo puppeteersVoodoo = default(PuppeteersVoodoo); if (((Component)((RaycastHit)(ref val2)).transform).CompareTag("Player") && ((Component)((RaycastHit)(ref val2)).transform).TryGetComponent(ref puppeteersVoodoo) && (Object)(object)puppeteersVoodoo.playerControlled != (Object)null) { Plugin.ExtendedLogging("Hit player " + ((Object)puppeteersVoodoo.playerControlled).name); if (!angleRangeCheck || !(Vector3.Angle(((Component)puppeteersVoodoo).transform.position + Vector3.up * 1.75f - self.centerPoint.position, self.forwardFacingPos.forward) > self.rotationRange)) { return puppeteersVoodoo.playerControlled; } Plugin.ExtendedLogging("Angle too far"); } } } return orig.Invoke(self, radius, angleRangeCheck); } } public static class VehicleControllerPatch { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__VehicleController_Awake; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__VehicleController_Awake; if (obj == null) { hook_Awake val = VehicleController_Awake; <>O.<0>__VehicleController_Awake = val; obj = (object)val; } VehicleController.Awake += (hook_Awake)obj; } private static void VehicleController_Awake(orig_Awake orig, VehicleController self) { orig.Invoke(self); RabbitMagician.vehicleController = self; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!(spawnedEnemy is RabbitMagician)) { continue; } Collider[] componentsInChildren = ((Component)spawnedEnemy).GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { Collider[] componentsInChildren2 = ((Component)self).GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren2) { Physics.IgnoreCollision(val, val2, true); } } } } } } namespace CodeRebirth.src.ModCompats { internal static class CullFactorySoftCompat { private static bool CullFactoryDynamicObjectsAPIExists = Chainloader.PluginInfos.TryGetValue("com.fumiko.CullFactory", out var value) && value.Metadata.Version >= new Version(1, 5, 0); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void TryRefreshDynamicLight(Light light) { if (CullFactoryDynamicObjectsAPIExists) { RefreshDynamicLight(light); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void RefreshDynamicLight(Light light) { DynamicObjectsAPI.RefreshLightPosition(light); } } internal static class ImperiumCompat { internal static bool Enabled => Chainloader.PluginInfos.ContainsKey("giosuel.Imperium"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void ToggleInputs(bool enable) { if (enable) { ((LcInputActions)Imperium.InputBindings.InterfaceMap).Enable(); ((LcInputActions)Imperium.InputBindings.BaseMap).Enable(); Imperium.InputBindings.StaticMap.Enable(); ((LcInputActions)Imperium.InputBindings.FreecamMap).Enable(); } else { ((LcInputActions)Imperium.InputBindings.BaseMap).Disable(); Imperium.InputBindings.StaticMap.Disable(); ((LcInputActions)Imperium.InputBindings.FreecamMap).Disable(); ((LcInputActions)Imperium.InputBindings.InterfaceMap).Disable(); } } } internal static class LateGameUpgradesCompat { internal static bool LateGameUpgradesExists = Chainloader.PluginInfos.ContainsKey("com.malco.lethalcompany.moreshipupgrades"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static float GetSellableScrapMultiplier() { if (LateGameUpgradesExists) { return GetSigurdAccessMultiplier(); } return 1f; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetSigurdAccessMultiplier() { return Sigurd.GetBuyingRate(1f); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void PatchDropshipUpgrades() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) new Hook((MethodBase)AccessTools.DeclaredMethod(typeof(FasterDropPod), "CanLeaveEarly", (Type[])null, (Type[])null), (Delegate)new Func, float, bool>(FixDropshipOnOxyde)); } private static bool FixDropshipOnOxyde(Func orig, float shipTimer) { DawnMoonInfo val = default(DawnMoonInfo); if (((Registry)(object)LethalContent.Moons).TryGetValue(CodeRebirthMoonKeys.Oxyde, ref val) && (Object)(object)val.Level == (Object)(object)RoundManager.Instance.currentLevel) { return false; } return orig.Invoke(shipTimer); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static float TryGetItemWeight(float currentItemWeight) { if (LateGameUpgradesExists) { Plugin.ExtendedLogging($"Current item weight: {currentItemWeight}"); return GetItemWeight(currentItemWeight); } return currentItemWeight - 1f; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static float GetItemWeight(float currentItemWeight) { Plugin.ExtendedLogging($"New item weight: {BackMuscles.DecreasePossibleWeight(currentItemWeight - 1f)}"); return BackMuscles.DecreasePossibleWeight(currentItemWeight - 1f); } } internal static class LethalMoonUnlocksCompat { internal static bool LethalMoonUnlocksExists = Chainloader.PluginInfos.TryGetValue("com.xmods.lethalmoonunlocks", out var value) && value.Metadata.Version >= new Version(2, 2, 0); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void ReleaseOxydeStoryLock(SelectableLevel selectableLevel) { UnlockManager.TryReleaseStoryLock(SelectableLevelExtensions.GetDawnInfo(selectableLevel).GetNumberlessPlanetName()); } } internal static class MoreCompanySoftCompat { private static bool MoreCompanyAPIExists = Chainloader.PluginInfos.TryGetValue("me.swipez.melonloader.morecompany", out var value) && value.Metadata.Version >= new Version(1, 5, 0); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void TryDisableOrEnableCosmetics(PlayerControllerB targetPlayer, bool disable) { if (MoreCompanyAPIExists) { DisableOrEnableCosmetics(targetPlayer, disable); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void DisableOrEnableCosmetics(PlayerControllerB targetPlayer, bool disable) { CosmeticApplication component = ((Component)((Component)targetPlayer).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent(); if (disable) { foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.SetActive(!disable); } return; } component.UpdateAllCosmeticVisibilities(PlayerControllerBExtensions.IsLocalPlayer(targetPlayer)); } } internal static class MoreCounterplayCompat { internal static bool MoreCounterplayExists = Chainloader.PluginInfos.TryGetValue("BaronDrakula.MoreCounterplay", out var value) && value.Metadata.Version >= new Version(1, 4, 1); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static bool CoilheadCounterplayEnabled() { return SyncedEntry.op_Implicit(MoreCounterplay.Settings.EnableCoilheadCounterplay); } } internal static class NavmeshInCompanyCompat { internal static bool Enabled => Chainloader.PluginInfos.ContainsKey("dev.kittenji.NavMeshInCompany"); } internal static class OpenBodyCamCompatibilityChecker { [CompilerGenerated] private static class <>O { public static TargetChangedToTransform <0>__OverrideAttachmentPoint; } internal static bool Enabled => Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void Init() { Plugin.ExtendedLogging("No way openbodycams is on?!"); InitializeImpl(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitializeImpl() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__OverrideAttachmentPoint; if (obj == null) { TargetChangedToTransform val = OverrideAttachmentPoint; <>O.<0>__OverrideAttachmentPoint = val; obj = (object)val; } BodyCamComponent.BeforeTargetChangedToTransform += (TargetChangedToTransform)obj; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool OverrideAttachmentPoint(MonoBehaviour bodyCam, Transform target, ref Transform attachmentPoint, ref Vector3 offset, ref Quaternion angle, ref Renderer[] renderersToHide) { GalAI galAI = default(GalAI); if (((Component)target).TryGetComponent(ref galAI)) { attachmentPoint = galAI.GalHead; renderersToHide = galAI.renderersToHideIn; return true; } return false; } } internal class TooManyEmotesCompat { internal static bool Enabled => Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void AddCredits(int profit) { if (Enabled) { AddToEmoteCredits(profit); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void AddToEmoteCredits(int profit) { TerminalPatcher.OnGainGroupCredits(profit, 0, (DepositItemsDesk)null); } } internal static class WeatherRegistryCompat { internal static bool WeatherRegistryAPIExists = Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"); } } namespace CodeRebirth.src.MiscScripts { public class ACUnitBounds : BoundsDefiner { public void OnEnable() { AirControlUnit.safeBounds.Add(this); } public void OnDisable() { AirControlUnit.safeBounds.Remove(this); } } public static class AnimationCurveUtil { public enum TangentMode { Free, Smooth, Linear } public static void SetKeyTangentMode(AnimationCurve curve, int index, TangentMode mode) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_00a9: 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_00e2: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= curve.length) { return; } Keyframe val = curve[index]; switch (mode) { case TangentMode.Free: ((Keyframe)(ref val)).inTangent = float.PositiveInfinity; ((Keyframe)(ref val)).outTangent = float.PositiveInfinity; break; case TangentMode.Smooth: { float time = ((Keyframe)(ref val)).time; float num; Keyframe val2; if (index <= 0) { num = ((Keyframe)(ref val)).time - 1f; } else { val2 = curve[index - 1]; num = ((Keyframe)(ref val2)).time; } float num2 = time - num; float value = ((Keyframe)(ref val)).value; float value2; if (index <= 0) { value2 = ((Keyframe)(ref val)).value; } else { val2 = curve[index - 1]; value2 = ((Keyframe)(ref val2)).value; } float num3 = value - value2; ((Keyframe)(ref val)).inTangent = num3 / num2; float num4; if (index >= curve.length - 1) { num4 = ((Keyframe)(ref val)).time + 1f; } else { val2 = curve[index + 1]; num4 = ((Keyframe)(ref val2)).time; } float num5 = num4 - ((Keyframe)(ref val)).time; float value3; if (index >= curve.length - 1) { value3 = ((Keyframe)(ref val)).value; } else { val2 = curve[index + 1]; value3 = ((Keyframe)(ref val2)).value; } float num6 = value3 - ((Keyframe)(ref val)).value; ((Keyframe)(ref val)).outTangent = num6 / num5; break; } case TangentMode.Linear: ((Keyframe)(ref val)).inTangent = 0f; ((Keyframe)(ref val)).outTangent = 0f; break; } curve.MoveKey(index, val); } } public class AttachToPlayerHUD : MonoBehaviour { [field: SerializeField] public Vector3 Position { get; private set; } [field: SerializeField] public Vector2 WidthHeight { get; private set; } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0045: Unknown result type (might be due to invalid IL or missing references) ((Transform)(RectTransform)((Component)this).transform).SetParent(GameNetworkManager.Instance.localPlayerController.playerHudUIContainer, false); ((RectTransform)((Component)this).transform).anchoredPosition3D = Position; ((RectTransform)((Component)this).transform).sizeDelta = WidthHeight; } } [Serializable] public class AudioSourceWithClips { [Tooltip("Near AudioSource that will play the clips.")] public AudioSource nearAudioSource = null; [Tooltip("List of close audio clips that can be played.")] public AudioClip[] nearClips = null; [Tooltip("Far AudioSource that will play the clips.")] public AudioSource farAudioSource = null; [Tooltip("List of far audio clips that can be played.")] public AudioClip[] farClips = null; } public class BetterCooldownTrigger : NetworkBehaviour { public enum DeathAnimation { Default, HeadBurst, Spring, Electrocuted, ComedyMask, TragedyMask, Burnt, Snipped, SliceHead, PlaceHolder1, PlaceHolder2, PlaceHolder3, PlaceHolder4, PlaceHolder5, PlaceHolder6 } public enum ForceDirection { Forward, Backward, Up, Down, Left, Right, Center } [Header("Script Enabled")] [Tooltip("Whether this script is enabled.")] public bool enabledScript = true; [Header("Death Animation Settings")] [Tooltip("Different ragdoll body types that spawn after death.")] public DeathAnimation deathAnimation = DeathAnimation.Default; [Space(2f)] [Header("Force Settings")] [Tooltip("The force direction of the damage.")] public ForceDirection forceDirection = ForceDirection.Forward; [Tooltip("The force magnitude of the damage.")] public float forceMagnitudeAfterDamage = 0f; [Tooltip("The force magnitude after death of player.")] public float forceMagnitudeAfterDeath = 0f; [Tooltip("If true, the force direction will be calculated from the object's transform. If false, the force direction will be calculated from the player's transform.")] public bool forceDirectionFromThisObject = true; [Space(2f)] [Header("Cause of Death")] [Tooltip("Cause of death displayed in ScanNode after death.")] public CauseOfDeath causeOfDeath = (CauseOfDeath)0; [Space(2f)] [Header("Trigger Settings")] [Tooltip("Whether to trigger for players.")] public bool triggerForPlayers = false; [Tooltip("Whether to trigger for enemies.")] public bool triggerForEnemies = false; [Tooltip("Whether player/enemy can exit the trigger's effect.")] public bool canThingExit = true; [Tooltip("Whether to use shared cooldown between different GameObjects that use this script.")] public bool sharedCooldown = false; [Tooltip("Whether to play default player damage SFX when damage is dealt.")] public bool playDefaultPlayerDamageSFX = false; [Tooltip("Whether to play sound when damage is dealt to player that enemies can hear.")] public bool soundAttractsDogs = false; [Space(2f)] [Header("Damage Settings")] [Tooltip("Enemy Main Script if put on an enemy")] public EnemyAI? enemyMainScript = null; [Tooltip("Timer in which the gameobject will disable itself, 0 will not disable itself after any point of time.")] public float damageDuration = 0f; [Tooltip("Damage to deal every interval for players.")] public int damageToDealForPlayers = 0; [Tooltip("Damage to deal every interval for enemies.")] public int damageToDealForEnemies = 0; [Tooltip("Cooldown to deal damage for players.")] public float damageIntervalForPlayers = 0.25f; [Tooltip("Cooldown to deal damage for enemies.")] public float damageIntervalForEnemies = 0.25f; [Space(2f)] [Header("Audio Settings")] [Tooltip("Damage clip to play when damage is dealt to player/enemy.")] public List damageClips = new List(); [Tooltip("Damage audio sources to play when damage is dealt to player (picks the closest AudioSource to the player).")] public List damageAudioSources = new List(); [Space(2f)] [Header("Death Prefab Settings")] [Tooltip("Prefab to spawn when the player dies.")] public GameObject? deathPrefabForPlayer = null; [Tooltip("Prefab to spawn when the enemy dies.")] public GameObject? deathPrefabForEnemy = null; [Space(2f)] [Header("Particle System Settings")] [Tooltip("Use particle systems when damage is dealt to player/enemy.")] public bool useParticleSystems = false; [Tooltip("Teleport particle system to enemy/player when damage is dealt.")] public bool teleportParticles = false; [Tooltip("Particle system to play when the player dies.")] public List deathParticlesForPlayer = new List(); [Tooltip("Particle system to play when the player is damaged.")] public List damageParticlesForPlayer = new List(); [Tooltip("Particle system to play when the enemy dies.")] public List deathParticlesForEnemy = new List(); [Tooltip("Particle system to play when the enemy is damaged.")] public List damageParticlesForEnemy = new List(); [Space(2f)] [Header("Display Message Settings")] [Tooltip("Whether to display message to player once damage is dealt to player.")] public bool displayMessage = false; [Tooltip("Header of message to display to player once damage is dealt to player.")] public string headerText = "Damage Dealt!"; [Tooltip("Message to display to player once damage is dealt to player.")] public string message = "Damage dealt!"; [Tooltip("Interval between displaying message to player once damage is dealt to player.")] public float messageInterval = 10f; private static float lastDamageTime = float.NegativeInfinity; private static float lastTipTime = float.NegativeInfinity; private Dictionary playerCoroutineStatus = new Dictionary(); private Dictionary enemyCoroutineStatus = new Dictionary(); private Dictionary playerClosestAudioSources = new Dictionary(); private Dictionary enemyClosestAudioSources = new Dictionary(); public void SetupFields(bool enableScripts = true, bool damagePlayers = true, bool damageEnemies = true, DeathAnimation deathAnimation = DeathAnimation.Default, ForceDirection forceDirection = ForceDirection.Down, float forceMagnitudeAfterDamage = 0f, float forceMagnitudeAfterDeath = 0f, bool forceDirectionFromThisObject = true, CauseOfDeath causeOfDeath = (CauseOfDeath)10, bool canThingExit = true, bool sharedCooldown = false, bool playDefaultPlayerDamageSFX = true, bool soundAttractsDogs = true, float damageDuration = 0f, int damageToDealForPlayers = 0, float damageIntervalForPlayers = 0f, int damageToDealForEnemies = 0, float damageIntervalForEnemies = 0f, List? damageClips = null, List? damageAudioSources = null, GameObject? deathPrefabForPlayer = null, GameObject? deathPrefabForEnemy = null, bool useParticleSystems = false, bool teleportParticles = false, List? damageParticlesForPlayer = null, List? deathParticlesForPlayer = null, List? damageParticlesForEnemy = null, List? deathParticlesForEnemy = null, bool displayMessage = false, string headerText = "Damage", string message = "Damage dealt!", float messageInterval = 10f) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) enabledScript = enableScripts; triggerForPlayers = damagePlayers; triggerForEnemies = damageEnemies; this.deathAnimation = deathAnimation; this.forceDirection = forceDirection; this.forceMagnitudeAfterDamage = forceMagnitudeAfterDamage; this.forceMagnitudeAfterDeath = forceMagnitudeAfterDeath; this.forceDirectionFromThisObject = forceDirectionFromThisObject; this.causeOfDeath = causeOfDeath; this.canThingExit = canThingExit; this.sharedCooldown = sharedCooldown; this.playDefaultPlayerDamageSFX = playDefaultPlayerDamageSFX; this.soundAttractsDogs = soundAttractsDogs; this.damageDuration = damageDuration; this.damageToDealForPlayers = damageToDealForPlayers; this.damageIntervalForPlayers = damageIntervalForPlayers; this.damageToDealForEnemies = damageToDealForEnemies; this.damageIntervalForEnemies = damageIntervalForEnemies; if (damageClips == null) { damageClips = new List(); } this.damageClips = damageClips; if (damageAudioSources == null) { damageAudioSources = new List(); } this.damageAudioSources = damageAudioSources; this.deathPrefabForPlayer = deathPrefabForPlayer; this.deathPrefabForEnemy = deathPrefabForEnemy; this.useParticleSystems = useParticleSystems; this.teleportParticles = teleportParticles; if (damageParticlesForPlayer == null) { damageParticlesForPlayer = new List(); } this.damageParticlesForPlayer = damageParticlesForPlayer; if (deathParticlesForPlayer == null) { deathParticlesForPlayer = new List(); } this.deathParticlesForPlayer = deathParticlesForPlayer; if (damageParticlesForEnemy == null) { damageParticlesForEnemy = new List(); } this.damageParticlesForEnemy = damageParticlesForEnemy; if (deathParticlesForEnemy == null) { deathParticlesForEnemy = new List(); } this.deathParticlesForEnemy = deathParticlesForEnemy; this.displayMessage = displayMessage; this.headerText = headerText; this.message = message; this.messageInterval = messageInterval; } public void OnEnable() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB key in allPlayerScripts) { playerCoroutineStatus[key] = false; } ((UnityEvent)(object)StartOfRound.Instance.playerTeleportedEvent).AddListener((UnityAction)RemovePlayerFromList); ((MonoBehaviour)this).StartCoroutine(ManageDamageTimer()); } private void RemovePlayerFromList(PlayerControllerB player) { if (playerCoroutineStatus.ContainsKey(player) && playerCoroutineStatus[player]) { playerCoroutineStatus[player] = false; } } private IEnumerator ManageDamageTimer() { if (!(damageDuration <= 0f)) { yield return (object)new WaitForSeconds(damageDuration); ((Component)this).gameObject.SetActive(false); } } private void OnTriggerEnter(Collider other) { if (!enabledScript) { return; } PlayerControllerB val = default(PlayerControllerB); if (triggerForPlayers && ((Component)other).gameObject.layer == 3 && ((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { if (playerCoroutineStatus.ContainsKey(val)) { playerCoroutineStatus[val] = true; if (damageAudioSources.Count > 0) { playerClosestAudioSources[val] = GetClosestAudioSource(((Component)val).transform); } Plugin.ExtendedLogging("Player Coroutine Started"); ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(val)); } } else { if (!triggerForEnemies) { return; } Transform val2 = CRUtilities.TryFindRoot(((Component)other).transform); EnemyAI val3 = default(EnemyAI); if ((Object)(object)val2 != (Object)null && ((Component)val2).TryGetComponent(ref val3) && !val3.isEnemyDead && (!((Object)(object)enemyMainScript != (Object)null) || (!((Object)(object)val3 == (Object)(object)enemyMainScript) && (!(enemyMainScript is RedwoodTitanAI redwoodTitanAI) || !((Object)(object)val3 == (Object)(object)redwoodTitanAI.targetEnemy)))) && !enemyCoroutineStatus.ContainsKey(val3)) { enemyCoroutineStatus[val3] = true; if (damageAudioSources.Count > 0) { enemyClosestAudioSources[val3] = GetClosestAudioSource(((Component)val3).transform); } ((MonoBehaviour)this).StartCoroutine(DamageEnemyCoroutine(val3)); } } } private void OnTriggerExit(Collider other) { if (!enabledScript || !canThingExit) { return; } PlayerControllerB val = default(PlayerControllerB); if (triggerForPlayers && ((Component)other).gameObject.layer == 3 && ((Component)other).TryGetComponent(ref val) && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val) { Plugin.ExtendedLogging("Player Coroutine Stopped"); RemovePlayerFromList(val); playerClosestAudioSources.Remove(val); } else if (triggerForEnemies) { Transform val2 = CRUtilities.TryFindRoot(((Component)other).transform); EnemyAI key = default(EnemyAI); if ((Object)(object)val2 != (Object)null && ((Component)val2).TryGetComponent(ref key)) { enemyCoroutineStatus[key] = false; enemyClosestAudioSources.Remove(key); } } } private IEnumerator DamagePlayerCoroutine(PlayerControllerB player) { while (playerCoroutineStatus[player]) { if (sharedCooldown && Time.time < lastDamageTime + damageIntervalForPlayers) { yield return null; continue; } lastDamageTime = Time.time; ApplyDamageToPlayer(player); yield return (object)new WaitForSeconds(damageIntervalForPlayers); } } private IEnumerator DamageEnemyCoroutine(EnemyAI enemy) { while (enemyCoroutineStatus[enemy]) { if (sharedCooldown && Time.time < lastDamageTime + damageIntervalForEnemies) { yield return null; continue; } lastDamageTime = Time.time; ApplyDamageToEnemy(enemy); yield return (object)new WaitForSeconds(damageIntervalForEnemies); } } private void ApplyDamageToPlayer(PlayerControllerB player) { //IL_0009: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) Vector3 val = CalculateForceDirection(player, forceMagnitudeAfterDamage); Vector3 val2 = CalculateForceDirection(player, forceMagnitudeAfterDeath); player.DamagePlayer(damageToDealForPlayers, playDefaultPlayerDamageSFX, true, causeOfDeath, (int)deathAnimation, false, val2); if (displayMessage && Time.time >= lastTipTime + messageInterval) { HUDManager.Instance.DisplayTip(headerText, message, true, false, "LC_Tip1"); lastTipTime = Time.time; } PlayDamageSound(((Component)player).transform, playerClosestAudioSources.ContainsKey(player) ? playerClosestAudioSources[player] : null); if (teleportParticles) { foreach (ParticleSystem item in damageParticlesForPlayer) { if ((Object)(object)item != (Object)null) { ((Component)item).transform.position = ((Component)player).transform.position; } } foreach (ParticleSystem item2 in deathParticlesForPlayer) { if ((Object)(object)item2 != (Object)null) { ((Component)item2).transform.position = ((Component)player).transform.position; } } } if (!player.isPlayerDead) { player.externalForces += val; } else if ((Object)(object)deathPrefabForPlayer != (Object)null && (Object)(object)deathPrefabForPlayer.GetComponent() != (Object)null) { SpawnDeathPrefabServerRpc(((Component)player).transform.position, ((Component)player).transform.rotation, forPlayer: true); } else if ((Object)(object)deathPrefabForPlayer != (Object)null) { Object.Instantiate(deathPrefabForPlayer, ((Component)player).transform.position, ((Component)player).transform.rotation); playerCoroutineStatus[player] = false; playerClosestAudioSources.Remove(player); } if (useParticleSystems) { HandleParticleSystemStuffServerRpc(((Component)player).transform.position, forPlayer: true, player.isPlayerDead); } } private void ApplyDamageToEnemy(EnemyAI enemy) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00b9: Unknown result type (might be due to invalid IL or missing references) enemy.HitEnemy(damageToDealForEnemies, (PlayerControllerB)null, false, -1); PlayDamageSound(((Component)enemy).transform, enemyClosestAudioSources.ContainsKey(enemy) ? enemyClosestAudioSources[enemy] : null); if (enemy.isEnemyDead) { if ((Object)(object)deathPrefabForEnemy != (Object)null && (Object)(object)deathPrefabForEnemy.GetComponent() != (Object)null) { SpawnDeathPrefabServerRpc(((Component)enemy).transform.position, ((Component)enemy).transform.rotation, forPlayer: false); } else if ((Object)(object)deathPrefabForEnemy != (Object)null) { Object.Instantiate(deathPrefabForEnemy, ((Component)enemy).transform.position, ((Component)enemy).transform.rotation); } enemyCoroutineStatus[enemy] = false; enemyClosestAudioSources.Remove(enemy); } if (useParticleSystems) { HandleParticleSystemStuffServerRpc(((Component)enemy).transform.position, forPlayer: false, enemy.isEnemyDead); } } [ServerRpc(RequireOwnership = false)] private void HandleParticleSystemStuffServerRpc(Vector3 position, bool forPlayer, bool isDead) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HandleParticleSystemStuffClientRpc(position, forPlayer, isDead); } [ClientRpc] private void HandleParticleSystemStuffClientRpc(Vector3 position, bool forPlayer, bool isDead) { //IL_00ec: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (teleportParticles) { if (forPlayer) { foreach (ParticleSystem item in damageParticlesForPlayer) { if ((Object)(object)item != (Object)null) { ((Component)item).transform.position = position; } } foreach (ParticleSystem item2 in deathParticlesForPlayer) { if ((Object)(object)item2 != (Object)null) { ((Component)item2).transform.position = position; } } } else { foreach (ParticleSystem item3 in damageParticlesForEnemy) { if ((Object)(object)item3 != (Object)null) { ((Component)item3).transform.position = position; } } foreach (ParticleSystem item4 in deathParticlesForEnemy) { if ((Object)(object)item4 != (Object)null) { ((Component)item4).transform.position = position; } } } } if (forPlayer) { if (!isDead && damageParticlesForPlayer.Count > 0) { ParticleSystem val = damageParticlesForPlayer[Random.Range(0, damageParticlesForPlayer.Count)]; val.Play(); } else if (isDead && deathParticlesForPlayer.Count > 0) { ParticleSystem val2 = deathParticlesForPlayer[Random.Range(0, deathParticlesForPlayer.Count)]; val2.Play(); } } else if (!isDead && damageParticlesForEnemy.Count > 0) { ParticleSystem val3 = damageParticlesForEnemy[Random.Range(0, damageParticlesForEnemy.Count)]; val3.Play(); } else if (isDead && deathParticlesForEnemy.Count > 0) { ParticleSystem val4 = deathParticlesForEnemy[Random.Range(0, deathParticlesForEnemy.Count)]; val4.Play(); } } [ServerRpc(RequireOwnership = false)] private void SpawnDeathPrefabServerRpc(Vector3 position, Quaternion rotation, bool forPlayer) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (forPlayer) { Object.Instantiate(deathPrefabForPlayer, position, rotation); GameObject? obj = deathPrefabForPlayer; if (obj != null) { obj.GetComponent().Spawn(false); } } else { Object.Instantiate(deathPrefabForEnemy, position, rotation); GameObject? obj2 = deathPrefabForEnemy; if (obj2 != null) { obj2.GetComponent().Spawn(false); } } } private Vector3 CalculateForceDirection(PlayerControllerB player, float baseForce) { //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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; switch (forceDirection) { case ForceDirection.Forward: val = (forceDirectionFromThisObject ? ((Component)this).transform.forward : ((Component)player).transform.forward); break; case ForceDirection.Backward: val = (forceDirectionFromThisObject ? (-((Component)this).transform.forward) : (-((Component)player).transform.forward)); break; case ForceDirection.Up: val = (forceDirectionFromThisObject ? ((Component)this).transform.up : ((Component)player).transform.up); break; case ForceDirection.Down: val = (forceDirectionFromThisObject ? (-((Component)this).transform.up) : (-((Component)player).transform.up)); break; case ForceDirection.Left: val = (forceDirectionFromThisObject ? (-((Component)this).transform.right) : (-((Component)player).transform.right)); break; case ForceDirection.Right: val = (forceDirectionFromThisObject ? ((Component)this).transform.right : ((Component)player).transform.right); break; case ForceDirection.Center: { Vector3 val2; Vector3 normalized; if (!forceDirectionFromThisObject) { val2 = ((Component)this).transform.position - ((Component)player).transform.position; normalized = ((Vector3)(ref val2)).normalized; } else { val2 = ((Component)player).transform.position - ((Component)this).transform.position; normalized = ((Vector3)(ref val2)).normalized; } val = normalized; break; } } return ((Vector3)(ref val)).normalized * baseForce; } private void PlayDamageSound(Transform targetTransform, AudioSource? audioSource) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (soundAttractsDogs) { RoundManager.Instance.PlayAudibleNoise(((Component)targetTransform).transform.position, ((Object)(object)audioSource != (Object)null) ? audioSource.maxDistance : 10f, ((Object)(object)audioSource != (Object)null) ? audioSource.volume : 0.85f, 0, false, 0); } if (damageClips.Count > 0 && (Object)(object)audioSource != (Object)null) { WalkieTalkie.TransmitOneShotAudio(audioSource, damageClips[Random.Range(0, damageClips.Count)], audioSource.volume); RoundManager.PlayRandomClip(audioSource, damageClips.ToArray(), true, audioSource.volume, 0, damageClips.Count); } } private AudioSource GetClosestAudioSource(Transform targetTransform) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) AudioSource val = damageAudioSources[0]; float num = Vector3.Distance(((Component)val).transform.position, targetTransform.position); foreach (AudioSource damageAudioSource in damageAudioSources) { float num2 = Vector3.Distance(((Component)damageAudioSource).transform.position, targetTransform.position); if (num2 < num) { val = damageAudioSource; num = num2; } } return val; } public void OnDisable() { ((MonoBehaviour)this).StopAllCoroutines(); playerCoroutineStatus.Clear(); enemyCoroutineStatus.Clear(); playerClosestAudioSources.Clear(); enemyClosestAudioSources.Clear(); ((UnityEvent)(object)StartOfRound.Instance.playerTeleportedEvent).RemoveListener((UnityAction)RemovePlayerFromList); } } public class BillboardScript : MonoBehaviour { private Transform parentObject; [Tooltip("Locks the rotational up axis of the billboard.")] public bool lockUpAxis = true; private Camera camera = null; private void Start() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; parentObject = ((Component)this).transform.parent; ((Component)this).transform.rotation = parentObject.rotation; } private void Update() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (lockUpAxis) { if (((Component)parentObject).transform.eulerAngles == Vector3.zero) { ((Component)this).gameObject.transform.eulerAngles = new Vector3(((Component)this).gameObject.transform.eulerAngles.x, ((Component)camera).transform.eulerAngles.y + 180f, ((Component)this).gameObject.transform.eulerAngles.z); } else { ((Component)this).gameObject.transform.eulerAngles = new Vector3(((Component)camera).transform.eulerAngles.x, ((Component)parentObject).transform.eulerAngles.y, ((Component)camera).transform.eulerAngles.z); } } else { ((Component)this).gameObject.transform.LookAt(((Component)camera).transform.position); } } } public class BoundsDefiner : MonoBehaviour { public Color boundColor = Color.blue; public Bounds bounds = new Bounds(Vector3.zero, Vector3.one); private void OnDrawGizmosSelected() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = boundColor; Matrix4x4 matrix = Gizmos.matrix; Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, Vector3.one); Gizmos.DrawWireCube(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).size); Gizmos.matrix = matrix; } public bool BoundsContainTransform(Transform target) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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_0019: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.InverseTransformPoint(target.position); return ((Bounds)(ref bounds)).Contains(val); } } public enum SaveTypes { Contract, Save, Plugin } public class CommitKeyToSave : NetworkBehaviour { [CompilerGenerated] private static class <>O { public static hook_SaveItemsInShip <0>__SaveKeys; public static hook_AutoSaveShipData <1>__SaveKeys; } internal static readonly NamespacedKey CodeRebirthLoreKey = NamespacedKey.From("code_rebirth", "lore_collection"); private static HashSet _savedContractKeys = new HashSet(); private static HashSet _savedSaveKeys = new HashSet(); private static HashSet _savedPluginKeys = new HashSet(); private static bool _shouldSaveContract = false; private static bool _shouldSaveSave = false; private static bool _shouldSavePlugin = false; [field: SerializeField] public SaveTypes SaveType { get; private set; } = SaveTypes.Contract; [field: SerializeField] public string LoreEntryName { get; private set; } = string.Empty; [field: SerializeField] [field: InspectorName("Namespace")] [field: DefaultKeySource("GetLoreEntryName", false)] public NamespacedKey NamespacedKey { get; private set; } [field: SerializeField] [field: TextArea(2, 10)] public string FoundEntryText { get; private set; } = "Found journal entry: ''"; [field: SerializeField] public bool SaveOnServer { get; private set; } = true; [field: SerializeField] public bool SaveImmediately { get; private set; } = false; internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__SaveKeys; if (obj == null) { hook_SaveItemsInShip val = SaveKeys; <>O.<0>__SaveKeys = val; obj = (object)val; } GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj; object obj2 = <>O.<1>__SaveKeys; if (obj2 == null) { hook_AutoSaveShipData val2 = SaveKeys; <>O.<1>__SaveKeys = val2; obj2 = (object)val2; } StartOfRound.AutoSaveShipData += (hook_AutoSaveShipData)obj2; } private static void SaveKeys(orig_AutoSaveShipData orig, StartOfRound self) { orig.Invoke(self); SaveKeys(); } private static void SaveKeys(orig_SaveItemsInShip orig, GameNetworkManager self) { orig.Invoke(self); SaveKeys(); } public void CommitKey() { if (!SaveOnServer || ((NetworkBehaviour)this).IsServer) { CommitNamespaceIntoFile(NamespacedKey); } } public void Destroy() { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } private void CommitNamespaceIntoFile(NamespacedKey key) { switch (SaveType) { case SaveTypes.Contract: _savedContractKeys = ((DataContainer)DawnLib.GetCurrentContract()).GetOrCreateDefault>(CodeRebirthLoreKey); if (!_savedContractKeys.Add(key)) { return; } _shouldSaveContract = true; break; case SaveTypes.Save: _savedSaveKeys = ((DataContainer)DawnLib.GetCurrentSave()).GetOrCreateDefault>(CodeRebirthLoreKey); if (!_savedSaveKeys.Add(key)) { return; } _shouldSaveSave = true; break; case SaveTypes.Plugin: _savedPluginKeys = ((DataContainer)Plugin.PersistentDataContainer).GetOrCreateDefault>(CodeRebirthLoreKey); if (!_savedPluginKeys.Add(key)) { return; } _shouldSavePlugin = true; break; } HUDManager.Instance.DisplayGlobalNotification(FoundEntryText); if (SaveImmediately || StartOfRound.Instance.inShipPhase) { SaveKeys(); } } private static void SaveKeys() { if (_shouldSaveContract) { ((DataContainer)DawnLib.GetCurrentContract()).Set>(CodeRebirthLoreKey, _savedContractKeys); } if (_shouldSaveSave) { ((DataContainer)DawnLib.GetCurrentSave()).Set>(CodeRebirthLoreKey, _savedSaveKeys); } if (_shouldSavePlugin) { ((DataContainer)Plugin.PersistentDataContainer).Set>(CodeRebirthLoreKey, _savedPluginKeys); } _shouldSaveContract = false; _shouldSaveSave = false; _shouldSavePlugin = false; } public string GetLoreEntryName() { return NamespacedKey.NormalizeStringForNamespacedKey(LoreEntryName, false); } } public class CRDropShip : ItemDropship { [Header("Audio")] public AudioSource rumbleSource = null; public AudioSource audioSource = null; public AudioClip musicSound = null; public AudioClip leaveSound = null; [SerializeField] private Collider colliderEncompasingDropship = null; private VehicleController? _lastSpawnedVehicle = null; public void SpawnVehicleAnimEvent() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) base.shipAnimator.SetBool("landing", true); base.shipTimer = 0f; if (((NetworkBehaviour)this).IsServer) { GameObject val = Object.Instantiate(base.terminalScript.buyableVehicles[base.terminalScript.orderedVehicleFromTerminal].vehiclePrefab, base.deliverVehiclePoint.position, base.deliverVehiclePoint.rotation, RoundManager.Instance.VehiclesContainer); val.GetComponent().Spawn(false); if ((Object)(object)base.terminalScript.buyableVehicles[base.terminalScript.orderedVehicleFromTerminal].secondaryPrefab != (Object)null) { Object.Instantiate(base.terminalScript.buyableVehicles[base.terminalScript.orderedVehicleFromTerminal].secondaryPrefab, RoundManager.Instance.VehiclesContainer).GetComponent().Spawn(false); } _lastSpawnedVehicle = val.GetComponent(); } base.untetheredVehicle = true; base.deliveringOrder = true; base.terminalScript.orderedVehicleFromTerminal = -1; base.terminalScript.vehicleInDropship = false; base.deliveringVehicle = false; base.triggerScript.interactable = false; } [ClientRpc] public void PlayRumbleClientRpc() { rumbleSource.Play(); } public void PlayRumbleAnimEvent() { rumbleSource.Play(); } public void DestroyAnyVehiclesAnimEvent() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_lastSpawnedVehicle == (Object)null)) { Bounds bounds = colliderEncompasingDropship.bounds; if (((Bounds)(ref bounds)).Contains(((Component)_lastSpawnedVehicle).transform.position)) { _lastSpawnedVehicle.DestroyCar(); } } } } public abstract class CRHittable : NetworkBehaviour { public abstract bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1); } public enum CRItemSpawnerType { Vanilla, Special } [Serializable] public class ItemNameWithRarity { public string Name; public float Rarity; } public class CRItemSpawner : MonoBehaviour { [SerializeField] private bool _spawnOnStart = true; [SerializeField] private CRItemSpawnerType spawnerType = CRItemSpawnerType.Vanilla; [SerializeField] [Range(0f, 100f)] private float spawnChance = 0f; [SerializeField] private List spawnSpots = new List(); [Header("Special Items")] public List specialItemNamesWithRarity = new List(); public void Start() { if (spawnSpots.Count == 0) { spawnSpots.Add(((Component)this).transform); } if (_spawnOnStart && NetworkManager.Singleton.IsServer) { switch (spawnerType) { case CRItemSpawnerType.Vanilla: DoVanillaItemSpawn(); break; case CRItemSpawnerType.Special: DoSpecialItemSpawn(); break; } } } public void DoVanillaItemSpawn() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer && !((float)Random.Range(0, 100) >= spawnChance)) { Item randomVanillaItem = Merchant.GetRandomVanillaItem(excludeShopItems: false); Vector3 position = spawnSpots[Random.Range(0, spawnSpots.Count)].position; CodeRebirthUtils.Instance.SpawnScrap(randomVanillaItem, position); } } public void DoSpecialItemSpawn() { //IL_0126: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer || (float)Random.Range(0, 100) >= spawnChance) { return; } List<(Item, float)> list = new List<(Item, float)>(); foreach (ItemNameWithRarity itemNamesWithRarity in specialItemNamesWithRarity) { Item val = ((IEnumerable)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func)((Item x) => x.itemName == itemNamesWithRarity.Name)); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Item not found: " + itemNamesWithRarity.Name)); } else { list.Add((val, itemNamesWithRarity.Rarity)); } } if (list.Count != 0) { Item item = CRUtilities.ChooseRandomWeightedType(list); Vector3 position = spawnSpots[Random.Range(0, spawnSpots.Count)].position; CodeRebirthUtils.Instance.SpawnScrap(item, position); } } } [RequireComponent(typeof(Collider))] public class CRNoiseListener : MonoBehaviour, INoiseListener { [SerializeField] internal UnityEvent _onNoiseDetected = new UnityEvent(); public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _onNoiseDetected.Invoke(new NoiseParams(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID)); } } [Serializable] public class NoiseParams(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { internal Vector3 noisePosition = noisePosition; internal float noiseLoudness = noiseLoudness; internal int timesPlayedInOneSpot = timesPlayedInOneSpot; internal int noiseID = noiseID; } [Serializable] public class CRObjectTypeWithRarity { public string CRObjectName; public int Rarity; } public class CRUtilities { private static Dictionary _masksByLayer = new Dictionary(); private static AudioReverbPresets? audioReverbPreset = null; private static Collider[] cachedColliders = (Collider[])(object)new Collider[64]; private static Dictionary playerControllerBToDamage = new Dictionary(); private static Dictionary enemyAICollisionDetectToDamage = new Dictionary(); private static Dictionary explodeablesToDamage = new Dictionary(); private static List landmineList = new List(); private static List hittablesList = new List(); public static void Init() { GenerateLayerMap(); } public static Transform? TryFindRoot(Transform child) { Transform val = child; while ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent() == (Object)null) { val = ((Component)val).transform.parent; } return val; } public static void GenerateLayerMap() { _masksByLayer = new Dictionary(); for (int i = 0; i < 32; i++) { int num = 0; for (int j = 0; j < 32; j++) { if (!Physics.GetIgnoreLayerCollision(i, j)) { num |= 1 << j; } } _masksByLayer.Add(i, num); } } public static int MaskForLayer(int layer) { return _masksByLayer[layer]; } public static void TeleportPlayerToShip(int playerObj, Vector3 teleportPos) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; if ((Object)(object)audioReverbPreset != (Object)null) { audioReverbPreset.audioPresets[3].ChangeAudioReverbForPlayer(val); } else { audioReverbPreset = Object.FindObjectOfType(); audioReverbPreset.audioPresets[3].ChangeAudioReverbForPlayer(val); } val.isInElevator = true; val.isInHangarShipRoom = true; val.isInsideFactory = false; val.averageVelocity = 0f; val.velocityLastFrame = Vector3.zero; StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true); StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play(); if (PlayerControllerBExtensions.IsLocalPlayer(val)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } public static IEnumerator TeleportPlayerBody(int playerObj, Vector3 teleportPosition) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float startTime = Time.realtimeSinceStartup; yield return (object)new WaitUntil((Func)(() => (Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj].deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f)); if (StartOfRound.Instance.inShipPhase || SceneManager.sceneCount <= 1) { yield break; } DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerObj].deadBody; if ((Object)(object)deadBody != (Object)null) { deadBody.attachedTo = null; deadBody.attachedLimb = null; deadBody.secondaryAttachedLimb = null; deadBody.secondaryAttachedTo = null; if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null) { deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } deadBody.isInShip = false; deadBody.parentedToShip = false; ((Component)deadBody).transform.SetParent((Transform)null, true); deadBody.SetRagdollPositionSafely(teleportPosition, true); } } public static void TeleportEnemy(EnemyAI enemy, Vector3 teleportPos) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) enemy.serverPosition = teleportPos; ((Component)enemy).transform.position = teleportPos; enemy.agent.Warp(teleportPos); enemy.SyncPositionToClients(); } public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect, int damage, float minDamageRange, float maxDamageRange, int enemyHitForce, PlayerControllerB? attacker, GameObject? overridePrefab, float pushForce) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0558: 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_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0598: 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_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0800: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"Spawning explosion at pos: {explosionPosition}"); Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { float num = Mathf.Clamp((maxDamageRange - minDamageRange) / 4f, 0.25f, 20f); GameObject val2; if ((Object)(object)overridePrefab == (Object)null) { val2 = Object.Instantiate(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val); AudioSource componentInChildren = val2.GetComponentInChildren(); componentInChildren.maxDistance *= num; ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren(); foreach (ParticleSystem val3 in componentsInChildren) { Transform transform = ((Component)val3).gameObject.transform; transform.localScale *= num; } } else { val2 = Object.Instantiate(overridePrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val); } val2.SetActive(true); } float num2 = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num2 <= 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } else if (num2 <= 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } int num3 = Physics.OverlapSphereNonAlloc(explosionPosition, maxDamageRange, cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); RaycastHit val4 = default(RaycastHit); PlayerControllerB val5 = default(PlayerControllerB); EnemyAICollisionDetect key = default(EnemyAICollisionDetect); IExplodeable key2 = default(IExplodeable); IHittable item = default(IHittable); for (int j = 0; j < num3; j++) { Plugin.ExtendedLogging("Explosion hit " + ((Object)cachedColliders[j]).name); float num4 = Vector3.Distance(explosionPosition, cachedColliders[j].ClosestPoint(explosionPosition)); if (num4 > 4f && Physics.Linecast(explosionPosition, ((Component)cachedColliders[j]).transform.position + Vector3.up * 0.3f, ref val4, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { continue; } if (((Component)cachedColliders[j]).gameObject.layer == 3 && ((Component)cachedColliders[j]).TryGetComponent(ref val5)) { if (val5.isPlayerControlled && !val5.isPlayerDead) { int num5 = (int)((float)damage * (1f - Mathf.Clamp01((num4 - minDamageRange) / (maxDamageRange - minDamageRange)))); if (playerControllerBToDamage.ContainsKey(val5) && playerControllerBToDamage[val5].damage < num5) { playerControllerBToDamage[val5] = (num4, num5); } else if (!playerControllerBToDamage.ContainsKey(val5)) { playerControllerBToDamage.Add(val5, (num4, num5)); } } } else if (((Component)cachedColliders[j]).gameObject.layer == 19 && ((Component)cachedColliders[j]).TryGetComponent(ref key)) { if (enemyAICollisionDetectToDamage.ContainsKey(key) && enemyAICollisionDetectToDamage[key].damage < enemyHitForce) { enemyAICollisionDetectToDamage[key] = (num4, enemyHitForce); } else if (!enemyAICollisionDetectToDamage.ContainsKey(key)) { enemyAICollisionDetectToDamage.Add(key, (num4, enemyHitForce)); } } else if (((Component)cachedColliders[j]).gameObject.layer == 21 && num4 < maxDamageRange) { Landmine componentInChildren2 = ((Component)cachedColliders[j]).gameObject.GetComponentInChildren(); if (!((Object)(object)componentInChildren2 == (Object)null) && !landmineList.Contains(componentInChildren2)) { landmineList.Add(componentInChildren2); } } else if (((Component)cachedColliders[j]).TryGetComponent(ref key2)) { if (explodeablesToDamage.ContainsKey(key2) && explodeablesToDamage[key2].damage < enemyHitForce) { explodeablesToDamage[key2] = (num4, enemyHitForce); } else if (!explodeablesToDamage.ContainsKey(key2)) { explodeablesToDamage.Add(key2, (num4, enemyHitForce)); } } else if (((Component)cachedColliders[j]).TryGetComponent(ref item) && !hittablesList.Contains(item)) { hittablesList.Add(item); } } Vector3 val6; for (int num6 = playerControllerBToDamage.Count - 1; num6 >= 0; num6--) { PlayerControllerB key3 = playerControllerBToDamage.ElementAt(num6).Key; val6 = ((Component)key3).transform.position - explosionPosition; Vector3 normalized = ((Vector3)(ref val6)).normalized; key3.DamagePlayer(playerControllerBToDamage[key3].damage, true, true, (CauseOfDeath)13, 6, false, normalized * pushForce * 5f); key3.externalForceAutoFade += normalized * pushForce; } for (int num7 = enemyAICollisionDetectToDamage.Count - 1; num7 >= 0; num7--) { EnemyAICollisionDetect key4 = enemyAICollisionDetectToDamage.ElementAt(num7).Key; if (!((Object)(object)key4.mainScript == (Object)null) && ((NetworkBehaviour)key4.mainScript).IsSpawned) { if ((Object)(object)attacker != (Object)null) { if (PlayerControllerBExtensions.IsLocalPlayer(attacker)) { EnemyAI mainScript = key4.mainScript; int item2 = enemyAICollisionDetectToDamage[key4].damage; PlayerControllerB val7 = attacker; val6 = default(Vector3); mainScript.HitEnemyOnLocalClient(item2, val6, val7, false, -1); } } else if (((NetworkBehaviour)key4.mainScript).IsOwner) { EnemyAI mainScript2 = key4.mainScript; int item3 = enemyAICollisionDetectToDamage[key4].damage; PlayerControllerB val7 = attacker; val6 = default(Vector3); mainScript2.HitEnemyOnLocalClient(item3, val6, val7, false, -1); } if (((NetworkBehaviour)key4.mainScript).IsOwner) { key4.mainScript.HitFromExplosion(enemyAICollisionDetectToDamage[key4].distance); } } } for (int num8 = landmineList.Count - 1; num8 >= 0; num8--) { ((MonoBehaviour)landmineList[num8]).StartCoroutine(landmineList[num8].TriggerOtherMineDelayed(landmineList[num8])); } for (int num9 = hittablesList.Count - 1; num9 >= 0; num9--) { IHittable val8 = hittablesList[num9]; if (NetworkManager.Singleton.IsServer) { val8.Hit(5, explosionPosition, attacker, true, -1); } } for (int num10 = explodeablesToDamage.Count - 1; num10 >= 0; num10--) { if (NetworkManager.Singleton.IsServer) { IExplodeable key5 = explodeablesToDamage.ElementAt(num10).Key; key5.OnExplosion(explodeablesToDamage[key5].damage, explosionPosition, explodeablesToDamage[key5].distance); } } playerControllerBToDamage.Clear(); enemyAICollisionDetectToDamage.Clear(); landmineList.Clear(); hittablesList.Clear(); explodeablesToDamage.Clear(); } public static void MakePlayerGrabObject(PlayerControllerB player, GrabbableObject grabbableObject) { //IL_016e: Unknown result type (might be due to invalid IL or missing references) player.currentlyGrabbingObject = grabbableObject; player.currentlyGrabbingObject.InteractItem(); if (player.currentlyGrabbingObject.grabbable && player.FirstEmptyItemSlot((GrabbableObject)null) != -1) { player.playerBodyAnimator.SetBool("GrabInvalidated", false); player.playerBodyAnimator.SetBool("GrabValidated", false); player.playerBodyAnimator.SetBool("cancelHolding", false); player.playerBodyAnimator.ResetTrigger("Throw"); player.SetSpecialGrabAnimationBool(true, (GrabbableObject)null); player.isGrabbingObjectAnimation = true; ((Behaviour)player.cursorIcon).enabled = false; ((TMP_Text)player.cursorTip).text = ""; player.twoHanded = player.currentlyGrabbingObject.itemProperties.twoHanded; player.carryWeight = Mathf.Clamp(player.carryWeight + LateGameUpgradesCompat.TryGetItemWeight(player.currentlyGrabbingObject.itemProperties.weight), 1f, 10f); if (player.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f) { player.grabObjectAnimationTime = player.currentlyGrabbingObject.itemProperties.grabAnimationTime; } else { player.grabObjectAnimationTime = 0.4f; } if (!player.isTestingPlayer) { Plugin.ExtendedLogging($"heldByPlayerOnServer: {grabbableObject.heldByPlayerOnServer}"); grabbableObject.heldByPlayerOnServer = false; player.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbableObject).NetworkObject)); } if (player.grabObjectCoroutine != null) { ((MonoBehaviour)player).StopCoroutine(player.grabObjectCoroutine); } player.grabObjectCoroutine = ((MonoBehaviour)player).StartCoroutine(player.GrabObject()); } } public static T? ChooseRandomWeightedType(IEnumerable<(T objectType, float rarity)> rarityList) { List<(T, float)> list = rarityList.Where<(T, float)>(((T objectType, float rarity) x) => x.rarity > 0f).ToList(); float num = 0f; List<(T, float)> list2 = new List<(T, float)>(list.Count); for (int num2 = 0; num2 < list.Count; num2++) { num += list[num2].Item2; list2.Add((list[num2].Item1, num)); } float num3 = Random.Range(0f, num); T val = default(T); foreach (var (val2, num4) in list2) { if (num3 < num4) { val = val2; break; } } if (val == null) { Plugin.ExtendedLogging("Could not find a valid object to spawn of type " + typeof(T).Name + "!"); return default(T); } return val; } public static Vector3 CalculateAverageLandNodePosition(IEnumerable nodes) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; foreach (GameObject node in nodes) { val += node.transform.position; num++; } return (num > 0) ? (val / (float)num) : Vector3.zero; } public static IEnumerator ForcePlayerLookup(PlayerControllerB player, float intensity) { float totalTime = 1f / intensity; float timeElapsed = 0f; Vector2 upwardInput = new Vector2(0f, 1f) * intensity; while (timeElapsed <= totalTime) { CalculateVerticalLookingInput(upwardInput, player); timeElapsed += Time.deltaTime; yield return null; } } public static IEnumerator AlternateForcePlayerLookup(PlayerControllerB player, float length, float intensity) { float timeElapsed = 0f; Vector2 upwardInput = new Vector2(0f, 1f) * intensity; while (timeElapsed <= length) { CalculateVerticalLookingInput(upwardInput, player); timeElapsed += Time.deltaTime; yield return null; } } public static void CalculateVerticalLookingInput(Vector2 inputVector, PlayerControllerB playerCurrentlyControlling) { //IL_0047: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!playerCurrentlyControlling.smoothLookEnabledLastFrame) { playerCurrentlyControlling.smoothLookEnabledLastFrame = true; playerCurrentlyControlling.smoothLookTurnCompass.rotation = ((Component)playerCurrentlyControlling.gameplayCamera).transform.rotation; playerCurrentlyControlling.smoothLookTurnCompass.SetParent((Transform)null); } playerCurrentlyControlling.cameraUp -= inputVector.y; playerCurrentlyControlling.cameraUp = Mathf.Clamp(playerCurrentlyControlling.cameraUp, -80f, 60f); playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles = new Vector3(playerCurrentlyControlling.cameraUp, playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles.y, playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles.z); ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles = new Vector3(Mathf.LerpAngle(((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.x, playerCurrentlyControlling.cameraUp, playerCurrentlyControlling.smoothLookMultiplier * Time.deltaTime), ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.y, ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.z); } } public class DeathTrigger : MonoBehaviour { public void OnTriggerEnter(Collider other) { //IL_001b: 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_002b: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)8, 0, default(Vector3), false); } } } public class DetectLightInSurroundings : MonoBehaviour { [HideInInspector] public float lightValueOnThisObject = 0f; [HideInInspector] public UnityEvent OnLightValueChange = new UnityEvent(); public void OnEnable() { LightUpdateManager.detectLightInSurroundings.Add(this); } public void OnDisable() { LightUpdateManager.detectLightInSurroundings.Remove(this); } public IEnumerator UpdateLightValue() { List<(Light light, HDAdditionalLightData hDAdditionalLightData)> roundLightData = new List<(Light, HDAdditionalLightData)>(); lightValueOnThisObject = 0f; roundLightData.Clear(); roundLightData.AddRange(CodeRebirthUtils.currentRoundLightData); foreach (var (light, hdLightData) in roundLightData) { if (!((Object)(object)light == (Object)null) && !((Object)(object)hdLightData == (Object)null) && ((Behaviour)light).enabled && !((Object)(object)((Component)this).transform == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController.nightVision == (Object)(object)light)) { Vector3 nodePosition = ((Component)this).transform.position; float attenuation = CalculateAttenuation(light, nodePosition); if (attenuation != 0f) { float contribution = light.intensity * attenuation; lightValueOnThisObject += contribution; yield return null; } } } OnLightValueChange.Invoke(lightValueOnThisObject); } private float CalculateAttenuation(Light light, Vector3 samplePosition) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) float range = light.range; RaycastHit val = default(RaycastHit); if ((int)light.type == 1) { if ((int)light.shadows != 0 && Physics.Raycast(samplePosition, -((Component)light).transform.forward, ref val, float.PositiveInfinity, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return 0f; } return 1f; } if ((int)light.type == 0) { float num = Vector3.Angle(((Component)light).transform.forward, samplePosition - ((Component)light).transform.position); if (num > light.spotAngle / 2f) { return 0f; } } float num2 = Vector3.Distance(samplePosition, ((Component)light).transform.position); if (num2 > range) { return 0f; } if ((int)light.shadows != 0 && Physics.Linecast(((Component)light).transform.position, samplePosition, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return 0f; } return 1f / (num2 * num2); } public void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); } } public delegate void OnFinishTalking(); public class DuckUI : NetworkBehaviour { public ItemUI itemUI = null; [SerializeField] private TextMeshProUGUI uiText = null; [SerializeField] private Transform duckTransform = null; public float bobDuration = 1f; public float talkSpeed = 0.1f; public CanvasGroup canvasGroup = null; private string fullText = string.Empty; private Vector3 originalDuckPos; private Vector3 originalLocalDuckPos; [HideInInspector] public bool isTalking = false; private float bobTimer = 0f; private AnimationCurve bobCurve = null; private Coroutine? duckCoroutine = null; public static DuckUI Instance; private void Awake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } ((Component)this).gameObject.transform.localPosition = Vector3.zero; SetTextManually(""); SetUIVisible(visible: false, instant: true); originalDuckPos = duckTransform.position; originalLocalDuckPos = duckTransform.localPosition; bobCurve = new AnimationCurve(); bobCurve.AddKey(new Keyframe(0f, 0f, 0f, 10f)); bobCurve.AddKey(new Keyframe(0.25f, 1f, 0f, 0f)); bobCurve.AddKey(new Keyframe(0.5f, 0f, 10f, 0f)); bobCurve.AddKey(new Keyframe(0.75f, -1f, 0f, 0f)); bobCurve.AddKey(new Keyframe(1f, 0f, -10f, 0f)); for (int i = 0; i < bobCurve.keys.Length; i++) { AnimationCurveUtil.SetKeyTangentMode(bobCurve, i, AnimationCurveUtil.TangentMode.Smooth); } } public void Update() { //IL_0016: 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) if (isTalking) { duckTransform.position = originalDuckPos; bobTimer += Time.deltaTime * 2.2f; if (bobTimer > bobDuration) { bobTimer = 0f; } float num = bobCurve.Evaluate(bobTimer / bobDuration); float num2 = Mathf.Lerp(140f, 150f, (num + 1f) / 2f); float num3 = originalLocalDuckPos.y + (num2 - 145f); duckTransform.localPosition = new Vector3(originalLocalDuckPos.x, num3, originalLocalDuckPos.z); } } public void SetTextManually(string text) { ((TMP_Text)uiText).text = text; } public void SetUIVisible(bool visible, bool instant = false) { if (instant) { canvasGroup.alpha = (visible ? 1f : 0f); } else { ((MonoBehaviour)this).StartCoroutine(FadeUI(visible)); } } private IEnumerator FadeUI(bool visible) { float startAlpha = canvasGroup.alpha; float endAlpha = (visible ? 1 : 0); float elapsedTime = 0f; while (elapsedTime < 0.3f) { canvasGroup.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / 0.3f); elapsedTime += Time.deltaTime; yield return null; } canvasGroup.alpha = endAlpha; } public void StartTalking(string text, float talkspeed, PlayerControllerB targetPlayer, bool isGlobal = false, OnFinishTalking? onFinishTalking = null) { if (!((Object)(object)targetPlayer == (Object)null) && (PlayerControllerBExtensions.IsLocalPlayer(targetPlayer) || isGlobal)) { if (duckCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(duckCoroutine); SetTextManually(""); } talkSpeed = talkspeed; fullText = text; isTalking = true; bobTimer = 0f; duckCoroutine = ((MonoBehaviour)this).StartCoroutine(DuckTalkCoroutine(onFinishTalking)); } } private IEnumerator DuckTalkCoroutine(OnFinishTalking? onFinishTalking) { ((TMP_Text)uiText).text = ""; string text = fullText; foreach (char c in text) { TextMeshProUGUI obj = uiText; ((TMP_Text)obj).text = ((TMP_Text)obj).text + c; yield return (object)new WaitForSeconds(talkSpeed); } duckTransform.localPosition = originalLocalDuckPos; isTalking = false; duckCoroutine = null; yield return (object)new WaitForSeconds(0.8f); onFinishTalking?.Invoke(); } } [CreateAssetMenu(fileName = "DynamicScreenShakeFalloff", menuName = "CodeRebirth/DynamicScreenShakeFalloff", order = 1)] public class DynamicScreenShakeFalloff : ScriptableObject { public float dynamicIncreaseFromBigToSmall = 0f; public float dynamicIncreaseFromLongToBig = 0f; public float dynamicIncreaseFromVeryStrongToLong = 0f; } [Serializable] public class ScanNodeData { public bool editMinRange; public int minRange; public bool editMaxRange; public int maxRange; public bool editHeader; public string headerText; public bool editSubText; public string subText; public bool editNodeType; public int nodeType; } public class EditScanNodeProperties : MonoBehaviour { [SerializeField] internal ScanNodeProperties? _scanNodeProperties = null; [SerializeField] private ScanNodeData _editedScanNodeData = null; public void EditScanNode() { if (!((Object)(object)_scanNodeProperties == (Object)null)) { if (_editedScanNodeData.editMinRange) { _scanNodeProperties.minRange = _editedScanNodeData.minRange; } if (_editedScanNodeData.editMaxRange) { _scanNodeProperties.maxRange = _editedScanNodeData.maxRange; } if (_editedScanNodeData.editHeader) { _scanNodeProperties.headerText = _editedScanNodeData.headerText; } if (_editedScanNodeData.editSubText) { _scanNodeProperties.subText = _editedScanNodeData.subText; } if (_editedScanNodeData.editNodeType) { _scanNodeProperties.nodeType = _editedScanNodeData.nodeType; } } } } public class EnemyLevelSpawner : MonoBehaviour { [Header("Misc")] public bool daytimeSpawner = false; public List enemySizesAllowed = new List { (EnemySize)0, (EnemySize)2, (EnemySize)1 }; public Transform spawnPosition = null; public int maxEnemiesToSpawn = 999; [Header("Timers")] public float spawnTimerStart = 10f; public float spawnTimerMin = 20f; public float spawnTimerMax = 30f; [Header("Special Enemies")] [Tooltip("Use EnemyType.EnemyName here.")] public List specialEnemiesToSpawn = new List(); internal float spawnTimer = 10f; public static Dictionary entitiesSpawned = new Dictionary(); private float enemiesSpawnedByPipe = 0f; private List<(EnemyType, float)> specialEnemies = new List<(EnemyType, float)>(); private IEnumerable<(EnemyType, float)> mainEnemiesToSpawn; private IEnumerable<(EnemyType, float)> ambientEnemiesToSpawn; [HideInInspector] public static List enemyLevelSpawners = new List(); public void Start() { enemyLevelSpawners.Add(this); foreach (string item in specialEnemiesToSpawn) { foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies) { if (enemy.enemyType.enemyName != item) { continue; } specialEnemies.Add((enemy.enemyType, enemy.rarity)); break; } } foreach (KeyValuePair item2 in entitiesSpawned) { Plugin.ExtendedLogging($"{item2.Key.enemyName} spawned {item2.Value} times"); } mainEnemiesToSpawn = RoundManager.Instance.currentLevel.OutsideEnemies.Select((SpawnableEnemyWithRarity x) => ((EnemyType enemyType, float))(enemyType: x.enemyType, x.rarity)).Concat<(EnemyType, float)>(specialEnemies); mainEnemiesToSpawn = mainEnemiesToSpawn.Where<(EnemyType, float)>(((EnemyType, float) x) => enemySizesAllowed.Contains(x.Item1.EnemySize)); ambientEnemiesToSpawn = RoundManager.Instance.currentLevel.DaytimeEnemies.Select((SpawnableEnemyWithRarity x) => ((EnemyType enemyType, float))(enemyType: x.enemyType, x.rarity)); spawnTimer = spawnTimerStart * 4f; spawnTimerMax *= 4f; spawnTimerMin *= 4f; if (spawnTimerMin > spawnTimerMax) { spawnTimerMin = spawnTimerMax; } } public void Update() { if (NetworkManager.Singleton.IsServer && (daytimeSpawner || !(RoundManager.Instance.currentOutsideEnemyPower > (float)RoundManager.Instance.currentLevel.maxOutsideEnemyPowerCount)) && (!daytimeSpawner || !(RoundManager.Instance.currentDaytimeEnemyPower > (float)RoundManager.Instance.currentLevel.maxDaytimeEnemyPowerCount)) && !(enemiesSpawnedByPipe >= (float)maxEnemiesToSpawn)) { spawnTimer -= Time.deltaTime; if (!(spawnTimer > 0f)) { spawnTimer = Random.Range(spawnTimerMin, spawnTimerMax); SpawnRandomEnemy(); } } } public EnemyAI? SpawnRandomEnemy() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) EnemyType val = (daytimeSpawner ? CRUtilities.ChooseRandomWeightedType(ambientEnemiesToSpawn) : CRUtilities.ChooseRandomWeightedType(mainEnemiesToSpawn)); if ((Object)(object)val == (Object)null) { return null; } if (entitiesSpawned.TryGetValue(val, out var value) && value >= val.MaxCount) { return null; } entitiesSpawned[val] = value + 1; enemiesSpawnedByPipe += 1f; Plugin.ExtendedLogging("Spawning " + val.enemyName); GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(spawnPosition.position, -1f, -3, val)); EnemySpawnerTracker enemySpawnerTracker = val2.AddComponent(); EnemyAI val3 = (enemySpawnerTracker.enemyAI = val2.GetComponent()); if (val3.enemyType.canDie) { RoundManager instance = RoundManager.Instance; instance.currentOutsideEnemyPower += val3.enemyType.PowerLevel; } return enemySpawnerTracker.enemyAI; } public void OnDestroy() { enemyLevelSpawners.Remove(this); entitiesSpawned.Clear(); } } public class EnemySpawnerTracker : MonoBehaviour { [HideInInspector] public EnemyAI enemyAI = null; private bool _removedFromSpawnedEnemies = false; public void Update() { if ((Object)(object)enemyAI == (Object)null) { Object.Destroy((Object)(object)this); } else if (!_removedFromSpawnedEnemies && enemyAI.isEnemyDead) { ((MonoBehaviour)this).StartCoroutine(HandleRemovingFromSpawnedEnemies(immediate: false)); } } public void OnDestroy() { ((MonoBehaviour)this).StartCoroutine(HandleRemovingFromSpawnedEnemies(immediate: true)); } private IEnumerator HandleRemovingFromSpawnedEnemies(bool immediate) { _removedFromSpawnedEnemies = true; if (!immediate) { yield return (object)new WaitForSeconds(15f); } if ((Object)(object)enemyAI.creatureAnimator != (Object)null) { ((Behaviour)enemyAI.creatureAnimator).enabled = false; } if ((Object)(object)enemyAI.creatureVoice != (Object)null) { ((Behaviour)enemyAI.creatureVoice).enabled = false; } if ((Object)(object)enemyAI.creatureSFX != (Object)null) { ((Behaviour)enemyAI.creatureSFX).enabled = false; } DawnEnemyAdditionalData enemyAdditionalData = DawnEnemyAdditionalData.CreateOrGet(enemyAI); foreach (EnemyAICollisionDetect enemyAICollisionDetect in enemyAdditionalData.EnemyAICollisionDetects) { Object.Destroy((Object)(object)enemyAICollisionDetect); } EnemyLevelSpawner.entitiesSpawned[enemyAI.enemyType]--; ((Behaviour)enemyAI).enabled = false; Object.Destroy((Object)(object)this); } } public enum Direction { East, West, North, South } public class FallingObjectBehaviour : NetworkBehaviour { private float _timeInAir = 0f; private bool _isMoving = false; public AnimationCurve animationCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); [SerializeField] private UnityEvent _onImpact = new UnityEvent(); protected Vector3 _origin { get; private set; } protected Vector3 _target { get; private set; } protected Vector3 _normal { get; private set; } protected float _speed { get; private set; } public float Progress => _timeInAir / _travelTime; protected float _travelTime { get; private set; } public Vector3 CalculateRandomSkyOrigin(Direction direction, Vector3 target, Random random) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; float num3 = RandomExtensions.NextFloat(random, 250f, 500f); float num4 = RandomExtensions.NextFloat(random, 250f, 500f); switch (direction) { case Direction.East: num = num3; break; case Direction.West: num = 0f - num3; break; case Direction.North: num2 = num4; break; case Direction.South: num2 = 0f - num4; break; } float num5 = RandomExtensions.NextFloat(random, 600f, 900f); return target + new Vector3(num, num5, num2); } protected virtual void Update() { if (_isMoving) { MoveObject(); } } protected void MoveObject() { //IL_004d: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) _timeInAir += Time.deltaTime; float progress = Progress; if (progress >= 1f) { ((Component)this).transform.position = _target; _isMoving = false; OnImpact(); } else { Vector3 position = Vector3.Lerp(_origin, _target, animationCurve.Evaluate(progress)); ((Component)this).transform.position = position; } } protected virtual void OnImpact() { _onImpact.Invoke(); } protected virtual void OnSetup() { } protected virtual float CalculateTravelTime(float distance) { return Mathf.Sqrt(2f * distance / _speed); } public void StopMoving() { _isMoving = false; } [ServerRpc(RequireOwnership = false)] public void SetupFallingObjectServerRpc(Vector3 origin, Vector3 target, float speed) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetupFallingObjectClientRpc(origin, target, speed); } [ClientRpc] public void SetupFallingObjectClientRpc(Vector3 origin, Vector3 target, float speed) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetupFallingObject(origin, target, speed); } public void SetupFallingObject(Vector3 origin, Vector3 target, float speed) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) _origin = origin; _target = target; _speed = speed; float num = Vector3.Distance(_origin, _target); Ray val = default(Ray); ((Ray)(ref val))..ctor(_origin, _target - _origin); RaycastHit val2 = default(RaycastHit); Physics.Raycast(val, ref val2, num + 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); Plugin.ExtendedLogging($"Raycast started at: {_origin} and wanted to end at: {_target}, hit: {((RaycastHit)(ref val2)).point} with normal: {((RaycastHit)(ref val2)).normal}"); _target = ((RaycastHit)(ref val2)).point; _normal = ((RaycastHit)(ref val2)).normal; num = Vector3.Distance(_origin, _target); _travelTime = CalculateTravelTime(num); Plugin.ExtendedLogging($"Travel Time: {_travelTime}"); _isMoving = true; ((Component)this).transform.LookAt(_target); OnSetup(); } } public class ForceEnemyToDestination : MonoBehaviour { public EnemyAI? enemy = null; public Vector3 Destination = Vector3.zero; public bool needed = true; public IEnumerator Start() { yield return (object)new WaitUntil((Func)(() => (Object)(object)enemy != (Object)null && Destination != Vector3.zero)); EnemyAI val = enemy; if (val is Janitor janitor) { janitor.CalculateAndSetNewPath(Destination); } } public void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!needed) { ((Behaviour)this).enabled = false; } if ((Object)(object)enemy == (Object)null || Destination == Vector3.zero || (Object)(object)enemy.agent == (Object)null || !((Behaviour)enemy.agent).enabled) { return; } if ((Object)(object)enemy.targetPlayer != (Object)null || Vector3.Distance(((Component)enemy).transform.position, Destination) <= 10f + enemy.agent.stoppingDistance) { needed = false; } else if (enemy is CodeRebirthEnemyAI codeRebirthEnemyAI) { if (codeRebirthEnemyAI is Janitor janitor) { if (((EnemyAI)janitor).currentBehaviourStateIndex != 0) { needed = false; } } else { codeRebirthEnemyAI.smartAgentNavigator.DoPathingToDestination(Destination); } } else { enemy.agent.SetDestination(Destination); } } } public class ForceLineRendererPositions : MonoBehaviour { [SerializeField] private LineRenderer _lineRenderer = null; [SerializeField] private Transform[] _transforms = Array.Empty(); private void Awake() { _lineRenderer.positionCount = _transforms.Length; } private void Update() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _transforms.Length; i++) { _lineRenderer.SetPosition(i, _transforms[i].position); } } } public class ForcePlayerCamera : MonoBehaviour { [Header("Auto-Aim Pull Settings")] [SerializeField] private float horizontalPullStrength = 2000f; [SerializeField] private float verticalPullStrength = 25f; [SerializeField] private Vector2 horizontalDeadzone = new Vector2(0.46f, 0.54f); [SerializeField] private Vector2 verticalDeadzone = new Vector2(0.35f, 0.6f); [SerializeField] private float cameraLerpSpeed = 20f; [SerializeField] private bool forceAlign = true; [SerializeField] private float forceAlignMinPull = 0.01f; [Header("Aim Target Override")] [SerializeField] private AnimationCurve AimTargetCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); [SerializeField] private float AimSpeedMouse = 1f; [Header("References")] public Camera gameplayCamera; public Transform turnCompass; public Transform playerBody; public Animator playerBodyAnimator; [Range(0f, 1f)] public float normalizedStrength = 1f; private float aimHorizontal; private float aimVertical; private Quaternion playerAim = Quaternion.identity; private bool AimTargetActive; private Vector3 AimTargetPosition; private float AimTargetTimer; private float AimTargetSpeed; private float AimTargetLerp; private int AimTargetPriority = -999; private Vector3 AimTargetSoftPosition; private float AimTargetSoftTimer; private float AimTargetSoftStrength; private float AimTargetSoftStrengthNoAim; private float AimTargetSoftStrengthCurrent; private int AimTargetSoftPriority = -999; private float PlayerAimingTimer; private float overrideAimStopTimer; private bool overrideAimStop; private float overrideAimSmooth; private float overrideAimSmoothTimer; public void SetupPlayer(PlayerControllerB player) { gameplayCamera = player.gameplayCamera; turnCompass = player.turnCompass; playerBody = player.thisPlayerBody; playerBodyAnimator = player.playerBodyAnimator; } public void AimTargetSet(Vector3 position, float time, float speed, GameObject obj, int priority) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (priority >= AimTargetPriority && AimTargetLerp == 0f) { AimTargetActive = true; AimTargetPosition = position; AimTargetTimer = time; AimTargetSpeed = speed; AimTargetPriority = priority; } } public void SetNormalizedStrength(float strength) { normalizedStrength = strength; } public void AimTargetSoftSet(Vector3 position, float time, float strength, float strengthNoAim, GameObject obj, int priority) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (priority >= AimTargetSoftPriority && !(AimTargetSoftPosition != Vector3.zero)) { if ((Object)(object)obj != (Object)null && AimTargetSoftTimer <= 0f) { PlayerAimingTimer = 0f; } AimTargetSoftPosition = position; AimTargetSoftTimer = time; AimTargetSoftStrength = strength; AimTargetSoftStrengthNoAim = strengthNoAim; AimTargetSoftPriority = priority; } } public void OverrideAimStop() { overrideAimStopTimer = 0.2f; } private void OverrideAimStopTick() { if (overrideAimStopTimer > 0f) { overrideAimStop = true; overrideAimStopTimer -= Time.deltaTime; } else { overrideAimStop = false; } } private void ResetPlayerAim(Quaternion _rotation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) float x = ((Quaternion)(ref _rotation)).eulerAngles.x; aimVertical = ((x > 180f) ? (x - 360f) : x); aimHorizontal = ((Quaternion)(ref _rotation)).eulerAngles.y; playerAim = _rotation; } private void HandleAutoAim() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: 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) Vector3 aimTargetPosition = AimTargetPosition; float num = Mathf.Clamp(Time.deltaTime, 0f, 0.1f); Vector3 val = gameplayCamera.WorldToViewportPoint(aimTargetPosition); float num2 = val.x - 0.5f; float num3 = Mathf.Abs(num2); float num4 = horizontalPullStrength * normalizedStrength; if (val.x < horizontalDeadzone.x || val.x > horizontalDeadzone.y) { float num5 = Mathf.Sign(num2); float num6 = num5 * num4 * num * num3; turnCompass.Rotate(Vector3.up * num6); playerBodyAnimator.SetBool("PullingCameraRight", num5 > 0f); playerBodyAnimator.SetBool("PullingCameraLeft", num5 < 0f); } else { playerBodyAnimator.SetBool("PullingCameraLeft", false); playerBodyAnimator.SetBool("PullingCameraRight", false); if (forceAlign && num3 < forceAlignMinPull) { Vector3 val2 = aimTargetPosition - turnCompass.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Quaternion val3 = Quaternion.LookRotation(normalized, Vector3.up); turnCompass.rotation = Quaternion.Slerp(turnCompass.rotation, val3, num * cameraLerpSpeed * normalizedStrength); } } Vector3 val4 = gameplayCamera.WorldToViewportPoint(aimTargetPosition + Vector3.up * 0.35f); float num7 = val4.y - 0.5f; float num8 = Mathf.Abs(num7); float num9 = verticalPullStrength * normalizedStrength; float num10 = aimVertical; if (val4.y > verticalDeadzone.y) { num10 = Mathf.Clamp(Mathf.Lerp(aimVertical, aimVertical - num9, num9 * num * num8), -89f, 89f); } else if (val4.y < verticalDeadzone.x) { num10 = Mathf.Clamp(Mathf.Lerp(aimVertical, aimVertical + num9, num9 * num * num8), -89f, 89f); } aimVertical = num10; Vector3 localEulerAngles = ((Component)gameplayCamera).transform.localEulerAngles; ((Component)gameplayCamera).transform.localEulerAngles = new Vector3(aimVertical, localEulerAngles.y, localEulerAngles.z); Vector3 val5 = Vector3.up * turnCompass.eulerAngles.y; playerBody.rotation = Quaternion.Lerp(playerBody.rotation, Quaternion.Euler(val5), num * cameraLerpSpeed * (1f - num3)); } private void Update() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00ba: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) float num = 1f; AimSpeedMouse = Mathf.Lerp(0.2f, 4f, 0.2f); if (AimTargetTimer <= 0f && !overrideAimStop) { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); val = ((!(AimTargetSoftTimer > 0f)) ? (val * AimSpeedMouse) : ((((Vector2)(ref val)).magnitude > 1f) ? ((Vector2)(ref val)).normalized : Vector2.zero)); aimHorizontal += val.x; aimVertical = Mathf.Clamp(aimVertical - val.y, -70f, 80f); playerAim = Quaternion.Euler(aimVertical, aimHorizontal, 0f); if (num > 0f) { playerAim = Quaternion.RotateTowards(((Component)this).transform.localRotation, playerAim, 10000f * Time.deltaTime); } if (((Vector2)(ref val)).magnitude > 0f) { PlayerAimingTimer = 0.1f; } } if (PlayerAimingTimer > 0f) { PlayerAimingTimer -= Time.deltaTime; } if (AimTargetTimer > 0f) { AimTargetTimer -= Time.deltaTime; AimTargetLerp = Mathf.Clamp01(AimTargetLerp + Time.deltaTime * AimTargetSpeed); } else if (AimTargetLerp > 0f) { ResetPlayerAim(((Component)this).transform.localRotation); AimTargetLerp = 0f; AimTargetPriority = -999; AimTargetActive = false; } Quaternion val2 = playerAim; if (AimTargetActive) { val2 = Quaternion.LerpUnclamped(playerAim, Quaternion.LookRotation(AimTargetPosition - ((Component)this).transform.position), AimTargetCurve.Evaluate(AimTargetLerp)); } if (AimTargetSoftTimer > 0f && AimTargetTimer <= 0f) { float num2 = ((PlayerAimingTimer <= 0f) ? AimTargetSoftStrengthNoAim : AimTargetSoftStrength); AimTargetSoftStrengthCurrent = Mathf.Lerp(AimTargetSoftStrengthCurrent, num2, 10f * Time.deltaTime); Quaternion val3 = Quaternion.LookRotation(AimTargetSoftPosition - ((Component)this).transform.position); val2 = Quaternion.Lerp(val2, val3, AimTargetSoftStrengthCurrent * Time.deltaTime); AimTargetSoftTimer -= Time.deltaTime; if (AimTargetSoftTimer <= 0f) { AimTargetSoftPriority = -999; } } if (overrideAimSmoothTimer > 0f) { num = overrideAimSmooth; overrideAimSmoothTimer -= Time.deltaTime; } if (!AimTargetActive && AimTargetSoftTimer <= 0f) { HandleAutoAim(); } else { ((Component)this).transform.localRotation = Quaternion.Lerp(((Component)this).transform.localRotation, val2, num / 100f * Time.deltaTime); ResetPlayerAim(((Component)this).transform.localRotation); } OverrideAimStopTick(); } } public class GameObjectEvents : MonoBehaviour { public GameObject[] gameObjects = Array.Empty(); public void EnableGameObject(int index) { gameObjects[index].SetActive(true); } public void DisableGameObject(int index) { gameObjects[index].SetActive(false); } } public class GrabAndLaunchPlayer : MonoBehaviour { public Transform pullTransform = null; private Coroutine? pullRoutine = null; private PlayerControllerB? playerToLaunch = null; public AudioSource audioSource = null; public AudioClip[] launchSounds = Array.Empty(); public void OnTriggerStay(Collider other) { PlayerControllerB player = default(PlayerControllerB); if (((Behaviour)this).enabled && pullRoutine == null && ((Component)other).gameObject.TryGetComponent(ref player)) { pullRoutine = ((MonoBehaviour)this).StartCoroutine(PullAndTrapPlayer(player)); } } private IEnumerator PullAndTrapPlayer(PlayerControllerB player) { audioSource.PlayOneShot(launchSounds[Random.Range(0, launchSounds.Length)]); player.disableMoveInput = true; playerToLaunch = player; ItemCrate crate = ((Component)((Component)this).transform.parent).GetComponent(); yield return (object)new WaitForSeconds(1.375f); playerToLaunch = null; player.disableMoveInput = false; player.externalForceAutoFade += ((Component)crate).transform.up * 1000f; yield return (object)new WaitForSeconds(0.458f); crate.ResetWoodenCrate(); yield return (object)new WaitForSeconds(0.458f); ((MonoBehaviour)this).StartCoroutine(CheckIfPlayerIsDead(player)); pullRoutine = null; ((Behaviour)this).enabled = false; } private IEnumerator CheckIfPlayerIsDead(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { yield return (object)new WaitUntil((Func)(() => player.isPlayerDead || player.thisController.isGrounded)); if (!player.isPlayerDead) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Crateapult); } } } public void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (pullRoutine != null && (Object)(object)playerToLaunch != (Object)null) { ((Component)playerToLaunch).transform.position = pullTransform.position; } } } public class GrabAndPullPlayer : MonoBehaviour { public Transform pullTransform = null; private Coroutine? pullRoutine = null; public AudioSource audioSource = null; public AudioClip[] pullSounds = Array.Empty(); public void OnTriggerStay(Collider other) { PlayerControllerB player = default(PlayerControllerB); if (((Behaviour)this).enabled && pullRoutine == null && ((Component)other).gameObject.TryGetComponent(ref player)) { pullRoutine = ((MonoBehaviour)this).StartCoroutine(PullAndTrapPlayer(player)); } } private IEnumerator PullAndTrapPlayer(PlayerControllerB player) { audioSource.PlayOneShot(pullSounds[Random.Range(0, pullSounds.Length)]); player.disableMoveInput = true; ItemCrate crate = ((Component)((Component)this).transform.parent).GetComponent(); crate.CloseCrateOnPlayerLocally(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player)); yield return (object)new WaitForSeconds(0.3f); while (((Behaviour)this).enabled) { ((Component)player).transform.position = pullTransform.position; yield return (object)new WaitForFixedUpdate(); } player.disableMoveInput = false; pullRoutine = null; } } public class GregBounds : BoundsDefiner { public void OnEnable() { GunslingerGreg.safeBounds.Add(this); } public void OnDisable() { GunslingerGreg.safeBounds.Remove(this); } } public class HittableCollisionDetect : MonoBehaviour, IHittable { [SerializeField] private CRHittable _mainScript = null; public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return _mainScript.Hit(force, hitDirection, playerWhoHit, playHitSFX, hitID); } } public class HUDMessageEvent : MonoBehaviour { public HUDDisplayTip tip; public bool playOnAwake = false; private void Awake() { if (playOnAwake) { PlayTip(); } } public void PlayTip() { HUDManagerExtensions.DisplayTip(HUDManager.Instance, tip); } public void PlayNetworkedTip() { DawnNetworker instance = NetworkSingleton.Instance; if (instance != null) { instance.BroadcastDisplayTipServerRpc(tip); } } } public interface IExplodeable { void OnExplosion(int force, Vector3 explosionPosition, float distanceToExplosion); } public class InteractSeatable : InteractTrigger { [Header("Interact Seatable")] [SerializeField] private string _actionToExit = ""; [SerializeField] private AudioSource? _seatableSource = null; [SerializeField] private UnityEvent _onPlayerSit = new UnityEvent(); [SerializeField] private UnityEvent _onPlayerStand = new UnityEvent(); private InputAction? _playerAction = null; public PlayerControllerB? SittingPlayer { get; private set; } public bool LocalPlayerSeated { get; private set; } public Vector3 PlayerExitPoint { get; private set; } = Vector3.zero; private void Reset() { base.hoverTip = "Sit down : [LMB]"; base.oneHandedItemAllowed = true; base.holdInteraction = true; base.timeToHold = 0.2f; base.cooldownTime = 0.3f; base.specialCharacterAnimation = true; base.stopAnimationManually = true; base.stopAnimationString = "SA_stopAnimation"; base.hidePlayerItem = true; base.animationWaitTime = 2f; base.animationString = "SA_Truck"; base.lockPlayerPosition = true; base.clampLooking = true; base.setVehicleAnimation = true; base.minVerticalClamp = 50f; base.maxVerticalClamp = -70f; base.horizontalClamp = 120f; } public void Awake() { ((UnityEvent)(object)base.onInteractEarlyOtherClients).AddListener((UnityAction)delegate(PlayerControllerB player) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (PlayerControllerBExtensions.IsLocalPlayer(player)) { SetPlayerOnSeatServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)player)); } }); _playerAction = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.FindAction(_actionToExit, false); } public void Update() { ((InteractTrigger)this).Update(); if (LocalPlayerSeated && !((Object)(object)SittingPlayer == (Object)null) && _playerAction != null && _playerAction.WasPressedThisFrame()) { ExitChairLocal(teleport: true); ExitChairServerRpc(); } } public void SetPlayerOnSeatLocal(PlayerControllerB playerSitting) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (PlayerControllerBExtensions.IsLocalPlayer(playerSitting)) { PlayerExitPoint = ((Component)playerSitting.visorCamera).transform.position; LocalPlayerSeated = true; } SittingPlayer = playerSitting; base.interactable = false; _onPlayerSit.Invoke(); } public void ExitChairLocal(bool teleport = false) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)SittingPlayer == (Object)null)) { if (teleport) { SittingPlayer.TeleportPlayer(PlayerExitPoint, false, 0f, false, true); } _onPlayerStand.Invoke(); PlayerExitPoint = Vector3.zero; LocalPlayerSeated = false; SittingPlayer = null; base.interactable = true; } } [ServerRpc(RequireOwnership = false)] public void SetPlayerOnSeatServerRpc(NetworkBehaviourReference playerReference) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!LocalPlayerSeated && !((Object)(object)SittingPlayer != (Object)null)) { SetPlayerOnSeatClientRpc(playerReference); } } [ClientRpc] public void SetPlayerOnSeatClientRpc(NetworkBehaviourReference playerReference) { PlayerControllerB playerOnSeatLocal = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerReference)).TryGet(ref playerOnSeatLocal, (NetworkManager)null)) { SetPlayerOnSeatLocal(playerOnSeatLocal); } } [ServerRpc(RequireOwnership = false)] public void ExitChairServerRpc() { ExitChairClientRpc(); } [ClientRpc] public void ExitChairClientRpc() { ExitChairLocal(); } } [Serializable] public class InterfaceReference where TInterface : class where TObject : Object { [SerializeField] [HideInInspector] private TObject underlyingValue; public TInterface Value { get { TObject val = underlyingValue; if (1 == 0) { } TInterface result; if (val != null) { if (!(val is TInterface val2)) { throw new InvalidOperationException(string.Format("{0} needs to implement interface {1}.", underlyingValue, "TInterface")); } result = val2; } else { result = null; } if (1 == 0) { } return result; } set { if (1 == 0) { } TObject val2; if (value != null) { TObject val = (TObject)(object)((value is TObject) ? value : null); if (val == null) { throw new ArgumentException($"{value} needs to be of type {typeof(TObject)}.", string.Empty); } val2 = val; } else { val2 = default(TObject); } if (1 == 0) { } underlyingValue = val2; } } public TObject UnderlyingValue { get { return underlyingValue; } set { underlyingValue = value; } } public InterfaceReference() { } public InterfaceReference(TObject target) { underlyingValue = target; } public InterfaceReference(TInterface @interface) { underlyingValue = (TObject)(object)((@interface is TObject) ? @interface : null); } public static implicit operator TInterface(InterfaceReference obj) { return obj.Value; } } [Serializable] public class InterfaceReference : InterfaceReference where TInterface : class { } public class ItemUI : MonoBehaviour { public RectTransform uiElement = null; public float defaultScale = 0.2f; [SerializeField] private TextMeshProUGUI itemName = null; [SerializeField] private Image itemImage = null; [SerializeField] private CanvasGroup canvasGroup = null; [HideInInspector] public Camera mainCamera = null; [HideInInspector] public PlayerControllerB? player = null; private PhysicsProp? parentItem = null; public void StartUIforItem(PhysicsProp item) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)player)) { parentItem = item; itemImage.sprite = ((GrabbableObject)item).itemProperties.itemIcon; ((TMP_Text)itemName).text = ((GrabbableObject)item).itemProperties.itemName; mainCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; } } public void Update() { //IL_0033: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parentItem == (Object)null) { canvasGroup.alpha = 0f; return; } ((Component)itemImage).transform.localScale = Vector3.one * Mathf.LerpUnclamped(0.45f, 0.5f, Mathf.Sin(Time.time * 4f) * 0.5f + 0.5f); float num = Vector3.Distance(((Component)mainCamera).transform.position, ((Component)parentItem).transform.position); Vector3 val = mainCamera.WorldToScreenPoint(((Component)parentItem).transform.position); if (val.z > 0f && num > 1f) { RectTransform component = ((Component)((Component)uiElement).GetComponentInParent()).GetComponent(); Vector2 val2 = Vector2.op_Implicit(mainCamera.ScreenToViewportPoint(val)); Vector2 sizeDelta = component.sizeDelta; Vector2 anchoredPosition = default(Vector2); ((Vector2)(ref anchoredPosition))..ctor(val2.x * sizeDelta.x - sizeDelta.x * 0.5f, val2.y * sizeDelta.y - sizeDelta.y * 0.5f); uiElement.anchoredPosition = anchoredPosition; float num2 = Mathf.Clamp01(num * defaultScale); ((Transform)uiElement).localScale = new Vector3(num2, num2, num2); canvasGroup.alpha = 1f; } else { canvasGroup.alpha = 0f; } } } [Serializable] public class ItemWithRarityAndColor { public string itemName = "Item Name"; public float rarity = 0f; public int minPrice = 0; public int maxPrice = 0; public Color borderColor = new Color(0.18039216f, 0.7058824f, 0f, 1f); public Color textColor = new Color(13f / 51f, 1f, 0f, 1f); } [Serializable] public class RealItemWithRarityAndColor(Item? item, float rarity, int minPrice, int maxPrice, Color borderColor, Color textColor) { public Item? item = item; public float rarity = rarity; public int minPrice = minPrice; public int maxPrice = maxPrice; public Color borderColor = borderColor; public Color textColor = textColor; } [Serializable] public class SimplifiedRealItemWithRarityAndColor(Item? item, float rarity, Color borderColor, Color textColor) { public Item? item = item; public float rarity = rarity; public Color borderColor = borderColor; public Color textColor = textColor; } [Serializable] public class SimplifiedItemWithRarityAndColor { public string itemName; public float rarity; public Color borderColor; public Color textColor; } public interface ITriggerProxy { void OnProxyTriggerEnter(Collider other) { } void OnProxyTriggerStay(Collider other) { } void OnProxyTriggerExit(Collider other) { } } public class LightningStrikeScript { public static StormyWeather? stormyWeather; public static void SpawnLightningBolt(Vector3 strikePosition, Random lightningRandom, AudioSource lightningSource) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(RandomExtensions.NextFloat(lightningRandom, -32f, 32f), 0f, RandomExtensions.NextFloat(lightningRandom, -32f, 32f)); Vector3 position = strikePosition + Vector3.up * 160f + val; if ((Object)(object)stormyWeather == (Object)null) { stormyWeather = Object.FindObjectOfType(true); Plugin.ExtendedLogging("Getting stormy weather for the first time"); } LightningBoltPrefabScript val2 = Object.Instantiate(stormyWeather.targetedThunder); ((Behaviour)val2).enabled = true; ((LightningBoltPrefabScriptBase)val2).GlowWidthMultiplier = 2.5f; ((LightningBoltPrefabScriptBase)val2).DurationRange = new RangeOfFloats { Minimum = 0.6f, Maximum = 1.2f }; ((LightningBoltPrefabScriptBase)val2).TrunkWidthRange = new RangeOfFloats { Minimum = 0.6f, Maximum = 1.2f }; ((LightningBoltScript)val2).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; val2.Source.transform.position = position; val2.Destination.transform.position = strikePosition; ((LightningBoltPrefabScriptBase)val2).AutomaticModeSeconds = 0.2f; ((LightningBoltPrefabScriptBase)val2).Generations = 8; ((LightningBoltPrefabScriptBase)val2).CreateLightningBoltsNow(); ((Component)lightningSource).transform.position = strikePosition + Vector3.up * 0.5f; if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { lightningSource.volume = 0f; } else { lightningSource.volume = 0.2f; } stormyWeather.PlayThunderEffects(strikePosition, lightningSource); } } public class LightUpdateManager : MonoBehaviour { public static HashSet detectLightInSurroundings = new HashSet(); public void Start() { ((MonoBehaviour)this).StartCoroutine(DoUpdateDetectLightInSurroundings()); } public IEnumerator DoUpdateDetectLightInSurroundings() { List list = new List(); while (true) { yield return (object)new WaitUntil((Func)(() => CodeRebirthUtils.currentRoundLightData.Count > 0 && detectLightInSurroundings.Count > 0)); list.Clear(); list.AddRange(detectLightInSurroundings); foreach (DetectLightInSurroundings detectLight in list) { yield return ((MonoBehaviour)this).StartCoroutine(detectLight.UpdateLightValue()); yield return (object)new WaitForSeconds(0.5f); } } } } [CreateAssetMenu(fileName = "LogCommandDetails", menuName = "CodeRebirth/LogCommandDetails", order = 2)] public class LogCommandDetails : ScriptableObject { [field: SerializeField] public NamespacedKey NamespacedKey { get; private set; } [field: SerializeField] public TerminalCommandBasicInformation CommandBasicInformation { get; private set; } [field: SerializeField] public string MainKeyword { get; private set; } [field: SerializeField] public List InputKeywords { get; private set; } = new List(); [field: SerializeField] [field: TextArea(2, 10)] public List ResultDisplayTexts { get; private set; } = new List(); [field: SerializeField] public List SavedResultKeys { get; private set; } = new List(); [field: SerializeField] public List TextToAppendAfterEmptyResult { get; private set; } = new List(); [field: SerializeField] [field: TextArea(2, 10)] public string EmptyResultDisplayText { get; private set; } [field: SerializeField] [field: TextArea(2, 10)] public string PostEmptyResultDisplayText { get; private set; } internal string ResultDisplayText(string userInput) { PersistentDataContainer currentSave = DawnLib.GetCurrentSave(); if (currentSave == null) { return EmptyResultDisplayText; } HashSet orCreateDefault = ((DataContainer)currentSave).GetOrCreateDefault>(ExtraScanEvents._dataKey); orCreateDefault.UnionWith(((DataContainer)currentSave).GetOrCreateDefault>(CommitKeyToSave.CodeRebirthLoreKey)); for (int i = 0; i < InputKeywords.Count; i++) { if (orCreateDefault.Contains(SavedResultKeys[i]) && userInput.Equals(InputKeywords[i], StringComparison.OrdinalIgnoreCase)) { return ResultDisplayTexts[i]; } } StringBuilder stringBuilder = new StringBuilder(EmptyResultDisplayText); for (int j = 0; j < InputKeywords.Count; j++) { if (orCreateDefault.Contains(SavedResultKeys[j])) { stringBuilder.Append(TextToAppendAfterEmptyResult[j]); } } stringBuilder.Append(PostEmptyResultDisplayText); return stringBuilder.ToString(); } } public enum RaycastDirection { Forward, Back, Up, Down, Left, Right } public class MoveObjectToRaycastResult : MonoBehaviour { [field: SerializeField] public RaycastDirection RaycastDirection { get; private set; } [field: SerializeField] public bool WorldDirection { get; private set; } [field: SerializeField] public LayerMask LayerMask { get; private set; } [field: SerializeField] public QueryTriggerInteraction QueryTriggerInteraction { get; private set; } [field: SerializeField] public float Distance { get; private set; } [field: SerializeField] public bool DoOnAwake { get; private set; } public void Awake() { if (DoOnAwake) { MoveToRaycastResult(); } } public void MoveToRaycastResult() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)this).transform.position, CalculateForceDirection()); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, Distance, LayerMask.op_Implicit(LayerMask), QueryTriggerInteraction)) { Plugin.ExtendedLogging($"Starting from: {((Component)this).transform.position}, hit: {((RaycastHit)(ref val2)).point} with normal: {((RaycastHit)(ref val2)).normal} and Direction: {((Ray)(ref val)).direction}"); ((Component)this).transform.position = ((RaycastHit)(ref val2)).point; } } private Vector3 CalculateForceDirection() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) Vector3 result = Vector3.zero; switch (RaycastDirection) { case RaycastDirection.Forward: result = (WorldDirection ? Vector3.forward : ((Component)this).transform.forward); break; case RaycastDirection.Back: result = (WorldDirection ? Vector3.back : (-((Component)((Component)this).transform).transform.forward)); break; case RaycastDirection.Up: result = (WorldDirection ? Vector3.up : ((Component)((Component)this).transform).transform.up); break; case RaycastDirection.Down: result = (WorldDirection ? Vector3.down : (-((Component)((Component)this).transform).transform.up)); break; case RaycastDirection.Right: result = (WorldDirection ? Vector3.right : ((Component)((Component)this).transform).transform.right); break; case RaycastDirection.Left: result = (WorldDirection ? Vector3.left : (-((Component)((Component)this).transform).transform.right)); break; } return result; } } public class OnEnemyDeath : MonoBehaviour { [SerializeField] private EnemyType _enemyType; [SerializeField] private UnityEvent _onDeath; [SerializeReference] private DuskAchievementReference _achievementReference; public void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EnemyAI.KillEnemy += new hook_KillEnemy(CheckWhoKilledEnemy); } private void CheckWhoKilledEnemy(orig_KillEnemy orig, EnemyAI self, bool destroy) { orig.Invoke(self, destroy); if ((Object)(object)self.enemyType != (Object)(object)_enemyType) { return; } DawnEnemyAdditionalData val = DawnEnemyAdditionalData.CreateOrGet(self); if (self.isEnemyDead) { _onDeath.Invoke(); if (val.KilledByPlayer && !((Object)(object)val.PlayerThatLastHit == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(val.PlayerThatLastHit)) { ((DuskContentReference)(object)_achievementReference).Resolve().TryCompleteAchievement(); } } } public void OnDestroy() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EnemyAI.KillEnemy -= new hook_KillEnemy(CheckWhoKilledEnemy); } } public class OnParticlesCollision : MonoBehaviour { [field: SerializeField] public ParticleSystem ParticleSystem { get; private set; } private void OnParticleCollision(GameObject other) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Plugin.Logger.LogInfo((object)("Particle hit: " + ((Object)other).name)); List list = new List(); int collisionEvents = ParticlePhysicsExtensions.GetCollisionEvents(ParticleSystem, other, list); if (collisionEvents > 0) { CodeRebirthUtils instance = CodeRebirthUtils.Instance; Item item = ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.Coin].Item; ParticleCollisionEvent val = list[0]; instance.SpawnScrap(item, ((ParticleCollisionEvent)(ref val)).intersection + Vector3.up * 0.25f); } } } } public class OxydeLightsManager : MonoBehaviour { [SerializeField] private Color[] _colors = Array.Empty(); [SerializeField] private Renderer[] _renderers = Array.Empty(); [SerializeField] private Light[] _lights = Array.Empty(); private int _currentLightIndex = 0; internal static OxydeLightsManager Instance; private void Start() { Instance = this; IncrementLights(); } public void IncrementLights() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (_currentLightIndex > _colors.Length - 1 || _colors.Length == 0) { return; } Light[] lights = _lights; foreach (Light val in lights) { val.color = _colors[_currentLightIndex]; } Renderer[] renderers = _renderers; foreach (Renderer val2 in renderers) { val2.sharedMaterials[1].color = _colors[_currentLightIndex]; } if (_currentLightIndex != 0) { foreach (EnemyLevelSpawner enemyLevelSpawner in EnemyLevelSpawner.enemyLevelSpawners) { if (!(enemyLevelSpawner is CompactorEnemyLevelSpawner)) { enemyLevelSpawner.spawnTimer = Random.Range(5, 10); } } } _currentLightIndex++; } } public class PlayEffectsOnAnimation : MonoBehaviour { [SerializeField] private ParticleSystem[] _particleSystems = Array.Empty(); public void PlayEffect() { ParticleSystem[] particleSystems = _particleSystems; foreach (ParticleSystem val in particleSystems) { val.Play(); } } public void PlayEffectWithIndex(int effectIndex) { _particleSystems[effectIndex].Play(true); } } public class PlaySoundOnAnimation : MonoBehaviour { [SerializeField] private List _audioSourcesWithClips = new List(); public void PlaySelectSourcesWithRandomSound(int index) { if (index < 0 || index >= _audioSourcesWithClips.Count) { Plugin.Logger.LogWarning((object)$"Index {index} is out of range for audio sources with clips."); return; } bool flag = false; bool flag2 = false; AudioSourceWithClips audioSourceWithClips = _audioSourcesWithClips[index]; if ((Object)(object)audioSourceWithClips.nearAudioSource != (Object)null && audioSourceWithClips.nearClips.Length != 0) { flag = true; PlayNearAudioClip(audioSourceWithClips); } if ((Object)(object)audioSourceWithClips.farAudioSource != (Object)null && audioSourceWithClips.farClips.Length != 0) { flag2 = true; PlayFarAudioClip(audioSourceWithClips); } if (!flag && !flag2) { Plugin.Logger.LogWarning((object)"No valid audio sources or clips found for the specified index."); } } private void PlayNearAudioClip(AudioSourceWithClips audioSourceWithClips) { int num = Random.Range(0, audioSourceWithClips.nearClips.Length); AudioClip val = audioSourceWithClips.nearClips[num]; audioSourceWithClips.nearAudioSource.PlayOneShot(val); Plugin.ExtendedLogging("Playing near audio clip: " + ((Object)val).name); } private void PlayFarAudioClip(AudioSourceWithClips audioSourceWithClips) { int num = Random.Range(0, audioSourceWithClips.farClips.Length); AudioClip val = audioSourceWithClips.farClips[num]; audioSourceWithClips.farAudioSource.PlayOneShot(val); Plugin.ExtendedLogging("Playing far audio clip: " + ((Object)val).name); } } public class PuppetDamageDealer : MonoBehaviour { public bool isEnabled = false; public Puppeteer puppeteer = null; private List puppeteers = new List(); public void OnTriggerStay(Collider other) { if (isEnabled && ((Object)((Component)other).gameObject).name.StartsWith("PuppeteerPuppet") && !puppeteers.Contains(((Component)other).gameObject)) { puppeteers.Add(((Component)other).gameObject); ((MonoBehaviour)this).StartCoroutine(ClearPuppet(((Component)other).gameObject)); } } private IEnumerator ClearPuppet(GameObject gameObject) { gameObject.GetComponent().Hit(1, ((Component)puppeteer).transform.forward); yield return (object)new WaitForSeconds(1f); if (puppeteers.Contains(gameObject)) { puppeteers.Remove(gameObject); } } } public class RainbowMaterialShift : MonoBehaviour { [SerializeField] private Renderer _renderer = null; [SerializeField] private float _speed = 1f; [Range(0f, 1f)] [SerializeField] private float _alpha = 1f; private Material _material = null; private float _currentColorHSV = 0f; private Random _colourRandom = new Random(); private static int counter = 0; private static readonly int ColorHash = Shader.PropertyToID("_Color"); private void Awake() { counter++; _material = _renderer.material; _colourRandom = new Random(StartOfRound.Instance.randomMapSeed + StartOfRound.Instance.allPlayerScripts.Length + counter); _currentColorHSV = (float)_colourRandom.NextDouble(); } private void Update() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0063: 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) _currentColorHSV += Time.deltaTime * _speed; if (_currentColorHSV > 1f) { _currentColorHSV -= 1f; } Color val = Color.HSVToRGB(_currentColorHSV, 1f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(val.r, val.g, val.b, _alpha); _material.SetColor(ColorHash, val2); } } public class ReactToVehicleCollision : MonoBehaviour { [SerializeField] private UnityEvent _onVehicleCollision = new UnityEvent(); private int _obstacleId = -1; private static int _nextObstacleId = 1; private static readonly Dictionary _reactToVehicleCollisions = new Dictionary(); private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) _obstacleId = _nextObstacleId; _nextObstacleId++; _reactToVehicleCollisions.Add(_obstacleId, this); Plugin.ExtendedLogging($"ReactToVehicleCollision: Registered vehicle reaction with ID {_obstacleId} at position {((Component)this).transform.position}"); } public void OnDestroy() { if (_reactToVehicleCollisions.ContainsKey(_obstacleId)) { _reactToVehicleCollisions.Remove(_obstacleId); Plugin.ExtendedLogging($"ReactToVehicleCollision: Unregistered vehicle reaction with ID {_obstacleId}"); } } public void OnTriggerEnter(Collider other) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) VehicleController val = default(VehicleController); if (((Component)other).TryGetComponent(ref val) && ((NetworkBehaviour)val).IsOwner && ((Vector3)(ref val.averageVelocity)).magnitude > 5f && Vector3.Angle(val.averageVelocity, ((Component)this).transform.position - val.mainRigidbody.position) < 80f) { CodeRebirthUtils.Instance.ReactToVehicleCollisionServerRpc(_obstacleId); val.CarReactToObstacle(val.mainRigidbody.position - ((Component)this).transform.position, ((Component)this).transform.position, Vector3.zero, (CarObstacleType)2, 1f, (EnemyAI)null, false); } } public void InvokeCollisionEvent() { _onVehicleCollision.Invoke(); } public static bool TryGetById(int obstacleId, out ReactToVehicleCollision? result) { return _reactToVehicleCollisions.TryGetValue(obstacleId, out result); } } [AttributeUsage(AttributeTargets.Field)] public class RequireInterfaceAttribute : PropertyAttribute { public readonly Type InterfaceType; public RequireInterfaceAttribute(Type interfaceType) { InterfaceType = interfaceType; } } [Serializable] public class RiseFromDifferentGroundTypes { public string groundTag; [Header("Events")] public UnityEvent onRiseStart = new UnityEvent(); public UnityEvent onRiseComplete = new UnityEvent(); public UnityEvent onGroundStart = new UnityEvent(); public UnityEvent onGroundComplete = new UnityEvent(); [Header("Rising Or Descending Settings")] public float depthToRaise = 1f; public float raiseSpeed = 0.25f; } public class RiseFromGroundOnSpawn : MonoBehaviour { [SerializeField] internal RiseFromDifferentGroundTypes[] _riseFromDifferentGroundTypes = Array.Empty(); internal RiseFromDifferentGroundTypes _riseFromDifferentGroundType = new RiseFromDifferentGroundTypes(); internal float _timeToTake = 0f; private Vector3 _originalPosition = Vector3.zero; public void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(((Component)this).transform.position + ((Component)this).transform.up * 0.1f, -((Component)this).transform.up, ref val, 2f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return; } string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag; _riseFromDifferentGroundType = _riseFromDifferentGroundTypes[0]; RiseFromDifferentGroundTypes[] riseFromDifferentGroundTypes = _riseFromDifferentGroundTypes; foreach (RiseFromDifferentGroundTypes riseFromDifferentGroundTypes2 in riseFromDifferentGroundTypes) { if (riseFromDifferentGroundTypes2.groundTag.Equals(tag, StringComparison.OrdinalIgnoreCase)) { _riseFromDifferentGroundType = riseFromDifferentGroundTypes2; break; } } _riseFromDifferentGroundType.onRiseStart.Invoke(); _originalPosition = ((Component)this).transform.position; ((Component)this).transform.position = ((Component)this).transform.position + ((Component)this).transform.up * (0f - _riseFromDifferentGroundType.depthToRaise); if (_riseFromDifferentGroundType.raiseSpeed > 0f) { _timeToTake = _riseFromDifferentGroundType.depthToRaise / _riseFromDifferentGroundType.raiseSpeed; } } public void Update() { //IL_001f: 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_003a: 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_0070: Unknown result type (might be due to invalid IL or missing references) _timeToTake -= Time.deltaTime; ((Component)this).transform.position = ((Component)this).transform.position + ((Component)this).transform.up * _riseFromDifferentGroundType.raiseSpeed * Time.deltaTime; if (_timeToTake <= 0f) { ((Component)this).transform.position = _originalPosition; FinishRisingOrGrounding(); } } private void FinishRisingOrGrounding() { if (_riseFromDifferentGroundType.raiseSpeed > 0f) { _riseFromDifferentGroundType.onRiseComplete.Invoke(); _riseFromDifferentGroundType.raiseSpeed *= -0.5f; } else { _riseFromDifferentGroundType.onGroundComplete.Invoke(); _riseFromDifferentGroundType.raiseSpeed *= -2f; } _timeToTake = _riseFromDifferentGroundType.depthToRaise / Mathf.Abs(_riseFromDifferentGroundType.raiseSpeed); ((Behaviour)this).enabled = false; } } public class RotateToDirection : MonoBehaviour { [field: SerializeField] public Vector3 Direction { get; private set; } = new Vector3(-90f, 0f, -45f); [field: SerializeField] public bool RotateOnAwake { get; private set; } = true; private void Awake() { if (RotateOnAwake) { ((MonoBehaviour)this).StartCoroutine(EnsureRotationIsForced()); } } public void Rotate() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.rotation = Quaternion.Euler(Direction); } private IEnumerator EnsureRotationIsForced() { yield return null; Rotate(); yield return null; Rotate(); yield return null; Rotate(); } } public class ScreenShakeOnAnimation : MonoBehaviour { [SerializeField] [Tooltip("List of screen shake targets that can be used to play audio when the screen shake is triggered.")] private ScreenShakeTarget[] _screenShakeTargets = Array.Empty(); public void ShakeScreenAnimEvent(AnimationEvent animationEvent) { Plugin.ExtendedLogging($"ShakeScreenAnimEvent called with AnimationEvent: {animationEvent}"); ShakeScreen(animationEvent.floatParameter, animationEvent.intParameter, animationEvent.stringParameter, animationEvent.objectReferenceParameter); } public void ShakeScreen(float outwardDistance, int shakeType, string shakeGameObjectName, Object objectReferenceParameter) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) DynamicScreenShakeFalloff dynamicScreenShakeFalloff = null; if (objectReferenceParameter is DynamicScreenShakeFalloff dynamicScreenShakeFalloff2) { dynamicScreenShakeFalloff = dynamicScreenShakeFalloff2; } Vector3 position = ((Component)this).transform.position; if (!string.IsNullOrEmpty(shakeGameObjectName)) { ScreenShakeTarget[] screenShakeTargets = _screenShakeTargets; foreach (ScreenShakeTarget screenShakeTarget in screenShakeTargets) { if (!(((Object)screenShakeTarget.screenShakeTarget).name != shakeGameObjectName)) { position = screenShakeTarget.screenShakeTarget.transform.position; PlayScreenShakeAudio(screenShakeTarget, position); PlayScreenShakeParticles(screenShakeTarget, position); break; } } } shakeType = Mathf.Clamp(shakeType, 0, 3); float num = Vector3.Distance(position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position); if (outwardDistance == -1f || num < outwardDistance) { HUDManager.Instance.ShakeCamera((ScreenShakeType)shakeType); } else { if (!((Object)(object)dynamicScreenShakeFalloff != (Object)null)) { return; } float num2 = 0f; for (int j = 0; j <= shakeType; j++) { switch (shakeType - j) { case 0: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromBigToSmall; break; case 1: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromLongToBig; break; case 2: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromVeryStrongToLong; break; case 3: num2 += 0f; break; } if (!(num > outwardDistance + num2)) { Plugin.ExtendedLogging($"ShakeType: {shakeType} - i: {j} - outwardDistanceIncrease: {num2} - distanceToPlayer: {num} - outwardDistance: {outwardDistance}"); HUDManager.Instance.ShakeCamera((ScreenShakeType)(shakeType - j)); break; } } } } private void PlayScreenShakeAudio(ScreenShakeTarget screenShakeTarget, Vector3 shakeStartPosition) { //IL_004b: 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) if (screenShakeTarget.nearAudioClips.Length != 0) { AudioClip val = screenShakeTarget.nearAudioClips[CodeRebirthUtils.Instance.CRRandom.Next(screenShakeTarget.nearAudioClips.Length)]; if ((Object)(object)screenShakeTarget.audioSourceNear != (Object)null) { ((Component)screenShakeTarget.audioSourceNear).transform.position = shakeStartPosition; screenShakeTarget.audioSourceNear.PlayOneShot(val); } } if (screenShakeTarget.farAudioClips.Length != 0) { AudioClip val2 = screenShakeTarget.farAudioClips[CodeRebirthUtils.Instance.CRRandom.Next(screenShakeTarget.farAudioClips.Length)]; if ((Object)(object)screenShakeTarget.audioSourceFar != (Object)null) { ((Component)screenShakeTarget.audioSourceFar).transform.position = shakeStartPosition; screenShakeTarget.audioSourceFar.PlayOneShot(val2); } } } private void PlayScreenShakeParticles(ScreenShakeTarget screenShakeTarget, Vector3 shakeStartPosition) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (screenShakeTarget.particleSystems.Length != 0) { ParticleSystem[] particleSystems = screenShakeTarget.particleSystems; foreach (ParticleSystem val in particleSystems) { ((Component)val).transform.position = shakeStartPosition; val.Play(); } } } } public class ScreenShakeTarget : MonoBehaviour { [Tooltip("The target GameObject that will have it's position used for screen shake effects.")] public GameObject? screenShakeTarget = null; [Space(5f)] [Header("Visual Settings")] public ParticleSystem[] particleSystems = Array.Empty(); [Space(5f)] [Header("Audio Settings")] public AudioSource? audioSourceNear = null; public AudioClip[] nearAudioClips = Array.Empty(); public AudioSource? audioSourceFar = null; public AudioClip[] farAudioClips = Array.Empty(); public void ShakeScreenAnimEvent(AnimationEvent animationEvent) { ShakeScreen(animationEvent.floatParameter, animationEvent.intParameter, animationEvent.stringParameter, animationEvent.objectReferenceParameter); } public void ShakeScreen(float outwardDistance, int shakeType, string stringParameters, Object objectReferenceParameter) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) DynamicScreenShakeFalloff dynamicScreenShakeFalloff = null; if (objectReferenceParameter is DynamicScreenShakeFalloff dynamicScreenShakeFalloff2) { dynamicScreenShakeFalloff = dynamicScreenShakeFalloff2; } Vector3 position = ((Component)this).transform.position; if ((Object)(object)screenShakeTarget != (Object)null) { position = screenShakeTarget.transform.position; } PlayScreenShakeAudio(position); PlayScreenShakeParticles(position); shakeType = Mathf.Clamp(shakeType, 0, 3); float num = Vector3.Distance(position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position); if (outwardDistance == -1f || num < outwardDistance) { HUDManager.Instance.ShakeCamera((ScreenShakeType)shakeType); } else { if (!((Object)(object)dynamicScreenShakeFalloff != (Object)null)) { return; } float num2 = 0f; for (int i = 0; i <= shakeType; i++) { switch (shakeType - i) { case 0: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromBigToSmall; break; case 1: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromLongToBig; break; case 2: num2 += dynamicScreenShakeFalloff.dynamicIncreaseFromVeryStrongToLong; break; case 3: num2 += 0f; break; } if (!(num > outwardDistance + num2)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)(shakeType - i)); break; } } } } private void PlayScreenShakeAudio(Vector3 shakeStartPosition) { //IL_004b: 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) if (nearAudioClips.Length != 0) { AudioClip val = nearAudioClips[CodeRebirthUtils.Instance.CRRandom.Next(nearAudioClips.Length)]; if ((Object)(object)audioSourceNear != (Object)null) { ((Component)audioSourceNear).transform.position = shakeStartPosition; audioSourceNear.PlayOneShot(val); } } if (farAudioClips.Length != 0) { AudioClip val2 = farAudioClips[CodeRebirthUtils.Instance.CRRandom.Next(farAudioClips.Length)]; if ((Object)(object)audioSourceFar != (Object)null) { ((Component)audioSourceFar).transform.position = shakeStartPosition; audioSourceFar.PlayOneShot(val2); } } } private void PlayScreenShakeParticles(Vector3 shakeStartPosition) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (particleSystems.Length != 0) { ParticleSystem[] array = particleSystems; foreach (ParticleSystem val in array) { ((Component)val).transform.position = shakeStartPosition; val.Play(); } } } } public class ShipAnimator : MonoBehaviour { [HideInInspector] public AnimationClip originalShipLeaveClip = null; private Coroutine? _messWithEyeVolumeRoutine = null; private void Start() { AnimationClip[] animationClips = StartOfRound.Instance.shipAnimator.runtimeAnimatorController.animationClips; foreach (AnimationClip val in animationClips) { if (((Object)val).name == "ShipLeave") { originalShipLeaveClip = val; break; } } ((MonoBehaviour)this).StartCoroutine(WaitToReplaceClip()); } private IEnumerator WaitToReplaceClip() { while (true) { yield return (object)new WaitUntil((Func)(() => RoundManager.Instance.currentLevel.sceneName == "Oxyde" && !StartOfRound.Instance.inShipPhase)); yield return (object)new WaitUntil((Func)(() => StartOfRound.Instance.shipHasLanded)); ((Behaviour)StartOfRound.Instance.shipAnimator).enabled = false; yield return (object)new WaitUntil((Func)(() => StartOfRound.Instance.shipIsLeaving)); ((Behaviour)StartOfRound.Instance.shipAnimator).enabled = true; if (StartOfRound.Instance.connectedPlayersAmount + 1 - StartOfRound.Instance.livingPlayers == 0 && (float)(TimeOfDay.Instance.profitQuota - TimeOfDay.Instance.quotaFulfilled) <= 0f) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.GreatestAsset); } yield return (object)new WaitUntil((Func)(() => StartOfRound.Instance.shipDoorsEnabled)); bool switchOffOxyde = false; if (StartOfRound.Instance.livingPlayers == 0) { switchOffOxyde = true; } yield return (object)new WaitUntil((Func)(() => RoundManager.Instance.currentLevel.sceneName != "Oxyde" || StartOfRound.Instance.inShipPhase)); if (switchOffOxyde) { HUDManagerExtensions.DisplayTip(HUDManager.Instance, new HUDDisplayTip("Warning", "All players found dead, rerouting back to company for a rest.", (AlertType)1)); if (NetworkManager.Singleton.IsServer) { ((Registry)(object)LethalContent.Moons)[MoonKeys.Gordion].RouteTo(); } } ((MonoBehaviour)this).StartCoroutine(UnReplaceAnimationClip()); } } public void TurnOnDarkenedVolumeAnimEvent() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Plugin.ExtendedLogging("Animation Event worked"); StartOfRound.Instance.shipDoorAudioSource.PlayOneShot(StartOfRound.Instance.alarmSFX); SoundManager.Instance.earsRingingTimer = 0.6f; _messWithEyeVolumeRoutine = ((MonoBehaviour)this).StartCoroutine(MessWithEyeVolume()); CRUtilities.CreateExplosion(((Component)StartOfRound.Instance.shipAnimatorObject).transform.position + Vector3.back * 3f, spawnExplosionEffect: true, 0, 0f, 10f, 0, null, null, 0f); } public void KillAllPlayersAnimEvent() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_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_0033: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isPlayerDead) { CRUtilities.CreateExplosion(((Component)val).transform.position, spawnExplosionEffect: true, 999, 0f, 5f, 50, null, null, 100f); } } CRUtilities.CreateExplosion(((Component)StartOfRound.Instance.shipAnimatorObject).transform.position + Vector3.forward * 3f + Vector3.left * 3f, spawnExplosionEffect: true, 0, 0f, 10f, 0, null, null, 0f); CRUtilities.CreateExplosion(((Component)StartOfRound.Instance.shipAnimatorObject).transform.position + Vector3.forward * 3f + Vector3.right * 3f, spawnExplosionEffect: true, 0, 0f, 10f, 0, null, null, 0f); } private IEnumerator MessWithEyeVolume() { while (CodeRebirthUtils.Instance.CloseEyeVolume.weight < 0.8f) { yield return null; CodeRebirthUtils.Instance.CloseEyeVolume.weight = Mathf.MoveTowards(CodeRebirthUtils.Instance.CloseEyeVolume.weight, 0.8f, 4f * Time.deltaTime); } while (CodeRebirthUtils.Instance.CloseEyeVolume.weight > 0.3f) { yield return null; CodeRebirthUtils.Instance.CloseEyeVolume.weight = Mathf.MoveTowards(CodeRebirthUtils.Instance.CloseEyeVolume.weight, 0.3f, 0.5f * Time.deltaTime); } yield return (object)new WaitForSeconds(3f); while (CodeRebirthUtils.Instance.CloseEyeVolume.weight < 1f) { yield return null; CodeRebirthUtils.Instance.CloseEyeVolume.weight = Mathf.MoveTowards(CodeRebirthUtils.Instance.CloseEyeVolume.weight, 1f, 0.4f * Time.deltaTime); } _messWithEyeVolumeRoutine = null; } private IEnumerator UnReplaceAnimationClip() { yield return (object)new WaitUntil((Func)(() => _messWithEyeVolumeRoutine == null)); while (CodeRebirthUtils.Instance.CloseEyeVolume.weight > 0f) { yield return null; CodeRebirthUtils.Instance.CloseEyeVolume.weight = Mathf.MoveTowards(CodeRebirthUtils.Instance.CloseEyeVolume.weight, 0f, Time.deltaTime); } Plugin.ExtendedLogging("Reverted to the original HangarShipLand animation clip."); } } public static class SlowDownEffect { public static bool isSlowDownEffectActive = false; public static AudioSource[] audioSourcesToAffect = Array.Empty(); public static List<(AudioSource audioSource, float pitch, float volume, float dopplerLevel)> audioSourcesWithOldValues = new List<(AudioSource, float, float, float)>(); public static List occludeAudiosToReEnable = new List(); public static List<(AudioLowPassFilter filter, float oldCutOffFrequency)> lowPassFiltersWithOldValues = new List<(AudioLowPassFilter, float)>(); public static InteractTrigger? CurrentlyEditedTrigger { get; private set; } public static void SlowTrigger(InteractTrigger? trigger) { if (isSlowDownEffectActive && !((Object)(object)trigger == (Object)null) && !((Object)(object)CurrentlyEditedTrigger == (Object)(object)trigger)) { if ((Object)(object)CurrentlyEditedTrigger != (Object)null) { ResetSlowTrigger(CurrentlyEditedTrigger); } CurrentlyEditedTrigger = trigger; InteractTrigger? currentlyEditedTrigger = CurrentlyEditedTrigger; currentlyEditedTrigger.timeToHoldSpeedMultiplier /= Time.timeScale; } } public static void ResetSlowTrigger(InteractTrigger trigger) { if (isSlowDownEffectActive && !((Object)(object)trigger != (Object)(object)CurrentlyEditedTrigger)) { InteractTrigger? currentlyEditedTrigger = CurrentlyEditedTrigger; currentlyEditedTrigger.timeToHoldSpeedMultiplier *= Time.timeScale; CurrentlyEditedTrigger = null; } } public static void DoSlowdownEffect(float timeLength, float timeScale) { isSlowDownEffectActive = true; audioSourcesToAffect = Resources.FindObjectsOfTypeAll(); Time.timeScale = timeScale; audioSourcesWithOldValues.Clear(); occludeAudiosToReEnable.Clear(); lowPassFiltersWithOldValues.Clear(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.movementSpeed /= Time.timeScale * 0.8f; Animator playerBodyAnimator = GameNetworkManager.Instance.localPlayerController.playerBodyAnimator; playerBodyAnimator.speed /= Time.timeScale; AudioSource[] array = audioSourcesToAffect; foreach (AudioSource audioSource in array) { SlowdownAudioSource(audioSource, timeLength); } ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(ResetTimeScaleAndMisc(audioSourcesWithOldValues, occludeAudiosToReEnable, lowPassFiltersWithOldValues, timeLength * Time.timeScale)); } public static void SlowdownAudioSource(AudioSource audioSource, float timeDelay) { audioSourcesWithOldValues.Add((audioSource, audioSource.pitch, audioSource.volume, audioSource.dopplerLevel)); audioSource.pitch = 0.2f; audioSource.volume = 0.7f * audioSource.volume; audioSource.dopplerLevel = 0f; OccludeAudio val = default(OccludeAudio); if (((Component)audioSource).gameObject.TryGetComponent(ref val) && ((Behaviour)val).enabled) { occludeAudiosToReEnable.Add(val); ((Behaviour)val).enabled = false; } AudioLowPassFilter val2 = default(AudioLowPassFilter); if (((Component)audioSource).gameObject.TryGetComponent(ref val2)) { lowPassFiltersWithOldValues.Add((val2, val2.cutoffFrequency)); val2.cutoffFrequency = 1000f; } else { val2 = ((Component)audioSource).gameObject.AddComponent(); Object.Destroy((Object)(object)val2, timeDelay * Time.timeScale); val2.cutoffFrequency = 1000f; } } public static void ReEnableOccludeAudio(OccludeAudio occludeAudio) { if (!((Object)(object)occludeAudio == (Object)null)) { ((Behaviour)occludeAudio).enabled = true; } } public static void ResetAudioSourceVariables(AudioSource audioSource, float pitch, float volume, float dopplerLevel) { if (!((Object)(object)audioSource == (Object)null)) { audioSource.pitch = pitch; audioSource.volume = volume; audioSource.dopplerLevel = dopplerLevel; } } public static void ResetLowPassFilterValue(AudioLowPassFilter filter, float cutoffFrequency) { if (!((Object)(object)filter == (Object)null)) { filter.cutoffFrequency = cutoffFrequency; } } public static IEnumerator ResetTimeScaleAndMisc(List<(AudioSource audioSource, float pitch, float volume, float dopplerLevel)> audioSourcesWithOldValues, List occludeAudiosToReEnable, List<(AudioLowPassFilter filter, float oldCutOffFrequency)> lowPassFiltersWithOldValues, float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)CurrentlyEditedTrigger != (Object)null) { ResetSlowTrigger(CurrentlyEditedTrigger); } Time.timeScale = 1f; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.movementSpeed /= 6f; Animator playerBodyAnimator = GameNetworkManager.Instance.localPlayerController.playerBodyAnimator; playerBodyAnimator.speed /= 5f; foreach (var (audioSource, pitch, volume, dopplerLevel) in audioSourcesWithOldValues) { ResetAudioSourceVariables(audioSource, pitch, volume, dopplerLevel); } foreach (OccludeAudio occludeAudio in occludeAudiosToReEnable) { ReEnableOccludeAudio(occludeAudio); } foreach (var (filter, oldCutOffFrequency) in lowPassFiltersWithOldValues) { ResetLowPassFilterValue(filter, oldCutOffFrequency); } float timeElapsed = 1f; while (timeElapsed > 0f) { timeElapsed -= Time.deltaTime; yield return null; } isSlowDownEffectActive = false; } } public class SpawnAndParentObject : NetworkBehaviour { private GameObject objectToSpawn = null; [field: SerializeField] public List ObjectsToSpawnList { get; private set; } public override void OnNetworkSpawn() { //IL_0058: 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) ((NetworkBehaviour)this).OnNetworkSpawn(); if (!((NetworkBehaviour)this).IsServer) { return; } int num = Random.Range(0, ObjectsToSpawnList.Count); objectToSpawn = ObjectsToSpawnList[num]; GameObject val = Object.Instantiate(objectToSpawn, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform); NetworkObject networkObject = default(NetworkObject); if (val.TryGetComponent(ref networkObject)) { networkObject.Spawn(true); NetworkObjectExtensions.OnSpawn(networkObject, (Action)delegate { networkObject.TrySetParent(((Component)this).transform, true); }); } else { SpawnGameObjectOnIndexServerRpc(num); } } [ServerRpc(RequireOwnership = false)] private void SpawnGameObjectOnIndexServerRpc(int indexToSpawn) { SpawnGameObjectOnIndexClientRpc(indexToSpawn); } [ClientRpc] private void SpawnGameObjectOnIndexClientRpc(int indexToSpawn) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { GameObject val = Object.Instantiate(ObjectsToSpawnList[indexToSpawn], ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform); } } } public class SpookyFlicker : MonoBehaviour { [Tooltip("Intensity range used for quick micro-flickers (as a fraction of base).")] [Range(0f, 1f)] [SerializeField] public float MinFrac = 0.4f; [Range(0f, 2f)] [SerializeField] public float MaxFrac = 1.2f; [Tooltip("How fast intensity can change (higher = snappier).")] [SerializeField] public float IntensityLerpSpeed = 10f; [Header("Flicker Timing")] [Tooltip("Minimum seconds between micro-flicker samples.")] [SerializeField] public Vector2 MicroIntervalRange = new Vector2(0.02f, 0.08f); [Tooltip("Random Perlin noise scroll speed for organic variation.")] [SerializeField] public float NoiseSpeed = 6f; [Tooltip("Chance per second to trigger a dramatic dim event.")] [Range(0f, 1f)] [SerializeField] public float DimEventRate = 0.15f; [Tooltip("How deep a dim event goes (multiplier of base intensity).")] [Range(0f, 1f)] [SerializeField] public float DimFloorFrac = 0.08f; [Tooltip("Duration range for a dim event.")] [SerializeField] public Vector2 DimDurationRange = new Vector2(0.08f, 0.35f); [Tooltip("Chance per second to trigger a short blackout.")] [Range(0f, 1f)] [SerializeField] public float BlackoutEventRate = 0.05f; [Tooltip("Duration range for a blackout event.")] [SerializeField] public Vector2 BlackoutDurationRange = new Vector2(0.15f, 0.7f); [Header("Sound")] [Tooltip("Looping 'buzz/hum' source.")] [SerializeField] public AudioSource? LoopSource = null; [Tooltip("One-shot source for ticks/pops etc.")] [SerializeField] public AudioSource? OneShotSource = null; [Tooltip("Played when a dim or blackout kicks in.")] [SerializeField] public AudioClip[] DimOrBlackoutClips = Array.Empty(); [Tooltip("Played when recovering back to normal after a dim/blackout.")] [SerializeField] public AudioClip[] RecoverClips = Array.Empty(); [Tooltip("Random pitch range applied to one-shots.")] [SerializeField] public Vector2 OneShotPitchRange = new Vector2(0.95f, 1.05f); private float _targetIntensity; private float _currentIntensity; private float _noiseT = 0f; private MaterialPropertyBlock _mpb; private Coroutine? _loop = null; private bool _inEvent = false; [field: Header("Targets")] [field: Tooltip("Primary light to flicker. If omitted, searches on this GameObject.")] [field: SerializeField] public Light TargetLight { get; private set; } [field: Tooltip("Optional renderers whose emission should follow the flicker (e.g., bulbs, signs).")] [field: SerializeField] public Renderer[] EmissiveRenderers { get; private set; } = Array.Empty(); [field: ColorUsage(true, true)] [field: SerializeField] public Color EmissionColor { get; private set; } = Color.white; [field: Header("Intensity")] [field: Tooltip("Nominal steady intensity when not flickering.")] [field: SerializeField] public float BaseIntensity { get; private set; } = 2f; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown _mpb = new MaterialPropertyBlock(); _currentIntensity = BaseIntensity; _targetIntensity = BaseIntensity; ApplyIntensityImmediate(_currentIntensity); } private void OnEnable() { StartFlicker(); } private void OnDisable() { StopFlicker(); } private void StartFlicker() { if (_loop == null) { EnsureLoopPlaying(); _loop = ((MonoBehaviour)this).StartCoroutine(FlickerLoop()); } } public void StopFlicker() { if (_loop != null) { ((MonoBehaviour)this).StopCoroutine(_loop); _loop = null; } _inEvent = false; _targetIntensity = BaseIntensity; ApplyIntensityImmediate(BaseIntensity); if ((Object)(object)LoopSource != (Object)null && LoopSource.isPlaying) { LoopSource.Stop(); } } private IEnumerator FlickerLoop() { float nextSampleTime = 0f; float time = 0f; float perlinOffset = Random.value * 1000f; while (((Behaviour)this).enabled) { time += Time.deltaTime; if (!_inEvent) { if (Random.value < BlackoutEventRate * Time.deltaTime) { yield return BlackoutEvent(); continue; } if (Random.value < DimEventRate * Time.deltaTime) { yield return DimEvent(); continue; } } if (time >= nextSampleTime) { float next = Random.Range(MicroIntervalRange.x, MicroIntervalRange.y); nextSampleTime = time + next; _noiseT += NoiseSpeed * next; float n = Mathf.PerlinNoise(perlinOffset + _noiseT, 0f); float frac = Mathf.Lerp(MinFrac, MaxFrac, n); _targetIntensity = BaseIntensity * frac; if (Random.value < 0.1f) { _targetIntensity *= Random.Range(0.7f, 1f); } if (_targetIntensity <= BaseIntensity * (MinFrac + 0.05f) && RecoverClips != null && RecoverClips.Length != 0) { PlayOneShot(RecoverClips); } } _currentIntensity = Mathf.Lerp(_currentIntensity, _targetIntensity, 1f - Mathf.Exp((0f - IntensityLerpSpeed) * Time.deltaTime)); ApplyIntensity(_currentIntensity); EnsureLoopPlaying(); yield return null; } } private IEnumerator DimEvent() { _inEvent = true; float duration = Random.Range(DimDurationRange.x, DimDurationRange.y); PlayOneShot(DimOrBlackoutClips); yield return TweenTo(BaseIntensity * DimFloorFrac, 0.02f, 0.04f); float timeElapsed = 0f; while (timeElapsed < duration) { timeElapsed += Time.deltaTime; float trem = 1f + (Mathf.PerlinNoise(_noiseT * 3f, 1f) - 0.5f) * 0.15f; ApplyIntensity(BaseIntensity * DimFloorFrac * trem); yield return null; } PlayOneShot(RecoverClips); yield return TweenTo(BaseIntensity * Random.Range(0.85f, 1.1f), 0.05f, 0.12f); _inEvent = false; } private IEnumerator BlackoutEvent() { _inEvent = true; float duration = Random.Range(BlackoutDurationRange.x, BlackoutDurationRange.y); PlayOneShot(DimOrBlackoutClips); yield return TweenTo(0f, 0.01f, 0.03f); float savedLoopVol = 0f; if ((Object)(object)LoopSource != (Object)null) { savedLoopVol = LoopSource.volume; LoopSource.volume = savedLoopVol * 0.35f; } float timeElapsed = 0f; while (timeElapsed < duration) { timeElapsed += Time.deltaTime; yield return null; } if ((Object)(object)LoopSource != (Object)null) { LoopSource.volume = savedLoopVol; } PlayOneShot(RecoverClips); yield return TweenTo(BaseIntensity * Random.Range(0.9f, 1.15f), 0.06f, 0.15f); _inEvent = false; } private IEnumerator TweenTo(float target, float minTime, float maxTime) { float duration = Random.Range(minTime, maxTime); float timeElapsed = 0f; float start = _currentIntensity; while (timeElapsed < duration) { timeElapsed += Time.deltaTime; float step = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(timeElapsed / duration)); ApplyIntensity(_currentIntensity = Mathf.Lerp(start, target, step)); yield return null; } _targetIntensity = target; _currentIntensity = target; ApplyIntensityImmediate(target); } private void EnsureLoopPlaying() { if (!((Object)(object)LoopSource == (Object)null) && !LoopSource.isPlaying) { LoopSource.Play(); } } private void PlayOneShot(AudioClip[] bank) { if (!((Object)(object)OneShotSource == (Object)null) && bank != null && bank.Length != 0) { AudioClip val = bank[Random.Range(0, bank.Length)]; if (!((Object)(object)val == (Object)null)) { OneShotSource.pitch = Random.Range(OneShotPitchRange.x, OneShotPitchRange.y); OneShotSource.PlayOneShot(val); } } } private void ApplyIntensity(float newIntensity) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) TargetLight.intensity = Mathf.Max(0f, newIntensity); if (EmissiveRenderers == null || EmissiveRenderers.Length == 0) { return; } float num = Mathf.Max(0f, newIntensity / Mathf.Max(0.0001f, BaseIntensity)); Renderer[] emissiveRenderers = EmissiveRenderers; foreach (Renderer val in emissiveRenderers) { if (!((Object)(object)val == (Object)null)) { val.GetPropertyBlock(_mpb); _mpb.SetColor("_EmissionColor", EmissionColor * num); val.SetPropertyBlock(_mpb); } } } private void ApplyIntensityImmediate(float val) { ApplyIntensity(val); Renderer[] emissiveRenderers = EmissiveRenderers; foreach (Renderer val2 in emissiveRenderers) { if ((Object)(object)val2 == (Object)null) { continue; } Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val3 in sharedMaterials) { if (!((Object)(object)val3 == (Object)null) && !val3.IsKeywordEnabled("_EMISSION")) { val3.EnableKeyword("_EMISSION"); } } } } } [Serializable] public class StringWithRarity { public string EnemyName; public float Rarity; } public class TMPTimer : MonoBehaviour { private bool _timerIsActive = true; private float _currentTime = 999f; private bool _canPlaySound = true; private int _currentSecond = 0; [field: SerializeField] public TextMeshPro TimerText { get; private set; } [field: SerializeField] public BoundedRange TotalSecondsRange { get; private set; } = new BoundedRange(90f, 180f); [field: SerializeField] public bool StartOnAwake { get; private set; } [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip SecondPassSound { get; private set; } [field: SerializeField] public float TimeToPlaySource { get; private set; } [field: SerializeField] public UnityEvent OnTimerEnd { get; private set; } private void Start() { if (StartOnAwake) { _timerIsActive = true; } else { _timerIsActive = false; } if (NetworkManager.Singleton.IsServer) { SyncTimerRpc(TotalSecondsRange.GetRandomInRange(new Random(StartOfRound.Instance.randomMapSeed + Random.Range(0, 1000)))); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SyncTimerRpc(float TotalSeconds) { _currentSecond = Mathf.ClampToInt((long)TotalSeconds); _currentTime = TotalSeconds; } public void StartTimer() { _timerIsActive = true; } private void Update() { if (_timerIsActive) { _currentTime -= Time.deltaTime; if (_currentTime <= 0f) { _timerIsActive = false; OnTimerEnd.Invoke(); _currentTime = 0f; } } TimeSpan timeSpan = TimeSpan.FromSeconds(_currentTime); int num = Mathf.ClampToInt((long)timeSpan.TotalSeconds); if (num < _currentSecond) { AudioSource.PlayOneShot(SecondPassSound); _currentSecond = num; } ((TMP_Text)TimerText).text = timeSpan.ToString("mm\\:ss\\:ff"); if (_canPlaySound && (float)_currentSecond <= TimeToPlaySource && !AudioSource.isPlaying) { _canPlaySound = false; AudioSource.Play(); } } } public class ToggleGameObjectInAnimation : MonoBehaviour { public GameObject targetGameObject; public void ToggleGameObject(int isActive) { if ((Object)(object)targetGameObject != (Object)null) { targetGameObject.SetActive(isActive == 1); } } } [Serializable] public class FloatIntStringObjectEvent : UnityEvent { } [Serializable] public class AnimationEventParameters { public float floatParameter; public int intParameter; public string stringParameter; public Object objectReferenceParameter; } public class TriggerAnimationUnityEvent : MonoBehaviour { [SerializeField] private FloatIntStringObjectEvent _animationUnityEvent = new FloatIntStringObjectEvent(); [SerializeField] private AnimationEventParameters animationEventParameters; public void TriggerScreenShake() { ((UnityEvent)(object)_animationUnityEvent).Invoke(animationEventParameters.floatParameter, animationEventParameters.intParameter, animationEventParameters.stringParameter, animationEventParameters.objectReferenceParameter); } } public class TriggerProxy : MonoBehaviour { [field: SerializeField] public InterfaceReference Trigger { get; private set; } private void OnTriggerEnter(Collider other) { Trigger.Value.OnProxyTriggerEnter(other); } private void OnTriggerStay(Collider other) { Trigger.Value.OnProxyTriggerStay(other); } private void OnTriggerExit(Collider other) { Trigger.Value.OnProxyTriggerExit(other); } } public class WaitForTimeBeforeEvent : MonoBehaviour { [SerializeField] private UnityEvent _afterWaitingEvent = new UnityEvent(); public void WaitAndDoEvent(float time) { ((MonoBehaviour)this).StartCoroutine(WaitAndDo(time)); } private IEnumerator WaitAndDo(float time) { yield return (object)new WaitForSeconds(time); _afterWaitingEvent.Invoke(); } } public class WeatherController : MonoBehaviour { public Renderer[] renderersToDisableEmissiveness = null; public Cubemap cubemapReplacement = null; public VolumeProfile volumeProfile = null; public Light[] lightsToDeactivate = null; public LocalVolumetricFog localVolumetricFog = null; public GameObject[] gameObjectsToActivate = null; public void Start() { if (NetworkManager.Singleton.IsServer) { SelectableLevelExtensions.GetDawnInfo(StartOfRound.Instance.currentLevel).ChangeWeatherTo((LevelWeatherType)(-1)); } } private IEnumerator HandleDarkness() { yield return (object)new WaitUntil((Func)(() => EnemyLevelSpawner.enemyLevelSpawners.Count > 0)); yield return null; yield return null; yield return null; yield return null; foreach (EnemyLevelSpawner enemyLevelSpawner in EnemyLevelSpawner.enemyLevelSpawners) { enemyLevelSpawner.spawnTimerMax /= 4f; enemyLevelSpawner.spawnTimerMin /= 4f; } GameObject[] array = gameObjectsToActivate; foreach (GameObject gameObject in array) { gameObject.SetActive(!gameObject.activeSelf); } Light[] array2 = lightsToDeactivate; foreach (Light light in array2) { light.intensity = 0f; } localVolumetricFog.parameters.meanFreePath = 20f; Material material = renderersToDisableEmissiveness[0].GetSharedMaterial(); material.SetColor("_EmissiveColor", Color.white); HDRISky hdriSky = default(HDRISky); if (volumeProfile.TryGet(ref hdriSky)) { ((VolumeParameter)hdriSky.hdriSky).overrideState = true; ((VolumeParameter)(object)hdriSky.hdriSky).value = (Texture)(object)cubemapReplacement; ((VolumeParameter)((SkySettings)hdriSky).exposure).overrideState = true; ((VolumeParameter)(object)((SkySettings)hdriSky).exposure).value = 2f; } } } [DefaultExecutionOrder(-999)] public class WeightedOutcomeScript : NetworkBehaviour { [Serializable] public class Outcome { [Min(0f)] public float weight = 1f; [Tooltip("Invoked on all clients when this outcome is selected.")] public UnityEvent onSelected = new UnityEvent(); [Tooltip("Invoked on all clients when this outcome is NOT selected (only if Disable Others is true).")] public UnityEvent onNotSelected = new UnityEvent(); } [Header("Outcomes")] [SerializeField] private Outcome[] _outcomes = Array.Empty(); [Header("Selection")] [Tooltip("Pick between Min and Max outcomes (inclusive).")] [SerializeField] private int _minSelect = 1; [SerializeField] private int _maxSelect = 1; [Tooltip("If false, an outcome can only be picked once per roll.")] [SerializeField] private bool _allowDuplicates = false; [Tooltip("If true, disable non-selected targets and invoke onNotSelected for them.")] [SerializeField] private bool _disableOthers = true; [Header("Roll Timing")] [Tooltip("If true, server rolls on OnNetworkSpawn().")] [SerializeField] private bool _rollOnSpawn = true; private NetworkList _chosen; private void Awake() { _chosen = new NetworkList(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); _chosen.OnListChanged += delegate { ApplySelection(); }; if (((NetworkBehaviour)this).IsServer && _rollOnSpawn) { RollServer(); } else { ApplySelection(); } } public override void OnNetworkDespawn() { if (_chosen != null) { _chosen.OnListChanged -= delegate { ApplySelection(); }; } ((NetworkBehaviour)this).OnNetworkDespawn(); } public void Roll() { if (((NetworkBehaviour)this).IsServer) { RollServer(); } else { RequestRollServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void RequestRollServerRpc() { RollServer(); } private void RollServer() { if (_outcomes == null || _outcomes.Length == 0) { _chosen.Clear(); return; } int num = Mathf.Clamp(_minSelect, 0, _outcomes.Length); int num2 = Mathf.Clamp(_maxSelect, num, _outcomes.Length); int num3 = Random.Range(num, num2 + 1); List list = new List(_outcomes.Length); for (int i = 0; i < _outcomes.Length; i++) { if (_outcomes[i].weight > 0f) { list.Add(i); } } _chosen.Clear(); if (list.Count == 0 || num3 == 0) { return; } for (int j = 0; j < num3; j++) { int num4 = PickWeightedIndex(list); _chosen.Add(num4); if (!_allowDuplicates) { list.Remove(num4); } if (list.Count == 0) { break; } } ApplySelection(); } private int PickWeightedIndex(List indices) { float num = 0f; for (int i = 0; i < indices.Count; i++) { num += _outcomes[indices[i]].weight; } float num2 = Random.Range(0f, num); float num3 = 0f; for (int j = 0; j < indices.Count; j++) { int num4 = indices[j]; num3 += _outcomes[num4].weight; if (num2 <= num3) { return num4; } } return indices[indices.Count - 1]; } private void ApplySelection() { if (_outcomes == null) { return; } HashSet hashSet = new HashSet(); for (int i = 0; i < _chosen.Count; i++) { hashSet.Add(_chosen[i]); } for (int j = 0; j < _outcomes.Length; j++) { if (hashSet.Contains(j)) { UnityEvent onSelected = _outcomes[j].onSelected; if (onSelected != null) { onSelected.Invoke(); } } else if (_disableOthers) { UnityEvent onNotSelected = _outcomes[j].onNotSelected; if (onNotSelected != null) { onNotSelected.Invoke(); } } } } } } namespace CodeRebirth.src.MiscScripts.CustomPasses { public class CustomPassManager { public enum CustomPassType { SeeThroughEnemies, SeeThroughItems, SeeThroughPlayers, SeeThroughHazards } private Dictionary _customPasses = new Dictionary(); private static CustomPassManager? _instance; private CustomPassVolume? _volume; public static CustomPassManager Instance { get { if (_instance == null) { _instance = new CustomPassManager(); } return _instance; } } public CustomPassVolume Volume { get { if ((Object)(object)_volume == (Object)null) { _volume = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject.AddComponent(); ConfigureVolume(); } return _volume; } } private void ConfigureVolume() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_volume == (Object)null)) { _volume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; _volume.injectionPoint = (CustomPassInjectionPoint)1; _volume.isGlobal = true; } } private void InitCustomPass(CustomPassType type) { //IL_003d: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) if (!HasCustomPass(type)) { CustomPass val = null; switch (type) { case CustomPassType.SeeThroughEnemies: { SeeThroughCustomPass seeThroughCustomPass4 = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass4).clearFlags = (ClearFlag)0; seeThroughCustomPass4.seeThroughLayer = LayerMask.op_Implicit(MoreLayerMasks.EnemiesMask); Color red2 = Color.red; Color fillColor4 = default(Color); ((Color)(ref fillColor4))..ctor(0.8f, 0f, 0f, 0.8f); seeThroughCustomPass4.ConfigureMaterial(red2, fillColor4, 0.04f); val = (CustomPass)(object)seeThroughCustomPass4; break; } case CustomPassType.SeeThroughItems: { SeeThroughCustomPass seeThroughCustomPass3 = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass3).clearFlags = (ClearFlag)0; seeThroughCustomPass3.seeThroughLayer = LayerMask.op_Implicit(MoreLayerMasks.PropsMask); Color edgeColor2 = default(Color); ((Color)(ref edgeColor2))..ctor(0.18039216f, 37f / 85f, 0.2509804f, 0.9f); Color fillColor3 = default(Color); ((Color)(ref fillColor3))..ctor(56f / 85f, 44f / 51f, 57f / 85f, 0.5f); seeThroughCustomPass3.ConfigureMaterial(edgeColor2, fillColor3, 0.04f); val = (CustomPass)(object)seeThroughCustomPass3; break; } case CustomPassType.SeeThroughPlayers: { SeeThroughCustomPass seeThroughCustomPass2 = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass2).clearFlags = (ClearFlag)0; seeThroughCustomPass2.seeThroughLayer = LayerMask.op_Implicit(MoreLayerMasks.PlayersAndRagdollMask); Color edgeColor = default(Color); ((Color)(ref edgeColor))..ctor(0f, 0.2f, 0.4f, 0.9f); Color fillColor2 = default(Color); ((Color)(ref fillColor2))..ctor(0f, 0.29803923f, 0.6f, 0.6f); seeThroughCustomPass2.ConfigureMaterial(edgeColor, fillColor2, 0.04f); val = (CustomPass)(object)seeThroughCustomPass2; break; } case CustomPassType.SeeThroughHazards: { SeeThroughCustomPass seeThroughCustomPass = new SeeThroughCustomPass(); ((CustomPass)seeThroughCustomPass).clearFlags = (ClearFlag)0; seeThroughCustomPass.seeThroughLayer = LayerMask.op_Implicit(MoreLayerMasks.HazardMask); Color red = Color.red; Color fillColor = default(Color); ((Color)(ref fillColor))..ctor(0.8f, 0f, 0f, 0.8f); seeThroughCustomPass.ConfigureMaterial(red, fillColor, 0.04f); val = (CustomPass)(object)seeThroughCustomPass; break; } } if (val != null) { _customPasses.Add(type, val); Volume.customPasses.Add(val); } } } public void RemoveCustomPass(CustomPassType type) { Volume.customPasses.Remove(_customPasses[type]); _customPasses.Remove(type); } public bool HasCustomPass(CustomPassType type) { return _customPasses.ContainsKey(type); } public CustomPass? CustomPassOfType(CustomPassType type) { return _customPasses.GetValueOrDefault(type); } public bool IsCustomPassEnabled(CustomPassType type) { return _customPasses.ContainsKey(type) && _customPasses[type].enabled; } public CustomPass? EnableCustomPass(CustomPassType type, bool enable = true) { if (!enable && !HasCustomPass(type)) { return null; } InitCustomPass(type); _customPasses[type].enabled = enable; return _customPasses[type]; } public void CleanUp() { for (int num = _customPasses.Count - 1; num >= 0; num--) { RemoveCustomPass(_customPasses.ElementAt(num).Key); } Object.DestroyImmediate((Object)(object)_volume); } } } namespace CodeRebirth.src.Content { public class CRSyncedEvent : NetworkBehaviour { [field: SerializeField] public bool RunEventOnStart { get; private set; } [field: SerializeField] public UnityEvent SyncedSuccessEvent { get; private set; } [field: SerializeField] public UnityEvent SyncedFailureEvent { get; private set; } [field: SerializeField] public bool IsToggleEvent { get; private set; } = false; [field: SerializeField] public bool IsSuccessByDefault { get; private set; } = true; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (RunEventOnStart && NetworkManager.Singleton.IsServer) { InvokeSyncedEvent(); } } public void InvokeSyncedEvent() { if (IsSuccessByDefault) { SyncedSuccessEvent.Invoke(); } else { SyncedFailureEvent.Invoke(); } if (IsToggleEvent) { IsSuccessByDefault = !IsSuccessByDefault; } InvokeSyncedEventRpc(); } [Rpc(/*Could not decode attribute arguments.*/)] public void InvokeSyncedEventRpc() { if (IsSuccessByDefault) { SyncedSuccessEvent.Invoke(); } else { SyncedFailureEvent.Invoke(); } if (IsToggleEvent) { IsSuccessByDefault = !IsSuccessByDefault; } } } } namespace CodeRebirth.src.Content.Weathers { public class WeatherHandler : ContentHandler { public class MeteoriteAssets : AssetBundleLoader { [LoadFromBundle("BetterCrater.prefab")] public GameObject CraterPrefab { get; private set; } = null; [LoadFromBundle("BigExplosion.prefab")] public GameObject ExplosionPrefab { get; private set; } = null; [LoadFromBundle("NewMeteor.prefab")] public GameObject MeteorPrefab { get; private set; } = null; [LoadFromBundle("Meteor.prefab")] public GameObject FloatingMeteorPrefab { get; private set; } = null; public MeteoriteAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TornadoAssets : AssetBundleLoader { public TornadoAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class NightShiftAssets : AssetBundleLoader { public NightShiftAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GodRaysAssets : AssetBundleLoader { [LoadFromBundle("GodRayWeather.prefab")] public GameObject GodRayPermanentEffectPrefab { get; private set; } = null; public GodRaysAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public NightShiftAssets? NightShift = null; public MeteoriteAssets? Meteorite = null; public TornadoAssets? Tornado = null; public GodRaysAssets? GodRays = null; public WeatherHandler(DuskMod mod) : base(mod) { if (!WeatherRegistryCompat.WeatherRegistryAPIExists) { Plugin.Logger.LogWarning((object)"Weather Registry not found, skipping weather content registration."); return; } ((ContentHandler)this).RegisterContent("meteorshowerassets", ref Meteorite, false); ((ContentHandler)this).RegisterContent("tornadoassets", ref Tornado, false); } } public class CodeRebirthWeathers : MonoBehaviour { public IEnumerable CullNodesByProximity(IEnumerable nodes, float minDistance = 5f, bool cullDoors = true, bool cullShip = false, float shipCullDistance = 20f) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) List list = new List(nodes); HashSet hashSet = new HashSet(); Transform shipBoundaries = StartOfRound.Instance.shipLandingPosition; for (int i = 0; i < list.Count; i++) { for (int j = i + 1; j < list.Count; j++) { if (Vector3.Distance(list[i].transform.position, list[j].transform.position) < minDistance) { hashSet.Add(list[j]); } } } list.RemoveAll(hashSet.Contains); if (cullDoors) { List entrances = Object.FindObjectsOfType().ToList(); list.RemoveAll((GameObject n) => entrances.Exists((EntranceTeleport e) => Vector3.Distance(n.transform.position, ((Component)e).transform.position) < minDistance)); } if (cullShip) { list.RemoveAll((GameObject n) => Vector3.Distance(n.transform.position, shipBoundaries.position) < shipCullDistance); } return list; } public void ChangeCurrentLevelMaximumPower(int outsidePower, int insidePower, int dayTimePower) { if (Plugin.ModConfig.ConfigAllowPowerLevelChangesFromWeather.Value) { RoundManager.Instance.currentLevel.maxOutsideEnemyPowerCount = Mathf.Clamp(RoundManager.Instance.currentLevel.maxOutsideEnemyPowerCount + outsidePower, 0, 999); RoundManager.Instance.currentLevel.maxEnemyPowerCount = Mathf.Clamp(RoundManager.Instance.currentLevel.maxEnemyPowerCount + insidePower, 0, 999); RoundManager.Instance.currentLevel.maxDaytimeEnemyPowerCount = Mathf.Clamp(RoundManager.Instance.currentLevel.maxDaytimeEnemyPowerCount + dayTimePower, 0, 999); } } public Vector3 GetRandomTargetPosition(IEnumerable nodes, List alreadyUsedNodes, float minX, float maxX, float minY, float maxY, float minZ, float maxZ, float radius) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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_01a7: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if (nodes.Count() == 0) { return Vector3.zero; } GameObject val = nodes.ElementAt(Random.Range(0, nodes.Count())); if ((Object)(object)val == (Object)null) { return Vector3.zero; } Vector3 position = val.transform.position; if (!alreadyUsedNodes.Contains(val)) { alreadyUsedNodes.Add(val); } position += new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), Random.Range(minZ, maxZ)); position = RoundManager.Instance.GetRandomNavMeshPositionInRadius(position, radius, default(NavMeshHit)); if (!Plugin.ModConfig.ConfigMeteorHitShip.Value && Vector3.Distance(position, ((Component)StartOfRound.Instance.shipLandingPosition).transform.position) <= 25f) { for (int i = 0; i < 5; i++) { position = val.transform.position; position += new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), Random.Range(minZ, maxZ)); position = RoundManager.Instance.GetRandomNavMeshPositionInRadius(position, radius, default(NavMeshHit)); if (Vector3.Distance(position, ((Component)StartOfRound.Instance.shipLandingPosition).transform.position) > 25f) { return position; } if (i == 4) { Plugin.Logger.LogWarning((object)"Selecting random position failed."); return Vector3.zero; } } } return position; } public bool IsAuthority() { return NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer; } } public class FireStormWeather : CodeRebirthWeathers { private IEnumerable nodes = Array.Empty(); private List alreadyUsedNodes = new List(); private List spawnedTornados = new List(); private void OnEnable() { Plugin.ExtendedLogging("Initing Tornado Weather on " + ((Object)RoundManager.Instance.currentLevel).name); ChangeCurrentLevelMaximumPower(-3, 6, -3); nodes = RoundManager.Instance.outsideAINodes; nodes = CullNodesByProximity(nodes, 5f, cullDoors: true, cullShip: true); if (IsAuthority()) { ((MonoBehaviour)this).StartCoroutine(TornadoSpawnerHandler()); } } private void OnDisable() { Plugin.ExtendedLogging("Cleaning up Weather."); foreach (Tornados spawnedTornado in spawnedTornados) { if (!((Object)(object)spawnedTornado == (Object)null) && ((NetworkBehaviour)spawnedTornado).IsOwner) { ((EnemyAI)spawnedTornado).KillEnemyOnOwnerClient(true); } } spawnedTornados.Clear(); ChangeCurrentLevelMaximumPower(3, -6, 3); } private IEnumerator TornadoSpawnerHandler() { yield return (object)new WaitForSeconds(20f); IEnumerable spawnNodes = CullNodesByProximity(nodes, 5f, cullDoors: true, cullShip: true, 50f); SpawnTornado(GetRandomTargetPosition(spawnNodes, alreadyUsedNodes, -2f, 2f, -5f, 5f, -2f, 2f, 25f)); } private void SpawnTornado(Vector3 target) { for (int i = 0; i < 3; i++) { } } } public class GodRaySpawner : MonoBehaviour { public GodRayManager godRayManager = null; public float timeBetweenGodRaySpawns; public float minX; public float maxX; public float minZ; public float maxZ; public List rayColours = new List(); private Random godRayRandom = null; private int numberOfGodrays = 30; private LayerMask raycastLayerMask; private void Start() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) godRayRandom = new Random(StartOfRound.Instance.randomMapSeed); raycastLayerMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Room" })); ((MonoBehaviour)this).StartCoroutine(SpawnGodRays()); } private IEnumerator SpawnGodRays() { RaycastHit val2 = default(RaycastHit); while (GodRayManager.Active && godRayManager.GodRays.Count() < numberOfGodrays) { yield return (object)new WaitForSeconds(10f); Color colour = rayColours[godRayRandom.Next(rayColours.Count)]; Vector3 topPosition = RandomExtensions.NextItem(godRayRandom, (IList)RoundManager.Instance.outsideAINodes).transform.position; Vector3 bottomPosition = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(RandomExtensions.NextItem(godRayRandom, (IList)RoundManager.Instance.outsideAINodes).transform.position, 100f, default(NavMeshHit), godRayRandom, -1, 1f); Vector3 raycastStart = bottomPosition; Vector3 raycastEnd = new Vector3(topPosition.x, 30f, topPosition.z); Vector3 val = raycastEnd - raycastStart; Vector3 rayDirection = ((Vector3)(ref val)).normalized; float raycastDistance = Vector3.Distance(raycastStart, raycastEnd); float topRandomFloat = RandomExtensions.NextFloat(godRayRandom, 2f, 8f); if (!Physics.Raycast(raycastStart, rayDirection, ref val2, raycastDistance, LayerMask.op_Implicit(raycastLayerMask))) { godRayManager.AddGodRay(new GodRay(colour, new Vector2(topPosition.x, topPosition.z), topRandomFloat, topRandomFloat, new Vector3(bottomPosition.x, -1f, bottomPosition.z), 8f, colour)); } } } private Vector3 CalculateCenterOfPoints(List points) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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) if (points == null || points.Count == 0) { return Vector3.zero; } Vector3 val = Vector3.zero; foreach (Vector3 point in points) { val += point; } return val / (float)points.Count; } } internal struct GodRaySkyEffect { public Color colour; public Vector3 topPosition; public Vector3 bottomPosition; public float radius; public float falloff; public GodRaySkyEffect(Color colour, Vector3 position, float radius, float falloff, Vector3 bottomPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.colour = colour; topPosition = position; this.bottomPosition = bottomPosition; this.radius = radius; this.falloff = falloff; } } internal struct GodRaySpotlightData { public Vector3 location; public Quaternion rotation; public float angle; public Color colour; public GodRaySpotlightData(Vector3 topPoint, float topRadius, Vector3 bottomPoint, float bottomRadius, Color colour) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = topPoint - bottomPoint; float magnitude = ((Vector3)(ref val)).magnitude; float num = bottomRadius - topRadius; float num2 = magnitude * topRadius / num; val = topPoint - bottomPoint; location = topPoint + ((Vector3)(ref val)).normalized * num2; rotation = Quaternion.FromToRotation(Vector3.forward, bottomPoint - topPoint); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(location.x - topPoint.x, location.z - topPoint.z); Func func = delegate(Vector2 a, Vector2 b, Vector2 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Vector2 val3 = c - b; float magnitude2 = ((Vector2)(ref val3)).magnitude; val3 = c - a; float magnitude3 = ((Vector2)(ref val3)).magnitude; val3 = b - a; return (a: magnitude2, b: magnitude3, c: ((Vector2)(ref val3)).magnitude); }; Func func2 = (float a, float b, float c) => Mathf.Acos((b * b + c * c - a * a) / (2f * b * c)); (float, float, float) tuple = func(new Vector2(((Vector2)(ref val2)).magnitude, location.y - topPoint.y), Vector2.op_Implicit(Vector3.zero), Vector2.right * topRadius); float num3 = func2(tuple.Item1, tuple.Item2, tuple.Item3); angle = num3 * 2f; this.colour = colour; } } public class GodRay { public Color SkyColour { get; private set; } public Color LightColour { get; private set; } public Vector2 TopPosition { get; private set; } public float TopRadius { get; private set; } public float TopFalloff { get; private set; } public Vector3 BottomPosition { get; private set; } public float BottomRadius { get; private set; } public GodRay(Color skyColour, Vector2 topPosition, float topRadius, float topFalloff, Vector3 bottomPosition, float bottomRadius, Color lightColour) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) SkyColour = skyColour; LightColour = lightColour; TopPosition = topPosition; TopRadius = topRadius; TopFalloff = topFalloff; BottomPosition = bottomPosition; BottomRadius = bottomRadius; base..ctor(); } internal GodRaySkyEffect SkyEffect(float skyHeight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) return new GodRaySkyEffect(SkyColour, new Vector3(TopPosition.x, skyHeight, TopPosition.y), TopRadius, TopFalloff, BottomPosition); } internal GodRaySpotlightData SpotlightData(float skyHeight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) return new GodRaySpotlightData(new Vector3(TopPosition.x, skyHeight, TopPosition.y), TopRadius * 1.45f, BottomPosition, BottomRadius * 1.2f, LightColour); } } public class GodRayManager : MonoBehaviour { private List godRayEffects = new List(); private List godRayColliders = new List(); private List godRaySpotlights = new List(); private List godRays = new List(); public Material godRayMaterial = null; public GameObject godRayParent = null; private Material material = null; private ComputeBuffer? rayBuffer; private Camera camera = null; private float scale; private Vector3 previousPosition; public IEnumerable GodRays => godRays.Select((GodRay x) => x); public static GodRayManager? Instance { get; private set; } public static bool Active => (Object)(object)Instance != (Object)null; public void OnEnable() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) Instance = this; camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; ((Component)this).transform.position = ((Component)camera).transform.position; material = ((Component)this).GetComponent().material; SetScale(camera.farClipPlane); RegenerateRayComputeBuffer(); previousPosition = ((Component)camera).transform.position; godRayParent.transform.localScale = Vector3.one; godRayParent.transform.rotation = Quaternion.identity; godRayParent.transform.position = Vector3.zero; RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering; } private void SetScale(float scale) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) scale *= 0.99f; ((Component)this).transform.localScale = Vector3.one * scale * 2f; ((Component)this).transform.position = ((Component)camera).transform.position; this.scale = scale * 2f; material.SetFloat("_skyBoxRadius", scale); for (int i = 0; i < godRaySpotlights.Count; i++) { float skyHeight = camera.farClipPlane * 0.99f + ((Component)camera).transform.position.y; GodRaySpotlightData godRaySpotlightData = godRays[i].SpotlightData(skyHeight); Vector3 val = godRays[i].BottomPosition - godRaySpotlightData.location; float num = ((Vector3)(ref val)).magnitude + 5f; godRaySpotlights[i].range = num; HDAdditionalLightData val2 = godRaySpotlights[i]; val2.range = camera.farClipPlane * 2f; float num2 = 100f; if (godRaySpotlightData.angle * 57.29578f < 1f) { num2 = godRaySpotlightData.angle * 57.29578f * 100f; } val2.SetSpotAngle(godRaySpotlightData.angle * 57.29578f, num2); val2.shapeRadius = 0f; val = godRaySpotlightData.location - godRays[i].BottomPosition; val2.luxAtDistance = ((Vector3)(ref val)).magnitude; val2.SetIntensity(7000f, (LightUnit)2); ((Component)godRaySpotlights[i]).gameObject.transform.rotation = godRaySpotlightData.rotation; ((Component)godRaySpotlights[i]).gameObject.transform.position = godRaySpotlightData.location; GenerateSpotlightMesh(((Component)godRaySpotlights[i]).gameObject, num, godRays[i].BottomRadius, godRays[i].LightColour, generateNewMesh: false, 40); } } private void OnBeginCameraRendering(ScriptableRenderContext context, Camera camera) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { ((Component)this).transform.position = ((Component)camera).transform.position; if (scale != camera.farClipPlane * 2f) { SetScale(camera.farClipPlane); } else if (previousPosition != ((Component)camera).transform.position) { SetScale(camera.farClipPlane); previousPosition = ((Component)camera).transform.position; } } } public bool RemoveGodRay(GodRay ray) { int index; if ((index = godRays.IndexOf(ray)) != -1) { godRays.RemoveAt(index); godRayEffects.RemoveAt(index); Object.Destroy((Object)(object)((Component)godRaySpotlights[index]).gameObject); godRaySpotlights.RemoveAt(index); Object.Destroy((Object)(object)((Component)godRayColliders[index]).gameObject); godRayColliders.RemoveAt(index); RegenerateRayComputeBuffer(); return true; } return false; } public GodRay AddGodRay(GodRay ray) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) float skyHeight = camera.farClipPlane * 0.99f; godRays.Add(ray); godRayEffects.Add(ray.SkyEffect(skyHeight)); GodRaySpotlightData godRaySpotlightData = ray.SpotlightData(skyHeight); GameObject val = new GameObject("LightGameObject"); val.layer = LayerMask.NameToLayer("Room"); HDAdditionalLightData val2 = GameObjectExtension.AddHDLight(val, (HDLightTypeAndShape)3); val2.range = camera.farClipPlane * 2f; float num = 100f; if (godRaySpotlightData.angle * 57.29578f < 1f) { num = godRaySpotlightData.angle * 57.29578f * 100f; } val2.SetSpotAngle(godRaySpotlightData.angle * 57.29578f, num); val2.shapeRadius = 0f; Vector3 val3 = godRaySpotlightData.location - ray.BottomPosition; val2.luxAtDistance = ((Vector3)(ref val3)).magnitude; val2.SetIntensity(7000f, (LightUnit)2); val2.color = godRaySpotlightData.colour; val.transform.SetParent(godRayParent.transform); val.transform.position = godRaySpotlightData.location; val.transform.rotation = godRaySpotlightData.rotation; val3 = ray.BottomPosition - godRaySpotlightData.location; GenerateSpotlightMesh(val, ((Vector3)(ref val3)).magnitude, ray.BottomRadius, godRaySpotlightData.colour, generateNewMesh: true, 40); godRaySpotlights.Add(val2); RegenerateRayComputeBuffer(); return ray; } private void GenerateSpotlightMesh(GameObject lightGameObject, float distance, float bottomRadius, Color colour, bool generateNewMesh = true, int pointCount = 100) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if (pointCount < 3 || pointCount >= 254) { throw new ArgumentOutOfRangeException("pointCount"); } Vector3[] array = (Vector3[])(object)new Vector3[pointCount + 1]; int[] array2 = new int[pointCount * 3]; array[0] = Vector3.zero; for (int i = 0; i < pointCount; i++) { float num = (float)i / (float)pointCount * MathF.PI * 2f; Vector3 val = new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * bottomRadius; array[i + 1] = new Vector3(0f, 0f, distance) + val; array2[i * 3] = 0; array2[i * 3 + 1] = 1 + (i + 1) % pointCount; array2[i * 3 + 2] = i + 1; } MeshFilter val2 = (generateNewMesh ? lightGameObject.AddComponent() : lightGameObject.GetComponent()); MeshRenderer val3 = (generateNewMesh ? lightGameObject.AddComponent() : lightGameObject.GetComponent()); Mesh val4 = new Mesh(); if (!generateNewMesh) { Object.Destroy((Object)(object)val2.mesh); } val2.mesh.Clear(); val2.mesh = val4; val4.vertices = array; val4.triangles = array2; val4.RecalculateNormals(); ((Renderer)val3).material = godRayMaterial; ((Renderer)val3).material.color = new Color(colour.r, colour.g, colour.b, 0.21960784f); if (generateNewMesh) { DoTheThingWithCollider(val4, lightGameObject.transform); } } private void DoTheThingWithCollider(Mesh mesh, Transform transform) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GodRayDamageCollider"); val.transform.SetParent(godRayParent.transform); val.transform.position = transform.position; val.transform.rotation = transform.rotation; MeshCollider val2 = val.AddComponent(); val2.sharedMesh = mesh; val2.convex = true; BetterCooldownTrigger betterCooldownTrigger = val.AddComponent(); betterCooldownTrigger.SetupFields(enableScripts: true, damagePlayers: true, damageEnemies: true, BetterCooldownTrigger.DeathAnimation.Burnt, BetterCooldownTrigger.ForceDirection.Center, 5f, 0f, forceDirectionFromThisObject: true, (CauseOfDeath)13, canThingExit: true, sharedCooldown: true, playDefaultPlayerDamageSFX: true, soundAttractsDogs: true, 0f, 2, 0.5f, 1, 15f, null, null, null, null, useParticleSystems: false, teleportParticles: false, null, null, null, null, displayMessage: true, "Melting...", "Your body is melting........."); ((Collider)val2).isTrigger = true; val2.sharedMesh.RecalculateNormals(); godRayColliders.Add(val2); } private void RegenerateRayComputeBuffer() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if (rayBuffer != null) { rayBuffer.Release(); rayBuffer = null; } if (godRayEffects.Count != 0) { rayBuffer = new ComputeBuffer(godRayEffects.Count, 48); rayBuffer.SetData(godRayEffects, 0, 0, godRayEffects.Count); material.SetBuffer("_rays", rayBuffer); } material.SetInt("_rayCount", godRayEffects.Count); } private void OnDisable() { ComputeBuffer? obj = rayBuffer; if (obj != null) { obj.Release(); } RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering; rayBuffer = null; Instance = null; foreach (HDAdditionalLightData godRaySpotlight in godRaySpotlights) { if (!((Object)(object)godRaySpotlight == (Object)null)) { Object.Destroy((Object)(object)((Component)godRaySpotlight).gameObject); } } foreach (MeshCollider godRayCollider in godRayColliders) { if (!((Object)(object)godRayCollider == (Object)null)) { Object.Destroy((Object)(object)((Component)godRayCollider).gameObject); } } godRayEffects.Clear(); godRaySpotlights.Clear(); godRayColliders.Clear(); godRays.Clear(); } } public class HurricaneWeather : CodeRebirthWeathers { private IEnumerable nodes = Array.Empty(); private List alreadyUsedNodes = new List(); private List spawnedTornados = new List(); private void OnEnable() { Plugin.ExtendedLogging("Initing Tornado Weather on " + ((Object)RoundManager.Instance.currentLevel).name); ChangeCurrentLevelMaximumPower(-3, 6, -3); nodes = RoundManager.Instance.outsideAINodes; nodes = CullNodesByProximity(nodes, 5f, cullDoors: true, cullShip: true, 50f); if (IsAuthority()) { WeatherController.AddWeatherEffect((LevelWeatherType)4); WeatherController.AddWeatherEffect((LevelWeatherType)1); ((MonoBehaviour)this).StartCoroutine(TornadoSpawnerHandler()); } } private void OnDisable() { Plugin.ExtendedLogging("Cleaning up Weather."); foreach (Tornados spawnedTornado in spawnedTornados) { if (!((Object)(object)spawnedTornado == (Object)null) && ((NetworkBehaviour)spawnedTornado).IsOwner) { ((EnemyAI)spawnedTornado).KillEnemyOnOwnerClient(true); } } spawnedTornados.Clear(); ChangeCurrentLevelMaximumPower(3, -6, 3); } private IEnumerator TornadoSpawnerHandler() { yield return (object)new WaitForSeconds(20f); SpawnTornado(GetRandomTargetPosition(nodes, alreadyUsedNodes, -2f, 2f, -5f, 5f, -2f, 2f, 25f)); } private void SpawnTornado(Vector3 target) { } } public class Meteors : FallingObjectBehaviour { private float chanceToSpawnScrap; [Header("Audio")] public AudioSource ImpactAudio = null; public AudioSource NormalTravelAudio = null; public AudioSource CloseTravelAudio = null; [Header("Graphics")] public GameObject? FireTrail = null; [Header("Events")] public UnityEvent _onMeteorLand; protected override void OnImpact() { base.OnImpact(); ((MonoBehaviour)this).StartCoroutine(Impact()); } protected override void OnSetup() { base.OnSetup(); ((MonoBehaviour)this).StartCoroutine(UpdateAudio()); GameObject? fireTrail = FireTrail; if (fireTrail != null) { fireTrail.SetActive(true); } } public void SetupAsLooping(bool isBig) { StopMoving(); if (!isBig) { ((Behaviour)NormalTravelAudio).enabled = false; ((Behaviour)CloseTravelAudio).enabled = false; } else { ((MonoBehaviour)this).StartCoroutine(UpdateAudio()); } } public void Start() { MeteorShower.meteors.Add(this); NormalTravelAudio.Play(); GameObject? fireTrail = FireTrail; if (fireTrail != null) { fireTrail.SetActive(false); } chanceToSpawnScrap = Plugin.ModConfig.ConfigMeteorShowerMeteoriteSpawnChance.Value; } private IEnumerator UpdateAudio() { while (true) { yield return (object)new WaitForSeconds(0.25f); if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { NormalTravelAudio.volume = 0f; CloseTravelAudio.volume = 0f; ImpactAudio.volume = 0.05f; } else { NormalTravelAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; CloseTravelAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; ImpactAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; } if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed) { NormalTravelAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; CloseTravelAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; ImpactAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; } if ((1f - base.Progress) * base._travelTime <= CloseTravelAudio.clip.length && !CloseTravelAudio.isPlaying) { NormalTravelAudio.volume = 0.5f * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; CloseTravelAudio.Play(); } } } private IEnumerator Impact() { ImpactAudio.Play(); if (((NetworkBehaviour)this).IsServer && (float)Random.Range(0, 100) < chanceToSpawnScrap) { Item[] meteorites = (Item[])(object)new Item[6] { ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.AmethystCrystal].Item, ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.SapphireCrystal].Item, ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.EmeraldCrystal].Item, ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.QuartzCrystal].Item, ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.RubyCrystal].Item, ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.TopazCrystal].Item }; int randomNumber = Random.Range(0, meteorites.Length); CodeRebirthUtils.Instance.SpawnScrap(meteorites[randomNumber], base._target); } GameObject craterInstance = Object.Instantiate(ContentHandler.Instance.Meteorite.CraterPrefab, base._target, Quaternion.identity); craterInstance.transform.up = base._normal; CraterController craterController = craterInstance.GetComponent(); craterController.ShowCrater(base._target, base._normal); GameObject? fireTrail = FireTrail; if (fireTrail != null) { fireTrail.SetActive(false); } CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 15f, 4, null, ContentHandler.Instance.Meteorite.ExplosionPrefab, 25f); _onMeteorLand.Invoke(); RoundManager.Instance.DestroyTreeAtPosition(((Component)this).transform.position, 15f); if (((NetworkBehaviour)this).IsServer) { yield return (object)new WaitForSeconds(10f); if (((NetworkBehaviour)this).NetworkObject.IsSpawned) { MeteorShower.meteors.Remove(this); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } } public class CraterController : MonoBehaviour { public void Start() { MeteorShower.craters.Add(this); ((MonoBehaviour)this).StartCoroutine(DespawnAfterDelay(60f)); } private IEnumerator DespawnAfterDelay(float delay) { yield return (object)new WaitForSeconds(delay); MeteorShower.craters.Remove(this); Object.Destroy((Object)(object)((Component)this).gameObject); } public void ShowCrater(Vector3 impactLocation, Vector3 normal) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_003f: 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) ((Component)this).transform.position = impactLocation + new Vector3(0f, 3f, 0f); ((Component)this).transform.up = normal; Plugin.ExtendedLogging($"Crater position: {((Component)this).transform.position} with normal: {normal}"); ((Component)this).gameObject.SetActive(true); } } public class MeteorShower : CodeRebirthWeathers { private enum Direction { Random, East, West, North, South } private Coroutine? spawnHandler = null; private IEnumerable nodes = Array.Empty(); [Space(5f)] [Header("Time between Meteor Spawns")] [Tooltip("Minimum Time between Meteor Spawns")] public float minTimeBetweenSpawns = 1f; [Space(5f)] [Tooltip("Maximum Time between Meteor Spawns")] public float maxTimeBetweenSpawns = 3f; [Space(5f)] [Tooltip("Minimum Amount of Meteors per Spawn")] public int minMeteorsPerSpawn = 1; [Space(5f)] [Tooltip("Maximum Amount of Meteors per Spawn")] public int maxMeteorsPerSpawn = 3; private List alreadyUsedNodes = new List(); private Direction direction = Direction.Random; private float normalisedTimeToLeave = 1f; [HideInInspector] public static List meteors = new List(); [HideInInspector] public static List craters = new List(); [HideInInspector] public Random random = new Random(); private void OnEnable() { Plugin.ExtendedLogging("Initing Meteor Shower Weather on " + ((Object)RoundManager.Instance.currentLevel).name); alreadyUsedNodes = new List(); normalisedTimeToLeave = Plugin.ModConfig.ConfigMeteorShowerTimeToLeave.Value; minMeteorsPerSpawn = Plugin.ModConfig.ConfigMinMeteorSpawnCount.Value; maxMeteorsPerSpawn = Plugin.ModConfig.ConfigMaxMeteorSpawnCount.Value; ChangeCurrentLevelMaximumPower(-3, 6, -3); if (minMeteorsPerSpawn > maxMeteorsPerSpawn) { Plugin.Logger.LogWarning((object)"Min Meteor Spawn Count is greater than Max Meteor Spawn Count. Swapping values."); (int, int) tuple = (minMeteorsPerSpawn, maxMeteorsPerSpawn); minMeteorsPerSpawn = tuple.Item2; (maxMeteorsPerSpawn, _) = tuple; } random = new Random(StartOfRound.Instance.randomMapSeed); nodes = CullNodesByProximity(RoundManager.Instance.outsideAINodes); SpawnOverheadVisualMeteors(random.Next(15, 45)); if (IsAuthority()) { Direction[] array = new Direction[5] { Direction.Random, Direction.East, Direction.West, Direction.North, Direction.South }; int num = Random.Range(0, array.Length); direction = array[num]; spawnHandler = ((MonoBehaviour)this).StartCoroutine(MeteorSpawnerHandler()); } } private void OnDisable() { Plugin.ExtendedLogging("Cleaning up Weather."); ChangeCurrentLevelMaximumPower(3, -6, 3); ClearCraters(); ClearMeteors(); if (IsAuthority()) { if (spawnHandler != null) { ((MonoBehaviour)this).StopCoroutine(spawnHandler); } spawnHandler = null; } } private void ClearMeteors() { Meteors[] array = MeteorShower.meteors.ToArray(); foreach (Meteors meteors in array) { if ((Object)(object)meteors == (Object)null) { continue; } if (((NetworkBehaviour)meteors).NetworkObject.IsSpawned) { if (IsAuthority()) { ((NetworkBehaviour)meteors).NetworkObject.Despawn(true); } } else { Object.Destroy((Object)(object)((Component)meteors).gameObject); } } MeteorShower.meteors.Clear(); } private void ClearCraters() { CraterController[] array = craters.ToArray(); foreach (CraterController craterController in array) { if (!((Object)(object)craterController == (Object)null)) { Object.Destroy((Object)(object)((Component)craterController).gameObject); } } craters.Clear(); } private void Update() { if (spawnHandler != null && TimeOfDay.Instance.timeHasStarted && normalisedTimeToLeave <= TimeOfDay.Instance.normalizedTimeOfDay) { ((MonoBehaviour)this).StopCoroutine(spawnHandler); spawnHandler = null; } } private void SpawnOverheadVisualMeteors(int amount = 50, GameObject? overridePrefab = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Vector3 val = CRUtilities.CalculateAverageLandNodePosition(nodes); Vector3 centralLocation = val + new Vector3(0f, RandomExtensions.NextFloat(random, 150f, 200f), 0f); for (int i = 0; i < amount; i++) { GameObject overridePrefab2 = overridePrefab; SpawnVisualMeteors(centralLocation, new Vector3(RandomExtensions.NextFloat(random, -175f, 175f), RandomExtensions.NextFloat(random, -50f, 50f), RandomExtensions.NextFloat(random, -175f, 175f)), 2f, RandomExtensions.NextFloat(random, 1.5f, 4f), overridePrefab2); } for (int j = 0; j < 1; j++) { GameObject overridePrefab2 = overridePrefab; SpawnVisualMeteors(centralLocation, Vector3.zero, 1.5f, RandomExtensions.NextFloat(random, 7.5f, 12.5f), overridePrefab2); } } private void SpawnVisualMeteors(Vector3 centralLocation, Vector3 offset = default(Vector3), float speed = 0f, float sizeMultiplier = 1f, GameObject? overridePrefab = null) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: 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) Meteors component = Object.Instantiate(overridePrefab ?? ContentHandler.Instance.Meteorite.FloatingMeteorPrefab, centralLocation + offset, Quaternion.identity).GetComponent(); Transform transform = ((Component)component).transform; transform.localScale *= sizeMultiplier; bool isBig = sizeMultiplier > 5f; component.SetupAsLooping(isBig); } private IEnumerator MeteorSpawnerHandler() { yield return (object)new WaitForSeconds(25f); while (true) { for (int i = 0; i < Random.Range(minMeteorsPerSpawn, maxMeteorsPerSpawn); i++) { SpawnMeteor(GetRandomTargetPosition(nodes, alreadyUsedNodes, -2f, 2f, -5f, 5f, -2f, 2f, 25f)); yield return null; } float delay = Random.Range(minTimeBetweenSpawns, maxTimeBetweenSpawns); yield return (object)new WaitForSeconds(delay); } } public Vector3 CalculateSkyOrigin(Vector3 target) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) float num = 0f; float num2 = 0f; float num3 = Random.Range(250, 500); float num4 = Random.Range(250, 500); switch (direction) { case Direction.East: num = num3; break; case Direction.West: num = 0f - num3; break; case Direction.North: num2 = num4; break; case Direction.South: num2 = 0f - num4; break; } float num5 = Random.Range(600, 900); return target + new Vector3(num, num5, num2); } public void SpawnMeteor(Vector3 target, GameObject? overridePrefab = null) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging("spawning meteor"); if (target == Vector3.zero) { Plugin.Logger.LogWarning((object)"Target is zero, not spawning meteor"); return; } Vector3 val = default(Vector3); val = ((direction != Direction.Random) ? CalculateSkyOrigin(target) : (target + new Vector3((float)(Random.Range(250, 500) * RandomExtensions.NextSign(random)), (float)Random.Range(600, 900), (float)(Random.Range(250, 500) * RandomExtensions.NextSign(random))))); GameObject prefab = overridePrefab ?? ContentHandler.Instance.Meteorite.MeteorPrefab; CodeRebirthUtils.Instance.CreateFallingObject(prefab, val, target, Plugin.ModConfig.ConfigMeteorSpeed.Value); } } public class Tornados : CodeRebirthEnemyAI { public enum TornadoType { Fire = 1, Smoke, Water } [Header("Properties")] public float initialSpeed = 5f; [Space(5f)] [Header("Audio")] public AudioSource normalTravelAudio = null; public AudioSource closeTravelAudio = null; public Transform[] eyes = null; public Transform throwingPoint = null; public TornadoType tornadoType = TornadoType.Smoke; private bool damageTimer = true; private float timeSinceBeingInsideTornado = 0f; public override void Start() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) base.Start(); initialSpeed = Plugin.ModConfig.ConfigTornadoSpeed.Value; Plugin.ExtendedLogging($"Setting up tornado of type: {tornadoType} at {((Component)this).transform.position}"); SetupTornadoType(); } private void SetupTornadoType() { switch (tornadoType) { case TornadoType.Water: initialSpeed /= 2f; break; } Init(); } private void Init() { smartAgentNavigator.StartSearchRoutine(40f); ((EnemyAI)this).agent.speed = initialSpeed; } [ServerRpc(RequireOwnership = false)] public void SetPlayerFlingingServerRpc(int PlayerID) { SetPlayerFlingingClientRpc(PlayerID); } [ClientRpc] public void SetPlayerFlingingClientRpc(int PlayerID) { StartOfRound.Instance.allPlayerScripts[PlayerID].SetFlingingAway(flingingAway: true); StartOfRound.Instance.allPlayerScripts[PlayerID].SetFlung(flung: true); ((MonoBehaviour)this).StartCoroutine(StopFlingingPlayer(StartOfRound.Instance.allPlayerScripts[PlayerID])); } public IEnumerator StopFlingingPlayer(PlayerControllerB player) { yield return (object)new WaitForSeconds(10f); player.SetFlingingAway(flingingAway: false); } private void HandleLocalPlayerInsideTornado(PlayerControllerB localPlayer) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)localPlayer == (Object)null) && localPlayer.isPlayerControlled && !localPlayer.isPlayerDead && !localPlayer.IsFlingingAway()) { float num = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)((EnemyAI)this).eye).transform.position); if (TornadoConditionsAreMet(localPlayer) && num <= 10f) { timeSinceBeingInsideTornado = Mathf.Clamp(timeSinceBeingInsideTornado + Time.fixedDeltaTime, 0f, Plugin.ModConfig.ConfigTornadoInsideBeforeThrow.Value + 20f); } else { timeSinceBeingInsideTornado = Mathf.Clamp(timeSinceBeingInsideTornado - Time.fixedDeltaTime, 0f, Plugin.ModConfig.ConfigTornadoInsideBeforeThrow.Value + 20f); } if (timeSinceBeingInsideTornado >= Plugin.ModConfig.ConfigTornadoInsideBeforeThrow.Value) { SetPlayerFlingingServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, localPlayer)); } } } public void FixedUpdate() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } UpdateAudio(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled) { if (tornadoType == TornadoType.Smoke) { HandleLocalPlayerInsideTornado(localPlayerController); } if (tornadoType != TornadoType.Water) { HandleTornadoDamageAndPulling(localPlayerController); } HandleStatusEffects(localPlayerController); if (localPlayerController.IsFlingingAway()) { Vector3 val = throwingPoint.position - ((Component)localPlayerController).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = CalculateSpiralForce(normalized, 6f); localPlayerController.externalForceAutoFade += val2; } } } private Vector3 CalculateSpiralForce(Vector3 directionToCenter, float spiralIntensity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(directionToCenter, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; return normalized * spiralIntensity + directionToCenter * spiralIntensity; } private void HandleTornadoDamageAndPulling(PlayerControllerB player) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0062: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) if (!TornadoConditionsAreMet(player)) { return; } CalculateTornadoLineOfSights(100, player, out var bestDistanceLOS, out var bestDistanceOverall); if (bestDistanceOverall != float.PositiveInfinity) { Vector3 val = ((Component)((EnemyAI)this).eye).transform.position - ((Component)player).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = CalculatePullStrength(bestDistanceLOS, hasLineOfSight: true, player); float num2 = CalculatePullStrength(bestDistanceOverall, hasLineOfSight: false, player); float num3 = Mathf.Max(num, num2); player.externalForceAutoFade += normalized * num3 * Time.fixedDeltaTime / 0.5f; if (!(bestDistanceLOS > 4f) && damageTimer) { damageTimer = false; ((MonoBehaviour)this).StartCoroutine(DamageTimer()); HandleTornadoTypeDamage(player); } } } public bool TornadoConditionsAreMet(PlayerControllerB player) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) int result; if (!player.inVehicleAnimation && !player.IsRidingHoverboard()) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)player).transform.position) && !player.isInsideFactory && player.isPlayerControlled && !player.isPlayerDead && !player.isInHangarShipRoom && !Object.op_Implicit((Object)(object)player.inAnimationWithEnemy) && !player.enteringSpecialAnimation && !player.isClimbingLadder) { result = ((!player.IsFlingingAway()) ? 1 : 0); goto IL_007e; } } result = 0; goto IL_007e; IL_007e: return (byte)result != 0; } private void HandleStatusEffects(PlayerControllerB player) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) float range = 10f; float range2 = 20f; float range3 = 30f; float distance = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position); switch (tornadoType) { case TornadoType.Fire: player.ApplyStatusEffect(CodeRebirthStatusEffects.Fire, range2, distance); break; case TornadoType.Smoke: player.ApplyStatusEffect(CodeRebirthStatusEffects.Smoke, range3, distance); break; case TornadoType.Water: player.ApplyStatusEffect(CodeRebirthStatusEffects.Water, range, distance); break; } } private float CalculatePullStrength(float distance, bool hasLineOfSight, PlayerControllerB localPlayerController) { float num = 100f; float num2 = 0f; float num3 = DetermineTornadoMaxStrength(hasLineOfSight, localPlayerController); float num4 = Mathf.Clamp01(1f - distance / num); float num5 = num4 * num4; return Mathf.Lerp(num2, num3, num5); } private float DetermineTornadoMaxStrength(bool hasLineOfSight, PlayerControllerB localPlayerController) { return (hasLineOfSight ? Plugin.ModConfig.ConfigTornadoPullStrength.Value : (0.125f * Plugin.ModConfig.ConfigTornadoPullStrength.Value)) * ((tornadoType != TornadoType.Smoke) ? 0.2f : 0.75f); } private void HandleTornadoTypeDamage(PlayerControllerB localPlayerController) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)localPlayerController == (Object)null)) { switch (tornadoType) { case TornadoType.Fire: localPlayerController.DamagePlayer(3, true, true, (CauseOfDeath)13, 0, false, default(Vector3)); break; case TornadoType.Smoke: localPlayerController.DamagePlayer(2, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); break; case TornadoType.Water: break; } } } private IEnumerator DamageTimer() { yield return (object)new WaitForSeconds(0.5f); damageTimer = true; } private void UpdateAudio() { if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { normalTravelAudio.volume = 0f; closeTravelAudio.volume = 0f; } else if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed) { normalTravelAudio.volume = Plugin.ModConfig.ConfigTornadoDefaultVolume.Value * Plugin.ModConfig.ConfigTornadoInShipVolume.Value; closeTravelAudio.volume = Plugin.ModConfig.ConfigTornadoDefaultVolume.Value * Plugin.ModConfig.ConfigTornadoInShipVolume.Value; } else { normalTravelAudio.volume = Plugin.ModConfig.ConfigTornadoDefaultVolume.Value; closeTravelAudio.volume = Plugin.ModConfig.ConfigTornadoDefaultVolume.Value; } } public void CalculateTornadoLineOfSights(int range, PlayerControllerB player, out float bestDistanceLOS, out float bestDistanceOverall) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) bestDistanceLOS = float.PositiveInfinity; bestDistanceOverall = float.PositiveInfinity; Transform[] array = eyes; foreach (Transform val in array) { float num = Vector3.Distance(((Component)val).transform.position, ((Component)player).transform.position); if (!(num > (float)range)) { bestDistanceOverall = Mathf.Min(bestDistanceOverall, num); if (!Physics.Linecast(((Component)val).transform.position, val.position, MoreLayerMasks.CollidersAndRoomAndInteractableAndRailingAndEnemiesAndTerrainAndHazardAndVehicleMask, (QueryTriggerInteraction)1)) { bestDistanceLOS = Mathf.Min(bestDistanceLOS, num); } } } } public Vector3 GetRandomTargetPosition(Random random, IEnumerable nodes, float minX, float maxX, float minY, float maxY, float minZ, float maxZ, float radius) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) int index = random.Next(nodes.Count()); GameObject val = nodes.ElementAt(index); Vector3 position = val.transform.position; position += new Vector3(RandomExtensions.NextFloat(random, minX, maxX), RandomExtensions.NextFloat(random, minY, maxY), RandomExtensions.NextFloat(random, minZ, maxZ)); return RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, radius, default(NavMeshHit), random, -1, 1f); } } public class TornadoWeather : CodeRebirthWeathers { private IEnumerable nodes = Array.Empty(); private List alreadyUsedNodes = new List(); private List spawnedTornados = new List(); private void OnEnable() { Plugin.ExtendedLogging("Initing Tornado Weather on " + ((Object)RoundManager.Instance.currentLevel).name); ChangeCurrentLevelMaximumPower(-3, 6, -3); nodes = RoundManager.Instance.outsideAINodes; nodes = CullNodesByProximity(nodes, 5f, cullDoors: true, cullShip: true); if (IsAuthority()) { ((MonoBehaviour)this).StartCoroutine(TornadoSpawnerHandler()); } } private void OnDisable() { Plugin.ExtendedLogging("Cleaning up Weather."); foreach (Tornados spawnedTornado in spawnedTornados) { if (!((Object)(object)spawnedTornado == (Object)null) && ((NetworkBehaviour)spawnedTornado).IsOwner) { ((EnemyAI)spawnedTornado).KillEnemyOnOwnerClient(true); } } spawnedTornados.Clear(); ChangeCurrentLevelMaximumPower(3, -6, 3); } private IEnumerator TornadoSpawnerHandler() { yield return (object)new WaitForSeconds(20f); IEnumerable spawnNodes = CullNodesByProximity(nodes, 5f, cullDoors: true, cullShip: true, 50f); SpawnTornado(GetRandomTargetPosition(spawnNodes, alreadyUsedNodes, -2f, 2f, -5f, 5f, -2f, 2f, 25f)); } private void SpawnTornado(Vector3 target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) NetworkObjectReference val = RoundManager.Instance.SpawnEnemyGameObject(target, -1f, -1, ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.Tornado].EnemyType); spawnedTornados.Add(NetworkObjectReference.op_Implicit(val).GetComponent()); } } } namespace CodeRebirth.src.Content.Weapons { public class CodeRebirthWeapons : Shovel { public Transform weaponTip = null; public void Awake() { } } public class ScaryShrimp : Shovel { public AudioClip killClip = null; public GameObject particleEffectGameObject = null; private PlayerControllerB lastPlayerHeld = null; [NonSerialized] public NetworkVariable hitEnemy = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public override void Start() { ((GrabbableObject)this).Start(); base.shovelHitForce = 0; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); lastPlayerHeld = ((GrabbableObject)this).playerHeldBy; } public override void DiscardItem() { ((Shovel)this).DiscardItem(); ((GrabbableObject)this).grabbable = false; } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); if (hitEnemy.Value == 0) { lastPlayerHeld.itemAudio.PlayOneShot(base.hitSFX[0]); } if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } private IEnumerator DespawnHeldObject(PlayerControllerB playerWhoHit) { yield return (object)new WaitForSeconds(0.1f); Plugin.ExtendedLogging("Despawned held object"); playerWhoHit.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } [ServerRpc(RequireOwnership = false)] public void PastHitEnemyServerRpc(int enemyHp) { PastHitEnemyClientRpc(enemyHp); } [ClientRpc] public void PastHitEnemyClientRpc(int enemyHp) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (enemyHp - 3 <= 0) { lastPlayerHeld.itemAudio.PlayOneShot(killClip); } if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)null) { Plugin.ExtendedLogging("No held object"); return; } GrabbableObject currentlyHeldObjectServer = ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer; currentlyHeldObjectServer.originalScale = Vector3.zero; ((Component)currentlyHeldObjectServer).transform.localScale = Vector3.zero; ((MonoBehaviour)this).StartCoroutine(DespawnHeldObject(((GrabbableObject)this).playerHeldBy)); } [ServerRpc(RequireOwnership = false)] public void PastHitPlayerServerRpc(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; PastHitPlayerClientRpc(playerIndex, val.health, val.isPlayerDead); } [ClientRpc] public void PastHitPlayerClientRpc(int playerIndex, int playerHp, bool isDead) { //IL_0092: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"Hit player {playerIndex} with {playerHp} hp and dead: {isDead}"); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; if (playerHp - 60 <= 0 || isDead) { lastPlayerHeld.itemAudio.PlayOneShot(killClip); } else { val.drunknessInertia = Mathf.Clamp(val.drunknessInertia + 3f * val.drunknessSpeed, 0.1f, 3f); val.increasingDrunknessThisFrame = true; val.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)null) { Plugin.ExtendedLogging("No held object"); return; } GrabbableObject currentlyHeldObjectServer = ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer; currentlyHeldObjectServer.originalScale = Vector3.zero; ((Component)currentlyHeldObjectServer).transform.localScale = Vector3.zero; ((MonoBehaviour)this).StartCoroutine(DespawnHeldObject(((GrabbableObject)this).playerHeldBy)); } } } namespace CodeRebirth.src.Content.Unlockables { public class UnlockableHandler : ContentHandler { public class ShockwaveBotAssets : AssetBundleLoader { [LoadFromBundle("LaserShockBlast.prefab")] public GameObject LaserShockBlast { get; private set; } = null; public ShockwaveBotAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SeamineTinkAssets : AssetBundleLoader { public SeamineTinkAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TerminalBotAssets : AssetBundleLoader { public TerminalBotAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SCP999Assets : AssetBundleLoader { public SCP999Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class Fishdispenserassets : AssetBundleLoader { public Fishdispenserassets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class FriendAssets : AssetBundleLoader { public FriendAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CruiserGalAssets : AssetBundleLoader { public CruiserGalAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CodeRebirthPlatinumAssets : AssetBundleLoader { public CodeRebirthPlatinumAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TimmyBassAssets : AssetBundleLoader { public TimmyBassAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GalsDecorAssets : AssetBundleLoader { public GalsDecorAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public FriendAssets? Friend = null; public Fishdispenserassets? ShrimpDispenser = null; public SCP999Assets? SCP999 = null; public SeamineTinkAssets? SeamineTink = null; public TerminalBotAssets? TerminalBot = null; public ShockwaveBotAssets? ShockwaveBot = null; public CruiserGalAssets? CruiserGal = null; public CodeRebirthPlatinumAssets? CodeRebirthPlatinum = null; public TimmyBassAssets? TimmyBass = null; public GalsDecorAssets? GalsDecor = null; public UnlockableHandler(DuskMod mod) : base(mod) { } } public class ACUnitGalAI : NetworkBehaviour { public Animator animator = null; public NetworkAnimator networkAnimator = null; public Transform gunTransform = null; public InteractTrigger gunTrigger = null; public InteractTrigger SwitchPoseTrigger = null; private static readonly int ShootingAnimation = Animator.StringToHash("Shoot"); private static readonly int AnimationStageInt = Animator.StringToHash("StageAnimation"); public void Start() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) ((UnityEvent)(object)gunTrigger.onInteract).AddListener((UnityAction)ShootPlayer); ((UnityEvent)(object)SwitchPoseTrigger.onInteract).AddListener((UnityAction)SwitchPose); gunTransform.localRotation = Quaternion.Euler(280f, 180f, 180f); } private void ShootPlayer(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { ShootPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } } [ServerRpc(RequireOwnership = false)] private void ShootPlayerServerRpc(int playerIndex) { ShootPlayerClientRpc(playerIndex); } [ClientRpc] private void ShootPlayerClientRpc(int playerIndex) { ((MonoBehaviour)this).StartCoroutine(ShootAnimationDelay(playerIndex)); } private IEnumerator ShootAnimationDelay(int playerIndex) { PlayerControllerB affectedPlayer = StartOfRound.Instance.allPlayerScripts[playerIndex]; Ray ray = new Ray(gunTransform.position, gunTransform.forward); RaycastHit hit = default(RaycastHit); Physics.Raycast(ray, ref hit, 100f, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)1); Vector3 endPosition = ((RaycastHit)(ref hit)).point; CRUtilities.CreateExplosion(endPosition, spawnExplosionEffect: true, 50, 0f, 1f, 5, affectedPlayer, null, 10f); networkAnimator.SetTrigger(ShootingAnimation, true); yield break; } private void SwitchPose(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { IncreaseOrDecreaseStageServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void IncreaseOrDecreaseStageServerRpc() { int integer = animator.GetInteger(AnimationStageInt); Plugin.ExtendedLogging("Current Stage: " + integer); if (integer >= 1) { animator.SetInteger(AnimationStageInt, 0); } else { animator.SetInteger(AnimationStageInt, integer + 1); } } } public class BearTrapGalAI : NetworkBehaviour { public Animator animator = null; public Transform biteTransform = null; public NetworkAnimator networkAnimator = null; public InteractTrigger boobaTrigger = null; public InteractTrigger SwitchPoseTrigger = null; private static readonly int BitingAnimation = Animator.StringToHash("Biting"); private static readonly int AnimationStageInt = Animator.StringToHash("StageAnimation"); public void Start() { ((UnityEvent)(object)boobaTrigger.onInteract).AddListener((UnityAction)EatPlayer); ((UnityEvent)(object)SwitchPoseTrigger.onInteract).AddListener((UnityAction)SwitchPose); } private void EatPlayer(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { BitePlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } } [ServerRpc(RequireOwnership = false)] private void BitePlayerServerRpc(int playerIndex) { BitePlayerClientRpc(playerIndex); } [ClientRpc] private void BitePlayerClientRpc(int playerIndex) { ((MonoBehaviour)this).StartCoroutine(BiteAnimationDelay(playerIndex)); } private IEnumerator BiteAnimationDelay(int playerIndex) { PlayerControllerB affectedPlayer = StartOfRound.Instance.allPlayerScripts[playerIndex]; ((Component)affectedPlayer).transform.position = biteTransform.position; affectedPlayer.disableMoveInput = true; affectedPlayer.disableInteract = true; animator.SetBool(BitingAnimation, true); yield return (object)new WaitForSeconds(3f); animator.SetBool(BitingAnimation, false); yield return (object)new WaitForSeconds(1f); affectedPlayer.disableMoveInput = false; affectedPlayer.disableInteract = false; } private void SwitchPose(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { IncreaseOrDecreaseStageServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void IncreaseOrDecreaseStageServerRpc() { int integer = animator.GetInteger(AnimationStageInt); Plugin.ExtendedLogging("Current Stage: " + integer); if (integer >= 2) { animator.SetInteger(AnimationStageInt, 0); } else { animator.SetInteger(AnimationStageInt, integer + 1); } } } public class BellCrabGalAI : NetworkBehaviour { public CRNoiseListener _BellCrabGalNoiseListener = null; public Animator animator; public NetworkAnimator networkAnimator; public InteractTrigger SwitchPoseTrigger; [NonSerialized] public float boomboxTimer = 0f; [NonSerialized] public bool boomboxPlaying = false; private static readonly int AnimationStageInt = Animator.StringToHash("AnimationStageInt"); private static readonly int isDancing = Animator.StringToHash("isDancing"); public void Start() { _BellCrabGalNoiseListener._onNoiseDetected.AddListener((UnityAction)OnNoiseDetected); ((UnityEvent)(object)SwitchPoseTrigger.onInteract).AddListener((UnityAction)SwitchPose); } public void Update() { BoomboxUpdate(); } private void BoomboxUpdate() { if (boomboxPlaying && ((NetworkBehaviour)this).IsServer) { boomboxTimer += Time.deltaTime; if (boomboxTimer >= 2f) { boomboxTimer = 0f; boomboxPlaying = false; animator.SetBool(isDancing, false); } } } private void SwitchPose(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { IncreaseOrDecreaseStageServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void IncreaseOrDecreaseStageServerRpc() { int integer = animator.GetInteger(AnimationStageInt); Plugin.ExtendedLogging("Current Stage: " + integer); if (integer >= 4) { animator.SetInteger(AnimationStageInt, 0); } else { animator.SetInteger(AnimationStageInt, integer + 1); } } public void OnNoiseDetected(NoiseParams noiseParams) { //IL_001f: 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) if (((NetworkBehaviour)this).IsServer && noiseParams.noiseID == 5 && !Physics.Linecast(((Component)this).transform.position, noiseParams.noisePosition, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { boomboxTimer = 0f; boomboxPlaying = true; animator.SetBool(isDancing, true); } } } public class Charger : NetworkBehaviour { public InteractTrigger ActivateOrDeactivateTrigger = null; public Transform ChargeTransform = null; [NonSerialized] public GalAI GalAI = null; [NonSerialized] public static List Instances = new List(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); } public IEnumerator ActivateGalAfterLand() { if (!((NetworkBehaviour)this).IsServer) { yield break; } while (true) { yield return (object)new WaitUntil((Func)(() => TimeOfDay.Instance.normalizedTimeOfDay <= 0.12f && StartOfRound.Instance.shipHasLanded && !GalAI.Animator.GetBool("activated") && !StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase && RoundManager.Instance.currentLevel.levelID != 3)); Plugin.ExtendedLogging("Activating Gal" + TimeOfDay.Instance.normalizedTimeOfDay); if (!GalAI.Animator.GetBool("activated")) { int playerIndex = Array.IndexOf(value: (from p in StartOfRound.Instance.allPlayerScripts where p.isPlayerControlled && !p.isPlayerDead orderby Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position) select p).First(), array: StartOfRound.Instance.allPlayerScripts); if (!((NetworkBehaviour)this).NetworkObject.IsSpawned) { break; } ActivateGirlServerRpc(playerIndex); } } } public void OnActivateGal(PlayerControllerB playerInteracting) { if (((NetworkBehaviour)this).NetworkObject.IsSpawned && !((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving && (RoundManager.Instance.currentLevel.levelID != 3 || NavmeshInCompanyCompat.Enabled)) { if (!GalAI.Animator.GetBool("activated")) { ActivateGirlServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } else if (!Plugin.ModConfig.ConfigOnlyOwnerDisablesGal.Value || !((Object)(object)playerInteracting != (Object)(object)GalAI.ownerPlayer)) { ActivateGirlServerRpc(-1); } } } [ServerRpc(RequireOwnership = false)] public void ActivateGirlServerRpc(int index) { GalAI.Animator.SetBool("activated", index != -1); ActivateGirlClientRpc(index); } [ClientRpc] private void ActivateGirlClientRpc(int index) { if (index != -1) { GalAI.ActivateGal(StartOfRound.Instance.allPlayerScripts[index]); } else { GalAI.DeactivateGal(); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); } } public class CleanerDroneGalAI : NetworkBehaviour { public Animator animator; public NetworkAnimator networkAnimator; public InteractTrigger SwitchPoseTrigger; public InteractTrigger smokeTrigger; public Transform smokeTransform; private static readonly int AnimationStageInt = Animator.StringToHash("AnimationStageInt"); public void Start() { ((UnityEvent)(object)SwitchPoseTrigger.onInteract).AddListener((UnityAction)SwitchPose); ((UnityEvent)(object)smokeTrigger.onInteract).AddListener((UnityAction)DropASmoke); } private void DropASmoke(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { SpawnTzpServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void SpawnTzpServerRpc() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Item val = StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == "TZP-Inhalant").FirstOrDefault(); if (!((Object)(object)val == (Object)null)) { GameObject val2 = Object.Instantiate(val.spawnPrefab, smokeTransform.position, Quaternion.identity); val2.GetComponent().Spawn(false); } } private void SwitchPose(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { IncreaseOrDecreaseStageServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void IncreaseOrDecreaseStageServerRpc() { int integer = animator.GetInteger(AnimationStageInt); Plugin.ExtendedLogging("Current Stage: " + integer); if (integer >= 2) { animator.SetInteger(AnimationStageInt, 0); } else { animator.SetInteger(AnimationStageInt, integer + 1); } } } public class CruiserCharger : Charger { public Animator animator = null; public static readonly int isActivatedAnimation = Animator.StringToHash("IsActivated"); } public class CruiserGalAI : GalAI { public enum State { Inactive, Active, FollowingPlayer, DeliveringPlayer, Dancing } public InteractTrigger ChestCollisionToggleTrigger = null; public InteractTrigger RadioTrigger = null; public InteractTrigger WheelDumpScrapTrigger = null; public InteractTrigger LeverInteract = null; public InteractTrigger ContainerTrigger = null; public InteractTrigger HatTrigger = null; public List ItemsHeldTransforms = new List(); public Transform playerHeldBone = null; public Transform galContainer = null; public AudioSource RadioAudioSource = null; public AudioSource FootstepSource = null; public AudioClip[] RadioSounds = Array.Empty(); public AudioClip[] StartOrStopFlyingSounds = Array.Empty(); public AudioClip LaunchSound = null; public AudioClip ChestCollisionToggleSound = null; public GameObject ContainerGO = null; private Coroutine? fixPlayerPositionRoutine = null; private List itemsHeldList = new List(); private EntranceTeleport entranceToGoTo = null; private bool flying = false; private State galState = State.Inactive; private Coroutine? chestCollisionToggleCoroutine = null; private static readonly int chestCollisionToggleAnimation = Animator.StringToHash("hitBumper"); private static readonly int pullLeverAnimation = Animator.StringToHash("pullLever"); private static readonly int spinWheelAnimation = Animator.StringToHash("spinWheel"); private static readonly int grabPlayerOntoSeatAnimation = Animator.StringToHash("putPlayerOnSeat"); private static readonly int danceAnimation = Animator.StringToHash("dancing"); private static readonly int activatedAnimation = Animator.StringToHash("activated"); private static readonly int flyAnimation = Animator.StringToHash("flying"); private static readonly int runSpeedFloat = Animator.StringToHash("RunSpeed"); private void LateUpdate() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ownerPlayer != (Object)null && galState == State.DeliveringPlayer) { ((Component)ownerPlayer).transform.position = galContainer.position; ownerPlayer.ResetFallGravity(); } } private void StartUpDelay() { List list = new List(); foreach (Charger instance in Charger.Instances) { if (instance is CruiserCharger item) { list.Add(item); } } if (list.Count <= 0) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } Plugin.Logger.LogError((object)"CruiserCharger not found in scene. CruiserGalAI will not be functional."); return; } CruiserCharger cruiserCharger = list.OrderBy((CruiserCharger x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position)).First(); cruiserCharger.GalAI = this; GalCharger = cruiserCharger; ((UnityEvent)(object)ChestCollisionToggleTrigger.onInteract).AddListener((UnityAction)OnChestCollisionToggleInteract); ((UnityEvent)(object)RadioTrigger.onInteract).AddListener((UnityAction)OnRadioInteract); ((UnityEvent)(object)WheelDumpScrapTrigger.onInteract).AddListener((UnityAction)OnWheelDumpScrapInteract); ((UnityEvent)(object)LeverInteract.onInteract).AddListener((UnityAction)OnLeverPullInteract); ((UnityEvent)(object)ContainerTrigger.onInteract).AddListener((UnityAction)OnContainerInteract); ((UnityEvent)(object)HatTrigger.onInteract).AddListener((UnityAction)OnHatInteract); if (Plugin.ModConfig.ConfigCruiserGalAutomatic.Value) { ((MonoBehaviour)this).StartCoroutine(GalCharger.ActivateGalAfterLand()); } ((UnityEvent)(object)GalCharger.ActivateOrDeactivateTrigger.onInteract).AddListener((UnityAction)GalCharger.OnActivateGal); } public override void ActivateGal(PlayerControllerB owner) { base.ActivateGal(owner); ResetToChargerStation(State.Active); GalSFX.volume = 1f; if (GalCharger is CruiserCharger cruiserCharger) { cruiserCharger.animator.SetBool(CruiserCharger.isActivatedAnimation, true); } } private void ResetToChargerStation(State state) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (((Behaviour)Agent).enabled) { Agent.Warp(GalCharger.ChargeTransform.position); } else { ((Component)this).transform.position = GalCharger.ChargeTransform.position; } ((Component)this).transform.rotation = GalCharger.ChargeTransform.rotation; HandleStateAnimationSpeedChanges(state); } } public override void DeactivateGal() { base.DeactivateGal(); ResetToChargerStation(State.Inactive); GalSFX.volume = 0f; if (GalCharger is CruiserCharger cruiserCharger) { cruiserCharger.animator.SetBool(CruiserCharger.isActivatedAnimation, false); } } private void OnHatInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { ThrowPlayerServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void ThrowPlayerServerRpc() { HandleStateAnimationSpeedChanges(State.FollowingPlayer); ThrowPlayerClientRpc(); } [ClientRpc] private void ThrowPlayerClientRpc() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ownerPlayer == (Object)null)) { GalSFX.PlayOneShot(LaunchSound); PlayerControllerB? obj = ownerPlayer; obj.externalForceAutoFade += Vector3.up * 40f; ownerPlayer.ResetFallGravity(); ((MonoBehaviour)this).StartCoroutine(ResetGravityContinuously()); } } private IEnumerator ResetGravityContinuously() { int iterations = 0; yield return (object)new WaitForSeconds(0.5f); ContainerGO.SetActive(false); while ((Object)(object)ownerPlayer != (Object)null && iterations < 5) { iterations++; yield return (object)new WaitForSeconds(0.5f); ownerPlayer.ResetFallGravity(); } } private void OnContainerInteract(PlayerControllerB playerInteracting) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { GrabItemOwnerHoldingServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)playerInteracting.currentlyHeldObjectServer)); } } [ServerRpc(RequireOwnership = false)] private void GrabItemOwnerHoldingServerRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) HandleGrabbingItemClientRpc(networkBehaviourReference); } [ClientRpc] private void HandleGrabbingItemClientRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown int index = itemsHeldList.Count; if (itemsHeldList.Count >= 8) { index = galRandom.Next(8); } ((MonoBehaviour)this).StartCoroutine(HandleGrabbingItem((GrabbableObject)NetworkBehaviourReference.op_Implicit(networkBehaviourReference), ItemsHeldTransforms[index])); } private IEnumerator HandleGrabbingItem(GrabbableObject item, Transform heldTransform) { yield return (object)new WaitForSeconds(0.2f); item.isInElevator = false; item.isInShipRoom = false; PlayerControllerB playerHeldBy = item.playerHeldBy; if (playerHeldBy != null) { playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } yield return (object)new WaitForSeconds(0.2f); item.grabbable = false; item.isHeldByEnemy = true; item.hasHitGround = false; item.parentObject = heldTransform; item.EnablePhysics(false); itemsHeldList.Add(item); ((Component)item).transform.rotation = item.parentObject.rotation; ((Component)item).transform.Rotate(item.itemProperties.rotationOffset); GalVoice.PlayOneShot(item.itemProperties.dropSFX); HoarderBugAI.grabbableObjectsInMap.Remove(((Component)item).gameObject); } private void OnLeverPullInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { PutPlayerIntoSeatServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PutPlayerIntoSeatServerRpc() { NetworkAnimator.SetTrigger(grabPlayerOntoSeatAnimation, true); NetworkAnimator.SetTrigger(pullLeverAnimation, true); } private void CheckIfCanPathToEntrances(List> args) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) smartAgentNavigator.DisableMovement(false); Plugin.ExtendedLogging($"Pathable entrances: {args.Count}"); if (args.Count <= 0) { ContainerGO.SetActive(false); return; } entranceToGoTo = args[Random.Range(0, args.Count)].Generic; HandleStateAnimationSpeedChangesServerRpc(3); } public IEnumerator FixingPlayerToPoint() { while (true) { yield return (object)new WaitForEndOfFrame(); if ((Object)(object)ownerPlayer == (Object)null) { break; } ((Component)ownerPlayer).transform.SetPositionAndRotation(playerHeldBone.position, playerHeldBone.rotation); } } private void OnWheelDumpScrapInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { DropAllHeldItemsServerRpc(); } } private void OnRadioInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { StartRadioServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartRadioServerRpc() { StartRadioClientRpc(); } [ClientRpc] private void StartRadioClientRpc() { StartOrStopRadio(); } private void StartOrStopRadio() { if (RadioAudioSource.isPlaying) { RadioAudioSource.Stop(); return; } RadioAudioSource.clip = RadioSounds[galRandom.Next(RadioSounds.Length)]; RadioAudioSource.Play(); } private void OnChestCollisionToggleInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer) && chestCollisionToggleCoroutine == null) { StartCollisionAnimationServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartCollisionAnimationServerRpc() { NetworkAnimator.SetTrigger(chestCollisionToggleAnimation, true); StartCollisionAnimationClientRpc(); } [ClientRpc] private void StartCollisionAnimationClientRpc() { ((MonoBehaviour)this).StartCoroutine(StartCollisionAnimation()); } private IEnumerator StartCollisionAnimation() { GalVoice.PlayOneShot(ChestCollisionToggleSound); EnablePhysics(!physicsEnabled); yield return (object)new WaitForSeconds(1.25f); chestCollisionToggleCoroutine = null; } [ServerRpc(RequireOwnership = false)] private void DropAllHeldItemsServerRpc() { DropAllHeldItemsClientRpc(); NetworkAnimator.SetTrigger(spinWheelAnimation, true); } [ClientRpc] private void DropAllHeldItemsClientRpc() { DropAllHeldItems(); } private void DropAllHeldItems() { Plugin.ExtendedLogging($"Items held Count: {itemsHeldList.Count}"); for (int num = itemsHeldList.Count - 1; num >= 0; num--) { HandleDroppingItem(itemsHeldList[num]); } } private void InteractTriggersUpdate() { bool flag = !inActive && (Object)(object)ownerPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)ownerPlayer; bool interactable = flag && (Object)(object)ownerPlayer != (Object)null && (Object)(object)ownerPlayer.currentlyHeldObjectServer != (Object)null; ChestCollisionToggleTrigger.interactable = flag; RadioTrigger.interactable = flag; WheelDumpScrapTrigger.interactable = itemsHeldList.Count > 0; LeverInteract.interactable = flag; ContainerTrigger.interactable = interactable; HatTrigger.interactable = flag && galState == State.DeliveringPlayer; } private void StoppingDistanceUpdate() { Agent.stoppingDistance = 3f; } private void SetIdleDefaultStateForEveryone() { if ((Object)(object)GalCharger == (Object)null || (((NetworkBehaviour)this).IsServer && !doneOnce)) { doneOnce = true; Plugin.Logger.LogInfo((object)"Syncing for client"); galRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); ((Behaviour)Agent).enabled = false; StartUpDelay(); } } public override void InActiveUpdate() { base.InActiveUpdate(); inActive = galState == State.Inactive; } public override void Update() { base.Update(); SetIdleDefaultStateForEveryone(); InteractTriggersUpdate(); if (inActive) { FootstepSource.volume = 0f; return; } StoppingDistanceUpdate(); if (Animator.GetFloat(runSpeedFloat) > 0.01f) { FootstepSource.volume = 1f; } else { FootstepSource.volume = 0f; } if (((NetworkBehaviour)this).IsHost) { HostSideUpdate(); } } private float GetCurrentSpeedMultiplier() { return (galState == State.FollowingPlayer) ? 2f : 1f; } private void HostSideUpdate() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.inShipPhase) { GalCharger.ActivateGirlServerRpc(-1); return; } if (((Behaviour)Agent).enabled) { smartAgentNavigator.AdjustSpeedBasedOnDistance(0f, 40f, 0f, 10f, GetCurrentSpeedMultiplier()); } Animator animator = Animator; int num = runSpeedFloat; Vector3 velocity = Agent.velocity; animator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 3f); switch (galState) { case State.Inactive: break; case State.Active: DoActive(); break; case State.FollowingPlayer: DoFollowingPlayer(); break; case State.DeliveringPlayer: DoDeliveringPlayer(); break; case State.Dancing: DoDancing(); break; } } public override void OnEnableOrDisableAgent(bool agentEnabled) { base.OnEnableOrDisableAgent(agentEnabled); Animator.SetBool(flyAnimation, !agentEnabled); } private void DoActive() { if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); } else { HandleStateAnimationSpeedChanges(State.FollowingPlayer); } } private void DoFollowingPlayer() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); return; } GoToDestinationResult val = default(GoToDestinationResult); smartAgentNavigator.TryDoPathingToDestination(((Component)ownerPlayer).transform.position, ref val); if ((int)val != 1 && (int)val != 2 && boomboxPlaying) { HandleStateAnimationSpeedChanges(State.Dancing); ((MonoBehaviour)this).StartCoroutine(StopDancingDelay()); } } private void DoDeliveringPlayer() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ownerPlayer == (Object)null) { HandleStateAnimationSpeedChangesServerRpc(2); return; } smartAgentNavigator.DoPathingToDestination(entranceToGoTo.entrancePoint.position); if (Vector3.Distance(((Component)this).transform.position, entranceToGoTo.entrancePoint.position) > Agent.stoppingDistance) { return; } if (Agent.hasPath) { Vector3 velocity = Agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude != 0f) { return; } } ContainerGO.SetActive(false); HandleStateAnimationSpeedChangesServerRpc(2); } private void DoDancing() { } private IEnumerator StopDancingDelay() { yield return (object)new WaitUntil((Func)(() => !boomboxPlaying || galState != State.Dancing)); if (galState == State.Dancing) { HandleStateAnimationSpeedChanges(State.FollowingPlayer); } } private void StartFlyingAnimEvent() { SetFlying(flying: true); ((MonoBehaviour)this).StartCoroutine(FlyAnimationDelay()); } private IEnumerator FlyAnimationDelay() { smartAgentNavigator.DisableMovement(true); yield return (object)new WaitForSeconds(0.5f); smartAgentNavigator.DisableMovement(false); } private void StopFlyingAnimEvent() { SetFlying(flying: false); } private void SetFlying(bool flying) { this.flying = flying; if (flying) { GalSFX.PlayOneShot(StartOrStopFlyingSounds[0]); } else { GalSFX.PlayOneShot(StartOrStopFlyingSounds[1]); } } [ServerRpc(RequireOwnership = false)] private void HandleStateAnimationSpeedChangesServerRpc(int state) { HandleStateAnimationSpeedChanges((State)state); } private void HandleStateAnimationSpeedChanges(State state) { SwitchStateClientRpc((int)state); switch (state) { case State.Inactive: SetAnimatorBools(dance: false, activated: false); break; case State.Active: case State.FollowingPlayer: SetAnimatorBools(dance: false, activated: true); break; case State.DeliveringPlayer: SetAnimatorBools(dance: false, activated: true); break; case State.Dancing: SetAnimatorBools(dance: true, activated: true); break; } } private void SetAnimatorBools(bool dance, bool activated) { Animator.SetBool(danceAnimation, dance); Animator.SetBool(activatedAnimation, activated); } [ServerRpc(RequireOwnership = false)] private void SwitchStateServerRpc(int state) { SwitchStateClientRpc(state); } [ClientRpc] private void SwitchStateClientRpc(int state) { SwitchState(state); } private void SwitchState(int state) { if (state != -1) { switch ((State)state) { case State.Inactive: HandleStateInactiveChange(); break; case State.Active: HandleStateActiveChange(); break; case State.FollowingPlayer: HandleStateFollowingPlayerChange(); break; case State.DeliveringPlayer: HandleStateDeliveringPlayerChange(); break; case State.Dancing: HandleStateDancingChange(); break; } galState = (State)state; } } private void HandleStateInactiveChange() { DropAllHeldItems(); SetFlying(flying: false); ContainerGO.SetActive(false); Animator.SetBool(flyAnimation, false); if (fixPlayerPositionRoutine != null && (Object)(object)ownerPlayer != (Object)null) { ((MonoBehaviour)this).StopCoroutine(fixPlayerPositionRoutine); ownerPlayer.disableMoveInput = false; ownerPlayer.inSpecialInteractAnimation = false; } ownerPlayer = null; ((Behaviour)Agent).enabled = false; } private void HandleStateActiveChange() { ((Behaviour)Agent).enabled = true; } private void HandleStateFollowingPlayerChange() { GalVoice.PlayOneShot(GreetOwnerSound); } private void HandleStateDeliveringPlayerChange() { } private void HandleStateDancingChange() { } private void HandleDroppingItem(GrabbableObject item) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) item.parentObject = null; Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; bool flag = ((Bounds)(ref bounds)).Contains(((Component)this).transform.position); if (flag) { Plugin.ExtendedLogging($"Dropping item in ship room: {item}"); ((Component)item).transform.SetParent(GameNetworkManager.Instance.localPlayerController.playersManager.elevatorTransform, true); } else { ((Component)item).transform.SetParent(StartOfRound.Instance.propsContainer, true); } item.grabbable = true; item.isHeldByEnemy = false; item.EnablePhysics(true); item.EnableItemMeshes(true); item.isInShipRoom = flag; item.isInElevator = flag; ((Component)item).transform.localScale = item.originalScale; item.fallTime = 0f; item.startFallingPosition = ((Component)item).transform.parent.InverseTransformPoint(((Component)item).transform.position); item.targetFloorPosition = ((Component)item).transform.parent.InverseTransformPoint(item.GetItemFloorPosition(((Component)item).transform.position - Vector3.up * 1.75f)); item.floorYRot = -1; ((Component)item).transform.rotation = Quaternion.Euler(item.itemProperties.restingRotation); itemsHeldList.Remove(item); } public override void OnUseEntranceTeleport(bool setOutside) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) base.OnUseEntranceTeleport(setOutside); for (int i = 0; i < itemsHeldList.Count; i++) { itemsHeldList[i].isInFactory = setOutside; int index = galRandom.Next(ItemsHeldTransforms.Count); ((Component)itemsHeldList[i]).transform.position = ItemsHeldTransforms[index].position; ((MonoBehaviour)this).StartCoroutine(SetItemPhysics(itemsHeldList[i])); } if (!((Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform.parent != (Object)(object)((Component)this).transform)) { smartAgentNavigator.lastUsedEntranceTeleport.TeleportPlayer(); ((Component)GameNetworkManager.Instance.localPlayerController).transform.position = galContainer.position; } } private IEnumerator SetItemPhysics(GrabbableObject grabbableObject) { yield return (object)new WaitForSeconds(0.1f); grabbableObject.EnablePhysics(false); } public void GrabOrReleasePlayerAnimEvent(int grabbing) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ownerPlayer == (Object)null) { Plugin.Logger.LogWarning((object)"ownerPlayer is null in GrabOrReleasePlayerAnimEvent"); return; } if (grabbing == 1) { fixPlayerPositionRoutine = ((MonoBehaviour)this).StartCoroutine(FixingPlayerToPoint()); ContainerGO.SetActive(true); ownerPlayer.disableMoveInput = true; ownerPlayer.inSpecialInteractAnimation = true; return; } ((MonoBehaviour)this).StopCoroutine(fixPlayerPositionRoutine); ownerPlayer.disableMoveInput = false; ownerPlayer.inSpecialInteractAnimation = false; ((Component)ownerPlayer).transform.position = galContainer.position; smartAgentNavigator.DisableMovement(true); List<(EntranceTeleport, Vector3)> list = new List<(EntranceTeleport, Vector3)>(); List source = CodeRebirthUtils.EntrancePoints.Where((EntranceTeleport x) => (x.isEntranceToBuilding && smartAgentNavigator.IsAgentOutside()) || (!smartAgentNavigator.IsAgentOutside() && !x.isEntranceToBuilding)).ToList(); list = source.Select((EntranceTeleport kv) => (kv: kv, position: kv.entrancePoint.position)).ToList(); foreach (var (val, val2) in list) { Plugin.ExtendedLogging($"Checking if can path to {((Object)val).name} with position {val2}"); } smartAgentNavigator.CheckPaths((IEnumerable>)list, (Action>>)CheckIfCanPathToEntrances); } } public class CRUnlockableUpgradeScrap : UnlockableUpgradeScrap { public override void Start() { //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); DawnUnlockableItemInfo val = default(DawnUnlockableItemInfo); if (!((NetworkBehaviour)this).IsServer || (((DuskContentReference)(object)((UnlockableUpgradeScrap)this).UnlockableReference).TryResolve(ref val) && val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() is FailedPurchaseResult)) { return; } List list = new List(); CRUnlockableUpgradeScrap cRUnlockableUpgradeScrap = default(CRUnlockableUpgradeScrap); DawnUnlockableItemInfo val2 = default(DawnUnlockableItemInfo); foreach (DawnItemInfo value in ((Registry)(object)LethalContent.Items).Values) { if (!(((DawnBaseInfo)(object)value).Key.Namespace != "code_rebirth") && !((Object)(object)value.Item == (Object)null) && !((Object)(object)value.Item.spawnPrefab == (Object)null) && value.Item.spawnPrefab.TryGetComponent(ref cRUnlockableUpgradeScrap) && !((Object)(object)value.Item == (Object)(object)((GrabbableObject)this).itemProperties) && ((DuskContentReference)(object)((UnlockableUpgradeScrap)cRUnlockableUpgradeScrap).UnlockableReference).TryResolve(ref val2) && val2.DawnPurchaseInfo.PurchasePredicate.CanPurchase() is FailedPurchaseResult) { list.Add(value.Item); } } if (list.Count <= 0) { List<(Item, float)> list2 = new List<(Item, float)>(); foreach (SpawnableItemWithRarity item2 in RoundManager.Instance.currentLevel.spawnableScrap) { list2.Add((item2.spawnableItem, item2.rarity)); } Item val3 = CRUtilities.ChooseRandomWeightedType(list2); if ((Object)(object)val3 != (Object)null) { CodeRebirthUtils.Instance.SpawnScrap(val3, ((Component)this).transform.position, isQuest: false, defaultRotation: true, 5); } } else { Item item = list[Random.Range(0, list.Count)]; CodeRebirthUtils.Instance.SpawnScrap(item, ((Component)this).transform.position); } ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public enum HoverboardTypes { Regular } public class FuturisticHoverboard : NetworkBehaviour { [SerializeField] private Rigidbody _rigidBody = null; [SerializeField] private InteractTrigger _sitTrigger = null; [SerializeField] private Transform[] _anchors = (Transform[])(object)new Transform[4]; [SerializeField] private float _jumpTimer = 5f; private bool _turnedOn = false; private float _speedMultiplier = 1f; private float _chargeIncreaseMultiplier = 1f; private InputAction _moveAction = null; private InputAction _sprintAction = null; private InputAction _jumpAction = null; private InputAction _crouchAction = null; private PlayerControllerB? _playerRiding = null; private HoverboardTypes _hoverboardType = HoverboardTypes.Regular; private void Start() { _moveAction = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.FindAction("Move", false); _sprintAction = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.FindAction("Sprint", false); _jumpAction = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.FindAction("Jump", false); _crouchAction = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.FindAction("Crouch", false); ((UnityEvent)(object)_sitTrigger.onInteract).AddListener((UnityAction)OnInteract); if (_hoverboardType == HoverboardTypes.Regular) { } } private void FixedUpdate() { if (!((Object)(object)_playerRiding == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(_playerRiding) && _turnedOn) { for (int i = 0; i < _anchors.Length; i++) { ApplyForce(_anchors[i]); } } } private void ApplyForce(Transform anchor) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(anchor.position, -anchor.up, ref val, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { float num = Mathf.Clamp(Mathf.Abs(1f / (((RaycastHit)(ref val)).point.y - anchor.position.y)), 0f, _playerRiding.isInHangarShipRoom ? 3f : 100f); Plugin.ExtendedLogging($"Force: {num}"); _rigidBody.AddForceAtPosition(((Component)_playerRiding).transform.up * num * 8f, anchor.position, (ForceMode)5); } } private void OnInteract(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player) && !((Object)(object)_playerRiding != (Object)null)) { MountPlayerServerRpc(PlayerControllerReference.op_Implicit(player)); } } [ServerRpc(RequireOwnership = false)] private void MountPlayerServerRpc(PlayerControllerReference playerReference) { MountPlayerClientRpc(playerReference); } [ClientRpc] private void MountPlayerClientRpc(PlayerControllerReference playerReference) { PlayerControllerB player = PlayerControllerReference.op_Implicit(playerReference); MountPlayer(player); } private void MountPlayer(PlayerControllerB player) { _playerRiding = player; } } [RequireComponent(typeof(SmartAgentNavigator))] public class GalAI : NetworkBehaviour, IHittable { public CRNoiseListener _GalAINoiseListener = null; public string GalName = ""; public Animator Animator = null; public NetworkAnimator NetworkAnimator = null; public NavMeshAgent Agent = null; [NonSerialized] public Charger GalCharger = null; public Collider[] colliders = Array.Empty(); public AudioSource GalVoice = null; public AudioSource GalSFX = null; public AudioClip ActivateSound = null; public AudioClip GreetOwnerSound = null; public AudioClip[] IdleSounds = Array.Empty(); public AudioClip DeactivateSound = null; public AudioClip[] HitSounds = Array.Empty(); public AudioClip[] FootstepSounds = Array.Empty(); public float DoorOpeningSpeed = 1f; public Transform GalHead = null; public Transform GalEye = null; public Renderer[] renderersToHideIn = Array.Empty(); public SmartAgentNavigator smartAgentNavigator = null; internal static List Instances = new List(); internal bool boomboxPlaying = false; internal float staringTimer = 0f; internal const float stareThreshold = 2f; internal const float STARE_DOT_THRESHOLD = 0.8f; internal const float STARE_ROTATION_SPEED = 2f; internal EnemyAI? targetEnemy; internal PlayerControllerB? ownerPlayer; internal HashSet enemyTargetBlacklist = new HashSet(); internal int chargeCount = 10; internal int maxChargeCount; internal bool currentlyAttacking = false; internal float boomboxTimer = 0f; internal bool physicsEnabled = true; internal float idleNeededTimer = 10f; internal float idleTimer = 0f; internal Random galRandom = new Random(); internal bool inActive = true; internal bool doneOnce = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); if ((Object)(object)_GalAINoiseListener == (Object)null) { _GalAINoiseListener = ((Component)this).GetComponentInChildren(); } _GalAINoiseListener._onNoiseDetected.AddListener((UnityAction)DetectNoise); } [ServerRpc(RequireOwnership = false)] public void RefillChargesServerRpc() { RefillChargesClientRpc(); } [ClientRpc] public void RefillChargesClientRpc() { RefillCharges(); } public virtual void RefillCharges() { chargeCount = maxChargeCount; } public void DoGalRadarAction(bool enabled) { if (enabled) { StartOfRound.Instance.mapScreen.AddTransformAsTargetToRadar(((Component)this).transform, GalName, true); } else { StartOfRound.Instance.mapScreen.RemoveTargetFromRadar(((Component)this).transform); } StartOfRound.Instance.mapScreen.SyncOrderOfRadarBoostersInList(); } public virtual void InActiveUpdate() { } private void BoomboxUpdate() { if (boomboxPlaying && !inActive) { boomboxTimer += Time.deltaTime; if (boomboxTimer >= 2f) { boomboxTimer = 0f; boomboxPlaying = false; } } } private void IdleUpdate() { if (!inActive) { idleTimer += Time.deltaTime; if (!(idleTimer <= idleNeededTimer)) { idleTimer = 0f; idleNeededTimer = RandomExtensions.NextFloat(galRandom, 10f, 15f); GalSFX.PlayOneShot(IdleSounds[galRandom.Next(IdleSounds.Length)]); GalVoice.pitch = RandomExtensions.NextFloat(galRandom, 0.9f, 1.1f); } } } private void OwnerPlayerUpdate() { if ((Object)(object)ownerPlayer != (Object)null && ownerPlayer.isPlayerDead) { ownerPlayer = null; } } public virtual void Update() { if (((NetworkBehaviour)this).NetworkObject.IsSpawned) { InActiveUpdate(); BoomboxUpdate(); IdleUpdate(); OwnerPlayerUpdate(); } } public virtual void ActivateGal(PlayerControllerB owner) { Plugin.ExtendedLogging("Activating Gal: " + GalName); ownerPlayer = owner; DoGalRadarAction(enabled: true); GalVoice.PlayOneShot(ActivateSound); smartAgentNavigator.SetAllValues(true); smartAgentNavigator.OnUseEntranceTeleport.AddListener((UnityAction)OnUseEntranceTeleport); smartAgentNavigator.OnEnableOrDisableAgent.AddListener((UnityAction)OnEnableOrDisableAgent); } public virtual void OnEnableOrDisableAgent(bool agentEnabled) { Plugin.ExtendedLogging($"Enabled Agent: {agentEnabled}"); } public virtual void OnUseEntranceTeleport(bool setOutside) { Plugin.ExtendedLogging($"Used Entrance Teleport and should be set outside: {setOutside}"); if (physicsEnabled) { EnablePhysics(enablePhysics: false); } } public virtual void DeactivateGal() { Plugin.ExtendedLogging("Deactivating Gal: " + GalName); ownerPlayer = null; DoGalRadarAction(enabled: false); GalVoice.PlayOneShot(DeactivateSound); smartAgentNavigator.OnUseEntranceTeleport.RemoveListener((UnityAction)OnUseEntranceTeleport); smartAgentNavigator.OnEnableOrDisableAgent.RemoveListener((UnityAction)OnEnableOrDisableAgent); } public bool GoToChargerAndDeactivate() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0062: Unknown result type (might be due to invalid IL or missing references) smartAgentNavigator.DoPathingToDestination(GalCharger.ChargeTransform.position); if (!(Vector3.Distance(((Component)this).transform.position, GalCharger.ChargeTransform.position) <= Agent.stoppingDistance) && Agent.hasPath) { Vector3 velocity = Agent.velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude <= 0.01f)) { return false; } } GalCharger.ActivateGirlServerRpc(-1); return true; } public void DoStaringAtOwner(PlayerControllerB ownerPlayer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) Vector3 val = GalHead.position - ((Component)ownerPlayer.gameplayCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(((Component)ownerPlayer.gameplayCamera).transform.forward, normalized); if (num <= 0.8f) { staringTimer = 0f; return; } staringTimer += Time.deltaTime; if (!(staringTimer < 2f)) { val = ((Component)ownerPlayer.gameplayCamera).transform.position - ((Component)this).transform.position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; normalized2.y = 0f; Quaternion val2 = Quaternion.LookRotation(normalized2); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 2f); if (staringTimer >= 3.5f || val2 == ((Component)this).transform.rotation) { staringTimer = 0f; } } } [ServerRpc(RequireOwnership = false)] public void EnablePhysicsServerRpc(bool enablePhysics) { EnablePhysicsClientRpc(enablePhysics); } [ClientRpc] public void EnablePhysicsClientRpc(bool enablePhysics) { EnablePhysics(enablePhysics); } public void EnablePhysics(bool enablePhysics) { Collider[] array = colliders; foreach (Collider val in array) { val.enabled = enablePhysics; } physicsEnabled = enablePhysics; } [ServerRpc(RequireOwnership = false)] public void SetEnemyTargetServerRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetEnemyTargetClientRpc(networkBehaviourReference); } [ClientRpc] public void SetEnemyTargetClientRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown targetEnemy = (EnemyAI)NetworkBehaviourReference.op_Implicit(networkBehaviourReference); Plugin.ExtendedLogging($"{this} setting target to: {targetEnemy.enemyType.enemyName}"); } [ServerRpc(RequireOwnership = false)] public void ClearEnemyTargetServerRpc() { ClearEnemyTargetClientRpc(); } [ClientRpc] public void ClearEnemyTargetClientRpc() { targetEnemy = null; } public virtual void DetectNoise(NoiseParams noiseParams) { //IL_002b: 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) if (!inActive && ((NetworkBehaviour)this).IsServer && noiseParams.noiseID == 5 && !Physics.Linecast(((Component)this).transform.position, noiseParams.noisePosition, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { boomboxTimer = 0f; boomboxPlaying = true; } } public virtual bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (inActive) { return false; } PlayHurtSoundServerRpc(); return true; } [ServerRpc(RequireOwnership = false)] public virtual void PlayHurtSoundServerRpc() { PlayHurtSoundClientRpc(); } [ClientRpc] public virtual void PlayHurtSoundClientRpc() { GalVoice.PlayOneShot(HitSounds[galRandom.Next(HitSounds.Length)]); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); if (!inActive) { DoGalRadarAction(enabled: false); smartAgentNavigator.OnUseEntranceTeleport.RemoveListener((UnityAction)OnUseEntranceTeleport); smartAgentNavigator.OnEnableOrDisableAgent.RemoveListener((UnityAction)OnEnableOrDisableAgent); } } } public class GlitchedPlushie : NetworkBehaviour { public SkinnedMeshRenderer skinnedMeshRenderer = null; public AudioSource plushieSource = null; public List audioClips = new List(); public InteractTrigger interactTrigger = null; private Random plushieRandom = new Random(); public void Start() { plushieRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); ((UnityEvent)(object)interactTrigger.onInteract).AddListener((UnityAction)ItemActivateTrigger); } public void ItemActivateTrigger(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(player)) { PlayStuffServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PlayStuffServerRpc() { PlayStuffClientRpc(); } [ClientRpc] private void PlayStuffClientRpc() { plushieSource.PlayOneShot(audioClips[plushieRandom.Next(audioClips.Count)]); ((MonoBehaviour)this).StartCoroutine(ActivatePlushieCoroutine()); } private IEnumerator ActivatePlushieCoroutine() { float totalDuration = 1f; float halfDuration = totalDuration / 2f; for (float elapsed = 0f; elapsed < halfDuration; elapsed += Time.deltaTime) { float t = elapsed / halfDuration; skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Lerp(0f, 100f, t)); yield return null; } skinnedMeshRenderer.SetBlendShapeWeight(0, 100f); for (float elapsed2 = 0f; elapsed2 < halfDuration; elapsed2 += Time.deltaTime) { float t2 = elapsed2 / halfDuration; skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Lerp(100f, 0f, t2)); yield return null; } skinnedMeshRenderer.SetBlendShapeWeight(0, 0f); } } public class HauntedTeddyBear : NetworkBehaviour { [CompilerGenerated] private static class <>O { public static hook_SetShipReadyToLand <0>__TrySpawnHauntedTeddyBear; } [field: SerializeField] [field: Range(0f, 100f)] public float SpawnChance { get; private set; } [field: SerializeField] public AutoParentToShip AutoParentToShip { get; private set; } [field: SerializeField] public List RandomSpawnPositions { get; private set; } = new List(); [field: SerializeField] public List RandomSpawnRotations { get; private set; } = new List(); internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__TrySpawnHauntedTeddyBear; if (obj == null) { hook_SetShipReadyToLand val = TrySpawnHauntedTeddyBear; <>O.<0>__TrySpawnHauntedTeddyBear = val; obj = (object)val; } StartOfRound.SetShipReadyToLand += (hook_SetShipReadyToLand)obj; } private static void TrySpawnHauntedTeddyBear(orig_SetShipReadyToLand orig, StartOfRound self) { orig.Invoke(self); DawnUnlockableItemInfo val = default(DawnUnlockableItemInfo); if (!NetworkManager.Singleton.IsServer || !((Registry)(object)LethalContent.Unlockables).TryGetValue(CodeRebirthUnlockableItemKeys.TeddyBear, ref val)) { return; } UnlockableItem unlockableItem = val.UnlockableItem; int num = StartOfRound.Instance.unlockablesList.unlockables.IndexOf(unlockableItem); if (num == -1) { return; } float spawnChance = unlockableItem.prefabObject.GetComponent().SpawnChance; if (!((float)Random.Range(0, 100) > spawnChance)) { if (unlockableItem.inStorage) { StartOfRound.Instance.ReturnUnlockableFromStorageServerRpc(num); } else if (unlockableItem.alreadyUnlocked || unlockableItem.hasBeenUnlockedByPlayer) { StartOfRound.Instance.SpawnedShipUnlockables[num].GetComponent().ChangePosition(); } else { StartOfRound.Instance.UnlockShipObject(num); } } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ChangePosition(); } public void ChangePosition() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && RandomSpawnPositions.Count != 0) { Random random = new Random(StartOfRound.Instance.randomMapSeed); int num = random.Next(0, RandomSpawnPositions.Count); Vector3 positionOffset = RandomSpawnPositions[num]; Quaternion rotation = ((Component)this).transform.rotation; Vector3 rotationOffset = ((Quaternion)(ref rotation)).eulerAngles; if (RandomSpawnRotations.Count > num) { rotationOffset = RandomSpawnRotations[num]; } AutoParentToShip.positionOffset = positionOffset; AutoParentToShip.rotationOffset = rotationOffset; AutoParentToShip.MoveToOffset(); SyncClientsPositionServerRpc(); } } [ServerRpc] public void SyncClientsPositionServerRpc() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) SyncClientsPositionClientRpc(AutoParentToShip.positionOffset, AutoParentToShip.rotationOffset); } [ClientRpc] public void SyncClientsPositionClientRpc(Vector3 positionOffset, Vector3 rotationOffset) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) AutoParentToShip.positionOffset = positionOffset; AutoParentToShip.rotationOffset = rotationOffset; AutoParentToShip.MoveToOffset(); } } public class LaserShockBlast : NetworkBehaviour { [Header("Laser Settings")] public float LaserRange = 100f; public float LaserDuration = 0.2f; [Header("Visual Effects")] public LineRenderer LineRenderer = null; public GameObject ImpactEffectGameObject = null; [Header("Sound Effects")] public AudioSource AudioSource = null; public AudioClip LaserSound = null; public AudioClip ImpactEffectSound = null; [NonSerialized] public Transform laserOrigin = null; [HideInInspector] public ShockwaveGalAI shockwaveGal = null; private ParticleSystem impactEffect = null; public void Start() { impactEffect = ImpactEffectGameObject.GetComponent(); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(FireLaser()); } } private IEnumerator FireLaser() { Vector3 origin = laserOrigin.position; Vector3 direction = laserOrigin.forward; RaycastHit[] raycastHits = Physics.RaycastAll(origin, direction, LaserRange, MoreLayerMasks.CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleMask, (QueryTriggerInteraction)2); Array.Sort(raycastHits, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); Vector3 finalHitPoint = origin + direction * LaserRange; RaycastHit[] array = raycastHits; for (int num = 0; num < array.Length; num++) { RaycastHit raycastHit = array[num]; bool hit = HandleHit(raycastHit); finalHitPoint = ((RaycastHit)(ref raycastHit)).point; Plugin.ExtendedLogging("Raycast Hit: " + ((Object)((RaycastHit)(ref raycastHit)).collider).name); Plugin.ExtendedLogging($"Final Hit Point: {finalHitPoint}"); Plugin.ExtendedLogging($"Hit: {hit}"); if (hit) { break; } } yield return (object)new WaitUntil((Func)(() => ((NetworkBehaviour)this).NetworkObject.IsSpawned)); FireLaserClientRpc(finalHitPoint, laserOrigin.position); MainModule main = impactEffect.main; yield return (object)new WaitForSeconds(((MainModule)(ref main)).duration + LaserDuration + 5f); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } [ClientRpc] private void FireLaserClientRpc(Vector3 hitPoint, Vector3 laserOrigin) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LineRenderer != (Object)null) { ((Component)AudioSource).gameObject.transform.position = laserOrigin; AudioSource.PlayOneShot(LaserSound); LineRenderer.SetPosition(0, laserOrigin); LineRenderer.SetPosition(1, hitPoint); } if ((Object)(object)impactEffect != (Object)null) { ((Component)impactEffect).transform.position = hitPoint; CRUtilities.CreateExplosion(hitPoint, spawnExplosionEffect: false, 40, 1f, 4f, 2, null, null, 5f); impactEffect.Play(); ((Component)AudioSource).gameObject.transform.position = hitPoint; AudioSource.PlayOneShot(ImpactEffectSound); } ((MonoBehaviour)this).StartCoroutine(DisableLaser()); } private IEnumerator DisableLaser() { yield return (object)new WaitForSeconds(LaserDuration); if ((Object)(object)LineRenderer != (Object)null) { ((Renderer)LineRenderer).enabled = false; } } private bool HandleEnemyHit(RaycastHit raycastHit) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) Transform val = CRUtilities.TryFindRoot(((Component)((RaycastHit)(ref raycastHit)).collider).transform); EnemyAI val2 = default(EnemyAI); if ((Object)(object)val == (Object)null || !((Component)val).TryGetComponent(ref val2) || (Object)(object)val2 == (Object)null) { return false; } KillEnemyFromOwnerClientRpc(new NetworkObjectReference(((Component)val2).gameObject.GetComponent())); return true; } private bool HandlePlayerHit(RaycastHit raycastHit) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (!((Component)((RaycastHit)(ref raycastHit)).collider).gameObject.TryGetComponent(ref val) || (Object)(object)val == (Object)null) { return false; } int num = val.health - 1; if (num > 0) { val.DamagePlayer(num, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } return true; } private bool HandleTerrainOrGroundHit(RaycastHit raycastHit) { if (((Component)((RaycastHit)(ref raycastHit)).collider).gameObject.layer == 25 || ((Component)((RaycastHit)(ref raycastHit)).collider).gameObject.layer == 8) { return true; } return false; } private bool HandleHit(RaycastHit raycastHit) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return HandleEnemyHit(raycastHit) || HandlePlayerHit(raycastHit) || HandleTerrainOrGroundHit(raycastHit); } [ClientRpc] private void KillEnemyFromOwnerClientRpc(NetworkObjectReference networkObjectReference) { //IL_0001: 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) EnemyAI component = NetworkObjectReference.op_Implicit(networkObjectReference).GetComponent(); if (((NetworkBehaviour)component).IsOwner) { component.HitEnemyOnLocalClient(999, ((Component)shockwaveGal).transform.position, shockwaveGal.ownerPlayer, true, -1); component.KillEnemyOnOwnerClient(false); } } } public class MoneyCounter : NetworkSingleton, IHittable { [SerializeField] private HUDDisplayTip _firstDebtDisplayTip; [SerializeField] private NetworkAnimator _networkAnimator; [SerializeField] private Animator _animator; [SerializeField] private AudioSource _audioSource; [SerializeField] private AudioClip _onSpawnSound; [SerializeField] private AudioClip _onHitSound; [SerializeField] private AudioClip _onCoinGetSound; [SerializeField] private AudioClip _onOneWheelTurn; [SerializeField] private AudioClip _onTenWheelTurn; [SerializeField] private AudioClip _onHundredWheelTurn; [SerializeField] private Transform HundredWheel; [SerializeField] private Transform TenWheel; [SerializeField] private Transform OneWheel; [SerializeField] private Renderer _renderer; [SerializeField] private UnityEvent OnGoingDebt = new UnityEvent(); [SerializeField] private UnityEvent OnLeavingDebt = new UnityEvent(); private NetworkVariable _totalMoneyStored = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private static NamespacedKey _moneyKey = NamespacedKey.From("code_rebirth", "money_stored"); private static NamespacedKey _debtKey = NamespacedKey.From("code_rebirth", "went_to_debt_once"); private static readonly int OnHitHash = Animator.StringToHash("hit"); private static readonly int CoinGetHash = Animator.StringToHash("coinGet"); private Quaternion _hundredBase; private Quaternion _tenBase; private Quaternion _oneBase; private Coroutine? _spinRoutine; private static readonly int EmissiveColor = Shader.PropertyToID("_EmissiveColor"); public IEnumerator Start() { yield return (object)new WaitUntil((Func)(() => ((NetworkBehaviour)this).NetworkObject.IsSpawned)); yield return (object)new WaitUntil((Func)(() => (Object)(object)Singleton.Instance != (Object)null)); _audioSource.PlayOneShot(_onSpawnSound); if (((NetworkBehaviour)this).IsServer) { PersistentDataContainer contract = DawnLib.GetCurrentContract(); int value = default(int); if (contract != null && ((DataContainer)contract).TryGet(_moneyKey, ref value)) { Plugin.ExtendedLogging($"Loading money from contract: {value}"); _totalMoneyStored.Value = value; } UpdateVisuals(0, _totalMoneyStored.Value); } } public override void OnNetworkSpawn() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.OnNetworkSpawn(); InitPatches(); _hundredBase = HundredWheel.localRotation; _tenBase = TenWheel.localRotation; _oneBase = OneWheel.localRotation; GameObject val = GameObject.Find("HangarShip/ScavengerModelSuitParts/Circle.001"); if ((Object)(object)val != (Object)null) { val.SetActive(false); } } public override void OnNetworkDespawn() { base.OnNetworkDespawn(); RemovePatches(); } private void InitPatches() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown StartOfRound.AutoSaveShipData += new hook_AutoSaveShipData(SaveMoneyToContract); HUDManager.ApplyPenalty += new hook_ApplyPenalty(CalculateCoinPenalty); } private void RemovePatches() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown StartOfRound.AutoSaveShipData -= new hook_AutoSaveShipData(SaveMoneyToContract); HUDManager.ApplyPenalty -= new hook_ApplyPenalty(CalculateCoinPenalty); } private void CalculateCoinPenalty(orig_ApplyPenalty orig, HUDManager self, int playersDead, int bodiesInsured) { orig.Invoke(self, playersDead, bodiesInsured); if (NetworkManager.Singleton.IsServer && playersDead >= StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB x) => x.isPlayerControlled)) { int value = ((AssetBundleLoader)(object)ContentHandler.Instance.Merchant).GetConfig("Debt Collector | Penalty").Value; Plugin.ExtendedLogging($"Applying {playersDead * value} coin max penalty on all team wipe"); RemoveMoney(playersDead * value); } } private void SaveMoneyToContract(orig_AutoSaveShipData orig, StartOfRound self) { orig.Invoke(self); if (NetworkManager.Singleton.IsServer) { Plugin.ExtendedLogging($"Saving money to contract: {_totalMoneyStored.Value}"); PersistentDataContainer currentContract = DawnLib.GetCurrentContract(); if (currentContract != null) { ((DataContainer)currentContract).Set(_moneyKey, _totalMoneyStored.Value); } } } public void AddMoney(int amount) { if (amount != 0) { if (amount < 0) { RemoveMoney(-amount); return; } int value = _totalMoneyStored.Value; _totalMoneyStored.Value = Mathf.Clamp(amount + _totalMoneyStored.Value, -999, 999); _networkAnimator.SetTrigger(CoinGetHash, true); PlaySoundServerRpc(1); UpdateVisuals(value, _totalMoneyStored.Value); } } public int MoneyStored() { return _totalMoneyStored.Value; } public void RemoveMoney(int amount) { if (amount == 0) { return; } if (amount < 0) { AddMoney(-amount); return; } int value = _totalMoneyStored.Value; NetworkVariable totalMoneyStored = _totalMoneyStored; totalMoneyStored.Value -= amount; if (_totalMoneyStored.Value < 0 && !((DataContainer)DawnLib.GetCurrentSave()).GetOrCreateDefault(_debtKey)) { ((DataContainer)DawnLib.GetCurrentSave()).Set(_debtKey, true); _totalMoneyStored.Value = 0; NetworkSingleton.Instance.BroadcastDisplayTipServerRpc(_firstDebtDisplayTip); } UpdateVisuals(value, _totalMoneyStored.Value); } private void UpdateVisuals(int oldValue, int newValue) { if (StartOfRound.Instance.inShipPhase) { Plugin.ExtendedLogging($"Saving money to contract: {_totalMoneyStored.Value}"); PersistentDataContainer currentContract = DawnLib.GetCurrentContract(); if (currentContract != null) { ((DataContainer)currentContract).Set(_moneyKey, _totalMoneyStored.Value); } } UpdateVisualsClientRpc(oldValue, newValue); } [ClientRpc] private void UpdateVisualsClientRpc(int oldValue, int newValue) { if ((Object)(object)Singleton.Instance == (Object)null) { Plugin.Logger.LogError((object)"CoinDisplayUI.Instance is null somehow"); return; } if (Singleton.Instance.editCoinRoutine != null) { ((MonoBehaviour)Singleton.Instance).StopCoroutine(Singleton.Instance.editCoinRoutine); ((TMP_Text)Singleton.Instance.CoinTMP).text = oldValue.ToString(); } Singleton.Instance.editCoinRoutine = ((MonoBehaviour)Singleton.Instance).StartCoroutine(Singleton.Instance.EditCoinAmount(newValue, oldValue)); if (newValue < 0 && oldValue >= 0) { Plugin.ExtendedLogging("Going into debt mode"); GoToDebtMode(); } else if (oldValue < 0 && newValue >= 0) { LeaveDebt(); } int num = Mathf.Abs(newValue); int targetHundred = num / 100; int targetTen = num % 100 / 10; int targetOne = num % 10; if (_spinRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_spinRoutine); } float duration = 10f; if (Mathf.Abs(newValue - oldValue) <= 10) { duration = 2.5f; } else if ((float)Mathf.Abs(newValue - oldValue) <= 50f) { duration = 5f; } _spinRoutine = ((MonoBehaviour)this).StartCoroutine(SpinWheels(targetHundred, targetTen, targetOne, duration)); } private void LeaveDebt() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) OnLeavingDebt.Invoke(); Material sharedMaterial = _renderer.GetSharedMaterial(); sharedMaterial.SetColor(EmissiveColor, Color.black); } private void GoToDebtMode() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) OnGoingDebt.Invoke(); Material sharedMaterial = _renderer.GetSharedMaterial(); sharedMaterial.SetColor(EmissiveColor, new Color(50f, 0f, 0f, 1f)); } private IEnumerator SpinWheels(int targetHundred, int targetTen, int targetOne, float duration) { int currentHundred = GetDigitFromWheel(HundredWheel, _hundredBase); int currentTen = GetDigitFromWheel(TenWheel, _tenBase); int currentOne = GetDigitFromWheel(OneWheel, _oneBase); int currentValue = currentHundred * 100 + currentTen * 10 + currentOne; int destinationValue = targetHundred * 100 + targetTen * 10 + targetOne; if (currentValue == destinationValue) { _spinRoutine = null; yield break; } int direction = ((destinationValue > currentValue) ? 1 : (-1)); int steps = Mathf.Abs(destinationValue - currentValue); float stepDuration = Mathf.Max(0.1f, duration / (float)steps); float angleHundred = AngleForDigitRaw(currentHundred); float angleTen = AngleForDigitRaw(currentTen); float angleOne = AngleForDigitRaw(currentOne); HundredWheel.localRotation = _hundredBase * Quaternion.AngleAxis(angleHundred, Vector3.right); TenWheel.localRotation = _tenBase * Quaternion.AngleAxis(angleTen, Vector3.right); OneWheel.localRotation = _oneBase * Quaternion.AngleAxis(angleOne, Vector3.right); for (int i = 0; i < steps; i++) { bool moveTen = false; bool moveHundred = false; if (direction > 0) { if (currentOne == 9) { currentOne = 0; moveTen = true; } else { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onOneWheelTurn); currentOne++; } if (moveTen) { if (currentTen == 9) { currentTen = 0; moveHundred = true; } else { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onTenWheelTurn); currentTen++; } if (moveHundred) { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onHundredWheelTurn); currentHundred++; } } } else { if (currentOne == 0) { currentOne = 9; moveTen = true; } else { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onOneWheelTurn); currentOne--; } if (moveTen) { if (currentTen == 0) { currentTen = 9; moveHundred = true; } else { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onTenWheelTurn); currentTen--; } if (moveHundred) { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.PlayOneShot(_onHundredWheelTurn); currentHundred--; } } } float startHundred = angleHundred; float startTen = angleTen; float startOne = angleOne; angleOne += (float)direction * 36f; if (moveTen) { angleTen += (float)direction * 36f; } if (moveHundred) { angleHundred += (float)direction * 36f; } float endHundred = angleHundred; float endTen = angleTen; float endOne = angleOne; yield return AnimateTick(startHundred, endHundred, startTen, endTen, startOne, endOne, stepDuration); } SetWheelDigit(HundredWheel, _hundredBase, targetHundred); SetWheelDigit(TenWheel, _tenBase, targetTen); SetWheelDigit(OneWheel, _oneBase, targetOne); _spinRoutine = null; } private IEnumerator AnimateTick(float startHundred, float endHundred, float startTen, float endTen, float startOne, float endOne, float tickDuration) { float elapsed = 0f; while (elapsed < tickDuration) { elapsed += Time.deltaTime; float u = Mathf.Clamp01(elapsed / tickDuration); float e = u * u * (3f - 2f * u); HundredWheel.localRotation = _hundredBase * Quaternion.AngleAxis(Mathf.Lerp(startHundred, endHundred, e), Vector3.right); TenWheel.localRotation = _tenBase * Quaternion.AngleAxis(Mathf.Lerp(startTen, endTen, e), Vector3.right); OneWheel.localRotation = _oneBase * Quaternion.AngleAxis(Mathf.Lerp(startOne, endOne, e), Vector3.right); yield return null; } HundredWheel.localRotation = _hundredBase * Quaternion.AngleAxis(endHundred, Vector3.right); TenWheel.localRotation = _tenBase * Quaternion.AngleAxis(endTen, Vector3.right); OneWheel.localRotation = _oneBase * Quaternion.AngleAxis(endOne, Vector3.right); } private int GetDigitFromWheel(Transform wheel, Quaternion baseRot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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_0013: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Inverse(baseRot) * wheel.localRotation; Vector3 val2 = val * Vector3.forward; float num = Mathf.Atan2(0f - val2.y, val2.z) * 57.29578f; if (num < 0f) { num += 360f; } int num2 = Mathf.RoundToInt(num / 36f) % 10; if (num2 < 0) { num2 += 10; } return num2; } private void SetWheelDigit(Transform wheel, Quaternion baseRot, int digit) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //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_0017: Unknown result type (might be due to invalid IL or missing references) float num = 36f * (float)digit; wheel.localRotation = baseRot * Quaternion.AngleAxis(num, Vector3.right); } private float AngleForDigitRaw(int digit) { return 36f * (float)digit; } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if ((Object)(object)playerWhoHit == (Object)null) { return false; } if (force == -22) { force = 1; } HitServerRpc(force); PlaySoundServerRpc(0); return true; } [ServerRpc(RequireOwnership = false)] private void HitServerRpc(int force) { _networkAnimator.SetTrigger(OnHitHash, true); RemoveMoney(force); } [ServerRpc(RequireOwnership = false)] private void PlaySoundServerRpc(int index) { PlaySoundClientRpc(index); } [ClientRpc] private void PlaySoundClientRpc(int index) { switch (index) { case 0: _audioSource.PlayOneShot(_onHitSound); break; case 1: _audioSource.PlayOneShot(_onCoinGetSound); break; } } } public class PlantPot : NetworkBehaviour { public enum Stage { Zero, One, Two, Three } public enum FruitType { None, Tomato, Golden_Tomato } public InteractTrigger trigger = null; public Transform[] ItemSpawnSpots = null; public GameObject[] enableList = null; public NetworkVariable fruitType = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable stage = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [NonSerialized] public bool grewThisOrbit = true; [NonSerialized] public static List Instances = new List(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(LoadPlantData()); } } public void SavePlantData() { } public IEnumerator LoadPlantData() { yield return (object)new WaitUntil((Func)(() => (Object)(object)CodeRebirthUtils.Instance != (Object)null)); if (((NetworkBehaviour)this).IsServer) { } Plugin.ExtendedLogging($"Loaded stage {stage.Value} and fruit type {fruitType.Value}"); if (stage.Value != 0) { ((MonoBehaviour)this).StartCoroutine(GrowthRoutine()); enableList[stage.Value].SetActive(true); } else { ((UnityEvent)(object)trigger.onInteract).AddListener((UnityAction)OnInteract); } } [ServerRpc(RequireOwnership = false)] private void StartPlantGrowthServerRpc(NetworkObjectReference netObjRef) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(GrowthRoutine()); IncreaseStageClientRpc(); SetupFruitTypeClientRpc(netObjRef); } [ClientRpc] private void SetupFruitTypeClientRpc(NetworkObjectReference netObjRef) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) WoodenSeed component = NetworkObjectReference.op_Implicit(netObjRef).GetComponent(); fruitType.Value = (int)component.fruitType; Plugin.ExtendedLogging($"Setting up fruit type {fruitType.Value}"); ((GrabbableObject)component).playerHeldBy.DespawnHeldObject(); } private void OnInteract(PlayerControllerB playerInteracting) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && (Object)(object)playerInteracting.currentlyHeldObjectServer != (Object)null && playerInteracting.currentlyHeldObjectServer.itemProperties.itemName == "Wooden Seed") { StartPlantGrowthServerRpc(new NetworkObjectReference(((NetworkBehaviour)playerInteracting.currentlyHeldObjectServer).NetworkObject)); } } private IEnumerator GrowthRoutine() { ((Behaviour)trigger).enabled = false; while (true) { yield return (object)new WaitUntil((Func)(() => StartOfRound.Instance.inShipPhase && !grewThisOrbit && RoundManager.Instance.currentLevel.spawnEnemiesAndScrap)); if (stage.Value < 3) { IncreaseStageServerRpc(); } else { switch ((FruitType)fruitType.Value) { case FruitType.Tomato: ProduceFruitServerRpc(1); break; case FruitType.Golden_Tomato: ProduceFruitServerRpc(2); break; } } grewThisOrbit = true; yield return (object)new WaitForEndOfFrame(); } } [ServerRpc(RequireOwnership = false)] private void ProduceFruitServerRpc(int fruitType) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Item val = null; if (fruitType != 1) { } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)$"Couldn't find fruit of type {fruitType}!"); return; } Transform[] itemSpawnSpots = ItemSpawnSpots; foreach (Transform val2 in itemSpawnSpots) { CodeRebirthUtils.Instance.SpawnScrap(val, val2.position); } } [ServerRpc(RequireOwnership = false)] private void IncreaseStageServerRpc() { IncreaseStageClientRpc(); } [ClientRpc] private void IncreaseStageClientRpc() { Plugin.ExtendedLogging($"Increasing stage from {stage.Value} to {stage.Value + 1}"); if (stage.Value == 0) { ((UnityEvent)(object)trigger.onInteract).RemoveListener((UnityAction)OnInteract); } enableList[stage.Value].SetActive(false); NetworkVariable obj = stage; int value = obj.Value; obj.Value = value + 1; enableList[stage.Value].SetActive(true); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); ((MonoBehaviour)this).StopAllCoroutines(); } } public class SCP999GalAI : NetworkBehaviour { public CRNoiseListener _SCP999GalNoiseListener = null; public Animator animator = null; public NetworkAnimator networkAnimator = null; public InteractTrigger HealTrigger = null; public GameObject particleSystemGameObject = null; public List revivePositions = new List(); private float boomboxTimer = 0f; private bool boomboxPlaying = false; private bool currentlyHealing = false; private float nearbyAnimationTimer = 1f; private float cooldownTimer = 5f; private static readonly int playerIsNearby = Animator.StringToHash("playerIsNearby"); private static readonly int isDancing = Animator.StringToHash("isDancing"); private static readonly int doSquishAnimation = Animator.StringToHash("doSquish"); private static readonly int doSucceedAnimation = Animator.StringToHash("doSucceed"); private static readonly int doFailAnimation = Animator.StringToHash("doFail"); private NetworkVariable healChargeCount = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private NetworkVariable reviveChargeCount = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public Dictionary playerMaxHealthDict = new Dictionary(); public static List Instances = new List(); private static readonly NamespacedKey NancyHealReviveCount = NamespacedKey.From("code_rebirth", "nancy_heal_revive_count"); public override void OnNetworkSpawn() { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { if (!GameNetworkManager.Instance.gameHasStarted) { Vector2 orSetDefault = ((DataContainer)DawnLib.GetCurrentContract()).GetOrSetDefault(NancyHealReviveCount, new Vector2(0f, 0f)); reviveChargeCount.Value = (int)orSetDefault.x; healChargeCount.Value = (int)orSetDefault.y; } else { RechargeGalHealsAndRevivesServerRpc(heal: true, revive: true); } } Instances.Add(this); ((MonoBehaviour)this).StartCoroutine(UpdatePlayerHealthForSelf()); QualitySettings.skinWeights = (SkinWeights)4; if (((NetworkBehaviour)this).IsServer) { RechargeGalHealsAndRevivesServerRpc(heal: true, revive: true); } MakeTriggerInteractable(!StartOfRound.Instance.inShipPhase); _SCP999GalNoiseListener._onNoiseDetected.AddListener((UnityAction)DetectNoise); ((UnityEvent)(object)HealTrigger.onInteract).AddListener((UnityAction)HealPlayerInteraction); } public override void OnNetworkDespawn() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkDespawn(); if (((NetworkBehaviour)this).IsServer) { ((DataContainer)DawnLib.GetCurrentContract()).Set(NancyHealReviveCount, new Vector2((float)reviveChargeCount.Value, (float)healChargeCount.Value)); } Instances.Remove(this); } public void Update() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (nearbyAnimationTimer <= 0f) { nearbyAnimationTimer = 1f; bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled && val.isInHangarShipRoom && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 10f) { flag = true; break; } } animator.SetBool(playerIsNearby, flag); } if (cooldownTimer <= 0f) { bool flag2 = healChargeCount.Value > 0; bool flag3 = reviveChargeCount.Value > 0; if (flag2 && flag3) { HealTrigger.hoverTip = "Heals Left: " + healChargeCount.Value + "\nRevives Left: " + reviveChargeCount.Value; } else if (flag2) { HealTrigger.hoverTip = "Heals Left: " + healChargeCount.Value; } else if (flag3) { HealTrigger.hoverTip = "Revives Left: " + reviveChargeCount.Value; } else { HealTrigger.hoverTip = "Not enough charges!"; } } else { HealTrigger.hoverTip = "Healing Cooldown: " + Math.Round(cooldownTimer, 2); } if (!currentlyHealing) { cooldownTimer -= Time.deltaTime; } BoomboxUpdate(); } private void BoomboxUpdate() { if (boomboxPlaying) { boomboxTimer += Time.deltaTime; if (boomboxTimer >= 2f) { boomboxTimer = 0f; boomboxPlaying = false; animator.SetBool(isDancing, false); } } } public IEnumerator UpdatePlayerHealthForSelf() { yield return (object)new WaitUntil((Func)(() => (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)); _ = GameNetworkManager.Instance.localPlayerController; ResetAndSetMaxHealthForPlayerRpc(); } public int GrabMaxHealthForPlayer(PlayerControllerB player) { return Mathf.Max(player.health, 100); } [Rpc(/*Could not decode attribute arguments.*/)] private void ResetAndSetMaxHealthForPlayerRpc() { playerMaxHealthDict.Clear(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; InformOtherClientsOfMaxHealthRpc(PlayerControllerReference.op_Implicit(localPlayerController), GrabMaxHealthForPlayer(localPlayerController)); } [Rpc(/*Could not decode attribute arguments.*/)] private void InformOtherClientsOfMaxHealthRpc(PlayerControllerReference player, int maxHealth) { PlayerControllerB val = PlayerControllerReference.op_Implicit(player); Plugin.ExtendedLogging($"Informing other clients that player {val.playerUsername} has max health: {maxHealth}"); if (playerMaxHealthDict.ContainsKey(val)) { playerMaxHealthDict[val] = maxHealth; } else { playerMaxHealthDict.Add(val, maxHealth); } } private void HealPlayerInteraction(PlayerControllerB playerInteracting) { Plugin.ExtendedLogging($"Healing player: {playerInteracting} | Cooldown timer: {cooldownTimer} | Heal Charge count: {healChargeCount.Value} | Revive Charge count: {reviveChargeCount.Value}"); if (!boomboxPlaying) { if (cooldownTimer > 0f || (healChargeCount.Value <= 0 && reviveChargeCount.Value <= 0)) { Plugin.ExtendedLogging("triggering squish animation."); TriggerAnimationServerRpc(doSquishAnimation); } else { DoHealingStuffServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } } } [ServerRpc(RequireOwnership = false)] private void TriggerAnimationServerRpc(int triggerHash) { networkAnimator.SetTrigger(triggerHash, true); } [ServerRpc(RequireOwnership = false)] private void DoHealingStuffServerRpc(int playerInteractingIndex) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"Player who poked index: {playerInteractingIndex}"); bool flag = false; PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerInteractingIndex]; bool value = Plugin.ModConfig.Config999GalHealOnlyInteractedPlayer.Value; int value2 = Plugin.ModConfig.Config999GalHealAmount.Value; float value3 = Plugin.ModConfig.Config999GalHealSpeed.Value; bool value4 = Plugin.ModConfig.Config999GalReviveNearbyDeadPlayers.Value; bool flag2 = false; if (Random.Range(0f, 100f) <= Plugin.ModConfig.Config999GalFailureChance.Value) { flag2 = true; } if (value4 && reviveChargeCount.Value > 0) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { Plugin.ExtendedLogging($"Checking player {((Object)val2).name} | dead: {val2.isPlayerDead} | controlled: {val2.isPlayerControlled}"); if ((Object)(object)val2 == (Object)null || !val2.isPlayerDead || (Object)(object)val2.deadBody == (Object)null || !((Component)val2.deadBody).gameObject.activeSelf || reviveChargeCount.Value <= 0) { continue; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)val2.deadBody).transform.position); Plugin.ExtendedLogging($"Distance from gal: {num}"); if (num > 5f) { continue; } NetworkVariable obj = reviveChargeCount; int value5 = obj.Value; obj.Value = value5 - 1; flag = true; if (flag2) { Plugin.ExtendedLogging("Failed to revive player."); if (NetworkManager.Singleton.IsServer) { networkAnimator.SetTrigger(doFailAnimation, true); } return; } DoALotOfShitToRevivePlayerClientRpc(revivePositions[Random.Range(0, revivePositions.Count)].position, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val2)); } } if (value) { if (healChargeCount.Value <= 0 || (Object)(object)val == (Object)null || val.isPlayerDead || !val.isPlayerControlled) { return; } flag = true; HealPlayersClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val), value2, value3, flag2); } else { PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts2) { Plugin.ExtendedLogging($"Checking player {((Object)val3).name} | dead: {val3.isPlayerDead} | controlled: {val3.isPlayerControlled}"); if (healChargeCount.Value > 0 && !((Object)(object)val3 == (Object)null) && !val3.isPlayerDead && val3.isPlayerControlled && !(Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) > 5f)) { flag = true; HealPlayersClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val3), value2, value3, flag2); } } } if (flag && !flag2) { networkAnimator.SetTrigger(doSucceedAnimation, true); } cooldownTimer = Plugin.ModConfig.Config999GalHealCooldown.Value; } [ClientRpc] private void HealPlayersClientRpc(int playerIndex, int healAmount, float healingSpeed, bool fail) { ((MonoBehaviour)this).StartCoroutine(HealPlayerOverTime(StartOfRound.Instance.allPlayerScripts[playerIndex], healAmount, healingSpeed, fail)); } private IEnumerator HealPlayerOverTime(PlayerControllerB player, int healAmount, float healingSpeed, bool failed) { if (failed) { Plugin.ExtendedLogging($"Failed to heal player, taking up {50} health away."); if (((NetworkBehaviour)this).IsServer) { networkAnimator.SetTrigger(doFailAnimation, true); NetworkVariable obj = healChargeCount; obj.Value -= 50; } yield break; } currentlyHealing = true; GameObject newParticles = Object.Instantiate(particleSystemGameObject, ((Component)player).transform.position, Quaternion.identity); newParticles.SetActive(true); int healthHealed = 0; float timeElapsed = 0f; while (healthHealed < healAmount && (float)player.health < playerMaxHealthDict[player]) { timeElapsed += Time.deltaTime; int healthThisFrame = Mathf.FloorToInt((float)healAmount * (timeElapsed / healingSpeed)) - healthHealed; if (healthThisFrame > 0) { healthHealed += healthThisFrame; if (PlayerControllerBExtensions.IsLocalPlayer(player)) { TellHostAboutNewHealthServerRpc(healthThisFrame); } player.health += healthThisFrame; SetVisualChangesToPlayer(player); } yield return null; } if (healthHealed < healAmount && (float)player.health < playerMaxHealthDict[player]) { player.health += healAmount - healthHealed; SetVisualChangesToPlayer(player); } currentlyHealing = false; Object.Destroy((Object)(object)newParticles); } [ServerRpc(RequireOwnership = false)] private void TellHostAboutNewHealthServerRpc(int healthToDecrease) { NetworkVariable obj = healChargeCount; obj.Value -= healthToDecrease; } private void SetVisualChangesToPlayer(PlayerControllerB player) { if (player.health >= 20) { if (player.criticallyInjured || player.bleedingHeavily) { player.criticallyInjured = false; player.bleedingHeavily = false; } player.playerBodyAnimator.SetBool("Limp", false); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { HUDManager.Instance.UpdateHealthUI(player.health, false); } } } [ClientRpc] private void DoALotOfShitToRevivePlayerClientRpc(Vector3 revivePosition, int PlayerScriptIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) DoStuffToRevivePlayer(revivePosition, PlayerScriptIndex); } public static void DoStuffToRevivePlayer(Vector3 revivePosition, int PlayerScriptIndex) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[PlayerScriptIndex]; val.isInsideFactory = false; val.isInElevator = true; val.isInHangarShipRoom = true; val.ResetPlayerBloodObjects(val.isPlayerDead); val.health = 5; val.isClimbingLadder = false; val.clampLooking = false; val.inVehicleAnimation = false; val.disableMoveInput = false; val.disableLookInput = false; val.disableInteract = false; val.ResetZAndXRotation(); ((Collider)val.thisController).enabled = true; if (val.isPlayerDead) { ((Collider)val.thisController).enabled = true; val.isPlayerDead = false; val.isPlayerControlled = true; val.health = 5; val.hasBeenCriticallyInjured = false; val.criticallyInjured = false; val.playerBodyAnimator.SetBool("Limp", false); val.TeleportPlayer(revivePosition, false, 0f, false, true); val.parentedToElevatorLastFrame = false; val.overrideGameOverSpectatePivot = null; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val.setPositionOfDeadPlayer = false; val.DisablePlayerModel(((Component)val).gameObject, true, true); ((Behaviour)val.helmetLight).enabled = false; val.Crouch(false); Animator playerBodyAnimator = val.playerBodyAnimator; if (playerBodyAnimator != null) { playerBodyAnimator.SetBool("Limp", false); } val.bleedingHeavily = false; if ((Object)(object)val.deadBody != (Object)null) { ((Behaviour)val.deadBody).enabled = false; ((Component)val.deadBody).gameObject.SetActive(false); } val.bleedingHeavily = true; val.deadBody = null; val.activatingItem = false; val.twoHanded = false; val.inShockingMinigame = false; val.inSpecialInteractAnimation = false; val.freeRotationInInteractAnimation = false; val.disableSyncInAnimation = false; val.inAnimationWithEnemy = null; val.holdingWalkieTalkie = false; val.speakingToWalkieTalkie = false; val.isSinking = false; val.isUnderwater = false; val.sinkingValue = 0f; val.statusEffectAudio.Stop(); val.DisableJetpackControlsLocally(); val.mapRadarDotAnimator.SetBool("dead", false); val.hasBegunSpectating = false; val.externalForceAutoFade = Vector3.zero; val.hinderedMultiplier = 1f; val.isMovementHindered = 0; val.sourcesCausingSinking = 0; val.reverbPreset = StartOfRound.Instance.shipReverb; SoundManager.Instance.earsRingingTimer = 0f; val.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)] = 1f; SoundManager.Instance.SetPlayerPitch(1f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)); if ((Object)(object)val.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent().overridingLowPass = false; } HUDManager.Instance.UpdateBoxesSpectateUI(); HUDManager.Instance.UpdateSpectateBoxSpeakerIcons(); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val) { val.bleedingHeavily = false; val.criticallyInjured = false; val.health = 5; HUDManager.Instance.UpdateHealthUI(5, true); Animator playerBodyAnimator2 = val.playerBodyAnimator; if (playerBodyAnimator2 != null) { playerBodyAnimator2.SetBool("Limp", false); } val.spectatedPlayerScript = null; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val); StartOfRound.Instance.SetPlayerObjectExtrapolate(false); ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); } StartOfRound.Instance.allPlayersDead = false; StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.UpdatePlayerVoiceEffects(); } [ServerRpc(RequireOwnership = false)] public void RechargeGalHealsAndRevivesServerRpc(bool heal, bool revive) { int num = 0; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isPlayerDead) { num++; } } Plugin.ExtendedLogging("Active Amount with dict: " + StartOfRound.Instance.ClientPlayerList.Count); Plugin.ExtendedLogging($"ActivePlayerAmount: {num} | heal: {heal} | revive: {revive}"); if (heal) { healChargeCount.Value = Plugin.ModConfig.Config999GalHealTotalAmount.Value * ((!Plugin.ModConfig.Config999GalScaleHealAndReviveWithPlayerCount.Value) ? 1 : num); } if (revive) { reviveChargeCount.Value = Plugin.ModConfig.Config999GalReviveCharges.Value * ((!Plugin.ModConfig.Config999GalScaleHealAndReviveWithPlayerCount.Value) ? 1 : num); } } [ServerRpc(RequireOwnership = false)] public void MakeTriggerInteractableServerRpc(bool interactable) { MakeTriggerInteractableClientRpc(interactable); } [ClientRpc] public void MakeTriggerInteractableClientRpc(bool interactable) { MakeTriggerInteractable(interactable); } public void MakeTriggerInteractable(bool interactable) { HealTrigger.interactable = interactable; } public void DetectNoise(NoiseParams noiseParams) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (noiseParams.noiseID == 5 && !Physics.Linecast(((Component)this).transform.position, noiseParams.noisePosition, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { boomboxTimer = 0f; boomboxPlaying = true; animator.SetBool(isDancing, true); } } } public class SeamineCharger : Charger { } public class SeamineGalAI : GalAI { public enum State { Inactive, Active, FollowingPlayer, Dancing, AttackMode } public TerrainScanner terrainScanner = null; public List JojoAnimations = new List(); public InteractTrigger hugInteractTrigger = null; public InteractTrigger beltInteractTrigger = null; public GameObject flashLightLight = null; public InteractTrigger flashLightInteractTrigger = null; public AudioSource RidingBruceSource = null; public AudioClip explosionSound = null; public AudioClip hazardPingSound = null; public AudioClip rechargeChargesSound = null; public AudioClip spotEnemySound = null; public AudioClip hugSound = null; public List bruceSwimmingAudioClips = new List(); public List startOrEndRidingBruceAudioClips = new List(); public AudioClip squeezeFishSound = null; public Pickable pickable = null; public Light light = null; private Collider[] cachedColliders = (Collider[])(object)new Collider[10]; private bool physicsTemporarilyDisabled = false; private List customPassRoutines = new List(); private float hazardRevealTimer = 10f; private bool inHugAnimation = false; private bool huggingOwner = false; private bool ridingBruce = false; private State galState = State.Inactive; private bool jojoPosing = false; private float enemyCheckTimer = 1f; private static readonly int inElevatorAnimation = Animator.StringToHash("inElevator"); private static readonly int chargeCountInt = Animator.StringToHash("chargeCount"); private static readonly int revealHazardsAnimation = Animator.StringToHash("revealHazards"); private static readonly int hugAnimation = Animator.StringToHash("doHug"); private static readonly int jojoAnimationInt = Animator.StringToHash("jojoPoseInt"); private static readonly int attackModeAnimation = Animator.StringToHash("attackMode"); private static readonly int ridingBruceAnimation = Animator.StringToHash("ridingBruce"); private static readonly int startExplodeAnimation = Animator.StringToHash("doExplode"); private static readonly int danceAnimation = Animator.StringToHash("dancing"); private static readonly int activatedAnimation = Animator.StringToHash("activated"); private static readonly int runSpeedFloat = Animator.StringToHash("RunSpeed"); private void StartUpDelay() { List list = new List(); foreach (Charger instance in Charger.Instances) { if (instance is SeamineCharger item) { list.Add(item); } } if (list.Count <= 0) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } Plugin.Logger.LogError((object)"SeamineCharger not found in scene. SeamineGalAI will not be functional."); return; } SeamineCharger seamineCharger = list.OrderBy((SeamineCharger x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position)).First(); seamineCharger.GalAI = this; GalCharger = seamineCharger; if (Plugin.ModConfig.ConfigSeamineTinkAutomatic.Value) { ((MonoBehaviour)this).StartCoroutine(GalCharger.ActivateGalAfterLand()); } ((UnityEvent)(object)hugInteractTrigger.onInteract).AddListener((UnityAction)OnHugInteract); ((UnityEvent)(object)flashLightInteractTrigger.onInteract).AddListener((UnityAction)OnFlashLightInteract); ((UnityEvent)(object)GalCharger.ActivateOrDeactivateTrigger.onInteract).AddListener((UnityAction)GalCharger.OnActivateGal); pickable.IsLocked = false; RidingBruceSource.volume = Plugin.ModConfig.ConfigSeamineTinkRidingBruceVolume.Value; RidingBruceSource.Stop(); } public void OnBeltInteract() { if (!((Object)(object)ownerPlayer == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(ownerPlayer) && !((Object)(object)ownerPlayer.currentlyHeldObjectServer == (Object)null) && ownerPlayer.currentlyHeldObjectServer is KeyItem) { ownerPlayer.DespawnHeldObject(); StartBeltInteractServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartBeltInteractServerRpc() { PlayChargeSoundClientRpc(); RefillChargesClientRpc(); Animator.SetInteger(chargeCountInt, chargeCount); } [ClientRpc] private void PlayChargeSoundClientRpc() { GalSFX.PlayOneShot(rechargeChargesSound); } private void OnFlashLightInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { StartFlashLightInteractServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartFlashLightInteractServerRpc() { StartFlashLightInteractClientRpc(); } [ClientRpc] private void StartFlashLightInteractClientRpc() { GalSFX.PlayOneShot(squeezeFishSound); flashLightLight.SetActive(!flashLightLight.activeSelf); CullFactorySoftCompat.TryRefreshDynamicLight(light); } private void OnHugInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { StartHugInteractServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartHugInteractServerRpc() { StartHugInteractClientRpc(); } [ClientRpc] private void StartHugInteractClientRpc() { if (!((Object)(object)ownerPlayer == (Object)null)) { if (physicsEnabled) { physicsTemporarilyDisabled = true; EnablePhysics(enablePhysics: false); } huggingOwner = true; } } public override void ActivateGal(PlayerControllerB owner) { base.ActivateGal(owner); ResetToChargerStation(State.Active); } private void ResetToChargerStation(State state) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (((Behaviour)Agent).enabled) { Agent.Warp(GalCharger.ChargeTransform.position); } else { ((Component)this).transform.position = GalCharger.ChargeTransform.position; } ((Component)this).transform.rotation = GalCharger.ChargeTransform.rotation; HandleStateAnimationSpeedChangesServerRpc((int)state); } } public override void DeactivateGal() { base.DeactivateGal(); ResetToChargerStation(State.Inactive); } private IEnumerator ResetSpeedBackToNormal() { jojoPosing = true; yield return (object)new WaitForSeconds(2f); Animator.SetInteger(jojoAnimationInt, -1); jojoPosing = false; } private void InteractTriggersUpdate() { bool flag = !inActive && (Object)(object)ownerPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)ownerPlayer; bool flag2 = galState != State.AttackMode && flag; beltInteractTrigger.interactable = flag2 && chargeCount <= 0; pickable.IsLocked = beltInteractTrigger.interactable; hugInteractTrigger.interactable = flag2; flashLightInteractTrigger.interactable = flag; } private void StoppingDistanceUpdate() { Agent.stoppingDistance = ((galState == State.AttackMode) ? 2.5f : (3f * (huggingOwner ? 0.33f : 1f))); } private void SetIdleDefaultStateForEveryone() { if (!((Object)(object)GalCharger == (Object)null) && (!((NetworkBehaviour)this).IsServer || doneOnce)) { return; } doneOnce = true; Plugin.Logger.LogInfo((object)"Syncing for client"); galRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); chargeCount = Plugin.ModConfig.ConfigSeamineTinkCharges.Value; Animator.SetInteger(chargeCountInt, chargeCount); maxChargeCount = chargeCount; ((Behaviour)Agent).enabled = false; IEnumerable enumerable = from s in ((AssetBundleLoader)(object)ContentHandler.Instance.SeamineTink).GetConfig("Seamine Tink | Enemy Blacklist").Value.Split(',') select s.Trim(); foreach (string nameEntry in enumerable) { enemyTargetBlacklist.UnionWith(from et in ((Registry)(object)LethalContent.Enemies).Values where et.EnemyType.enemyName.Equals(nameEntry, StringComparison.OrdinalIgnoreCase) select et.EnemyType.enemyName); } StartUpDelay(); } public override void InActiveUpdate() { base.InActiveUpdate(); inActive = galState == State.Inactive; } public override void Update() { base.Update(); SetIdleDefaultStateForEveryone(); InteractTriggersUpdate(); if (!inActive) { StoppingDistanceUpdate(); if (((NetworkBehaviour)this).IsHost) { EnemyChecks(); HostSideUpdate(); } } } private float GetCurrentSpeedMultiplier() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) float result = 1f * ((galState == State.FollowingPlayer) ? 2f : 1f) * ((galState == State.AttackMode) ? 4f : 1f) * ((jojoPosing || inHugAnimation || currentlyAttacking) ? 0f : 1f); if (inHugAnimation && Vector3.Distance(((Component)this).transform.position, Agent.pathEndPosition) <= Agent.stoppingDistance) { Agent.velocity = Vector3.zero; } return result; } private void EnemyChecks() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) enemyCheckTimer -= Time.deltaTime; if (enemyCheckTimer > 0f) { return; } enemyCheckTimer = 1f; if (galState != State.FollowingPlayer || (Object)(object)ownerPlayer == (Object)null || !((Behaviour)Agent).enabled || chargeCount <= 0 || (!smartAgentNavigator.IsAgentOutside() && !ownerPlayer.isInsideFactory) || (smartAgentNavigator.IsAgentOutside() && ownerPlayer.isInsideFactory)) { return; } int num = Physics.OverlapSphereNonAlloc(((Component)ownerPlayer.gameplayCamera).transform.position, 15f, cachedColliders, MoreLayerMasks.EnemiesMask, (QueryTriggerInteraction)2); Plugin.ExtendedLogging($"Found {num} enemies"); EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < num; i++) { Collider val = cachedColliders[i]; if (!((Component)val).gameObject.activeSelf || !((Component)val).TryGetComponent(ref val2)) { continue; } EnemyAI mainScript = val2.mainScript; if (!((Object)(object)mainScript == (Object)null) && !mainScript.isEnemyDead && !enemyTargetBlacklist.Contains(mainScript.enemyType.enemyName) && !(mainScript is Transporter)) { if (!Physics.Linecast(((Component)ownerPlayer.gameplayCamera).transform.position, ((Component)val).transform.position, ref val3, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { SetEnemyTargetServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)mainScript)); HandleStateAnimationSpeedChanges(State.AttackMode); break; } Plugin.ExtendedLogging("Missed Hit: " + ((Object)((RaycastHit)(ref val3)).collider).name); } } } private void HostSideUpdate() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.inShipPhase) { GalCharger.ActivateGirlServerRpc(-1); return; } if (((Behaviour)Agent).enabled) { smartAgentNavigator.AdjustSpeedBasedOnDistance(0f, 40f, 0f, 10f, GetCurrentSpeedMultiplier()); } Animator animator = Animator; int num = runSpeedFloat; Vector3 velocity = Agent.velocity; animator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 2f); switch (galState) { case State.Inactive: break; case State.Active: DoActive(); break; case State.FollowingPlayer: DoFollowingPlayer(); break; case State.Dancing: DoDancing(); break; case State.AttackMode: DoAttackMode(); break; } } public override void OnEnableOrDisableAgent(bool agentEnabled) { base.OnEnableOrDisableAgent(agentEnabled); Animator.SetBool(ridingBruceAnimation, !agentEnabled); } private void DoActive() { if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); } else { HandleStateAnimationSpeedChanges(State.FollowingPlayer); } } private void DoFollowingPlayer() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); return; } GoToDestinationResult val = default(GoToDestinationResult); smartAgentNavigator.TryDoPathingToDestination(((Component)ownerPlayer).transform.position, ref val); if ((int)val == 1 || (int)val == 2) { return; } DoStaringAtOwner(ownerPlayer); DoRevealingHazards(); if (!DoHuggingOwner(ownerPlayer) && !DoDancingAction() && !jojoPosing && Random.Range(0f, 2500f) <= 5f) { Vector3 velocity = Agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude <= 0.01f && Vector3.Distance(((Component)Agent).transform.position, ((Component)ownerPlayer).transform.position) <= 5f) { DoJojoPoselol(); } } } private void DoDancing() { } private void DoAttackMode() { //IL_011a: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead || chargeCount <= 0 || (Object)(object)ownerPlayer == (Object)null) { if ((Object)(object)targetEnemy != (Object)null && targetEnemy.isEnemyDead) { ClearEnemyTargetServerRpc(); } if ((Object)(object)ownerPlayer != (Object)null) { HandleStateAnimationSpeedChanges(State.FollowingPlayer); } else { GoToChargerAndDeactivate(); } return; } if (!currentlyAttacking) { smartAgentNavigator.DoPathingToDestination(((Component)targetEnemy).transform.position); if (!smartAgentNavigator.CurrentPathIsValid() || (Vector3.Distance(((Component)this).transform.position, ((Component)ownerPlayer).transform.position) > 15f && Plugin.ModConfig.ConfigDontTargetFarEnemies.Value)) { HandleStateAnimationSpeedChanges(State.FollowingPlayer); return; } } float num = Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position); if (!(num <= Agent.stoppingDistance + 4f + (float)((targetEnemy is CentipedeAI || smartAgentNavigator.IsAgentOutside()) ? 5 : 0)) || currentlyAttacking) { return; } Vector3 position = ((Component)targetEnemy).transform.position; Vector3 val = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0f; if (normalized != Vector3.zero) { Quaternion val2 = Quaternion.LookRotation(normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f); } if (num <= Agent.stoppingDistance + (float)((targetEnemy is CentipedeAI || smartAgentNavigator.IsAgentOutside()) ? 5 : 0)) { currentlyAttacking = true; NetworkAnimator.SetTrigger(startExplodeAnimation, true); if (ridingBruce) { SetRidingBruce(RidingBruce: false); } } } private void DoJojoPoselol() { int num = Random.Range(0, JojoAnimations.Count); Animator.SetInteger(jojoAnimationInt, num); ((MonoBehaviour)this).StartCoroutine(ResetSpeedBackToNormal()); } private void DoRevealingHazards() { hazardRevealTimer -= Time.deltaTime; if (hazardRevealTimer <= 0f) { NetworkAnimator.SetTrigger(revealHazardsAnimation, true); hazardRevealTimer = Random.Range(Plugin.ModConfig.ConfigSeamineScanFrequency.Value - 5f, Plugin.ModConfig.ConfigSeamineScanFrequency.Value + 5f); } } private void DoHazardActionsAnimEvent() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) GalVoice.PlayOneShot(hazardPingSound); if (Plugin.ModConfig.ConfigOnlyOwnerSeesScanEffects.Value && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)ownerPlayer) { return; } ParticleSystem val = DoTerrainScan(terrainScanner, ((Component)this).transform.position); ((Component)((Component)val).gameObject.transform.parent).gameObject.SetActive(true); if (customPassRoutines.Count <= 0) { customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughEnemies, Plugin.ModConfig.ConfigSeamineScanRange.Value))); customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughHazards, Plugin.ModConfig.ConfigSeamineScanRange.Value))); return; } foreach (Coroutine customPassRoutine in customPassRoutines) { ((MonoBehaviour)this).StopCoroutine(customPassRoutine); } customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughEnemies, Plugin.ModConfig.ConfigSeamineScanRange.Value))); customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughHazards, Plugin.ModConfig.ConfigSeamineScanRange.Value))); } public static ParticleSystem DoTerrainScan(TerrainScanner _terrainScanner, Vector3 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return _terrainScanner.SpawnTerrainScanner(position); } private bool DoDancingAction() { if (boomboxPlaying) { HandleStateAnimationSpeedChanges(State.Dancing); ((MonoBehaviour)this).StartCoroutine(StopDancingDelay()); return true; } return false; } private bool DoHuggingOwner(PlayerControllerB ownerPlayer) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!huggingOwner) { return false; } if (Vector3.Distance(((Component)this).transform.position, ((Component)ownerPlayer).transform.position) <= Agent.stoppingDistance && ((Behaviour)Agent).enabled && !inHugAnimation) { NetworkAnimator.SetTrigger(hugAnimation, true); DoHugSoundClientRpc(); inHugAnimation = true; } return true; } [ClientRpc] private void DoHugSoundClientRpc() { if (!((Object)(object)ownerPlayer == (Object)null)) { ownerPlayer.enteringSpecialAnimation = true; ownerPlayer.disableMoveInput = true; ((MonoBehaviour)this).StartCoroutine(WaitUntilStopped()); } } private IEnumerator WaitUntilStopped() { yield return (object)new WaitUntil((Func)(() => Agent.velocity == Vector3.zero)); yield return (object)new WaitForSeconds(3.2f); GalVoice.PlayOneShot(hugSound); } public void EndHugAnimEvent() { inHugAnimation = false; huggingOwner = false; EnablePhysics(!physicsTemporarilyDisabled); physicsTemporarilyDisabled = false; if (!((Object)(object)ownerPlayer == (Object)null)) { ownerPlayer.enteringSpecialAnimation = false; ownerPlayer.disableMoveInput = false; } } private IEnumerator StopDancingDelay() { yield return (object)new WaitUntil((Func)(() => !boomboxPlaying || galState != State.Dancing)); if (galState == State.Dancing) { HandleStateAnimationSpeedChanges(State.FollowingPlayer); } } private void CheckIfEnemyIsHitAnimEvent() { //IL_0023: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) GalSFX.PlayOneShot(explosionSound); CRUtilities.CreateExplosion(((Component)beltInteractTrigger).gameObject.transform.position, spawnExplosionEffect: true, 10, 0f, 6f, 1, null, null, 5f); List list = new List(); int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 15f, cachedColliders, MoreLayerMasks.EnemiesMask, (QueryTriggerInteraction)2); EnemyAICollisionDetect val = default(EnemyAICollisionDetect); for (int i = 0; i < num; i++) { if (((Component)cachedColliders[i]).TryGetComponent(ref val)) { EnemyAI mainScript = val.mainScript; if ((Object)(object)mainScript != (Object)null && !mainScript.isEnemyDead) { Plugin.ExtendedLogging("Enemy hit: " + (object)mainScript); if (!list.Contains(mainScript)) { list.Add(mainScript); } } } else { Plugin.ExtendedLogging("Thing hit: " + ((Object)cachedColliders[i]).name); } } foreach (EnemyAI item in list) { if ((Object)(object)item == (Object)null || item.isEnemyDead || !((NetworkBehaviour)item).IsOwner) { continue; } item.HitEnemyOnLocalClient(999, ((Component)this).transform.position, ownerPlayer, true, -1); if (item.enemyType.canDie && !item.enemyType.destroyOnDeath) { item.KillEnemyOnOwnerClient(false); } else if (item is SpringManAI && MoreCounterplayCompat.MoreCounterplayExists && MoreCounterplayCompat.CoilheadCounterplayEnabled()) { for (int j = 0; j < 10; j++) { item.HitEnemyOnLocalClient(999, ((Component)this).transform.position, ownerPlayer, false, 5); } } else { item.KillEnemyOnOwnerClient(true); } } } private void EndAttackAnimEvent() { currentlyAttacking = false; chargeCount--; Animator.SetInteger(chargeCountInt, chargeCount); } public override void RefillCharges() { base.RefillCharges(); Animator.SetInteger(chargeCountInt, chargeCount); } private void PlayFootstepSoundAnimEvent() { GalSFX.PlayOneShot(FootstepSounds[galRandom.Next(FootstepSounds.Length)]); } private void StartRidingBruceAnimEvent() { SetRidingBruce(RidingBruce: true); ((MonoBehaviour)this).StartCoroutine(FlyAnimationDelay()); } private IEnumerator FlyAnimationDelay() { smartAgentNavigator.DisableMovement(true); yield return (object)new WaitForSeconds(1.5f); smartAgentNavigator.DisableMovement(false); } private void StopRidingBruceAnimEvent() { SetRidingBruce(RidingBruce: false); } private void SetRidingBruce(bool RidingBruce) { ridingBruce = RidingBruce; if (RidingBruce) { GalSFX.PlayOneShot(startOrEndRidingBruceAudioClips[galRandom.Next(startOrEndRidingBruceAudioClips.Count)]); RidingBruceSource.clip = bruceSwimmingAudioClips[Random.Range(0, bruceSwimmingAudioClips.Count)]; RidingBruceSource.Play(); } else { RidingBruceSource.Stop(); } } [ServerRpc(RequireOwnership = false)] private void HandleStateAnimationSpeedChangesServerRpc(int state) { HandleStateAnimationSpeedChanges((State)state); } private void HandleStateAnimationSpeedChanges(State state) { SwitchStateClientRpc((int)state); switch (state) { case State.Inactive: SetAnimatorBools(attackMode: false, dance: false, activated: false); break; case State.Active: SetAnimatorBools(attackMode: false, dance: false, activated: true); break; case State.FollowingPlayer: SetAnimatorBools(attackMode: false, dance: false, activated: true); break; case State.Dancing: SetAnimatorBools(attackMode: false, dance: true, activated: true); break; case State.AttackMode: SetAnimatorBools(attackMode: true, dance: false, activated: true); break; } } private void SetAnimatorBools(bool attackMode, bool dance, bool activated) { Animator.SetBool(attackModeAnimation, attackMode); Animator.SetBool(danceAnimation, dance); Animator.SetBool(activatedAnimation, activated); } [ServerRpc(RequireOwnership = false)] private void SwitchStateServerRpc(int state) { SwitchStateClientRpc(state); } [ClientRpc] private void SwitchStateClientRpc(int state) { SwitchState(state); } private void SwitchState(int state) { if (state != -1) { switch ((State)state) { case State.Inactive: HandleStateInactiveChange(); break; case State.Active: HandleStateActiveChange(); break; case State.FollowingPlayer: HandleStateFollowingPlayerChange(); break; case State.Dancing: HandleStateDancingChange(); break; case State.AttackMode: HandleStateAttackModeChange(); break; } galState = (State)state; } } private void HandleStateInactiveChange() { if (inHugAnimation) { inHugAnimation = false; huggingOwner = false; EnablePhysics(!physicsTemporarilyDisabled); physicsTemporarilyDisabled = false; if ((Object)(object)ownerPlayer != (Object)null) { ownerPlayer.enteringSpecialAnimation = false; ownerPlayer.disableMoveInput = false; } } ownerPlayer = null; ((Behaviour)Agent).enabled = false; GalSFX.PlayOneShot(squeezeFishSound); flashLightLight.SetActive(false); Animator.SetBool(inElevatorAnimation, false); Animator.SetBool(ridingBruceAnimation, false); } private void HandleStateActiveChange() { ((Behaviour)Agent).enabled = true; } private void HandleStateFollowingPlayerChange() { GalVoice.PlayOneShot(GreetOwnerSound); } private void HandleStateDancingChange() { } private void HandleStateAttackModeChange() { GalVoice.PlayOneShot(spotEnemySound); } public override void OnUseEntranceTeleport(bool setOutside) { base.OnUseEntranceTeleport(setOutside); CullFactorySoftCompat.TryRefreshDynamicLight(light); } public static IEnumerator DoCustomPassThing(ParticleSystem particleSystem, CustomPassManager.CustomPassType customPassType, float scanRange) { CustomPass val = CustomPassManager.Instance.EnableCustomPass(customPassType); SeeThroughCustomPass customPass = val as SeeThroughCustomPass; if (customPass != null) { customPass.maxVisibilityDistance = 0f; yield return (object)new WaitWhile((Func)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) float time = particleSystem.time; MainModule main = particleSystem.main; MinMaxCurve val2 = ((MainModule)(ref main)).startLifetime; float num = time / ((MinMaxCurve)(ref val2)).constant; SeeThroughCustomPass seeThroughCustomPass = customPass; SizeOverLifetimeModule sizeOverLifetime = particleSystem.sizeOverLifetime; val2 = ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size; seeThroughCustomPass.maxVisibilityDistance = ((MinMaxCurve)(ref val2)).Evaluate(num) * 300f; return customPass.maxVisibilityDistance < scanRange; }); yield return (object)new WaitForSeconds(5f); yield return (object)new WaitWhile((Func)delegate { customPass.maxVisibilityDistance -= Time.deltaTime * scanRange / 3f; return customPass.maxVisibilityDistance > 0f; }); CustomPassManager.Instance.RemoveCustomPass(customPassType); } } } public class ShockwaveCharger : Charger { } public class ShockwaveFaceController : MonoBehaviour { public enum RobotMode { Normal, Combat } public ShockwaveGalAI ShockwaveGalAI = null; private SkinnedMeshRenderer FaceSkinnedMeshRenderer = null; private Renderer FaceRenderer = null; public float GlitchDuration = 0.1f; public float GlitchFrequency = 2f; private float glitchTimer; private Coroutine? glitchCoroutine = null; private Coroutine? modeCoroutine = null; private Random controllerRandom = new Random(); [SerializeField] private RobotMode currentMode = RobotMode.Normal; private readonly Color greenColor = new Color(0f, 0.671f, 0.027f); private readonly Color lightGreenColor = new Color(0.5f, 1f, 0.5f); private readonly Color redColor = new Color(0.859f, 0.016f, 0f); private readonly Color lightRedColor = new Color(1f, 0.5f, 0.5f); private Material[] originalMaterials; public void OnEnable() { controllerRandom = new Random(StartOfRound.Instance.randomMapSeed + 32); FaceSkinnedMeshRenderer = ShockwaveGalAI.FaceSkinnedMeshRenderer; FaceRenderer = ShockwaveGalAI.FaceRenderer; glitchTimer = RandomExtensions.NextFloat(controllerRandom, 1f / GlitchFrequency, 3f / GlitchFrequency); SetFaceState(ShockwaveGalAI.galEmotion, 100f); SetMode(currentMode); originalMaterials = FaceRenderer.sharedMaterials; } private void Update() { GlitchUpdate(); } private void GlitchUpdate() { glitchTimer -= Time.deltaTime; if (glitchTimer <= 0f) { if (glitchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(glitchCoroutine); } glitchCoroutine = ((MonoBehaviour)this).StartCoroutine(GlitchEffect()); glitchTimer = RandomExtensions.NextFloat(controllerRandom, 1f / GlitchFrequency, 3f / GlitchFrequency); } } private IEnumerator GlitchEffect() { FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)ShockwaveGalAI.galEmotion, 0f); int glitchShapeKeyIndex = controllerRandom.Next(FaceSkinnedMeshRenderer.sharedMesh.blendShapeCount); float glitchWeight = RandomExtensions.NextFloat(controllerRandom, 0f, 100f); FaceSkinnedMeshRenderer.SetBlendShapeWeight(glitchShapeKeyIndex, glitchWeight); yield return (object)new WaitForSeconds(GlitchDuration); FaceSkinnedMeshRenderer.SetBlendShapeWeight(glitchShapeKeyIndex, 0f); FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)ShockwaveGalAI.galEmotion, 100f); glitchCoroutine = null; } public void SetFaceState(ShockwaveGalAI.Emotion faceState, float weight) { if (glitchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(glitchCoroutine); glitchCoroutine = null; } ResetFace(); ShockwaveGalAI.galEmotion = faceState; FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)faceState, Mathf.Clamp(weight, 0f, 100f)); } public void SetMode(RobotMode mode) { if (modeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(modeCoroutine); modeCoroutine = null; } modeCoroutine = ((MonoBehaviour)this).StartCoroutine(BlinkModeTransition(mode)); } private IEnumerator BlinkModeTransition(RobotMode mode) { int blinkCount = 4; float blinkDuration = 0.2f; for (int i = 0; i < blinkCount; i++) { Color blinkEmissionColor = ((i % 2 == 0) ? greenColor : redColor); Color blinkFaceColor = ((i % 2 == 0) ? lightGreenColor : lightRedColor); ApplyEmissionColor(blinkEmissionColor); ApplyFaceColor(blinkFaceColor); yield return (object)new WaitForSeconds(blinkDuration); } currentMode = mode; Color finalEmissionColor = ((mode == RobotMode.Combat) ? redColor : greenColor); Color finalFaceColor = ((mode == RobotMode.Combat) ? lightRedColor : lightGreenColor); ApplyEmissionColor(finalEmissionColor); ApplyFaceColor(finalFaceColor); modeCoroutine = null; } private void ApplyEmissionColor(Color emissionColor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Material[] sharedMaterials = FaceRenderer.sharedMaterials; sharedMaterials[0].SetColor("_EmissiveColor", emissionColor); sharedMaterials[2].SetColor("_EmissiveColor", emissionColor); FaceRenderer.SetMaterials(sharedMaterials.ToList()); } private void ApplyFaceColor(Color faceColor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Material[] sharedMaterials = ((Renderer)FaceSkinnedMeshRenderer).sharedMaterials; sharedMaterials[0].SetColor("_EmissiveColor", faceColor); ((Renderer)FaceSkinnedMeshRenderer).SetMaterials(sharedMaterials.ToList()); } public void ResetFace() { foreach (ShockwaveGalAI.Emotion value in Enum.GetValues(typeof(ShockwaveGalAI.Emotion))) { FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)value, 0f); } } private void OnDisable() { FaceSkinnedMeshRenderer.SetBlendShapeWeight(3, 0f); FaceRenderer.SetMaterials(originalMaterials.ToList()); } } public class ShockwaveGalAI : GalAI { public enum State { Inactive, Active, FollowingPlayer, DeliveringItems, Dancing, AttackMode } public enum Emotion { Heart, ClosedEye, OpenEye, Happy } public ShockwaveFaceController RobotFaceController = null; public SkinnedMeshRenderer FaceSkinnedMeshRenderer = null; public Renderer FaceRenderer = null; public InteractTrigger HeadPatTrigger = null; public InteractTrigger ChestTrigger = null; public List GiveItemTrigger = new List(); public List itemsHeldTransforms = new List(); public AnimationClip CatPoseAnim = null; [NonSerialized] public Emotion galEmotion = Emotion.ClosedEye; public Transform LaserOrigin = null; public AudioSource FlySource = null; public AudioClip PatSound = null; public AudioClip[] TakeDropItemSounds = Array.Empty(); private Collider[] cachedColliders = (Collider[])(object)new Collider[5]; private List itemsHeldList = new List(); private bool flying = false; private int maxItemsToHold = 4; private State galState = State.Inactive; private bool catPosing = false; private bool backFlipping = false; private Coroutine? headPatCoroutine = null; private static readonly int backFlipAnimation = Animator.StringToHash("startFlip"); private static readonly int catAnimation = Animator.StringToHash("startCat"); private static readonly int holdingItemAnimation = Animator.StringToHash("holdingItem"); private static readonly int attackModeAnimation = Animator.StringToHash("attackMode"); private static readonly int startAttackAnimation = Animator.StringToHash("startAttack"); private static readonly int danceAnimation = Animator.StringToHash("dancing"); private static readonly int activatedAnimation = Animator.StringToHash("activated"); private static readonly int pettingAnimation = Animator.StringToHash("startPet"); private static readonly int runSpeedFloat = Animator.StringToHash("RunSpeed"); private void StartUpDelay() { List list = new List(); foreach (Charger instance in Charger.Instances) { if (instance is ShockwaveCharger item) { list.Add(item); } } if (list.Count <= 0) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } Plugin.Logger.LogError((object)"ShockwaveCharger not found in scene. ShockwaveGalAI will not be functional."); return; } ShockwaveCharger shockwaveCharger = list.OrderBy((ShockwaveCharger x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position)).First(); shockwaveCharger.GalAI = this; GalCharger = shockwaveCharger; ((UnityEvent)(object)HeadPatTrigger.onInteract).AddListener((UnityAction)OnHeadInteract); ((UnityEvent)(object)ChestTrigger.onInteract).AddListener((UnityAction)OnChestInteract); if (Plugin.ModConfig.ConfigShockwaveBotAutomatic.Value) { ((MonoBehaviour)this).StartCoroutine(GalCharger.ActivateGalAfterLand()); } ((UnityEvent)(object)GalCharger.ActivateOrDeactivateTrigger.onInteract).AddListener((UnityAction)GalCharger.OnActivateGal); foreach (InteractTrigger item2 in GiveItemTrigger) { ((UnityEvent)(object)item2.onInteract).AddListener((UnityAction)GrabItemInteract); } ((MonoBehaviour)this).StartCoroutine(CheckForNearbyEnemiesToOwner()); } public override void ActivateGal(PlayerControllerB owner) { base.ActivateGal(owner); int num = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.isPlayerControlled).Count(); if (num == 1 || Plugin.ModConfig.ConfigShockwaveHoldsFourItems.Value) { maxItemsToHold = 4; } else { maxItemsToHold = 2; } ResetToChargerStation(State.Active, Emotion.OpenEye); } private void ResetToChargerStation(State state, Emotion emotion) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (((Behaviour)Agent).enabled) { Agent.Warp(GalCharger.ChargeTransform.position); } else { ((Component)this).transform.position = GalCharger.ChargeTransform.position; } ((Component)this).transform.rotation = GalCharger.ChargeTransform.rotation; HandleStateAnimationSpeedChanges(state, emotion); } } public override void DeactivateGal() { base.DeactivateGal(); ResetToChargerStation(State.Inactive, Emotion.ClosedEye); } private void OnChestInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { DropAllHeldItemsServerRpc(); } } private void OnHeadInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { if ((Random.Range(0f, 1f) < 0.9f || catPosing) && headPatCoroutine == null) { StartPetAnimationServerRpc(); } else if (!catPosing) { StartCatPoseAnimationServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void DropAllHeldItemsServerRpc() { DropAllHeldItemsClientRpc(); } [ClientRpc] private void DropAllHeldItemsClientRpc() { DropAllHeldItems(); } private void DropAllHeldItems() { //IL_0039: 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) int count = itemsHeldList.Count; Plugin.ExtendedLogging($"Items held: {count}"); for (int num = count - 1; num >= 0; num--) { HandleDroppingItem(itemsHeldList[num]); } } [ServerRpc(RequireOwnership = false)] private void StartPetAnimationServerRpc() { NetworkAnimator.SetTrigger(pettingAnimation, true); PlayPatSoundClientRpc(); EnablePhysicsClientRpc(!physicsEnabled); } [ClientRpc] private void PlayPatSoundClientRpc() { headPatCoroutine = ((MonoBehaviour)this).StartCoroutine(SetFaceToHearts()); GalVoice.PlayOneShot(PatSound); } private IEnumerator SetFaceToHearts() { State currentState = galState; RobotFaceController.SetFaceState(Emotion.Heart, 100f); yield return (object)new WaitForSeconds(PatSound.length); if (currentState == galState) { RobotFaceController.SetFaceState(Emotion.OpenEye, 100f); headPatCoroutine = null; } } [ServerRpc(RequireOwnership = false)] private void StartCatPoseAnimationServerRpc() { NetworkAnimator.SetTrigger(catAnimation, true); ((MonoBehaviour)this).StartCoroutine(ResetSpeedBackToNormal()); } private IEnumerator ResetSpeedBackToNormal() { catPosing = true; yield return (object)new WaitForSeconds(CatPoseAnim.length); catPosing = false; } private void InteractTriggersUpdate() { bool flag = !inActive && (Object)(object)ownerPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)ownerPlayer; bool flag2 = galState != State.AttackMode && flag; HeadPatTrigger.interactable = flag; ChestTrigger.interactable = flag2 && itemsHeldList.Count > 0; foreach (InteractTrigger item in GiveItemTrigger) { item.interactable = flag2 && (Object)(object)ownerPlayer != (Object)null && (Object)(object)ownerPlayer.currentlyHeldObjectServer != (Object)null && galState != State.DeliveringItems; } } private void StoppingDistanceUpdate() { Agent.stoppingDistance = ((galState == State.AttackMode) ? 6f : 3f); } private void SetIdleDefaultStateForEveryone() { if (!((Object)(object)GalCharger == (Object)null) && (!((NetworkBehaviour)this).IsServer || doneOnce)) { return; } doneOnce = true; Plugin.Logger.LogInfo((object)"Syncing for client"); FlySource.Play(); galRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); chargeCount = Plugin.ModConfig.ConfigShockwaveCharges.Value; maxChargeCount = chargeCount; ((Behaviour)Agent).enabled = false; FlySource.volume = 0f; IEnumerable enumerable = from s in ((AssetBundleLoader)(object)ContentHandler.Instance.ShockwaveBot).GetConfig("Shockwave Bot | Enemy Blacklist").Value.Split(',') select s.Trim(); foreach (string nameEntry in enumerable) { enemyTargetBlacklist.UnionWith(from et in ((Registry)(object)LethalContent.Enemies).Values where et.EnemyType.enemyName.Equals(nameEntry, StringComparison.OrdinalIgnoreCase) select et.EnemyType.enemyName); } StartUpDelay(); } public override void InActiveUpdate() { base.InActiveUpdate(); inActive = galState == State.Inactive; } public override void Update() { //IL_0043: 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) base.Update(); SetIdleDefaultStateForEveryone(); InteractTriggersUpdate(); if (galState == State.Inactive && (Object)(object)GalCharger != (Object)null) { ((Component)this).transform.SetPositionAndRotation(((Component)GalCharger).transform.position, ((Component)GalCharger).transform.rotation); return; } if (flying) { FlySource.volume = Plugin.ModConfig.ConfigShockwaveBotPropellerVolume.Value; } StoppingDistanceUpdate(); if (((NetworkBehaviour)this).IsHost) { HostSideUpdate(); } } private float GetCurrentSpeedMultiplier() { float result = ((galState == State.FollowingPlayer || galState == State.AttackMode) ? 2f : 1f); if ((backFlipping && (Object)(object)targetEnemy == (Object)null) || catPosing) { result = 0f; } return result; } private void HostSideUpdate() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.inShipPhase) { GalCharger.ActivateGirlServerRpc(-1); return; } if (((Behaviour)Agent).enabled) { smartAgentNavigator.AdjustSpeedBasedOnDistance(0f, 40f, 0f, 10f, GetCurrentSpeedMultiplier()); } Animator animator = Animator; int num = runSpeedFloat; Vector3 velocity = Agent.velocity; animator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 3f); switch (galState) { case State.Inactive: break; case State.Active: DoActive(); break; case State.FollowingPlayer: DoFollowingPlayer(); break; case State.DeliveringItems: DoDeliveringItems(); break; case State.Dancing: DoDancing(); break; case State.AttackMode: DoAttackMode(); break; } } public override void OnEnableOrDisableAgent(bool agentEnabled) { base.OnEnableOrDisableAgent(agentEnabled); Animator.SetBool(attackModeAnimation, !agentEnabled); } private void DoActive() { if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); } else { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.OpenEye); } } private void DoFollowingPlayer() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //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_00f0: 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) if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); return; } GoToDestinationResult val = default(GoToDestinationResult); smartAgentNavigator.TryDoPathingToDestination(((Component)ownerPlayer).transform.position, ref val); if ((int)val == 1 || (int)val == 2) { return; } DoStaringAtOwner(ownerPlayer); if (itemsHeldList.Count >= maxItemsToHold) { HandleStateAnimationSpeedChangesServerRpc(3, 2); } else if (boomboxPlaying) { HandleStateAnimationSpeedChanges(State.Dancing, Emotion.Happy); ((MonoBehaviour)this).StartCoroutine(StopDancingDelay()); } else if (!backFlipping && Random.Range(0f, 25000f) <= 2f) { Vector3 velocity = Agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude <= 0.01f && Vector3.Distance(((Component)Agent).transform.position, ((Component)ownerPlayer).transform.position) <= 5f) { DoBackFliplol(); } } } private void DoDeliveringItems() { //IL_0052: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (itemsHeldList.Count == 0) { if ((Object)(object)ownerPlayer != (Object)null) { HandleStateAnimationSpeedChangesServerRpc(2, 2); } else { GalCharger.ActivateGirlServerRpc(-1); } } smartAgentNavigator.DoPathingToDestination(GalCharger.ChargeTransform.position); if (!(Vector3.Distance(((Component)this).transform.position, GalCharger.ChargeTransform.position) <= Agent.stoppingDistance)) { return; } if (Agent.hasPath) { Vector3 velocity = Agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude != 0f) { return; } } DropAllHeldItemsServerRpc(); } private void DoDancing() { if (itemsHeldList.Count >= maxItemsToHold) { HandleStateAnimationSpeedChangesServerRpc(3, 2); } } private void DoAttackMode() { //IL_011a: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead || chargeCount <= 0 || (Object)(object)ownerPlayer == (Object)null) { if ((Object)(object)targetEnemy != (Object)null && targetEnemy.isEnemyDead) { ClearEnemyTargetServerRpc(); } if ((Object)(object)ownerPlayer != (Object)null) { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.OpenEye); } else { GoToChargerAndDeactivate(); } return; } if (!currentlyAttacking) { smartAgentNavigator.DoPathingToDestination(((Component)targetEnemy).transform.position); if (!smartAgentNavigator.CurrentPathIsValid() || (Vector3.Distance(((Component)this).transform.position, ((Component)ownerPlayer).transform.position) > 15f && Plugin.ModConfig.ConfigDontTargetFarEnemies.Value)) { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.OpenEye); return; } } if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) <= Agent.stoppingDistance + 5f || currentlyAttacking) { Vector3 position = ((Component)targetEnemy).transform.position; Vector3 val = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0f; if (normalized != Vector3.zero) { Quaternion val2 = Quaternion.LookRotation(normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 5f); } if (!currentlyAttacking) { currentlyAttacking = true; NetworkAnimator.SetTrigger(startAttackAnimation, true); } } } private void DoBackFliplol() { NetworkAnimator.SetTrigger(backFlipAnimation, true); } private IEnumerator StopDancingDelay() { yield return (object)new WaitUntil((Func)(() => !boomboxPlaying || galState != State.Dancing)); if (galState == State.Dancing) { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.OpenEye); } } private IEnumerator CheckForNearbyEnemiesToOwner() { if (!((NetworkBehaviour)this).IsServer) { yield break; } WaitForSeconds delay = new WaitForSeconds(1f); EnemyAI enemy = default(EnemyAI); EnemyAI enemy2 = default(EnemyAI); RaycastHit hit = default(RaycastHit); while (true) { yield return delay; if (galState != State.FollowingPlayer || (Object)(object)ownerPlayer == (Object)null || !((Behaviour)Agent).enabled || chargeCount <= 0 || (!smartAgentNavigator.IsAgentOutside() && !ownerPlayer.isInsideFactory) || (smartAgentNavigator.IsAgentOutside() && ownerPlayer.isInsideFactory)) { continue; } int numHits = Physics.OverlapSphereNonAlloc(((Component)ownerPlayer.gameplayCamera).transform.position, 15f, cachedColliders, MoreLayerMasks.EnemiesMask, (QueryTriggerInteraction)2); for (int i = 0; i < numHits; i++) { Collider collider = cachedColliders[i]; if (!((Component)collider).gameObject.activeSelf) { continue; } if (!((Component)collider).TryGetComponent(ref enemy) && (Object)(object)((Component)collider).GetComponent() == (Object)null) { NetworkObject networkObject = ((Component)collider).GetComponentInParent(); if ((Object)(object)networkObject == (Object)null || !((Component)networkObject).TryGetComponent(ref enemy2)) { continue; } enemy = enemy2; enemy2 = null; } if ((Object)(object)enemy == (Object)null || enemy.isEnemyDead || !enemy.enemyType.canDie || enemyTargetBlacklist.Contains(enemy.enemyType.enemyName) || !Physics.Linecast(((Component)ownerPlayer.gameplayCamera).transform.position, ((Component)collider).transform.position, ref hit, MoreLayerMasks.CollidersAndRoomMaskAndDefaultAndEnemies, (QueryTriggerInteraction)2) || ((Object)(object)((Component)((RaycastHit)(ref hit)).collider).gameObject != (Object)(object)((Component)enemy).gameObject && !((Component)((RaycastHit)(ref hit)).collider).transform.IsChildOf(((Component)enemy).transform))) { continue; } SetEnemyTargetServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)enemy)); HandleStateAnimationSpeedChanges(State.AttackMode, Emotion.OpenEye); break; } } } private void CheckIfEnemyIsHitAnimEvent() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetEnemy == (Object)null) && !targetEnemy.isEnemyDead && ((NetworkBehaviour)this).IsServer) { GameObject laserShockBlast = ContentHandler.Instance.ShockwaveBot.LaserShockBlast; GameObject val = Object.Instantiate(laserShockBlast, LaserOrigin.position, LaserOrigin.rotation); LaserShockBlast component = val.GetComponent(); component.shockwaveGal = this; component.laserOrigin = LaserOrigin; ((NetworkBehaviour)component).NetworkObject.Spawn(false); } } private void EndAttackAnimEvent() { currentlyAttacking = false; chargeCount--; if (chargeCount <= 0 && (Object)(object)ownerPlayer != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(ownerPlayer)) { HUDManager.Instance.DisplayTip("WARNING", "DELILAH ATTACK CHARGES EXHAUSTED", true, false, "LC_Tip1"); } } private void PlayFootstepSoundAnimEvent() { GalSFX.PlayOneShot(FootstepSounds[galRandom.Next(FootstepSounds.Length)]); } private void StartFlyingAnimEvent() { SetFlying(flying: true); ((MonoBehaviour)this).StartCoroutine(FlyAnimationDelay()); } private IEnumerator FlyAnimationDelay() { smartAgentNavigator.DisableMovement(true); yield return (object)new WaitForSeconds(0.5f); smartAgentNavigator.DisableMovement(false); } private void StopFlyingAnimEvent() { SetFlying(flying: false); } private void SetFlying(bool flying) { this.flying = flying; backFlipping = flying; if (flying) { FlySource.volume = Plugin.ModConfig.ConfigShockwaveBotPropellerVolume.Value; } else { FlySource.volume = 0f; } } private void AdjustSpeedOnDistanceOnTargetPosition() { float remainingDistance = Agent.remainingDistance; float num = 0f; float num2 = 40f; float num3 = 0f; float num4 = ((galState == State.FollowingPlayer || galState == State.AttackMode) ? 20f : 10f); float num5 = Mathf.Clamp(remainingDistance, num, num2); float num6 = (num5 - num) / (num2 - num); float speed = Mathf.Lerp(num3, num4, num6); if ((backFlipping && (Object)(object)targetEnemy == (Object)null) || catPosing) { speed = 0f; } Agent.speed = speed; } [ServerRpc(RequireOwnership = false)] private void HandleStateAnimationSpeedChangesServerRpc(int state, int emotion) { HandleStateAnimationSpeedChanges((State)state, (Emotion)emotion); } private void HandleStateAnimationSpeedChanges(State state, Emotion emotion) { SwitchStateOrEmotionClientRpc((int)state, (int)emotion); switch (state) { case State.Inactive: SetAnimatorBools(holding: false, attack: false, dance: false, activated: false); break; case State.Active: case State.FollowingPlayer: SetAnimatorBools(holding: false, attack: false, dance: false, activated: true); break; case State.DeliveringItems: SetAnimatorBools(holding: true, attack: false, dance: false, activated: true); break; case State.Dancing: SetAnimatorBools(holding: false, attack: false, dance: true, activated: true); break; case State.AttackMode: SetAnimatorBools(holding: false, attack: true, dance: false, activated: true); break; } } private void SetAnimatorBools(bool holding, bool attack, bool dance, bool activated) { Animator.SetBool(holdingItemAnimation, holding); Animator.SetBool(attackModeAnimation, attack); Animator.SetBool(danceAnimation, dance); Animator.SetBool(activatedAnimation, activated); } [ServerRpc(RequireOwnership = false)] private void SwitchStateOrEmotionServerRpc(int state, int emotion) { SwitchStateOrEmotionClientRpc(state, emotion); } [ClientRpc] private void SwitchStateOrEmotionClientRpc(int state, int emotion) { SwitchStateOrEmotion(state, emotion); } private void SwitchStateOrEmotion(int state, int emotion) { if (state != -1) { if (1 == 0) { } ShockwaveFaceController.RobotMode robotMode = state switch { 0 => HandleStateInactiveChange(), 1 => HandleStateActiveChange(), 2 => HandleStateFollowingPlayerChange(), 3 => HandleStateDeliveringItemsChange(), 4 => HandleStateDancingChange(), 5 => HandleStateAttackModeChange(), _ => ShockwaveFaceController.RobotMode.Normal, }; if (1 == 0) { } ShockwaveFaceController.RobotMode mode = robotMode; RobotFaceController.SetMode(mode); galState = (State)state; } if (emotion != -1) { RobotFaceController.SetFaceState((Emotion)emotion, 100f); } } private ShockwaveFaceController.RobotMode HandleStateInactiveChange() { DropAllHeldItems(); ownerPlayer = null; ((Behaviour)Agent).enabled = false; return ShockwaveFaceController.RobotMode.Normal; } private ShockwaveFaceController.RobotMode HandleStateActiveChange() { RobotFaceController.SetFaceState(Emotion.OpenEye, 100f); ((Behaviour)Agent).enabled = true; return ShockwaveFaceController.RobotMode.Normal; } private ShockwaveFaceController.RobotMode HandleStateFollowingPlayerChange() { GalVoice.PlayOneShot(GreetOwnerSound); return ShockwaveFaceController.RobotMode.Normal; } private ShockwaveFaceController.RobotMode HandleStateDeliveringItemsChange() { return ShockwaveFaceController.RobotMode.Normal; } private ShockwaveFaceController.RobotMode HandleStateDancingChange() { return ShockwaveFaceController.RobotMode.Normal; } private ShockwaveFaceController.RobotMode HandleStateAttackModeChange() { DropAllHeldItems(); return ShockwaveFaceController.RobotMode.Combat; } private void GrabItemInteract(PlayerControllerB player) { if (!((Object)(object)player != (Object)(object)ownerPlayer) && !((Object)(object)player.currentlyHeldObjectServer == (Object)null) && itemsHeldList.Count < maxItemsToHold) { GrabItemOwnerHoldingServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player)); } } [ServerRpc(RequireOwnership = false)] private void GrabItemOwnerHoldingServerRpc(int indexOfOwner) { Animator.SetBool(holdingItemAnimation, true); GrabItemOwnerHoldingClientRpc(indexOfOwner); } [ClientRpc] private void GrabItemOwnerHoldingClientRpc(int indexOfOwner) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[indexOfOwner]; ((MonoBehaviour)this).StartCoroutine(HandleGrabbingItem(val.currentlyHeldObjectServer, itemsHeldTransforms[itemsHeldList.Count])); } [ClientRpc] private void HandleGrabbingItemClientRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown ((MonoBehaviour)this).StartCoroutine(HandleGrabbingItem((GrabbableObject)NetworkBehaviourReference.op_Implicit(networkBehaviourReference), itemsHeldTransforms[itemsHeldList.Count])); } private IEnumerator HandleGrabbingItem(GrabbableObject item, Transform heldTransform) { yield return (object)new WaitForSeconds(0.2f); item.isInElevator = false; item.isInShipRoom = false; PlayerControllerB playerHeldBy = item.playerHeldBy; if (playerHeldBy != null) { playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } yield return (object)new WaitForSeconds(0.2f); item.grabbable = false; item.isHeldByEnemy = true; item.hasHitGround = false; item.parentObject = heldTransform; item.EnablePhysics(false); itemsHeldList.Add(item); if (((Object)((Component)heldTransform).gameObject).name.EndsWith("L")) { ((Component)item).transform.localRotation = Quaternion.Euler(0f, -100f, 0f); } else { ((Component)item).transform.localRotation = Quaternion.Euler(0f, 100f, 0f); } GalVoice.PlayOneShot(TakeDropItemSounds[galRandom.Next(TakeDropItemSounds.Length)]); HoarderBugAI.grabbableObjectsInMap.Remove(((Component)item).gameObject); } [ClientRpc] private void HandleDroppingItemClientRpc(int itemIndex, Vector3 dropPosition = default(Vector3)) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) HandleDroppingItem(itemsHeldList[itemIndex], dropPosition); } private void HandleDroppingItem(GrabbableObject? item, Vector3 dropPosition = default(Vector3)) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { Plugin.Logger.LogError((object)"Item was null in HandleDroppingItem"); return; } item.parentObject = null; Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)this).transform.position)) { if (itemsHeldList.Count - 1 == 0) { HUDManager.Instance.DisplayTip("Scrap Delivered", "Shockwave Gal has delivered the items given to her to the ship!", false, false, "LC_Tip1"); } Plugin.ExtendedLogging($"Dropping item in ship room: {item}"); item.isInShipRoom = true; item.isInElevator = true; ((Component)item).transform.SetParent(GameNetworkManager.Instance.localPlayerController.playersManager.elevatorTransform, true); item.EnablePhysics(true); item.EnableItemMeshes(true); ((Component)item).transform.localScale = item.originalScale; item.isHeld = false; item.isPocketed = false; item.fallTime = 0f; item.startFallingPosition = ((Component)item).transform.parent.InverseTransformPoint(((Component)item).transform.position); Vector3 itemFloorPosition = item.GetItemFloorPosition(default(Vector3)); item.targetFloorPosition = GameNetworkManager.Instance.localPlayerController.playersManager.elevatorTransform.InverseTransformPoint(itemFloorPosition); item.floorYRot = -1; item.grabbable = true; item.isHeldByEnemy = false; ((Component)item).transform.rotation = Quaternion.Euler(item.itemProperties.restingRotation); } else { item.isInShipRoom = false; item.isInElevator = false; item.EnablePhysics(true); item.fallTime = 0f; item.startFallingPosition = ((Component)item).transform.parent.InverseTransformPoint(((Component)item).transform.position); item.targetFloorPosition = ((Component)item).transform.parent.InverseTransformPoint(item.GetItemFloorPosition(default(Vector3))); item.floorYRot = -1; item.DiscardItemFromEnemy(); item.grabbable = true; item.isHeldByEnemy = false; ((Component)item).transform.rotation = Quaternion.Euler(item.itemProperties.restingRotation); ((Component)item).transform.SetParent(StartOfRound.Instance.propsContainer, true); } itemsHeldList.Remove(item); GalVoice.PlayOneShot(TakeDropItemSounds[galRandom.Next(TakeDropItemSounds.Length)]); if (itemsHeldList.Count == 0 && ((NetworkBehaviour)this).IsServer) { Animator.SetBool(holdingItemAnimation, false); } } public override void OnUseEntranceTeleport(bool setOutside) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.OnUseEntranceTeleport(setOutside); for (int i = 0; i < itemsHeldList.Count; i++) { itemsHeldList[i].isInFactory = setOutside; ((Component)itemsHeldList[i]).transform.position = itemsHeldTransforms[i].position; ((MonoBehaviour)this).StartCoroutine(SetItemPhysics(itemsHeldList[i])); } } private IEnumerator SetItemPhysics(GrabbableObject grabbableObject) { yield return (object)new WaitForSeconds(0.1f); grabbableObject.EnablePhysics(false); } } public class ShrimpDispenser : NetworkBehaviour { public AudioSource audioSource = null; public AudioClip dispenseSound = null; public AudioClip buttonSound = null; public Transform dispenseTransform = null; public InteractTrigger dispenserTrigger = null; private ScaryShrimp? lastShrimpDispensed = null; private bool currentlyDispensing = false; private Item itemToSpawn = null; private Random shrimpRandom = new Random(); private bool ItemPickedUp => (Object)(object)lastShrimpDispensed != (Object)null && Vector3.Distance(dispenseTransform.position, ((Component)lastShrimpDispensed).transform.position) >= 1.5f; public void Start() { shrimpRandom = new Random(StartOfRound.Instance.randomMapSeed); itemToSpawn = ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.BlueShrimp].Item; ((UnityEvent)(object)dispenserTrigger.onInteract).AddListener((UnityAction)OnDispenserInteract); } private void OnDispenserInteract(PlayerControllerB playerInteracting) { PlayButtonSoundServerRpc(); if (!currentlyDispensing) { currentlyDispensing = true; PlayDispenserAnimationServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PlayButtonSoundServerRpc() { PlayButtonSoundClientRpc(); } [ClientRpc] private void PlayButtonSoundClientRpc() { audioSource.PlayOneShot(buttonSound, 1f); } [ServerRpc(RequireOwnership = false)] private void PlayDispenserAnimationServerRpc() { PlayDispenserAnimationClientRpc(); } [ClientRpc] private void PlayDispenserAnimationClientRpc() { ((MonoBehaviour)this).StartCoroutine(PlayDispenserAnimation()); } private IEnumerator PlayDispenserAnimation() { currentlyDispensing = true; if (shrimpRandom.Next(10) <= 0 || Plugin.ModConfig.ConfigDebugMode.Value) { audioSource.PlayOneShot(dispenseSound); } yield return (object)new WaitForSeconds(0.6f); if ((Object)(object)lastShrimpDispensed != (Object)null && !ItemPickedUp) { ((GrabbableObject)lastShrimpDispensed).grabbable = false; } yield return (object)new WaitForSeconds(0.4f); Plugin.ExtendedLogging($"Current y rotation {((Component)this).transform.rotation.y} for this gameobject: {((Object)((Component)this).gameObject).name}"); ref Vector3 restingRotation = ref itemToSpawn.restingRotation; Quaternion rotation = ((Component)this).transform.rotation; restingRotation.y = ((Quaternion)(ref rotation)).eulerAngles.y + 180f; Plugin.ExtendedLogging($"Spawning {itemToSpawn} at {dispenseTransform.position} with y rotation {itemToSpawn.restingRotation.y}"); if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)lastShrimpDispensed != (Object)null && !ItemPickedUp) { if (((GrabbableObject)lastShrimpDispensed).isHeld && (Object)(object)((GrabbableObject)lastShrimpDispensed).playerHeldBy != (Object)null) { if (!((GrabbableObject)lastShrimpDispensed).grabbable) { ((GrabbableObject)lastShrimpDispensed).grabbable = true; } } else if (((NetworkBehaviour)lastShrimpDispensed).IsSpawned) { ((NetworkBehaviour)lastShrimpDispensed).NetworkObject.Despawn(true); } } CodeRebirthUtils instance = CodeRebirthUtils.Instance; Item item = itemToSpawn; Vector3 position = dispenseTransform.position; rotation = default(Quaternion); NetworkObjectReference shrimp = instance.SpawnScrap(item, position, isQuest: false, defaultRotation: true, 0, rotation); SetParentObjectServerRpc(shrimp); } currentlyDispensing = false; } [ServerRpc(RequireOwnership = false)] private void SetParentObjectServerRpc(NetworkObjectReference shrimp) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetParentObjectClientRpc(shrimp); } [ClientRpc] private void SetParentObjectClientRpc(NetworkObjectReference shrimp) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) lastShrimpDispensed = NetworkObjectReference.op_Implicit(shrimp).GetComponent(); ((GrabbableObject)lastShrimpDispensed).parentObject = dispenseTransform; } } public class TerminalCharger : Charger { public Animator animator = null; public static readonly int isOpenedAnimation = Animator.StringToHash("isOpen"); } public class TerminalFaceController : MonoBehaviour { public TerminalGalAI TerminalGalAI = null; private SkinnedMeshRenderer FaceSkinnedMeshRenderer = null; [HideInInspector] public float glitchTimer; [HideInInspector] public Coroutine? TemporarySwitchCoroutine = null; [HideInInspector] public Random controllerRandom = new Random(); public void OnEnable() { controllerRandom = new Random(StartOfRound.Instance.randomMapSeed + 32); FaceSkinnedMeshRenderer = TerminalGalAI.FaceSkinnedMeshRenderer; SetFaceState(TerminalGalAI.galEmotion, 100f); } private void Update() { GlitchUpdate(); } private void GlitchUpdate() { glitchTimer -= Time.deltaTime; if (glitchTimer <= 0f) { if (TemporarySwitchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(TemporarySwitchCoroutine); } TemporarySwitchCoroutine = ((MonoBehaviour)this).StartCoroutine(TemporarySwitchEffect(3)); glitchTimer = RandomExtensions.NextFloat(controllerRandom, 4f, 8f); } } public IEnumerator TemporarySwitchEffect(int shapeKeyIndex) { SetFaceState((TerminalGalAI.Emotion)shapeKeyIndex, 100f); float Duration = RandomExtensions.NextFloat(controllerRandom, 0.5f, 1f); yield return (object)new WaitForSeconds(Duration); SetFaceState(TerminalGalAI.galEmotion, 100f); TemporarySwitchCoroutine = null; } public void SetFaceState(TerminalGalAI.Emotion faceState, float weight) { ResetFace(); Plugin.ExtendedLogging($"{TerminalGalAI} setting face state to: {faceState}"); if (faceState != CodeRebirth.src.Content.Unlockables.TerminalGalAI.Emotion.Winky && faceState != CodeRebirth.src.Content.Unlockables.TerminalGalAI.Emotion.Angy && faceState != CodeRebirth.src.Content.Unlockables.TerminalGalAI.Emotion.Flustered) { TerminalGalAI.galEmotion = faceState; } if (faceState != CodeRebirth.src.Content.Unlockables.TerminalGalAI.Emotion.Basis) { FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)faceState, Mathf.Clamp(weight, 0f, 100f)); } } public void ResetFace() { foreach (TerminalGalAI.Emotion value in Enum.GetValues(typeof(TerminalGalAI.Emotion))) { if (value != CodeRebirth.src.Content.Unlockables.TerminalGalAI.Emotion.Basis) { FaceSkinnedMeshRenderer.SetBlendShapeWeight((int)value, 0f); } } } } public class TerminalGalAI : GalAI { public enum State { Inactive, Active, FollowingPlayer, Dancing, UnlockingObjects } public enum Emotion { Basis = -1, VeryHappy, Mood, Angy, Winky, Crying, Sleeping, Flustered, Love } public SkinnedMeshRenderer FaceSkinnedMeshRenderer = null; public TerrainScanner terrainScanner = null; public GameObject boostersGameObject = null; public InteractTrigger keyboardInteractTrigger = null; public InteractTrigger zapperInteractTrigger = null; public InteractTrigger keyInteractTrigger = null; public InteractTrigger teleporterInteractTrigger = null; public AudioSource FlyingSource = null; public AudioSource FootstepSource = null; public AudioSource specialSource = null; public AudioClip scrapPingSound = null; public AudioClip keyboardPressSound = null; public AudioClip zapperSound = null; public AudioClip keySound = null; public AudioClip teleporterSound = null; public List startOrEndFlyingAudioClips = new List(); public TerminalFaceController terminalFaceController = null; private Collider[] cachedColliders = (Collider[])(object)new Collider[5]; private List customPassRoutines = new List(); private List pointsOfInterest = new List(); private float scrapRevealTimer = 10f; private bool flying = false; private Coroutine? unlockingSomething = null; private Coroutine? zapperRoutine = null; private State galState = State.Inactive; [HideInInspector] public Emotion galEmotion = Emotion.Sleeping; private static readonly int revealScrapAnimation = Animator.StringToHash("revealScrap"); private static readonly int flyingAnimation = Animator.StringToHash("flying"); private static readonly int danceAnimation = Animator.StringToHash("dancing"); private static readonly int activatedAnimation = Animator.StringToHash("activated"); private static readonly int runSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int specialAnimationInt = Animator.StringToHash("specialAnimationInt"); private void StartUpDelay() { List list = new List(); foreach (Charger instance in Charger.Instances) { if (instance is TerminalCharger item) { list.Add(item); } } if (list.Count <= 0) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } Plugin.Logger.LogError((object)"TerminalCharger not found in scene. TerminalGalAI will not be functional."); return; } TerminalCharger terminalCharger = list.OrderBy((TerminalCharger x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position)).First(); terminalCharger.GalAI = this; GalCharger = terminalCharger; if (Plugin.ModConfig.ConfigTerminalBotAutomatic.Value) { ((MonoBehaviour)this).StartCoroutine(GalCharger.ActivateGalAfterLand()); } ((UnityEvent)(object)GalCharger.ActivateOrDeactivateTrigger.onInteract).AddListener((UnityAction)GalCharger.OnActivateGal); ((UnityEvent)(object)keyboardInteractTrigger.onInteract).AddListener((UnityAction)OnKeyboardInteract); ((UnityEvent)(object)keyInteractTrigger.onInteract).AddListener((UnityAction)OnKeyHandInteract); ((UnityEvent)(object)zapperInteractTrigger.onInteract).AddListener((UnityAction)OnZapperInteract); ((UnityEvent)(object)teleporterInteractTrigger.onInteract).AddListener((UnityAction)OnTeleporterInteract); GrabbableObject val = default(GrabbableObject); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if ((Object)(object)items == (Object)null || (Object)(object)items.spawnPrefab == (Object)null || !items.spawnPrefab.TryGetComponent(ref val)) { continue; } if ((Object)(object)val.mainObjectRenderer != (Object)null && ((Component)val.mainObjectRenderer).gameObject.layer == 0) { ((Component)val.mainObjectRenderer).gameObject.layer = 6; continue; } Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Renderer val2 in componentsInChildren) { if (((Component)val2).gameObject.layer == 0) { ((Component)val2).gameObject.layer = 6; } } } } private void OnTeleporterInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { TeleporterInteractServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } } [ServerRpc(RequireOwnership = false)] private void TeleporterInteractServerRpc(int playerIndex) { Animator.SetInteger(specialAnimationInt, 2); TeleporterInteractClientRpc(playerIndex); } [ClientRpc] private void TeleporterInteractClientRpc(int playerIndex) { ((MonoBehaviour)this).StartCoroutine(DelayTeleport(playerIndex)); } private IEnumerator DelayTeleport(int playerIndex) { GalVoice.PlayOneShot(teleporterSound); yield return (object)new WaitForSeconds(teleporterSound.length / 5f); Animator.SetInteger(specialAnimationInt, -1); yield return (object)new WaitForSeconds(teleporterSound.length / 5f * 4f); ResetToChargerStation(galState, galEmotion); CRUtilities.TeleportPlayerToShip(playerIndex, ((Component)GalCharger).transform.position); } private void OnZapperInteract(PlayerControllerB playerInteracting) { if (zapperRoutine == null && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { ZapperInteractServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerInteracting)); } } [ServerRpc(RequireOwnership = false)] private void ZapperInteractServerRpc(int playerIndex) { ZapperInteractClientRpc(playerIndex); } [ClientRpc] private void ZapperInteractClientRpc(int playerIndex) { zapperRoutine = ((MonoBehaviour)this).StartCoroutine(RechargePlayerHeldEquipment(StartOfRound.Instance.allPlayerScripts[playerIndex])); } private IEnumerator RechargePlayerHeldEquipment(PlayerControllerB playerToRecharge) { if (playerToRecharge.isPlayerDead || !playerToRecharge.isPlayerControlled || (Object)(object)playerToRecharge.currentlyHeldObjectServer == (Object)null || !playerToRecharge.currentlyHeldObjectServer.itemProperties.requiresBattery) { if (PlayerControllerBExtensions.IsLocalPlayer(playerToRecharge)) { HUDManager.Instance.DisplayTip("Error", "What you're holding cannot be charged", false, false, "LC_Tip1"); } yield break; } GalVoice.PlayOneShot(zapperSound); Animator.SetInteger(specialAnimationInt, 1); playerToRecharge.inSpecialInteractAnimation = true; yield return (object)new WaitForSeconds(0.2f); Animator.SetInteger(specialAnimationInt, -1); while (playerToRecharge.currentlyHeldObjectServer.insertedBattery.charge < 1f) { Battery insertedBattery = playerToRecharge.currentlyHeldObjectServer.insertedBattery; insertedBattery.charge += Time.deltaTime; yield return null; } playerToRecharge.inSpecialInteractAnimation = false; zapperRoutine = null; } private void OnKeyboardInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { KeyboardInteractServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void KeyboardInteractServerRpc() { KeyboardInteractClientRpc(); } [ClientRpc] private void KeyboardInteractClientRpc() { ((MonoBehaviour)this).StartCoroutine(terminalFaceController.TemporarySwitchEffect(6)); GalVoice.PlayOneShot(keyboardPressSound); EnablePhysics(!physicsEnabled); } private void OnKeyHandInteract(PlayerControllerB playerInteracting) { if (PlayerControllerBExtensions.IsLocalPlayer(playerInteracting) && !((Object)(object)playerInteracting != (Object)(object)ownerPlayer)) { KeyHandInteractServerRpc(); } } private bool ObjectIsInteractable(GameObject gameObject) { Plugin.ExtendedLogging("Checking if " + ((Object)gameObject).name + " is interactable"); DoorLock val = default(DoorLock); if (gameObject.TryGetComponent(ref val) && val.isLocked) { return true; } Pickable pickable = default(Pickable); if (gameObject.TryGetComponent(ref pickable) && pickable.IsLocked) { return true; } return false; } [ServerRpc(RequireOwnership = false)] private void KeyHandInteractServerRpc() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 7.5f, cachedColliders, MoreLayerMasks.InteractableMask, (QueryTriggerInteraction)2); HashSet hashSet = new HashSet(); Plugin.ExtendedLogging($"Found {num} interactable objects"); for (int i = 0; i < num; i++) { if ((Object)(object)cachedColliders[i] == (Object)null) { continue; } GameObject gameObject = ((Component)cachedColliders[i]).gameObject; if (ObjectIsInteractable(gameObject)) { NavMesh.CalculatePath(((Component)this).transform.position, gameObject.transform.position, -1, smartAgentNavigator.agent.path); if (DoCalculatePathDistance(smartAgentNavigator.agent.path) <= 20f) { hashSet.Add(gameObject); } } } pointsOfInterest = hashSet.ToList(); HandleStateAnimationSpeedChanges(State.UnlockingObjects, Emotion.Basis); } public float DoCalculatePathDistance(NavMeshPath path) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if ((int)path.status != 2 && path.corners.Length >= 1) { for (int i = 1; i < path.corners.Length; i++) { num += Vector3.Distance(path.corners[i - 1], path.corners[i]); } } Plugin.ExtendedLogging($"Path distance: {num}"); return num; } public override void ActivateGal(PlayerControllerB owner) { base.ActivateGal(owner); ResetToChargerStation(State.Active, Emotion.Basis); if (GalCharger is TerminalCharger terminalCharger) { terminalCharger.animator.SetBool(TerminalCharger.isOpenedAnimation, true); } } private void ResetToChargerStation(State state, Emotion emotion) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (((Behaviour)Agent).enabled) { Agent.Warp(GalCharger.ChargeTransform.position); } ((Component)this).transform.SetPositionAndRotation(GalCharger.ChargeTransform.position, GalCharger.ChargeTransform.rotation); HandleStateAnimationSpeedChangesServerRpc((int)state, (int)emotion); } } public override void DeactivateGal() { base.DeactivateGal(); ResetToChargerStation(State.Inactive, Emotion.Sleeping); if (GalCharger is TerminalCharger terminalCharger) { terminalCharger.animator.SetBool(TerminalCharger.isOpenedAnimation, false); } } private void InteractTriggersUpdate() { bool flag = !inActive && (Object)(object)ownerPlayer != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)ownerPlayer; bool interactable = galState != State.UnlockingObjects && flag; keyboardInteractTrigger.interactable = flag; keyInteractTrigger.interactable = interactable; zapperInteractTrigger.interactable = interactable; teleporterInteractTrigger.interactable = interactable; } private void StoppingDistanceUpdate() { Agent.stoppingDistance = 3f * ((galState == State.UnlockingObjects) ? 0.5f : 1f); } private void SetIdleDefaultStateForEveryone() { if ((Object)(object)GalCharger == (Object)null || (((NetworkBehaviour)this).IsServer && !doneOnce)) { doneOnce = true; Plugin.Logger.LogInfo((object)"Syncing for client"); galRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); chargeCount = 0; maxChargeCount = chargeCount; ((Behaviour)Agent).enabled = false; StartUpDelay(); } } public override void InActiveUpdate() { base.InActiveUpdate(); inActive = galState == State.Inactive; } public override void Update() { base.Update(); SetIdleDefaultStateForEveryone(); InteractTriggersUpdate(); if (inActive) { FootstepSource.volume = 0f; return; } StoppingDistanceUpdate(); if (Animator.GetFloat(runSpeedFloat) > 0.01f) { FootstepSource.volume = 1f; } else { FootstepSource.volume = 0f; } if (galRandom.Next(500000) <= 3) { specialSource.volume = ((AssetBundleLoader)(object)ContentHandler.Instance.TerminalBot).GetConfig("Terminal Gal | Special Song Volume").Value; specialSource.Stop(); specialSource.Play(); } if (((NetworkBehaviour)this).IsHost) { HostSideUpdate(); } } private float GetCurrentSpeedMultiplier() { return 1.3f; } private void HostSideUpdate() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.inShipPhase) { GalCharger.ActivateGirlServerRpc(-1); return; } if (((Behaviour)Agent).enabled) { smartAgentNavigator.AdjustSpeedBasedOnDistance(0f, 40f, 0f, 10f, GetCurrentSpeedMultiplier()); } Animator animator = Animator; int num = runSpeedFloat; Vector3 velocity = Agent.velocity; animator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 2f); switch (galState) { case State.Inactive: break; case State.Active: DoActive(); break; case State.FollowingPlayer: DoFollowingPlayer(); break; case State.Dancing: DoDancing(); break; case State.UnlockingObjects: DoUnlockingObjects(); break; } } public override void OnEnableOrDisableAgent(bool agentEnabled) { base.OnEnableOrDisableAgent(agentEnabled); Animator.SetBool(flyingAnimation, !agentEnabled); } private void DoActive() { if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); } else { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.Basis); } } private void DoFollowingPlayer() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if ((Object)(object)ownerPlayer == (Object)null) { GoToChargerAndDeactivate(); return; } GoToDestinationResult val = default(GoToDestinationResult); smartAgentNavigator.TryDoPathingToDestination(((Component)ownerPlayer).transform.position, ref val); if ((int)val != 1 && (int)val != 2) { DoStaringAtOwner(ownerPlayer); DoRevealingScrap(); if (!DoDancingAction()) { } } } private void DoDancing() { } private void DoUnlockingObjects() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (pointsOfInterest.Count() <= 0) { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.Basis); } else if (unlockingSomething == null) { smartAgentNavigator.DoPathingToDestination(pointsOfInterest.First().transform.position); if (((Behaviour)Agent).enabled && Agent.remainingDistance <= Agent.stoppingDistance) { unlockingSomething = ((MonoBehaviour)this).StartCoroutine(DoUnlockingObjectsRoutine(pointsOfInterest.First())); } } } private IEnumerator DoUnlockingObjectsRoutine(GameObject pointOfInterest) { Animator.SetInteger(specialAnimationInt, 0); yield return (object)new WaitForSeconds(0.5f); Animator.SetInteger(specialAnimationInt, -1); yield return (object)new WaitForSeconds(2.5f); Pickable pickable = default(Pickable); DoorLock doorLock = default(DoorLock); if (pointOfInterest.TryGetComponent(ref pickable)) { pickable.Unlock(); } else if (pointOfInterest.TryGetComponent(ref doorLock)) { doorLock.UnlockDoorClientRpc(); } pointsOfInterest.Remove(pointOfInterest); unlockingSomething = null; } private void PlayKeySoundAnimEvent() { GalVoice.PlayOneShot(keySound); } private void DoRevealingScrap() { scrapRevealTimer -= Time.deltaTime; if (scrapRevealTimer <= 0f) { NetworkAnimator.SetTrigger(revealScrapAnimation, true); scrapRevealTimer = Random.Range(Plugin.ModConfig.ConfigTerminalScanFrequency.Value - 5f, Plugin.ModConfig.ConfigTerminalScanFrequency.Value + 5f); } } private void DoScrapActionsAnimEvent() { GalVoice.PlayOneShot(scrapPingSound); if (Plugin.ModConfig.ConfigOnlyOwnerSeesScanEffectsTerminalGal.Value && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)ownerPlayer) { return; } ParticleSystem val = DoTerrainScan(); ((Component)((Component)val).gameObject.transform.parent).gameObject.SetActive(true); if (customPassRoutines.Count <= 0) { customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughItems))); return; } foreach (Coroutine customPassRoutine in customPassRoutines) { ((MonoBehaviour)this).StopCoroutine(customPassRoutine); } customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughItems))); } private ParticleSystem DoTerrainScan() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return terrainScanner.SpawnTerrainScanner(((Component)this).transform.position); } private bool DoDancingAction() { if (boomboxPlaying) { HandleStateAnimationSpeedChanges(State.Dancing, Emotion.VeryHappy); ((MonoBehaviour)this).StartCoroutine(StopDancingDelay()); return true; } return false; } private IEnumerator StopDancingDelay() { yield return (object)new WaitUntil((Func)(() => !boomboxPlaying || galState != State.Dancing)); if (galState == State.Dancing) { HandleStateAnimationSpeedChanges(State.FollowingPlayer, Emotion.Basis); } } private void StartFlyingAnimEvent() { SetFlying(Flying: true); ((MonoBehaviour)this).StartCoroutine(FlyAnimationDelay()); } private IEnumerator FlyAnimationDelay() { smartAgentNavigator.DisableMovement(true); yield return (object)new WaitForSeconds(1.5f); smartAgentNavigator.DisableMovement(false); } private void StopFlyingAnimEvent() { SetFlying(Flying: false); } private void SetFlying(bool Flying) { flying = Flying; if (Flying) { GalSFX.PlayOneShot(startOrEndFlyingAudioClips[0]); boostersGameObject.SetActive(true); FlyingSource.volume = Plugin.ModConfig.ConfigTerminalBotFlyingVolume.Value; } else { boostersGameObject.SetActive(false); GalSFX.PlayOneShot(startOrEndFlyingAudioClips[1]); FlyingSource.volume = 0f; } } [ServerRpc(RequireOwnership = false)] private void HandleStateAnimationSpeedChangesServerRpc(int state, int emotion) { HandleStateAnimationSpeedChanges((State)state, (Emotion)emotion); } private void HandleStateAnimationSpeedChanges(State state, Emotion emotion) { SwitchStateClientRpc((int)state, (int)emotion); switch (state) { case State.Inactive: SetAnimatorBools(dance: false, activated: false); break; case State.Active: SetAnimatorBools(dance: false, activated: true); break; case State.FollowingPlayer: SetAnimatorBools(dance: false, activated: true); break; case State.Dancing: SetAnimatorBools(dance: true, activated: true); break; } } private void SetAnimatorBools(bool dance, bool activated) { Animator.SetBool(danceAnimation, dance); Animator.SetBool(activatedAnimation, activated); } [ServerRpc(RequireOwnership = false)] private void SwitchStateServerRpc(int state, int emotion) { SwitchStateClientRpc(state, emotion); } [ClientRpc] private void SwitchStateClientRpc(int state, int emotion) { SwitchState(state, emotion); } private void SwitchState(int state, int emotion) { if (state != -1) { switch ((State)state) { case State.Inactive: HandleStateInactiveChange(); break; case State.Active: HandleStateActiveChange(); break; case State.FollowingPlayer: HandleStateFollowingPlayerChange(); break; case State.Dancing: HandleStateDancingChange(); break; case State.UnlockingObjects: HandleStateUnlockingObjectsChange(); break; } galState = (State)state; } Plugin.ExtendedLogging($"Switching emotion to {(Emotion)emotion}"); terminalFaceController.SetFaceState((Emotion)emotion, 100f); } private void HandleStateInactiveChange() { ownerPlayer = null; ((Behaviour)Agent).enabled = false; Animator.SetBool(flyingAnimation, false); } private void HandleStateActiveChange() { ((Behaviour)Agent).enabled = true; } private void HandleStateFollowingPlayerChange() { GalVoice.PlayOneShot(GreetOwnerSound); } private void HandleStateDancingChange() { } private void HandleStateUnlockingObjectsChange() { } public override void OnUseEntranceTeleport(bool setOutside) { base.OnUseEntranceTeleport(setOutside); } public IEnumerator DoCustomPassThing(ParticleSystem particleSystem, CustomPassManager.CustomPassType customPassType) { CustomPass val = CustomPassManager.Instance.EnableCustomPass(customPassType); SeeThroughCustomPass customPass = val as SeeThroughCustomPass; if (customPass != null) { customPass.maxVisibilityDistance = 0f; yield return (object)new WaitWhile((Func)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) float time = particleSystem.time; MainModule main = particleSystem.main; MinMaxCurve val2 = ((MainModule)(ref main)).startLifetime; float num = time / ((MinMaxCurve)(ref val2)).constant; SeeThroughCustomPass seeThroughCustomPass = customPass; SizeOverLifetimeModule sizeOverLifetime = particleSystem.sizeOverLifetime; val2 = ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size; seeThroughCustomPass.maxVisibilityDistance = ((MinMaxCurve)(ref val2)).Evaluate(num) * 300f; return customPass.maxVisibilityDistance < Plugin.ModConfig.ConfigTerminalScanRange.Value; }); yield return (object)new WaitForSeconds(5f); yield return (object)new WaitWhile((Func)delegate { customPass.maxVisibilityDistance -= Time.deltaTime * Plugin.ModConfig.ConfigTerminalScanRange.Value / 3f; return customPass.maxVisibilityDistance > 0f; }); CustomPassManager.Instance.RemoveCustomPass(customPassType); } } public override bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) base.Hit(force, hitDirection, playerWhoHit, playHitSFX, hitID); DoAngerGalServerRpc(); return true; } [ServerRpc(RequireOwnership = false)] public void DoAngerGalServerRpc() { DoAngerGalClientRpc(); } [ClientRpc] private void DoAngerGalClientRpc() { if (terminalFaceController.TemporarySwitchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(terminalFaceController.TemporarySwitchCoroutine); } terminalFaceController.TemporarySwitchCoroutine = ((MonoBehaviour)this).StartCoroutine(terminalFaceController.TemporarySwitchEffect(2)); terminalFaceController.glitchTimer = RandomExtensions.NextFloat(terminalFaceController.controllerRandom, 4f, 8f); } } public class TerrainScanner : MonoBehaviour { public GameObject TerrainScannerPrefab; public float duration = 10f; public float size = 500f; public ParticleSystem SpawnTerrainScanner(Vector3 spawnPosition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(TerrainScannerPrefab, spawnPosition, Quaternion.identity); Object.Destroy((Object)(object)val, 20f); return ((Component)val.transform.GetChild(0)).GetComponent(); } } } namespace CodeRebirth.src.Content.Skins { public class SkinHandler : ContentHandler { public class CRHalloweenAssets : AssetBundleLoader { public CRHalloweenAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public CRHalloweenAssets? CRHalloween = null; public SkinHandler(DuskMod mod) : base(mod) { } } public class PeaceMyers : MonoBehaviour { private PeaceKeeper peaceKeeper = null; private float originalChasingSpeed = 0f; public void Awake() { peaceKeeper = ((Component)((Component)this).transform.parent).GetComponent(); originalChasingSpeed = peaceKeeper._chasingSpeed; peaceKeeper._walkingSpeed *= 1.5f; ((EnemyAI)peaceKeeper).enemyHP = 9999; } public void Update() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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) if (((EnemyAI)peaceKeeper).isEnemyDead) { return; } peaceKeeper._chasingSpeed = peaceKeeper._walkingSpeed; peaceKeeper._shootingSpeed = peaceKeeper._walkingSpeed; peaceKeeper._damageInterval = 0f; if (peaceKeeper._gunParticleSystemGO.activeSelf) { peaceKeeper._gunParticleSystemGO.SetActive(false); } if (!((Object)(object)((EnemyAI)peaceKeeper).targetPlayer == (Object)null)) { PlayerControllerB targetPlayer = ((EnemyAI)peaceKeeper).targetPlayer; Vector3 forward = ((Component)targetPlayer.gameplayCamera).transform.forward; Vector3 val = ((Component)peaceKeeper).transform.position - ((Component)targetPlayer.gameplayCamera).transform.position; float num = Vector3.Dot(forward, ((Vector3)(ref val)).normalized); if (num <= 0f) { peaceKeeper._shootingSpeed = originalChasingSpeed * 2f; peaceKeeper._chasingSpeed = originalChasingSpeed * 2f; } } } } } namespace CodeRebirth.src.Content.Moons { [ContentOrder(1)] public class MoonHandler : ContentHandler { public class OxydeAssets : AssetBundleLoader { public OxydeAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public OxydeAssets? Oxyde = null; public MoonHandler(DuskMod mod) : base(mod) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (Oxyde != null) { new TerminalTextModifier("Oxyde // Buying at 100%", (IProvider)(object)new SimpleProvider("Oxyde // Buying at 300%")); } } } } namespace CodeRebirth.src.Content.Maps { public class MapObjectHandler : ContentHandler { public class CompactorTobyAssets : AssetBundleLoader { public CompactorTobyAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class ShredderSarahAssets : AssetBundleLoader { public ShredderSarahAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CrateAssets : AssetBundleLoader { public CrateAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class FloraAssets : AssetBundleLoader { [LoadFromBundle("AllFlora.prefab")] public GameObject AllFloraPrefab { get; private set; } = null; public FloraAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BiomeAssets : AssetBundleLoader { public BiomeAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BearTrapAssets : AssetBundleLoader { public BearTrapAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GlowingGemAssets : AssetBundleLoader { public GlowingGemAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class IndustrialFanAssets : AssetBundleLoader { public IndustrialFanAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class FlashTurretAssets : AssetBundleLoader { public FlashTurretAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TeslaShockAssets : AssetBundleLoader { [LoadFromBundle("ChainLightning.prefab")] public GameObject ChainLightningPrefab { get; private set; } = null; public TeslaShockAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class AirControlUnitAssets : AssetBundleLoader { [LoadFromBundle("AirControlUnitProjectile.prefab")] public GameObject ProjectilePrefab { get; private set; } = null; public AirControlUnitAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class FunctionalMicrowaveAssets : AssetBundleLoader { public FunctionalMicrowaveAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MerchantAssets : AssetBundleLoader { [LoadFromBundle("GuardsmanProjectile.prefab")] public GameObject ProjectilePrefab { get; private set; } = null; [LoadFromBundle("CoinUI.prefab")] public GameObject CoinUIPrefab { get; private set; } = null; public MerchantAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GunslingerGregAssets : AssetBundleLoader { [LoadFromBundle("GregMissile.prefab")] public GameObject MissilePrefab { get; private set; } = null; [LoadFromBundle("DebrisExplosionEffect.prefab")] public GameObject OldBirdExplosionPrefab { get; private set; } = null; public GunslingerGregAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class OxydeCrashShipAssets : AssetBundleLoader { public OxydeCrashShipAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class AutonomousCraneAssets : AssetBundleLoader { public AutonomousCraneAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public OxydeCrashShipAssets? OxydeCrashShip = null; public GunslingerGregAssets? GunslingerGreg = null; public CompactorTobyAssets? CompactorToby = null; public ShredderSarahAssets? ShredderSarah = null; public MerchantAssets? Merchant = null; public CrateAssets? Crate = null; public FloraAssets? Flora = null; public BiomeAssets? Biome = null; public BearTrapAssets? BearTrap = null; public GlowingGemAssets? GlowingGem = null; public IndustrialFanAssets? IndustrialFan = null; public FlashTurretAssets? FlashTurret = null; public TeslaShockAssets? TeslaShock = null; public AirControlUnitAssets? AirControlUnit = null; public FunctionalMicrowaveAssets? FunctionalMicrowave = null; public AutonomousCraneAssets? AutonomousCrane = null; public MapObjectHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent("oxydecrashshipassets", ref OxydeCrashShip, false); ((ContentHandler)this).RegisterContent("compactortobyassets", ref CompactorToby, ContentHandler.Instance.Oxyde != null); ((ContentHandler)this).RegisterContent("gunslingergregassets", ref GunslingerGreg, false); ((ContentHandler)this).RegisterContent("shreddersarahassets", ref ShredderSarah, ContentHandler.Instance.Oxyde != null); ((ContentHandler)this).RegisterContent("merchantassets", ref Merchant, false); ((ContentHandler)this).RegisterContent("crateassets", ref Crate, false); ((ContentHandler)this).RegisterContent("aircontrolunitassets", ref AirControlUnit, false); ((ContentHandler)this).RegisterContent("flashturretassets", ref FlashTurret, false); ((ContentHandler)this).RegisterContent("beartrapassets", ref BearTrap, false); ((ContentHandler)this).RegisterContent("functionalmicrowaveassets", ref FunctionalMicrowave, false); ((ContentHandler)this).RegisterContent("autonomouscraneassets", ref AutonomousCrane, false); ((ContentHandler)this).RegisterContent("glowinggemassets", ref GlowingGem, false); ((ContentHandler)this).RegisterContent("industrialfanassets", ref IndustrialFan, false); Plugin.ModConfig.ConfigFloraEnabled = Plugin.configFile.Bind("Flora Options", "Flora | Enabled", true, "Whether Flora is enabled."); if (Plugin.ModConfig.ConfigFloraEnabled.Value) { RegisterOutsideFlora(mod); } } public void RegisterOutsideFlora(DuskMod mod) { Flora = new FloraAssets(mod, "floraassets"); Flora component = Flora.AllFloraPrefab.GetComponent(); GameObject[] desert = component.Desert; foreach (GameObject prefab in desert) { RegisterFlora(prefab, FloraTag.Desert, Plugin.ModConfig.ConfigFloraDesertCurveSpawnWeight.Value); } GameObject[] snowy = component.Snowy; foreach (GameObject prefab2 in snowy) { RegisterFlora(prefab2, FloraTag.Snow, Plugin.ModConfig.ConfigFloraSnowCurveSpawnWeight.Value); } GameObject[] grass = component.Grass; foreach (GameObject prefab3 in grass) { RegisterFlora(prefab3, FloraTag.Grass, Plugin.ModConfig.ConfigFloraGrassCurveSpawnWeight.Value); } } public void RegisterFlora(GameObject prefab, FloraTag tag, string configString) { //IL_0043: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown try { MapObjectSpawnMechanics val = new MapObjectSpawnMechanics(configString, string.Empty, true); RoundManagerPatch.spawnableFlora.Add(new SpawnableFlora { prefab = prefab, floraTag = tag, spawnCurveFunction = val.CurveFunction }); } catch (MalformedAnimationCurveConfigException ex) { MalformedAnimationCurveConfigException ex2 = ex; ex2.LogNicely(Plugin.Logger); } } } public class AirControlUnit : CodeRebirthHazard { public Transform turretTransform = null; public Transform turretCannonTransform = null; public Transform projectileSpawnPoint = null; public float rotationSpeed = 45f; public float fireRate = 1f; public float detectionRange = 50f; public AudioSource ACUAudioSource = null; public AudioClip ACUFireSound = null; public AudioClip ACURechargeSound = null; public AudioSource ACUClickingAudioSource = null; public AudioSource DetectPlayerAudioSound = null; public AudioClip ACUStartOrEndSound = null; public AudioSource ACUTurnAudioSource = null; private float playerHeadstart = 20f; public float maxAngle = 75f; [HideInInspector] public static List safeBounds = new List(); private float currentAngle = 0f; private float fireTimer = 3f; private GameObject projectilePrefab = null; private PlayerControllerB? lastPlayerTargetted = null; public override void Start() { base.Start(); projectilePrefab = ContentHandler.Instance.AirControlUnit.ProjectilePrefab; lastPlayerTargetted = null; DetectPlayerAudioSound.volume = 0f; ACUClickingAudioSource.Stop(); ACUClickingAudioSource.clip = null; ACUTurnAudioSource.volume = 0f; } private void Update() { playerHeadstart -= Time.deltaTime; if (StartOfRound.Instance.shipIsLeaving || playerHeadstart > 0f || Plugin.ModConfig.ConfigDebugMode.Value) { return; } FindAndAimAtTarget(); if ((Object)(object)lastPlayerTargetted == (Object)null) { fireTimer = fireRate; return; } fireTimer -= Time.deltaTime; if (fireTimer <= 0f) { FireProjectile(); fireTimer = fireRate; } UpdateAudio(); } private void UpdateAudio() { float value = Plugin.ModConfig.ConfigACUVolume.Value; ACUAudioSource.volume = value; ACUClickingAudioSource.volume = value; } private bool IsPlayerNearGround(PlayerControllerB playerControllerB) { if (playerControllerB.isClimbingLadder) { return true; } return playerControllerB.IsPlayerNearGround(); } private void FindAndAimAtTarget() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) bool lockedOntoAPlayer = false; Bounds bounds; if ((Object)(object)lastPlayerTargetted != (Object)null) { bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)lastPlayerTargetted).transform.position) && !IsPlayerNearGround(lastPlayerTargetted) && !TransformInSafeBounds(((Component)lastPlayerTargetted).transform)) { HandleTargettingToPlayer(lastPlayerTargetted, ref lockedOntoAPlayer); goto IL_0113; } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && val.isPlayerControlled) { bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)val).transform.position) && !IsPlayerNearGround(val) && !TransformInSafeBounds(((Component)val).transform)) { HandleTargettingToPlayer(val, ref lockedOntoAPlayer); } } } goto IL_0113; IL_0113: if (!lockedOntoAPlayer) { lastPlayerTargetted = null; DetectPlayerAudioSound.volume = 0f; ACUClickingAudioSource.Stop(); ACUClickingAudioSource.clip = null; ACUTurnAudioSource.volume = 0f; } } private bool TransformInSafeBounds(Transform toKillTransform) { foreach (ACUnitBounds safeBound in safeBounds) { if (safeBound.BoundsContainTransform(toKillTransform)) { return true; } } return false; } private void HandleTargettingToPlayer(PlayerControllerB playerControllerB, ref bool lockedOntoAPlayer) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) Rigidbody playerRigidbody = playerControllerB.playerRigidbody; if ((Object)(object)playerRigidbody == (Object)null) { return; } float num = Vector3.Distance(turretCannonTransform.position, ((Component)playerControllerB).transform.position); float num2 = num / 50f; Vector3 val = ((Component)playerControllerB).transform.position + playerRigidbody.velocity * num2; Vector3 val2 = val - turretTransform.position; float num3 = Vector3.Angle(turretTransform.up, val2); if (num <= detectionRange && num3 <= maxAngle && !Physics.Linecast(turretCannonTransform.position, ((Component)playerControllerB).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { lockedOntoAPlayer = true; lastPlayerTargetted = playerControllerB; if ((Object)(object)ACUClickingAudioSource.clip == (Object)null) { DetectPlayerAudioSound.volume = Plugin.ModConfig.ConfigACUVolume.Value; ACUClickingAudioSource.Stop(); ACUClickingAudioSource.clip = ACUStartOrEndSound; ACUClickingAudioSource.Play(); } ACUTurnAudioSource.volume = Plugin.ModConfig.ConfigACUVolume.Value; currentAngle = num3; Quaternion val3 = Quaternion.LookRotation(val2); val3.z = 0f; val3.x = 0f; turretTransform.rotation = Quaternion.RotateTowards(turretTransform.rotation, val3, rotationSpeed * Time.deltaTime * 5f); Vector3 localEulerAngles = turretCannonTransform.localEulerAngles; turretCannonTransform.localEulerAngles = new Vector3(num3, localEulerAngles.y, localEulerAngles.z); } } private void FireProjectile() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lastPlayerTargetted == (Object)null)) { if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 70f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } ACUAudioSource.PlayOneShot(ACUFireSound); if (((NetworkBehaviour)this).IsServer) { GameObject val = Object.Instantiate(projectilePrefab, projectileSpawnPoint.position, projectileSpawnPoint.rotation); NetworkObject component = val.GetComponent(); component.Spawn(false); AirUnitProjectile component2 = val.GetComponent(); component2.Initialize(Plugin.ModConfig.ConfigAirControlUnitDamage.Value, currentAngle, lastPlayerTargetted); ((MonoBehaviour)this).StartCoroutine(RattleCannon()); } } } private IEnumerator RattleCannon() { Vector3 originalPosition = turretCannonTransform.localPosition; float shakeDuration = 0.2f; float shakeIntensity = 0.5f; while (shakeDuration > 0f) { turretCannonTransform.localPosition = originalPosition + Vector2.op_Implicit(Random.insideUnitCircle) * shakeIntensity; shakeDuration -= Time.deltaTime; yield return null; } turretCannonTransform.localPosition = originalPosition; ACUAudioSource.PlayOneShot(ACURechargeSound); } } public class AirUnitProjectile : NetworkBehaviour { private float damage; public float speed = 20f; public float lifetime = 5f; public float bulletTrailForce = 50f; public float curveStrength = 2f; public AudioSource playerHitSoundSource = null; public AudioSource windSource = null; public MeshFilter bulletMesh = null; private Collider[] cachedColliders = (Collider[])(object)new Collider[8]; [NonSerialized] public bool explodedOnTarget = false; private float anglePointingTo = 0f; private PlayerControllerB playerToTarget = null; public void Initialize(float damageAmount, float angle, PlayerControllerB targetPlayer) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) damage = damageAmount; anglePointingTo = angle; playerToTarget = targetPlayer; curveStrength *= ((targetPlayer.currentlyHeldObjectServer is JetpackItem) ? 1.5f : 0.5f); ((MonoBehaviour)this).StartCoroutine(DespawnAfterDelay(lifetime)); Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; ((Component)this).transform.localEulerAngles = new Vector3(anglePointingTo, localEulerAngles.y, localEulerAngles.z); } private void FixedUpdate() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: 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_02c2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerToTarget == (Object)null) { return; } int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 2f, cachedColliders, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)1); if (!explodedOnTarget && num != 0 && playerToTarget.playerSteamId != 9) { CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 10f, 6, null, null, 5f); playerHitSoundSource.Play(); float num2 = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position); if (num2 <= 10f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } else if (num2 <= 20f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } else if (num2 <= 30f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num2 <= 40f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } HUDManager.Instance.ShakeCamera((ScreenShakeType)2); explodedOnTarget = true; bulletMesh.mesh = null; windSource.volume = 0f; } if (((NetworkBehaviour)this).IsServer) { Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.up * speed * Time.fixedDeltaTime; if (!explodedOnTarget && (Object)(object)playerToTarget != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)playerToTarget).transform.position) <= 30f + (float)((playerToTarget.playerSteamId != 9) ? 1 : 100)) { Vector3 val = ((Component)playerToTarget).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.Lerp(((Component)this).transform.up, normalized, curveStrength * Time.fixedDeltaTime * (float)((playerToTarget.playerSteamId != 9) ? 1 : 100)); Vector3 normalized2 = ((Vector3)(ref val)).normalized; ((Component)this).transform.up = normalized2; } if ((Object)(object)playerToTarget != (Object)null && explodedOnTarget) { ((Component)this).transform.position = ((Component)playerToTarget).transform.position; } } } private IEnumerator DespawnAfterDelay(float delay) { yield return (object)new WaitForSeconds(delay); if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } private void OnTriggerEnter(Collider other) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (!explodedOnTarget && ((Component)other).TryGetComponent(ref val)) { Vector3 val2 = ((Component)this).transform.up * Plugin.ModConfig.ConfigAirControlUnitKnockbackPower.Value; CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 0, 0f, 0f, 6, null, null, 5f); val.DamagePlayer((int)damage, true, true, (CauseOfDeath)3, 0, false, val2); playerHitSoundSource.Play(); if (PlayerControllerBExtensions.IsLocalPlayer(val)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } if (!val.isPlayerDead) { ((MonoBehaviour)this).StartCoroutine(PushPlayerFarAway(val, val2)); } explodedOnTarget = true; bulletMesh.mesh = null; windSource.volume = 0f; } } private IEnumerator PushPlayerFarAway(PlayerControllerB player, Vector3 force) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float duration = 1f; while (duration > 0f) { duration -= Time.fixedDeltaTime; player.externalForces += force; yield return (object)new WaitForFixedUpdate(); } } } public class AirUnitBulletTrail : NetworkBehaviour { public AirUnitProjectile mainProjectile = null; private void OnTriggerEnter(Collider other) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (!mainProjectile.explodedOnTarget && ((Component)other).TryGetComponent(ref val)) { Vector3 val2 = ((Component)mainProjectile).transform.position - ((Component)this).transform.position; Vector3 force = ((Vector3)(ref val2)).normalized * mainProjectile.bulletTrailForce; if (PlayerControllerBExtensions.IsLocalPlayer(val)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if (!val.isPlayerDead) { ((MonoBehaviour)this).StartCoroutine(PushPlayerFarAway(val, force)); } } } private IEnumerator PushPlayerFarAway(PlayerControllerB player, Vector3 force) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float duration = 1f; while (duration > 0f) { duration -= Time.fixedDeltaTime; player.externalForces += force; yield return (object)new WaitForFixedUpdate(); } } } public class AutonomousCrane : NetworkBehaviour { public enum CraneState { Idle, GetTargetPosition, MoveCraneHead, MoveCraneArm, DropMagnet } private enum MagnetState { IdleTop, MovingDown, IdleBottom, MovingUp } [SerializeField] private Collider[] _colliders = Array.Empty(); [Header("Audio")] [SerializeField] private AudioSource _audioSource = null; [SerializeField] private AudioClip _craneStopMovingSound = null; [SerializeField] private AudioClip _craneTurningSound = null; [SerializeField] private AudioClip _magnetDroppingSound = null; [SerializeField] private AudioClip _magnetImpactSound = null; [SerializeField] private AudioClip _magnetReelingUpSound = null; [Header("Events")] [SerializeField] private UnityEvent _onMagnetHitGround = new UnityEvent(); [SerializeField] private UnityEvent _onActivateCrane = new UnityEvent(); [SerializeField] private UnityEvent _onDeactivateCrane = new UnityEvent(); [Header("Crane Parts")] [SerializeField] private GameObject _properCraneArmEndGO = null; [SerializeField] private GameObject _cabinHead = null; [SerializeField] private GameObject _craneArmStart = null; [SerializeField] private GameObject _craneArmEnd = null; [SerializeField] private GameObject _magnet = null; [Header("Disabling Interacts")] [SerializeField] private Animator _leverAnimator = null; [SerializeField] private InteractTrigger _disableInteract = null; [SerializeField] private float _rotationSpeed = 12.5f; internal List _targetablePlayers = new List(); internal PlayerControllerB? _targetPlayer = null; private bool _craneIsActive = true; private Vector3 _targetPosition = Vector3.zero; private CraneState _currentState = CraneState.Idle; private BoundedRange _deactivationLengthRange = new BoundedRange(15f, 25f); private Random _craneRandomiser; private Coroutine? _reenableCraneRoutine = null; private Collider[] _cachedColliders = (Collider[])(object)new Collider[32]; private static readonly int PullLeverAnimation = Animator.StringToHash("pullLever"); private static readonly int UnpullLeverAnimation = Animator.StringToHash("unpullLever"); private Vector3 _magnetTargetPosition = Vector3.zero; private Vector3 _originalMagnetPosition = Vector3.zero; private float _magnetMovingProgress = 0f; private MagnetState _magnetState = MagnetState.IdleTop; private List _playerKillList = new List(); private List _enemyKillList = new List(); public override void OnNetworkSpawn() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); _craneRandomiser = new Random(StartOfRound.Instance.randomMapSeed + 33333); _deactivationLengthRange = ((AssetBundleLoader)(object)ContentHandler.Instance.AutonomousCrane).GetConfig("Autonomous Crane | Deactivation Length").Value; float num = Vector3.Distance(((Component)this).transform.position, StartOfRound.Instance.shipLandingPosition.position); Plugin.ExtendedLogging($"Distance to ship: {num}"); if (num <= 30f) { if (((NetworkBehaviour)this).IsServer) { _craneIsActive = false; ((MonoBehaviour)this).StartCoroutine(DiscardAfterABit()); } } else { ((MonoBehaviour)this).StartCoroutine(LandingCondition()); ((UnityEvent)(object)_disableInteract.onInteract).AddListener((UnityAction)EditCraneStateTrigger); } } private IEnumerator LandingCondition() { Collider[] colliders = _colliders; foreach (Collider collider in colliders) { collider.enabled = false; } yield return (object)new WaitUntil((Func)(() => StartOfRound.Instance.shipHasLanded || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)); Collider[] colliders2 = _colliders; foreach (Collider collider2 in colliders2) { collider2.enabled = true; } } private IEnumerator DiscardAfterABit() { yield return (object)new WaitForSeconds(0.1f); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } private void EditCraneStateTrigger(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { if (!_craneIsActive) { Plugin.ExtendedLogging("Activating crane"); EnableCraneServerRpc(); } else { Plugin.ExtendedLogging("Deactivating crane"); DisableCraneServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void DisableCraneServerRpc() { DisableCraneClientRpc(); } [ClientRpc] private void DisableCraneClientRpc() { _reenableCraneRoutine = ((MonoBehaviour)this).StartCoroutine(ReEnableCraneAfterDelay()); } public void Update() { if (StartOfRound.Instance.shipIsLeaving && GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && _colliders[0].enabled) { Collider[] colliders = _colliders; foreach (Collider val in colliders) { val.enabled = false; } } if (!((NetworkBehaviour)this).IsServer) { return; } if (!_craneIsActive) { _currentState = CraneState.DropMagnet; if (_magnetState != MagnetState.IdleBottom) { DoDroppingMagnetBehaviour(); } return; } switch (_currentState) { case CraneState.Idle: DoIdleBehaviour(); break; case CraneState.GetTargetPosition: DoGetTargetPositionBehaviour(); break; case CraneState.MoveCraneHead: DoMovingCraneHeadBehaviour(); break; case CraneState.MoveCraneArm: DoMovingCraneArmBehaviour(); break; case CraneState.DropMagnet: DoDroppingMagnetBehaviour(); break; } } private void DoIdleBehaviour() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (_targetablePlayers.Count <= 0) { return; } using List.Enumerator enumerator = _targetablePlayers.GetEnumerator(); if (enumerator.MoveNext()) { PlayerControllerB current = enumerator.Current; Plugin.ExtendedLogging($"AutonomousCrane: Player {current} is in range, switching to GetTargetPosition state."); _targetPosition = Vector3.zero; _targetablePlayers.Remove(current); _targetPlayer = current; _currentState = CraneState.GetTargetPosition; } } private void DoGetTargetPositionBehaviour() { if ((Object)(object)_targetPlayer == (Object)null) { DisableAudioSourceServerRpc(stopping: true); _currentState = CraneState.Idle; } else { GetTargetPosition(_targetPlayer); ChangeAudioSourceClipServerRpc(0); _currentState = CraneState.MoveCraneHead; } } private void DoMovingCraneHeadBehaviour() { if ((Object)(object)_targetPlayer == (Object)null) { DisableAudioSourceServerRpc(stopping: true); _currentState = CraneState.Idle; return; } GetTargetPosition(_targetPlayer); if (RotateCraneHead()) { _currentState = CraneState.MoveCraneArm; } } private void DoMovingCraneArmBehaviour() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_targetPlayer == (Object)null) { DisableAudioSourceServerRpc(stopping: true); _currentState = CraneState.Idle; return; } Vector3 targetPosition = _targetPosition; targetPosition.y = _cabinHead.transform.position.y; Vector3 forward = _cabinHead.transform.forward; Vector3 val = targetPosition - _cabinHead.transform.position; float num = Vector3.Dot(forward, ((Vector3)(ref val)).normalized); if (num < 0.98f) { _currentState = CraneState.MoveCraneHead; return; } GetTargetPosition(_targetPlayer); if (MoveCraneArm()) { DisableAudioSourceServerRpc(stopping: false); ChangeAudioSourceClipServerRpc(1); _targetPlayer = null; _currentState = CraneState.DropMagnet; } } private void DoDroppingMagnetBehaviour() { MoveMagnet(); } private bool RotateCraneHead() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _targetPosition - _cabinHead.transform.position; val.y = 0f; Quaternion val2 = Quaternion.LookRotation(val, Vector3.up); _cabinHead.transform.rotation = Quaternion.RotateTowards(_cabinHead.transform.rotation, val2, _rotationSpeed * Time.deltaTime / ((Component)this).transform.localScale.x); float num = Quaternion.Angle(_cabinHead.transform.rotation, val2); return num < 0.1f; } private bool MoveCraneArm() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _craneArmStart.transform.parent.InverseTransformPoint(_targetPosition); Vector2 val2 = new Vector2(val.x, val.z); float magnitude = ((Vector2)(ref val2)).magnitude; float num = Vector3.Distance(_craneArmStart.transform.position, _craneArmEnd.transform.position); float num2 = Mathf.Asin(Mathf.Clamp01(magnitude / num)) * 57.29578f; if (num2 < 10f || num2 > 90f) { return false; } float num3 = Mathf.Clamp(num2, 20f, 80f); Quaternion localRotation = _craneArmStart.transform.localRotation; float y = ((Quaternion)(ref localRotation)).eulerAngles.y; localRotation = _craneArmStart.transform.localRotation; Quaternion val3 = Quaternion.Euler(num3, y, ((Quaternion)(ref localRotation)).eulerAngles.z); _craneArmStart.transform.localRotation = Quaternion.RotateTowards(_craneArmStart.transform.localRotation, val3, _rotationSpeed * Time.deltaTime / ((Component)this).transform.localScale.x); float num4 = Quaternion.Angle(_craneArmStart.transform.localRotation, val3); _craneArmEnd.transform.position = _properCraneArmEndGO.transform.position; return num4 < 0.1f; } private void MoveMagnet() { //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (_magnetState == MagnetState.IdleTop && Physics.Raycast(_magnet.transform.position, Vector3.down, ref val, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { _originalMagnetPosition = _magnet.transform.position; _magnetTargetPosition = ((RaycastHit)(ref val)).point; _magnetMovingProgress = 0f; _magnetState = MagnetState.MovingDown; Plugin.ExtendedLogging($"Moving magnet to {((RaycastHit)(ref val)).point}"); } if (_magnetState == MagnetState.MovingDown) { _magnetMovingProgress += Time.deltaTime * 2.5f; _magnet.transform.position = Vector3.Lerp(_originalMagnetPosition, _magnetTargetPosition, _magnetMovingProgress); if (_magnetMovingProgress >= 1f) { _magnetMovingProgress = 1f; _magnetState = MagnetState.IdleBottom; CraneHitBottomServerRpc(_magnetTargetPosition); } } else if (_magnetState == MagnetState.IdleBottom) { _magnetMovingProgress -= Time.deltaTime * 0.25f; if (_magnetMovingProgress <= 0f) { _magnetMovingProgress = 0f; ChangeAudioSourceClipServerRpc(2); _magnetState = MagnetState.MovingUp; } } else if (_magnetState == MagnetState.MovingUp) { _magnetMovingProgress += Time.deltaTime * 0.5f; if (_magnetMovingProgress >= 1f) { _magnetMovingProgress = 1f; DisableAudioSourceServerRpc(stopping: false); _magnetState = MagnetState.IdleTop; _currentState = CraneState.Idle; } _magnet.transform.position = Vector3.Lerp(_magnetTargetPosition, _originalMagnetPosition, _magnetMovingProgress); } } private void GetTargetPosition(PlayerControllerB targetPlayer) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) _targetPosition = ((Component)targetPlayer).transform.position; } [ServerRpc(RequireOwnership = false)] private void CraneHitBottomServerRpc(Vector3 magnetTargetPosition) { //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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) _playerKillList.Clear(); _enemyKillList.Clear(); int num = Physics.OverlapSphereNonAlloc(magnetTargetPosition, 5f * ((Component)this).transform.localScale.x, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val2 = default(IHittable); for (int i = 0; i < num; i++) { Collider val = _cachedColliders[i]; Plugin.ExtendedLogging("Collider: " + ((Object)val).name); if (!((Component)val).TryGetComponent(ref val2)) { continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val3 != null) { if (!val3.isPlayerDead && val3.isPlayerControlled && !val3.IsPseudoDead() && !_playerKillList.Contains(val3)) { _playerKillList.Add(val3); } continue; } EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val4 != null) { if (!_enemyKillList.Contains(val4.mainScript) && !Physics.Linecast(magnetTargetPosition, ((Component)val4.mainScript).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { _enemyKillList.Add(val4.mainScript); } } else { val2.Hit(99, magnetTargetPosition, (PlayerControllerB)null, true, -1); } } foreach (PlayerControllerB playerKill in _playerKillList) { HandlePlayerDeathClientRpc(magnetTargetPosition, PlayerControllerReference.op_Implicit(playerKill)); } foreach (EnemyAI enemyKill in _enemyKillList) { CodeRebirthUtils.Instance.KillEnemyOnOwnerClientRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)enemyKill), overrideDestroy: false); } CraneHitBottomResultsClientRpc(magnetTargetPosition); } [ClientRpc] private void HandlePlayerDeathClientRpc(Vector3 magnetTargetPosition, PlayerControllerReference playerToDie) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = PlayerControllerReference.op_Implicit(playerToDie); if (!Physics.Linecast(magnetTargetPosition, ((Component)val).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)8, 0, default(Vector3), false); if (PlayerControllerBExtensions.IsLocalPlayer(val)) { SpawnScrapOnServerRpc(playerToDie); } } } [ServerRpc(RequireOwnership = false)] private void SpawnScrapOnServerRpc(PlayerControllerReference playerToDie) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = PlayerControllerReference.op_Implicit(playerToDie); NetworkObjectReference val2 = CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.FlattenedBody].Item, ((Component)val).transform.position); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent()._flattenedBodyName = val; } } [ClientRpc] private void CraneHitBottomResultsClientRpc(Vector3 magnetTargetPosition) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, magnetTargetPosition); if (num >= 40f && num < 60f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } else if (num >= 20f && num < 40f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num > 10f && num < 20f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } else if (num <= 10f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } _audioSource.clip = null; _audioSource.Stop(); _audioSource.PlayOneShot(_magnetImpactSound); _onMagnetHitGround.Invoke(); } private IEnumerator ReEnableCraneAfterDelay() { DisableCrane(); yield return (object)new WaitForSeconds(_deactivationLengthRange.GetRandomInRange(_craneRandomiser)); EnableCrane(); _reenableCraneRoutine = null; } private void DisableCrane() { _leverAnimator.SetTrigger(PullLeverAnimation); _audioSource.Stop(); _craneIsActive = false; _onDeactivateCrane.Invoke(); } [ServerRpc(RequireOwnership = false)] private void EnableCraneServerRpc() { EnableCraneClientRpc(); } [ClientRpc] private void EnableCraneClientRpc() { if (_reenableCraneRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_reenableCraneRoutine); _reenableCraneRoutine = null; } EnableCrane(); } private void EnableCrane() { _craneIsActive = true; _onActivateCrane.Invoke(); _leverAnimator.SetTrigger(UnpullLeverAnimation); } [ServerRpc] private void DisableAudioSourceServerRpc(bool stopping) { DisableAudioSourceClientRpc(stopping); } [ClientRpc] private void DisableAudioSourceClientRpc(bool stopping) { DisableAudioSource(stopping); } private void DisableAudioSource(bool stopping) { _audioSource.clip = null; _audioSource.Stop(); if (stopping) { _audioSource.PlayOneShot(_craneStopMovingSound); } } [ServerRpc] private void ChangeAudioSourceClipServerRpc(int soundID) { ChangeAudioSourceClipClientRpc(soundID); } [ClientRpc] public void ChangeAudioSourceClipClientRpc(int soundID) { ChangeAudioSourceClip(soundID); } private void ChangeAudioSourceClip(int soundID) { DisableAudioSource(stopping: false); switch (soundID) { case 0: _audioSource.clip = _craneTurningSound; break; case 1: _audioSource.clip = _magnetDroppingSound; break; case 2: _audioSource.clip = _magnetReelingUpSound; break; } _audioSource.Play(); } } public class AutonomousCraneTrigger : MonoBehaviour { [SerializeField] private AutonomousCrane _mainScript = null; [SerializeField] private MeshCollider _mainCollider = null; [SerializeField] private MeshCollider _exemptionCollider = null; private Vector3 _mainLocalCenter; private Vector2 _mainLocalRadii; private float _mainLocalHalfH; private Vector3 _exemptLocalCenter; private Vector2 _exemptLocalRadii; private float _exemptLocalHalfH; private IEnumerator Start() { yield return (object)new WaitForSeconds(1f); Bounds mb = _mainCollider.sharedMesh.bounds; _mainLocalCenter = ((Bounds)(ref mb)).center; _mainLocalRadii = new Vector2(((Bounds)(ref mb)).extents.x, ((Bounds)(ref mb)).extents.z); _mainLocalHalfH = ((Bounds)(ref mb)).extents.y; Bounds eb = _exemptionCollider.sharedMesh.bounds; _exemptLocalCenter = ((Bounds)(ref eb)).center; _exemptLocalRadii = new Vector2(((Bounds)(ref eb)).extents.x, ((Bounds)(ref eb)).extents.z); _exemptLocalHalfH = ((Bounds)(ref eb)).extents.y; } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null) { continue; } bool flag = _mainScript._targetablePlayers.Contains(val); bool flag2 = IsInsideLocalCylinder(((Component)val).transform.position, ((Component)_mainCollider).transform, _mainLocalCenter, _mainLocalRadii, _mainLocalHalfH); bool flag3 = IsInsideLocalCylinder(((Component)val).transform.position, ((Component)_exemptionCollider).transform, _exemptLocalCenter, _exemptLocalRadii, _exemptLocalHalfH); if (val.isPlayerDead || !val.isPlayerControlled || val.IsPseudoDead() || !flag2 || flag3 || val.isInHangarShipRoom) { if (flag) { _mainScript._targetablePlayers.Remove(val); } else if ((Object)(object)_mainScript._targetPlayer == (Object)(object)val) { _mainScript._targetPlayer = null; } } else if (!((Object)(object)val == (Object)(object)_mainScript._targetPlayer) && !flag) { _mainScript._targetablePlayers.Add(val); } } } private static bool IsInsideLocalCylinder(Vector3 worldPoint, Transform colliderTransform, Vector3 localCenter, Vector2 localRadii, float localHalfHeight) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector3 val = colliderTransform.InverseTransformPoint(worldPoint); float num = val.x - localCenter.x; float num2 = val.z - localCenter.z; if (num * num / (localRadii.x * localRadii.x) + num2 * num2 / (localRadii.y * localRadii.y) > 1f) { return false; } float num3 = val.y - localCenter.y; return num3 >= 0f - localHalfHeight && num3 <= localHalfHeight; } } public class BearTrap : CodeRebirthHazard, IHittable { public Animator trapAnimator = null; public Collider trapCollider = null; public float delayBeforeReset = 3f; public InteractTrigger trapTrigger = null; public AudioSource trapAudioSource = null; public AudioClip resetTrapEndSound = null; public AudioClip triggerSound = null; public AudioClip resetTrapSound = null; public AudioClip poppingTireSound = null; private float damagePlayerTimer = 0f; private Vector3 caughtPosition = Vector3.zero; internal PlayerControllerB? playerCaught = null; private EnemyAI? enemyCaught = null; private bool isTriggered = false; private bool canTrigger = true; internal bool byProduct = false; private static readonly int IsTrapTriggered = Animator.StringToHash("isTrapTriggered"); private static readonly int IsTrapResetting = Animator.StringToHash("isTrapResetting"); public override void Start() { //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_0073: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0236: Unknown result type (might be due to invalid IL or missing references) base.Start(); if (!((NetworkBehaviour)this).IsServer) { return; } float resetTime = Random.Range(trapTrigger.timeToHold - 1.5f, trapTrigger.timeToHold + 0.5f); SyncRandomResetTrapTimeClientRpc(resetTime); if (byProduct) { return; } Vector3 position = ((Component)this).transform.position; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < Random.Range(4, 8) - ((this is BoomTrap) ? 3 : 0); i++) { Vector3 val = RoundManager.Instance.GetRandomNavMeshPositionInRadius(position, 10f, default(NavMeshHit)) + Vector3.up * 2f; Physics.Raycast(val, Vector3.down, ref val2, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null)) { DawnMapObjectInfo val3 = ((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.GravelBearTrap]; GameObject mapObjectPrefab = val3.GetMapObjectPrefab(); if (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Grass")) { val3 = ((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.GrassBearTrap]; mapObjectPrefab = val3.GetMapObjectPrefab(); } else if (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Snow")) { val3 = ((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.SnowBearTrap]; mapObjectPrefab = val3.GetMapObjectPrefab(); } if (this is BoomTrap) { val3 = ((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.BoomTrap]; mapObjectPrefab = val3.GetMapObjectPrefab(); } else if (Random.Range(0, 1000) < 5) { val3 = ((Registry)(object)LethalContent.MapObjects)[CodeRebirthMapObjectKeys.BoomTrap]; mapObjectPrefab = val3.GetMapObjectPrefab(); } GameObject val4 = Object.Instantiate(mapObjectPrefab, ((RaycastHit)(ref val2)).point, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); val4.GetComponent().byProduct = true; Plugin.ExtendedLogging($"Spawning {((Object)mapObjectPrefab).name} at {((RaycastHit)(ref val2)).point}"); val4.transform.up = ((RaycastHit)(ref val2)).normal; val4.GetComponent().Spawn(true); position = val4.transform.position; } } ((NetworkBehaviour)this).NetworkObject.Despawn(true); } private void Update() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0092: 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) trapTrigger.interactable = isTriggered; UpdateAudio(); if ((Object)(object)playerCaught != (Object)null) { damagePlayerTimer -= Time.deltaTime; float num = Vector3.Distance(((Component)playerCaught).transform.position, ((Component)this).transform.position); if (num > 15f) { DoReleaseTrap(); return; } ((Component)playerCaught).transform.position = Vector3.Lerp(((Component)playerCaught).transform.position, caughtPosition, 5f * Time.deltaTime); } if (!((Object)(object)enemyCaught == (Object)null)) { enemyCaught.agent.velocity = Vector3.zero; } } public void SetWheelFriction(BearTrapWheelProxy bearTrapWheelProxy) { if (Plugin.ModConfig.ConfigBearTrapsPopTires.Value) { bearTrapWheelProxy.PunctureWheel(); } } private void UpdateAudio() { trapAudioSource.volume = Plugin.ModConfig.ConfigBearTrapVolume.Value; } private void OnTriggerEnter(Collider other) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 if (isTriggered || !canTrigger) { return; } BearTrapWheelProxy bearTrapWheelProxy = default(BearTrapWheelProxy); PlayerControllerB val = default(PlayerControllerB); EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); if (((Component)other).gameObject.layer == 30 && ((Component)other).TryGetComponent(ref bearTrapWheelProxy)) { if (!bearTrapWheelProxy.AlreadyPunctured) { trapAudioSource.PlayOneShot(poppingTireSound); SetWheelFriction(bearTrapWheelProxy); } } else if (((Component)other).gameObject.layer == 3 && ((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { TriggerTrapServerRpc(PlayerControllerReference.op_Implicit(val)); } else if (((Component)other).gameObject.layer == 19 && ((Component)other).TryGetComponent(ref val2) && (int)val2.mainScript.enemyType.EnemySize != 1) { TriggerTrap(val2.mainScript); } } [ServerRpc(RequireOwnership = false)] private void TriggerTrapServerRpc(PlayerControllerReference playerControllerReference) { TriggerTrapClientRpc(playerControllerReference); } [ClientRpc] private void TriggerTrapClientRpc(PlayerControllerReference playerControllerReference) { TriggerTrap(PlayerControllerReference.op_Implicit(playerControllerReference)); } [ServerRpc(RequireOwnership = false)] private void TriggerTrapServerRpc() { TriggerTrapClientRpc(); } [ClientRpc] private void TriggerTrapClientRpc() { TriggerTrap(); } public virtual void TriggerTrap(PlayerControllerB player) { //IL_005d: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) playerCaught = player; playerCaught.disableMoveInput = true; if (damagePlayerTimer <= 0f) { damagePlayerTimer = 0.5f; playerCaught.DamagePlayer(25, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); } caughtPosition = ((Component)playerCaught).transform.position; TriggerTrap(); } public virtual void TriggerTrap() { trapAudioSource.Stop(); trapAudioSource.clip = triggerSound; trapAudioSource.Play(); isTriggered = true; trapAnimator.SetBool(IsTrapTriggered, true); ((MonoBehaviour)this).StartCoroutine(ResetBooleanAfterDelay(IsTrapTriggered, 0.5f)); trapCollider.enabled = false; } public virtual void TriggerTrap(EnemyAI enemy) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 enemyCaught = enemy; enemyCaught.HitEnemy(0, (PlayerControllerB)null, false, -1); TriggerTrap(); ((MonoBehaviour)this).StartCoroutine(DelayReleasingTrap(10f * (((int)enemy.enemyType.EnemySize == 2) ? 0.5f : 1f) * enemy.enemyType.stunTimeMultiplier)); } [ServerRpc(RequireOwnership = false)] private void DelayReleasingTrapServerRpc(float timer) { DelayReleasingTrapClientRpc(timer); } [ClientRpc] private void DelayReleasingTrapClientRpc(float timer) { ((MonoBehaviour)this).StartCoroutine(DelayReleasingTrap(timer)); } private IEnumerator DelayReleasingTrap(float timer) { ((Component)trapTrigger).gameObject.SetActive(false); yield return (object)new WaitForSeconds(timer); DoReleaseTrapEarly(); yield return (object)new WaitForSeconds(trapTrigger.timeToHold); ((Component)trapTrigger).gameObject.SetActive(true); DoReleaseTrap(); } public void ReleaseTrapEarly() { Plugin.ExtendedLogging("release trap early"); DoReleaseTrapEarlyServerRpc(); } [ServerRpc(RequireOwnership = false)] private void DoReleaseTrapEarlyServerRpc() { DoReleaseTrapEarlyClientRpc(); } [ClientRpc] private void DoReleaseTrapEarlyClientRpc() { DoReleaseTrapEarly(); } public void DoReleaseTrapEarly() { trapAnimator.SetBool(IsTrapResetting, true); trapAudioSource.Stop(); trapAudioSource.clip = resetTrapSound; trapAudioSource.Play(); ((MonoBehaviour)this).StartCoroutine(ResetBooleanAfterDelay(IsTrapResetting, 0.5f)); } public void OnCancelReleaseTrap() { Plugin.ExtendedLogging("Canceling trap release"); DoOnCancelReleaseTrapServerRpc(); } [ServerRpc(RequireOwnership = false)] public void DoOnCancelReleaseTrapServerRpc() { DoOnCancelReleaseTrapClientRpc(); } [ClientRpc] public void DoOnCancelReleaseTrapClientRpc() { if (isTriggered && !((Object)(object)playerCaught == (Object)null)) { TriggerTrap(playerCaught); } } public void ReleaseTrap(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { Plugin.ExtendedLogging("release trap"); DoReleaseTrapServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void DoReleaseTrapServerRpc() { DoReleaseTrapClientRpc(); } [ClientRpc] public void DoReleaseTrapClientRpc() { DoReleaseTrap(); } public void DoReleaseTrap() { trapAudioSource.Stop(); trapAudioSource.clip = resetTrapEndSound; trapAudioSource.Play(); trapAnimator.SetBool(IsTrapResetting, true); trapCollider.enabled = true; if ((Object)(object)playerCaught != (Object)null) { playerCaught.disableMoveInput = false; playerCaught = null; } if ((Object)(object)enemyCaught != (Object)null) { enemyCaught = null; } isTriggered = false; ((MonoBehaviour)this).StartCoroutine(DelayForReuse()); trapAnimator.SetBool(IsTrapTriggered, false); ((MonoBehaviour)this).StartCoroutine(ResetBooleanAfterDelay(IsTrapResetting, 0.5f)); } private IEnumerator DelayForReuse() { canTrigger = false; yield return (object)new WaitForSeconds(delayBeforeReset); canTrigger = true; } private IEnumerator ResetBooleanAfterDelay(int parameterHash, float delay) { yield return (object)new WaitForSeconds(delay); trapAnimator.SetBool(parameterHash, false); } [ClientRpc] private void SyncRandomResetTrapTimeClientRpc(float resetTime) { trapTrigger.timeToHold = resetTime; } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (isTriggered) { return false; } TriggerTrapServerRpc(); if (!(this is BoomTrap)) { DelayReleasingTrapServerRpc(60f); } return true; } } public abstract class BearTrapWheelProxy : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_Start <0>__EditVehicles; } private static readonly NamespacedKey BearTrapWheelProxyKey = NamespacedKey.From("code_rebirth", "bear_trap_wheel_proxy"); public bool AlreadyPunctured { get; private set; } public virtual void Start() { PersistentDataContainer currentContract = DawnLib.GetCurrentContract(); if (!((DataContainer)currentContract).Has(BearTrapWheelProxyKey)) { return; } List orSetDefault = ((DataContainer)currentContract).GetOrSetDefault>(BearTrapWheelProxyKey, new List()); foreach (string item in orSetDefault) { if (((Object)((Component)this).gameObject).name == item) { PunctureWheel(); break; } } } internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__EditVehicles; if (obj == null) { hook_Start val = EditVehicles; <>O.<0>__EditVehicles = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; } private static void EditVehicles(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); int num = LayerMask.NameToLayer("Vehicle"); List list = new List(); foreach (NetworkPrefab prefab2 in NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs) { GameObject prefab = prefab2.Prefab; if (!((Object)(object)prefab == (Object)null) && prefab.layer == num && (Object.op_Implicit((Object)(object)prefab.GetComponent()) || Object.op_Implicit((Object)(object)prefab.GetComponent()))) { WheelCollider[] componentsInChildren = prefab.GetComponentsInChildren(); foreach (WheelCollider item in componentsInChildren) { list.Add(item); } } } foreach (WheelCollider item2 in list) { UnityWheelColliderProxy unityWheelColliderProxy = ((Component)item2).gameObject.AddComponent(); unityWheelColliderProxy.SetupWheel(); } } public abstract void SetupWheel(); public virtual void PunctureWheel() { if (!AlreadyPunctured) { AlreadyPunctured = true; PersistentDataContainer currentContract = DawnLib.GetCurrentContract(); List orSetDefault = ((DataContainer)currentContract).GetOrSetDefault>(BearTrapWheelProxyKey, new List()); orSetDefault.Add(((Object)((Component)this).gameObject).name); ((DataContainer)currentContract).Set>(BearTrapWheelProxyKey, orSetDefault); } } } public class BiomeManager : CodeRebirthHazard { public DecalProjector corruptionProjector = null; public DecalProjector crimsonProjector = null; public DecalProjector hallowProjector = null; private ParticleSystem deathParticles = null; private DecalProjector activeProjector = null; private Random biomeRandom = new Random(69); private static int foliageLayer = 0; private static int terrainLayer = 0; private List foliageOrTreeColliderList = new List(); private Collider[] _cachedColliders = (Collider[])(object)new Collider[10]; public static List Instances = new List(); public static bool Active => Instances.Count > 0; public override void Start() { base.Start(); foliageLayer = LayerMask.NameToLayer("Foliage"); terrainLayer = LayerMask.NameToLayer("Terrain"); if ((Object)(object)StartOfRound.Instance != (Object)null) { biomeRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); } switch (biomeRandom.Next(3)) { case 0: ((Component)corruptionProjector).gameObject.SetActive(true); activeProjector = corruptionProjector; break; case 1: ((Component)crimsonProjector).gameObject.SetActive(true); activeProjector = crimsonProjector; break; case 2: ((Component)hallowProjector).gameObject.SetActive(true); activeProjector = hallowProjector; break; } deathParticles = ((Component)activeProjector).gameObject.GetComponentInChildren(); ((MonoBehaviour)this).StartCoroutine(CheckAndDestroyFoliage()); } public void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)activeProjector == (Object)null) && !(activeProjector.size.x >= 250f) && !(activeProjector.size.y >= 250f)) { DecalProjector obj = activeProjector; obj.size += new Vector3(Time.deltaTime * 0.34f, Time.deltaTime * 0.34f, 0f); } } private IEnumerator CheckAndDestroyFoliage() { yield return (object)new WaitForSeconds(40f); Collider[] hitColliders = Physics.OverlapSphere(((Component)activeProjector).transform.position, 71.42857f, MoreLayerMasks.TerrainAndFoliageMask); Collider[] array = hitColliders; foreach (Collider hitCollider in array) { if (IsTree(hitCollider) || IsFoliage(hitCollider)) { foliageOrTreeColliderList.Add(hitCollider); } } while (true) { yield return (object)new WaitForSeconds(2f); PerformSphereCast(); } } private void PerformSphereCast() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(((Component)activeProjector).transform.position, activeProjector.size.y / 3.5f, _cachedColliders, MoreLayerMasks.TerrainAndFoliageMask); int num2 = 0; for (int num3 = num - 1; num3 >= 0; num3--) { if (foliageOrTreeColliderList.Contains(_cachedColliders[num3])) { num2++; foliageOrTreeColliderList.Remove(_cachedColliders[num3]); DestroyColliderObject(_cachedColliders[num3], num2); } } } private bool IsFoliage(Collider collider) { MeshRenderer component = ((Component)collider).GetComponent(); MeshFilter component2 = ((Component)collider).GetComponent(); return (Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null && ((Component)collider).gameObject.layer == foliageLayer; } private bool IsTree(Collider collider) { MeshRenderer component = ((Component)collider).GetComponent(); MeshFilter component2 = ((Component)collider).GetComponent(); return (Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null && ((Component)collider).CompareTag("Wood") && ((Component)collider).gameObject.layer == terrainLayer && !collider.isTrigger; } private void DestroyColliderObject(Collider collider, int colliderCount) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 position = ((Component)collider).transform.position; Quaternion rotation = ((Component)collider).transform.rotation; if ((Object)(object)((Component)collider).GetComponent() != (Object)null) { if (((NetworkBehaviour)this).IsServer) { ((Component)collider).GetComponent().Despawn(true); } } else { Object.Destroy((Object)(object)((Component)collider).gameObject); } if ((colliderCount != 0 && biomeRandom.Next(1, colliderCount + 1) <= 5) || biomeRandom.Next(1, 101) <= 20) { ParticleSystem val = Object.Instantiate(deathParticles, position, rotation); val.Play(); GameObject gameObject = ((Component)val).gameObject; MainModule main = val.main; float duration = ((MainModule)(ref main)).duration; main = val.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constantMax); } } } public class BoomTrap : BearTrap { public AudioSource boomSource = null; public AudioClip explosionSound = null; public AudioClip hissSound = null; private bool triggeredOnce = false; public override void TriggerTrap(PlayerControllerB player) { base.TriggerTrap(player); if (!triggeredOnce) { triggeredOnce = true; ((MonoBehaviour)this).StartCoroutine(StartExplosionCountdown(player)); } } public override void TriggerTrap() { base.TriggerTrap(); if (!triggeredOnce) { triggeredOnce = true; if ((Object)(object)playerCaught == (Object)null) { ((Component)trapTrigger).gameObject.SetActive(false); } ((MonoBehaviour)this).StartCoroutine(StartExplosionCountdown(null)); } } private IEnumerator StartExplosionCountdown(PlayerControllerB? playerSnapped) { boomSource.PlayOneShot(hissSound); yield return (object)new WaitForSeconds(hissSound.length); CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 400, 0f, 4f, 10, playerSnapped, null, 50f); boomSource.PlayOneShot(explosionSound); yield return (object)new WaitForSeconds(explosionSound.length); if ((Object)(object)playerCaught == (Object)null && (Object)(object)playerSnapped != (Object)null && !playerSnapped.isPlayerDead && PlayerControllerBExtensions.IsLocalPlayer(playerSnapped)) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.ShortFuse); } DoReleaseTrap(); if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public override void TriggerTrap(EnemyAI enemy) { base.TriggerTrap(enemy); if (!triggeredOnce) { triggeredOnce = true; StartExplosionCountdown(null); } } } public class BugleBoy : MonoBehaviour { [SerializeField] public Animator animator = null; [SerializeField] public InteractTrigger rerollTrigger = null; [SerializeField] public Merchant merchant = null; [SerializeField] public AudioSource bugleSource = null; [SerializeField] public AudioClip[] bugleClips = Array.Empty(); internal AudioClip chosenClip = null; internal static readonly int ActivatedHash = Animator.StringToHash("MusicPlaying"); private bool disabled = false; [SerializeField] public int RerollPrice { get; private set; } = 2; [field: SerializeField] public AudioClip StartBugleSound { get; set; } public IEnumerator Start() { yield return null; yield return null; chosenClip = bugleClips[merchant.storeSeededRandom.Next(0, bugleClips.Length)]; rerollTrigger.cooldownTime = chosenClip.length; ((UnityEvent)(object)rerollTrigger.onInteract).AddListener((UnityAction)Reroll); CoinDisplayUI.PointsOfInterest.Add(((Component)this).transform); } public void OnDestroy() { CoinDisplayUI.PointsOfInterest.Remove(((Component)this).transform); ((UnityEvent)(object)rerollTrigger.onInteract).RemoveListener((UnityAction)Reroll); } public void Update() { if (!disabled) { if ((Object)(object)NetworkSingleton.Instance == (Object)null || NetworkSingleton.Instance.MoneyStored() <= RerollPrice) { rerollTrigger.interactable = false; } else { rerollTrigger.interactable = true; } } } public void DisableSelf() { ((UnityEvent)(object)rerollTrigger.onInteract).RemoveListener((UnityAction)Reroll); rerollTrigger.interactable = false; disabled = true; } public void Reroll(PlayerControllerB playerInteracting) { if (!((Object)(object)playerInteracting == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerInteracting)) { merchant.RerollServerRpc(); } } public void PlayMusic() { bugleSource.clip = chosenClip; bugleSource.Play(); ((MonoBehaviour)this).StartCoroutine(StopHisSinging()); } private IEnumerator StopHisSinging() { yield return (object)new WaitUntil((Func)(() => !bugleSource.isPlaying)); chosenClip = bugleClips[merchant.storeSeededRandom.Next(0, bugleClips.Length)]; rerollTrigger.cooldownTime = chosenClip.length; animator.SetBool(ActivatedHash, false); } } public class CodeRebirthHazard : NetworkBehaviour { private Collider[] cachedColliders = (Collider[])(object)new Collider[5]; public virtual void Start() { if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(DecideHazardSpawningStuff()); } } private IEnumerator DecideHazardSpawningStuff() { yield return (object)new WaitForSeconds(Random.Range(0f, 2f)); int numHits = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 1f, cachedColliders, MoreLayerMasks.InteractableMask, (QueryTriggerInteraction)1); for (int i = 0; i < numHits; i++) { if (Object.op_Implicit((Object)(object)((Component)cachedColliders[i]).GetComponent())) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); break; } } } } public class CoinDisplayUI : Singleton { internal static List PointsOfInterest = new List(); private Coroutine? fadingRoutine = null; internal Coroutine? editCoinRoutine = null; private Vector3 TMPChangeOriginalPosition = Vector3.zero; [field: SerializeField] public Image Image { get; private set; } [field: SerializeField] public TextMeshProUGUI CoinTMP { get; private set; } [field: SerializeField] public TextMeshProUGUI CoinChangeTMP { get; private set; } [field: SerializeField] public float MinDistanceRequired { get; private set; } = 10f; private void Start() { //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_0017: Unknown result type (might be due to invalid IL or missing references) TMPChangeOriginalPosition = ((RectTransform)((TMP_Text)CoinChangeTMP).transform).anchoredPosition3D; ((TMP_Text)CoinTMP).text = "0"; } private void Update() { //IL_006b: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (fadingRoutine != null || editCoinRoutine != null) { return; } if ((Object)(object)NetworkSingleton.Instance != (Object)null) { ((TMP_Text)CoinTMP).text = NetworkSingleton.Instance.MoneyStored().ToString(); } foreach (Transform item in PointsOfInterest) { if (Vector3.Distance(item.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) <= MinDistanceRequired) { if (((Graphic)Image).color.a != 1f) { fadingRoutine = ((MonoBehaviour)this).StartCoroutine(FadeIn(includeCoinChangeTMP: false)); ((Component)item).gameObject.SetActive(true); } return; } } if (((Graphic)Image).color.a == 1f) { fadingRoutine = ((MonoBehaviour)this).StartCoroutine(FadeOut()); } } private IEnumerator FadeOut() { float alpha = 1f; ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, alpha); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, alpha); float duration = 0.25f; while (duration > 0f) { alpha -= Time.deltaTime * 4f; ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, alpha); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, alpha); duration -= Time.deltaTime; yield return null; } ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, 0f); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, 0f); fadingRoutine = null; } internal IEnumerator EditCoinAmount(int newValue, int oldValue) { if (((Graphic)Image).color.a == 0f) { yield return ((MonoBehaviour)this).StartCoroutine(FadeIn(includeCoinChangeTMP: true)); } RectTransform coinChangeTMPRectTransform = (RectTransform)((TMP_Text)CoinChangeTMP).transform; int extraDigits = ((TMP_Text)CoinTMP).text.Length - 1; coinChangeTMPRectTransform.anchoredPosition3D = TMPChangeOriginalPosition + new Vector3(25f * (float)extraDigits, 0f, 0f); int changedAmount = newValue - oldValue; if (changedAmount > 0) { ((Graphic)CoinChangeTMP).color = Color.green; } else { ((Graphic)CoinChangeTMP).color = Color.red; } if (changedAmount > 0) { ((TMP_Text)CoinChangeTMP).text = "+" + changedAmount; } else { ((TMP_Text)CoinChangeTMP).text = changedAmount.ToString(); } bool goSlowly = Mathf.Abs(changedAmount) <= 10; while (changedAmount != 0) { if (((Graphic)CoinTMP).color.a != 1f) { ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, 1f); ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, 1f); } yield return (object)new WaitForSeconds(0.05f * (float)((!goSlowly) ? 1 : 5)); if (changedAmount > 0) { ((TMP_Text)CoinTMP).text = (int.Parse(((TMP_Text)CoinTMP).text) + 1).ToString(); ((TMP_Text)CoinChangeTMP).text = "+" + (int.Parse(((TMP_Text)CoinChangeTMP).text) - 1); changedAmount--; } else if (changedAmount < 0) { ((TMP_Text)CoinTMP).text = (int.Parse(((TMP_Text)CoinTMP).text) - 1).ToString(); ((TMP_Text)CoinChangeTMP).text = (int.Parse(((TMP_Text)CoinChangeTMP).text) + 1).ToString(); changedAmount++; } extraDigits = ((TMP_Text)CoinTMP).text.Length - 1; coinChangeTMPRectTransform.anchoredPosition3D = TMPChangeOriginalPosition + new Vector3(25f * (float)extraDigits, 0f, 0f); } yield return (object)new WaitForSeconds(0.25f); ((MonoBehaviour)this).StartCoroutine(FadeOut()); float duration = 0.25f; float alpha = 1f; float decreasingHeight = 0f; while (duration > 0f) { decreasingHeight += Time.deltaTime * 60f * 4f; alpha -= Time.deltaTime * 4f; ((Graphic)CoinChangeTMP).color = new Color(((Graphic)CoinChangeTMP).color.r, ((Graphic)CoinChangeTMP).color.g, ((Graphic)CoinChangeTMP).color.b, alpha); coinChangeTMPRectTransform.anchoredPosition3D = TMPChangeOriginalPosition + new Vector3(25f * (float)extraDigits, 0f - decreasingHeight, 0f); duration -= Time.deltaTime; yield return null; } ((Graphic)CoinChangeTMP).color = new Color(((Graphic)CoinChangeTMP).color.r, ((Graphic)CoinChangeTMP).color.g, ((Graphic)CoinChangeTMP).color.b, 0f); coinChangeTMPRectTransform.anchoredPosition3D = TMPChangeOriginalPosition + new Vector3(25f * (float)extraDigits, 0f, 0f); editCoinRoutine = null; } private IEnumerator FadeIn(bool includeCoinChangeTMP) { float alpha = 0f; ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, alpha); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, alpha); if (includeCoinChangeTMP) { ((Graphic)CoinChangeTMP).color = new Color(((Graphic)CoinChangeTMP).color.r, ((Graphic)CoinChangeTMP).color.g, ((Graphic)CoinChangeTMP).color.b, alpha); } float duration = 0.25f; while (duration > 0f) { alpha += Time.deltaTime * 4f; ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, alpha); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, alpha); if (includeCoinChangeTMP) { ((Graphic)CoinChangeTMP).color = new Color(((Graphic)CoinChangeTMP).color.r, ((Graphic)CoinChangeTMP).color.g, ((Graphic)CoinChangeTMP).color.b, alpha); } duration -= Time.deltaTime; yield return null; } ((Graphic)Image).color = new Color(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b, 1f); ((Graphic)CoinTMP).color = new Color(((Graphic)CoinTMP).color.r, ((Graphic)CoinTMP).color.g, ((Graphic)CoinTMP).color.b, 1f); if (includeCoinChangeTMP) { ((Graphic)CoinChangeTMP).color = new Color(((Graphic)CoinChangeTMP).color.r, ((Graphic)CoinChangeTMP).color.g, ((Graphic)CoinChangeTMP).color.b, 1f); } fadingRoutine = null; } } public class CompactorEnemyLevelSpawner : EnemyLevelSpawner { } public class CompactorToby : NetworkBehaviour, IHittable { [Header("Sounds")] [SerializeField] private AudioSource _tobySource = null; [SerializeField] private AudioClip _buttonPressSound = null; [SerializeField] private AudioClip _buttonErrorSound = null; [SerializeField] private AudioClip _compactorWhackedSound = null; [SerializeField] private AudioSource _tobyMalfunctionSource = null; [SerializeField] private AudioClip _compactorCloseGateSound = null; [SerializeField] private AudioClip _compactorEndSound = null; [Header("Animations")] [SerializeField] private Animator _tobyAnimator = null; [SerializeField] private NetworkAnimator _tobyNetworkAnimator = null; private List _compactorEnemyLevelSpawners = new List(); [HideInInspector] public bool compacting = false; private bool _usedOnce = false; private static readonly int HitAnimation = Animator.StringToHash("hit"); private static readonly int StartCompactAnimation = Animator.StringToHash("startCompact"); private static readonly int FastEndCompactAnimation = Animator.StringToHash("fastEnd"); private static readonly int SlowEndCompactAnimation = Animator.StringToHash("slowEnd"); public void Start() { foreach (EnemyLevelSpawner enemyLevelSpawner in EnemyLevelSpawner.enemyLevelSpawners) { if (enemyLevelSpawner is CompactorEnemyLevelSpawner item) { _compactorEnemyLevelSpawners.Add(item); } } } public void CompactorInteract(PlayerControllerB player) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (compacting || !PlayerControllerBExtensions.IsLocalPlayer(player)) { return; } int num = 0; bool fast = true; List list = new List(); List list2 = new List(); GrabbableObject[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren(); foreach (GrabbableObject val in componentsInChildren) { if (!val.isHeld) { num += val.scrapValue; list.Add(val); list2.Add(((Component)val).transform.position); if (!val.itemProperties.itemName.Contains("Shredded Scraps")) { fast = false; } } } if (num == 0) { ErrorSoundServerRpc(); return; } foreach (GrabbableObject item in list) { DespawnItemServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)item)); } Vector3 randomPosition = list2[Random.Range(0, list2.Count)]; TryCompactItemServerRpc(randomPosition, num, null, fast); } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (compacting) { return false; } TriggerAnimationServerRpc(HitAnimation); return true; } [ServerRpc(RequireOwnership = false)] private void ErrorSoundServerRpc() { ErrorSoundClientRpc(); } [ClientRpc] private void ErrorSoundClientRpc() { _tobySource.PlayOneShot(_buttonErrorSound); } [ServerRpc(RequireOwnership = false)] public void TryCompactItemServerRpc(Vector3 randomPosition, int value, PlayerControllerReference? deadPlayer, bool fast) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) StartOrStopCompactingClientRpc(starting: true, !fast); ((MonoBehaviour)this).StartCoroutine(CompactProcess(randomPosition, value, deadPlayer, fast)); } private IEnumerator CompactProcess(Vector3 randomPosition, int value, PlayerControllerReference? deadPlayer, bool fast) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"Value: {value} | Dead Player: {deadPlayer} | Fast: {fast}"); _tobyNetworkAnimator.SetTrigger(StartCompactAnimation, true); yield return (object)new WaitForSeconds(21f); float timeElapsed = 0f; float timeToWait = (fast ? 5f : 30f); if (fast) { _tobyNetworkAnimator.SetTrigger(FastEndCompactAnimation, true); } else { _tobyNetworkAnimator.SetTrigger(SlowEndCompactAnimation, true); } float Timethreshold = 2.4f; while (timeElapsed < timeToWait) { yield return null; timeElapsed += Time.deltaTime; Timethreshold -= Time.deltaTime; if (Timethreshold <= 0f) { Timethreshold = 2.4f; Plugin.ExtendedLogging("Toby Spawning Enemy"); int randomIndex = Random.Range(0, _compactorEnemyLevelSpawners.Count); CompactorEnemyLevelSpawner enemyLevelSpawner = _compactorEnemyLevelSpawners[randomIndex]; EnemyAI enemyAI = null; for (int i = 0; i < 5; i++) { enemyAI = enemyLevelSpawner.SpawnRandomEnemy(); if ((Object)(object)enemyAI != (Object)null) { break; } } if ((Object)(object)enemyAI != (Object)null && (Object)(object)enemyAI.agent != (Object)null && ((Behaviour)enemyAI.agent).enabled) { ForceEnemyToDestination component = ((Component)enemyAI).gameObject.AddComponent(); component.enemy = enemyAI; component.Destination = ((Component)this).transform.position; } } if (timeElapsed >= 11.1f && _tobyMalfunctionSource.isPlaying) { StopTobySourceClientRpc(); } } StartOrStopCompactingClientRpc(starting: false, malfunctioning: false); if (deadPlayer != null) { NetworkObjectReference flattenedBodyNetObjRef = CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.FlattenedBody].Item, randomPosition, isQuest: false, defaultRotation: true, value); NetworkObject flattenedBodyNetObj = default(NetworkObject); if (((NetworkObjectReference)(ref flattenedBodyNetObjRef)).TryGet(ref flattenedBodyNetObj, (NetworkManager)null)) { PlayerControllerB player = PlayerControllerReference.op_Implicit(deadPlayer); ((Component)flattenedBodyNetObj).GetComponent()._flattenedBodyName = player; } } else { CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.SallyCube].Item, randomPosition, isQuest: false, defaultRotation: true, value); } } private IEnumerator PlaySourceWithDelay(float delay) { yield return (object)new WaitForSeconds(delay); _tobyMalfunctionSource.Play(); } [ClientRpc] private void StopTobySourceClientRpc() { _tobyMalfunctionSource.Stop(); } [ServerRpc(RequireOwnership = false)] public void TriggerAnimationServerRpc(int hash) { _tobyNetworkAnimator.SetTrigger(hash, true); } [ClientRpc] public void StartOrStopCompactingClientRpc(bool starting, bool malfunctioning) { compacting = starting; if (starting) { _tobySource.PlayOneShot(_buttonPressSound); if (malfunctioning) { ((MonoBehaviour)this).StartCoroutine(PlaySourceWithDelay(21f)); } return; } if (!_usedOnce) { foreach (EnemyLevelSpawner enemyLevelSpawner in EnemyLevelSpawner.enemyLevelSpawners) { enemyLevelSpawner.spawnTimerMin /= 2f; enemyLevelSpawner.spawnTimerMax /= 2f; } OxydeLightsManager.Instance.IncrementLights(); _usedOnce = true; HUDManager.Instance.DisplayTip("Warning!", "Site machinery activated, anomaly levels rising.", true, false, "LC_Tip1"); } _tobyMalfunctionSource.Stop(); } [ServerRpc(RequireOwnership = false)] public void DespawnItemServerRpc(NetworkBehaviourReference networkBehaviourReference) { GrabbableObject val = default(GrabbableObject); if (((NetworkBehaviourReference)(ref networkBehaviourReference)).TryGet(ref val, (NetworkManager)null)) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } } public void PlayMiscSoundsAnimEvent(int SoundID) { switch (SoundID) { case 0: _tobySource.PlayOneShot(_compactorWhackedSound); break; case 1: _tobySource.PlayOneShot(_compactorCloseGateSound); break; case 2: _tobySource.PlayOneShot(_compactorEndSound); break; } } } public class CrateExplodeable : MonoBehaviour, IExplodeable { [field: SerializeField] public ItemCrate ItemCrate { get; private set; } public void OnExplosion(int force, Vector3 explosionPosition, float distanceToExplosion) { if (!ItemCrate.burned) { ItemCrate.DoBurningServerRpc(); } } } public class DestructibleObject : NetworkBehaviour, IHittable { [Header("References")] [SerializeField] private Collider[] colliders = Array.Empty(); [SerializeField] private Renderer[] renderers = Array.Empty(); [SerializeField] private ParticleSystem[] _particleSystems = Array.Empty(); [SerializeField] private AudioSource _audioSource = null; [SerializeField] private AudioClip _destroySound = null; [Header("Settings")] [SerializeField] private int _playerDamageAmount = 5; [SerializeField] private float _forceApplied = 5f; private bool _isDestructible = false; internal Coroutine? _destroyCactiRoutine = null; public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (Object.op_Implicit((Object)(object)playerWhoHit) && ((AssetBundleLoader)(object)ContentHandler.Instance.CactusBudling).GetConfig("Cactus Budling | Cacti Toughness").Value && ((Object)(object)playerWhoHit.currentlyHeldObjectServer == (Object)null || !playerWhoHit.currentlyHeldObjectServer.itemProperties.isDefensiveWeapon)) { return false; } DestroyDestructibleObjectServerRpc(); return true; } public void OnTriggerEnter(Collider other) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (_isDestructible && ((Component)other).gameObject.TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { PlayerControllerB obj = val; int playerDamageAmount = _playerDamageAmount; Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; obj.DamagePlayer(playerDamageAmount, true, true, (CauseOfDeath)0, 0, false, ((Vector3)(ref val2)).normalized * _forceApplied); DestroyDestructibleObjectServerRpc(); } } public void SetDestructible(bool isDestructible) { _isDestructible = isDestructible; } [ServerRpc(RequireOwnership = false)] private void DestroyDestructibleObjectServerRpc() { DestroyDestructibleObjectClientRpc(); } [ClientRpc] private void DestroyDestructibleObjectClientRpc() { DestroyDestructibleObject(); } public void DestroyDestructibleObject() { //IL_0019: 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_0059: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (_isDestructible) { if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) <= 1f) { GameNetworkManager.Instance.localPlayerController.DamagePlayer(5, true, true, (CauseOfDeath)14, 0, false, default(Vector3)); } Collider[] array = colliders; foreach (Collider val in array) { val.enabled = false; } Renderer[] array2 = renderers; foreach (Renderer val2 in array2) { val2.enabled = false; } ParticleSystem[] particleSystems = _particleSystems; foreach (ParticleSystem val3 in particleSystems) { val3.Play(); } float delay = 0f; if ((Object)(object)_particleSystems[0] != (Object)null) { MainModule main = _particleSystems[0].main; delay = ((MainModule)(ref main)).duration + 1f; } _audioSource.PlayOneShot(_destroySound); if (_destroyCactiRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_destroyCactiRoutine); } _destroyCactiRoutine = ((MonoBehaviour)this).StartCoroutine(DestroyObjectWithDelay(delay, bringDown: false)); } } internal IEnumerator DestroyObjectWithDelay(float delay, bool bringDown) { yield return (object)new WaitForSeconds(delay); if (bringDown) { RiseFromGroundOnSpawn riseFromGroundOnSpawn = ((Component)this).GetComponent(); ((Behaviour)riseFromGroundOnSpawn).enabled = true; riseFromGroundOnSpawn._riseFromDifferentGroundType.onGroundStart.Invoke(); yield return (object)new WaitForSeconds(riseFromGroundOnSpawn._timeToTake); } if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } public class FlashTurret : CodeRebirthHazard { public CRNoiseListener _FlashTurretNoiseListener = null; public Transform turretTransform = null; public Light flashLight = null; public float rotationSpeed = 90f; public float detectionRange = 15f; public float flashDuration = 3f; public float blindDuration = 5f; public float flashIntensity = 10f; public float flashCooldown = 3f; public AudioSource cameraAudioSource = null; public AudioClip spotPlayerSound = null; public AudioClip flashPlayerSound = null; private bool isTriggered = false; private PlayerControllerB? detectedPlayer = null; private bool isFlashing = false; private float flashTimer = 0f; private float cooldownTimer = 0f; public override void Start() { base.Start(); _FlashTurretNoiseListener._onNoiseDetected.AddListener((UnityAction)OnNoiseDetected); Plugin.ExtendedLogging("Flash Turret initialized"); } private void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) UpdateAudio(); if (isTriggered && (Object)(object)detectedPlayer != (Object)null) { Vector3 val = ((Component)detectedPlayer).transform.position - turretTransform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.LookRotation(normalized); turretTransform.rotation = Quaternion.RotateTowards(turretTransform.rotation, val2, rotationSpeed * Time.deltaTime); if (Quaternion.Angle(turretTransform.rotation, val2) < 1f && !isFlashing) { Vector3 forward = ((Component)detectedPlayer.gameplayCamera).transform.forward; val = turretTransform.position - ((Component)detectedPlayer).transform.position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; float dotProduct = Vector3.Dot(forward, normalized2); TriggerFlash(dotProduct); } } if (isFlashing) { flashTimer -= Time.deltaTime; flashLight.intensity = Mathf.Lerp(flashIntensity, 0f, 1f - flashTimer / 5f); if (flashTimer <= 0f) { flashLight.intensity = 0f; isFlashing = false; cooldownTimer = flashCooldown; ResetTurret(); } } if (cooldownTimer > 0f) { cooldownTimer -= Time.deltaTime; } } private void UpdateAudio() { cameraAudioSource.volume = Plugin.ModConfig.ConfigFlashTurretVolume.Value; } public void OnNoiseDetected(NoiseParams noiseParams) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"Flash turret hearing noiseID: {noiseParams.noiseID}"); if (noiseParams.noiseID != 6 || (Object)(object)detectedPlayer != (Object)null || cooldownTimer > 0f) { return; } float num = Vector3.Distance(turretTransform.position, noiseParams.noisePosition); if (!(num > detectionRange)) { Ray val = default(Ray); ((Ray)(ref val))..ctor(turretTransform.position, noiseParams.noisePosition - turretTransform.position); RaycastHit val2 = default(RaycastHit); PlayerControllerB val3 = default(PlayerControllerB); if (Physics.Raycast(val, ref val2, num + 1f, StartOfRound.Instance.collidersAndRoomMaskAndPlayers, (QueryTriggerInteraction)2) && !((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent(ref val3)) { detectedPlayer = val3; isTriggered = true; cameraAudioSource.PlayOneShot(spotPlayerSound); } } } private void TriggerFlash(float dotProduct) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) cameraAudioSource.PlayOneShot(flashPlayerSound, 0.5f); if ((Object)(object)flashLight != (Object)null) { flashLight.intensity = flashIntensity; isFlashing = true; flashTimer = flashDuration; } if ((Object)(object)detectedPlayer != (Object)null && dotProduct > 0.5f) { StunGrenadeItem.StunExplosion(((Component)detectedPlayer).transform.position, true, 0.5f, 5f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f); } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 0.5f, 0, false, 75); } private void ResetTurret() { isTriggered = false; detectedPlayer = null; } } public class Flora : MonoBehaviour { public GameObject[] Grass = null; public GameObject[] Desert = null; public GameObject[] Snowy = null; public GameObject[] DangerousSpecies = null; } public class FunctionalMicrowave : CodeRebirthHazard { public float microwaveOpeningTimer = 15f; public float microwaveClosingTimer = 7.5f; public Collider mainCollider = null; public float hinderedMultiplier = 1.5f; public int damageAmount = 3; public float damageTimer = 0.1f; public Animator animator = null; public NavMeshAgent agent = null; public float Speed = 3f; public float TurnSpeed = 10f; public AudioSource microwaveAudioSource = null; public AudioClip microwaveOpenSound = null; public AudioClip microwaveCloseSound = null; public Transform scrapSpawnPoint = null; private int originalDamageAmount = 0; private bool spawnedWithScrap = false; private GrabbableObject? scrapSpawned = null; private float movingTimer = 30f; private bool movingForAWhile = false; private float microwaveOpening = 0f; private float microwaveClosing = 0f; private bool isOpen = true; private float damageTimerDecrease = 0f; private Vector3 newDestination = default(Vector3); private List playersAffected = new List(); private Random microwaveRandom = new Random(); public override void Start() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) base.Start(); Plugin.ExtendedLogging("Functional Microwave initialized"); microwaveClosing = microwaveClosingTimer; microwaveOpening = microwaveOpeningTimer; animator.SetBool("isActivated", isOpen); agent.speed = Speed; agent.acceleration = 5f; agent.angularSpeed = TurnSpeed; Item val = ChooseRandomMicrowaveScrap(); if (!((Object)(object)val == (Object)null)) { spawnedWithScrap = true; originalDamageAmount = damageAmount; damageAmount = 10; if (((NetworkBehaviour)this).IsServer) { NetworkObjectReference val2 = CodeRebirthUtils.Instance.SpawnScrap(val, scrapSpawnPoint.position, isQuest: false, defaultRotation: false); scrapSpawned = NetworkObjectReference.op_Implicit(val2).GetComponent(); scrapSpawned.grabbable = false; scrapSpawned.parentObject = scrapSpawnPoint; newDestination = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position; SyncScrapStuffClientRpc(val2); } } } [ClientRpc] private void SyncScrapStuffClientRpc(NetworkObjectReference spawnedScrap) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) scrapSpawned = NetworkObjectReference.op_Implicit(spawnedScrap).GetComponent(); scrapSpawned.grabbable = false; scrapSpawned.parentObject = scrapSpawnPoint; } private Item? ChooseRandomMicrowaveScrap() { return (Item?)(microwaveRandom.Next(5) switch { 0 => ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.CharredBaby].Item, 1 => ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.CharredFork].Item, 2 => ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.CharredBaby].Item, 3 => ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.SapsuckerOmelette].Item, 4 => ((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.CharredSpork].Item, _ => null, }); } public void Update() { //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) UpdateAudio(); damageTimerDecrease -= Time.deltaTime; movingTimer -= Time.deltaTime; if ((Object)(object)scrapSpawned != (Object)null && (scrapSpawned.isHeld || (Object)(object)scrapSpawned.playerHeldBy != (Object)null)) { scrapSpawned.grabbable = true; if ((Object)(object)scrapSpawned.playerHeldBy != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(scrapSpawned.playerHeldBy)) { DuskAchievementExtensions.TryDiscoverMoreProgressAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.LunchisServed, scrapSpawned.itemProperties.itemName); } damageAmount = originalDamageAmount; scrapSpawned = null; } if (movingTimer < 0f) { movingForAWhile = true; movingTimer = 30f; } if (!isOpen) { microwaveOpening += Time.deltaTime; if (microwaveOpening >= microwaveOpeningTimer) { if ((Object)(object)scrapSpawned != (Object)null) { scrapSpawned.grabbable = true; } microwaveOpening = 0f; isOpen = true; mainCollider.enabled = true; microwaveAudioSource.PlayOneShot(microwaveOpenSound); animator.SetBool("isActivated", isOpen); if ((Object)(object)scrapSpawned != (Object)null) { CRUtilities.CreateExplosion(((Component)scrapSpawned).transform.position, spawnExplosionEffect: true, 20, 0f, 3f, 2, null, null, 5f); } } } else { microwaveClosing += Time.deltaTime; if (microwaveClosing >= microwaveClosingTimer) { if ((Object)(object)scrapSpawned != (Object)null) { scrapSpawned.grabbable = false; } microwaveClosing = 0f; isOpen = false; mainCollider.enabled = false; microwaveAudioSource.PlayOneShot(microwaveCloseSound); foreach (PlayerControllerB item in playersAffected) { item.movementSpeed *= hinderedMultiplier; } playersAffected.Clear(); animator.SetBool("isActivated", isOpen); } } if (((NetworkBehaviour)this).IsServer && (agent.remainingDistance < 1f || movingForAWhile)) { movingForAWhile = false; agent.SetDestination(newDestination); newDestination = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position; } } private void UpdateAudio() { microwaveAudioSource.volume = Plugin.ModConfig.ConfigMicrowaveVolume.Value; } public void OnColliderEnter(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && !playersAffected.Contains(val)) { playersAffected.Add(val); PlayerControllerB obj = val; obj.movementSpeed /= hinderedMultiplier; } } public void OnColliderStay(Collider other) { //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) PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && damageTimerDecrease <= 0f) { damageTimerDecrease = damageTimer; val.DamagePlayer(damageAmount, true, true, (CauseOfDeath)13, 0, false, default(Vector3)); } } public void OnColliderExit(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && playersAffected.Contains(val)) { playersAffected.Remove(val); PlayerControllerB obj = val; obj.movementSpeed *= hinderedMultiplier; } } } public class FunctionalMicrowaveCollider : NetworkBehaviour { public FunctionalMicrowave mainScript; public void OnTriggerEnter(Collider other) { mainScript.OnColliderEnter(other); } public void OnTriggerStay(Collider other) { mainScript.OnColliderStay(other); } public void OnTriggerExit(Collider other) { mainScript.OnColliderExit(other); } } public class GunslingerGreg : CodeRebirthHazard { public Transform gregBase = null; public Transform gregCannon = null; public float rotationSpeed = 45f; public float fireRate = 1f; public float detectionRange = 50f; public AudioSource GregSource = null; public AudioSource FarGregSource = null; public AudioClip GregLockOnSound = null; public AudioClip[] GregFireSounds = Array.Empty(); public AudioClip[] FarGregFireSounds = Array.Empty(); public AudioSource DetectPlayerAudioSound = null; public AudioSource DetectPlayerFarAudioSound = null; public float playerHeadstart = 5f; public float maxAngle = 90f; public Queue rockets = new Queue(); public Transform[] rocketTransforms = Array.Empty(); private GunslingerMissile? missileToRecharge = null; public static List safeBounds = new List(); private float rechargeRocketTimer = 30f; private float fireTimer = 1f; private GameObject MissilePrefab = null; private Transform? lastTransformTargetted = null; public override void Start() { base.Start(); MissilePrefab = ContentHandler.Instance.GunslingerGreg.MissilePrefab; Transform[] array = rocketTransforms; foreach (Transform rocketTransform in array) { rockets.Enqueue(SpawnImmobileRocket(rocketTransform)); } lastTransformTargetted = null; DetectPlayerAudioSound.volume = 0f; DetectPlayerFarAudioSound.volume = 0f; } private void Update() { playerHeadstart -= Time.deltaTime; if ((Object)(object)missileToRecharge == (Object)null) { foreach (GunslingerMissile rocket in rockets) { if (rocket.ready) { continue; } missileToRecharge = rocket; break; } } else { RechargeRocket(missileToRecharge); } if (Plugin.ModConfig.ConfigDebugMode.Value) { return; } if (StartOfRound.Instance.shipIsLeaving || playerHeadstart > 0f || rockets.Count <= 0) { DetectPlayerAudioSound.volume = 0f; DetectPlayerFarAudioSound.volume = 0f; return; } FindAndAimAtTarget(); if (!((Object)(object)lastTransformTargetted == (Object)null)) { fireTimer -= Time.deltaTime; if (fireTimer <= 0f) { FireProjectile(); fireTimer = fireRate; } } } private GunslingerMissile SpawnImmobileRocket(Transform rocketTransform) { //IL_0008: 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) GameObject val = Object.Instantiate(MissilePrefab, rocketTransform.position, rocketTransform.rotation, rocketTransform); GunslingerMissile component = val.GetComponent(); component.mainTransform = rocketTransform; component.ready = true; return component; } private void RechargeRocket(GunslingerMissile rocket) { rechargeRocketTimer -= Time.deltaTime; if (!(rechargeRocketTimer > 0f)) { rechargeRocketTimer = 30f; rocket.ready = true; ((Component)rocket).gameObject.SetActive(true); missileToRecharge = null; } } private bool IsTransformNearGround(Transform toKillTransform) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(toKillTransform.position, Vector3.down); if (Physics.Raycast(val, 20f, StartOfRound.Instance.allPlayersCollideWithMask, (QueryTriggerInteraction)1)) { return true; } return false; } private void FindAndAimAtTarget() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) bool lockedOntoATransform = false; if ((Object)(object)lastTransformTargetted != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (!((Bounds)(ref bounds)).Contains(lastTransformTargetted.position) && !IsTransformNearGround(lastTransformTargetted) && !TransformInSafeBounds(lastTransformTargetted)) { HandleTargettingToTransform(lastTransformTargetted, ref lockedOntoATransform); goto IL_01a9; } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && val.isPlayerControlled && !val.isInHangarShipRoom && !val.isClimbingLadder && !IsTransformNearGround(((Component)val).transform) && !TransformInSafeBounds(((Component)val).transform)) { HandleTargettingToTransform(((Component)val).transform, ref lockedOntoATransform); } } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { RadMechAI val2 = (RadMechAI)(object)((spawnedEnemy is RadMechAI) ? spawnedEnemy : null); if (val2 != null && !((EnemyAI)val2).isEnemyDead && !((Object)(object)((EnemyAI)val2).creatureAnimator == (Object)null)) { Transform val3 = ((Component)((EnemyAI)val2).creatureAnimator).transform.Find("metarig"); if (!TransformInSafeBounds(val3)) { HandleTargettingToTransform(val3, ref lockedOntoATransform); } } } goto IL_01a9; IL_01a9: if (!lockedOntoATransform) { lastTransformTargetted = null; DetectPlayerAudioSound.volume = 0f; DetectPlayerFarAudioSound.volume = 0f; } } private bool TransformInSafeBounds(Transform toKillTransform) { foreach (GregBounds safeBound in safeBounds) { if (safeBound.BoundsContainTransform(toKillTransform)) { return true; } } return false; } private void HandleTargettingToTransform(Transform toKilltransform, ref bool lockedOntoATransform) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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) float num = Vector3.Distance(gregCannon.position, toKilltransform.position); Vector3 position = toKilltransform.position; Vector3 val = position - gregBase.position; float num2 = Vector3.Angle(gregBase.up, val); if (num <= detectionRange && num2 <= maxAngle && !Physics.Linecast(gregCannon.position, toKilltransform.position, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { lockedOntoATransform = true; if ((Object)(object)lastTransformTargetted == (Object)null) { GregSource.PlayOneShot(GregLockOnSound); } lastTransformTargetted = toKilltransform; DetectPlayerAudioSound.volume = 1f; DetectPlayerFarAudioSound.volume = 1f; Quaternion val2 = Quaternion.LookRotation(val); val2.z = 0f; val2.x = 0f; gregBase.rotation = Quaternion.RotateTowards(gregBase.rotation, val2, rotationSpeed * Time.deltaTime * 5f); Vector3 localEulerAngles = gregCannon.localEulerAngles; gregCannon.localEulerAngles = new Vector3(0f - (maxAngle - num2), localEulerAngles.y, localEulerAngles.z); } } private void FireProjectile() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lastTransformTargetted == (Object)null)) { if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 50f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } GregSource.PlayOneShot(GregFireSounds[Random.Range(0, GregFireSounds.Length)]); FarGregSource.PlayOneShot(FarGregFireSounds[Random.Range(0, FarGregFireSounds.Length)]); GunslingerMissile gunslingerMissile = rockets.Dequeue(); gunslingerMissile.Initialize(((Component)lastTransformTargetted).transform, this); } } } public class GunslingerMissile : MonoBehaviour { public float speed = 20f; public float curveStrength = 2f; private Transform _oldParent = null; [HideInInspector] public GunslingerGreg gregScript = null; [HideInInspector] public bool ready = false; [HideInInspector] public Transform mainTransform = null; private Collider[] _cachedColliders = (Collider[])(object)new Collider[8]; private Transform? _targetTransform = null; public void Initialize(Transform targetTransform, GunslingerGreg greg) { ready = false; _targetTransform = targetTransform; gregScript = greg; _oldParent = ((Component)this).transform.parent; ((Component)this).transform.SetParent((Transform)null); greg.rockets.Enqueue(this); PlayerControllerB val = default(PlayerControllerB); if (((Component)targetTransform).TryGetComponent(ref val) && !(val.currentlyHeldObjectServer is JetpackItem)) { curveStrength = 1f; } } public void FixedUpdate() { //IL_009c: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0382: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_targetTransform == (Object)null || (Object)(object)mainTransform == (Object)null) { if ((Object)(object)((Component)this).transform.parent == (Object)null && (Object)(object)mainTransform != (Object)null) { ((Component)this).transform.SetParent(_oldParent, true); ((Component)this).transform.SetPositionAndRotation(mainTransform.position, mainTransform.rotation); ((Component)this).gameObject.SetActive(false); } return; } float num = Vector3.Distance(((Component)this).transform.position, _targetTransform.position); if (num <= 0.5f) { if (((Component)_targetTransform).gameObject.layer == 19 && ((Object)_targetTransform).name == "metarig") { RadMechAI componentInParent = ((Component)_targetTransform).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { if (((NetworkBehaviour)componentInParent).IsOwner) { ((EnemyAI)componentInParent).KillEnemyOnOwnerClient(true); } GameObject val = Object.Instantiate(ContentHandler.Instance.GunslingerGreg.OldBirdExplosionPrefab, ((Component)this).transform.position, Quaternion.identity); Object.Destroy((Object)(object)val, 15f); } } CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 15, 0f, 4f, 6, null, null, 20f); if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 10f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } ((Component)this).transform.SetParent(_oldParent, true); ((Component)this).transform.SetPositionAndRotation(mainTransform.position, mainTransform.rotation); _targetTransform = null; ((Component)this).gameObject.SetActive(false); return; } int num2 = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 2f, _cachedColliders, MoreLayerMasks.CollidersAndRoomAndPlayersAndEnemiesAndTerrainAndVehicleMask, (QueryTriggerInteraction)1); if (num2 > 0) { if (num < 7.5f && ((Component)_targetTransform).gameObject.layer == 19 && ((Object)_targetTransform).name == "metarig") { RadMechAI componentInParent2 = ((Component)_targetTransform).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { if (((NetworkBehaviour)componentInParent2).IsOwner) { ((EnemyAI)componentInParent2).KillEnemyOnOwnerClient(true); } GameObject val2 = Object.Instantiate(ContentHandler.Instance.GunslingerGreg.OldBirdExplosionPrefab, ((Component)this).transform.position, Quaternion.identity); Object.Destroy((Object)(object)val2, 15f); } } CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 15, 0f, 4f, 6, null, null, 20f); if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 10f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } ((Component)this).transform.SetParent(_oldParent, true); ((Component)this).transform.SetPositionAndRotation(mainTransform.position, mainTransform.rotation); _targetTransform = null; ((Component)this).gameObject.SetActive(false); } else { Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * speed * Time.fixedDeltaTime; Vector3 val3 = _targetTransform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; val3 = Vector3.Lerp(((Component)this).transform.forward, normalized, curveStrength * Time.fixedDeltaTime); Vector3 normalized2 = ((Vector3)(ref val3)).normalized; ((Component)this).transform.forward = normalized2; } } } public class IndustrialFan : CodeRebirthHazard { public Transform fanTransform = null; public AudioSource cutAudioSource = null; public float rotationSpeed = 45f; public float pushForce = 15f; public float suctionForce = 15f; public ParticleSystem redMistEffect = null; public override void Start() { base.Start(); Plugin.ExtendedLogging("Industrial fan initialized"); } public void FixedUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) fanTransform.Rotate(Vector3.up, rotationSpeed * Time.fixedDeltaTime); } private void OnTriggerEnter(Collider other) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { SyncDeathRpc(PlayerControllerReference.op_Implicit(val)); cutAudioSource.Play(); val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)15, 9, default(Vector3), false); PlayRedMist(); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SyncDeathRpc(PlayerControllerReference player) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = PlayerControllerReference.op_Implicit(player); cutAudioSource.Play(); val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)15, 9, default(Vector3), false); PlayRedMist(); } public bool IsObstructed(Vector3 targetPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Physics.Linecast(targetPosition, fanTransform.position, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)1); } private void PlayRedMist() { redMistEffect.Play(); } } public class IndustrialFanBackCollider : MonoBehaviour { public IndustrialFan industrialFan = null; private void OnTriggerStay(Collider other) { //IL_002d: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (PlayerControllerBExtensions.IsLocalPlayer(component) && !industrialFan.IsObstructed(((Component)other).transform.position) && !(Vector3.Distance(((Component)other).transform.position, industrialFan.fanTransform.position) > 20f)) { Vector3 position = industrialFan.fanTransform.position; Vector3 val = position - ((Component)other).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = industrialFan.suctionForce * Time.fixedDeltaTime; if (Vector3.Distance(((Component)other).transform.position, position) > num) { Transform transform = ((Component)other).transform; transform.position += normalized * num; } else { ((Component)other).transform.position = position; } } } } public class IndustrialFanFrontCollider : MonoBehaviour { public IndustrialFan industrialFan = null; private void OnTriggerStay(Collider other) { //IL_002d: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (PlayerControllerBExtensions.IsLocalPlayer(component) && !industrialFan.IsObstructed(((Component)other).transform.position)) { float num = Vector3.Distance(((Component)other).transform.position, industrialFan.fanTransform.position); if (!(num > 20f)) { Vector3 val = ((Component)other).transform.position - industrialFan.fanTransform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((Component)other).transform.position + normalized * industrialFan.pushForce; float num2 = 1f - num / 20f; ((Component)other).transform.position = Vector3.Lerp(((Component)other).transform.position, val2, industrialFan.pushForce * num2 * Time.fixedDeltaTime); } } } } public class ItemCrate : CRHittable { public enum CrateType { Wooden, Metal, WoodenMimic, MetalMimic } [Header("Audio")] public AudioSource? slowlyOpeningSFX = null; public AudioSource openSFX = null; public UnityEvent onBurn = new UnityEvent(); public UnityEvent postBurn = new UnityEvent(); public SkinnedMeshRenderer skinnedMeshRenderer = null; public Material? transparentMaterial = null; public Material? mimicMaterial = null; public InteractTrigger? trigger = null; public Pickable? pickable = null; public Animator animator = null; private bool opened = false; private float digProgress = 0f; public int health = 4; public Vector3 originalPosition; public Random crateRandom = new Random(); public static List ShopItemList = new List(); public CrateType crateType; public Collider mainCollider = null; public GrabAndPullPlayer? grabAndPullPlayerScript = null; public GrabAndLaunchPlayer? grabAndLaunchPlayerScript = null; public static List Instances = new List(); private bool openedOnce = false; private float damageBurningTicks = 0.5f; internal bool burned = false; private bool isBurning = false; private static readonly int BurningHash = Animator.StringToHash("burning"); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); Transporter.objectsWithPriorityToTransport.Add(new GameObjectWithPriority(((Component)this).gameObject, 5)); if (crateType == CrateType.WoodenMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(2) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], transparentMaterial }); } else if (crateType == CrateType.MetalMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(3) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], ((Renderer)skinnedMeshRenderer).sharedMaterials[1], transparentMaterial }); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); Transporter.objectsWithPriorityToTransport.Remove(new GameObjectWithPriority(((Component)this).gameObject, 5)); } private void Start() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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) if ((Object)(object)grabAndPullPlayerScript != (Object)null) { ((Behaviour)grabAndPullPlayerScript).enabled = false; } if ((Object)(object)grabAndLaunchPlayerScript != (Object)null) { ((Behaviour)grabAndLaunchPlayerScript).enabled = false; } crateRandom = new Random(StartOfRound.Instance.randomMapSeed + CodeRebirthUtils.Instance.CRRandom.Next(100000)); digProgress = RandomExtensions.NextFloat(crateRandom, 0.01f, 0.1f); ((Component)this).transform.position = ((Component)this).transform.position + ((Component)this).transform.up * -0.6f; originalPosition = ((Component)this).transform.position; UpdateDigPosition(0f, digProgress); if (crateType == CrateType.Wooden || crateType == CrateType.WoodenMimic) { BoundedRange value = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Health").Value; health = crateRandom.Next((int)value.Min, (int)value.Max + 1); } if ((crateType == CrateType.Metal || crateType == CrateType.MetalMimic) && (Object)(object)trigger != (Object)null) { BoundedRange value2 = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Metal Safe | Hold Timer").Value; trigger.timeToHold = RandomExtensions.NextFloat(crateRandom, value2.Min, value2.Max); animator.SetFloat("openingSpeed", 11.875f / trigger.timeToHold); Plugin.ExtendedLogging("Crate time to hold: " + trigger.timeToHold); } if ((crateType != CrateType.Wooden && crateType != CrateType.WoodenMimic) || ShopItemList.Count != 0) { return; } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (ItemExtensions.HasDawnInfo(items)) { DawnItemInfo dawnInfo = ItemExtensions.GetDawnInfo(items); if (dawnInfo.ShopInfo != null && dawnInfo.ScrapInfo == null) { ShopItemList.Add(items); } } } } private void UpdateDigPosition(float old, float newValue) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (newValue == 0f) { originalPosition = ((Component)this).transform.position - ((Component)this).transform.up * 0.5f; } ((Component)this).transform.position = originalPosition + ((Component)this).transform.up * newValue * 0.5f; Plugin.ExtendedLogging($"ItemCrate was hit! New digProgress: {newValue}"); } private void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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) if (burned) { damageBurningTicks -= Time.deltaTime; if (isBurning && damageBurningTicks <= 0f) { damageBurningTicks = 0.5f; if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 5f) { GameNetworkManager.Instance.localPlayerController.DamagePlayer(5, true, true, (CauseOfDeath)13, 6, false, default(Vector3)); } } } else if ((crateType == CrateType.Metal || crateType == CrateType.MetalMimic) && !((Object)(object)trigger == (Object)null) && !((Object)(object)pickable == (Object)null)) { bool flag = digProgress >= 1f; trigger.interactable = flag && !pickable.IsLocked && !opened; ((Behaviour)pickable).enabled = flag && pickable.IsLocked && !opened; } } public void OnInteractEarly() { OnInteractEarlyServerRpc(); } [ServerRpc(RequireOwnership = false)] private void OnInteractEarlyServerRpc() { OnInteractEarlyClientRpc(); } [ClientRpc] private void OnInteractEarlyClientRpc() { AudioSource? obj = slowlyOpeningSFX; if (obj != null) { obj.Play(); } animator.SetBool("opening", true); } public void OnInteract(PlayerControllerB player) { if (!opened) { OpenCrateServerRpc(); } } public void OnInteractCancel() { OnInteractCancelServerRpc(); } [ServerRpc(RequireOwnership = false)] private void OnInteractCancelServerRpc() { OnInteractCancelClientRpc(); } [ClientRpc] private void OnInteractCancelClientRpc() { AudioSource? obj = slowlyOpeningSFX; if (obj != null) { obj.Stop(); } animator.SetBool("opening", false); } [ServerRpc(RequireOwnership = false)] public void OpenCrateServerRpc() { OpenCrate(); } public void OpenCrate() { //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: 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_02e4: Unknown result type (might be due to invalid IL or missing references) if (!openedOnce && crateType != CrateType.MetalMimic && crateType != CrateType.WoodenMimic) { int num = 3; if (crateType == CrateType.Metal) { BoundedRange value = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Metal Safe | Scrap Spawn Number").Value; num = Random.Range((int)value.Min, (int)value.Max + 1); } else if (crateType == CrateType.Wooden) { BoundedRange value2 = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Scrap Spawn Number").Value; num = Random.Range((int)value2.Min, (int)value2.Max + 1); } for (int i = 0; i < num; i++) { Item val = null; switch (crateType) { case CrateType.Metal: { string value3 = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Metal Safe | Blacklist").Value; bool value4 = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Metal Safe | Blacklist Or Whitelist").Value; string[] source = (from s in value3.Split(',') select s.Trim().ToLowerInvariant()).ToArray(); List list = new List(); foreach (SpawnableItemWithRarity item in RoundManager.Instance.currentLevel.spawnableScrap) { if (item.rarity > 0) { Plugin.ExtendedLogging("Moon's item pool: " + item.spawnableItem.itemName); if (value4 && !source.Contains(item.spawnableItem.itemName.ToLowerInvariant())) { list.Add(item); } else if (!value4 && source.Contains(item.spawnableItem.itemName.ToLowerInvariant())) { list.Add(item); } } } SpawnableItemWithRarity val2 = RandomExtensions.NextItem(crateRandom, (IList)list); val = val2.spawnableItem; break; } case CrateType.Wooden: val = GetRandomShopItem(); break; } if (!((Object)(object)val == (Object)null) && !((Object)(object)val.spawnPrefab == (Object)null)) { CodeRebirthUtils.Instance.SpawnScrap(val, ((Component)this).transform.position + Vector3.up + Vector3.right * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f) + Vector3.forward * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f)); } } } OpenCrateClientRpc(); } [ClientRpc] private void OpenCrateClientRpc() { OpenCrateLocally(); } public void OpenCrateLocally() { if (crateType == CrateType.WoodenMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(2) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], mimicMaterial }); } else if (crateType == CrateType.MetalMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(3) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], ((Renderer)skinnedMeshRenderer).sharedMaterials[1], mimicMaterial }); } AudioSource? obj = slowlyOpeningSFX; if (obj != null) { obj.Stop(); } if ((Object)(object)pickable != (Object)null && (Object)(object)trigger != (Object)null) { pickable.IsLocked = false; ((Behaviour)trigger).enabled = false; } openSFX.Play(); mainCollider.enabled = false; opened = true; openedOnce = true; if (crateType == CrateType.Metal || crateType == CrateType.MetalMimic) { animator.SetBool("opened", true); } else { animator.SetBool("opened", true); } animator.SetBool("opening", false); if ((Object)(object)grabAndPullPlayerScript != (Object)null) { ((Behaviour)grabAndPullPlayerScript).enabled = true; } if ((Object)(object)grabAndLaunchPlayerScript != (Object)null) { ((Behaviour)grabAndLaunchPlayerScript).enabled = true; } if (crateType == CrateType.WoodenMimic) { ((MonoBehaviour)this).StartCoroutine(ResetCrateManually()); } } private IEnumerator ResetCrateManually() { yield return (object)new WaitForSeconds(2f); if (health <= 0 || digProgress != 0f) { if ((Object)(object)grabAndLaunchPlayerScript != (Object)null) { ((Behaviour)grabAndLaunchPlayerScript).enabled = false; } ResetWoodenCrate(); } } [ServerRpc(RequireOwnership = false)] private void SetNewDigProgressServerRpc(float newDigProgress) { SetNewDigProgressClientRpc(newDigProgress); } [ClientRpc] private void SetNewDigProgressClientRpc(float newDigProgress) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, originalPosition + ((Component)this).transform.up * newDigProgress * 0.5f) > 0.5f) { digProgress = 1f; return; } UpdateDigPosition(digProgress, newDigProgress); digProgress = Mathf.Clamp01(newDigProgress); } [ServerRpc(RequireOwnership = false)] private void DamageCrateServerRpc(int damage) { DamageCrateClientRpc(damage); if (health - damage == -1) { OpenCrate(); } } [ClientRpc] private void DamageCrateClientRpc(int damage) { health -= damage; Plugin.ExtendedLogging("Crate health: " + health); } [ServerRpc(RequireOwnership = false)] public void DoBurningServerRpc() { int randomMimicScrapToSpawn = crateRandom.Next(0, 3); DoBurningClientRpc(randomMimicScrapToSpawn); SetNewDigProgressClientRpc(1f); } [ClientRpc] private void DoBurningClientRpc(int randomMimicScrapToSpawn) { ((MonoBehaviour)this).StartCoroutine(DoBurningLocal(randomMimicScrapToSpawn)); } private IEnumerator DoBurningLocal(int randomMimicScrapToSpawn) { if (crateType == CrateType.WoodenMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(2) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], mimicMaterial }); } else if (crateType == CrateType.MetalMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(3) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], ((Renderer)skinnedMeshRenderer).sharedMaterials[1], mimicMaterial }); } burned = true; isBurning = true; animator.SetBool(BurningHash, true); onBurn.Invoke(); yield return (object)new WaitForSeconds(12f); animator.SetBool(BurningHash, false); if (((NetworkBehaviour)this).IsServer) { if (crateType == CrateType.MetalMimic || crateType == CrateType.WoodenMimic) { NamespacedKey burnedScrapToSpawn = CodeRebirthItemKeys.BurntFleshArm; switch (randomMimicScrapToSpawn) { case 0: burnedScrapToSpawn = CodeRebirthItemKeys.BurntFleshArm; break; case 1: burnedScrapToSpawn = CodeRebirthItemKeys.BurntFleshEye; break; case 2: burnedScrapToSpawn = CodeRebirthItemKeys.BurntFleshTeeth; break; case 3: burnedScrapToSpawn = CodeRebirthItemKeys.BurntFleshTongue; break; } CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[burnedScrapToSpawn].Item, ((Component)this).transform.position + Vector3.up + Vector3.right * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f) + Vector3.forward * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f)); } else { CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.BurntRubble].Item, ((Component)this).transform.position + Vector3.up + Vector3.right * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f) + Vector3.forward * RandomExtensions.NextFloat(crateRandom, -0.25f, 0.25f)); } } isBurning = false; postBurn.Invoke(); } public override bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) if (opened || (Object)(object)playerWhoHit == (Object)null || burned) { return false; } if (hitID == 745737) { burned = true; DoBurningServerRpc(); return true; } bool flag = false; if (crateType == CrateType.Metal || crateType == CrateType.MetalMimic) { flag = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Metal Safe | Shovellin").Value; } else if (crateType == CrateType.Wooden || crateType == CrateType.WoodenMimic) { flag = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Shovellin").Value; } if ((Object)(object)playerWhoHit.currentlyHeldObjectServer == (Object)null && flag) { return false; } if (digProgress < 1f) { float num = RandomExtensions.NextFloat(crateRandom, 0.15f, 0.25f); SetNewDigProgressServerRpc(digProgress + num); } else if (crateType == CrateType.Wooden || crateType == CrateType.WoodenMimic) { DamageCrateServerRpc(1); } if (force == 22 || ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit.currentlyHeldObjectServer == (Object)null)) { playerWhoHit.DamagePlayer(5, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); } return true; } public Item GetRandomShopItem() { string value = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Blacklist").Value; bool flag = !((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Blacklist Or Whitelist").Value; string[] array = Array.Empty(); string[] array2 = Array.Empty(); List list = new List(); if (!flag) { array = (from s in value.Split(',') select s.Trim().ToLowerInvariant()).ToArray(); foreach (Item shopItem in ShopItemList) { Plugin.ExtendedLogging("Shop item: " + shopItem.itemName); if (!array.Contains(shopItem.itemName.ToLowerInvariant())) { list.Add(shopItem); } } } else { if (string.IsNullOrEmpty(value)) { ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Blacklist").Value = GenerateWhiteList(); value = ((AssetBundleLoader)(object)ContentHandler.Instance.Crate).GetConfig("Wooden Crate | Blacklist").Value; } array2 = (from s in value.Split(',') select s.Trim().ToLowerInvariant()).ToArray(); foreach (Item shopItem2 in ShopItemList) { if (array2.Contains(shopItem2.itemName.ToLowerInvariant())) { list.Add(shopItem2); } } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (array2.Contains(items.itemName.ToLowerInvariant())) { list.Add(items); } } } if (list.Count <= 0) { Plugin.Logger.LogError((object)"Acceptable items count is 0, check your wooden crate config to make sure its setup right."); return StartOfRound.Instance.allItemsList.itemsList[Random.Range(0, StartOfRound.Instance.allItemsList.itemsList.Count)]; } return list[Random.Range(0, list.Count)]; } public string GenerateWhiteList() { List list = new List(); foreach (Item shopItem in ShopItemList) { list.Add(shopItem.itemName.ToLowerInvariant()); } return string.Join(",", list); } public void OnTriggerEnter(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (opened && ((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.SafeAndSound); opened = false; CloseCrateOnPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)); } } [ServerRpc(RequireOwnership = false)] private void CloseCrateOnPlayerServerRpc(int playerIndex) { CloseCrateOnPlayerClientRpc(playerIndex); } [ClientRpc] private void CloseCrateOnPlayerClientRpc(int playerIndex) { CloseCrateOnPlayerLocally(playerIndex); } public void CloseCrateOnPlayerLocally(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; if (!PlayerControllerBExtensions.IsLocalPlayer(val)) { if ((Object)(object)pickable != (Object)null && (Object)(object)trigger != (Object)null) { pickable.IsLocked = true; ((Behaviour)trigger).enabled = true; } mainCollider.enabled = true; } openedOnce = true; opened = false; animator.SetBool("opened", false); if (crateType == CrateType.MetalMimic) { ((MonoBehaviour)this).StartCoroutine(DisableGrabPullThing(val)); ((MonoBehaviour)this).StartCoroutine(StartDamagingPlayer(val)); } else if (crateType == CrateType.WoodenMimic) { ((MonoBehaviour)this).StartCoroutine(DisableGrabLaunchThing()); } } private IEnumerator DisableGrabLaunchThing() { if ((Object)(object)grabAndLaunchPlayerScript != (Object)null) { ((Behaviour)grabAndLaunchPlayerScript).enabled = true; yield return (object)new WaitForSeconds(1.4f); ((Behaviour)grabAndLaunchPlayerScript).enabled = false; } } public void ResetWoodenCrate() { mainCollider.enabled = true; opened = false; health = 4; animator.SetBool("opened", false); UpdateDigPosition(digProgress, 0f); digProgress = Mathf.Clamp01(0f); if (crateType == CrateType.WoodenMimic) { ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(2) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], transparentMaterial }); } } private IEnumerator DisableGrabPullThing(PlayerControllerB player) { yield return (object)new WaitForSeconds(1.5f); if ((Object)(object)grabAndPullPlayerScript != (Object)null) { ((Behaviour)grabAndPullPlayerScript).enabled = false; player.Crouch(true); ((Component)player).transform.position = grabAndPullPlayerScript.pullTransform.position; } } private IEnumerator StartDamagingPlayer(PlayerControllerB player) { yield return (object)new WaitForSeconds(2f); while (!player.isPlayerDead && Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position) <= 4f) { yield return (object)new WaitForSeconds(2f); player.DamagePlayer(10, false, true, (CauseOfDeath)5, 0, false, default(Vector3)); player.Crouch(true); } ((Renderer)skinnedMeshRenderer).SetSharedMaterials(new List(3) { ((Renderer)skinnedMeshRenderer).sharedMaterials[0], ((Renderer)skinnedMeshRenderer).sharedMaterials[1], transparentMaterial }); } } public class JimothyNPC : NetworkBehaviour { [Header("References")] [SerializeField] private InteractTrigger _interactTrigger = null; [SerializeField] private Animator _jimothyAnimator = null; [SerializeField] private NetworkAnimator _jimothyNetworkAnimator = null; [Header("Timers")] [SerializeField] private float _minIdleTime = 10f; [SerializeField] private float _maxIdleTime = 20f; private float _idleTimer = 0f; private bool pickedUp = false; private bool playersNearby = false; private bool playersNearbyLastFrame = false; private static readonly int ThumbsUpAnimation = Animator.StringToHash("thumbsUp"); private static readonly int PickUpJimothyAnimation = Animator.StringToHash("pickUp"); private static readonly int GreetPlayersAnimation = Animator.StringToHash("greetPlayers"); private static readonly int RandomIdleAnimation = Animator.StringToHash("randomIdle"); private static readonly int IsTypingAnimation = Animator.StringToHash("isTyping"); public void Update() { if (((NetworkBehaviour)this).IsServer && pickedUp) { HandleCheckingNearbyPlayers(); HandleIdleAnimation(); } } private void HandleCheckingNearbyPlayers() { //IL_0046: 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) playersNearby = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && val.isPlayerControlled && !(Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > 5f)) { playersNearby = true; break; } } if (playersNearby != playersNearbyLastFrame && playersNearby) { _jimothyNetworkAnimator.SetTrigger(GreetPlayersAnimation, true); } playersNearbyLastFrame = playersNearby; } private void HandleIdleAnimation() { _idleTimer -= Time.deltaTime; if (!(_idleTimer > 0f)) { switch (Random.Range(0, 2)) { case 0: _jimothyAnimator.SetBool(IsTypingAnimation, true); ((MonoBehaviour)this).StartCoroutine(StopTypingWithDelay()); break; case 1: _jimothyNetworkAnimator.SetTrigger(RandomIdleAnimation, true); break; } _idleTimer = Random.Range(_minIdleTime, _maxIdleTime); } } private IEnumerator StopTypingWithDelay() { yield return (object)new WaitForSeconds(15f); _jimothyAnimator.SetBool(IsTypingAnimation, false); } public void PickupFallenJimothy(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { PickupFallenJimothyServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PickupFallenJimothyServerRpc() { _jimothyNetworkAnimator.SetTrigger(PickUpJimothyAnimation, true); pickedUp = true; DisableInteractTriggerClientRpc(); _idleTimer = Random.Range(_minIdleTime, _maxIdleTime); } [ClientRpc] private void DisableInteractTriggerClientRpc() { _interactTrigger.interactable = false; } public void PlayerUsedSallyButton() { _jimothyNetworkAnimator.SetTrigger(ThumbsUpAnimation, true); } } [RequireComponent(typeof(NavMeshAgent))] [RequireComponent(typeof(NetworkTransform))] public class KamikazeJimothy : NetworkBehaviour { [SerializeField] private UnityEvent _onJimFix = new UnityEvent(); [SerializeField] private Animator _animator = null; [SerializeField] private AnimationClip _jimFixAnimation = null; [SerializeField] private NavMeshAgent _agent = null; [SerializeField] private Renderer[] _renderers = Array.Empty(); [SerializeField] private InteractTrigger _headTrigger = null; private Coroutine? _feedingRoutine = null; private List _grabbablesValues = new List(); private static readonly int AssembleHeadAnimationHash = Animator.StringToHash("assembleHead"); private void Start() { ((UnityEvent)(object)_headTrigger.onInteract).AddListener((UnityAction)PlaceHeadTrigger); } private void PlaceHeadTrigger(PlayerControllerB playerControllerB) { if (PlayerControllerBExtensions.IsLocalPlayer(playerControllerB) && !((Object)(object)playerControllerB.currentlyHeldObjectServer == (Object)null) && playerControllerB.currentlyHeldObjectServer is JimBall) { playerControllerB.DespawnHeldObject(); PlaceHeadOnJimothyServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PlaceHeadOnJimothyServerRpc() { PlaceHeadOnJimothyClientRpc(); ((MonoBehaviour)this).StartCoroutine(AnimationDelay()); } private IEnumerator AnimationDelay() { GrabbableObject[] array = ((Component)((Component)this).transform).GetComponentsInChildren().ToArray(); foreach (GrabbableObject grabbableObject in array) { _grabbablesValues.Add(grabbableObject.scrapValue); ((NetworkBehaviour)grabbableObject).NetworkObject.Despawn(true); } yield return (object)new WaitForSeconds(_jimFixAnimation.length + 1f); ((Behaviour)_agent).enabled = true; } [ClientRpc] private void PlaceHeadOnJimothyClientRpc() { _animator.SetTrigger(AssembleHeadAnimationHash); _onJimFix.Invoke(); ((Behaviour)_headTrigger).enabled = false; } public void Update() { //IL_003d: 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) if (((Behaviour)_agent).enabled && !((Object)(object)NetworkSingleton.Instance == (Object)null) && _feedingRoutine == null) { _agent.SetDestination(NetworkSingleton.Instance.shreddingPoint.position); if (Vector3.Distance(((Component)this).transform.position, ((Component)NetworkSingleton.Instance.shreddingPoint).transform.position) < 1f + _agent.stoppingDistance) { _feedingRoutine = ((MonoBehaviour)this).StartCoroutine(FeedTheShredder()); } } } public IEnumerator FeedTheShredder() { Renderer[] renderers = _renderers; foreach (Renderer renderer in renderers) { renderer.enabled = false; } if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 30f) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Banzai); } if (!((NetworkBehaviour)this).IsServer) { yield break; } foreach (int grabbableObjectValue in _grabbablesValues) { NetworkSingleton.Instance.TryFeedItemServerRpc(playerDeath: false, grabbableObjectValue); yield return (object)new WaitForSeconds(0.2f); } ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public class KillAndCompactPlayer : MonoBehaviour { public CompactorToby toby = null; public void OnTriggerEnter(Collider other) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00d1: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_013c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (!((Component)other).TryGetComponent(ref val) || !PlayerControllerBExtensions.IsLocalPlayer(val)) { return; } if (toby.compacting) { val.KillPlayer(((Component)val).transform.position, true, (CauseOfDeath)8, 0, default(Vector3), false); return; } GrabbableObject[] itemSlots = val.ItemSlots; List list = new List(); int num = 0; GrabbableObject[] array = itemSlots; foreach (GrabbableObject val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.itemProperties == (Object)null)) { list.Add(((Component)val2).transform.position); num += val2.scrapValue; } } val.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); GrabbableObject[] array2 = itemSlots; foreach (GrabbableObject val3 in array2) { if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3.itemProperties == (Object)null)) { toby.DespawnItemServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)val3)); } } val.KillPlayer(((Component)val).transform.position, false, (CauseOfDeath)8, 0, default(Vector3), false); Vector3 randomPosition = list[Random.Range(0, list.Count)]; toby.TryCompactItemServerRpc(randomPosition, num, PlayerControllerReference.op_Implicit(val), fast: true); } } public class KillAndShredPlayer : MonoBehaviour { public ShreddingSarah sarah = null; public void OnTriggerEnter(Collider other) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { val.KillPlayer(((Component)val).transform.position, false, (CauseOfDeath)8, 0, default(Vector3), false); sarah.TryFeedItemServerRpc(playerDeath: true, 10); } } } public class LaserTurret : CodeRebirthHazard { public Transform turretTransform = null; public Transform laserStartPoint = null; public VisualEffect visualEffect = null; public float rotationSpeed = 45f; public float laserRange = 50f; public float laserDamage = 3f; public float laserThickness = 0.5f; public ParticleSystem ashParticle = null; public AudioSource impactAudioSource = null; private float originalImpactPositionZ = 1f; private float originalParticlesVelocityZ = 1f; private float originalDarkBeamScaleY = 1f; private float originalElectricBeamScaleY = 1f; private float originalBeamCoreScaleY = 1f; private bool isFiring = false; private float damageTimer = 0f; private static readonly int ImpactPosition = Shader.PropertyToID("ImpactPosition"); private static readonly int ParticlesVelocity = Shader.PropertyToID("ParticlesVelocity"); private static readonly int DarkBeamScale = Shader.PropertyToID("DarkBeamScale"); private static readonly int ElectricBeamScale = Shader.PropertyToID("ElectricBeamScale"); private static readonly int BeamCoreScale = Shader.PropertyToID("BeamCoreScale"); public override void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) base.Start(); Plugin.ExtendedLogging("Laser Turret initialized"); visualEffect.Play(); originalImpactPositionZ = visualEffect.GetVector3(ImpactPosition).z; originalParticlesVelocityZ = visualEffect.GetVector3(ParticlesVelocity).z; originalDarkBeamScaleY = visualEffect.GetVector3(DarkBeamScale).y; originalElectricBeamScaleY = visualEffect.GetVector3(ElectricBeamScale).y; originalBeamCoreScaleY = visualEffect.GetVector3(BeamCoreScale).y; } public void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) UpdateAudio(); turretTransform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime); FireLaser(); } private void UpdateAudio() { impactAudioSource.volume = Plugin.ModConfig.ConfigLaserTurretVolume.Value; } private void FireLaser() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = laserStartPoint.forward; RaycastHit val = default(RaycastHit); if (Physics.SphereCast(laserStartPoint.position, laserThickness / 2f, forward, ref val, laserRange, MoreLayerMasks.CollidersAndRoomAndPlayersAndInteractableMask, (QueryTriggerInteraction)1)) { PlayerControllerB val2 = default(PlayerControllerB); if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 3 && ((Component)((RaycastHit)(ref val)).collider).TryGetComponent(ref val2) && val2.isCrouching && ((Component)val2.gameplayCamera).transform.position.y + laserThickness < laserStartPoint.position.y) { Vector3 val3 = ((RaycastHit)(ref val)).point + forward * 0.01f; RaycastHit val4 = default(RaycastHit); if (!Physics.SphereCast(val3, laserThickness / 2f, forward, ref val4, laserRange - ((RaycastHit)(ref val)).distance, MoreLayerMasks.CollidersAndRoomAndPlayersAndInteractableMask, (QueryTriggerInteraction)1)) { UpdateLaserVisuals(((RaycastHit)(ref val)).point - forward * 1.912f); return; } val = val4; } UpdateLaserVisuals(((RaycastHit)(ref val)).point - forward * 1.912f); PlayerControllerB val5 = default(PlayerControllerB); if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer != 3 || !((Component)((RaycastHit)(ref val)).collider).TryGetComponent(ref val5)) { return; } damageTimer -= Time.deltaTime; if (damageTimer <= 0f && val5.playerSteamId != 76561199094139351L) { if ((float)val5.health <= laserDamage) { val5.KillPlayer(default(Vector3), !Plugin.ModConfig.ConfigHazardsDeleteBodies.Value, (CauseOfDeath)13, 0, default(Vector3), false); SpawnAshParticle(((Component)val5).transform.position); } else { val5.DamagePlayer((int)laserDamage * ((val5.playerSteamId != 9) ? 1 : 2), true, true, (CauseOfDeath)13, 6, false, default(Vector3)); } damageTimer = 0.1f; } } else if (isFiring) { isFiring = false; } } private void UpdateLaserVisuals(Vector3 laserEndPoint) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(laserStartPoint.position, laserEndPoint) / 5f; Vector3 vector = visualEffect.GetVector3(BeamCoreScale); vector.y = originalBeamCoreScaleY * num; Vector3 vector2 = visualEffect.GetVector3(ElectricBeamScale); vector2.y = originalElectricBeamScaleY * num; Vector3 vector3 = visualEffect.GetVector3(DarkBeamScale); vector3.y = originalDarkBeamScaleY * num; Vector3 vector4 = visualEffect.GetVector3(ParticlesVelocity); vector4.z = originalParticlesVelocityZ * num; Vector3 vector5 = visualEffect.GetVector3(ImpactPosition); vector5.z = originalImpactPositionZ * num; visualEffect.SetVector3(ImpactPosition, vector5); visualEffect.SetVector3(ParticlesVelocity, vector4); visualEffect.SetVector3(DarkBeamScale, vector3); visualEffect.SetVector3(ElectricBeamScale, vector2); visualEffect.SetVector3(BeamCoreScale, vector); ((Component)impactAudioSource).transform.position = laserEndPoint; if (!isFiring) { isFiring = true; } } private void SpawnAshParticle(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(ashParticle, position, Quaternion.identity).Play(); } } public class Merchant : NetworkBehaviour { public Animator merchantAnimator = null; [SerializeField] public List merchantBarrelPrefabs = new List(); [SerializeField] public List merchantBarrelSpawns = new List(); [SerializeField] public BugleBoy bugleBoy = null; [SerializeField] public MerchantTipPad tipPad = null; [SerializeField] public AnimationClip PurchaseAnimation = null; [SerializeField] public AnimationClip StealAnimation = null; internal Random storeSeededRandom = new Random(); private Dictionary itemsOnSale = new Dictionary(); private static readonly int IdleRandomHash = Animator.StringToHash("idleRandom"); private static readonly int RerollHash = Animator.StringToHash("reroll"); private static readonly int StealHash = Animator.StringToHash("steal"); private static readonly int PurchaseHash = Animator.StringToHash("purchase"); private static readonly int ActivatedHash = Animator.StringToHash("activated"); private int itemsDeleted = 0; private int itemsSpawned = 0; private bool previouslyActivated = false; internal List existingMerchantBarrels = new List(); public void Start() { storeSeededRandom = new Random(StartOfRound.Instance.randomMapSeed + 37325); if ((Object)(object)NetworkSingleton.Instance == (Object)null || NetworkSingleton.Instance.MoneyStored() < 0) { DeclareShopClosed(); } if (((NetworkBehaviour)this).IsServer) { PopulateItemsWithRarityList(); } } [ServerRpc(RequireOwnership = false)] internal void RerollServerRpc() { RerollClientRpc(); } [ClientRpc] private void RerollClientRpc() { bugleBoy.animator.SetBool(BugleBoy.ActivatedHash, true); bugleBoy.bugleSource.PlayOneShot(bugleBoy.StartBugleSound); merchantAnimator.SetTrigger(RerollHash); if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(2); } foreach (MerchantBarrel existingMerchantBarrel in existingMerchantBarrels) { if ((Object)(object)existingMerchantBarrel.currentlySpawnedGrabbableObject != (Object)null) { existingMerchantBarrel.currentlySpawnedGrabbableObject.grabbable = false; } } ((MonoBehaviour)this).StartCoroutine(FixMissedItems()); } private IEnumerator FixMissedItems() { yield return (object)new WaitForSeconds(6f); yield return (object)new WaitUntil((Func)(() => itemsDeleted == itemsSpawned)); for (int i = itemsSpawned; i < existingMerchantBarrels.Count; i++) { MerchantBarrel merchantBarrel = existingMerchantBarrels[i]; if ((Object)(object)merchantBarrel.currentlySpawnedGrabbableObject != (Object)null) { merchantBarrel.currentlySpawnedGrabbableObject.grabbable = true; } } itemsDeleted = 0; itemsSpawned = 0; } public void DeleteItemsAtBarrel(int barrelRef) { itemsDeleted++; if (((NetworkBehaviour)this).IsServer) { MerchantBarrel merchantBarrel = existingMerchantBarrels[barrelRef]; if (!((Object)(object)merchantBarrel.currentlySpawnedGrabbableObject == (Object)null)) { ((NetworkBehaviour)merchantBarrel.currentlySpawnedGrabbableObject).NetworkObject.Despawn(true); } } } public void SpawnItemAtBarrel(int barrelRef) { itemsSpawned++; if (((NetworkBehaviour)this).IsServer) { MerchantBarrel merchantBarrel = existingMerchantBarrels[barrelRef]; HandleSpawningMerchantItems(merchantBarrel); } } public void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 30f * (previouslyActivated ? 1.5f : 1f)) { flag = true; break; } } if (flag != previouslyActivated) { merchantAnimator.SetBool(ActivatedHash, flag); } previouslyActivated = flag; for (int num = itemsOnSale.Count - 1; num >= 0; num--) { GrabbableObject key = itemsOnSale.ElementAt(num).Key; int value = itemsOnSale.ElementAt(num).Value; if (key.isHeld && (Object)(object)key.playerHeldBy != (Object)null) { itemsOnSale.Remove(key); foreach (MerchantBarrel existingMerchantBarrel in existingMerchantBarrels) { if ((Object)(object)existingMerchantBarrel.currentlySpawnedGrabbableObject == (Object)(object)key) { existingMerchantBarrel.currentlySpawnedGrabbableObject = null; } } key.customGrabTooltip = ""; if (EnoughMoneySlotted(value)) { ((MonoBehaviour)this).StartCoroutine(PayUpBoy(value)); if (PlayerControllerBExtensions.IsLocalPlayer(key.playerHeldBy)) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Capitalism); } if (itemsOnSale.Count <= 0) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.OutOfStock); } } else { Steal(value); } } } } private bool EnoughMoneySlotted(int itemCost) { if ((Object)(object)NetworkSingleton.Instance == (Object)null) { return false; } if (NetworkSingleton.Instance.MoneyStored() < itemCost) { return false; } return true; } private IEnumerator PayUpBoy(int itemCost) { if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(itemCost); } foreach (var (grabbableObject, price) in itemsOnSale) { SetupGrabbableTooltip(grabbableObject, price); } foreach (GrabbableObject grabbableObject2 in itemsOnSale.Keys) { grabbableObject2.grabbable = false; } merchantAnimator.SetTrigger(PurchaseHash); yield return (object)new WaitForSeconds(PurchaseAnimation.length); foreach (GrabbableObject grabbableObject3 in itemsOnSale.Keys) { grabbableObject3.grabbable = true; } } private void Steal(int priceOfStolenItem) { foreach (GrabbableObject key in itemsOnSale.Keys) { key.grabbable = false; } bugleBoy.DisableSelf(); tipPad.CloseDonations(); merchantAnimator.SetTrigger(StealHash); if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(priceOfStolenItem * 2); } } public void PopulateItemsWithRarityList() { //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); CRUnlockableUpgradeScrap cRUnlockableUpgradeScrap = default(CRUnlockableUpgradeScrap); DawnUnlockableItemInfo val = default(DawnUnlockableItemInfo); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (!((Object)(object)items.spawnPrefab != (Object)null) || !items.spawnPrefab.TryGetComponent(ref cRUnlockableUpgradeScrap) || (((DuskContentReference)(object)((UnlockableUpgradeScrap)cRUnlockableUpgradeScrap).UnlockableReference).TryResolve(ref val) && val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() is FailedPurchaseResult)) { Plugin.ExtendedLogging("Item: " + items.itemName); string key = items.itemName.ToLowerInvariant().Trim(); if (!dictionary.TryAdd(key, items)) { Plugin.ExtendedLogging("Previous item was a duplicate"); } } } for (int i = 0; i < merchantBarrelPrefabs.Count; i++) { MerchantBarrel merchantBarrel = Object.Instantiate(merchantBarrelPrefabs[i], merchantBarrelSpawns[i]); ((Component)merchantBarrel).GetComponent().Spawn(true); existingMerchantBarrels.Add(merchantBarrel); foreach (ItemWithRarityAndColor item in merchantBarrel.itemNamesWithRarityAndColor) { string itemName = item.itemName; float rarity = item.rarity; int num = item.minPrice; int maxPrice = item.maxPrice; Color borderColor = item.borderColor; Color textColor = item.textColor; if (num > maxPrice) { num = maxPrice; } string text = itemName.ToLowerInvariant().Trim(); Item value; if (text == "vanilla") { Plugin.ExtendedLogging("Merchant item: " + itemName); Plugin.ExtendedLogging($"Merchant item rarity: {rarity}"); Plugin.ExtendedLogging($"Merchant item min price: {num}"); Plugin.ExtendedLogging($"Merchant item max price: {maxPrice}"); Plugin.ExtendedLogging($"Merchant item border color: {borderColor}"); Plugin.ExtendedLogging($"Merchant item text color: {textColor}"); merchantBarrel.validItemsWithRarityAndColor.Add(new RealItemWithRarityAndColor(null, rarity, num, maxPrice, borderColor, textColor)); } else if (dictionary.TryGetValue(text, out value)) { Plugin.ExtendedLogging("Merchant item: " + itemName); Plugin.ExtendedLogging($"Merchant item rarity: {rarity}"); Plugin.ExtendedLogging($"Merchant item price: {num}"); Plugin.ExtendedLogging($"Merchant item max price: {maxPrice}"); Plugin.ExtendedLogging($"Merchant item border color: {borderColor}"); Plugin.ExtendedLogging($"Merchant item text color: {textColor}"); Plugin.ExtendedLogging("Comparable item: " + value.itemName + "\n"); merchantBarrel.validItemsWithRarityAndColor.Add(new RealItemWithRarityAndColor(value, rarity, num, maxPrice, borderColor, textColor)); } } HandleSpawningMerchantItems(merchantBarrel); } } public unsafe void HandleSpawningMerchantItems(MerchantBarrel merchantBarrel) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)NetworkSingleton.Instance == (Object)null || NetworkSingleton.Instance.MoneyStored() < 0) { return; } Vector3 position = merchantBarrel.barrelSpawnPoint.position; if (merchantBarrel.validItemsWithRarityAndColor == null || merchantBarrel.validItemsWithRarityAndColor.Count == 0) { Plugin.ExtendedLogging("No valid items for barrel " + ((Object)((Component)merchantBarrel).gameObject).name); return; } RealItemWithRarityAndColor realItemWithRarityAndColor = CRUtilities.ChooseRandomWeightedType(merchantBarrel.validItemsWithRarityAndColor.Select((RealItemWithRarityAndColor x) => (x: x, rarity: x.rarity))); if ((Object)(object)realItemWithRarityAndColor.item == (Object)null) { Vector3 val = position; Plugin.ExtendedLogging("Item selection failed for barrel at " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString() + "Assuming Random item"); Item randomVanillaItem = GetRandomVanillaItem(excludeShopItems: false, storeSeededRandom); realItemWithRarityAndColor.item = randomVanillaItem; } GameObject val2 = NetworkObjectReference.op_Implicit(CodeRebirthUtils.Instance.SpawnScrap(realItemWithRarityAndColor.item, position)); GrabbableObject component = val2.GetComponent(); SyncGrabbableObjectScanStuffServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)component), new NetworkBehaviourReference((NetworkBehaviour)(object)merchantBarrel), Random.Range(realItemWithRarityAndColor.minPrice, realItemWithRarityAndColor.maxPrice + 1), realItemWithRarityAndColor.borderColor.r, realItemWithRarityAndColor.borderColor.g, realItemWithRarityAndColor.borderColor.b, realItemWithRarityAndColor.textColor.r, realItemWithRarityAndColor.textColor.g, realItemWithRarityAndColor.textColor.b); } public static Item GetRandomVanillaItem(bool excludeShopItems, Random? storeSeededRandom = null) { if (storeSeededRandom == null) { storeSeededRandom = new Random(Random.Range(0, 1000000)); } List list = ((Registry)(object)LethalContent.Items).Values.Where((DawnItemInfo x) => ((DawnBaseInfo)(object)x).Key.IsVanilla()).ToList(); if (excludeShopItems) { list = list.Where((DawnItemInfo x) => x.ScrapInfo != null && x.ShopInfo == null).ToList(); } int index = storeSeededRandom.Next(0, list.Count); return list[index].Item; } [ServerRpc(RequireOwnership = false)] public void SyncGrabbableObjectScanStuffServerRpc(NetworkBehaviourReference grabbableObject, NetworkBehaviourReference barrelRef, int price, float borderColorR, float borderColorG, float borderColorB, float textColorR, float textColorG, float textColorB) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) SyncGrabbableObjectScanStuffClientRpc(grabbableObject, barrelRef, price, borderColorR, borderColorG, borderColorB, textColorR, textColorG, textColorB); } [ClientRpc] public void SyncGrabbableObjectScanStuffClientRpc(NetworkBehaviourReference grabbableObjectRef, NetworkBehaviourReference barrelRef, int price, float borderColorR, float borderColorG, float borderColorB, float textColorR, float textColorG, float textColorB) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) GrabbableObject val = (GrabbableObject)NetworkBehaviourReference.op_Implicit(grabbableObjectRef); val.grabbable = true; SetupGrabbableTooltip(val, price); itemsOnSale.Add(val, price); MerchantBarrel merchantBarrel = (MerchantBarrel)(object)NetworkBehaviourReference.op_Implicit(barrelRef); merchantBarrel.currentlySpawnedGrabbableObject = val; ((TMP_Text)merchantBarrel.textMeshPro1).text = price.ToString(); ((TMP_Text)merchantBarrel.textMeshPro2).text = price.ToString(); ForceScanColorOnItem val2 = ((Component)val).gameObject.AddComponent(); val2.grabbableObject = val; val2.borderColor = new Color(borderColorR, borderColorG, borderColorB, 1f); val2.textColor = new Color(textColorR, textColorG, textColorB, 1f); } private void SetupGrabbableTooltip(GrabbableObject grabbableObject, int itemCost) { if ((Object)(object)NetworkSingleton.Instance == (Object)null || NetworkSingleton.Instance.MoneyStored() < itemCost) { grabbableObject.customGrabTooltip = "You don't have enough money to buy this, stealing is not recommended."; } else { grabbableObject.customGrabTooltip = "You can buy this for " + itemCost + " coins."; } } public void DeclareShopClosed() { bugleBoy.DisableSelf(); tipPad.CloseDonations(); merchantAnimator.SetBool(ActivatedHash, true); merchantAnimator.SetTrigger(StealHash); } } public class MerchantBarrel : NetworkBehaviour { [SerializeField] public List itemNamesWithRarityAndColor = new List(); public TextMeshPro textMeshPro1 = null; public TextMeshPro textMeshPro2 = null; public Transform barrelSpawnPoint = null; [HideInInspector] public List validItemsWithRarityAndColor = new List(); [HideInInspector] public GrabbableObject? currentlySpawnedGrabbableObject = null; public void Start() { CoinDisplayUI.PointsOfInterest.Add(((Component)this).transform); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); CoinDisplayUI.PointsOfInterest.Remove(((Component)this).transform); } } public class MerchantTipPad : NetworkBehaviour { [CompilerGenerated] private static class <>O { public static Manipulator <0>__UseTippedAmountToInfluenceQuota; public static hook_SetNewProfitQuota <1>__ResetTippedAmount; } private bool shopClosed = false; public static int _tippedAmount; [field: SerializeField] public InteractTrigger[] TipTriggers { get; private set; } = Array.Empty(); [field: SerializeField] public InteractTrigger TipJarTrigger { get; private set; } [field: SerializeField] public GameObject[] ObjectsToEnableOnDonationAmounts { get; private set; } = Array.Empty(); [field: SerializeField] public AudioSource TippingSource { get; private set; } [field: SerializeField] public AudioClip TippingSound { get; private set; } internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__UseTippedAmountToInfluenceQuota; if (obj == null) { Manipulator val = UseTippedAmountToInfluenceQuota; <>O.<0>__UseTippedAmountToInfluenceQuota = val; obj = (object)val; } TimeOfDay.SetNewProfitQuota += (Manipulator)obj; object obj2 = <>O.<1>__ResetTippedAmount; if (obj2 == null) { hook_SetNewProfitQuota val2 = ResetTippedAmount; <>O.<1>__ResetTippedAmount = val2; obj2 = (object)val2; } TimeOfDay.SetNewProfitQuota += (hook_SetNewProfitQuota)obj2; } private static void ResetTippedAmount(orig_SetNewProfitQuota orig, TimeOfDay self) { _tippedAmount = Mathf.Clamp(_tippedAmount, 0, 100); orig.Invoke(self); _tippedAmount = 0; } private static void UseTippedAmountToInfluenceQuota(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[5] { (Instruction cursor) => ILPatternMatchingExt.MatchLdstr(cursor, "Randomizer amount after: {0}"), (Instruction cursor) => ILPatternMatchingExt.MatchLdloc(cursor, 1), (Instruction cursor) => ILPatternMatchingExt.MatchBox(cursor), (Instruction cursor) => ILPatternMatchingExt.MatchCall(cursor, "Format"), (Instruction cursor) => ILPatternMatchingExt.MatchCall(cursor, "Log") })) { Plugin.Logger.LogWarning((object)"Couldn't find the original code for TimeOfDay.SetNewProfitQuota, skipping IL patching."); return; } val.Emit(OpCodes.Ldloc_1); val.Emit(OpCodes.Ldc_R4, 1f); val.Emit(OpCodes.Ldc_R4, 1.3f); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(MerchantTipPad), "GetTippedAmount", (Type[])null, (Type[])null)); val.Emit(OpCodes.Ldc_R4, 100f); val.Emit(OpCodes.Div); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Mathf), "Lerp", new Type[3] { typeof(float), typeof(float), typeof(float) }, (Type[])null)); val.Emit(OpCodes.Div); val.Emit(OpCodes.Stloc_1); } public void Awake() { InteractTrigger[] tipTriggers = TipTriggers; foreach (InteractTrigger val in tipTriggers) { val.interactable = false; } ToggleDonationObjects(); } public void Start() { CoinDisplayUI.PointsOfInterest.Add(((Component)this).transform); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); CoinDisplayUI.PointsOfInterest.Remove(((Component)this).transform); } public void CloseDonations() { shopClosed = true; InteractTrigger[] tipTriggers = TipTriggers; foreach (InteractTrigger val in tipTriggers) { val.interactable = false; val.disabledHoverTip = "Shop closed"; } } public void Update() { if (!((Object)(object)NetworkSingleton.Instance == (Object)null) && !shopClosed) { TipTriggers[0].interactable = NetworkSingleton.Instance.MoneyStored() >= 1; TipTriggers[1].interactable = NetworkSingleton.Instance.MoneyStored() >= 5; TipTriggers[2].interactable = NetworkSingleton.Instance.MoneyStored() >= 10; } } public void ToggleDonationObjects() { TippingSource.PlayOneShot(TippingSound); if (_tippedAmount <= 24) { ObjectsToEnableOnDonationAmounts[0].SetActive(true); } if (_tippedAmount >= 25) { ObjectsToEnableOnDonationAmounts[1].SetActive(true); } if (_tippedAmount >= 50) { ObjectsToEnableOnDonationAmounts[2].SetActive(true); } if (_tippedAmount >= 75) { ObjectsToEnableOnDonationAmounts[3].SetActive(true); } TipJarTrigger.disabledHoverTip = $"Coins Tipped: {_tippedAmount}"; } public void Tip1Coin() { if (!((Object)(object)NetworkSingleton.Instance == (Object)null) && NetworkSingleton.Instance.MoneyStored() >= 1) { if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(1); } _tippedAmount++; ToggleDonationObjects(); } } public void Tip5Coins() { if (!((Object)(object)NetworkSingleton.Instance == (Object)null) && NetworkSingleton.Instance.MoneyStored() >= 5) { if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(5); } _tippedAmount += 5; ToggleDonationObjects(); } } public void Tip10Coins() { if (!((Object)(object)NetworkSingleton.Instance == (Object)null) && NetworkSingleton.Instance.MoneyStored() >= 10) { if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.RemoveMoney(10); } _tippedAmount += 10; ToggleDonationObjects(); } } public static float GetTippedAmount() { return _tippedAmount; } } public class Money : GrabbableObject { [SerializeField] private BoundedRange _valueRange = new BoundedRange(1f, 1f); [SerializeField] private ParticleSystem _moneyParticles; [SerializeField] private AudioSource _moneySource; [SerializeField] private AudioClip _collectSound; [SerializeField] private OwnerNetworkAnimator? _ownerNetworkAnimator; private PlayerControllerB previouslyHeldByPlayer; private int _value; private static int _coinsSpawned = 0; private static readonly int FlipHash = Animator.StringToHash("flip"); private static readonly NamespacedKey CoinMesageKey = NamespacedKey.From("code_rebirth", "coin_ever_flicked"); private static void DisplayCoinMessage() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (!((DataContainer)DawnLib.GetCurrentContract()).GetOrSetDefault(CoinMesageKey, false)) { ((DataContainer)DawnLib.GetCurrentContract()).Set(CoinMesageKey, true); HUDManagerExtensions.DisplayTip(HUDManager.Instance, new HUDDisplayTip("Error - TP Failed", "Denomination Analyser not located.\nPlease purchase one from the ship terminal to store currency.", (AlertType)0)); } } public void Awake() { _value = (int)_valueRange.GetRandomInRange(new Random(StartOfRound.Instance.randomMapSeed + _coinsSpawned)); _coinsSpawned++; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); base.playerHeldBy.activatingItem = true; previouslyHeldByPlayer = base.playerHeldBy; if ((Object)(object)_ownerNetworkAnimator != (Object)null) { if (((NetworkBehaviour)this).IsOwner) { ((NetworkAnimator)_ownerNetworkAnimator).SetTrigger(FlipHash, true); } } else { TryCollectCoin(); } } public void TryCollectCoin() { previouslyHeldByPlayer.activatingItem = false; if ((Object)(object)NetworkSingleton.Instance == (Object)null) { DisplayCoinMessage(); return; } ((Component)_moneyParticles).transform.SetParent((Transform)null, true); _moneyParticles.Play(); _moneySource.PlayOneShot(_collectSound); if (((NetworkBehaviour)this).IsServer) { NetworkSingleton.Instance.AddMoney(_value); } if (((NetworkBehaviour)this).IsOwner) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.OhAPenny); ((MonoBehaviour)this).StartCoroutine(DestroyItemAfterDelay()); } } private IEnumerator DestroyItemAfterDelay() { yield return (object)new WaitForSeconds(0.1f); if (Object.op_Implicit((Object)(object)base.playerHeldBy) && (base.isHeld || base.isPocketed)) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } else { DespawnItemServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void DespawnItemServerRpc() { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public class OxydeCrane : NetworkBehaviour { public GameObject shipNavColliders = null; public Vector3 endPosition = Vector3.zero; public Quaternion endRotation = Quaternion.identity; public Animator craneAnimator = null; public Animator leverAnimator = null; public InteractTrigger dropButton = null; private string previousDisabledTriggerMessage = ""; private bool alreadyDropped = false; private static readonly int StartAnimation = Animator.StringToHash("startAnimation"); private static readonly int MoveBackAnimation = Animator.StringToHash("MoveBack"); private static readonly int PullLeverAnimation = Animator.StringToHash("pullLever"); public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnStartNewRound)); ((Component)dropButton).gameObject.SetActive(false); StartMatchLeverRefs.Instance.triggerScript.interactable = false; previousDisabledTriggerMessage = StartMatchLeverRefs.Instance.triggerScript.disabledHoverTip; StartMatchLeverRefs.Instance.triggerScript.disabledHoverTip = "Ship needs to be un-attached from the magnet."; ((MonoBehaviour)this).StartCoroutine(SpawnOutsideHazards()); } private IEnumerator SpawnOutsideHazards() { yield return (object)new WaitUntil((Func)(() => RoundManager.Instance.dungeonCompletedGenerating && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null)); RoundManager.Instance.SpawnOutsideHazards(); } private void OnStartNewRound() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown craneAnimator.SetTrigger(StartAnimation); ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).RemoveListener(new UnityAction(OnStartNewRound)); } public void Update() { RoundManager.Instance.currentDungeonType = -1; StartMatchLeverRefs.Instance.triggerScript.interactable = alreadyDropped; } public void DropInteract(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player) && !alreadyDropped) { TryDropShipFromCraneServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void TryDropShipFromCraneServerRpc() { TryDropShipFromCraneClientRpc(); } [ClientRpc] private void TryDropShipFromCraneClientRpc() { ((MonoBehaviour)this).StartCoroutine(TryDropShipFromCrane()); } public IEnumerator TryDropShipFromCrane() { alreadyDropped = true; dropButton.interactable = false; StartMatchLeverRefs.Instance.triggerScript.disabledHoverTip = previousDisabledTriggerMessage; StartMatchLeverRefs.Instance.triggerScript.interactable = true; leverAnimator.SetTrigger(PullLeverAnimation); float timeElapsed = 0f; List<(GameObject gameObject, Vector3 startPos, Quaternion startRot)> objectsToDrop = new List<(GameObject, Vector3, Quaternion)>(2) { (shipNavColliders, shipNavColliders.transform.position, shipNavColliders.transform.rotation), (((Component)StartOfRound.Instance.shipAnimatorObject).gameObject, ((Component)StartOfRound.Instance.shipAnimatorObject).transform.position, ((Component)StartOfRound.Instance.shipAnimatorObject).transform.rotation) }; yield return (object)new WaitForSeconds(0.5f); while (timeElapsed <= 2f) { yield return null; timeElapsed += Time.deltaTime; foreach (var tuple in objectsToDrop) { Vector3 vector = Vector3.Lerp(tuple.startPos, endPosition, timeElapsed); Quaternion quaternion = Quaternion.Lerp(tuple.startRot, endRotation, timeElapsed); tuple.gameObject.transform.SetPositionAndRotation(vector, quaternion); } } float forceDuration = 5f; while (forceDuration > 0f) { yield return null; forceDuration -= Time.deltaTime; foreach (var item in objectsToDrop) { item.gameObject.transform.SetPositionAndRotation(endPosition, endRotation); } } craneAnimator.SetTrigger(MoveBackAnimation); } public void AllowDropInteract() { if (!alreadyDropped) { ((Component)dropButton).gameObject.SetActive(true); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if (!alreadyDropped) { StartMatchLeverRefs.Instance.triggerScript.disabledHoverTip = previousDisabledTriggerMessage; StartMatchLeverRefs.Instance.triggerScript.interactable = true; } } } public class OxydeCrashingShip : FallingObjectBehaviour { [Header("Audio")] [SerializeField] private AudioSource _ImpactAudio = null; [SerializeField] private AudioSource _NormalTravelAudio = null; [SerializeField] private AudioSource _CloseTravelAudio = null; private Coroutine? _fallingRoutine = null; public override void OnNetworkSpawn() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) ((NetworkBehaviour)this).OnNetworkSpawn(); DawnMoonInfo val = default(DawnMoonInfo); if (!((Registry)(object)LethalContent.Moons).TryGetValue(CodeRebirthMoonKeys.Oxyde, ref val) || (object)val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Success() || (object)val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Hidden()) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } return; } Vector3 position = ((Component)this).transform.position; ((Component)this).transform.position = new Vector3(9999f, 9999f, 9999f); if (((NetworkBehaviour)this).IsServer) { _fallingRoutine = ((MonoBehaviour)this).StartCoroutine(WaitToDoYourThing(position, Random.Range(180f, 360f))); } } public IEnumerator WaitToDoYourThing(Vector3 spawnPosition, float delay) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(delay); Vector3 origin = CalculateRandomSkyOrigin((Direction)Random.Range(0, Enum.GetValues(typeof(Direction)).Length), spawnPosition, new Random(Random.Range(0, 10000))); SetupFallingObjectServerRpc(origin, spawnPosition, 25f); } public void Fall(Vector3 fallPosition, float speed) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (_fallingRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_fallingRoutine); } Vector3 origin = CalculateRandomSkyOrigin((Direction)Random.Range(0, Enum.GetValues(typeof(Direction)).Length), fallPosition, new Random(Random.Range(0, 10000))); SetupFallingObjectServerRpc(origin, fallPosition, speed); } protected override void OnImpact() { base.OnImpact(); Impact(); } protected override void OnSetup() { base.OnSetup(); _NormalTravelAudio.Play(); ((MonoBehaviour)this).StartCoroutine(UpdateAudio()); } public void Start() { } private IEnumerator UpdateAudio() { while (true) { yield return (object)new WaitForSeconds(0.1f); if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { _NormalTravelAudio.volume = 0f; _CloseTravelAudio.volume = 0f; _ImpactAudio.volume = 0.05f; } else { _NormalTravelAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; _CloseTravelAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; _ImpactAudio.volume = Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; } if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed) { _NormalTravelAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; _CloseTravelAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; _ImpactAudio.volume = Plugin.ModConfig.ConfigMeteorShowerInShipVolume.Value * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; } if (!_CloseTravelAudio.isPlaying && (1f - base.Progress) * base._travelTime <= _CloseTravelAudio.clip.length) { _NormalTravelAudio.volume = 0.5f * Plugin.ModConfig.ConfigMeteorsDefaultVolume.Value; _CloseTravelAudio.Play(); } } } private void Impact() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) _ImpactAudio.Play(); HUDManager.Instance.ShakeCamera((ScreenShakeType)3); CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 50, 0f, 25f, 4, null, null, 100f); } } public class SellingSally : NetworkBehaviour { [Header("Sounds")] [SerializeField] private AudioSource sallyElevatorSource = null; [SerializeField] private AudioClip elevatorOpenSound = null; [SerializeField] private AudioClip elevatorCloseSound = null; [SerializeField] private AudioSource sallySource = null; [SerializeField] private AudioClip warningSound = null; [SerializeField] private AudioSource buttonSource = null; [SerializeField] private AudioClip buttonSound = null; [SerializeField] private AudioClip errorSound = null; [SerializeField] private AudioSource bellSource = null; [SerializeField] private AudioClip bellSound = null; [Header("Animations")] [SerializeField] private Animator sallyAnimator = null; [SerializeField] private SkinnedMeshRenderer bellRenderer = null; [SerializeField] private NetworkAnimator sallyNetworkAnimator = null; [Header("Misc")] [SerializeField] private JimothyNPC? _jimothy = null; [SerializeField] private Transform endOfBarrelTransform = null; [SerializeField] private Transform sallyLoaderTransform = null; [SerializeField] private Collider sallyLargePlatformCollider = null; private List _sellableScraps = new List(); private static readonly int OpenedAnimation = Animator.StringToHash("open"); private static readonly int ShootAnimation = Animator.StringToHash("shoot"); private bool _usedOnce = false; [HideInInspector] public static SellingSally? Instance = null; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instance = this; } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instance = null; } public void OnButtonInteract(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { PressButtonServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void PressButtonServerRpc() { if (!CanCurrentlyShoot()) { PlayErrorSoundClientRpc(); return; } PlayButtonSoundServerRpc(); sallyNetworkAnimator.SetTrigger(ShootAnimation, true); } public void OnBellInteract(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { RingBellServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void PlayButtonSoundServerRpc() { _jimothy?.PlayerUsedSallyButton(); PlayButtonSoundClientRpc(); } [ClientRpc] private void PlayButtonSoundClientRpc() { sallySource.PlayOneShot(warningSound); buttonSource.PlayOneShot(buttonSound); } [ServerRpc(RequireOwnership = false)] public void RingBellServerRpc() { bool flag = sallyAnimator.GetBool(OpenedAnimation); sallyAnimator.SetBool(OpenedAnimation, !flag); AnimateBellClientRpc(!flag); } [ClientRpc] public void AnimateBellClientRpc(bool openingElevator) { sallyElevatorSource.PlayOneShot(openingElevator ? elevatorOpenSound : elevatorCloseSound); bellSource.PlayOneShot(bellSound); ((MonoBehaviour)this).StartCoroutine(AnimateBell()); } public IEnumerator AnimateBell() { float timeElapsed = 0f; while (timeElapsed <= 0.25f) { timeElapsed += Time.deltaTime; bellRenderer.SetBlendShapeWeight(0, timeElapsed * 4f * 100f); yield return null; } while (timeElapsed > 0f) { timeElapsed -= Time.deltaTime; bellRenderer.SetBlendShapeWeight(0, timeElapsed * 4f * 100f); yield return null; } } private bool CanCurrentlyShoot() { _sellableScraps.Clear(); GrabbableObject[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren(); if (componentsInChildren.Length == 0) { return false; } GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject val in array) { if (!((Object)(object)((Component)val).transform.parent != (Object)(object)sallyLoaderTransform)) { if (!(val.itemProperties.itemName == "Sally Cube") && !(val.itemProperties.itemName == "Flattened Body")) { _sellableScraps.Clear(); return false; } _sellableScraps.Add(val); } } foreach (GrabbableObject sellableScrap in _sellableScraps) { sellableScrap.grabbable = false; } if (_sellableScraps.Count == 0) { return false; } return true; } public void DoShootScrapAnimEvent() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform.parent == (Object)(object)endOfBarrelTransform.parent) { ((Component)GameNetworkManager.Instance.localPlayerController).transform.position = endOfBarrelTransform.position; GameNetworkManager.Instance.localPlayerController.DamagePlayer(9999, true, true, (CauseOfDeath)3, 0, false, endOfBarrelTransform.forward * 100f); } else { Bounds bounds = sallyLargePlatformCollider.bounds; if (((Bounds)(ref bounds)).Contains(((Component)GameNetworkManager.Instance.localPlayerController).transform.position)) { GameNetworkManager.Instance.localPlayerController.KillPlayer(GameNetworkManager.Instance.localPlayerController.velocityLastFrame, true, (CauseOfDeath)3, 9, default(Vector3), false); } } if (!((NetworkBehaviour)this).IsServer) { return; } int num = 0; if (!CanCurrentlyShoot()) { PlayErrorSound(); return; } foreach (GrabbableObject sellableScrap in _sellableScraps) { sellableScrap.SetScrapValue(Mathf.RoundToInt((float)sellableScrap.scrapValue * LateGameUpgradesCompat.GetSellableScrapMultiplier() * StartOfRound.Instance.companyBuyingRate * (float)((TimeOfDay.Instance.daysUntilDeadline > 0) ? 1 : 3))); num += sellableScrap.scrapValue; } SellAndDisplayItemProfitsRpc(num); } [Rpc(/*Could not decode attribute arguments.*/)] private void SellAndDisplayItemProfitsRpc(int profit) { TooManyEmotesCompat.AddCredits(profit); if (!_usedOnce) { foreach (EnemyLevelSpawner enemyLevelSpawner in EnemyLevelSpawner.enemyLevelSpawners) { enemyLevelSpawner.spawnTimerMin /= 8f; enemyLevelSpawner.spawnTimerMax /= 8f; } OxydeLightsManager.Instance.IncrementLights(); _usedOnce = true; HUDManager.Instance.DisplayTip("Warning!", "Rampant underground activity detected, evacuation recommended.", true, false, "LC_Tip1"); } DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Internship); Terminal instance = TerminalRefs.Instance; instance.groupCredits += profit; EndOfGameStats gameStats = StartOfRound.Instance.gameStats; gameStats.scrapValueCollected += profit; TimeOfDay instance2 = TimeOfDay.Instance; instance2.quotaFulfilled += profit; HUDManager.Instance.DisplayCreditsEarning(profit, _sellableScraps.ToArray(), TerminalRefs.Instance.groupCredits); foreach (GrabbableObject sellableScrap in _sellableScraps) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)sellableScrap).NetworkObject.Despawn(true); } } _sellableScraps.Clear(); TimeOfDay.Instance.UpdateProfitQuotaCurrentTime(); } [ClientRpc] public void PlayErrorSoundClientRpc() { PlayErrorSound(); } public void PlayErrorSound() { buttonSource.PlayOneShot(errorSound); } } public class ShreddingSarah : NetworkSingleton { public float launchSpeed = 30f; public float landingRadius = 8f; public float landingRaycastUp = 50f; public float landingRaycastDown = 100f; public Transform shreddingPoint = null; public InteractTrigger cannonTrigger = null; public Transform shootPoint = null; public Transform targetTransform = null; public AudioSource loadAudioSource = null; public AudioClip loadSFX = null; public AudioSource shootAudioSource = null; public AudioClip shootSFX = null; public void Start() { cannonTrigger.hoverTip = "Shred item : [" + (StartOfRound.Instance.localPlayerUsingController ? "R-trigger" : "LMB") + "]"; cannonTrigger.disabledHoverTip = "Hold item to Shred"; } public void Update() { cannonTrigger.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null; } public void TryFeedItem(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player) && !((Object)(object)player.currentlyHeldObjectServer == (Object)null)) { int num = 0; bool playerDeath = false; if (player.currentlyHeldObjectServer is SnailCatPhysicsProp) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.YouMonster); } if (player.currentlyHeldObjectServer is RagdollGrabbableObject) { playerDeath = true; num = 10; } else if (player.currentlyHeldObjectServer.itemProperties.itemName.Contains("Shredded Scraps")) { num = -10; } num += player.currentlyHeldObjectServer.scrapValue; TryFeedItemServerRpc(playerDeath, num); player.DespawnHeldObject(); } } [ServerRpc(RequireOwnership = false)] public void TryFeedItemServerRpc(bool playerDeath, int valueOfItem) { //IL_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReference netObjRef = ((!playerDeath) ? CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.NormalShreddedScraps].Item, shootPoint.position, isQuest: false, defaultRotation: true, valueOfItem) : CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.BloodyShreddedScraps].Item, shootPoint.position, isQuest: false, defaultRotation: true, valueOfItem)); ShootItemForwards(netObjRef); } private void ShootItemForwards(NetworkObjectReference netObjRef) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging("Scrap Cannon - Shooting forwards (untargeted)"); Vector3 position = shootPoint.position; Vector3 val = targetTransform.position + new Vector3(Random.Range(-2f, 2f), Random.Range(-2f, 2f), Random.Range(-2f, 2f)); Vector3 val2 = new Vector3(val.x - position.x, 0f, val.z - position.z); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = (float)Random.Range(0, 1) * landingRadius; float num2 = (float)Random.Range(0, 1) * (MathF.PI * 2f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val.x, 0f, val.z); float num3 = Vector3.Distance(val3, new Vector3(position.x, 0f, position.z)); Vector3 val4 = new Vector3(position.x, 0f, position.z) + normalized * num3 + new Vector3(Mathf.Sin(num2), 0f, Mathf.Cos(num2)) * num; Vector3 val5 = val4 + (((Component)this).transform.position.y + landingRaycastUp) * Vector3.up; RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5, -Vector3.up, ref val6, landingRaycastUp + landingRaycastDown, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { GrabbableObject component = NetworkObjectReference.op_Implicit(netObjRef).GetComponent(); Vector3 itemFloorPosition = component.GetItemFloorPosition(((RaycastHit)(ref val6)).point + Vector3.up); ShootItemClientRPC(netObjRef, itemFloorPosition); } else { Vector3 landingPosition = val4 + ((Component)this).transform.position.y * Vector3.up; ShootItemClientRPC(netObjRef, landingPosition); } } [ClientRpc] public void ShootItemClientRPC(NetworkObjectReference heldObjectRef, Vector3 landingPosition) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref heldObjectRef)).TryGet(ref val, (NetworkManager)null)) { Plugin.Logger.LogError((object)$"Scrap Cannon - ShootItemClientRPC - Held object could not be found: {((NetworkObjectReference)(ref heldObjectRef)).NetworkObjectId}"); return; } GrabbableObject component = ((Component)val).gameObject.GetComponent(); component.fallTime = 1.1f; component.hasHitGround = true; component.EnablePhysics(false); component.EnableItemMeshes(false); loadAudioSource.PlayOneShot(loadSFX); ((MonoBehaviour)this).StartCoroutine(ShootItemRoutine(component, landingPosition)); } private IEnumerator ShootItemRoutine(GrabbableObject grabbableObject, Vector3 landingPosition) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(loadSFX.length + 0.25f); shootAudioSource.PlayOneShot(shootSFX); grabbableObject.EnableItemMeshes(true); float launchTotalDistance = Vector3.Distance(shootPoint.position, landingPosition); float launchProgress = 0f; Plugin.ExtendedLogging($"Old World position: {((Component)grabbableObject).transform.position}"); Plugin.ExtendedLogging($"Old Local position: {((Component)grabbableObject).transform.localPosition}"); while (launchProgress < launchTotalDistance) { Vector3 currentPosition = SampleChute(shootPoint.position, landingPosition, launchProgress / launchTotalDistance); Vector3 localPosition = (grabbableObject.targetFloorPosition = (grabbableObject.startFallingPosition = StartOfRound.Instance.propsContainer.InverseTransformPoint(currentPosition))); ((Component)grabbableObject).transform.localPosition = localPosition; launchProgress += launchSpeed * Time.deltaTime; yield return null; } Vector3 finalLocalPosition = StartOfRound.Instance.propsContainer.InverseTransformPoint(landingPosition); grabbableObject.EnablePhysics(true); grabbableObject.startFallingPosition = finalLocalPosition; grabbableObject.targetFloorPosition = finalLocalPosition; ((Component)grabbableObject).transform.localPosition = finalLocalPosition; grabbableObject.hasHitGround = false; grabbableObject.fallTime = 0f; } private Vector3 SampleChute(Vector3 start, Vector3 end, float t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a9: 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_00ab: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(start, end) < 0.001f || start.y <= end.y) { return Vector3.Lerp(start, end, t); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(end.x - start.x, 0f, end.z - start.z); float magnitude = ((Vector3)(ref val)).magnitude; float num = (start.y + end.y - magnitude * magnitude / (start.y - end.y)) / 2f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(start.x, num, start.z); Vector3 val3 = start - val2; Vector3 val4 = end - val2; Vector3 val5 = Vector3.Cross(val3, val4); Vector3 normalized = ((Vector3)(ref val5)).normalized; if (normalized == Vector3.zero) { return Vector3.Lerp(start, end, t); } float num2 = Vector3.SignedAngle(val3, val4, normalized); Vector3 val6 = Quaternion.AngleAxis(num2 * t, normalized) * val3; return val2 + val6; } } public enum FloraTag { None, Desert, Snow, Grass, Dangerous } public class SpawnableFlora { public GameObject prefab = null; public FloraTag floraTag; public Func spawnCurveFunction; } public class TeslaShock : CodeRebirthHazard { public float distanceFromPlayer = 5f; public int playerDamageAmount = 40; public int playerZapDamageAmount = 10; public float pushMultiplier = 10f; public Transform startChainPoint = null; public VisualEffect vfx = null; public AudioSource teslaIdleAudioSource = null; public AudioClip teslaSlowIdleSound = null; public AudioClip teslaFastIdleSound = null; public AudioSource teslaAudioSource = null; public AudioClip teslaTouchSound = null; public AudioClip teslaFirstBigChargeSound = null; public AudioClip teslaConsecutiveChargeSound = null; public List teslaZapSounds = null; private GrabbableObject chargedItemPlayerWasHolding; private PlayerControllerB? targetPlayer; private List<(GameObject obj, LineRenderer[] renderers)> lineRendererObjects = new List<(GameObject, LineRenderer[])>(); private int activeLineRenderers = 0; public override void Start() { //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_006f: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) base.Start(); Plugin.ExtendedLogging("Tesla Turret initialized"); vfx.SetFloat("SpawnRate", 10f); teslaIdleAudioSource.clip = teslaSlowIdleSound; teslaIdleAudioSource.Stop(); teslaIdleAudioSource.Play(); GameObject val = new GameObject("ScanNode") { layer = LayerMask.NameToLayer("ScanNode") }; val.transform.position = ((Component)this).transform.position + new Vector3(0f, 2f, 0f); val.transform.SetParent(((Component)this).transform, true); val.transform.localScale = new Vector3(1f, 1f, 1f); ScanNodeProperties val2 = val.AddComponent(); val2.maxRange = 13; val2.minRange = 0; val2.requiresLineOfSight = true; val2.headerText = "Tesla Shock"; val2.subText = "My PC hated making the visuals for this thing..."; val2.nodeType = 1; BoxCollider val3 = val.AddComponent(); val3.center = new Vector3(0f, 2f, 0f); val3.size = new Vector3(1f, 0.83f, 1f); } private void Update() { UpdateAudio(); if ((Object)(object)targetPlayer != (Object)null) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB affectedPlayer in allPlayerScripts) { if (ShouldContinueCharging(affectedPlayer)) { targetPlayer = affectedPlayer; teslaIdleAudioSource.clip = teslaFastIdleSound; teslaIdleAudioSource.Stop(); teslaIdleAudioSource.Play(); ((MonoBehaviour)this).StartCoroutine(ExplodePlayerAfterDelay(affectedPlayer)); break; } } } private void UpdateAudio() { teslaIdleAudioSource.volume = Plugin.ModConfig.ConfigBugZapperVolume.Value; teslaAudioSource.volume = Plugin.ModConfig.ConfigBugZapperVolume.Value; } private void OnTriggerEnter(Collider other) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (((Component)other).TryGetComponent(ref val)) { Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = normalized * pushMultiplier; val.DamagePlayer(50, true, true, (CauseOfDeath)3, 0, false, val3); teslaAudioSource.PlayOneShot(teslaTouchSound); } } private IEnumerator ExplodePlayerAfterDelay(PlayerControllerB affectedPlayer) { RaycastHit val2 = default(RaycastHit); while (ShouldContinueCharging(affectedPlayer)) { Plugin.ExtendedLogging("Charging " + affectedPlayer.playerUsername); yield return ((MonoBehaviour)this).StartCoroutine(ChargePlayer(affectedPlayer)); List validTargets = new List(); if (!ShouldContinueCharging(affectedPlayer)) { float distanceFromItem = Vector3.Distance(((Component)this).transform.position, ((Component)chargedItemPlayerWasHolding).transform.position); int num; if (distanceFromItem <= distanceFromPlayer) { Vector3 position = ((Component)this).transform.position; Vector3 val = ((Component)chargedItemPlayerWasHolding).transform.position - ((Component)this).transform.position; num = ((!Physics.Raycast(position, ((Vector3)(ref val)).normalized, ref val2, distanceFromItem, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)1)) ? 1 : 0); } else { num = 0; } if (num != 0) { validTargets.Add(startChainPoint); validTargets.Add(((Component)chargedItemPlayerWasHolding).transform); DrawChainLines(validTargets); DamageTargets(validTargets, affectedPlayer); yield return ((MonoBehaviour)this).StartCoroutine(HandleConsecutiveChargeEffects()); } } else { List sortedPlayers = GetPlayersSortedByDistance(affectedPlayer); List sortedEnemies = GetEnemiesSortedByDistance(affectedPlayer); List sortedTargets = GetTargetsSortedByDistanceIncludingAffectedPlayer(affectedPlayer, sortedPlayers, sortedEnemies); validTargets = GetValidChainTargets(sortedTargets); DrawChainLines(validTargets); DamageTargets(validTargets, affectedPlayer); yield return ((MonoBehaviour)this).StartCoroutine(HandleConsecutiveChargeEffects()); } } ResetEffects(); } private bool ShouldContinueCharging(PlayerControllerB affectedPlayer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)affectedPlayer).transform.position, ((Component)this).transform.position); int result; if (num <= distanceFromPlayer && !affectedPlayer.isPlayerDead && affectedPlayer.isPlayerControlled && PlayerCarryingSomethingConductive(affectedPlayer)) { Vector3 position = ((Component)affectedPlayer).transform.position; Vector3 val = ((Component)this).transform.position - ((Component)affectedPlayer).transform.position; RaycastHit val2 = default(RaycastHit); result = ((!Physics.Raycast(position, ((Vector3)(ref val)).normalized, ref val2, num, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)1)) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } private IEnumerator ChargePlayer(PlayerControllerB affectedPlayer) { float timeToCharge = teslaFirstBigChargeSound.length; if (affectedPlayer.playerSteamId == 9) { timeToCharge /= 5f; } teslaAudioSource.PlayOneShot(teslaFirstBigChargeSound); vfx.SetFloat("SpawnRate", 10f); yield return (object)new WaitForSeconds(timeToCharge / 5f); vfx.SetFloat("SpawnRate", 20f); yield return (object)new WaitForSeconds(timeToCharge / 5f); vfx.SetFloat("SpawnRate", 40f); yield return (object)new WaitForSeconds(timeToCharge / 5f); vfx.SetFloat("SpawnRate", 60f); yield return (object)new WaitForSeconds(timeToCharge / 5f); vfx.SetFloat("SpawnRate", 80f); yield return (object)new WaitForSeconds(timeToCharge / 5f); vfx.SetFloat("SpawnRate", 100f); } private List GetPlayersSortedByDistance(PlayerControllerB affectedPlayer) { return (from player in StartOfRound.Instance.allPlayerScripts where (Object)(object)player != (Object)(object)affectedPlayer && player.isPlayerControlled && !player.isPlayerDead orderby Vector3.Distance(((Component)player).transform.position, ((Component)affectedPlayer).transform.position) select player).ToList(); } private List GetEnemiesSortedByDistance(PlayerControllerB affectedPlayer) { return (from enemy in RoundManager.Instance.SpawnedEnemies where !enemy.isEnemyDead orderby Vector3.Distance(((Component)enemy).transform.position, ((Component)affectedPlayer).transform.position) select enemy).ToList(); } private List GetTargetsSortedByDistanceIncludingAffectedPlayer(PlayerControllerB affectedPlayer, List sortedPlayers, List sortedEnemies) { List list = new List(); list.Add(startChainPoint); list.Add(((Component)affectedPlayer).transform); list.AddRange(sortedPlayers.Select((PlayerControllerB player) => ((Component)player).transform)); list.AddRange(sortedEnemies.Select((EnemyAI enemy) => ((Component)enemy).transform)); List source = list; return source.OrderBy((Transform x) => Vector3.Distance(x.position, startChainPoint.position)).ToList(); } private List GetValidChainTargets(IEnumerable sortedTargets) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) List list = new List { sortedTargets.First() }; foreach (Transform sortedTarget in sortedTargets) { if (Vector3.Distance(list.Last().position, sortedTarget.position) > distanceFromPlayer) { break; } list.Add(sortedTarget); } return list; } private void DrawChainLines(IEnumerable sortedTargets) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) int linesNeeded = sortedTargets.Count() - 1; EnsureLineRendererPool(linesNeeded); Vector3? val = null; int index = 0; foreach (Transform sortedTarget in sortedTargets) { if (val.HasValue) { LineRenderer[] item = lineRendererObjects[index].renderers; LineRenderer[] array = item; foreach (LineRenderer val2 in array) { val2.positionCount = 2; val2.SetPosition(0, val.Value); val2.SetPosition(1, sortedTarget.position); ((Component)teslaAudioSource).transform.position = sortedTarget.position; teslaAudioSource.PlayOneShot(teslaZapSounds[Random.Range(0, teslaZapSounds.Count - 1)]); ((Renderer)val2).enabled = true; ((MonoBehaviour)this).StartCoroutine(DisableRendererAfterDelay(val2, 0.5f)); } } val = sortedTarget.position; } DisableExtraLineRenderers(linesNeeded); activeLineRenderers = linesNeeded; } private void DamageTargets(List sortedTargets, PlayerControllerB startingPlayer) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i < sortedTargets.Count; i++) { Transform currentTarget = sortedTargets[i]; PlayerControllerB val = ((IEnumerable)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func)((PlayerControllerB p) => (Object)(object)((Component)p).transform == (Object)(object)currentTarget)); EnemyAI val2 = ((IEnumerable)RoundManager.Instance.SpawnedEnemies).FirstOrDefault((Func)((EnemyAI e) => (Object)(object)((Component)e).transform == (Object)(object)currentTarget)); if ((Object)(object)val != (Object)null) { val.DamagePlayer(80 * ((val.playerSteamId != 9) ? 1 : 2), true, true, (CauseOfDeath)13, 0, false, default(Vector3)); } else if ((Object)(object)val2 != (Object)null) { val2.HitEnemy(3, startingPlayer, true, -1); } else { Plugin.ExtendedLogging("Shooting non player or non enemy target"); } } } private IEnumerator HandleConsecutiveChargeEffects() { ((Component)teslaAudioSource).transform.position = ((Component)this).transform.position; teslaAudioSource.PlayOneShot(teslaConsecutiveChargeSound); teslaIdleAudioSource.clip = teslaSlowIdleSound; teslaIdleAudioSource.Stop(); teslaIdleAudioSource.Play(); vfx.SetFloat("SpawnRate", 80f); yield return (object)new WaitForSeconds(teslaConsecutiveChargeSound.length / 5f); vfx.SetFloat("SpawnRate", 60f); yield return (object)new WaitForSeconds(teslaConsecutiveChargeSound.length / 5f); vfx.SetFloat("SpawnRate", 40f); yield return (object)new WaitForSeconds(teslaConsecutiveChargeSound.length / 5f); vfx.SetFloat("SpawnRate", 20f); yield return (object)new WaitForSeconds(teslaConsecutiveChargeSound.length / 5f); vfx.SetFloat("SpawnRate", 0f); yield return (object)new WaitForSeconds(teslaConsecutiveChargeSound.length / 5f); yield return (object)new WaitForSeconds(5f); } private void ResetEffects() { vfx.SetFloat("SpawnRate", 10f); DisableAllLineRenderers(); activeLineRenderers = 0; targetPlayer = null; } private void DisableExtraLineRenderers(int linesNeeded) { for (int i = linesNeeded; i < activeLineRenderers; i++) { LineRenderer[] item = lineRendererObjects[i].renderers; LineRenderer[] array = item; foreach (LineRenderer val in array) { ((Renderer)val).enabled = false; } } } private void DisableAllLineRenderers() { foreach (var lineRendererObject in lineRendererObjects) { LineRenderer[] item = lineRendererObject.renderers; foreach (LineRenderer val in item) { ((Renderer)val).enabled = false; } } } private IEnumerator DisableRendererAfterDelay(LineRenderer lineRenderer, float delay) { yield return (object)new WaitForSeconds(delay); ((Renderer)lineRenderer).enabled = false; } private void EnsureLineRendererPool(int linesNeeded) { while (lineRendererObjects.Count < linesNeeded) { GameObject val = Object.Instantiate(ContentHandler.Instance.TeslaShock.ChainLightningPrefab, ((Component)this).transform); LineRenderer[] componentsInChildren = val.GetComponentsInChildren(); lineRendererObjects.Add((val, componentsInChildren)); LineRenderer[] array = componentsInChildren; foreach (LineRenderer val2 in array) { ((Renderer)val2).enabled = false; } } } private bool PlayerCarryingSomethingConductive(PlayerControllerB player) { GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null) && val.itemProperties.isConductiveMetal) { chargedItemPlayerWasHolding = val; return true; } } return false; } } public class UnityWheelColliderProxy : BearTrapWheelProxy { public override void SetupWheel() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) WheelCollider component = ((Component)this).GetComponent(); SphereCollider val = ((Component)component).gameObject.AddComponent(); ((Collider)val).isTrigger = true; val.radius = component.radius; ((Collider)val).includeLayers = LayerMask.op_Implicit(MoreLayerMasks.HazardMask); } public override void PunctureWheel() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) base.PunctureWheel(); WheelCollider component = ((Component)this).GetComponent(); component.radius *= 0.9f; WheelFrictionCurve forwardFriction = component.forwardFriction; ((WheelFrictionCurve)(ref forwardFriction)).stiffness = ((WheelFrictionCurve)(ref forwardFriction)).stiffness * 0.7f; component.forwardFriction = forwardFriction; WheelFrictionCurve sidewaysFriction = component.sidewaysFriction; ((WheelFrictionCurve)(ref sidewaysFriction)).stiffness = ((WheelFrictionCurve)(ref sidewaysFriction)).stiffness * 0.4f; component.sidewaysFriction = sidewaysFriction; } } public class UnknownWheelProxy : BearTrapWheelProxy { public Action? PunctureWheelAction; public Action? SetupWheelAction; public override void SetupWheel() { SetupWheelAction?.Invoke(); } public override void PunctureWheel() { base.PunctureWheel(); PunctureWheelAction?.Invoke(); } } public class VendingMachine : NetworkBehaviour { private List possibleItemsToSpawn = new List(); private SimplifiedRealItemWithRarityAndColor currentItemToSpawn; private float jammingProgress = 0f; private float lastTimeUsed = 0f; private static readonly NamespacedKey _firstVendingUsage = NamespacedKey.From("code_rebirth", "first_vending_usage"); private static readonly int JammedAnimationHash = Animator.StringToHash("jammed"); private static readonly int UseAnimationHash = Animator.StringToHash("use"); [field: SerializeField] public HUDDisplayTip FirstInteractionTipWithoutCounter { get; private set; } [field: SerializeField] public List PotentialItemsToSpawn { get; private set; } = new List(); [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip PurchaseItemSound { get; private set; } [field: SerializeField] public AudioClip JamSound { get; private set; } [field: SerializeField] public Animator Animator { get; private set; } [field: SerializeField] public float Cooldown { get; private set; } [field: SerializeField] public InteractTrigger SlotTrigger { get; private set; } [field: SerializeField] public Transform StartSpawnPosition { get; private set; } [field: SerializeField] public Transform EndSpawnPosition { get; private set; } [field: SerializeField] public int PayPrice { get; private set; } [field: SerializeField] public AnimationCurve JammingCurve { get; private set; } = AnimationCurve.Linear(0f, 0f, 1f, 1f); public override void OnNetworkSpawn() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) ((NetworkBehaviour)this).OnNetworkSpawn(); CoinDisplayUI.PointsOfInterest.Add(((Component)this).transform); foreach (SimplifiedItemWithRarityAndColor item in PotentialItemsToSpawn) { if (item.itemName.Equals("vanilla", StringComparison.OrdinalIgnoreCase)) { possibleItemsToSpawn.Add(new SimplifiedRealItemWithRarityAndColor(null, item.rarity, item.borderColor, item.textColor)); continue; } string text = (item.itemName = item.itemName.ToLowerInvariant().Trim()); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName.ToLowerInvariant().Trim() == text) { possibleItemsToSpawn.Add(new SimplifiedRealItemWithRarityAndColor(items, item.rarity, item.borderColor, item.textColor)); break; } } } if (((NetworkBehaviour)this).IsServer) { currentItemToSpawn = CRUtilities.ChooseRandomWeightedType(possibleItemsToSpawn.Select((SimplifiedRealItemWithRarityAndColor x) => (x: x, rarity: x.rarity))); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); CoinDisplayUI.PointsOfInterest.Remove(((Component)this).transform); } public void StartSpawningAnimation(PlayerControllerB playerControllerB) { if ((Object)(object)playerControllerB == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(playerControllerB)) { return; } if ((Object)(object)NetworkSingleton.Instance == (Object)null) { if (!((DataContainer)Plugin.PersistentDataContainer).GetOrCreateDefault(_firstVendingUsage)) { ((DataContainer)Plugin.PersistentDataContainer).Set(_firstVendingUsage, true); HUDManagerExtensions.DisplayTip(HUDManager.Instance, FirstInteractionTipWithoutCounter); } } else if (NetworkSingleton.Instance.MoneyStored() >= PayPrice) { StartSpawningAnimationServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartSpawningAnimationServerRpc() { if (!(Time.time - lastTimeUsed < Cooldown)) { lastTimeUsed = Time.time; if (JammingCurve.Evaluate(jammingProgress) > Random.Range(0f, 1f)) { JamMachineClientRpc(); } else { StartSpawningAnimationsClientRpc(); } } } [ClientRpc] private void StartSpawningAnimationsClientRpc() { AudioSource.PlayOneShot(PurchaseItemSound); Animator.SetTrigger(UseAnimationHash); } public void SpawnRandomItem() { if (((NetworkBehaviour)this).IsServer) { SpawnRandomItemServerRpc(); } } [ClientRpc] private void JamMachineClientRpc() { Animator.SetBool(JammedAnimationHash, true); AudioSource.PlayOneShot(JamSound); SlotTrigger.interactable = false; } [ServerRpc(RequireOwnership = false)] private void SpawnRandomItemServerRpc() { //IL_002a: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b3: 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_00c9: Unknown result type (might be due to invalid IL or missing references) NetworkSingleton.Instance.RemoveMoney(PayPrice); jammingProgress += 0.1f; Vector3 position = StartSpawnPosition.position; float num = Random.Range(0f, 1f); Vector3 val = EndSpawnPosition.position - StartSpawnPosition.position; Vector3 position2 = position + num * ((Vector3)(ref val)).normalized; if ((Object)(object)currentItemToSpawn.item == (Object)null) { currentItemToSpawn.item = Merchant.GetRandomVanillaItem(excludeShopItems: false); } GameObject val2 = NetworkObjectReference.op_Implicit(CodeRebirthUtils.Instance.SpawnScrap(currentItemToSpawn.item, position2)); GrabbableObject component = val2.GetComponent(); SyncGrabbableObjectScanStuffClientRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)component), currentItemToSpawn.borderColor.r, currentItemToSpawn.borderColor.g, currentItemToSpawn.borderColor.b, currentItemToSpawn.textColor.r, currentItemToSpawn.textColor.g, currentItemToSpawn.textColor.b); currentItemToSpawn = CRUtilities.ChooseRandomWeightedType(possibleItemsToSpawn.Select((SimplifiedRealItemWithRarityAndColor x) => (x: x, rarity: x.rarity))); } [ClientRpc] private void SyncGrabbableObjectScanStuffClientRpc(NetworkBehaviourReference grabbableObjectRef, float borderColorR, float borderColorG, float borderColorB, float textColorR, float textColorG, float textColorB) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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) GrabbableObject val = (GrabbableObject)NetworkBehaviourReference.op_Implicit(grabbableObjectRef); val.grabbable = true; ForceScanColorOnItem val2 = ((Component)val).gameObject.AddComponent(); val2.grabbableObject = val; val2.borderColor = new Color(borderColorR, borderColorG, borderColorB, 1f); val2.textColor = new Color(textColorR, textColorG, textColorB, 1f); } } } namespace CodeRebirth.src.Content.Items { public class ItemHandler : ContentHandler { public class HoverboardAssets : AssetBundleLoader { public HoverboardAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BrrreakerAssets : AssetBundleLoader { public BrrreakerAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TurbulenceAssets : AssetBundleLoader { public TurbulenceAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MarrowSplitterAssets : AssetBundleLoader { public MarrowSplitterAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TomaHopAssets : AssetBundleLoader { public TomaHopAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SnowGlobeAssets : AssetBundleLoader { public SnowGlobeAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class ZortAssets : AssetBundleLoader { public ZortAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class XuAndRigoAssets : AssetBundleLoader { [LoadFromBundle("RodFollower.prefab")] public GameObject SmallRigoPrefab { get; private set; } = null; public XuAndRigoAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MoonUnlockerAssets : AssetBundleLoader { public MoonUnlockerAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class OxydeLoreAssets : AssetBundleLoader { public OxydeLoreAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CodeRebirthPlushiesAssets : AssetBundleLoader { public CodeRebirthPlushiesAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public MoonUnlockerAssets? MoonUnlocker = null; public OxydeLoreAssets? OxydeLore = null; public XuAndRigoAssets? XuAndRigo = null; public ZortAssets? Zort = null; public HoverboardAssets? Hoverboard = null; public SnowGlobeAssets? SnowGlobe = null; public BrrreakerAssets? Brrreaker = null; public TurbulenceAssets? Turbulence = null; public MarrowSplitterAssets? MarrowSplitter = null; public TomaHopAssets? TomaHop = null; public CodeRebirthPlushiesAssets? CRPlushies = null; public ItemHandler(DuskMod mod) : base(mod) { } } public class ActivateEvent : GrabbableObject { [SerializeField] private UnityEvent _onActivate = new UnityEvent(); public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); _onActivate.Invoke(); } } public class AlarmClock : GrabbableObject { } public class CasettePlayer : MonoBehaviour { [SerializeField] private VideoPlayer _videoPlayer = null; [SerializeField] private Transform _tapeRespawnTransform = null; [SerializeField] private AudioSource _generalAudioSource = null; [SerializeField] private AudioSource _projectorAudioSource = null; [SerializeField] private AudioClip _tapeInsertSound = null; [SerializeField] private AudioClip _tapeEjectSound = null; private bool _playing = false; public IEnumerator PlayTape(VideoClip videoClip, CasetteTape casetteTapeUsed) { if (!((Object)(object)videoClip == (Object)null) && !_playing) { _videoPlayer.Stop(); _playing = true; Item casetteItem = ((GrabbableObject)casetteTapeUsed).itemProperties; if ((Object)(object)((GrabbableObject)casetteTapeUsed).playerHeldBy != (Object)null && ((GrabbableObject)casetteTapeUsed).isHeld && (Object)(object)((GrabbableObject)casetteTapeUsed).playerHeldBy.currentlyHeldObjectServer == (Object)(object)casetteTapeUsed) { ((GrabbableObject)casetteTapeUsed).playerHeldBy.DespawnHeldObject(); } _generalAudioSource.PlayOneShot(_tapeInsertSound); yield return (object)new WaitForSeconds(_tapeInsertSound.length); _videoPlayer.audioOutputMode = (VideoAudioOutputMode)1; _videoPlayer.EnableAudioTrack((ushort)0, true); _videoPlayer.SetTargetAudioSource((ushort)0, _projectorAudioSource); _videoPlayer.controlledAudioTrackCount = 1; _videoPlayer.clip = videoClip; _videoPlayer.Play(); yield return (object)new WaitUntil((Func)(() => _videoPlayer.isPlaying)); yield return (object)new WaitUntil((Func)(() => !_videoPlayer.isPlaying)); _generalAudioSource.PlayOneShot(_tapeEjectSound); yield return (object)new WaitForSeconds(_tapeEjectSound.length); _playing = false; if (NetworkManager.Singleton.IsServer) { CodeRebirthUtils.Instance.SpawnScrap(casetteItem, _tapeRespawnTransform.position); } } } } public class CasetteTape : GrabbableObject { [SerializeField] private VideoClip _videoToPlay = null; public override void ItemActivate(bool used, bool buttonDown = true) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward); RaycastHit val2 = default(RaycastHit); CasettePlayer casettePlayer = default(CasettePlayer); if (Physics.Raycast(val, ref val2, 3f, MoreLayerMasks.PropsMask, (QueryTriggerInteraction)1) && ((Component)((RaycastHit)(ref val2)).transform).TryGetComponent(ref casettePlayer)) { ((MonoBehaviour)casettePlayer).StartCoroutine(casettePlayer.PlayTape(_videoToPlay, this)); } } } public class Ceasefire : GrabbableObject { [Header("Visuals")] [SerializeField] private GameObject _ceasefireBarrel = null; [SerializeField] private GameObject _particleSystemsGO = null; [SerializeField] private ParticleSystem[] _particleSystems = Array.Empty(); [SerializeField] private float _rotationSpeed = 10f; [SerializeField] private Renderer _ceasefireRenderer = null; [Header("Audio")] [SerializeField] private AudioSource _idleSource = null; [SerializeField] private AudioClip _overheatedSound = null; [SerializeField] private AudioClip _outOfOverheatSound = null; [SerializeField] private AudioClip _fireStartSound = null; [SerializeField] private AudioClip _fireLoopSound = null; [SerializeField] private AudioClip _fireEndSound = null; [Header("Charge Effects")] [SerializeField] private float _maxChargedTime = 10f; [SerializeField] private float _minParticleRateOverTime = 10f; [SerializeField] private float _maxParticleRateOverTime = 45f; [SerializeField] private float _minEmissionIntensity = 1f; [SerializeField] private float _maxEmissionIntensity = 10f; [SerializeField] private float _maxDamageIntervalAtMaxCharge = 2f; [SerializeField] private ParticleSystem _overheatEffect = null; [SerializeField] private float _overChargedDuration = 30f; private float _startingTime = 0f; private float _endingTime = 0f; private Coroutine? _firingStartRoutine = null; private Coroutine? _firingEndRoutine = null; private float _currentBarrelRotationX = 0f; private Material _ceasefireMaterial = null; private Color _baseEmissionColor; private bool _overCharged = false; private float _overChargedTimer = 30f; private float _chargedTime = 0f; [Header("Gatling Gun")] [SerializeField] private float _minigunDamageInterval = 0.21f; [SerializeField] private float _minigunRange = 30f; [SerializeField] private float _minigunWidth = 1f; [SerializeField] private int _minigunDamage = 5; [SerializeField] private AnimationCurve _minigunDamageCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f), new Keyframe(1f, 1f) }); private float _damageInterval = 0f; private Collider[] _cachedColliders = (Collider[])(object)new Collider[20]; private List _enemyAIs = new List(); private static readonly int _EmissiveColorHash = Shader.PropertyToID("_EmissiveColor"); private float CurrentDamageInterval => Mathf.Lerp(_minigunDamageInterval, _maxDamageIntervalAtMaxCharge, _minigunDamageCurve.Evaluate(Mathf.Clamp01(_chargedTime / _maxChargedTime))); public override void Start() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) ((GrabbableObject)this).Start(); _overChargedTimer = _overChargedDuration; _ceasefireMaterial = _ceasefireRenderer.material; _baseEmissionColor = _ceasefireMaterial.GetColor(_EmissiveColorHash); float num = Mathf.Lerp(_minEmissionIntensity, _maxEmissionIntensity, 0f); Color val = _baseEmissionColor * num; _ceasefireMaterial.SetColor(_EmissiveColorHash, val); } public override void Update() { //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: 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_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (_overCharged && _overChargedTimer > 0f) { _overChargedTimer -= Time.deltaTime; if (_overChargedTimer <= 0f) { _overCharged = false; _idleSource.PlayOneShot(_outOfOverheatSound); } } if (!base.isHeld || base.isPocketed) { return; } float num = 0f; if (_firingStartRoutine != null) { num = Time.deltaTime * _rotationSpeed * _startingTime; } else if (base.isBeingUsed) { DoGatlingGunDamage(); num = Time.deltaTime * _rotationSpeed; } else if (_firingEndRoutine != null) { num = Time.deltaTime * _rotationSpeed * _endingTime; } if (base.isBeingUsed && _chargedTime < _maxChargedTime) { _chargedTime += Time.deltaTime; } else if (!base.isBeingUsed && _chargedTime > 0f) { _chargedTime -= Time.deltaTime * 0.5f; } float num2 = Mathf.Clamp01(_chargedTime / _maxChargedTime); float num3 = _minigunDamageCurve.Evaluate(num2); if (num != 0f) { num *= 1f - num3; _currentBarrelRotationX += num; _ceasefireBarrel.transform.localEulerAngles = new Vector3(-280f + _currentBarrelRotationX, 270f, 90f); if ((Object)(object)base.playerHeldBy != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy) && _particleSystemsGO.activeSelf) { float num4 = 20f * (base.playerHeldBy.isCrouching ? 0.5f : 1f) * Time.deltaTime * (num / 35f); int num5 = Random.Range(0, 2); if (1 == 0) { } Vector3 val = (Vector3)(num5 switch { 0 => ((Component)this).transform.right, 1 => -((Component)this).transform.right, _ => ((Component)this).transform.right, }); if (1 == 0) { } Vector3 val2 = val; float num6 = Mathf.Clamp(Random.Range(-5f, 1f), 0f, 1f); if (num6 > 0f) { ((MonoBehaviour)this).StartCoroutine(CRUtilities.AlternateForcePlayerLookup(base.playerHeldBy, 0.5f, num6 / 7.5f)); } PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.externalForceAutoFade += -((Component)base.playerHeldBy.gameplayCamera).transform.forward * num4 * 0.75f + val2 * num4 * 2f; } } if (num2 >= 0.8f) { _overheatEffect.Play(); } else if (num2 <= 0.45f && _overheatEffect.isPlaying) { _overheatEffect.Stop(); } ParticleSystem[] particleSystems = _particleSystems; foreach (ParticleSystem val3 in particleSystems) { EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Lerp(_maxParticleRateOverTime, _minParticleRateOverTime, num3)); } float num7 = Mathf.Clamp(Mathf.Lerp(_minEmissionIntensity, _maxEmissionIntensity, num3), 0f, _maxEmissionIntensity); Color val4 = _baseEmissionColor * num7; _ceasefireMaterial.SetColor(_EmissiveColorHash, val4); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || _overCharged) { if (_firingStartRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_firingStartRoutine); _firingStartRoutine = null; } _firingEndRoutine = ((MonoBehaviour)this).StartCoroutine(DoEndFiringSequence()); base.isBeingUsed = false; } else { if (_firingEndRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_firingEndRoutine); } _firingEndRoutine = null; _firingStartRoutine = ((MonoBehaviour)this).StartCoroutine(DoStartFiringSequence()); base.isBeingUsed = true; } } private IEnumerator DoStartFiringSequence() { _idleSource.clip = _fireStartSound; _idleSource.Stop(); _idleSource.Play(); _startingTime = 0f; for (float timeElapsed = 0f; timeElapsed <= _fireStartSound.length; timeElapsed += Time.deltaTime) { yield return null; _startingTime = timeElapsed / _fireStartSound.length; } _particleSystemsGO.SetActive(true); _idleSource.clip = _fireLoopSound; _idleSource.Stop(); _idleSource.Play(); _firingStartRoutine = null; } private IEnumerator DoEndFiringSequence() { _particleSystemsGO.SetActive(false); _idleSource.clip = _fireEndSound; if (!_overCharged) { _idleSource.Stop(); _idleSource.Play(); } _endingTime = 2f; for (float timeElapsed = _fireEndSound.length; timeElapsed > 0f; timeElapsed -= Time.deltaTime) { yield return null; _endingTime = timeElapsed / _fireEndSound.length; } _idleSource.Stop(); _firingEndRoutine = null; } public void DoGatlingGunDamage() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) float currentDamageInterval = CurrentDamageInterval; if (_damageInterval < currentDamageInterval) { _damageInterval += Time.deltaTime; return; } if (PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } if (currentDamageInterval >= _maxDamageIntervalAtMaxCharge - 0.25f) { base.playerHeldBy.DamagePlayer(10, true, true, (CauseOfDeath)7, 0, false, base.playerHeldBy.velocityLastFrame * 10f); base.isBeingUsed = false; _overChargedTimer = _overChargedDuration; _idleSource.PlayOneShot(_overheatedSound); _overCharged = true; if (_firingStartRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_firingStartRoutine); _firingStartRoutine = null; } _firingEndRoutine = ((MonoBehaviour)this).StartCoroutine(DoEndFiringSequence()); } _damageInterval = 0f; if (!((NetworkBehaviour)this).IsServer) { return; } _enemyAIs.Clear(); Vector3 position = _ceasefireBarrel.transform.position; Vector3 val = position + -_ceasefireBarrel.transform.up * _minigunRange; int num = Physics.OverlapCapsuleNonAlloc(position, val, _minigunWidth, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val3 = default(IHittable); for (int i = 0; i < num; i++) { Collider val2 = _cachedColliders[i]; if (!((Component)val2).TryGetComponent(ref val3) || Physics.Linecast(position, ((Component)val2).gameObject.transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } PlayerControllerB val4 = (PlayerControllerB)(object)((val3 is PlayerControllerB) ? val3 : null); if (val4 != null) { if (!((Object)(object)val4 == (Object)(object)base.playerHeldBy)) { Vector3 val5 = ((Component)val4).transform.position - position; Vector3 normalized = ((Vector3)(ref val5)).normalized; val4.DamagePlayerFromOtherClientServerRpc(_minigunDamage, normalized, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, base.playerHeldBy)); val4.externalForceAutoFade += normalized * 2f; } continue; } EnemyAICollisionDetect val6 = (EnemyAICollisionDetect)(object)((val3 is EnemyAICollisionDetect) ? val3 : null); if (val6 != null) { if (!_enemyAIs.Contains(val6.mainScript)) { _enemyAIs.Add(val6.mainScript); val6.mainScript.HitEnemyOnLocalClient(1, position, base.playerHeldBy, true, -1); } } else { val3.Hit(1, position, base.playerHeldBy, true, -1); } } } } public class CreditPad : GrabbableObject { public AudioSource audioPlayer = null; public VideoPlayer videoPlayer = null; public int creditValue = 0; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); IncreaseShipValueServerRpc(); ((MonoBehaviour)this).StartCoroutine(WaitForEndOfFrame()); } private IEnumerator WaitForEndOfFrame() { yield return (object)new WaitForSeconds(0.25f); yield return (object)new WaitUntil((Func)(() => !audioPlayer.isPlaying && !videoPlayer.isPlaying)); if (base.isHeld || base.isPocketed) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } else { DespawnItemServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void DespawnItemServerRpc() { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } [ServerRpc(RequireOwnership = false)] public void IncreaseShipValueServerRpc() { int num = Mathf.Max(0, TerminalRefs.Instance.groupCredits + creditValue); TerminalRefs.Instance.SyncGroupCreditsClientRpc(num, TerminalRefs.Instance.numberOfItemsInDropship); PlaySoundClientRpc(); } [ClientRpc] public void PlaySoundClientRpc() { audioPlayer.Play(); ((Component)videoPlayer).gameObject.SetActive(true); if (!videoPlayer.playOnAwake) { videoPlayer.Play(); } } } public class CRPlanetUnlocker : GrabbableObject { [Header("Planet Unlocker Settings")] [SerializeReference] private DuskMoonReference _moonReference; [SerializeField] private bool _consumeOnUnlock = true; [SerializeField] [Tooltip("Leave empty to have no audio")] private AudioSource _unlockAudio; [SerializeField] [Tooltip("Leave empty to have no videoPlayer")] private VideoPlayer _unlockVideoPlayer; [Header("Notification Settings")] [SerializeField] private bool _showDisplayTip; [SerializeField] private HUDDisplayTip _displayTip; public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!TryUnlock()) { HUDManagerExtensions.DisplayTip(HUDManager.Instance, new HUDDisplayTip("Error", "Coordinates to " + ((DuskContentReference)_moonReference).Key.Key + " could not be verified, Cancelling.", (AlertType)1)); } if (Object.op_Implicit((Object)(object)_unlockAudio)) { _unlockAudio.Play(); } if (Object.op_Implicit((Object)(object)_unlockVideoPlayer)) { ((Component)_unlockVideoPlayer).gameObject.SetActive(true); if (!_unlockVideoPlayer.playOnAwake) { _unlockVideoPlayer.Play(); } } ((MonoBehaviour)this).StartCoroutine(WaitToDespawn()); } private bool TryUnlock() { DawnMoonInfo val = default(DawnMoonInfo); if (((DuskContentReference)(object)_moonReference).TryResolve(ref val)) { ITerminalPurchasePredicate purchasePredicate = val.DawnPurchaseInfo.PurchasePredicate; ProgressivePredicate val2 = (ProgressivePredicate)(object)((purchasePredicate is ProgressivePredicate) ? purchasePredicate : null); if (val2 == null) { HUDManagerExtensions.DisplayTip(HUDManager.Instance, _displayTip); return false; } val2.Unlock(_showDisplayTip ? _displayTip : null); val2.Unhide(); return true; } HUDManagerExtensions.DisplayTip(HUDManager.Instance, _displayTip); return false; } private IEnumerator WaitToDespawn() { if (Object.op_Implicit((Object)(object)_unlockVideoPlayer) && (Object)(object)_unlockVideoPlayer.clip != (Object)null) { yield return (object)new WaitForSeconds((float)_unlockVideoPlayer.clip.length); } else if (Object.op_Implicit((Object)(object)_unlockAudio) && (Object)(object)_unlockAudio.clip != (Object)null) { yield return (object)new WaitForSeconds(_unlockAudio.clip.length); } else { yield return (object)new WaitForSeconds(1f); } if ((PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy) || (!base.isHeld && !base.isPocketed)) && _consumeOnUnlock) { if (base.isHeld || base.isPocketed) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } else if (((NetworkBehaviour)this).IsOwner) { DespawnItemServerRpc(); } } } [ServerRpc(RequireOwnership = false)] public void DespawnItemServerRpc() { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public class CRWeapon : GrabbableObject { [Header("Melee Weapon")] public int HitForce = 1; public Transform weaponTip = null; [Tooltip("Shovel Default: 1.5\nKnife Default: 0.3")] public float weaponRange = 1.5f; [Tooltip("Shovel Default: 0.3\nKnife Default: 0.43")] public float weaponCooldown = 0.3f; [Tooltip("Leave blank for no blood particle on hit")] public ParticleSystem? bloodParticle = null; private float timeAtLastDamageDealt; [Header("Damage Targets")] public bool damagePlayers = true; [Tooltip("Passes a Player that has been damaged by the weapon")] public UnityEvent OnPlayerHit = new UnityEvent(); public bool damageEnemies = true; [Tooltip("Passes an Enemy that has been damaged by the weapon")] public UnityEvent OnEnemyHit = new UnityEvent(); public bool damageVehicles = false; [Tooltip("Passes a Vehicle that has been damaged by the weapon")] public UnityEvent OnVehicleHit = new UnityEvent(); public bool damageObjects = true; [Tooltip("Passes an Object that has been damaged by the weapon")] public UnityEvent OnObjectHit = new UnityEvent(); public bool damageSurfaces = true; [Tooltip("Passes a Surface that has been damaged by the weapon")] public UnityEvent OnSurfaceHit = new UnityEvent(); [Tooltip("On success of hitting anything.")] public UnityEvent OnHitSuccess = new UnityEvent(); [Tooltip("Default: 1\nPop Butlers: 5")] public int HitId = 1; [Header("Heavy Weapons")] [Tooltip("Heavy Weapons are similar to the shovel or signs.\nNon Heavy Weapons are similar to the Kitchen Knife")] public bool isHeavyWeapon = true; [Tooltip("Shovel Default: 0.35")] public float reelingTime = 0.35f; private float reelingAnimSpeed = 1f; [Tooltip("Shovel Default: 0.13")] public float swingTime = 0.13f; private bool isHoldingButton; [Header("Audio")] public AudioClip[] hitSFX = Array.Empty(); [Tooltip("Only used for Heavy Weapons")] public AudioClip[] reelUpSFX = Array.Empty(); public AudioClip[] swingSFX = Array.Empty(); public AudioClip[] finishReelUpSFX = Array.Empty(); public AudioClip[] hitEnemySFX = Array.Empty(); public AudioSource weaponAudio; public bool tryHitAllTimes = false; internal NetworkVariable heldOverHeadTimer = new NetworkVariable(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); internal bool reelingUp = false; private Coroutine? _reelingRoutine = null; internal RaycastHit[] cachedRaycastHits = (RaycastHit[])(object)new RaycastHit[16]; internal PlayerControllerB? previousPlayerHeldBy = null; private List _iHittableList = new List(); private List _hitVehicles = new List(); private List _hitPlayers = new List(); private List _hitEnemies = new List(); private static readonly int UseHeldItem1Animation = Animator.StringToHash("UseHeldItem1"); private static readonly int ShovelHitAnimation = Animator.StringToHash("shovelHit"); private static readonly int ReelingUpAnimation = Animator.StringToHash("reelingUp"); public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } previousPlayerHeldBy = base.playerHeldBy; if (base.itemProperties.requiresBattery && base.insertedBattery.empty) { return; } if (isHeavyWeapon) { isHoldingButton = buttonDown; if (buttonDown && _reelingRoutine == null) { _reelingRoutine = ((MonoBehaviour)this).StartCoroutine(ReelBackWeapon()); } return; } PlayRandomSFX(swingSFX); if (PlayerControllerBExtensions.IsLocalPlayer(previousPlayerHeldBy)) { previousPlayerHeldBy.playerBodyAnimator.SetTrigger(UseHeldItem1Animation); } if (((NetworkBehaviour)this).IsOwner && Time.realtimeSinceStartup - timeAtLastDamageDealt > weaponCooldown) { HitWeapon(); } } private IEnumerator ReelBackWeapon() { heldOverHeadTimer.Value = 0f; base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger(ShovelHitAnimation); base.playerHeldBy.playerBodyAnimator.SetBool(ReelingUpAnimation, true); reelingAnimSpeed = 0.35f / reelingTime; base.playerHeldBy.playerBodyAnimator.speed = reelingAnimSpeed; PlayRandomSFX(reelUpSFX); OnStartReelup(); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(reelingTime); base.playerHeldBy.playerBodyAnimator.speed = 1f; PlayRandomSFX(finishReelUpSFX); StartHeldOverHead(); while (isHoldingButton && base.isHeld) { NetworkVariable obj = heldOverHeadTimer; obj.Value += Time.deltaTime; yield return null; } EndHeldOverHead(); yield return (object)new WaitUntil((Func)(() => !isHoldingButton || !base.isHeld)); SwingHeavyWeapon(!base.isHeld); bool success = false; if (tryHitAllTimes) { float timeElapsed = 0f; while (timeElapsed <= swingTime && !success) { timeElapsed += Time.deltaTime; yield return null; success = HitWeapon(!base.isHeld); } } else { yield return (object)new WaitForSeconds(swingTime); success = HitWeapon(!base.isHeld); } EndWeaponHit(success); yield return (object)new WaitForSeconds(weaponCooldown); heldOverHeadTimer.Value = 0f; _reelingRoutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { ReelUpSFXClientRpc(); } [ClientRpc] public void ReelUpSFXClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { PlayRandomSFX(reelUpSFX); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; if (PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { base.playerHeldBy.playerBodyAnimator.speed = 1f; } } ((GrabbableObject)this).DiscardItem(); } public virtual void SwingHeavyWeapon(bool cancel = false) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool(ReelingUpAnimation, false); if (!cancel) { PlayRandomSFX(swingSFX); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public virtual void OnStartReelup() { StartOrStopReelingUpServerRpc(start: true); } [ServerRpc(RequireOwnership = false)] private void StartOrStopReelingUpServerRpc(bool start) { StartOrStopReelingUpClientRpc(start); } [ClientRpc] private void StartOrStopReelingUpClientRpc(bool start) { reelingUp = start; } public virtual void EndWeaponHit(bool success) { } public virtual void StartHeldOverHead() { StartOrStopReelingUpServerRpc(start: false); } public virtual void EndHeldOverHead() { } public bool HitWeapon(bool cancel = false) { //IL_0059: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_041c: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { Plugin.Logger.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called."); return false; } previousPlayerHeldBy.activatingItem = false; int num = -1; if (cancel) { return false; } previousPlayerHeldBy.twoHanded = false; int count = Physics.SphereCastNonAlloc(weaponTip.position, weaponRange, weaponTip.forward, cachedRaycastHits, 1.5f, MoreLayerMasks.CollidersAndRoomAndRailingAndTerrainAndHazardAndVehicleAndDefaultMask, (QueryTriggerInteraction)1); IOrderedEnumerable orderedEnumerable = from hit in cachedRaycastHits.Take(count) orderby ((RaycastHit)(ref hit)).distance select hit; _hitVehicles.Clear(); foreach (RaycastHit item in orderedEnumerable) { RaycastHit current = item; if (((Component)((RaycastHit)(ref current)).collider).gameObject.CompareTag("Player") || ((Component)((RaycastHit)(ref current)).collider).gameObject.CompareTag("Enemy")) { continue; } VehicleController val = GrabVehicleFromHit(current); if ((Object)(object)val != (Object)null) { _hitVehicles.Add(val); } DawnSurface component = ((Component)((RaycastHit)(ref current)).collider).gameObject.GetComponent(); foreach (DawnSurfaceInfo value in LethalContent.Surfaces.Values) { if (Object.op_Implicit((Object)(object)component) && component.SurfaceIndex > 0) { num = value.SurfaceIndex; if ((Object)(object)value.SurfaceVFXPrefab != (Object)null) { Singleton.Instance.Play(value.SurfaceVFXPrefab, ((RaycastHit)(ref current)).point, ((RaycastHit)(ref current)).normal, value.SurfaceVFXOffset, Mathf.Clamp((float)HitForce, 0.1f, 10f)); } Plugin.ExtendedLogging($"Hit surface: {((Object)((RaycastHit)(ref current)).collider).name} at position: {((Component)((RaycastHit)(ref current)).collider).gameObject.transform.position}"); break; } if (((Component)((RaycastHit)(ref current)).collider).gameObject.CompareTag(value.Surface.surfaceTag)) { continue; } num = value.SurfaceIndex; if ((Object)(object)value.SurfaceVFXPrefab != (Object)null) { Singleton.Instance.Play(value.SurfaceVFXPrefab, ((RaycastHit)(ref current)).point, ((RaycastHit)(ref current)).normal, value.SurfaceVFXOffset, Mathf.Clamp((float)HitForce, 0.1f, 10f)); } Plugin.ExtendedLogging($"Hit surface: {((Object)((RaycastHit)(ref current)).collider).name} at position: {((Component)((RaycastHit)(ref current)).collider).gameObject.transform.position}"); break; } } _iHittableList.Clear(); _hitEnemies.Clear(); _hitPlayers.Clear(); count = Physics.SphereCastNonAlloc(weaponTip.position, weaponRange, weaponTip.forward, cachedRaycastHits, 1.5f, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); orderedEnumerable = from hit in cachedRaycastHits.Take(count) orderby ((RaycastHit)(ref hit)).distance select hit; IHittable val2 = default(IHittable); foreach (RaycastHit item2 in orderedEnumerable) { RaycastHit current3 = item2; if (!((Component)((RaycastHit)(ref current3)).collider).gameObject.TryGetComponent(ref val2) || (Object)(object)((Component)((RaycastHit)(ref current3)).collider).gameObject == (Object)(object)((Component)previousPlayerHeldBy).gameObject) { continue; } Plugin.ExtendedLogging($"Hit hittable: {((Object)((RaycastHit)(ref current3)).collider).name} at position: {((Component)((RaycastHit)(ref current3)).collider).gameObject.transform.position}"); EnemyAICollisionDetect val3 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val3 != null) { if (!_hitEnemies.Contains(val3.mainScript)) { Plugin.ExtendedLogging($"Hit enemy: {((Object)((RaycastHit)(ref current3)).collider).name} at position: {((Component)((RaycastHit)(ref current3)).collider).gameObject.transform.position}"); _hitEnemies.Add(val3.mainScript); } continue; } PlayerControllerB val4 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val4 != null) { if (!_hitPlayers.Contains(val4)) { Plugin.ExtendedLogging($"Hit player: {((Object)((RaycastHit)(ref current3)).collider).name} at position: {((Component)((RaycastHit)(ref current3)).collider).gameObject.transform.position}"); _hitPlayers.Add(val4); } } else { _iHittableList.Add(val2); } } if (num == -1 && _hitEnemies.Count <= 0 && _hitPlayers.Count <= 0 && _hitVehicles.Count <= 0) { return false; } foreach (IHittable iHittable in _iHittableList) { OnWeaponHit(iHittable, ((Component)this).transform.position); } timeAtLastDamageDealt = Time.realtimeSinceStartup; RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); HandleHittingPlayers(_hitPlayers); HandleHittingEnemies(_hitEnemies); HandleHittingVehicles(_hitVehicles); HandleHittingSurface(num); if (isHeavyWeapon) { base.playerHeldBy.playerBodyAnimator.SetTrigger(ShovelHitAnimation); } OnHitSuccess.Invoke(); return true; } private void HandleHittingSurface(int surfaceID) { if (damageSurfaces && surfaceID != -1) { OnSurfaceHit.Invoke(surfaceID); weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX, 1f); PlayRandomSFX(hitSFX); HitWeaponServerRpc(surfaceID); } } private void HandleHittingPlayers(List __hitPlayers) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) if (!damagePlayers || __hitPlayers.Count <= 0) { return; } List list = new List(); foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && !spawnedEnemy.isEnemyDead) { CentipedeAI val = (CentipedeAI)(object)((spawnedEnemy is CentipedeAI) ? spawnedEnemy : null); if (val != null && (Object)(object)val.clingingToPlayer != (Object)null) { list.Add(val); } } } foreach (PlayerControllerB player in __hitPlayers) { Plugin.ExtendedLogging($"Hitting player: {player}"); OnPlayerHit.Invoke(player); if (!list.Any((CentipedeAI x) => (Object)(object)x.clingingToPlayer == (Object)(object)player)) { player.DamagePlayerFromOtherClientServerRpc(HitForce * 10, ((Component)weaponTip).transform.position, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player)); } } } private void HandleHittingEnemies(List _hitEnemies) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (!damageEnemies || _hitEnemies.Count <= 0) { return; } foreach (EnemyAI _hitEnemy in _hitEnemies) { Plugin.ExtendedLogging($"Hitting enemy: {_hitEnemy}"); OnEnemyHit.Invoke(_hitEnemy); if (!_hitEnemy.isEnemyDead) { _hitEnemy.HitEnemyOnLocalClient(HitForce, ((Component)weaponTip).transform.position, previousPlayerHeldBy, true, HitId); } } PlayRandomSFX(hitEnemySFX); ParticleSystem? obj = bloodParticle; if (obj != null) { obj.Play(true); } } private void HandleHittingVehicles(List _hitVehicles) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!damageVehicles || _hitVehicles.Count <= 0) { return; } foreach (VehicleController _hitVehicle in _hitVehicles) { _hitVehicle.PushTruckServerRpc(((Component)previousPlayerHeldBy).transform.position, ((Component)weaponTip).transform.position); _hitVehicle.DealPermanentDamage(HitForce, ((Component)previousPlayerHeldBy).transform.position); OnVehicleHit.Invoke(_hitVehicle); } } public VehicleController? GrabVehicleFromHit(RaycastHit hit) { if (!damageVehicles) { return null; } if (((Component)((RaycastHit)(ref hit)).collider).gameObject.layer != 30) { return null; } VehicleController val = default(VehicleController); if (!((Component)((RaycastHit)(ref hit)).collider).TryGetComponent(ref val)) { return null; } if (_hitVehicles.Contains(val)) { return null; } return val; } public bool OnWeaponHit(IHittable target, Vector3 hitDir) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!damageObjects) { return false; } OnObjectHit.Invoke(target); return target.Hit(HitForce, hitDir, previousPlayerHeldBy, true, HitId); } [ServerRpc] public void HitWeaponServerRpc(int hitSurfaceID) { HitWeaponClientRpc(hitSurfaceID); } [ClientRpc] public void HitWeaponClientRpc(int hitSurfaceID) { if (!((NetworkBehaviour)this).IsOwner) { PlayRandomSFX(hitSFX); HitSurface(hitSurfaceID); } } private void PlayRandomSFX(AudioClip[] clips) { if (clips.Length != 0) { RoundManager.PlayRandomClip(weaponAudio, clips, true, 1f, 0, 1000); } } private void HitSurface(int hitSurfaceID) { weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } } public class Detonator : GrabbableObject { public AudioSource detonatorSource = null; public AudioClip useSound = null; public AudioClip leverPressed = null; public SkinnedMeshRenderer skinnedMeshRenderer = null; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); detonatorSource.PlayOneShot(useSound); ((MonoBehaviour)this).StartCoroutine(DoBlowAnimation()); } private IEnumerator DoBlowAnimation() { float currentWeight = skinnedMeshRenderer.GetBlendShapeWeight(0); while (currentWeight < 100f) { currentWeight = skinnedMeshRenderer.GetBlendShapeWeight(0); skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(currentWeight + Time.deltaTime * 100f, 0f, 100f)); yield return null; } detonatorSource.PlayOneShot(leverPressed); NitroCrate[] array = NitroCrate.nitroCrates.ToArray(); foreach (NitroCrate crate in array) { if (((NetworkBehaviour)this).IsServer) { crate.RequestServerToDespawnServerRpc(); } } yield return (object)new WaitForSeconds(4f); while (currentWeight > 0f) { currentWeight = skinnedMeshRenderer.GetBlendShapeWeight(0); skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(currentWeight - Time.deltaTime * 100f, 0f, 100f)); yield return null; } } } public class DisposableCamera : GrabbableObject { } public class DuckyTube : GrabbableObject { } public class EazyBake : GrabbableObject { private List collidersInside = new List(); private float timeSinceLastDamage = 0f; private static readonly int FiringHash = Animator.StringToHash("Firing"); private PlayerControllerB? playerWhoToggledOn = null; private List hitPlayers = new List(); private List hitEnemies = new List(); private List hitObjects = new List(); private List hitExplodeables = new List(); [field: SerializeField] public float DamagerTimer { get; private set; } = 0.25f; [field: SerializeField] public float HinderedMultiplier { get; private set; } = 2f; [field: SerializeField] public Animator Animator { get; private set; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (base.isBeingUsed) { playerWhoToggledOn = base.playerHeldBy; Animator.SetBool(FiringHash, true); } else { playerWhoToggledOn = null; Animator.SetBool(FiringHash, false); } } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); Animator.SetBool(FiringHash, false); playerWhoToggledOn = null; } private void FixedUpdate() { collidersInside.Clear(); } internal void OnFixedUpdateStay(Collider other) { if (!collidersInside.Contains(other)) { collidersInside.Add(other); } } public override void Update() { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if ((Object)(object)base.playerHeldBy != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy) && base.playerHeldBy.isHoldingInteract && !base.isPocketed && (Object)(object)base.playerHeldBy.hoveringOverTrigger != (Object)null && base.playerHeldBy.hoveringOverTrigger.animationString == "SA_ChargeItem" && base.playerHeldBy.isHoldingInteract) { base.playerHeldBy.hoveringOverTrigger.Interact(base.playerHeldBy.thisPlayerBody); } if (!(timeSinceLastDamage < Time.realtimeSinceStartup)) { return; } List list = new List(hitPlayers); hitPlayers.Clear(); hitEnemies.Clear(); hitObjects.Clear(); hitExplodeables.Clear(); timeSinceLastDamage = Time.realtimeSinceStartup + DamagerTimer; foreach (Collider item in collidersInside) { IHittable component = ((Component)item).GetComponent(); IExplodeable component2 = ((Component)item).GetComponent(); if ((component2 == null && component == null) || Physics.Linecast(((Component)item).transform.position, ((Component)this).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } if (component2 != null) { if (!hitExplodeables.Contains(component2)) { hitExplodeables.Add(component2); } } else { if (component == null) { continue; } PlayerControllerB val = (PlayerControllerB)(object)((component is PlayerControllerB) ? component : null); if (val != null) { if (!hitPlayers.Contains(val) && !((Object)(object)val == (Object)(object)base.playerHeldBy)) { hitPlayers.Add(val); } continue; } EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((component is EnemyAICollisionDetect) ? component : null); if (val2 != null) { if (!hitEnemies.Contains(val2.mainScript)) { hitEnemies.Add(val2.mainScript); } } else if (!hitObjects.Contains(component)) { hitObjects.Add(component); } } } foreach (PlayerControllerB hitPlayer in hitPlayers) { if (!list.Contains(hitPlayer)) { hitPlayer.movementSpeed /= HinderedMultiplier; } if (PlayerControllerBExtensions.IsLocalPlayer(hitPlayer)) { hitPlayer.DamagePlayer(5, true, true, (CauseOfDeath)7, 0, false, default(Vector3)); } } foreach (PlayerControllerB item2 in list) { if (!hitPlayers.Contains(item2)) { item2.movementSpeed *= HinderedMultiplier; } } foreach (EnemyAI hitEnemy in hitEnemies) { if (((NetworkBehaviour)hitEnemy).IsOwner) { hitEnemy.HitFromExplosion(4f); } hitEnemy.HitEnemy(1, playerWhoToggledOn, false, 745737); } if (!((NetworkBehaviour)this).IsServer) { return; } foreach (IHittable hitObject in hitObjects) { hitObject.Hit(1, -((Component)this).transform.forward, playerWhoToggledOn, false, 745737); } foreach (IExplodeable hitExplodeable in hitExplodeables) { hitExplodeable.OnExplosion(1, ((Component)this).transform.position, 4f); } } } public class ElectricSlugger : GrabbableObject { public SkinnedMeshRenderer skinnedMeshRenderer = null; public Transform weaponTip = null; public VisualEffect shootVFX = null; public List lights = new List(); [Header("Audio")] public AudioSource idleSource = null; public AudioSource firingSource = null; public AudioClip fireSound = null; public AudioClip chargeSound = null; private RaycastHit[] cachedRaycastHits = (RaycastHit[])(object)new RaycastHit[16]; private float pumpTimer = 0f; private int pumpCount = 0; private bool canFire = true; public override void Start() { ((GrabbableObject)this).Start(); foreach (Light light in lights) { ((Behaviour)light).enabled = false; } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); Plugin.InputActionsInstance.PumpSlugger.performed += OnPumpDone; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); foreach (Light light in lights) { ((Behaviour)light).enabled = true; } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); foreach (Light light in lights) { ((Behaviour)light).enabled = false; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); Plugin.InputActionsInstance.PumpSlugger.performed -= OnPumpDone; foreach (Light light in lights) { ((Behaviour)light).enabled = false; } } public void OnPumpDone(CallbackContext context) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if (!(pumpTimer > 0f) && !base.insertedBattery.empty && !(base.insertedBattery.charge <= 0f) && !base.isBeingUsed && !base.isPocketed && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy)) { ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { DoPumpActionServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void DoPumpActionServerRpc() { DoPumpActionClientRpc(); } [ClientRpc] private void DoPumpActionClientRpc() { ((MonoBehaviour)this).StartCoroutine(DoPumpAction()); } private IEnumerator DoPumpAction() { pumpTimer = 1.5f; canFire = false; float elapsed = 0f; firingSource.PlayOneShot(chargeSound); while (elapsed < 0.25f) { elapsed += Time.deltaTime; skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(elapsed * 200f, 0f, 100f)); yield return null; } while (elapsed > 0f) { elapsed -= Time.deltaTime; skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(elapsed * 200f, 0f, 100f)); yield return null; } pumpCount++; canFire = true; } public override void Update() { ((GrabbableObject)this).Update(); pumpTimer -= Time.deltaTime; } public override void LateUpdate() { ((GrabbableObject)this).LateUpdate(); ShakeTransform(((Component)this).transform, pumpCount); } public void ShakeTransform(Transform _transform, int intensity) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) idleSource.volume = 0f; if (intensity > 0) { idleSource.volume = 1f; float num = Mathf.Clamp((float)intensity * 0.00025f * (float)Random.Range(-1, 2), -0.002f, 0.002f); _transform.localPosition = new Vector3(_transform.localPosition.x + num, _transform.localPosition.y + num, _transform.localPosition.z + num); } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0050: 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_00e5: 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_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!canFire || base.insertedBattery.empty || base.insertedBattery.charge <= 0f) { return; } int num = Physics.SphereCastNonAlloc(((Component)base.playerHeldBy.gameplayCamera).transform.position, 1f, ((Component)base.playerHeldBy).gameObject.transform.forward, cachedRaycastHits, 999f, LayerMask.GetMask(new string[8] { "Default", "Player", "Room", "Props", "Enemies", "Terrain", "MapHazards", "Vehicle" }), (QueryTriggerInteraction)2); IHittable val = default(IHittable); for (int i = 0; i < num; i++) { CRUtilities.CreateExplosion(((RaycastHit)(ref cachedRaycastHits[i])).transform.position, spawnExplosionEffect: true, 0, 0f, 0f, 0, base.playerHeldBy, null, 0f); if (((Component)((RaycastHit)(ref cachedRaycastHits[i])).collider).gameObject.TryGetComponent(ref val)) { PlayerControllerB val2 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null); if ((val2 == null || (!((Object)(object)val2 == (Object)(object)base.playerHeldBy) && !val2.isPlayerDead)) && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)base.playerHeldBy) { val.Hit(2 * (pumpCount + 1), ((Component)base.playerHeldBy.gameplayCamera).transform.position, base.playerHeldBy, true, -1); } } } firingSource.PlayOneShot(fireSound); shootVFX.Play(); Battery insertedBattery = base.insertedBattery; insertedBattery.charge -= 0.1f * (float)(pumpCount + 1); if (base.insertedBattery.charge <= 0f) { foreach (Light light in lights) { ((Behaviour)light).enabled = false; } } if (PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.externalForceAutoFade += -((Component)base.playerHeldBy.gameplayCamera).transform.forward * (float)(pumpCount + 1) * 5f * (base.playerHeldBy.isCrouching ? 0.25f : 1f); float num2 = (pumpCount + 1) * 2; ((MonoBehaviour)this).StartCoroutine(CRUtilities.ForcePlayerLookup(base.playerHeldBy, num2 / 5f)); pumpCount = 0; } } public class EzBakeBakingRegion : MonoBehaviour { [field: SerializeField] public EazyBake EazyBake { get; private set; } public void OnTriggerStay(Collider other) { EazyBake.OnFixedUpdateStay(other); } } public class FakeSnailCat : GrabbableObject { [SerializeField] private OwnerNetworkAnimator _ownerNetworkAnimator = null; [SerializeField] private Animator _animator = null; [SerializeField] private Renderer _renderer = null; internal PlayerControllerB lastOwner = null; internal Vector3 localScale = Vector3.one; internal string snailCatName = "Salted Beef"; internal float shiftHash = 0f; private bool destroyed = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(DelayForBit()); } } private IEnumerator DelayForBit() { yield return null; yield return null; InitaliseFakeSnailCatServerRpc(); } [ServerRpc(RequireOwnership = false)] private void InitaliseFakeSnailCatServerRpc() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) InitaliseFakeSnailCatClientRpc(PlayerControllerReference.op_Implicit(lastOwner), localScale, snailCatName, shiftHash); } [ClientRpc] private void InitaliseFakeSnailCatClientRpc(PlayerControllerReference currentOwner, Vector3 scale, string name, float magicalHashNumber) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(InitaliseFakeSnailCat(PlayerControllerReference.op_Implicit(currentOwner), scale, name, magicalHashNumber)); } public IEnumerator InitaliseFakeSnailCat(PlayerControllerB currentOwner, Vector3 scale, string name, float magicalHashNumber) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForEndOfFrame(); Transform transform = ((Component)this).transform; Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; transform.position = ((Bounds)(ref bounds)).center; GameNetworkManager.Instance.localPlayerController.SetItemInElevator(true, true, (GrabbableObject)(object)this); lastOwner = currentOwner; if (PlayerControllerBExtensions.IsLocalPlayer(lastOwner)) { CRUtilities.MakePlayerGrabObject(lastOwner, (GrabbableObject)(object)this); } ((Component)this).transform.localScale = scale; base.originalScale = scale; snailCatName = name; ((Component)this).GetComponentInChildren().headerText = snailCatName; _renderer.GetMaterial().SetFloat(SnailCatAI.ShiftHash, magicalHashNumber); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); _animator.SetBool(SnailCatPhysicsProp.GrabbedAnimation, true); _animator.SetBool(SnailCatPhysicsProp.SittingAnimation, false); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); _animator.SetBool(SnailCatPhysicsProp.GrabbedAnimation, false); _animator.SetBool(SnailCatPhysicsProp.SittingAnimation, true); } public override void Update() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((GrabbableObject)this).Update(); if (((NetworkBehaviour)this).IsServer && !destroyed && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving) { destroyed = true; EnemyType enemyType = ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.RealEnemySnailCat].EnemyType; NetworkObjectReference val = RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, enemyType); SnailCatAI component = ((Component)NetworkObjectReference.op_Implicit(val)).GetComponent(); component.wasFake = true; if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null) { component.playerHolding = base.playerHeldBy; } component.fakeLocalScale = ((Component)this).transform.localScale; component.currentName = snailCatName; component.shiftHash = _renderer.GetMaterial().GetFloat(SnailCatAI.ShiftHash); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } public class FlattenedBody : GrabbableObject { internal PlayerControllerB? _flattenedBodyName = null; [SerializeField] private ScanNodeProperties _scanNodeProperties = null; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitUntilNameSet()); } } private IEnumerator WaitUntilNameSet() { yield return null; yield return null; if (!((Object)(object)_flattenedBodyName == (Object)null)) { ChangeScanNodeNameServerRpc(_scanNodeProperties.headerText + " Of " + _flattenedBodyName.playerUsername); } } [ServerRpc] private void ChangeScanNodeNameServerRpc(string newName) { ChangeScanNodeNameClientRpc(newName); } [ClientRpc] private void ChangeScanNodeNameClientRpc(string newName) { _scanNodeProperties.headerText = newName; } } public class FogHorn : GrabbableObject { public VisualEffect fogHornEffect = null; [Header("Audio")] public AudioSource audioSource = null; public AudioClip useSound = null; public AudioClip failSound = null; private NetworkVariable timesUsed = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return timesUsed.Value; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); timesUsed.Value = saveData; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); TryActivateFogHornServerRpc(); } [ServerRpc(RequireOwnership = false)] private void TryActivateFogHornServerRpc() { int num = 5 + timesUsed.Value * 5; if (Random.Range(0, 100) < num) { DoSucceedOrFailClientRpc(succeed: false); return; } SelectableLevelExtensions.GetDawnInfo(StartOfRound.Instance.currentLevel).ChangeWeatherTo((LevelWeatherType)(-1)); NetworkVariable obj = timesUsed; int value = obj.Value; obj.Value = value + 1; DoSucceedOrFailClientRpc(succeed: true); } [ClientRpc] private void DoSucceedOrFailClientRpc(bool succeed) { if (succeed) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); audioSource.PlayOneShot(useSound); fogHornEffect.Play(); } else { audioSource.PlayOneShot(failSound); } } } public class FogHornEffect : MonoBehaviour { [SerializeField] private VisualEffect _fogEffect = null; private static readonly int _objectForwardHash = Shader.PropertyToID("ObjectForward"); private static readonly int _objectUpHash = Shader.PropertyToID("ObjectUp"); public void Update() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) _fogEffect.SetVector3(_objectForwardHash, -((Component)this).transform.up); _fogEffect.SetVector3(_objectUpHash, -((Component)this).transform.forward); } } public class FragGrenade : GrabbableObject { } public class Fruit : GrabbableObject { [ClientRpc] public void SetFruitValueClientRpc(int value) { ((GrabbableObject)this).SetScrapValue(value); } } public class GoldRigo : GrabbableObject { } public class GuardPhone : GrabbableObject { [SerializeField] private AudioSource _callSource = null; [SerializeField] private AudioClip _callSound = null; public override void ItemActivate(bool used, bool buttonDown = true) { //IL_007b: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving || (Object)(object)base.playerHeldBy == (Object)null || base.playerHeldBy.isInsideFactory) { base.currentUseCooldown = 0f; } else if (((NetworkBehaviour)this).IsServer) { Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)base.playerHeldBy).transform.position + ((Component)base.playerHeldBy).transform.forward * 5f, 5f, default(NavMeshHit)); ((MonoBehaviour)this).StartCoroutine(SpawnWithDelay(randomNavMeshPositionInRadius)); } } private IEnumerator SpawnWithDelay(Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) _callSource.PlayOneShot(_callSound); yield return (object)new WaitForSeconds(_callSound.length); yield return (object)new WaitForSeconds(3f); RoundManager.Instance.SpawnEnemyGameObject(position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.Guardsman].EnemyType); } } public class Hoverboard : GrabbableObject, IHittable { public enum HoverboardMode { None, Held, Mounted } public enum HoverboardTypes { Regular } public Rigidbody hb = null; public InteractTrigger trigger = null; private bool turnedOn = false; public GameObject hoverboardSeat = null; public Transform[] anchors = (Transform[])(object)new Transform[4]; [NonSerialized] public PlayerControllerB? playerControlling; private bool _isHoverForwardHeld = false; private bool _isHoverBackwardHeld = false; private bool _isHoverLeftHeld = false; private bool _isHoverRightHeld = false; private bool _isSprintHeld = false; private bool jumpCooldown = true; public Transform hoverboardChild = null; private HoverboardTypes hoverboardType = HoverboardTypes.Regular; private bool weightApplied = false; private float _speedMultiplier = 1f; private float _chargeIncreaseMultiplier = 1f; private HoverboardMode hoverboardMode; private Quaternion resetChildRotation; private bool isAdjusting = false; private readonly Vector3[] initialAnchorPositions = (Vector3[])(object)new Vector3[4]; private readonly Quaternion[] initialAnchorRotations = (Quaternion[])(object)new Quaternion[4]; public override void Start() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) StartBaseImportant(); ConfigureHoverboard(); ((GrabbableObject)this).EnablePhysics(false); base.insertedBattery = new Battery(false, 1f); ((GrabbableObject)this).ChargeBatteries(); if (hoverboardType != HoverboardTypes.Regular) { } SwitchModeExtension(SwitchingOff: true); resetChildRotation = hoverboardChild.rotation; if (((NetworkBehaviour)this).IsServer) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(); Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(hoverboardChild.position) && !base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.elevatorTransform, true); base.isInShipRoom = true; base.isInElevator = true; } else { bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(hoverboardChild.position) && base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.propsContainer, true); base.isInShipRoom = false; base.isInElevator = false; } } } for (int i = 0; i < anchors.Length; i++) { initialAnchorPositions[i] = anchors[i].localPosition; initialAnchorRotations[i] = anchors[i].localRotation; } SetHoverboardState(0); } private void ConfigureHoverboard() { _speedMultiplier = ((AssetBundleLoader)(object)ContentHandler.Instance.Hoverboard).GetConfig("Hoverboard | Speed Multiplier").Value; _chargeIncreaseMultiplier = ((AssetBundleLoader)(object)ContentHandler.Instance.Hoverboard).GetConfig("Hoverboard | Charge Increase Multiplier").Value; } public void OnInteract(PlayerControllerB player) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)player) && hoverboardMode == HoverboardMode.None) { ((MonoBehaviour)this).StartCoroutine(OnInteractCoroutine(player)); } } public IEnumerator OnInteractCoroutine(PlayerControllerB player) { SetPlayerTargetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player)); yield return (object)new WaitUntil((Func)(() => (Object)(object)playerControlling == (Object)(object)player)); SetHoverboardStateServerRpc(2); } public void ModeHandler(CallbackContext context) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (hoverboardMode == HoverboardMode.None || (Object)(object)playerControlling == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(playerControlling)) { return; } ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { if (hoverboardMode == HoverboardMode.Mounted) { SetHoverboardStateServerRpc(1); } else if (hoverboardMode == HoverboardMode.Held) { SetHoverboardStateServerRpc(2); } Plugin.InputActionsInstance.SwitchMode.performed += ModeHandler; } } public void OnKeyHeld(CallbackContext context) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)playerControlling) { return; } ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; InputAction action = ((CallbackContext)(ref context)).action; bool forwardHeld = false; bool backwardHeld = false; bool leftHeld = false; bool rightHeld = false; bool sprintHeld = false; if (val.wasPressedThisFrame) { switch (action.name) { case "HoverForward": forwardHeld = true; break; case "HoverBackward": backwardHeld = true; break; case "HoverLeft": leftHeld = true; break; case "HoverRight": rightHeld = true; break; case "SprintForward": sprintHeld = true; break; } SetHoverboardHeldServerRpc(forwardHeld, backwardHeld, rightHeld, leftHeld, sprintHeld); } } public void OnKeyReleased(CallbackContext context) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)playerControlling) { return; } ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; InputAction action = ((CallbackContext)(ref context)).action; bool forwardHeld = true; bool backwardHeld = true; bool leftHeld = true; bool rightHeld = true; bool sprintHeld = true; if (val.wasReleasedThisFrame) { switch (action.name) { case "HoverForward": forwardHeld = false; break; case "HoverBackward": backwardHeld = false; break; case "HoverLeft": leftHeld = false; break; case "HoverRight": rightHeld = false; break; case "SprintForward": sprintHeld = false; break; } SetHoverboardReleasedServerRpc(forwardHeld, backwardHeld, rightHeld, leftHeld, sprintHeld); } } public void MovementHandler(CallbackContext context) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)playerControlling)) { ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame && ((CallbackContext)(ref context)).action == Plugin.InputActionsInstance.HoverUp) { HandleMovement(); } } } public void FixedUpdate() { if (!((Object)(object)playerControlling == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerControlling) && turnedOn && hoverboardMode != HoverboardMode.Held) { for (int i = 0; i < 4; i++) { ApplyForce(anchors[i]); } } } public override void Update() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (HandleDropping()) { return; } if (_isSprintHeld && !base.insertedBattery.empty && _isHoverForwardHeld && hoverboardMode == HoverboardMode.Mounted) { base.isBeingUsed = true; base.insertedBattery.charge = Mathf.Clamp(base.insertedBattery.charge - Time.deltaTime / base.itemProperties.batteryUsage, 0f, 1f); if (base.insertedBattery.charge <= 0f && !base.insertedBattery.empty) { base.insertedBattery.empty = true; } } else { base.isBeingUsed = false; base.insertedBattery.charge = Mathf.Clamp(base.insertedBattery.charge + (Time.deltaTime + _chargeIncreaseMultiplier / base.itemProperties.batteryUsage), 0f, 1f); if (base.insertedBattery.charge >= 0.15f && base.insertedBattery.empty) { base.insertedBattery.empty = false; } } if ((hoverboardMode == HoverboardMode.Held || hoverboardMode == HoverboardMode.Mounted) && (Object)(object)playerControlling == (Object)null) { DropHoverboard(); } else { if ((Object)(object)playerControlling == (Object)null) { return; } if (PlayerControllerBExtensions.IsLocalPlayer(playerControlling) && Vector3.Distance(hoverboardChild.position, ((Component)playerControlling).transform.position) > 5f) { SetHoverboardStateServerRpc(1); return; } if (PlayerControllerBExtensions.IsLocalPlayer(playerControlling) && hoverboardMode == HoverboardMode.Mounted) { Vector2 val = Plugin.InputActionsInstance.MouseDelta.ReadValue(); float num = 0.1f; float num2 = val.x * num; float num3 = val.y * num * 0.8f; Vector2 inputVector = default(Vector2); ((Vector2)(ref inputVector))..ctor(0f, num3); CalculateVerticalLookingInput(inputVector, playerControlling); hoverboardChild.Rotate(Vector3.up, num2); } if (hoverboardMode == HoverboardMode.Mounted && (Object)(object)((Component)playerControlling).transform.GetParent() != (Object)(object)hoverboardSeat.transform) { ((Component)playerControlling).transform.SetParent(hoverboardSeat.transform, true); Plugin.ExtendedLogging($"Setting parent of {playerControlling} to {((Component)playerControlling).transform.GetParent()}"); } if (Object.op_Implicit((Object)(object)playerControlling.inAnimationWithEnemy) || playerControlling.isClimbingLadder || (hoverboardMode == HoverboardMode.Mounted && playerControlling.isClimbingLadder)) { DropHoverboard(); return; } if (hoverboardMode == HoverboardMode.Mounted && turnedOn && PlayerControllerBExtensions.IsLocalPlayer(playerControlling)) { ((Component)playerControlling).transform.position = hoverboardSeat.transform.position; if (_isHoverForwardHeld) { hb.AddForce(hoverboardChild.right * _speedMultiplier * 25f * ((_isSprintHeld && !base.insertedBattery.empty) ? 2f : 1f), (ForceMode)5); } if (_isHoverBackwardHeld) { hb.AddForce(-hoverboardChild.right * _speedMultiplier * 5f * ((_isSprintHeld && !base.insertedBattery.empty) ? 2f : 1f), (ForceMode)5); } if (_isHoverLeftHeld) { hb.AddForce(hoverboardChild.forward * _speedMultiplier * 5f * ((_isSprintHeld && !base.insertedBattery.empty) ? 2f : 1f), (ForceMode)5); } if (_isHoverRightHeld) { hb.AddForce(-hoverboardChild.forward * _speedMultiplier * 5f * ((_isSprintHeld && !base.insertedBattery.empty) ? 2f : 1f), (ForceMode)5); } if (!isAdjusting) { CheckIfUpsideDown(); } } if (hoverboardMode == HoverboardMode.Mounted) { playerControlling.ResetFallGravity(); } } } public override void LateUpdate() { //IL_005d: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); if (!((NetworkBehaviour)this).IsServer || !StartOfRound.Instance.shipHasLanded || (StartOfRound.Instance.shipIsLeaving && hoverboardMode != HoverboardMode.Held)) { return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(); Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(hoverboardChild.position) && !base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.elevatorTransform, true); base.isInShipRoom = true; base.isInElevator = true; return; } bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(hoverboardChild.position) && base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.propsContainer, true); base.isInShipRoom = false; base.isInElevator = false; } } public bool HandleDropping() { if ((Object)(object)playerControlling == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(playerControlling) || !Plugin.InputActionsInstance.DropHoverboard.triggered) { return false; } DropHoverboard(); return true; } public void DropHoverboard() { SetHoverboardStateServerRpc(0); SetPlayerTargetServerRpc(-1); SwitchModeExtension(SwitchingOff: true); } private void HandleMovement() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playerControlling == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(playerControlling)) { Vector3 val = Vector3.zero; float num = 0f; if (jumpCooldown) { jumpCooldown = false; val += hoverboardChild.up; num = 1500f; ((MonoBehaviour)this).StartCoroutine(JumpTimerStart()); } if (!(val == Vector3.zero)) { hb.AddForce(val * num, (ForceMode)5); } } } public IEnumerator JumpTimerStart() { yield return (object)new WaitForSeconds(2f); jumpCooldown = true; } public void ApplyForce(Transform anchor) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(anchor.position, -anchor.up, ref val, 1000f, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { float num = Mathf.Clamp(Mathf.Abs(1f / (((RaycastHit)(ref val)).point.y - anchor.position.y)), 0f, base.isInShipRoom ? 3f : 100f); hb.AddForceAtPosition(hoverboardChild.up * num * 8f, anchor.position, (ForceMode)5); } } [ServerRpc(RequireOwnership = false)] public void SetPlayerTargetServerRpc(int PlayerID) { SetPlayerTargetClientRpc(PlayerID); } [ClientRpc] public void SetPlayerTargetClientRpc(int PlayerID) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown if (PlayerID == -1 && (Object)(object)playerControlling != (Object)null) { playerControlling.disableMoveInput = false; playerControlling.disableLookInput = false; if (!playerControlling.isInHangarShipRoom) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)playerControlling).transform.position)) { ((Component)playerControlling).transform.SetParent(playerControlling.playersManager.playersContainer, true); goto IL_00b9; } } ((Component)playerControlling).transform.SetParent(playerControlling.playersManager.elevatorTransform, true); goto IL_00b9; } if ((Object)(object)StartOfRound.Instance.allPlayerScripts[PlayerID] == (Object)null) { Plugin.Logger.LogWarning((object)$"Index invalid! {PlayerID}"); return; } if ((Object)(object)playerControlling == (Object)(object)StartOfRound.Instance.allPlayerScripts[PlayerID]) { Plugin.ExtendedLogging($"{this} already targeting: {playerControlling.playerUsername}"); return; } hoverboardChild.rotation = resetChildRotation; playerControlling = StartOfRound.Instance.allPlayerScripts[PlayerID]; if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.ChangeOwnership(playerControlling.actualClientId); } if (PlayerControllerBExtensions.IsLocalPlayer(playerControlling) && !playerControlling.GetCRPlayerData().ridingHoverboard) { DialogueSegment val = new DialogueSegment { speakerText = "Hoverboard Tooltips", bodyText = "C to Drop, E to Mount, F to Switch between Held and Mounted mode, Space to Jump, Shift to activate Boost.", waitTime = 7f }; HUDManager.Instance.ReadDialogue((DialogueSegment[])(object)new DialogueSegment[1] { val }); } playerControlling.GetCRPlayerData().ridingHoverboard = true; playerControlling.GetCRPlayerData().hoverboardRiding = this; ((Component)playerControlling).transform.SetPositionAndRotation(hoverboardSeat.transform.position, hoverboardSeat.transform.rotation * Quaternion.Euler(0f, 90f, 0f)); Plugin.ExtendedLogging($"{this} setting target to: {playerControlling.playerUsername}"); return; IL_00b9: playerControlling = null; Plugin.ExtendedLogging($"Clearing target on {this}"); } [ServerRpc(RequireOwnership = false)] internal void SetHoverboardHeldServerRpc(bool forwardHeld, bool backwardHeld, bool rightHeld, bool leftHeld, bool sprintHeld) { SetHoverboardHeldClientRpc(forwardHeld, backwardHeld, rightHeld, leftHeld, sprintHeld); } [ClientRpc] internal void SetHoverboardHeldClientRpc(bool forwardHeld, bool backwardHeld, bool rightHeld, bool leftHeld, bool sprintHeld) { if (forwardHeld) { _isHoverForwardHeld = true; } if (backwardHeld) { _isHoverBackwardHeld = true; } if (rightHeld) { _isHoverRightHeld = true; } if (leftHeld) { _isHoverLeftHeld = true; } if (sprintHeld) { _isSprintHeld = true; } } [ServerRpc(RequireOwnership = false)] internal void SetHoverboardReleasedServerRpc(bool forwardHeld, bool backwardHeld, bool rightHeld, bool leftHeld, bool sprintHeld) { SetHoverboardReleasedClientRpc(forwardHeld, backwardHeld, rightHeld, leftHeld, sprintHeld); } [ClientRpc] internal void SetHoverboardReleasedClientRpc(bool forwardHeld, bool backwardHeld, bool rightHeld, bool leftHeld, bool sprintHeld) { if (!forwardHeld) { _isHoverForwardHeld = false; } if (!backwardHeld) { _isHoverBackwardHeld = false; } if (!rightHeld) { _isHoverRightHeld = false; } if (!leftHeld) { _isHoverLeftHeld = false; } if (!sprintHeld) { _isSprintHeld = false; } } [ServerRpc(RequireOwnership = false)] internal void SetHoverboardStateServerRpc(int state) { SetHoverboardStateClientRpc(state); } [ClientRpc] internal void SetHoverboardStateClientRpc(int state) { SetHoverboardState(state); } private void SetHoverboardState(int state) { if ((Object)(object)playerControlling == (Object)null && hoverboardMode != HoverboardMode.None) { Plugin.Logger.LogWarning((object)"Player controlling is null for me..."); } switch (state) { case 0: if ((Object)(object)playerControlling != (Object)null) { SwitchToNothing(playerControlling); } else { Plugin.Logger.LogError((object)"Player controlling is null when switching to nothing..."); } break; case 1: if ((Object)(object)playerControlling != (Object)null) { SwitchToHeld(playerControlling); } else { Plugin.Logger.LogError((object)"Player controlling is null when switching to held..."); } break; case 2: if ((Object)(object)playerControlling != (Object)null) { SwitchToMounted(playerControlling); } else { Plugin.Logger.LogError((object)"Player controlling is null when switching to mounted..."); } break; } HandleToolTips(); } public void SwitchToMounted(PlayerControllerB playerCurrentlyControlling) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (hoverboardMode == HoverboardMode.Held) { hoverboardChild.position = ((Component)playerCurrentlyControlling).transform.position; if (((NetworkBehaviour)this).IsServer) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(); if (base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.elevatorTransform, true); } else { ((Component)this).transform.SetParent(val.playersManager.propsContainer, true); } } } hoverboardChild.rotation = resetChildRotation; Transform obj = hoverboardChild; obj.position += Vector3.up * 0.3f; for (int i = 0; i < anchors.Length; i++) { anchors[i].localPosition = initialAnchorPositions[i]; anchors[i].localRotation = initialAnchorRotations[i]; } if (((NetworkBehaviour)this).IsServer) { ((Component)playerCurrentlyControlling).transform.SetParent(hoverboardSeat.transform, true); } playerCurrentlyControlling.GetCRPlayerData().ridingHoverboard = true; playerCurrentlyControlling.GetCRPlayerData().hoverboardRiding = this; hoverboardMode = HoverboardMode.Mounted; if (weightApplied) { playerCurrentlyControlling.carryWeight = Mathf.Clamp(playerCurrentlyControlling.carryWeight - 0.24f, 1f, 1000f); } weightApplied = false; SetupCollidersIgnoringOrIncluding(ignore: true); playerCurrentlyControlling.disableLookInput = true; playerCurrentlyControlling.disableMoveInput = true; if (PlayerControllerBExtensions.IsLocalPlayer(playerCurrentlyControlling)) { ((MonoBehaviour)this).StartCoroutine(TurnOnHoverboard()); } hb.useGravity = true; hb.isKinematic = false; trigger.interactable = false; SwitchModeExtension(SwitchingOff: false); } public void SwitchToHeld(PlayerControllerB playerCurrentlyControlling) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(); if (playerCurrentlyControlling.isInHangarShipRoom) { ((Component)playerCurrentlyControlling).transform.SetParent(val.playersManager.elevatorTransform, true); } else { ((Component)playerCurrentlyControlling).transform.SetParent(val.playersManager.playersContainer, true); } if (((NetworkBehaviour)this).IsServer) { ((Component)this).transform.SetParent(((Component)playerCurrentlyControlling).transform, true); } playerCurrentlyControlling.GetCRPlayerData().ridingHoverboard = false; playerCurrentlyControlling.GetCRPlayerData().hoverboardRiding = null; playerCurrentlyControlling.disableMoveInput = false; playerCurrentlyControlling.disableLookInput = false; hoverboardMode = HoverboardMode.Held; playerCurrentlyControlling.disableLookInput = false; playerCurrentlyControlling.disableMoveInput = false; if (!weightApplied) { playerCurrentlyControlling.carryWeight = Mathf.Clamp(playerCurrentlyControlling.carryWeight + 0.24f, 1f, 1000f); } weightApplied = true; hoverboardChild.position = ((Component)playerCurrentlyControlling).transform.position + ((Component)playerCurrentlyControlling).transform.right * 0.7f + ((Component)playerCurrentlyControlling).transform.up * 1f; Quaternion val2 = Quaternion.Euler(180f, 180f, -90f); hoverboardChild.rotation = ((Component)playerCurrentlyControlling).transform.rotation * val2; _isHoverForwardHeld = false; _isSprintHeld = false; _isHoverRightHeld = false; _isHoverLeftHeld = false; _isHoverBackwardHeld = false; base.isBeingUsed = false; turnedOn = false; hb.useGravity = false; hb.isKinematic = true; } public void SwitchToNothing(PlayerControllerB playerCurrentlyControlling) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.FirstOrDefault(); hoverboardMode = HoverboardMode.None; if (((NetworkBehaviour)this).IsServer) { if (base.isInShipRoom) { ((Component)this).transform.SetParent(val.playersManager.elevatorTransform, true); } else { ((Component)this).transform.SetParent(val.playersManager.propsContainer, true); } } if (weightApplied) { playerCurrentlyControlling.carryWeight = Mathf.Clamp(playerCurrentlyControlling.carryWeight - 0.24f, 1f, 1000f); } weightApplied = false; SetupCollidersIgnoringOrIncluding(ignore: false); turnedOn = false; _isHoverForwardHeld = false; _isSprintHeld = false; _isHoverRightHeld = false; _isHoverLeftHeld = false; _isHoverBackwardHeld = false; base.isBeingUsed = false; hb.useGravity = true; hb.isKinematic = false; trigger.interactable = true; } public IEnumerator TurnOnHoverboard() { yield return (object)new WaitForSeconds(1f); if (hoverboardMode == HoverboardMode.Mounted) { TurnOnHoverboardServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void TurnOnHoverboardServerRpc() { TurnOnHoverboardClientRpc(); } [ClientRpc] public void TurnOnHoverboardClientRpc() { turnedOn = true; } public void StartBaseImportant() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) base.propColliders = ((Component)this).gameObject.GetComponentsInChildren(); base.originalScale = ((Component)this).transform.localScale; if (base.itemProperties.itemSpawnsOnGround) { base.startFallingPosition = ((Component)this).transform.position; if ((Object)(object)((Component)this).transform.parent != (Object)null) { base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(base.startFallingPosition); } ((GrabbableObject)this).FallToGround(false, false, default(Vector3)); } else { base.hasHitGround = true; base.reachedFloorTarget = true; base.targetFloorPosition = ((Component)this).transform.localPosition; } if (base.itemProperties.isScrap) { base.hasHitGround = true; } if (base.itemProperties.isScrap && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { base.radarIcon = Object.Instantiate(StartOfRound.Instance.itemRadarIconPrefab, RoundManager.Instance.mapPropsContainer.transform).transform; } if (!base.itemProperties.isScrap) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)this).gameObject); } MeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).renderingLayerMask = 1u; } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).renderingLayerMask = 1u; } ((UnityEvent)(object)trigger.onInteract).AddListener((UnityAction)OnInteract); } public void SwitchModeExtension(bool SwitchingOff) { if (SwitchingOff) { Plugin.InputActionsInstance.HoverForward.performed -= OnKeyHeld; Plugin.InputActionsInstance.HoverBackward.performed -= OnKeyHeld; Plugin.InputActionsInstance.HoverLeft.performed -= OnKeyHeld; Plugin.InputActionsInstance.HoverRight.performed -= OnKeyHeld; Plugin.InputActionsInstance.SprintForward.performed -= OnKeyHeld; Plugin.InputActionsInstance.HoverForward.canceled -= OnKeyReleased; Plugin.InputActionsInstance.HoverBackward.canceled -= OnKeyReleased; Plugin.InputActionsInstance.HoverLeft.canceled -= OnKeyReleased; Plugin.InputActionsInstance.HoverRight.canceled -= OnKeyReleased; Plugin.InputActionsInstance.SprintForward.canceled -= OnKeyReleased; Plugin.InputActionsInstance.HoverUp.performed -= MovementHandler; Plugin.InputActionsInstance.SwitchMode.performed -= ModeHandler; } else { Plugin.InputActionsInstance.HoverForward.performed += OnKeyHeld; Plugin.InputActionsInstance.HoverBackward.performed += OnKeyHeld; Plugin.InputActionsInstance.HoverLeft.performed += OnKeyHeld; Plugin.InputActionsInstance.HoverRight.performed += OnKeyHeld; Plugin.InputActionsInstance.SprintForward.performed += OnKeyHeld; Plugin.InputActionsInstance.HoverForward.canceled += OnKeyReleased; Plugin.InputActionsInstance.HoverBackward.canceled += OnKeyReleased; Plugin.InputActionsInstance.HoverLeft.canceled += OnKeyReleased; Plugin.InputActionsInstance.HoverRight.canceled += OnKeyReleased; Plugin.InputActionsInstance.SprintForward.canceled += OnKeyReleased; Plugin.InputActionsInstance.HoverUp.performed += MovementHandler; Plugin.InputActionsInstance.SwitchMode.performed += ModeHandler; } } public void HandleToolTips() { if (!((Object)(object)playerControlling == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)playerControlling)) { HUDManager.Instance.ClearControlTips(); if (hoverboardMode == HoverboardMode.Mounted) { HUDManager.Instance.ChangeControlTipMultiple(new string[4] { "Dismount Hoverboard : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.DropHoverboard, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]", "Move Hoverboard : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.HoverForward, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "][" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.HoverLeft, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "][" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.HoverBackward, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "][" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.HoverRight, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]", "Up Boost : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.HoverUp, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]", "Switch Mode (Mounted) : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.SwitchMode, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]" }, false, (Item)null); } else if (hoverboardMode == HoverboardMode.Held) { HUDManager.Instance.ChangeControlTipMultiple(new string[2] { "Drop Hoverboard : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.DropHoverboard, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]", "Switch Mode (Held) : [" + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.InputActionsInstance.SwitchMode, (DisplayStringOptions)0, (string)null).Split(' ')[0] + "]" }, false, (Item)null); } } } public override void FallWithCurve() { } private void CalculateVerticalLookingInput(Vector2 inputVector, PlayerControllerB playerCurrentlyControlling) { //IL_0047: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!playerCurrentlyControlling.smoothLookEnabledLastFrame) { playerCurrentlyControlling.smoothLookEnabledLastFrame = true; playerCurrentlyControlling.smoothLookTurnCompass.rotation = ((Component)playerCurrentlyControlling.gameplayCamera).transform.rotation; playerCurrentlyControlling.smoothLookTurnCompass.SetParent((Transform)null); } playerCurrentlyControlling.cameraUp -= inputVector.y; playerCurrentlyControlling.cameraUp = Mathf.Clamp(playerCurrentlyControlling.cameraUp, -80f, 60f); playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles = new Vector3(playerCurrentlyControlling.cameraUp, playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles.y, playerCurrentlyControlling.smoothLookTurnCompass.localEulerAngles.z); ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles = new Vector3(Mathf.LerpAngle(((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.x, playerCurrentlyControlling.cameraUp, playerCurrentlyControlling.smoothLookMultiplier * Time.deltaTime), ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.y, ((Component)playerCurrentlyControlling.gameplayCamera).transform.localEulerAngles.z); } private void CheckIfUpsideDown() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(hoverboardChild.up, Vector3.up); if (num > 60f) { Quaternion targetRotation = Quaternion.LookRotation(Vector3.ProjectOnPlane(hoverboardChild.forward, Vector3.up), Vector3.up); ((MonoBehaviour)this).StartCoroutine(AdjustOrientation(targetRotation)); } } private IEnumerator AdjustOrientation(Quaternion targetRotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) isAdjusting = true; float duration = 0.5f; float elapsed = 0f; Quaternion initialRotation = hoverboardChild.rotation; while (elapsed < duration) { elapsed += Time.deltaTime; hoverboardChild.rotation = Quaternion.Slerp(initialRotation, targetRotation, elapsed / duration); yield return null; } hoverboardChild.rotation = targetRotation; isAdjusting = false; } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) hb.AddForce(hitDirection * (float)force, (ForceMode)1); return true; } public void SetupCollidersIgnoringOrIncluding(bool ignore) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB player in allPlayerScripts) { Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Collider hoverboardCollider in componentsInChildren) { SimplifyCollidersIgnore(hoverboardCollider, player, ignore); } } } public void SimplifyCollidersIgnore(Collider hoverboardCollider, PlayerControllerB player, bool ignore) { Physics.IgnoreCollision(hoverboardCollider, player.playerCollider, ignore); Physics.IgnoreCollision(hoverboardCollider, ((Component)player.playerRigidbody).GetComponent(), true); Physics.IgnoreCollision(hoverboardCollider, ((Component)((Component)player).GetComponent()).GetComponent(), true); Physics.IgnoreCollision(hoverboardCollider, (Collider)(object)((Component)((Component)player).transform.Find("PlayerPhysicsBox")).GetComponent(), ignore); Physics.IgnoreCollision(hoverboardCollider, ((Component)((Component)((Component)player).transform.Find("PlayerPhysicsBox")).GetComponent()).GetComponent(), ignore); Physics.IgnoreCollision(hoverboardCollider, (Collider)(object)((Component)((Component)player).transform.Find("Misc").Find("Cube")).GetComponent(), ignore); Physics.IgnoreCollision(hoverboardCollider, (Collider)(object)((Component)((Component)((Component)player).transform.Find("Misc").Find("Cube")).GetComponent()).GetComponent(), ignore); } } public class HoverboardSpawner : GrabbableObject { private FuturisticHoverboard? _hoverboard = null; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((Object)(object)_hoverboard != (Object)null)) { } } } public class InfiniKey : GrabbableObject { public AudioSource infiniSource = null; public AudioClip hitNothingSound = null; public AudioClip UnlockSomethingSound = null; private RaycastHit[] cachedHits = (RaycastHit[])(object)new RaycastHit[10]; private PlayerControllerB? previousPlayerHeldBy = null; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if ((Object)(object)base.playerHeldBy != (Object)null) { previousPlayerHeldBy = base.playerHeldBy; if (PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1"); } } if (((NetworkBehaviour)this).IsOwner) { UseInfiniKey(); } } public void UseInfiniKey() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { Plugin.Logger.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called."); return; } previousPlayerHeldBy.activatingItem = false; int num = -1; previousPlayerHeldBy.twoHanded = false; int num2 = Physics.SphereCastNonAlloc(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.3f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, cachedHits, 0.75f, MoreLayerMasks.CollidersAndRoomAndRailingAndInteractableMask, (QueryTriggerInteraction)2); for (int i = 0; i < num2; i++) { if (((Component)((RaycastHit)(ref cachedHits[i])).transform).gameObject.layer == 8 || ((Component)((RaycastHit)(ref cachedHits[i])).transform).gameObject.layer == 11) { string tag = ((Component)((RaycastHit)(ref cachedHits[i])).collider).gameObject.tag; num = Array.IndexOf(StartOfRound.Instance.footstepSurfaces, tag); } else { OnHit(((RaycastHit)(ref cachedHits[i])).collider); } } if (num != -1) { HitInfiniKeyServerRpc(num); } else { HitInfiniKeyServerRpc(-2); } } public void OnHit(Collider collider) { if (!((Object)(object)collider == (Object)null)) { Plugin.ExtendedLogging("OnHit: " + ((Object)((Component)collider).gameObject).name + " with tag " + ((Component)collider).gameObject.tag); bool flag = false; DoorLock val = default(DoorLock); Pickable pickable = default(Pickable); if (((Component)collider).gameObject.TryGetComponent(ref val) && val.isLocked) { val.UnlockDoorServerRpc(); flag = true; } else if (((Component)collider).gameObject.TryGetComponent(ref pickable)) { pickable.Unlock(); flag = true; } if (flag) { HitInfiniKeyServerRpc(-1); } } } [ServerRpc(RequireOwnership = false)] private void HitInfiniKeyServerRpc(int hitSurfaceIndex) { HitInfiniKeyClientRpc(hitSurfaceIndex); } [ClientRpc] private void HitInfiniKeyClientRpc(int hitSurfaceIndex) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) switch (hitSurfaceIndex) { case -1: infiniSource.PlayOneShot(UnlockSomethingSound); return; case -2: infiniSource.PlayOneShot(hitNothingSound); return; } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); infiniSource.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceIndex].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(infiniSource, StartOfRound.Instance.footstepSurfaces[hitSurfaceIndex].hitSurfaceSFX, 1f); } } public class InstrumentPlayer : GrabbableObject { public AudioSource audioPlayer = null; public static List instrumentPlayers = new List(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); instrumentPlayers.Add(this); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (audioPlayer.isPlaying) { audioPlayer.Stop(); return; } audioPlayer.volume = ((AssetBundleLoader)(object)ContentHandler.Instance.Zort).GetConfig("Instruments | Volume").Value; AudioSource val = null; foreach (InstrumentPlayer instrumentPlayer in instrumentPlayers) { Plugin.ExtendedLogging("Instrument Player: " + ((Object)instrumentPlayer).name); if (!instrumentPlayer.audioPlayer.isPlaying) { continue; } val = instrumentPlayer.audioPlayer; break; } if ((Object)(object)val != (Object)null) { float time = val.time; Plugin.ExtendedLogging($"Starting at Time: {time}"); audioPlayer.Play(); audioPlayer.time = time; } else { audioPlayer.Play(); } } public bool AllInstrumentsArePlaying() { string[] source = new string[4] { "Recorder", "Guitar", "Violin", "Accordion" }; return source.All((string required) => instrumentPlayers.Any((InstrumentPlayer ip) => ((GrabbableObject)ip).itemProperties.itemName == required && ip.audioPlayer.isPlaying)); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); instrumentPlayers.Remove(this); } } public class JimBall : SoccerBallProp { [SerializeField] private OwnerNetworkAnimator _ownerNetworkAnimator = null; [SerializeField] internal Animator _animator = null; internal static readonly int KickingAnimation = Animator.StringToHash("kicking"); internal static readonly int HeldAnimation = Animator.StringToHash("held"); public override void EquipItem() { ((GrabbableObject)this).EquipItem(); _animator.SetBool(HeldAnimation, true); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); _animator.SetBool(HeldAnimation, false); } public override void PlayDropSFX() { ((SoccerBallProp)this).PlayDropSFX(); if (((NetworkBehaviour)this).IsOwner) { _animator.SetBool(KickingAnimation, false); } } } public class LifeFormAnalyzer : GrabbableObject { public Animator animator = null; public float scanInterval = 10f; public TerrainScanner terrainScanner = null; public AudioSource _audioSource = null; public AudioClip _hazardPingSound = null; public AudioClip _activatedSound = null; public AudioClip _deactivatedSound = null; private List customPassRoutines = new List(); private float scanTimer = 0f; private bool turnedOn = false; private static readonly int ActivatedAnimation = Animator.StringToHash("activated"); public override void Start() { ((GrabbableObject)this).Start(); base.useCooldown = scanInterval; } public override void Update() { ((GrabbableObject)this).Update(); if (turnedOn) { scanTimer -= Time.deltaTime; if (scanTimer <= 0f) { scanTimer = scanInterval; _audioSource.PlayOneShot(_hazardPingSound); DoRevealScan(); } } } public void DoRevealScan() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = SeamineGalAI.DoTerrainScan(terrainScanner, ((Component)this).transform.position); ((Component)((Component)val).gameObject.transform.parent).gameObject.SetActive(true); if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) > 10f) { return; } if (customPassRoutines.Count <= 0) { customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(SeamineGalAI.DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughEnemies, 25f))); customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(SeamineGalAI.DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughHazards, 25f))); return; } foreach (Coroutine customPassRoutine in customPassRoutines) { ((MonoBehaviour)this).StopCoroutine(customPassRoutine); } customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(SeamineGalAI.DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughEnemies, 25f))); customPassRoutines.Add(((MonoBehaviour)this).StartCoroutine(SeamineGalAI.DoCustomPassThing(val, CustomPassManager.CustomPassType.SeeThroughHazards, 25f))); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); turnedOn = !turnedOn; animator.SetBool(ActivatedAnimation, turnedOn); scanTimer = scanInterval; if (turnedOn) { _audioSource.PlayOneShot(_activatedSound); _audioSource.PlayOneShot(_hazardPingSound); DoRevealScan(); return; } _audioSource.PlayOneShot(_deactivatedSound); foreach (Coroutine customPassRoutine in customPassRoutines) { ((MonoBehaviour)this).StopCoroutine(customPassRoutine); } customPassRoutines.Clear(); } } public class Magic8Ball : GrabbableObject { private Random _eightBallRandom = null; private Coroutine? _displayRoutine = null; private static readonly int ShakeItemAnimationHash = Animator.StringToHash("shakeItem"); [field: SerializeField] public float TimeToDisplayResult { get; private set; } = 1.167f; [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip ShakeSound { get; private set; } [field: SerializeField] public SpriteRenderer SpriteRenderer { get; private set; } [field: SerializeField] public Sprite DefaultSprite { get; private set; } [field: SerializeField] public Sprite[] PossibleSprites { get; private set; } = Array.Empty(); public override void Start() { ((GrabbableObject)this).Start(); _eightBallRandom = new Random(StartOfRound.Instance.randomMapSeed + 323); SpriteRenderer.sprite = DefaultSprite; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); SpriteRenderer.sprite = DefaultSprite; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); SpriteRenderer.sprite = DefaultSprite; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (_displayRoutine == null) { AudioSource.PlayOneShot(ShakeSound); base.playerHeldBy.playerBodyAnimator.SetTrigger(ShakeItemAnimationHash); _displayRoutine = ((MonoBehaviour)this).StartCoroutine(WaitForAnimationEnd()); } } private IEnumerator WaitForAnimationEnd() { SpriteRenderer.sprite = DefaultSprite; yield return (object)new WaitForSeconds(TimeToDisplayResult); SpriteRenderer.color = new Color(SpriteRenderer.color.r, SpriteRenderer.color.g, SpriteRenderer.color.b, 0f); DisplayMagic8BallResult(); float duration = 0f; while (duration < 1f) { SpriteRenderer.color = new Color(SpriteRenderer.color.r, SpriteRenderer.color.g, SpriteRenderer.color.b, duration); duration += Time.deltaTime * 4f; yield return null; } SpriteRenderer.color = new Color(SpriteRenderer.color.r, SpriteRenderer.color.g, SpriteRenderer.color.b, 1f); _displayRoutine = null; } public void DisplayMagic8BallResult() { Sprite sprite = PossibleSprites[_eightBallRandom.Next(PossibleSprites.Length)]; SpriteRenderer.sprite = sprite; } } public class MarrowSplitter : GrabbableObject { [SerializeField] private Animator _marrowSplitterAnimator = null; [SerializeField] private OwnerNetworkAnimator _marrowSplitterOwnerNetworkAnimator = null; [SerializeField] private SkinnedMeshRenderer _skinnedMeshRenderer = null; [SerializeField] private ParticleSystem _bloodParticles = null; [SerializeField] private Transform _endTransform = null; [SerializeField] private AudioSource _idleSource = null; [SerializeField] private AudioClip[] _fillUpSounds = Array.Empty(); [SerializeField] private AudioClip[] _hitEnemySounds = Array.Empty(); [SerializeField] private AudioClip _healingSound = null; [SerializeField] private AudioClip[] _hitObjectSounds = Array.Empty(); [SerializeField] private int _increaseAmount = 1; [SerializeField] private int _decreaseAmount = 2; private float _tryHealPlayerTimer = 1f; private float _hitTimer = 0f; private bool _isHealing = false; private static readonly int AttackingAnimation = Animator.StringToHash("isAttacking"); private Collider[] _cachedColliders = (Collider[])(object)new Collider[8]; private List _iHittableList = new List(); private List _enemyAIList = new List(); public override void EquipItem() { ((GrabbableObject)this).EquipItem(); Plugin.InputActionsInstance.MarrowHealPlayer.performed += OnTryStartHealPlayer; Plugin.InputActionsInstance.MarrowHealPlayer.canceled += OnTryCancelHealPlayer; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); Plugin.ExtendedLogging($"Marrow Splitter Discarded and isBeingUsed: {base.isBeingUsed}"); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } base.isBeingUsed = false; Plugin.InputActionsInstance.MarrowHealPlayer.performed -= OnTryStartHealPlayer; Plugin.InputActionsInstance.MarrowHealPlayer.canceled -= OnTryCancelHealPlayer; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); Plugin.ExtendedLogging($"Marrow Splitter Pocketed and isBeingUsed: {base.isBeingUsed}"); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } _isHealing = false; _idleSource.volume = 0f; _idleSource.Stop(); base.isBeingUsed = false; Plugin.InputActionsInstance.MarrowHealPlayer.performed -= OnTryStartHealPlayer; Plugin.InputActionsInstance.MarrowHealPlayer.canceled -= OnTryCancelHealPlayer; } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } _isHealing = false; _idleSource.volume = 0f; _idleSource.Stop(); base.isBeingUsed = false; Plugin.InputActionsInstance.MarrowHealPlayer.performed -= OnTryStartHealPlayer; Plugin.InputActionsInstance.MarrowHealPlayer.canceled -= OnTryCancelHealPlayer; } public void OnTryStartHealPlayer(CallbackContext context) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if (base.isBeingUsed || !base.isHeld || base.isPocketed || (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy) { return; } ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { int num = Mathf.FloorToInt(_skinnedMeshRenderer.GetBlendShapeWeight(0)); if (num > 0) { _marrowSplitterAnimator.SetBool(AttackingAnimation, true); ActivateOrStopSourceForHealingServerRpc(activate: true); } } } public void OnTryCancelHealPlayer(CallbackContext context) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy) && !base.isPocketed && base.isHeld) { ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasReleasedThisFrame && base.isBeingUsed) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); ActivateOrStopSourceForHealingServerRpc(activate: false); } } } [ServerRpc(RequireOwnership = false)] private void ActivateOrStopSourceForHealingServerRpc(bool activate) { ActivateOrStopSourceForHealingClientRpc(activate); } [ClientRpc] private void ActivateOrStopSourceForHealingClientRpc(bool activate) { if (activate) { base.isBeingUsed = true; _isHealing = true; _idleSource.PlayOneShot(_healingSound); _idleSource.volume = 1f; _idleSource.Play(); } else { base.isBeingUsed = false; _isHealing = false; _idleSource.volume = 0f; _idleSource.Stop(); } } public override void Update() { ((GrabbableObject)this).Update(); if (_isHealing && base.isBeingUsed) { _tryHealPlayerTimer -= Time.deltaTime; } if (!_isHealing && base.isBeingUsed) { _hitTimer -= Time.deltaTime; } if (base.isBeingUsed && !((Object)(object)base.playerHeldBy == (Object)null) && !base.isPocketed) { if (_isHealing && _tryHealPlayerTimer <= 0f) { DoHealingPlayers(); } else if (!_isHealing && _hitTimer <= 0f) { DoHitStuff(1); } } } private void DoHitStuff(int damageToDeal) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) _iHittableList.Clear(); _enemyAIList.Clear(); bool flag = false; bool flag2 = false; int num = Physics.OverlapSphereNonAlloc(_endTransform.position, 1f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val2 = default(IHittable); for (int i = 0; i < num; i++) { Collider val = _cachedColliders[i]; if (!((Component)val).TryGetComponent(ref val2)) { continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val3 != null) { if (!((Object)(object)val3 == (Object)(object)base.playerHeldBy)) { flag = true; flag2 = true; val3.DamagePlayer(damageToDeal, true, true, (CauseOfDeath)15, 0, false, default(Vector3)); } continue; } EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val4 != null) { flag = true; flag2 = true; if (!_enemyAIList.Contains(val4.mainScript) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy)) { _enemyAIList.Add(val4.mainScript); val4.mainScript.HitEnemyOnLocalClient(1, ((Component)this).transform.position, base.playerHeldBy, true, -1); } } else { flag = true; if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy)) { val2.Hit(1, ((Component)this).transform.position, base.playerHeldBy, true, -1); } } } if (flag) { _bloodParticles.Play(true); _idleSource.PlayOneShot(_hitEnemySounds[Random.Range(0, _hitEnemySounds.Length)]); _hitTimer = 0.8f; if (flag2) { Battery insertedBattery = base.insertedBattery; insertedBattery.charge -= 0.1f; float blendShapeWeight = _skinnedMeshRenderer.GetBlendShapeWeight(0); float num2 = Mathf.Clamp(blendShapeWeight + (float)_increaseAmount, 0f, 100f); if (num2 > blendShapeWeight && flag2) { _idleSource.PlayOneShot(_fillUpSounds[Random.Range(0, _fillUpSounds.Length)]); } Plugin.ExtendedLogging($"Increasing blendshape weight to {num2}"); _skinnedMeshRenderer.SetBlendShapeWeight(0, num2); } return; } num = Physics.OverlapSphereNonAlloc(_endTransform.position, 1f, _cachedColliders, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); for (int j = 0; j < num; j++) { for (int k = 0; k < StartOfRound.Instance.footstepSurfaces.Length; k++) { if (((Component)_cachedColliders[j]).gameObject.CompareTag(StartOfRound.Instance.footstepSurfaces[k].surfaceTag)) { HandleHittingSurface(k); _hitTimer = 0.4f; break; } } } } private void DoHealingPlayers() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(_endTransform.position, 1f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); bool flag = false; IHittable val = default(IHittable); for (int i = 0; i < num; i++) { if ((Object)(object)((Component)_cachedColliders[i]).transform == (Object)(object)((Component)base.playerHeldBy).transform || !((Component)_cachedColliders[i]).gameObject.TryGetComponent(ref val)) { continue; } PlayerControllerB val2 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null); if (val2 == null || (Object)(object)val2 == (Object)(object)base.playerHeldBy || val2.IsPseudoDead() || val2.isPlayerDead || !val2.isPlayerControlled || val2.health >= 100) { continue; } int num2 = Mathf.FloorToInt(_skinnedMeshRenderer.GetBlendShapeWeight(0)); _skinnedMeshRenderer.SetBlendShapeWeight(0, (float)Mathf.Clamp(num2 - _decreaseAmount, 0, 100)); flag = true; _bloodParticles.Play(true); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)base.playerHeldBy) { val2.DamagePlayerFromOtherClientServerRpc(-_decreaseAmount, ((Component)base.playerHeldBy).transform.position, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, base.playerHeldBy)); } if (num2 - _decreaseAmount <= 0) { base.isBeingUsed = false; _isHealing = false; _idleSource.volume = 0f; _idleSource.Stop(); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } return; } } if (flag || base.playerHeldBy.health >= 100) { return; } _bloodParticles.Play(true); int num3 = Mathf.FloorToInt(_skinnedMeshRenderer.GetBlendShapeWeight(0)); _skinnedMeshRenderer.SetBlendShapeWeight(0, (float)Mathf.Clamp(num3 - _decreaseAmount, 0, 100)); base.playerHeldBy.DamagePlayer(-_decreaseAmount, true, true, (CauseOfDeath)14, 0, false, default(Vector3)); if (num3 - _decreaseAmount <= 0) { base.isBeingUsed = false; _isHealing = false; _idleSource.volume = 0f; _idleSource.Stop(); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } } } private void HandleHittingSurface(int surfaceID) { if (surfaceID != -1) { _idleSource.PlayOneShot(StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(_idleSource, StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX, 1f); _idleSource.PlayOneShot(_hitObjectSounds[Random.Range(0, _hitObjectSounds.Length)]); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (_isHealing) { return; } Plugin.ExtendedLogging($"Marrow Splitter used and button down: {used} {buttonDown}"); if (!buttonDown) { base.isBeingUsed = false; _idleSource.volume = 0f; _idleSource.Stop(); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, false); } } else { base.isBeingUsed = true; _idleSource.volume = 1f; _idleSource.Play(); if (((NetworkBehaviour)this).IsOwner) { _marrowSplitterAnimator.SetBool(AttackingAnimation, true); } } } } [AddComponentMenu("TestAccount666/Code Rebirth/Material Variants")] public class MaterialVariants : NetworkBehaviour { [SerializeField] [Tooltip("The item data of the scrap.")] private Item itemData = null; [Space(5f)] [SerializeField] [Tooltip("The mesh renderers to change the material of. This will use the first material in the array.")] private Renderer[] renderers = null; [FormerlySerializedAs("ChangeScanNodeText")] [Space(5f)] private bool changeScanNodeText = false; [SerializeField] [Tooltip("The text to change to when the material is changed.")] private string[] scanNodeText = null; [Space(5f)] [SerializeField] [Tooltip("The scan node properties to change the text of.")] private ScanNodeProperties scanNodeProperties = null; [Space(5f)] [SerializeField] [Tooltip("The currently saved material variant.")] private int savedMaterialVariant = -1; public override void OnNetworkSpawn() { SetRendererServerRpc(); } [ServerRpc(RequireOwnership = false)] private void SetRendererServerRpc() { savedMaterialVariant = ((savedMaterialVariant != -1) ? Math.Clamp(savedMaterialVariant, 0, itemData.materialVariants.Length - 1) : Random.Range(0, itemData.materialVariants.Length)); SetRendererClientRpc(savedMaterialVariant); } [ClientRpc] private void SetRendererClientRpc(int materialVariant) { Renderer[] array = renderers; foreach (Renderer val in array) { val.SetMaterial(itemData.materialVariants[materialVariant]); if (changeScanNodeText) { scanNodeProperties.headerText = scanNodeText[materialVariant]; } } } } public class MeteoriteShard : GrabbableObject { } public class MistressPlushie : PlushieItem { public override void LateUpdate() { //IL_0046: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0094: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isPocketed || (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { return; } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, ((Component)this).transform.position); if (!(num > 20f)) { Vector3 val = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position - ((Component)this).transform.position; float num2 = Vector3.Dot(val, ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward); if (!(num2 <= 0f)) { val.y = 0f; float num3 = 0.1f; ((Component)this).transform.forward = Vector3.Lerp(((Component)this).transform.forward, val, Time.deltaTime * num3); } } } } public class MoleDigger : GrabbableObject { public Animator moleAnimator = null; public OwnerNetworkAnimator moleOwnerNetworkAnimator = null; public Transform endTransform = null; public GameObject lightObject = null; public AudioSource idleSource = null; public AudioSource audioSource = null; public AudioClip attackIdleSound = null; public AudioClip normalIdleSound = null; public AudioClip[] hitObjectSounds = Array.Empty(); public AudioClip[] hitEnemiesSounds = Array.Empty(); public AudioClip DeactivateSound = null; public AudioClip[] chainYankSound = Array.Empty(); public AudioClip activateSound = null; private float _yankChainTimer = 0f; private float _hitTimer = 0f; private static readonly int ActivatedAnimation = Animator.StringToHash("activated"); private static readonly int PullChainAnimation = Animator.StringToHash("pullChain"); private static readonly int AttackingAnimation = Animator.StringToHash("isAttacking"); private Collider[] _cachedColliders = (Collider[])(object)new Collider[16]; private List _iHittableList = new List(); private List _enemyAIList = new List(); public override void Start() { //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_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) ((GrabbableObject)this).Start(); Enumerator enumerator = GameNetworkManager.Instance.localPlayerController.playerActions.m_Movement.actions.GetEnumerator(); try { while (enumerator.MoveNext()) { InputAction current = enumerator.Current; Plugin.ExtendedLogging($"name: {current.name} type: {current.id}"); } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } lightObject.SetActive(false); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); Plugin.InputActionsInstance.PullChain.performed += OnChainYanked; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); Plugin.ExtendedLogging($"Mole Digger Discarded and isBeingUsed: {base.isBeingUsed}"); if (((NetworkBehaviour)this).IsOwner) { moleAnimator.SetBool(ActivatedAnimation, false); moleAnimator.SetBool(AttackingAnimation, false); } idleSource.volume = 0f; idleSource.clip = normalIdleSound; audioSource.PlayOneShot(DeactivateSound); lightObject.SetActive(false); base.isBeingUsed = false; Plugin.InputActionsInstance.PullChain.performed -= OnChainYanked; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); Plugin.ExtendedLogging($"Mole Digger Pocketed and isBeingUsed: {base.isBeingUsed}"); if (((NetworkBehaviour)this).IsOwner) { moleAnimator.SetBool(ActivatedAnimation, false); moleAnimator.SetBool(AttackingAnimation, false); } idleSource.volume = 0f; idleSource.clip = normalIdleSound; audioSource.PlayOneShot(DeactivateSound); lightObject.SetActive(false); base.isBeingUsed = false; } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); if (((NetworkBehaviour)this).IsOwner) { moleAnimator.SetBool(ActivatedAnimation, false); moleAnimator.SetBool(AttackingAnimation, false); } idleSource.volume = 0f; idleSource.clip = normalIdleSound; audioSource.PlayOneShot(DeactivateSound); lightObject.SetActive(false); base.isBeingUsed = false; } [ServerRpc(RequireOwnership = false)] private void ActivateLightObjectServerRpc(bool enable) { ActivateLightObjectClientRpc(enable); } [ClientRpc] private void ActivateLightObjectClientRpc(bool enable) { idleSource.volume = (enable ? 1f : 0f); idleSource.clip = normalIdleSound; audioSource.PlayOneShot(enable ? activateSound : DeactivateSound); lightObject.SetActive(enable); } public void OnChainYanked(CallbackContext context) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (_yankChainTimer > 0f || base.insertedBattery.empty || base.isBeingUsed || base.isPocketed || moleAnimator.GetBool(ActivatedAnimation) || (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy) { return; } ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { _yankChainTimer = 1f; audioSource.PlayOneShot(chainYankSound[Random.Range(0, chainYankSound.Length)]); if (Random.Range(0, 100) < 25) { moleAnimator.SetBool(ActivatedAnimation, true); ActivateLightObjectServerRpc(enable: true); Plugin.ExtendedLogging("Mole Digger Activated"); } ((NetworkAnimator)moleOwnerNetworkAnimator).SetTrigger(PullChainAnimation, true); } } public override void Update() { ((GrabbableObject)this).Update(); _yankChainTimer -= Time.deltaTime; _hitTimer -= Time.deltaTime; if (base.isBeingUsed && !(_hitTimer > 0f) && !((Object)(object)base.playerHeldBy == (Object)null)) { DoHitStuff(1); } } private void DoHitStuff(int damageToDeal) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) _iHittableList.Clear(); _enemyAIList.Clear(); bool flag = false; int num = Physics.OverlapSphereNonAlloc(endTransform.position, 1f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val = default(IHittable); for (int i = 0; i < num; i++) { if ((Object)(object)((Component)_cachedColliders[i]).transform == (Object)(object)((Component)base.playerHeldBy).transform || !((Component)_cachedColliders[i]).gameObject.TryGetComponent(ref val)) { continue; } EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null); if (val2 != null) { if (_enemyAIList.Contains(val2.mainScript)) { continue; } audioSource.PlayOneShot(hitEnemiesSounds[Random.Range(0, hitEnemiesSounds.Length)]); _enemyAIList.Add(val2.mainScript); } flag = true; _iHittableList.Add(val); } foreach (IHittable iHittable in _iHittableList) { if (((NetworkBehaviour)this).IsOwner) { iHittable.Hit(damageToDeal, ((Component)base.playerHeldBy.gameplayCamera).transform.position, base.playerHeldBy, true, -1); } } if (flag) { _hitTimer = 0.4f; Battery insertedBattery = base.insertedBattery; insertedBattery.charge -= 0.05f; return; } num = Physics.OverlapSphereNonAlloc(endTransform.position, 1f, _cachedColliders, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); for (int j = 0; j < num; j++) { for (int k = 0; k < StartOfRound.Instance.footstepSurfaces.Length; k++) { if (((Component)_cachedColliders[j]).gameObject.CompareTag(StartOfRound.Instance.footstepSurfaces[k].surfaceTag)) { HandleHittingSurface(k); _hitTimer = 0.4f; break; } } } } private void HandleHittingSurface(int surfaceID) { if (surfaceID != -1) { audioSource.PlayOneShot(StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(audioSource, StartOfRound.Instance.footstepSurfaces[surfaceID].hitSurfaceSFX, 1f); audioSource.PlayOneShot(hitObjectSounds[Random.Range(0, hitObjectSounds.Length)]); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!moleAnimator.GetBool(ActivatedAnimation)) { base.isBeingUsed = false; return; } Plugin.ExtendedLogging($"Mole Digger used and button down: {used} {buttonDown}"); if (!buttonDown) { idleSource.clip = normalIdleSound; idleSource.Stop(); idleSource.Play(); if (((NetworkBehaviour)this).IsOwner) { moleAnimator.SetBool(AttackingAnimation, false); } } else { idleSource.clip = attackIdleSound; idleSource.Stop(); idleSource.Play(); if (((NetworkBehaviour)this).IsOwner) { moleAnimator.SetBool(AttackingAnimation, true); } } } } public class Mountaineer : CRWeapon { public Renderer iceRenderer = null; public AudioClip[] unlatchSounds = Array.Empty(); private Quaternion brrreakerStuckRotation = Quaternion.identity; private Vector3 brrreakerStuckPosition = Vector3.zero; private bool stuckToWall = false; private PlayerControllerB? stuckPlayer = null; private Vector3 stuckPosition = Vector3.zero; private Material iceMaterial = null; public static List Instances = new List(); internal float FreezePercentile => GetFreezePercentage(); public override void OnNetworkSpawn() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); OnSurfaceHit.AddListener((UnityAction)OnSurfaceHitEvent); iceMaterial = new Material(iceRenderer.sharedMaterial); iceRenderer.material = iceMaterial; } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); OnSurfaceHit.RemoveListener((UnityAction)OnSurfaceHitEvent); Instances.Remove(this); } public override void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0075: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_01bf: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (heldOverHeadTimer.Value > 0f && iceMaterial.color.a < 1f) { iceMaterial.color = new Color(iceMaterial.color.r, iceMaterial.color.g, iceMaterial.color.b, iceMaterial.color.a + Time.deltaTime / 5f); } else if (heldOverHeadTimer.Value <= 0f && iceMaterial.color.a > 0f) { iceMaterial.color = new Color(iceMaterial.color.r, iceMaterial.color.g, iceMaterial.color.b, 0f); } iceMaterial.color = new Color(iceMaterial.color.r, iceMaterial.color.g, iceMaterial.color.b, heldOverHeadTimer.Value); if ((Object)(object)stuckPlayer != (Object)null && stuckToWall && !stuckPlayer.isGrabbingObjectAnimation) { if (stuckPlayer.isPlayerDead) { stuckPlayer.activatingItem = false; stuckPlayer.disableMoveInput = false; return; } ((Component)stuckPlayer).transform.position = stuckPosition; stuckPlayer.ResetFallGravity(); stuckPlayer.disableMoveInput = true; stuckPlayer.activatingItem = true; } } public void OnSurfaceHitEvent(int surfaceID) { //IL_0048: 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) if (PlayerControllerBExtensions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy) && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving) { OnSurfaceHitServerRpc(surfaceID, ((Component)this).transform.position, ((Component)this).transform.rotation); } } [ServerRpc(RequireOwnership = false)] public void OnSurfaceHitServerRpc(int surfaceID, Vector3 _brrreakerStuckPosition, Quaternion _brrreakerStuckRotation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) OnSurfaceHitClientRpc(surfaceID, _brrreakerStuckPosition, _brrreakerStuckRotation); } [ClientRpc] public void OnSurfaceHitClientRpc(int surfaceID, Vector3 _brrreakerStuckPosition, Quaternion _brrreakerStuckRotation) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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) stuckToWall = true; brrreakerStuckPosition = _brrreakerStuckPosition; brrreakerStuckRotation = _brrreakerStuckRotation; if (!PlayerControllerBExtensions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy)) { ((GrabbableObject)this).grabbable = false; return; } stuckPlayer = ((GrabbableObject)this).playerHeldBy; stuckPlayer.externalForces = Vector3.zero; stuckPlayer.externalForceAutoFade = Vector3.zero; stuckPosition = ((Component)stuckPlayer).transform.position; ((MonoBehaviour)this).StartCoroutine(((GrabbableObject)this).playerHeldBy.waitToEndOfFrameToDiscard()); } public override void FallWithCurve() { //IL_0013: 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) if (stuckToWall) { ((Component)this).transform.position = brrreakerStuckPosition; ((Component)this).transform.rotation = brrreakerStuckRotation; } else { ((GrabbableObject)this).FallWithCurve(); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).grabbable = true; stuckToWall = false; stuckPlayer = null; } public void JumpActionTriggered(PlayerControllerB player) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (stuckToWall && !((Object)(object)stuckPlayer == (Object)null)) { weaponAudio.PlayOneShot(unlatchSounds[Random.Range(0, unlatchSounds.Length)]); stuckPlayer.activatingItem = false; stuckPlayer.disableMoveInput = false; stuckPlayer.externalForceAutoFade = Vector3.up * 35f; CRUtilities.MakePlayerGrabObject(stuckPlayer, (GrabbableObject)(object)this); } } public void InteractActionTriggered(PlayerControllerB player) { if (stuckToWall && !((Object)(object)stuckPlayer == (Object)null)) { weaponAudio.PlayOneShot(unlatchSounds[Random.Range(0, unlatchSounds.Length)]); stuckPlayer.activatingItem = false; stuckPlayer.disableMoveInput = false; CRUtilities.MakePlayerGrabObject(stuckPlayer, (GrabbableObject)(object)this); } } public float GetFreezePercentage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return iceMaterial.color.a * 100f; } } public class MouseTrap : GrabbableObject, ITriggerProxy { private static readonly int ArmedHash = Animator.StringToHash("Armed"); private bool _armed = false; [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip ArmingSound { get; private set; } [field: SerializeField] public AudioClip SnapSound { get; private set; } [field: SerializeField] public Animator Animator { get; private set; } public void OnProxyTriggerEnter(Collider other) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (_armed) { PlayerControllerB val = default(PlayerControllerB); EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); DeadBodyInfo val3 = default(DeadBodyInfo); if (((Component)other).TryGetComponent(ref val) && PlayerControllerBExtensions.IsLocalPlayer(val)) { HandlePlayerInteractionsRpc(PlayerControllerReference.op_Implicit(val)); } else if (((Component)other).TryGetComponent(ref val2) && ((NetworkBehaviour)val2.mainScript).IsOwner) { HandleEnemyInteractionsRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)val2.mainScript)); } else if (((Component)other).TryGetComponent(ref val3) && PlayerControllerBExtensions.IsLocalPlayer(val3.playerScript)) { HandleDeadBodyInteractionsRpc(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void HandlePlayerInteractionsRpc(PlayerControllerReference playerControllerReference) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) AudioSource.PlayOneShot(SnapSound); _armed = false; Animator.SetBool(ArmedHash, false); PlayerControllerB val = PlayerControllerReference.op_Implicit(playerControllerReference); val.DamagePlayer(5, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); ((MonoBehaviour)this).StartCoroutine(StunPlayerTemporarily(val)); } [Rpc(/*Could not decode attribute arguments.*/)] private void HandleDeadBodyInteractionsRpc() { AudioSource.PlayOneShot(SnapSound); _armed = false; Animator.SetBool(ArmedHash, false); ((MonoBehaviour)this).StartCoroutine(StunNothingTemporarily()); } [Rpc(/*Could not decode attribute arguments.*/)] private void HandleEnemyInteractionsRpc(NetworkBehaviourReference enemyBehaviourReference) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown AudioSource.PlayOneShot(SnapSound); _armed = false; Animator.SetBool(ArmedHash, false); EnemyAI val = (EnemyAI)NetworkBehaviourReference.op_Implicit(enemyBehaviourReference); val.HitEnemy(1, (PlayerControllerB)null, true, -1); ((MonoBehaviour)this).StartCoroutine(StunEnemyTemporarily(val)); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); Animator.SetBool(ArmedHash, true); AudioSource.PlayOneShot(ArmingSound); base.grabbable = false; ((MonoBehaviour)this).StartCoroutine(base.playerHeldBy.waitToEndOfFrameToDiscard()); } public void ArmMouseTrap() { _armed = true; base.grabbable = true; } public override void EquipItem() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).EquipItem(); if (_armed) { base.playerHeldBy.DamagePlayer(5, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); AudioSource.PlayOneShot(SnapSound); Animator.SetBool(ArmedHash, false); _armed = false; } } private IEnumerator StunNothingTemporarily() { base.grabbable = false; yield return (object)new WaitForSeconds(2f); base.grabbable = true; } private IEnumerator StunPlayerTemporarily(PlayerControllerB player) { base.grabbable = false; player.disableMoveInput = true; yield return (object)new WaitForSeconds(1f); player.disableMoveInput = false; base.grabbable = true; } private IEnumerator StunEnemyTemporarily(EnemyAI enemy) { base.grabbable = false; enemy.SetEnemyStunned(true, 2f, (PlayerControllerB)null); yield return (object)new WaitForSeconds(2f); base.grabbable = true; } } public class NitroCrate : GrabbableObject, IHittable { public Renderer renderer = null; public static List nitroCrates = new List(); [HideInInspector] public bool exploded = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); nitroCrates.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); nitroCrates.Remove(this); } [ServerRpc(RequireOwnership = false)] public void RequestServerToDespawnServerRpc() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!exploded) { exploded = true; if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } ((MonoBehaviour)this).StartCoroutine(DespawnAfterDelay(1f)); } } private IEnumerator DespawnAfterDelay(float delay) { DisableRendererAndExplodeClientRpc(); yield return (object)new WaitForSeconds(delay); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } [ClientRpc] private void DisableRendererAndExplodeClientRpc() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 20, 0f, 15f, 100, null, null, 250f); renderer.enabled = false; } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { RequestServerToDespawnServerRpc(); return true; } } public class OldBooze : GrabbableObject { private bool drinking = false; private static readonly int UseTZPItemAnimationHash = Animator.StringToHash("useTZPItem"); [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip DrinkingClip { get; private set; } public override void Update() { ((GrabbableObject)this).Update(); if (!drinking || !StartOfRound.Instance.shipIsLeaving) { return; } if ((Object)(object)base.playerHeldBy != (Object)null) { if (PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } } else if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!drinking) { base.playerHeldBy.activatingItem = true; drinking = true; ((MonoBehaviour)this).StartCoroutine(DrinkBooze()); } } private IEnumerator DrinkBooze() { PlayerControllerB playerDrunk = base.playerHeldBy; AudioSource.PlayOneShot(DrinkingClip); float duration = playerDrunk.drunkness; playerDrunk.playerBodyAnimator.SetBool(UseTZPItemAnimationHash, true); while (duration <= 1f) { duration = (playerDrunk.drunkness = duration + Time.deltaTime); playerDrunk.increasingDrunknessThisFrame = true; yield return null; } playerDrunk.playerBodyAnimator.SetBool(UseTZPItemAnimationHash, false); if (playerDrunk.isPlayerDead) { base.grabbable = false; base.customGrabTooltip = "Empty..."; if ((Object)(object)base.playerHeldBy != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } } else { playerDrunk.DamagePlayer(-50, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); playerDrunk.activatingItem = false; playerDrunk.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); base.grabbable = false; base.customGrabTooltip = "Empty..."; } } } [RequireComponent(typeof(SmartAgentNavigator))] public class OrbitalStrike : GrabbableObject { private Timer MinimumActivationTimer; private Timer LaserDurationTimer; private static readonly int RunSpeedAnimation = Animator.StringToHash("RunSpeed"); private static readonly int DeactivateAnimation = Animator.StringToHash("Deactivate"); private static readonly int ActivateAnimation = Animator.StringToHash("Activate"); [field: SerializeField] public Animator Animator { get; private set; } [field: SerializeField] public VisualEffect VisualEffect { get; private set; } [field: SerializeField] public NavMeshAgent NavMeshAgent { get; private set; } [field: SerializeField] public SmartAgentNavigator SmartAgentNavigator { get; private set; } [field: SerializeField] public Rigidbody Rigidbody { get; private set; } [field: SerializeField] public float MinimumActivationTime { get; private set; } [field: SerializeField] public float LaserDuration { get; private set; } public override void Start() { ((GrabbableObject)this).Start(); ((Component)this).gameObject.layer = 20; MinimumActivationTimer = new Timer(MinimumActivationTime, TimerExecutionTime.Update); LaserDurationTimer = new Timer(LaserDuration, TimerExecutionTime.Update); LaserDurationTimer.OnFinish += DeactivateLaser; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_004e: 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_0075: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner) { Rigidbody.isKinematic = false; base.grabbable = false; MinimumActivationTimer.Start(); Rigidbody.AddForce(((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f, (ForceMode)2); NavMeshAgent.Warp(((Component)base.playerHeldBy).transform.position); base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, ((Component)base.playerHeldBy).transform.position, true); } } private void DeactivateLaser(Timer t) { base.grabbable = true; Animator.SetTrigger(DeactivateAnimation); ((Behaviour)NavMeshAgent).enabled = false; Rigidbody.isKinematic = false; ((Behaviour)SmartAgentNavigator).enabled = false; } private void ActivateLaser() { Plugin.Logger.LogWarning((object)"Fire Laser!!!!"); MinimumActivationTimer.Stop(); LaserDurationTimer.Start(); Animator.SetTrigger(ActivateAnimation); ((Behaviour)NavMeshAgent).enabled = true; Rigidbody.isKinematic = true; ((Behaviour)SmartAgentNavigator).enabled = true; SmartAgentNavigator.StartSearchRoutine(20f); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); } public override void Update() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (Rigidbody.isKinematic) { ((GrabbableObject)this).Update(); } Animator animator = Animator; int runSpeedAnimation = RunSpeedAnimation; Vector3 velocity = NavMeshAgent.velocity; animator.SetFloat(runSpeedAnimation, ((Vector3)(ref velocity)).magnitude / NavMeshAgent.speed); } public override void LateUpdate() { //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_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 (!((Behaviour)NavMeshAgent).enabled && Rigidbody.isKinematic) { ((GrabbableObject)this).LateUpdate(); } else if (!Rigidbody.isKinematic) { ManualLogSource logger = Plugin.Logger; Vector3 velocity = Rigidbody.velocity; logger.LogWarning((object)((Vector3)(ref velocity)).magnitude.ToString()); velocity = Rigidbody.velocity; if ((double)((Vector3)(ref velocity)).magnitude < 2.0 && MinimumActivationTimer.IsFinished) { ActivateLaser(); } } } } public class Oxidizer : GrabbableObject { public ParticleSystem[] flameStreamParticleSystems = Array.Empty(); public SkinnedMeshRenderer skinnedMeshRenderer = null; public Transform capsuleTransform = null; public AudioSource flameSource = null; public AudioSource oxidizerSource = null; public AudioClip outOfOxygenClip = null; public AudioClip releaseHoldClip = null; public AudioClip holdStartClip = null; public AudioClip bigBlastClip = null; public float depleteMultiplier = 10f; public float rechargeMultiplier = 1f; private bool charged = true; private bool superCharged = false; private bool nerfed = false; private float updateHitInterval = 0.2f; private RaycastHit[] _cachedRaycastHits = (RaycastHit[])(object)new RaycastHit[24]; private List _iHittableList = new List(); private List _enemyAIList = new List(); private List _playerControllerBList = new List(); private void DoHitStuff(int damageToDeal) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) _iHittableList.Clear(); _enemyAIList.Clear(); _playerControllerBList.Clear(); int num = Physics.SphereCastNonAlloc(capsuleTransform.position, 2f, ((Component)flameStreamParticleSystems[0]).transform.forward, _cachedRaycastHits, 6f, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val = default(IHittable); for (int i = 0; i < num; i++) { if ((Object)(object)((RaycastHit)(ref _cachedRaycastHits[i])).transform == (Object)(object)((Component)base.playerHeldBy).transform || !((Component)((RaycastHit)(ref _cachedRaycastHits[i])).collider).gameObject.TryGetComponent(ref val)) { continue; } EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null); if (val2 != null) { if (!_enemyAIList.Contains(val2.mainScript)) { _enemyAIList.Add(val2.mainScript); } continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null); if (val3 != null) { if (!_playerControllerBList.Contains(val3)) { _playerControllerBList.Add(val3); } } else { _iHittableList.Add(val); } } foreach (IHittable iHittable in _iHittableList) { if (((NetworkBehaviour)this).IsOwner) { iHittable.Hit(damageToDeal, ((Component)flameStreamParticleSystems[0]).transform.position, base.playerHeldBy, true, 745737); } } foreach (EnemyAI enemyAI in _enemyAIList) { if (((NetworkBehaviour)enemyAI).IsOwner) { enemyAI.HitFromExplosion(Vector3.Distance(((Component)this).transform.position, ((Component)enemyAI).transform.position)); } enemyAI.HitEnemy(damageToDeal, base.playerHeldBy, true, 745737); } foreach (PlayerControllerB playerControllerB in _playerControllerBList) { playerControllerB.DamagePlayer(damageToDeal * 10, true, true, (CauseOfDeath)13, 6, false, default(Vector3)); } } public override void Update() { ((GrabbableObject)this).Update(); updateHitInterval -= Time.deltaTime; if (superCharged) { return; } if (!charged && skinnedMeshRenderer.GetBlendShapeWeight(0) < 80f) { charged = true; oxidizerSource.PlayOneShot(holdStartClip); } else if (charged && !base.isBeingUsed && skinnedMeshRenderer.GetBlendShapeWeight(0) >= 80f) { charged = false; } if (!base.isBeingUsed) { skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(skinnedMeshRenderer.GetBlendShapeWeight(0) - Time.deltaTime * rechargeMultiplier * (nerfed ? 0.5f : 1f), 0f, 100f)); return; } if (updateHitInterval <= 0f) { updateHitInterval = 0.25f; DoHitStuff(1); } skinnedMeshRenderer.SetBlendShapeWeight(0, Mathf.Clamp(skinnedMeshRenderer.GetBlendShapeWeight(0) + Time.deltaTime * depleteMultiplier, 0f, 100f)); if (skinnedMeshRenderer.GetBlendShapeWeight(0) >= 100f) { base.isBeingUsed = false; base.playerHeldBy.activatingItem = false; ParticleSystem[] array = flameStreamParticleSystems; foreach (ParticleSystem val in array) { val.Stop(); } oxidizerSource.PlayOneShot(outOfOxygenClip); flameSource.Stop(); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!charged) { return; } base.isBeingUsed = buttonDown; if (buttonDown) { oxidizerSource.PlayOneShot(holdStartClip); flameSource.Play(); } else { oxidizerSource.PlayOneShot(releaseHoldClip); flameSource.Stop(); } base.playerHeldBy.activatingItem = buttonDown; ParticleSystem[] array = flameStreamParticleSystems; foreach (ParticleSystem val in array) { if (buttonDown) { val.Play(); } else { val.Stop(); } } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); Plugin.InputActionsInstance.ExhaustFuel.performed += OnExhaustFuel; } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); base.isBeingUsed = false; Plugin.InputActionsInstance.ExhaustFuel.performed -= OnExhaustFuel; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); base.isBeingUsed = false; } public void OnExhaustFuel(CallbackContext context) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if (charged && !base.isPocketed && !superCharged && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)base.playerHeldBy)) { ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { DoExhaustFuelServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void DoExhaustFuelServerRpc() { DoExhaustFuelClientRpc(); } [ClientRpc] private void DoExhaustFuelClientRpc() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_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) superCharged = true; oxidizerSource.PlayOneShot(bigBlastClip); float num = 100f - skinnedMeshRenderer.GetBlendShapeWeight(0); int num2 = Mathf.FloorToInt(num / 5f); Plugin.ExtendedLogging($"Oxidizer: {num2} damage dealt."); DoHitStuff(num2); ParticleSystem[] array = flameStreamParticleSystems; foreach (ParticleSystem val in array) { MainModule main = val.main; MinMaxCurve startSize = ((MainModule)(ref main)).startSize; ((MainModule)(ref main)).startSize = new MinMaxCurve(((MinMaxCurve)(ref startSize)).constant * 3f); val.Play(); } PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.externalForceAutoFade += -((Component)base.playerHeldBy.gameplayCamera).transform.forward * 25f * (base.playerHeldBy.isCrouching ? 0.25f : 1f); ((MonoBehaviour)this).StartCoroutine(CRUtilities.ForcePlayerLookup(base.playerHeldBy, 5f)); ((MonoBehaviour)this).StartCoroutine(SetWeightTo100()); } private IEnumerator SetWeightTo100() { while (skinnedMeshRenderer.GetBlendShapeWeight(0) < 100f) { skinnedMeshRenderer.SetBlendShapeWeight(0, skinnedMeshRenderer.GetBlendShapeWeight(0) + 100f * Time.deltaTime); yield return null; } ParticleSystem[] array = flameStreamParticleSystems; foreach (ParticleSystem ps in array) { MainModule mainModule = ps.main; MinMaxCurve startSize = ((MainModule)(ref mainModule)).startSize; ((MainModule)(ref mainModule)).startSize = new MinMaxCurve(((MinMaxCurve)(ref startSize)).constant / 3f); ps.Stop(); mainModule = default(MainModule); } charged = false; superCharged = false; ((MonoBehaviour)this).StartCoroutine(SuperChargeNerf()); } private IEnumerator SuperChargeNerf() { nerfed = true; yield return (object)new WaitForSeconds(15f); nerfed = false; } } [RequireComponent(typeof(InteractTrigger))] public class Pickable : NetworkBehaviour { [SerializeField] private AudioSource? unlockSFX = null; [SerializeField] private UnityEvent? onUnlock = null; public bool IsLocked { get; set; } = true; public void Unlock() { UnlockStuffServerRpc(); } [ServerRpc(RequireOwnership = false)] public void UnlockStuffServerRpc() { UnlockStuffClientRpc(); } [ClientRpc] public void UnlockStuffClientRpc() { UnlockStuffLocally(); } public void UnlockStuffLocally() { if (IsLocked) { Plugin.ExtendedLogging($"Unlocking {this}"); AudioSource? obj = unlockSFX; if (obj != null) { obj.Play(); } UnityEvent? obj2 = onUnlock; if (obj2 != null) { obj2.Invoke(); } IsLocked = false; } } } public class PlushieItem : GrabbableObject { [Header("References")] [SerializeField] private Animator _animator = null; [Space(10f)] [Header("Events")] [SerializeField] private bool _dropOnUse = false; [SerializeField] private UnityEvent _onUseEvent = null; [SerializeField] private UnityEvent _onAnimationEnd = null; [Space(10f)] [Header("Audio")] [SerializeField] private AudioSource _audioSource = null; [SerializeField] private AudioClip? _useSound = null; private static readonly int DoPlushieAnimation = Animator.StringToHash("DoPlushieAnimation"); public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); _animator.SetTrigger(DoPlushieAnimation); _onUseEvent.Invoke(); if ((Object)(object)_useSound != (Object)null) { _audioSource.PlayOneShot(_useSound); } if (_dropOnUse && (Object)(object)base.playerHeldBy != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy)) { ((MonoBehaviour)base.playerHeldBy).StartCoroutine(base.playerHeldBy.waitToEndOfFrameToDiscard()); } } public void OnAnimationEndAnimEvent() { _onAnimationEnd.Invoke(); } } public class RubberBand : GrabbableObject { private static readonly int ProgressAnimationHash = Animator.StringToHash("Progress"); private static readonly int ChargingAnimationHash = Animator.StringToHash("Charging"); private static readonly int ReleaseAnimationHash = Animator.StringToHash("Release"); private static readonly int MaxChargeAnimationHash = Animator.StringToHash("MaxCharge"); private float _charging = 0f; private float _cooldown = 0.5f; [field: SerializeField] public Animator Animator { get; private set; } [field: SerializeField] public AnimationCurve UseCurveStrength { get; private set; } [field: SerializeField] public float PushStrength { get; private set; } public override void Update() { ((GrabbableObject)this).Update(); _cooldown -= Time.deltaTime; if (!base.isPocketed && base.isHeld && !(_charging >= 3f)) { if (base.isBeingUsed) { _charging += Time.deltaTime; } float num = UseCurveStrength.Evaluate(_charging); Animator.SetFloat(ProgressAnimationHash, num); if (_charging >= 3f) { Animator.SetTrigger(MaxChargeAnimationHash); } } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!(_cooldown > 0f)) { base.isBeingUsed = buttonDown; if (buttonDown) { base.playerHeldBy.isMovementHindered = Mathf.Clamp(1, 1, base.playerHeldBy.isMovementHindered); Animator.SetFloat(ProgressAnimationHash, 0f); Animator.SetTrigger(ChargingAnimationHash); } else { _cooldown = 0.5f; base.playerHeldBy.isMovementHindered = Mathf.Clamp(base.playerHeldBy.isMovementHindered - 1, 0, base.playerHeldBy.isMovementHindered); float num = UseCurveStrength.Evaluate(_charging); PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.externalForceAutoFade += ((Component)base.playerHeldBy.gameplayCamera).transform.forward * PushStrength * num * 10f; _charging = 0f; Animator.SetFloat(ProgressAnimationHash, 1f); Animator.SetTrigger(ReleaseAnimationHash); } base.playerHeldBy.activatingItem = buttonDown; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); Animator.SetFloat(ProgressAnimationHash, 0f); Animator.ResetTrigger(ChargingAnimationHash); Animator.ResetTrigger(ReleaseAnimationHash); Animator.ResetTrigger(MaxChargeAnimationHash); base.isBeingUsed = false; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); Animator.SetFloat(ProgressAnimationHash, 0f); Animator.ResetTrigger(ChargingAnimationHash); Animator.ResetTrigger(ReleaseAnimationHash); Animator.ResetTrigger(MaxChargeAnimationHash); base.isBeingUsed = false; } } public class SallyCubes : GrabbableObject { } public class ScrapAPult : GrabbableObject { } public class ShipUnlocker : GrabbableObject { public AudioSource audioPlayer = null; public VideoPlayer videoPlayer = null; private bool usedOnce = false; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (usedOnce) { return; } List list = new List(); foreach (UnlockableItem unlockable in StartOfRound.Instance.unlockablesList.unlockables) { if (!unlockable.hasBeenUnlockedByPlayer && !unlockable.alreadyUnlocked) { list.Add(unlockable); } } if (list.Count > 0) { UnlockableItem item = list[Random.Range(0, list.Count)]; StartOfRound.Instance.BuyShipUnlockableServerRpc(StartOfRound.Instance.unlockablesList.unlockables.IndexOf(item), TerminalRefs.Instance.groupCredits); PlaySoundClientRpc(); ((MonoBehaviour)this).StartCoroutine(WaitForEndOfFrame()); } } private IEnumerator WaitForEndOfFrame() { yield return (object)new WaitForSeconds(0.25f); yield return (object)new WaitUntil((Func)(() => !audioPlayer.isPlaying && !videoPlayer.isPlaying)); if (base.isHeld || base.isPocketed) { base.playerHeldBy.carryWeight = Mathf.Clamp(base.playerHeldBy.carryWeight - (base.itemProperties.weight - 1f), 1f, 10f); base.playerHeldBy.DestroyItemInSlotAndSync(Array.IndexOf(base.playerHeldBy.ItemSlots, (GrabbableObject)(object)this)); } else { DespawnItemServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void DespawnItemServerRpc() { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } [ClientRpc] public void PlaySoundClientRpc() { usedOnce = true; audioPlayer.Play(); ((Component)videoPlayer).gameObject.SetActive(true); if (!videoPlayer.playOnAwake) { videoPlayer.Play(); } } } public class SmallRigo : MonoBehaviour { public AudioSource audioSource = null; public AudioClip[] imarigoSounds = Array.Empty(); public Animator animator = null; public NavMeshAgent agent = null; [HideInInspector] public bool jumping = false; private static readonly int Jumping = Animator.StringToHash("isJumping"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); public void DoPathingToPosition(Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Animator obj = animator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = agent.velocity; obj.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude); agent.SetDestination(position); } public void SetJumping(bool _jumping) { jumping = _jumping; animator.SetBool(Jumping, _jumping); } } public class SmallRigoManager : MonoBehaviour { public GoldRigo goldRigo = null; public int numberOfSmallRigos = 20; private bool active = false; private bool initalizing = true; private GameObject smallRigoPrefab = null; private List smallRigosActive = new List(); public void Start() { goldRigo = ((Component)this).gameObject.GetComponent(); smallRigoPrefab = ContentHandler.Instance.XuAndRigo.SmallRigoPrefab; ((MonoBehaviour)this).StartCoroutine(SpawnSmallRigos(numberOfSmallRigos)); } public void Update() { if ((Object)(object)goldRigo == (Object)null) { foreach (SmallRigo item in smallRigosActive) { if (!((Object)(object)item == (Object)null)) { Object.Destroy((Object)(object)item); } } if (NetworkManager.Singleton.IsServer) { Object.Destroy((Object)(object)this); } } else { if (initalizing) { return; } if (active) { if (StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving) { Deactivate(); } } else if (!StartOfRound.Instance.inShipPhase && StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving) { Activate(); } } } public IEnumerator SpawnSmallRigos(int numberOfSmallRigos) { while (smallRigosActive.Count < numberOfSmallRigos) { yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)goldRigo == (Object)null) { Plugin.Logger.LogError((object)"GoldRigo is null"); yield break; } GameObject smallRigo = Object.Instantiate(smallRigoPrefab, ((Component)goldRigo).transform.position, ((Component)goldRigo).transform.rotation); smallRigosActive.Add(smallRigo.GetComponent()); } initalizing = false; } public void Activate() { active = true; foreach (SmallRigo item in smallRigosActive) { ((Component)item).gameObject.SetActive(true); } ((MonoBehaviour)this).StartCoroutine(VoiceRoutine()); ((MonoBehaviour)this).StartCoroutine(ActiveRoutine()); } public IEnumerator ActiveRoutine() { NavMeshHit hit = default(NavMeshHit); foreach (SmallRigo smallRigo in smallRigosActive) { if (!((Object)(object)smallRigo == (Object)null)) { if (NavMesh.SamplePosition(((Component)goldRigo).transform.position, ref hit, 2f, smallRigo.agent.areaMask)) { ((Component)smallRigo).transform.position = ((NavMeshHit)(ref hit)).position; ((Behaviour)smallRigo.agent).enabled = true; smallRigo.agent.Warp(((NavMeshHit)(ref hit)).position); } else { ((Behaviour)smallRigo.agent).enabled = false; } } } while (active) { foreach (SmallRigo smallRigo2 in smallRigosActive) { if ((Object)(object)smallRigo2 == (Object)null) { continue; } if (!((Behaviour)smallRigo2.agent).enabled || !smallRigo2.agent.isOnNavMesh) { if (!NavMesh.SamplePosition(((Component)goldRigo).transform.position, ref hit, 2f, smallRigo2.agent.areaMask)) { continue; } ((Component)smallRigo2).transform.position = ((NavMeshHit)(ref hit)).position; ((Behaviour)smallRigo2.agent).enabled = true; smallRigo2.agent.Warp(((NavMeshHit)(ref hit)).position); } float distanceToKing = Vector3.Distance(((Component)smallRigo2).transform.position, ((Component)goldRigo).transform.position); if ((Object)(object)((GrabbableObject)goldRigo).playerHeldBy != (Object)null) { if (distanceToKing <= 2f && !smallRigo2.jumping) { smallRigo2.SetJumping(_jumping: true); continue; } if (distanceToKing > 2f && smallRigo2.jumping) { smallRigo2.SetJumping(_jumping: false); } smallRigo2.DoPathingToPosition(((Component)((GrabbableObject)goldRigo).playerHeldBy).transform.position); } else if (distanceToKing > 1f) { smallRigo2.DoPathingToPosition(((Component)goldRigo).transform.position); } yield return null; } yield return (object)new WaitForSeconds(0.25f); } } public IEnumerator VoiceRoutine() { while (active) { int randomRigo = Random.Range(0, smallRigosActive.Count - 1); smallRigosActive[randomRigo].audioSource.PlayOneShot(smallRigosActive[randomRigo].imarigoSounds[Random.Range(0, smallRigosActive[randomRigo].imarigoSounds.Length)], Random.Range(0.75f, 1f)); yield return (object)new WaitForSeconds(Random.Range(0.75f, 2.5f)); } } public void Deactivate() { active = false; foreach (SmallRigo item in smallRigosActive) { ((Behaviour)item.agent).enabled = false; ((Component)item).gameObject.SetActive(false); } } public void OnDestroy() { if (NetworkManager.Singleton.IsServer && (Object)(object)goldRigo != (Object)null && ((NetworkBehaviour)goldRigo).IsSpawned) { ((NetworkBehaviour)goldRigo).NetworkObject.Despawn(true); } foreach (SmallRigo item in smallRigosActive) { if (!((Object)(object)item == (Object)null)) { Object.Destroy((Object)(object)((Component)item).gameObject); } } } } public class SnowGlobe : GrabbableObject { [Tooltip("Lights")] [SerializeField] private GameObject mainLightGameObject = null; [SerializeField] private GameObject[] redLightsGameObject = null; [SerializeField] private GameObject[] blueLightsGameObject = null; [SerializeField] private GameObject[] greenLightsGameObject = null; [Space(5f)] [SerializeField] private Animator shipAnimator = null; [SerializeField] private ParticleSystem snowPS = null; [SerializeField] private ParticleSystemRenderer snowPSR = null; [SerializeField] private AudioSource musicAS = null; private PlayerControllerB? previouslyHeldBy; private bool activated; private Random snow = new Random(); public override void Start() { ((GrabbableObject)this).Start(); snow = new Random(StartOfRound.Instance.randomMapSeed + 32); } public override void Update() { ((GrabbableObject)this).Update(); if (!((Object)(object)previouslyHeldBy == (Object)null)) { } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); previouslyHeldBy = base.playerHeldBy; if ((Object)(object)previouslyHeldBy == (Object)null) { Plugin.ExtendedLogging("previouslyHeldBy is null"); } ToggleParticleRenderer(toggle: true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ToggleParticleRenderer(toggle: false); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!activated) { if (Plugin.ModConfig.ConfigSnowGlobeMusic.Value) { musicAS.volume = 1f; } else { musicAS.volume = 0f; } ((MonoBehaviour)this).StartCoroutine(ActivateSnowGlobeCoroutine()); activated = true; } } public IEnumerator ActivateSnowGlobeCoroutine() { yield return (object)new WaitForEndOfFrame(); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 1f, 0, base.isInShipRoom, 0); yield return ToggleSnowGlobeCoroutine(toggle: true); yield return (object)new WaitUntil((Func)(() => !musicAS.isPlaying)); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 1f, 0, base.isInShipRoom, 0); yield return ToggleSnowGlobeCoroutine(toggle: false); yield return (object)new WaitForSeconds(2f); activated = false; } private IEnumerator ToggleSnowGlobeCoroutine(bool toggle, float delay = 0.2f) { ToggleParticles(toggle); ToggleMusic(toggle); shipAnimator.SetBool("doorsActivated", toggle); yield return (object)new WaitForSeconds(delay); mainLightGameObject.SetActive(toggle); } public IEnumerator RotateLights() { int currentLightIndex = 0; for (int totalSeconds = 17; totalSeconds > 0; totalSeconds--) { ToggleLights(toggle: false); switch (currentLightIndex % 3) { case 0: { GameObject[] array2 = redLightsGameObject; foreach (GameObject light2 in array2) { light2.SetActive(true); } break; } case 1: { GameObject[] array3 = greenLightsGameObject; foreach (GameObject light3 in array3) { light3.SetActive(true); } break; } case 2: { GameObject[] array = blueLightsGameObject; foreach (GameObject light in array) { light.SetActive(true); } break; } } if (totalSeconds <= 2) { ToggleLights(toggle: true); } yield return (object)new WaitForSeconds(1f); currentLightIndex++; } ToggleLights(toggle: false); } private void ToggleLights(bool toggle) { GameObject[] array = redLightsGameObject; foreach (GameObject val in array) { val.SetActive(toggle); } GameObject[] array2 = greenLightsGameObject; foreach (GameObject val2 in array2) { val2.SetActive(toggle); } GameObject[] array3 = blueLightsGameObject; foreach (GameObject val3 in array3) { val3.SetActive(toggle); } } private void ToggleParticles(bool toggle) { if (toggle) { snowPS.Play(); } else { snowPS.Stop(); } } private void ToggleMusic(bool toggle) { if (toggle) { musicAS.Play(); } else { musicAS.Stop(); } } private void ToggleParticleRenderer(bool toggle) { ((Renderer)snowPSR).enabled = toggle; } } public class Swatter : CRWeapon { private Collider[] cachedColliders = (Collider[])(object)new Collider[24]; public override void Start() { ((GrabbableObject)this).Start(); OnEnemyHit.AddListener((UnityAction)OnEnemyHitEvent); } public void OnEnemyHitEvent(EnemyAI enemyScript) { ((MonoBehaviour)this).StartCoroutine(HandleEnemyHits(enemyScript)); } public IEnumerator HandleEnemyHits(EnemyAI enemyScript) { int numHits = Physics.OverlapSphereNonAlloc(((Component)enemyScript).gameObject.transform.position, 5f, cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable iHittable = default(IHittable); for (int i = 0; i < numHits; i++) { yield return null; int num; if (((Component)cachedColliders[i]).gameObject.TryGetComponent(ref iHittable)) { EnemyAICollisionDetect hittableEnemyScript = (EnemyAICollisionDetect)(object)((iHittable is EnemyAICollisionDetect) ? iHittable : null); if (hittableEnemyScript == null || (!((Object)(object)hittableEnemyScript.mainScript == (Object)(object)enemyScript) && !hittableEnemyScript.mainScript.isEnemyDead)) { PlayerControllerB player = (PlayerControllerB)(object)((iHittable is PlayerControllerB) ? iHittable : null); num = ((player != null && (Object)(object)player == (Object)(object)previousPlayerHeldBy) ? 1 : 0); goto IL_0116; } } num = 1; goto IL_0116; IL_0116: if (num == 0) { iHittable.Hit(HitForce, ((Component)previousPlayerHeldBy).transform.position, previousPlayerHeldBy, true, HitId); iHittable = null; } } } } public class TalkingHead : GrabbableObject { public Transform playerBone = null; public Vector3 positionOffset = new Vector3(-2.5f, -2.2f, 0f); public MeshRenderer meshRenderer = null; internal Mistress? mistress = null; internal PlayerControllerB? player = null; private bool wasInFactoryLastFrame = false; private ScanNodeProperties scanNodeProperties = null; private Vector3 rotationOffset = new Vector3(-90f, 90f, 90f); private Vector3 nonHeldRotationOffset = new Vector3(90f, 0f, 0f); private Renderer? localHeadRenderer = null; internal static List talkingHeads = new List(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); scanNodeProperties = ((Component)this).GetComponentInChildren(); base.isInFactory = false; talkingHeads.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); talkingHeads.Remove(this); } public override void Update() { //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if ((Object)(object)player == (Object)null) { return; } if (base.isInFactory != wasInFactoryLastFrame && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player && RoundManager.Instance.currentLevel.planetHasTime) { Plugin.ExtendedLogging("Teleporting player."); EntranceTeleport val = ((IEnumerable)CodeRebirthUtils.EntrancePoints).FirstOrDefault((Func)((EntranceTeleport p) => p.isEntranceToBuilding == !wasInFactoryLastFrame)); if (val != null) { val.TeleportPlayer(); } } wasInFactoryLastFrame = base.isInFactory; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { ((Renderer)meshRenderer).enabled = false; ((Behaviour)scanNodeProperties).enabled = false; } if ((Object)(object)mistress != (Object)null) { player.inAnimationWithEnemy = (EnemyAI)(object)mistress; } ((Component)player.thisPlayerModelLOD1).gameObject.SetActive(false); ((Component)player.thisPlayerModelLOD2).gameObject.SetActive(false); ((Component)player.thisPlayerModel).gameObject.SetActive(false); player.disableMoveInput = true; player.disableInteract = true; if (!base.isHeld) { Quaternion rotation = ((Component)this).transform.rotation; rotation *= Quaternion.Euler(rotationOffset); ((Component)player).transform.SetPositionAndRotation(playerBone.position + positionOffset, rotation); } else { ((Component)player).transform.position = playerBone.position; ((Component)player).transform.forward = ((Component)this).transform.forward; Quaternion rotation2 = ((Component)this).transform.rotation; rotation2 *= Quaternion.Euler(nonHeldRotationOffset); ((Component)player).transform.rotation = rotation2; } if ((Object)(object)localHeadRenderer == (Object)null) { localHeadRenderer = ((Component)player.localVisor).GetComponentInChildren(); } localHeadRenderer.enabled = false; int num = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB player) => player.isPlayerControlled && !player.isPlayerDead && !player.IsPseudoDead()); if (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB player) => player.isPlayerControlled && !player.isPlayerDead && !player.IsPseudoDead()) == 0) { MoreCompanySoftCompat.TryDisableOrEnableCosmetics(player, disable: false); player.DisablePlayerModel(((Component)player).gameObject, true, false); player.inAnimationWithEnemy = null; player.disableMoveInput = false; player.disableInteract = false; ((Component)player.thisPlayerModel).gameObject.SetActive(true); ((Component)player.playerBadgeMesh).gameObject.SetActive(true); ((Component)player.thisPlayerModelLOD2).gameObject.SetActive(true); ((Component)player.thisPlayerModelLOD1).gameObject.SetActive(true); ((Component)player.headCostumeContainer).gameObject.SetActive(true); ((Component)player.headCostumeContainerLocal).gameObject.SetActive(true); ((Component)player.playerBetaBadgeMesh).gameObject.SetActive(true); if ((Object)(object)localHeadRenderer != (Object)null) { localHeadRenderer.enabled = true; } player.SetPseudoDead(pseudoDead: false); ((Component)player).gameObject.layer = 3; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { ((Behaviour)scanNodeProperties).enabled = true; ((Renderer)meshRenderer).enabled = true; HUDManager.Instance.HideHUD(false); StartOfRound.Instance.allowLocalPlayerDeath = true; player.KillPlayer(Vector3.zero, false, (CauseOfDeath)17, 0, default(Vector3), false); } Plugin.ExtendedLogging("Killing talking head."); player = null; } } [ServerRpc(RequireOwnership = false)] public void SyncTalkingHeadServerRpc(PlayerControllerReference playerControllerReference, NetworkBehaviourReference networkBehaviourReference) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SyncTalkingHeadClientRpc(playerControllerReference, networkBehaviourReference); } [ClientRpc] private void SyncTalkingHeadClientRpc(PlayerControllerReference playerControllerReference, NetworkBehaviourReference networkBehaviourReference) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) player = PlayerControllerReference.op_Implicit(playerControllerReference); mistress = (Mistress)(object)NetworkBehaviourReference.op_Implicit(networkBehaviourReference); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { ((Renderer)meshRenderer).enabled = false; } player.SetPseudoDead(pseudoDead: true); } } public class TimeSlower : GrabbableObject { public Animator animator = null; public AudioClip rechargedSound = null; public AudioClip timeStopEndSound = null; public AudioClip watchUseSound = null; public AudioSource watchSource = null; public AudioSource watchIdleSource = null; private static readonly int activateWatch = Animator.StringToHash("activateWatch"); public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); watchIdleSource.Play(); watchSource.PlayOneShot(watchUseSound); animator.SetTrigger(activateWatch); SlowDownEffect.DoSlowdownEffect(30f, 0.2f); ((MonoBehaviour)this).StartCoroutine(WaitUntilEffectEnds(6f)); } private IEnumerator WaitUntilEffectEnds(float length) { yield return (object)new WaitForSeconds(length); watchIdleSource.Stop(); watchSource.PlayOneShot(timeStopEndSound); yield return (object)new WaitUntil((Func)(() => base.currentUseCooldown == 0f)); watchSource.PlayOneShot(rechargedSound); } } public class TomaHop : CRWeapon { [SerializeField] private float _groundLaunchTimer = 1f; [SerializeField] private AudioClip _launchUpSound = null; private int hitsInSuccession = 0; private float hitTimer = 1.5f; public override void GrabItem() { ((GrabbableObject)this).GrabItem(); OnEnemyHit.AddListener((UnityAction)OnEnemyHitEvent); Plugin.InputActionsInstance.JumpBoost.performed += OnGroundLaunch; } public override void DiscardItem() { base.DiscardItem(); OnEnemyHit.RemoveListener((UnityAction)OnEnemyHitEvent); Plugin.InputActionsInstance.JumpBoost.performed -= OnGroundLaunch; } public void OnGroundLaunch(CallbackContext context) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!(_groundLaunchTimer > 0f) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)((GrabbableObject)this).playerHeldBy) && !((GrabbableObject)this).isPocketed && GameNetworkManager.Instance.localPlayerController.thisController.isGrounded) { ButtonControl val = (ButtonControl)((CallbackContext)(ref context)).control; if (val.wasPressedThisFrame) { _groundLaunchTimer = 1f; weaponAudio.PlayOneShot(_launchUpSound); PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.externalForces += Vector3.up * 50f; PlayerControllerB playerHeldBy2 = ((GrabbableObject)this).playerHeldBy; playerHeldBy2.externalForceAutoFade += Vector3.up * 50f; } } } public override void Update() { ((GrabbableObject)this).Update(); _groundLaunchTimer -= Time.deltaTime; if (hitsInSuccession > 0) { hitTimer -= Time.deltaTime; if (hitTimer <= 0f) { hitsInSuccession--; hitTimer = 2f; } } } public void OnEnemyHitEvent(EnemyAI enemyAI) { //IL_0060: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (!(previousPlayerHeldBy.fallValue >= -3f)) { float num = previousPlayerHeldBy.fallValue * -1f; previousPlayerHeldBy.ResetFallGravity(); Vector3 val = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)); Vector3 val2 = ((Vector3)(ref val)).normalized * 4f; Vector3 val3 = Vector3.up * num + val2 * Mathf.Clamp((float)hitsInSuccession, 0f, 10f); previousPlayerHeldBy.externalForces = val3; PlayerControllerB? obj = previousPlayerHeldBy; obj.externalForceAutoFade += val3; enemyAI.HitEnemyOnLocalClient(Math.Clamp((int)(num / 10f) - 1, 0, 10), ((Component)this).transform.position, previousPlayerHeldBy, true, -1); hitsInSuccession++; hitTimer = 2f; } } } public class Turbulence : CRWeapon { [SerializeField] private AudioSource _jetActiveIdleSource = null; [SerializeField] private ParticleSystem _jetParticles = null; private bool stuckToGround = false; public override void OnNetworkSpawn() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ((NetworkBehaviour)this).OnNetworkSpawn(); OnHitSuccess.AddListener(new UnityAction(OnHitSuccessEvent)); OnEnemyHit.AddListener((UnityAction)OnEnemyHitEvent); } public override void OnNetworkDespawn() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ((NetworkBehaviour)this).OnNetworkDespawn(); OnHitSuccess.RemoveListener(new UnityAction(OnHitSuccessEvent)); OnEnemyHit.RemoveListener((UnityAction)OnEnemyHitEvent); } public void OnEnemyHitEvent(EnemyAI enemyAI) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) OnEnemyHitServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)enemyAI)); } [ServerRpc(RequireOwnership = false)] public void OnEnemyHitServerRpc(NetworkBehaviourReference enemyAI) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) OnEnemyHitClientRpc(enemyAI); } [ClientRpc] public void OnEnemyHitClientRpc(NetworkBehaviourReference enemyAI) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) EnemyAI val = default(EnemyAI); if (((NetworkBehaviourReference)(ref enemyAI)).TryGet(ref val, (NetworkManager)null)) { if (((NetworkBehaviour)val).IsOwner) { val.HitFromExplosion(5f); } if (val.enemyHP <= 0 || val.isEnemyDead) { ((Component)val).transform.localScale = new Vector3(((Component)val).transform.localScale.x, ((Component)val).transform.localScale.y * 0.1f, ((Component)val).transform.localScale.z); } } } public void OnHitSuccessEvent() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) RoundManager.Instance.DestroyTreeOnLocalClient(((Component)this).transform.position); OnHitSuccessServerRpc(((Component)this).transform.position, ((Component)this).transform.rotation); } [ServerRpc(RequireOwnership = false)] public void OnHitSuccessServerRpc(Vector3 position, Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) OnHitSuccessClientRpc(position, rotation); } [ClientRpc] public void OnHitSuccessClientRpc(Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_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) ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; stuckToGround = true; float num = Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position); if (num <= 15f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } if (PlayerControllerBExtensions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy)) { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.externalForceAutoFade += -((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward * 150f; ((MonoBehaviour)this).StartCoroutine(((GrabbableObject)this).playerHeldBy.waitToEndOfFrameToDiscard()); } } public override void OnStartReelup() { base.OnStartReelup(); _jetParticles.Play(true); PlayJetParticlesServerRpc(); } [ServerRpc(RequireOwnership = false)] public void PlayJetParticlesServerRpc() { PlayJetParticlesClientRpc(); } [ClientRpc] public void PlayJetParticlesClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { _jetParticles.Play(true); } } public override void EndWeaponHit(bool success) { base.EndWeaponHit(success); _jetParticles.Stop(true); StopJetParticlesServerRpc(); } [ServerRpc(RequireOwnership = false)] public void StopJetParticlesServerRpc() { StopJetParticlesClientRpc(); } [ClientRpc] public void StopJetParticlesClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { _jetParticles.Stop(true); } } public override void StartHeldOverHead() { base.StartHeldOverHead(); _jetActiveIdleSource.Play(); ActivateJetIdleSoundServerRpc(); } [ServerRpc(RequireOwnership = false)] public void ActivateJetIdleSoundServerRpc() { ActivateJetIdleSoundClientRpc(); } [ClientRpc] public void ActivateJetIdleSoundClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { _jetActiveIdleSource.Play(); } } public override void EndHeldOverHead() { base.EndHeldOverHead(); _jetActiveIdleSource.Stop(); DeactivateJetIdleSoundServerRpc(); } [ServerRpc(RequireOwnership = false)] public void DeactivateJetIdleSoundServerRpc() { DeactivateJetIdleSoundClientRpc(); } [ClientRpc] public void DeactivateJetIdleSoundClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { _jetActiveIdleSource.Stop(); } } public override void FallWithCurve() { if (!stuckToGround) { ((GrabbableObject)this).FallWithCurve(); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).grabbable = true; stuckToGround = false; } public override void LateUpdate() { ((GrabbableObject)this).LateUpdate(); if (reelingUp && ((NetworkBehaviour)this).IsServer) { NetworkVariable obj = heldOverHeadTimer; obj.Value += Time.deltaTime; } ShakeTransform(((Component)this).transform, Mathf.Clamp(heldOverHeadTimer.Value * 2f, 0f, 20f)); } public void ShakeTransform(Transform _transform, float intensity) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!(intensity <= 0f)) { float num = Mathf.Clamp(intensity * 0.00025f * (float)Random.Range(-1, 2), -0.004f, 0.004f); _transform.localPosition = new Vector3(_transform.localPosition.x + num, _transform.localPosition.y + num, _transform.localPosition.z + num); } } } public class WalkieYellie : GrabbableObject { [Header("Audio")] [SerializeField] private AudioSource _idleSource = null; [SerializeField] private AudioSource _audioSource = null; [SerializeField] private AudioClip _activateSound = null; [SerializeField] private AudioClip _deactivateSound = null; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); Plugin.ExtendedLogging($"Letting go of thing: {!buttonDown}"); Plugin.ExtendedLogging($"Is owner: {((NetworkBehaviour)this).IsOwner}"); base.playerHeldBy.activatingItem = buttonDown; if (buttonDown) { if (!((NetworkBehaviour)this).IsOwner) { ((MonoBehaviour)this).StartCoroutine(ResetVoiceChatAudioSource(base.playerHeldBy.currentVoiceChatAudioSource, base.playerHeldBy.currentVoiceChatAudioSource.maxDistance)); base.playerHeldBy.currentVoiceChatAudioSource.maxDistance = 999f; } _idleSource.Play(); _audioSource.PlayOneShot(_activateSound); } else { _idleSource.Stop(); _audioSource.PlayOneShot(_deactivateSound); } if (!((NetworkBehaviour)this).IsOwner) { Plugin.ExtendedLogging($"Setting voice distance of playerHeldBy to: {base.playerHeldBy.currentVoiceChatAudioSource.maxDistance}"); } } public override void Update() { ((GrabbableObject)this).Update(); } private IEnumerator ResetVoiceChatAudioSource(AudioSource audioSource, float maxDistance) { PlayerControllerB previouslyPlayerHeldBy = base.playerHeldBy; AudioLowPassFilter audioLowPassFilter = default(AudioLowPassFilter); bool alreadyHadAudioLowPass = ((Component)previouslyPlayerHeldBy.currentVoiceChatAudioSource).gameObject.TryGetComponent(ref audioLowPassFilter); if (!alreadyHadAudioLowPass) { audioLowPassFilter = ((Component)previouslyPlayerHeldBy.currentVoiceChatAudioSource).gameObject.AddComponent(); } float oldCutoff = audioLowPassFilter.cutoffFrequency; audioLowPassFilter.cutoffFrequency = 1000f; AudioEchoFilter audioEchoFilter = default(AudioEchoFilter); bool alreadyHadAudioEcho = ((Component)previouslyPlayerHeldBy.currentVoiceChatAudioSource).gameObject.TryGetComponent(ref audioEchoFilter); if (!alreadyHadAudioEcho) { audioEchoFilter = ((Component)previouslyPlayerHeldBy.currentVoiceChatAudioSource).gameObject.AddComponent(); } float oldDelay = audioEchoFilter.delay; audioEchoFilter.delay = 120f; float oldDecayRatio = audioEchoFilter.decayRatio; audioEchoFilter.decayRatio = 0.2f; float oldWetMix = audioEchoFilter.wetMix; audioEchoFilter.wetMix = 0.15f; float oldDryMix = audioEchoFilter.dryMix; audioEchoFilter.dryMix = 1f; yield return (object)new WaitUntil((Func)(() => (Object)(object)base.playerHeldBy == (Object)null || !base.playerHeldBy.activatingItem || base.isPocketed)); if (!alreadyHadAudioLowPass) { Object.Destroy((Object)(object)audioLowPassFilter); } else { audioLowPassFilter.cutoffFrequency = oldCutoff; } if (!alreadyHadAudioEcho) { Object.Destroy((Object)(object)audioEchoFilter); } else { audioEchoFilter.delay = oldDelay; audioEchoFilter.decayRatio = oldDecayRatio; audioEchoFilter.wetMix = oldWetMix; audioEchoFilter.dryMix = oldDryMix; } audioSource.maxDistance = maxDistance; if (previouslyPlayerHeldBy.playerSteamId == 76561198399127090L) { SoundManager.Instance.SetPlayerPitch(1f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, previouslyPlayerHeldBy)); } } } public class WoodenSeed : GrabbableObject { public PlantPot.FruitType fruitType = PlantPot.FruitType.None; public override void Start() { ((GrabbableObject)this).Start(); Random random = new Random(StartOfRound.Instance.randomMapSeed); fruitType = (PlantPot.FruitType)random.Next(1, 3); } } public class WrittenDocument : GrabbableObject { [Tooltip("In ascending order from first, to second, etc")] [SerializeField] private GameObject[] _orderedPages = Array.Empty(); [SerializeField] private AudioSource _pageSource = null; [SerializeField] private AudioClip[] _pageFlipSounds = Array.Empty(); private int activePage = 0; public override void EquipItem() { ((GrabbableObject)this).EquipItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (_orderedPages.Length <= 1) { return; } _pageSource.PlayOneShot(_pageFlipSounds[Random.Range(0, _pageFlipSounds.Length)]); if (_orderedPages.Where((GameObject x) => x.activeSelf).Count() == 1) { GameObject[] orderedPages = _orderedPages; foreach (GameObject val in orderedPages) { val.SetActive(true); } activePage = 0; } else { _orderedPages[activePage].SetActive(false); activePage++; } } } public class XRayGoggles : GrabbableObject { } public class Xui : GrabbableObject { [SerializeField] private AudioClip[] _differentPickupAndPocketSounds = Array.Empty(); private AudioSource _audioSource = null; private bool beenUsed = false; private Random xuiRandom = new Random(); public override void Start() { ((GrabbableObject)this).Start(); _audioSource = ((Component)this).GetComponent(); xuiRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); AudioClip pocketSFX = _differentPickupAndPocketSounds[xuiRandom.Next(_differentPickupAndPocketSounds.Length)]; AudioClip grabSFX = _differentPickupAndPocketSounds[xuiRandom.Next(_differentPickupAndPocketSounds.Length)]; base.itemProperties.pocketSFX = pocketSFX; base.itemProperties.grabSFX = grabSFX; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!beenUsed && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving && StartOfRound.Instance.shipHasLanded) { ((MonoBehaviour)base.playerHeldBy).StartCoroutine(base.playerHeldBy.waitToEndOfFrameToDiscard()); base.grabbable = false; base.grabbableToEnemies = false; beenUsed = true; AudioClip pocketSFX = _differentPickupAndPocketSounds[xuiRandom.Next(_differentPickupAndPocketSounds.Length)]; AudioClip grabSFX = _differentPickupAndPocketSounds[xuiRandom.Next(_differentPickupAndPocketSounds.Length)]; base.itemProperties.pocketSFX = pocketSFX; base.itemProperties.grabSFX = grabSFX; _audioSource.PlayOneShot(base.itemProperties.grabSFX); ((MonoBehaviour)this).StartCoroutine(DoAnimation(base.itemProperties.grabSFX.length)); } } public override void FallWithCurve() { //IL_0013: 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_0032: Unknown result type (might be due to invalid IL or missing references) if (beenUsed) { Transform transform = ((Component)this).transform; transform.position += new Vector3(0f, 0.2f * Time.deltaTime, 0f); } else { ((GrabbableObject)this).FallWithCurve(); } } public IEnumerator DoAnimation(float delay) { if (((NetworkBehaviour)this).IsServer) { if (delay > 5f) { delay = 3f; } yield return (object)new WaitForSeconds(delay); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } public override void OnNetworkDespawn() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkDespawn(); if (!((NetworkBehaviour)this).IsServer || StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipIsLeaving) { return; } int num = xuiRandom.Next(100); Plugin.ExtendedLogging($"Random Number: {num}"); if (num <= 35) { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Masked].EnemyType); return; } List list = new List(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { Plugin.ExtendedLogging($"Checking player {((Object)val).name} | dead: {val.isPlayerDead} | controlled: {val.isPlayerControlled} | place of death: {val.placeOfDeath}"); if (val.isPlayerDead && val.placeOfDeath != Vector3.zero) { Plugin.ExtendedLogging("Player " + ((Object)val).name + " is dead."); list.Add(val); } } if (list.Count > 0) { CodeRebirthPlayerManager.RevivePlayer(RandomExtensions.NextItem(xuiRandom, (IList)list), ((Component)this).transform.position); } else if (num <= 70) { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Masked].EnemyType); } } } public class YoyoItem : GrabbableObject { private Random random = new Random(); private static readonly int Use1Hash = Animator.StringToHash("Use1"); private static readonly int Use2Hash = Animator.StringToHash("Use2"); private static readonly int Use3Hash = Animator.StringToHash("Use3"); private static readonly int Use4Hash = Animator.StringToHash("Use4"); private static readonly int IsHeldHash = Animator.StringToHash("IsHeld"); [field: SerializeField] public Animator YoyoAnimator { get; private set; } = null; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); switch (random.Next(1, 5)) { case 1: YoyoAnimator.SetTrigger(Use1Hash); break; case 2: YoyoAnimator.SetTrigger(Use2Hash); break; case 3: YoyoAnimator.SetTrigger(Use3Hash); break; case 4: YoyoAnimator.SetTrigger(Use4Hash); break; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); YoyoAnimator.SetBool(IsHeldHash, false); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); YoyoAnimator.SetBool(IsHeldHash, true); random = new Random(StartOfRound.Instance.randomMapSeed + StartOfRound.Instance.allPlayerScripts.Length + 420 + 69); } } } namespace CodeRebirth.src.Content.Enemies { public class EnemyHandler : ContentHandler { public class SnailCatAssets : AssetBundleLoader { public SnailCatAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CarnivorousPlantAssets : AssetBundleLoader { public CarnivorousPlantAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class RedwoodTitanAssets : AssetBundleLoader { public RedwoodTitanAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class DuckSongAssets : AssetBundleLoader { [LoadFromBundle("DuckHolder.prefab")] public GameObject DuckUIPrefab { get; private set; } = null; public DuckSongAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class ManorLordAssets : AssetBundleLoader { [LoadFromBundle("PuppeteerPuppet.prefab")] public GameObject PuppeteerPuppetPrefab { get; private set; } = null; public ManorLordAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MistressAssets : AssetBundleLoader { [LoadFromBundle("GuillotinePrefab.prefab")] public GameObject GuillotinePrefab { get; private set; } = null; public MistressAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class JanitorAssets : AssetBundleLoader { public JanitorAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class TransporterAssets : AssetBundleLoader { public TransporterAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MonarchAssets : AssetBundleLoader { public MonarchAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class PandoraAssets : AssetBundleLoader { public PandoraAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class NancyAssets : AssetBundleLoader { public NancyAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class DriftwoodMenaceAssets : AssetBundleLoader { public DriftwoodMenaceAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CuteaAssets : AssetBundleLoader { public CuteaAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class PeaceKeeperAssets : AssetBundleLoader { public PeaceKeeperAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class RabbitMagicianAssets : AssetBundleLoader { public RabbitMagicianAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class CactusBudlingAssets : AssetBundleLoader { public CactusBudlingAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public CactusBudlingAssets? CactusBudling = null; public RabbitMagicianAssets? RabbitMagician = null; public PeaceKeeperAssets? PeaceKeeper = null; public CuteaAssets? Cutea = null; public NancyAssets? Nancy = null; public DriftwoodMenaceAssets? DriftwoodMenace = null; public PandoraAssets? Pandora = null; public MonarchAssets? Monarch = null; public MistressAssets? Mistress = null; public TransporterAssets? Transporter = null; public JanitorAssets? Janitor = null; public ManorLordAssets? ManorLord = null; public DuckSongAssets? DuckSong = null; public SnailCatAssets? SnailCat = null; public CarnivorousPlantAssets? CarnivorousPlant = null; public RedwoodTitanAssets? RedwoodTitan = null; public EnemyHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent("cactusbudlingassets", ref CactusBudling, false); ((ContentHandler)this).RegisterContent("rabbitmagicianassets", ref RabbitMagician, false); ((ContentHandler)this).RegisterContent("peacekeeperassets", ref PeaceKeeper, false); ((ContentHandler)this).RegisterContent("manorlordassets", ref ManorLord, false); ((ContentHandler)this).RegisterContent("janitorassets", ref Janitor, false); ((ContentHandler)this).RegisterContent("driftwoodmenaceassets", ref DriftwoodMenace, false); ((ContentHandler)this).RegisterContent("nancyassets", ref Nancy, false); ((ContentHandler)this).RegisterContent("monarchassets", ref Monarch, false); ((ContentHandler)this).RegisterContent("mistressassets", ref Mistress, false); ((ContentHandler)this).RegisterContent("redwoodtitanassets", ref RedwoodTitan, false); ((ContentHandler)this).RegisterContent("snailcatassets", ref SnailCat, false); ((ContentHandler)this).RegisterContent("ducksongassets", ref DuckSong, false); ((ContentHandler)this).RegisterContent("transporterassets", ref Transporter, false); } } public class BoxChute : MonoBehaviour { private Vector3 landingPosition = Vector3.zero; private static readonly int LandAnimation = Animator.StringToHash("land"); [field: SerializeField] public Transform Spawner { get; private set; } [field: SerializeField] public Animator Animator { get; private set; } [field: SerializeField] public float FallingSpeed { get; private set; } = 10f; [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioClip AmbientDroppingSound { get; private set; } [field: SerializeField] public AudioClip LandingSound { get; private set; } [field: SerializeField] public AudioClip OpenSound { get; private set; } [field: SerializeField] public UnityEvent OnLanding { get; private set; } = new UnityEvent(); public void SetupBoxChute() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0046: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); landingPosition = (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 500f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val)).point : ((Component)this).transform.position); NavMeshHit val2 = default(NavMeshHit); landingPosition = (NavMesh.SamplePosition(landingPosition, ref val2, 20f, -1) ? ((NavMeshHit)(ref val2)).position : landingPosition); Vector3 val3 = ((Component)this).transform.forward; for (int i = 0; i < 4; i++) { if (!Physics.Raycast(landingPosition + Vector3.up * 0.33f, val3, 3f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Plugin.ExtendedLogging($"Found valid direction for box chute to face on landing: {val3} from initial direction {((Component)this).transform.forward}"); ((Component)this).transform.forward = val3; break; } val3 = Quaternion.Euler(0f, 90f, 0f) * val3; } } public void Start() { AudioSource.clip = AmbientDroppingSound; AudioSource.Play(); } public void Update() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!(landingPosition == Vector3.zero)) { if (Vector3.Distance(((Component)this).transform.position, landingPosition) <= 0.5f) { ((Component)this).transform.position = landingPosition; landingPosition = Vector3.zero; AudioSource.Stop(); AudioSource.PlayOneShot(LandingSound); Animator.SetTrigger(LandAnimation); } ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, landingPosition, Time.deltaTime * FallingSpeed); } } public void OnLandingAnimEvent() { OnLanding.Invoke(); } public void PlayOpenSound() { AudioSource.PlayOneShot(OpenSound); } public void SpawnEnemy() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { RoundManager.Instance.SpawnEnemyGameObject(Spawner.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.DebtCollector].EnemyType); } } } public class CactusAICollisionDetect : MonoBehaviour { [SerializeField] private EnemyAI _mainScript = null; public void OnTriggerEnter(Collider other) { EnemyAICollisionDetect val = default(EnemyAICollisionDetect); if ((Object)(object)((Component)other).GetComponent() != (Object)null) { _mainScript.OnCollideWithPlayer(other); } else if (((Component)other).TryGetComponent(ref val) && (Object)(object)val.mainScript != (Object)(object)_mainScript) { _mainScript.OnCollideWithEnemy(other, val.mainScript); } } } public class CactusBudling : CodeRebirthEnemyAI, IVisibleThreat { public enum CactusBudlingState { Spawning, SearchingForRoot, Rooted, Rolling, Dead, Grabbed } [Header("Audio")] [SerializeField] private AudioClip _burnSound = null; [SerializeField] private AudioSource _rollingSource = null; [Header("Animations")] [SerializeField] private AnimationClip _rootingEndAnimation = null; [SerializeField] private AnimationClip _rollingStartAnimation = null; [Header("Mechanics")] [SerializeField] private ParticleSystem[] _burnParticles = Array.Empty(); [SerializeField] private float _rollingDuration = 20f; [SerializeField] private float _rootingDuration = 60f; [SerializeField] private int _attackAmount = 5; private Vector3 _targetRootPosition = Vector3.zero; private Vector3 _targetRollingPosition = Vector3.zero; private float _rotationProgressTimer = 0f; private float _rollingTimer = 0f; private float _rootingTimer = 0f; private float _attackInterval = 2f; private List _budlingCacti = new List(); private Coroutine? _nextStateRoutine = null; private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); internal static readonly int RollingAnimation = Animator.StringToHash("isRolling"); internal static readonly int RootingAnimation = Animator.StringToHash("isRooting"); private static readonly int DeadAnimation = Animator.StringToHash("isDead"); internal static readonly int GrabbedAnimation = Animator.StringToHash("Grabbed"); private Coroutine? _burnGiantRoutine = null; ThreatType IVisibleThreat.type => (ThreatType)4; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((EnemyAI)this).eye; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void Start() { base.Start(); DuskContentDefinition[] content = ((AssetBundleLoader)(object)ContentHandler.Instance.CactusBudling).Content; foreach (DuskContentDefinition val in content) { DuskMapObjectDefinition val2 = (DuskMapObjectDefinition)(object)((val is DuskMapObjectDefinition) ? val : null); if (val2 != null && val2.MapObjectName.Contains("Cactus", StringComparison.OrdinalIgnoreCase)) { _budlingCacti.Add(val2.GameObject); } } if (((NetworkBehaviour)this).IsServer) { GetNextRootPosition(); } } public override void Update() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).currentBehaviourStateIndex != 4 && ((EnemyAI)this).currentBehaviourStateIndex != 5) { _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(0, _idleAudioClips.audioClips.Length)]); } if (((EnemyAI)this).currentBehaviourStateIndex == 3 && Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 15f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } } public void LateUpdate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) RaycastHit val = default(RaycastHit); if (((NetworkBehaviour)this).IsServer && (((EnemyAI)this).currentBehaviourStateIndex == 2 || !(_rotationProgressTimer <= 0f)) && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 1f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; Quaternion val3 = Quaternion.LookRotation(normalized, normal); if (((EnemyAI)this).currentBehaviourStateIndex == 2) { _rotationProgressTimer = Mathf.Clamp01(_rotationProgressTimer + Time.deltaTime * 0.5f); } else { _rotationProgressTimer = Mathf.Clamp01(_rotationProgressTimer - Time.deltaTime * 0.5f); } ((Component)this).transform.rotation = Quaternion.Slerp(Quaternion.identity, val3, _rotationProgressTimer); } } public override void DoAIInterval() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!StartOfRound.Instance.allPlayersDead && !((EnemyAI)this).isEnemyDead) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 3f); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoSpawning(); break; case 1: DoSearchingForRoot(); break; case 2: DoRooted(); break; case 3: DoRolling(); break; case 4: DoDead(); break; case 5: DoGrabbed(); break; } } } private void DoSpawning() { } private void DoSearchingForRoot() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, _targetRootPosition) < 2f + ((EnemyAI)this).agent.stoppingDistance) { if (_nextStateRoutine == null) { _rootingTimer = _rootingDuration; smartAgentNavigator.StopAgent(); ((EnemyAI)this).creatureAnimator.SetBool(RootingAnimation, true); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } else { smartAgentNavigator.DoPathingToDestination(_targetRootPosition); } } private void DoRooted() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) _rootingTimer -= ((EnemyAI)this).AIIntervalTime; if (_rootingTimer <= 0f) { if (_nextStateRoutine == null) { ((EnemyAI)this).creatureAnimator.SetBool(RootingAnimation, false); GetNextRootPosition(); } return; } _attackInterval -= ((EnemyAI)this).AIIntervalTime; if (!(_attackInterval <= 0f)) { return; } _attackInterval = _rootingDuration / (float)_attackAmount; List list = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => !x.isPlayerDead && x.isPlayerControlled).ToList(); PlayerControllerB val = list[Random.Range(0, list.Count)]; Vector3 val2 = Vector3.zero; for (int num = 0; num < 5; num++) { val2 = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)val).transform.position, 5f, default(NavMeshHit)); if (Vector3.Distance(val2, ((Component)val).transform.position) > 1f) { break; } } Vector3 zero = Vector3.zero; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 2f, Vector3.down, ref val3, 5f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point; zero = ((RaycastHit)(ref val3)).normal; int index = Random.Range(0, _budlingCacti.Count); int angle = Random.Range(0, 360); SpawnCactiServerRpc(val2, zero, angle, index, val.isInsideFactory); } else { _attackInterval = 0f; } } private void DoRolling() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) _rollingTimer -= ((EnemyAI)this).AIIntervalTime; if (_rollingTimer <= 0f) { if (_nextStateRoutine == null) { ((EnemyAI)this).creatureAnimator.SetBool(RollingAnimation, false); GetNextRootPosition(); } return; } if (Vector3.Distance(((Component)this).transform.position, _targetRollingPosition) < 3f + ((EnemyAI)this).agent.stoppingDistance) { for (int i = 0; i < 10; i++) { _targetRollingPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 75f, default(NavMeshHit)); if (smartAgentNavigator.CanPathToPoint(((Component)this).transform.position, _targetRollingPosition) > 0f) { break; } } } smartAgentNavigator.DoPathingToDestination(_targetRollingPosition); } private void DoDead() { } private void DoGrabbed() { } internal void GetNextRootPosition() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) List<(Vector3, Vector3)> list = new List<(Vector3, Vector3)>(); for (int i = 0; i < 10; i++) { Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 40f, default(NavMeshHit)); list.Add((randomNavMeshPositionInRadius, randomNavMeshPositionInRadius)); } smartAgentNavigator.CheckPaths((IEnumerable>)list, (Action>>)FoundNextRootPosition); } private void FoundNextRootPosition(List> args) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) SyncRootPositionServerRpc(args[Random.Range(0, args.Count)].Generic); } [ServerRpc(RequireOwnership = false)] private void SyncRootPositionServerRpc(Vector3 rootPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SyncRootPositionClientRpc(rootPosition); } [ClientRpc] private void SyncRootPositionClientRpc(Vector3 rootPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) _targetRootPosition = rootPosition; _nextStateRoutine = ((MonoBehaviour)this).StartCoroutine(DelayToNextState(_rollingStartAnimation.length, 3f, CactusBudlingState.SearchingForRoot)); } private IEnumerator DelayToNextState(float delay, float agentSpeed, CactusBudlingState nextState) { Plugin.ExtendedLogging($"Switching to next state: {nextState}"); ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient((int)nextState); yield return (object)new WaitForSeconds(delay); ((EnemyAI)this).agent.speed = agentSpeed; _nextStateRoutine = null; } private IEnumerator RollingSoundStuff(float delayTimer) { yield return (object)new WaitForSeconds(delayTimer); _rollingSource.Play(); while (_rollingTimer > 0f) { yield return null; } _rollingSource.Stop(); } [ServerRpc(RequireOwnership = false)] private void SpawnCactiServerRpc(Vector3 position, Vector3 normal, int angle, int index, bool insideSpawn) { //IL_0010: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) GameObject val = _budlingCacti[index]; GameObject val2 = Object.Instantiate(val, position, Quaternion.Euler(0f, (float)angle, 0f), RoundManager.Instance.mapPropsContainer.transform); NetworkObject component = val2.GetComponent(); component.Spawn(true); SpawnCactiClientRpc(NetworkObjectReference.op_Implicit(component), normal, insideSpawn); } [ClientRpc] private void SpawnCactiClientRpc(NetworkObjectReference netObjRef, Vector3 normal, bool insideSpawn) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref netObjRef)).TryGet(ref val, (NetworkManager)null)) { return; } ((Component)val).transform.up = normal; if (insideSpawn) { RiseFromGroundOnSpawn component = ((Component)val).gameObject.GetComponent(); RiseFromDifferentGroundTypes[] riseFromDifferentGroundTypes = component._riseFromDifferentGroundTypes; foreach (RiseFromDifferentGroundTypes riseFromDifferentGroundTypes2 in riseFromDifferentGroundTypes) { riseFromDifferentGroundTypes2.raiseSpeed /= 4f; } } DestructibleObject component2 = ((Component)val).gameObject.GetComponent(); component2._destroyCactiRoutine = ((MonoBehaviour)component2).StartCoroutine(component2.DestroyObjectWithDelay(RandomExtensions.NextFloat(enemyRandom, 30f, 45f), bringDown: true)); } [ServerRpc(RequireOwnership = false)] private void BurnGiantServerRpc() { BurnGiantClientRpc(); } [ClientRpc] private void BurnGiantClientRpc() { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } private IEnumerator BurnGiant() { ParticleSystem[] burnParticles = _burnParticles; foreach (ParticleSystem particleSystem in burnParticles) { particleSystem.Play(); } ((EnemyAI)this).creatureSFX.PlayOneShot(_burnSound); yield return (object)new WaitForSeconds(5f); _burnGiantRoutine = null; } public override void HitFromExplosion(float distance) { ((EnemyAI)this).HitFromExplosion(distance); if (_burnGiantRoutine == null && !((EnemyAI)this).isEnemyDead) { BurnGiantServerRpc(); } } public override void OnCollideWithPlayer(Collider other) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (((EnemyAI)this).currentBehaviourStateIndex == 3) { Plugin.ExtendedLogging("Collided with player: " + ((Object)((Component)other).gameObject).name); Vector3 forward = ((Component)this).transform.forward; PlayerControllerB component = ((Component)other).GetComponent(); component.externalForceAutoFade = forward * 75f; component.externalForces = forward * 75f; component.DamagePlayer(50, true, true, (CauseOfDeath)8, 0, false, forward * 75f); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead) { return; } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (hitID == 745737 && _burnGiantRoutine == null) { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } if (((EnemyAI)this).enemyHP <= 0) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } else if (((EnemyAI)this).currentBehaviourStateIndex == 3) { _rollingTimer += 5f; } else { if (((EnemyAI)this).currentBehaviourStateIndex == 3) { return; } if (_nextStateRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_nextStateRoutine); } if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(RootingAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(RollingAnimation, true); } float num = _rollingStartAnimation.length; if (((EnemyAI)this).currentBehaviourStateIndex == 2) { num += _rootingEndAnimation.length; } ((MonoBehaviour)this).StartCoroutine(RollingSoundStuff(num)); for (int i = 0; i < 10; i++) { _targetRollingPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 75f, default(NavMeshHit)); if (smartAgentNavigator.CanPathToPoint(((Component)this).transform.position, _targetRollingPosition) > 15f) { break; } } _rollingTimer = _rollingDuration + num; _nextStateRoutine = ((MonoBehaviour)this).StartCoroutine(DelayToNextState(num, 10f, CactusBudlingState.Rolling)); } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); ((EnemyAI)this).agent.speed = 0f; _rollingTimer = 0f; if (_nextStateRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_nextStateRoutine); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(DeadAnimation, true); } } } public class CarnivorousPlant : CodeRebirthEnemyAI { public enum State { Idle, AttackTargetPlayer } public Transform[] eyes; public AnimationClip attackAnimation = null; public Transform mouth = null; public AudioClip BiteSound = null; public Gradient CarnivorousPlantColourGradient = new Gradient(); private bool carryingPlayerBody; private DeadBodyInfo? bodyBeingCarried; private bool attacking = false; private static readonly int startAttack = Animator.StringToHash("startAttack"); private static readonly int takeDamage = Animator.StringToHash("takeDamage"); private static readonly int isDead = Animator.StringToHash("isDead"); public override void Start() { base.Start(); ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); } public override void Update() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (!((EnemyAI)this).isEnemyDead) { if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && ((EnemyAI)this).currentBehaviourStateIndex == 1) { Vector3 val = ((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.LookRotation(normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, Time.deltaTime * 10f); } else { float num = 2f; ((Component)this).transform.Rotate(Vector3.up, num * Time.deltaTime); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead) { switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoIdle(); break; case 1: DoAttackTargetPlayer(); break; } } } private void DoIdle() { //IL_003e: 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) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isInHangarShipRoom && !val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 20f) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } } } private void DoAttackTargetPlayer() { if (!attacking) { PlayBiteSoundClientRpc(); attacking = true; creatureNetworkAnimator.SetTrigger(startAttack, true); ((MonoBehaviour)this).Invoke("EndAttack", attackAnimation.length); } } [ClientRpc] private void PlayBiteSoundClientRpc() { ((EnemyAI)this).creatureVoice.PlayOneShot(BiteSound); } private void EndAttack() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) attacking = false; if (((EnemyAI)this).targetPlayer.isPlayerDead || Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) > 5f) { ClearPlayerTargetServerRpc(); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); } DropPlayerBodyServerRpc(); } public override void OnCollideWithPlayer(Collider other) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (!((Object)(object)val == (Object)null)) { val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)8, 0, default(Vector3), false); if (val.isPlayerDead && !carryingPlayerBody) { CarryingDeadPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val)); } } } [ServerRpc(RequireOwnership = false)] private void DropPlayerBodyServerRpc() { DropPlayerBodyClientRpc(); } [ClientRpc] public void DropPlayerBodyClientRpc() { DropPlayerBody(); } private void DropPlayerBody() { if (carryingPlayerBody && !((Object)(object)bodyBeingCarried == (Object)null)) { carryingPlayerBody = false; bodyBeingCarried.matchPositionExactly = false; bodyBeingCarried.attachedTo = null; bodyBeingCarried = null; } } [ServerRpc(RequireOwnership = false)] private void CarryingDeadPlayerServerRpc(int playerIndex) { CarryingDeadPlayerClientRpc(playerIndex); } [ClientRpc] public void CarryingDeadPlayerClientRpc(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; carryingPlayerBody = true; bodyBeingCarried = val.deadBody; bodyBeingCarried.attachedTo = mouth; bodyBeingCarried.attachedLimb = val.deadBody.bodyParts[0]; bodyBeingCarried.matchPositionExactly = true; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).enemyType.hitBodySFX); if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(takeDamage, true); } if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).creatureAnimator.SetBool(isDead, true); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } [RequireComponent(typeof(SmartAgentNavigator))] [RequireComponent(typeof(Animator))] [RequireComponent(typeof(NetworkAnimator))] [RequireComponent(typeof(NetworkTransform))] [RequireComponent(typeof(Collider))] public abstract class CodeRebirthEnemyAI : EnemyAI { internal EnemyAI? targetEnemy = null; internal PlayerControllerB? previousTargetPlayer = null; [Header("Required Components")] [SerializeField] internal NetworkAnimator creatureNetworkAnimator = null; [SerializeField] internal SmartAgentNavigator smartAgentNavigator = null; [Header("Inherited Fields")] [SerializeField] internal AudioClipsWithTime _idleAudioClips = null; [SerializeField] private AudioClip[] _hitBodySounds = Array.Empty(); [SerializeField] internal AudioClip spawnSound = null; internal float _idleTimer = 1f; internal Random enemyRandom = new Random(); internal Random enemyHostRandom = new Random(); public override void Start() { ((EnemyAI)this).Start(); if (((NetworkBehaviour)this).IsServer) { enemyHostRandom = new Random(StartOfRound.Instance.randomMapSeed + 69); } enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + 73); if ((Object)(object)spawnSound != (Object)null) { base.creatureVoice.PlayOneShot(spawnSound); } _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); smartAgentNavigator.OnUseEntranceTeleport.AddListener((UnityAction)((EnemyAI)this).SetEnemyOutside); smartAgentNavigator.SetAllValues(base.isOutside); Plugin.ExtendedLogging(base.enemyType.enemyName + " Spawned."); if (Plugin.ModConfig.ConfigExtendedLogging.Value) { GrabEnemyRarity(base.enemyType.enemyName); } } public override void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) base.serverPosition = ((Component)this).transform.position; ((EnemyAI)this).Update(); } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!base.isEnemyDead && playHitSFX && _hitBodySounds.Length != 0) { base.creatureSFX.PlayOneShot(_hitBodySounds[enemyRandom.Next(_hitBodySounds.Length)]); } } public override void KillEnemy(bool destroy = false) { ((EnemyAI)this).KillEnemy(destroy); if (base.isEnemyDead) { smartAgentNavigator.DisposeOfTasks(); } } public void GrabEnemyRarity(string enemyName) { SpawnableEnemyWithRarity val = ((IEnumerable)RoundManager.Instance.currentLevel.OutsideEnemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals(enemyName))) ?? ((IEnumerable)RoundManager.Instance.currentLevel.DaytimeEnemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals(enemyName))) ?? ((IEnumerable)RoundManager.Instance.currentLevel.Enemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals(enemyName))); if (val != null) { Plugin.ExtendedLogging(enemyName + " has Rarity: " + val.rarity); } else { Plugin.Logger.LogWarning((object)"Enemy not found."); } } public bool FindClosestPlayerInRange(float range, bool targetAlreadyTargettedPerson = true) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; float num = float.MaxValue; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)null) && val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom && EnemyHasLineOfSightToPosition(((Component)val2).transform.position, 60f, range) && (targetAlreadyTargettedPerson || !CheckIfPersonAlreadyTargetted(val2))) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (!(num2 >= num)) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { return false; } SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); return true; } public bool CheckIfPersonAlreadyTargetted(PlayerControllerB playerToCheck) { foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy == (Object)(object)this || !(spawnedEnemy is CodeRebirthEnemyAI codeRebirthEnemyAI) || !((Object)(object)((EnemyAI)codeRebirthEnemyAI).targetPlayer == (Object)(object)playerToCheck)) { continue; } return true; } return false; } public bool EnemyHasLineOfSightToPosition(Vector3 pos, float width = 60f, float range = 20f, float proximityAwareness = 5f) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Transform val = ((!((Object)(object)base.eye == (Object)null)) ? base.eye : ((Component)this).transform); float num = Vector3.Distance(val.position, pos); if (num < proximityAwareness) { return true; } if (num >= range || Physics.Linecast(val.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } Vector3 val2 = pos - val.position; return Vector3.Angle(val.forward, val2) < width; } public static bool PlayerLookingAtPosition(PlayerControllerB player, Vector3 position, float dotProductThreshold) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position - ((Component)player).gameObject.transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (Vector3.Dot(((Component)player.gameplayCamera).transform.forward, normalized) < dotProductThreshold) { return false; } RaycastHit val2 = default(RaycastHit); if (Physics.Linecast(((Component)player.gameplayCamera).transform.position, position, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } return true; } public bool EnemySeesPlayer(PlayerControllerB player, float dotThreshold) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) Transform val = ((!((Object)(object)base.eye == (Object)null)) ? ((Component)base.eye).transform : ((Component)this).transform); Vector3 val2 = ((Component)player).transform.position - val.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (Vector3.Dot(((Component)this).transform.forward, normalized) < dotThreshold) { return false; } float num = Vector3.Distance(val.position, ((Component)player).transform.position); if (Physics.Raycast(val.position, normalized, num, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return false; } return true; } public bool AnimationIsFinished(string AnimName) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(AnimName)) { Plugin.ExtendedLogging(((NetworkBehaviour)this).__getTypeName() + ": Checking for animation " + AnimName + ", but current animation is " + ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name); return true; } currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f; } [ServerRpc(RequireOwnership = false)] public void ClearPlayerTargetServerRpc() { ClearPlayerTargetClientRpc(); } [ClientRpc] public void ClearPlayerTargetClientRpc() { ClearPlayerTarget(); } public void ClearPlayerTarget() { base.targetPlayer = null; PlayerSetAsTarget(null); } [ServerRpc(RequireOwnership = false)] public void SetPlayerTargetServerRpc(PlayerControllerReference playerControllerReference) { SetPlayerTargetClientRpc(playerControllerReference); } [ClientRpc] public void SetPlayerTargetClientRpc(PlayerControllerReference playerControllerReference) { SetPlayerTarget(playerControllerReference); } public void SetPlayerTarget(PlayerControllerReference playerControllerReference) { PlayerControllerB targetPlayer = PlayerControllerReference.op_Implicit(playerControllerReference); previousTargetPlayer = base.targetPlayer; base.targetPlayer = targetPlayer; PlayerSetAsTarget(base.targetPlayer); Plugin.ExtendedLogging($"{this} setting target to: {base.targetPlayer.playerUsername}"); } [ServerRpc(RequireOwnership = false)] public void ClearEnemyTargetServerRpc() { ClearEnemyTargetClientRpc(); } [ClientRpc] public void ClearEnemyTargetClientRpc() { ClearEnemyTarget(); } public void ClearEnemyTarget() { targetEnemy = null; EnemySetAsTarget(null); } [ServerRpc(RequireOwnership = false)] public void SetEnemyTargetServerRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetEnemyTargetClientRpc(networkBehaviourReference); } [ClientRpc] public void SetEnemyTargetClientRpc(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetEnemyTarget(networkBehaviourReference); } public void SetEnemyTarget(NetworkBehaviourReference networkBehaviourReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown targetEnemy = (EnemyAI)NetworkBehaviourReference.op_Implicit(networkBehaviourReference); Plugin.ExtendedLogging($"{this} setting target to: {targetEnemy.enemyType.enemyName}"); EnemySetAsTarget(targetEnemy); } public virtual void EnemySetAsTarget(EnemyAI? enemy) { } public virtual void PlayerSetAsTarget(PlayerControllerB? player) { } } public class CutieFlyAI : CodeRebirthEnemyAI { public GameObject armature = null; private static readonly int IsDeadAnimation = Animator.StringToHash("doDeath"); private static readonly int IsLeavingAnimation = Animator.StringToHash("leaving"); private float oldSpeed = 0f; private float timeLeft = 30f; public override void Start() { base.Start(); timeLeft = Random.Range(30f, 50f); oldSpeed = ((EnemyAI)this).agent.speed; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } } public override void Update() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).stunNormalizedTimer > 0f) { ((EnemyAI)this).HitEnemy(1, (PlayerControllerB)null, true, 999123); } if (((NetworkBehaviour)this).IsServer && ((EnemyAI)this).daytimeEnemyLeaving) { timeLeft -= Time.deltaTime; Transform transform = armature.gameObject.transform; transform.position += Vector3.up * Time.deltaTime * 2f; if (timeLeft <= 0f) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } public override void DaytimeEnemyLeave() { ((EnemyAI)this).DaytimeEnemyLeave(); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(IsLeavingAnimation, true); } } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); if (!((EnemyAI)this).isEnemyDead) { ((EnemyAI)this).HitEnemy(1, ((Component)other).GetComponent(), true, -1); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!((EnemyAI)this).isEnemyDead && (!((Object)(object)playerWhoHit == (Object)null) || hitID == 999123)) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((NetworkBehaviour)this).IsOwner && ((EnemyAI)this).enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); smartAgentNavigator.StopSearchRoutine(); if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(IsDeadAnimation, true); } } public void LandCutieflyAnimEvent() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).agent.velocity = Vector3.zero; ((EnemyAI)this).agent.speed = 0f; } public void FlyCutieflyAnimEvent() { ((EnemyAI)this).agent.speed = oldSpeed; } public void SpawnMonarchAnimEvent() { ((MonoBehaviour)this).StartCoroutine(HandleSpawningMonarch()); } public IEnumerator HandleSpawningMonarch() { if (ContentHandler.Instance.Monarch == null) { yield break; } yield return (object)new WaitForSeconds(3f); if (((NetworkBehaviour)this).IsServer) { if (Monarch.Monarchs.Count > 0 && Random.Range(0, 100) < 50) { yield break; } EnemyType enemyType = ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.Monarch].EnemyType; RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, enemyType); } HUDManager.Instance.DisplayTip("WARNING", "SEISMIC ACTIVITY DETECTED", true, false, "LC_Tip1"); HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } } public class DebtCollector : CodeRebirthEnemyAI { public enum DebtCollectorState { Spawning, Idle, Teleporting, ChasingTargetPlayer, AttackingPlayer, Death } private List _treadMaterials = new List(); private Vector3 _lastPosition = Vector3.zero; private float _teleportIdleTimer = 3f; private float _checkForPlayersTimer = 1.5f; private float _lostPlayerTimer = 2f; private float _grabAttackTimer = 10f; private float _pryingDoorOpenTimer = 0f; private bool _playerIsGrabbed = false; private Vector3 _overrideNextTeleportPosition = Vector3.zero; private bool _breakingDoorOpen = false; private HangarShipDoor _shipDoor = null; private float _hitCooldown = 0.2f; private static Collider[] _cachedColliders = (Collider[])(object)new Collider[24]; private static readonly int RunSpeedAnimationHash = Animator.StringToHash("RunSpeed"); private static readonly int SliceAnimationHash = Animator.StringToHash("Slice"); private static readonly int GrabAnimationHash = Animator.StringToHash("Grab"); private static readonly int SuccessAnimationHash = Animator.StringToHash("Success"); private static readonly int PryOpenAnimationHash = Animator.StringToHash("PryOpen"); private static readonly int TeleportAnimationHash = Animator.StringToHash("Teleport"); private static readonly int IsDeadAnimationHash = Animator.StringToHash("IsDead"); private static readonly int PryOpenDoorAnimationHash = Animator.StringToHash("pryOpenDoor"); private static readonly int PryingOpenDoorAnimationHash = Animator.StringToHash("PryingOpenDoor"); private static readonly int ClosedDoorAnimationHash = Animator.StringToHash("Closed"); private List _playersHit = new List(); private List _enemiesHit = new List(); private List _hittablesHit = new List(); [field: SerializeField] public AnimationClip PryOpenAnimation { get; private set; } [field: SerializeField] public float WanderingSpeed { get; private set; } = 3.5f; [field: SerializeField] public float ChasingSpeed { get; private set; } = 5f; [field: SerializeField] public float AttackingSpeed { get; private set; } = 2f; [field: SerializeField] public Transform SliceArmStart { get; private set; } [field: SerializeField] public Transform SliceArmEnd { get; private set; } [field: SerializeField] public Transform GrabHand { get; private set; } [field: SerializeField] public BoundedRange GrabAttackTimer { get; private set; } = new BoundedRange(10f, 15f); [field: SerializeField] [field: Range(0f, 100f)] public float ChanceToGoForGrabAttack { get; private set; } = 50f; [field: SerializeField] public BoundedRange TeleportIdleTimerRange { get; private set; } = new BoundedRange(5f, 10f); [field: SerializeField] public ParticleSystem HookScrappingParticles { get; private set; } [field: Header("Audio")] [field: SerializeField] public NetworkAudioSource NetworkAudioSource { get; private set; } [field: SerializeField] public AudioSource AudioSource { get; private set; } [field: SerializeField] public AudioSource TreadSource { get; private set; } [field: SerializeField] public AudioSource HookScrapingSource { get; private set; } [field: SerializeField] public AudioClip TeleportSound { get; private set; } [field: SerializeField] public AudioClip PryOpenDoorSound { get; private set; } [field: SerializeField] public AudioClip GrabSound { get; private set; } [field: SerializeField] public AudioClip GrabSucceedSound { get; private set; } [field: SerializeField] public AudioClip BitchSliceSound { get; private set; } [field: SerializeField] public AudioClip BitchSliceHit { get; private set; } public override void Start() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) base.Start(); ((EnemyAI)this).agent.speed = WanderingSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); _lastPosition = ((Component)this).transform.position; _treadMaterials.Add(((Renderer)((EnemyAI)this).skinnedMeshRenderers[1]).materials[2]); _treadMaterials.Add(((Renderer)((EnemyAI)this).skinnedMeshRenderers[1]).materials[3]); _shipDoor = Object.FindFirstObjectByType(); if (((NetworkBehaviour)this).IsServer) { FindRandomPlayerViaAsyncPathfinding(); } } public override void Update() { //IL_0129: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } _hitCooldown -= Time.deltaTime; HandleIdleSoundTimer(); if (_breakingDoorOpen) { _pryingDoorOpenTimer += Time.deltaTime / 2.4f; _shipDoor.shipDoorsAnimator.SetFloat(PryOpenDoorAnimationHash, _pryingDoorOpenTimer); if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.DoPathingToDestination(((Component)_shipDoor.outsideDoorPoint).transform.position); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, ((Component)_shipDoor.outsideDoorPoint).transform.position, ((EnemyAI)this).agent.speed * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, ((Component)_shipDoor.outsideDoorPoint).transform.rotation, ((EnemyAI)this).agent.speed * Time.deltaTime); } } Vector3 val = _lastPosition - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; _treadMaterials[0].SetVector(PeaceKeeper.ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, 0f - magnitude, 0f))); _treadMaterials[1].SetVector(PeaceKeeper.ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, magnitude, 0f))); if (magnitude > 0f) { TreadSource.volume = 1f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)HookScrapingSource).transform.position, Vector3.down, ref val2, 0.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { if (!HookScrappingParticles.isPlaying) { HookScrappingParticles.Play(); } HookScrapingSource.volume = 1f; } else { if (HookScrappingParticles.isPlaying) { HookScrappingParticles.Stop(); } HookScrapingSource.volume = 0f; } } else { TreadSource.volume = 0f; if (HookScrappingParticles.isPlaying) { HookScrappingParticles.Stop(); } HookScrapingSource.volume = 0f; } _lastPosition = ((Component)this).transform.position; if (!_playerIsGrabbed && (Object)(object)((EnemyAI)this).targetPlayer != (Object)null && ((EnemyAI)this).currentBehaviourStateIndex == 4) { RotateToPlayer(((EnemyAI)this).targetPlayer); } } public void LateUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) && _playerIsGrabbed) { ((Component)((EnemyAI)this).targetPlayer).transform.position = GrabHand.position + Vector3.down * 2.43f; Quaternion val = GrabHand.rotation * Quaternion.Euler(0f, -180f, 0f); float y = ((Quaternion)(ref val)).eulerAngles.y; float y2 = ((Component)((EnemyAI)this).targetPlayer).transform.eulerAngles.y; float num = Mathf.Clamp(Mathf.DeltaAngle(y, y2), -90f, 90f); ((Component)((EnemyAI)this).targetPlayer).transform.rotation = Quaternion.Euler(0f, y + num, 0f); } } public override void DoAIInterval() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!StartOfRound.Instance.allPlayersDead && !((EnemyAI)this).isEnemyDead && !smartAgentNavigator.CheckPathsOngoing()) { Vector3 velocity = ((EnemyAI)this).agent.velocity; float num = ((Vector3)(ref velocity)).magnitude / 3f; ((EnemyAI)this).creatureAnimator.SetFloat(RunSpeedAnimationHash, num); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoSpawning(); break; case 1: DoIdle(); break; case 2: DoTeleporting(); break; case 3: DoChasingTargetPlayer(); break; case 4: DoAttackingPlayer(); break; case 5: DoDeath(); break; } } } private void DoSpawning() { } private void DoIdle() { _checkForPlayersTimer -= ((EnemyAI)this).AIIntervalTime; if (_checkForPlayersTimer <= 0f) { _checkForPlayersTimer = TeleportIdleTimerRange.GetRandomInRange(new Random(Random.Range(0, 999999))) / 4f; FindRandomPlayerViaAsyncPathfinding(); return; } _teleportIdleTimer -= ((EnemyAI)this).AIIntervalTime; if (_teleportIdleTimer <= 0f) { smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); NetworkAudioSource.PlayOneShot(TeleportSound); creatureNetworkAnimator.SetTrigger(TeleportAnimationHash, true); _teleportIdleTimer = TeleportIdleTimerRange.GetRandomInRange(new Random(Random.Range(0, 999999))); } } private void DoTeleporting() { } private void DoChasingTargetPlayer() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead) { smartAgentNavigator.StartSearchRoutine(20f); ClearPlayerTargetServerRpc(); ((EnemyAI)this).agent.speed = WanderingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } else { if (_breakingDoorOpen) { return; } GoToDestinationResult val = default(GoToDestinationResult); smartAgentNavigator.TryDoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position, ref val); if ((int)val == 2) { _lostPlayerTimer -= ((EnemyAI)this).AIIntervalTime; if (_lostPlayerTimer <= 0f) { _lostPlayerTimer = 2f; ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); NetworkAudioSource.PlayOneShot(TeleportSound); creatureNetworkAnimator.SetTrigger(TeleportAnimationHash, true); return; } } else { _lostPlayerTimer = Mathf.Min(_lostPlayerTimer + ((EnemyAI)this).AIIntervalTime, 2f); } _grabAttackTimer -= ((EnemyAI)this).AIIntervalTime; if (Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) < ((EnemyAI)this).agent.stoppingDistance + 1.5f) { ((EnemyAI)this).agent.speed = AttackingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(4); if (_grabAttackTimer <= 0f && Random.Range(0f, 100f) < ChanceToGoForGrabAttack) { _grabAttackTimer = GrabAttackTimer.GetRandomInRange(new Random(Random.Range(0, 999999))); ((EnemyAI)this).agent.speed = AttackingSpeed * 3f; ((EnemyAI)this).agent.acceleration = 100f; NetworkAudioSource.PlayOneShot(GrabSound); creatureNetworkAnimator.SetTrigger(GrabAnimationHash, true); } else { _grabAttackTimer -= 1f; NetworkAudioSource.PlayOneShot(BitchSliceSound); creatureNetworkAnimator.SetTrigger(SliceAnimationHash, true); } } else if (CanBreakDownDoor()) { BreakOpenDoorStartRpc(); creatureNetworkAnimator.SetTrigger(PryOpenAnimationHash, true); } } } private void DoAttackingPlayer() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) && !((EnemyAI)this).targetPlayer.isPlayerDead) { smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); } } private void DoDeath() { } private IEnumerator HandleTeleportDelay(DebtCollectorState state, float delay, float speed, bool hasTargetPlayer) { yield return (object)new WaitForSeconds(delay); if (!hasTargetPlayer) { FindRandomPlayerViaAsyncPathfinding(); yield break; } ((EnemyAI)this).agent.speed = speed; ((EnemyAI)this).SwitchToBehaviourServerRpc((int)state); } private void HandleIdleSoundTimer() { _idleTimer -= Time.deltaTime; if (!(_idleTimer > 0f)) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); AudioClip val = _idleAudioClips.audioClips[enemyRandom.Next(_idleAudioClips.audioClips.Length)]; ((EnemyAI)this).creatureVoice.PlayOneShot(val); } } [Rpc(/*Could not decode attribute arguments.*/)] private void BreakOpenDoorStartRpc() { Plugin.ExtendedLogging("Starting breaking down door"); _breakingDoorOpen = true; _pryingDoorOpenTimer = 0f; AudioSource.PlayOneShot(PryOpenDoorSound); _shipDoor.shipDoorsAnimator.SetBool(PryingOpenDoorAnimationHash, true); _shipDoor.shipDoorsAnimator.SetFloat(PryOpenDoorAnimationHash, _pryingDoorOpenTimer); } private bool CanBreakDownDoor() { //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_0058: 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_007a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_shipDoor == (Object)null) { return false; } if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { return false; } if (StartOfRound.Instance.hangarDoorsClosed) { Bounds bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)((EnemyAI)this).targetPlayer).transform.position) && !(Vector3.Distance(((Component)this).transform.position, _shipDoor.outsideDoorPoint.position) > 4f)) { return true; } } return false; } private void FindRandomPlayerViaAsyncPathfinding() { IEnumerable<(PlayerControllerB, Vector3)> enumerable = from kv in StartOfRound.Instance.allPlayerScripts where (Object)(object)kv != (Object)null && !kv.isPlayerDead && kv.isPlayerControlled select (kv: kv, position: ((Component)kv).transform.position); smartAgentNavigator.CheckPaths(enumerable, (Action>>)CheckIfNeedToChangeState); } public void CheckIfNeedToChangeState(List> args) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) int count = args.Count; if (count > 0) { Plugin.ExtendedLogging($"DebtCollector: Found {count} targets"); SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(args[Random.Range(0, count)].Generic)); smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = ChasingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(3); return; } List list = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB kv) => (Object)(object)kv != (Object)null && !kv.isPlayerDead && kv.isPlayerControlled).ToList(); if (list.Count <= 0) { ((EnemyAI)this).agent.speed = WanderingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); smartAgentNavigator.StartSearchRoutine(20f); Plugin.ExtendedLogging("DebtCollector: Going idle temporarily"); } else { PlayerControllerB val = list[Random.Range(0, list.Count)]; ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); NetworkAudioSource.PlayOneShot(TeleportSound); creatureNetworkAnimator.SetTrigger(TeleportAnimationHash, true); _overrideNextTeleportPosition = ((Component)val).transform.position; } } private void RotateToPlayer(PlayerControllerB player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; val.y = 0f; Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); } [Rpc(/*Could not decode attribute arguments.*/)] private void SetPlayerAsGrabbedRpc() { AudioSource.PlayOneShot(GrabSucceedSound); _playerIsGrabbed = true; ((EnemyAI)this).targetPlayer.disableMoveInput = true; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; ((EnemyAI)this).enemyHP = Mathf.Clamp(((EnemyAI)this).enemyHP + 10, 0, 30); ((EnemyAI)this).creatureAnimator.SetTrigger(SuccessAnimationHash); } public void FinishPryOpenDoor(int cancelledEarly) { Plugin.ExtendedLogging($"Finishing pry open door with {cancelledEarly}"); if (cancelledEarly != 1) { _shipDoor.shipDoorsAnimator.SetBool(ClosedDoorAnimationHash, false); StartOfRound.Instance.SetShipDoorsClosed(false); StartOfRound.Instance.SetShipDoorsOverheatLocalClient(); _shipDoor.doorPower = 0f; } _breakingDoorOpen = false; ((EnemyAI)this).inSpecialAnimation = false; _shipDoor.shipDoorsAnimator.SetBool(PryingOpenDoorAnimationHash, false); } public void TeleportSomewhereRandom() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && !((EnemyAI)this).targetPlayer.isPlayerDead && smartAgentNavigator.CanPathToPoint(((Component)((EnemyAI)this).agent).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) != -1f) { CRUtilities.TeleportEnemy((EnemyAI)(object)this, RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)((EnemyAI)this).targetPlayer).transform.position, 20f, default(NavMeshHit))); ((MonoBehaviour)this).StartCoroutine(HandleTeleportDelay(DebtCollectorState.ChasingTargetPlayer, 4f, ChasingSpeed, (Object)(object)((EnemyAI)this).targetPlayer != (Object)null)); return; } List list = new List(); if (RoundManager.Instance.insideAINodes != null && RoundManager.Instance.insideAINodes.Length != 0) { list.AddRange(RoundManager.Instance.insideAINodes.Select((GameObject node) => node.transform.position)); } else if (RoundManager.Instance.outsideAINodes != null && RoundManager.Instance.outsideAINodes.Length != 0) { list.AddRange(RoundManager.Instance.outsideAINodes.Select((GameObject node) => node.transform.position)); } if (list.Count == 0 && _overrideNextTeleportPosition == Vector3.zero) { Plugin.ExtendedLogging("DebtCollector: No nodes to teleport to"); return; } if (_overrideNextTeleportPosition == Vector3.zero) { _overrideNextTeleportPosition = list[Random.Range(0, list.Count)]; } CRUtilities.TeleportEnemy((EnemyAI)(object)this, _overrideNextTeleportPosition); _overrideNextTeleportPosition = Vector3.zero; ((MonoBehaviour)this).StartCoroutine(HandleTeleportDelay(DebtCollectorState.ChasingTargetPlayer, 4f, ChasingSpeed, (Object)(object)((EnemyAI)this).targetPlayer != (Object)null)); } public void TryGrabPlayer() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StopAgent(); ((EnemyAI)this).agent.speed = ChasingSpeed; } RaycastHit val = default(RaycastHit); if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && !((EnemyAI)this).targetPlayer.isPlayerDead && PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer) && Physics.Raycast(GrabHand.position, ((Component)((EnemyAI)this).targetPlayer).transform.position - GrabHand.position, ref val, 5f, StartOfRound.Instance.playersMask, (QueryTriggerInteraction)2) && Vector3.Distance(((RaycastHit)(ref val)).collider.ClosestPoint(GrabHand.position), GrabHand.position) < 3f) { GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel").SetActive(false); ((EnemyAI)this).targetPlayer.DamagePlayer(((EnemyAI)this).targetPlayer.health - 1, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); SetPlayerAsGrabbedRpc(); } } public void KillTargetPlayer() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && !((EnemyAI)this).targetPlayer.isPlayerDead) { if (PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel").SetActive(true); } ((EnemyAI)this).targetPlayer.disableMoveInput = false; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; ((EnemyAI)this).targetPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)17, 8, default(Vector3), false); ClearPlayerTarget(); } _playerIsGrabbed = false; } public void EndAttackAnimation() { Plugin.ExtendedLogging("DebtCollector: EndAttackAnimation"); _playerIsGrabbed = false; ((EnemyAI)this).agent.speed = ChasingSpeed; ((EnemyAI)this).agent.acceleration = 16f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); } public void DoSlashAttack() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapCapsuleNonAlloc(SliceArmStart.position, SliceArmEnd.position, 2f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val2 = default(IHittable); for (int i = 0; i < num; i++) { Collider val = _cachedColliders[i]; Plugin.ExtendedLogging("Bitch Slap hit " + ((Object)val).name); if (!((Component)val).TryGetComponent(ref val2)) { continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val3 != null) { if (!_playersHit.Contains(val3)) { _playersHit.Add(val3); if (((NetworkBehaviour)val3).IsOwner) { Vector3 val4 = ((Component)val3).transform.position - ((Component)this).transform.position; Vector3 val5 = ((Vector3)(ref val4)).normalized * 20f; NetworkAudioSource.PlayOneShot(BitchSliceHit); val3.DamagePlayer(20, true, true, (CauseOfDeath)17, 7, false, val5); val3.externalForceAutoFade += val5; } } continue; } EnemyAICollisionDetect val6 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val6 != null) { if (!_enemiesHit.Contains(val6.mainScript)) { _enemiesHit.Add(val6.mainScript); if (((NetworkBehaviour)this).IsServer && !((Object)(object)((Component)val6.mainScript).gameObject == (Object)(object)((Component)this).gameObject)) { NetworkAudioSource.PlayOneShot(BitchSliceHit); val6.mainScript.HitEnemyOnLocalClient(2, ((Component)this).transform.position, (PlayerControllerB)null, true, 1921); } } } else if (!_hittablesHit.Contains(val2)) { _hittablesHit.Add(val2); if (((NetworkBehaviour)this).IsServer) { NetworkAudioSource.PlayOneShot(BitchSliceHit); val2.Hit(2, ((Component)this).transform.position, (PlayerControllerB)null, true, 1921); } } } if (_playersHit.Count > 0) { ((EnemyAI)this).enemyHP = Mathf.Clamp(((EnemyAI)this).enemyHP + 2 * _playersHit.Count, 0, 30); } _playersHit.Clear(); _enemiesHit.Clear(); _hittablesHit.Clear(); } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!((EnemyAI)this).isEnemyDead && !(_hitCooldown > 0f)) { _hitCooldown = 0.25f; if (force > 5) { force = 5; } if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit != (Object)(object)((EnemyAI)this).targetPlayer && ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || Vector3.Distance(((Component)this).transform.position, ((Component)playerWhoHit).transform.position) < Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position))) { SetPlayerTarget(PlayerControllerReference.op_Implicit(playerWhoHit)); smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = ChasingSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((EnemyAI)this).enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { if (((EnemyAI)this).enemyHP > 0) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - 10; if (((EnemyAI)this).enemyHP > 0) { return; } } base.KillEnemy(destroy); TreadSource.Stop(); HookScrapingSource.Stop(); HookScrappingParticles.Stop(); AudioSource.PlayOneShot(((EnemyAI)this).dieSFX); if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { if (PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel").SetActive(true); } ((EnemyAI)this).targetPlayer.disableMoveInput = false; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; } _playerIsGrabbed = false; ClearPlayerTarget(); if (!StartOfRound.Instance.shipIsLeaving) { ((DataContainer)DawnLib.GetCurrentContract()).Set(RoundManagerPatch.MilitaryAmountKey, ((DataContainer)DawnLib.GetCurrentContract()).GetOrCreateDefault(RoundManagerPatch.MilitaryAmountKey) + 1); } if (_breakingDoorOpen) { FinishPryOpenDoor(1); } ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimationHash, true); ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(5); } } public class DriftwoodMenaceAI : CodeRebirthEnemyAI, IVisibleThreat { public enum DriftwoodState { Spawn, SearchingForPrey, ChestBang, RunningToPrey, SmashingPrey, EatingPrey, PlayingWithPrey, RunningAway, Grabbed, Death, BurningGiant } public AudioClip BurningSound = null; public ParticleSystem[] burnParticles = Array.Empty(); public List CharredMaterials = new List(); public GameObject grabArea = null; public AnimationClip spawnAnimation = null; public AnimationClip chestBangingAnimation = null; public AudioClip screamSound = null; public AudioClip onStunSound = null; public float seeingRange = 60f; public float awarenessLevel = 0f; public float maxAwarenessLevel = 100f; public float awarenessDecreaseRate = 2.5f; public float awarenessIncreaseRate = 5f; public float awarenessIncreaseMultiplier = 2f; public Transform smashTransform = null; private static Collider[] _cachedColliders = (Collider[])(object)new Collider[24]; private Vector3 enemyPositionBeforeDeath = Vector3.zero; private bool currentlyGrabbed = false; private bool canSmash = true; private EnemyAI? ScaryThing = null; private HashSet _enemyTargetBlacklist = new HashSet(); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int GrabPlayerAnimation = Animator.StringToHash("GrabPlayer"); private static readonly int DoAggroAnimation = Animator.StringToHash("DoAggro"); private static readonly int DriftwoodSmashAnimation = Animator.StringToHash("DriftwoodSmash"); private static readonly int EatEnemyAnimation = Animator.StringToHash("EatEnemy"); internal static readonly int GrabbedAnimation = Animator.StringToHash("Grabbed"); private static readonly int DeadAnimation = Animator.StringToHash("Dead"); private static readonly int StunnedAnimation = Animator.StringToHash("Stunned"); private static readonly int RUNFUCKERRUNFloat = Animator.StringToHash("RUNFUCKERRUN"); private bool currentlyStunned = false; private Vector3 randomPosition = Vector3.zero; private Coroutine? _burnGiantRoutine = null; ThreatType IVisibleThreat.type => (ThreatType)4; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((EnemyAI)this).eye; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void Start() { base.Start(); ((EnemyAI)this).creatureAnimator.SetFloat(RUNFUCKERRUNFloat, 1f); List list = (from s in ((AssetBundleLoader)(object)ContentHandler.Instance.DriftwoodMenace).GetConfig("Driftwood Menace | Enemy Blacklist").Value.Split(',') select s.Trim()).ToList(); foreach (string nameEntry in list) { _enemyTargetBlacklist.UnionWith(from et in ((Registry)(object)LethalContent.Enemies).Values where et.EnemyType.enemyName.Equals(nameEntry, StringComparison.OrdinalIgnoreCase) select et.EnemyType.enemyName); } foreach (string item in _enemyTargetBlacklist) { Plugin.ExtendedLogging("Enemy Blacklist: " + item); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); ((MonoBehaviour)this).StartCoroutine(SpawnAnimationCooldown()); } public override void Update() { //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).stunNormalizedTimer > 0f && !currentlyStunned) { ((EnemyAI)this).creatureVoice.PlayOneShot(onStunSound); currentlyStunned = true; currentlyGrabbed = false; if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; } ((EnemyAI)this).targetPlayer = null; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, true); } return; } if (currentlyStunned && ((EnemyAI)this).stunNormalizedTimer <= 0f) { currentlyStunned = false; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, false); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = 7f; return; } if (currentlyStunned) { smartAgentNavigator.StopAgent(); return; } _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f && (Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(0, _idleAudioClips.audioClips.Length)]); } if (currentlyGrabbed && (Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, grabArea.transform.position); if (num > 10f) { currentlyGrabbed = false; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; ((EnemyAI)this).targetPlayer = null; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((MonoBehaviour)this).StartCoroutine(ChestBangPause(1, 7f)); } } else { ((Component)((EnemyAI)this).targetPlayer).transform.position = grabArea.transform.position; ((EnemyAI)this).targetPlayer.ResetFallGravity(); } return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled && !localPlayerController.isInsideFactory && !localPlayerController.isInHangarShipRoom) { if (EnemyHasLineOfSightToPosition(((Component)localPlayerController).transform.position, 60f, seeingRange)) { DriftwoodGiantSeePlayerEffect(localPlayerController); } if (((EnemyAI)this).currentBehaviourStateIndex == 1) { UpdateAwareness(); } } } public override void DoAIInterval() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead && !currentlyStunned) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 2f); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoSpawn(); break; case 1: DoSearchingForPrey(); break; case 2: DoChestBang(); break; case 3: DoRunningToPrey(); break; case 4: DoSmashingPrey(); break; case 5: DoEatingPrey(); break; case 6: DoPlayingWithPrey(); break; case 7: DoRunningAway(); break; case 8: DoGrabbed(); break; case 9: DoDeath(); break; case 10: DoBurningGiant(); break; } } } public void DoSpawn() { } public void DoSearchingForPrey() { if (DetectScaryThings()) { RunFarAway(); } else if (FindClosestTargetEnemyInRange(seeingRange) || (awarenessLevel >= 25f && FindClosestPlayerInRange(seeingRange))) { smartAgentNavigator.StopSearchRoutine(); ((MonoBehaviour)this).StartCoroutine(ChestBangPause(3, 20f)); ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } public void DoChestBang() { } public void DoRunningToPrey() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_0252: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead) && ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead)) { Plugin.ExtendedLogging("If you see this, something went wrong, likely an enemy or player randomly died."); Plugin.ExtendedLogging("Resettings state to Scream Animation"); ClearPlayerTargetServerRpc(); ClearEnemyTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = 7f; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } else if ((Object)(object)targetEnemy != (Object)null) { if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) > seeingRange + 10f && !EnemyHasLineOfSightToPosition(((Component)targetEnemy).transform.position)) { Plugin.ExtendedLogging("Stop chasing target enemy"); ClearEnemyTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = 7f; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } else { smartAgentNavigator.DoPathingToDestination(((Component)targetEnemy).transform.position); } } else { if (!((Object)(object)((EnemyAI)this).targetPlayer != (Object)null)) { return; } if (!(Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) > seeingRange + 10f) || EnemyHasLineOfSightToPosition(((Component)((EnemyAI)this).targetPlayer).transform.position)) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)((EnemyAI)this).targetPlayer).transform.position)) { smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); return; } } Plugin.ExtendedLogging("Stop chasing target player"); ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = 7f; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } } public void DoSmashingPrey() { //IL_0082: 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_00b8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null || (targetEnemy.isEnemyDead && canSmash)) { Plugin.ExtendedLogging("If you see this, something went wrong, likely an enemy randomly died."); ClearEnemyTargetServerRpc(); ((MonoBehaviour)this).StartCoroutine(ChestBangPause(1, 7f)); ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position); if (num > seeingRange + 10f && !EnemyHasLineOfSightToPosition(((Component)targetEnemy).transform.position)) { ClearEnemyTargetServerRpc(); ((MonoBehaviour)this).StartCoroutine(ChestBangPause(1, 7f)); ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } else if (canSmash) { Plugin.ExtendedLogging($"Distance to enemy: {num}, Stopping distance: {((EnemyAI)this).agent.stoppingDistance + 2f}"); if (num < ((EnemyAI)this).agent.stoppingDistance + 2f) { ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); creatureNetworkAnimator.SetTrigger(DriftwoodSmashAnimation, true); canSmash = false; ((MonoBehaviour)this).StartCoroutine(SmashCooldown()); } else { ((EnemyAI)this).agent.speed = 20f; ((EnemyAI)this).SwitchToBehaviourServerRpc(3); } } } public void DoEatingPrey() { } public void DoPlayingWithPrey() { } public void DoRunningAway() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (ScaryThing is RadMechAI) { smartAgentNavigator.DoPathingToDestination(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, -1).position); } else if (ScaryThing is RedwoodTitanAI) { smartAgentNavigator.DoPathingToDestination(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)ScaryThing).transform.position, false, 0, false, 50, -1).position); } } public void DoGrabbed() { } public void DoDeath() { } public void DoBurningGiant() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_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) if (randomPosition == Vector3.zero) { randomPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 50f, default(NavMeshHit)); } if (Vector3.Distance(((Component)this).transform.position, randomPosition) < ((EnemyAI)this).agent.stoppingDistance + 3f) { randomPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 50f, default(NavMeshHit)); } smartAgentNavigator.DoPathingToDestination(randomPosition); } public void DriftwoodChestBangAnimEvent() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead && !localPlayerController.isInHangarShipRoom) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num <= 15f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); localPlayerController.DamagePlayer(3, true, true, (CauseOfDeath)5, 0, false, default(Vector3)); } } } public void ParticlesFromEatingPreyAnimEvent() { } public void ThrowPlayerAnimEvent() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { Plugin.ExtendedLogging("No player to throw, This is a bug, please report this"); return; } ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; currentlyGrabbed = false; Vector3 val = ((Component)this).transform.forward; Vector3 val2 = -((Vector3)(ref val)).normalized * 60f; val = Vector3.up; Vector3 val3 = ((Vector3)(ref val)).normalized * 30f; val = val2 + Quaternion.AngleAxis(55f, ((Component)this).transform.right) * val3; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = 150f; Plugin.ExtendedLogging("Launching Player"); PlayerControllerB targetPlayer = ((EnemyAI)this).targetPlayer; targetPlayer.externalForceAutoFade += normalized * num; ((EnemyAI)this).targetPlayer.SetFlingingAway(flingingAway: true); ((EnemyAI)this).targetPlayer.SetFlung(flung: true); ((MonoBehaviour)this).StartCoroutine(StopFlingingPlayer(((EnemyAI)this).targetPlayer)); ((EnemyAI)this).targetPlayer = null; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((MonoBehaviour)this).StartCoroutine(ChestBangPause(1, 7f)); } } public void SmashPlayerOntoGroundAnimEvent() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { Plugin.Logger.LogError((object)"No player to smash onto the ground, This is a bug, please report this"); } else { ((EnemyAI)this).targetPlayer.DamagePlayer(5, true, true, (CauseOfDeath)2, 0, false, default(Vector3)); } } public void GrabPlayerAnimEvent() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { Plugin.Logger.LogError((object)"No player to grab, This is a bug, please report this"); return; } currentlyGrabbed = true; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; ((Component)((EnemyAI)this).targetPlayer).transform.position = grabArea.transform.position; ((EnemyAI)this).targetPlayer.ResetFallGravity(); } public void SmashEnemyAnimEvent() { //IL_0007: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(smashTransform.position, 8f, _cachedColliders, MoreLayerMasks.EnemiesMask, (QueryTriggerInteraction)2); IHittable val = default(IHittable); for (int i = 0; i < num; i++) { if (((Component)_cachedColliders[i]).gameObject.TryGetComponent(ref val)) { EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null); if (val2 == null || !(val2.mainScript is DriftwoodMenaceAI)) { val.Hit(6, smashTransform.position, (PlayerControllerB)null, true, -1); } } } if (!((Object)(object)targetEnemy != (Object)null)) { return; } Vector3 val3 = ((Component)targetEnemy).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; Quaternion val4 = Quaternion.LookRotation(normalized, ((Component)this).transform.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val4, Time.deltaTime * 3f); if (targetEnemy.enemyHP > 0) { return; } if (RoundManager.Instance.SpawnedEnemies.Any((EnemyAI x) => !x.isEnemyDead && !(x is DriftwoodMenaceAI) && Vector3.Distance(((Component)x).transform.position, ((Component)this).transform.position) < 10f)) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } return; } enemyPositionBeforeDeath = ((Component)targetEnemy).transform.position; ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(5); targetEnemy = null; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.DoPathingToDestination(enemyPositionBeforeDeath); ((Component)this).transform.LookAt(enemyPositionBeforeDeath); creatureNetworkAnimator.SetTrigger(EatEnemyAnimation, true); } } public void FinishedFeedingOnEnemyAnimEvent() { if (!((EnemyAI)this).isEnemyDead) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP + 2; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 7f; smartAgentNavigator.StartSearchRoutine(50f); } } } public IEnumerator SpawnAnimationCooldown() { yield return (object)new WaitForSeconds(spawnAnimation.length); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = 7f; } } public IEnumerator ScareCooldown() { yield return (object)new WaitForSeconds(7.5f); ((EnemyAI)this).agent.speed = 7f; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } public IEnumerator ChestBangPause(int nextStateIndex, float agentSpeed) { creatureNetworkAnimator.SetTrigger(DoAggroAnimation, true); PlayScreamSoundServerRpc(); yield return (object)new WaitForSeconds(chestBangingAnimation.length); if (nextStateIndex == 1) { smartAgentNavigator.StartSearchRoutine(50f); } ((EnemyAI)this).agent.speed = agentSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(nextStateIndex); } [ServerRpc(RequireOwnership = false)] public void PlayScreamSoundServerRpc() { PlayScreamSoundClientRpc(); } [ClientRpc] public void PlayScreamSoundClientRpc() { ((EnemyAI)this).creatureVoice.PlayOneShot(screamSound); } public void RunFarAway() { ((MonoBehaviour)this).StartCoroutine(ScareCooldown()); ((EnemyAI)this).agent.speed = 20f; ((EnemyAI)this).SwitchToBehaviourServerRpc(7); } public bool DetectScaryThings() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) EnemyAI val = null; float num = 35f; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!spawnedEnemy.isEnemyDead && (spawnedEnemy is RedwoodTitanAI || spawnedEnemy is RadMechAI)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (num2 < num) { num = num2; val = spawnedEnemy; } } } if ((Object)(object)val != (Object)null) { ScaryThing = val; return true; } return false; } public void DriftwoodGiantSeePlayerEffect(PlayerControllerB localPlayer) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).currentBehaviourStateIndex == 3 && (Object)(object)localPlayer == (Object)(object)((EnemyAI)this).targetPlayer) { localPlayer.IncreaseFearLevelOverTime(1.4f, 1f); } else if (Vector3.Distance(((Component)this).transform.position, ((Component)localPlayer).transform.position) < 15f) { localPlayer.JumpToFearLevel(0.7f, true); } else { localPlayer.JumpToFearLevel(0.4f, true); } } public void UpdateAwareness() { //IL_0029: 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_005e: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; float num = float.MaxValue; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (EnemyHasLineOfSightToPosition(((Component)val2).transform.position)) { val = val2; float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; } } } float num3 = 0f; num3 += (float)((RedwoodTitanAI.instanceNumbers > 0) ? (5 * RedwoodTitanAI.instanceNumbers) : 0); awarenessLevel = Mathf.Max(awarenessLevel, num3); if ((Object)(object)val != (Object)null) { bool flag = (Object)(object)val.currentlyHeldObjectServer != (Object)null && val.currentlyHeldObjectServer.itemProperties.isDefensiveWeapon; float num4 = Mathf.Clamp01((seeingRange - num) / seeingRange); awarenessLevel += awarenessIncreaseRate * Time.deltaTime * (1f + num4 * awarenessIncreaseMultiplier) + (flag ? 0.1f : 0f); awarenessLevel = Mathf.Min(awarenessLevel, maxAwarenessLevel); } else { awarenessLevel -= awarenessDecreaseRate * Time.deltaTime; } } public IEnumerator SmashCooldown() { yield return (object)new WaitForSeconds(1.5f); canSmash = true; } public bool FindClosestTargetEnemyInRange(float range) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) EnemyAI val = null; float num = range; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (spawnedEnemy.enemyType.canDie && !spawnedEnemy.isEnemyDead && spawnedEnemy.enemyHP > 0 && (int)spawnedEnemy.enemyType.EnemySize != 1 && !(spawnedEnemy is RedwoodTitanAI) && !(spawnedEnemy is DriftwoodMenaceAI) && !(spawnedEnemy is ForestGiantAI) && !(spawnedEnemy is CactusBudling) && !_enemyTargetBlacklist.Contains(spawnedEnemy.enemyType.enemyName) && EnemyHasLineOfSightToPosition(((Component)spawnedEnemy).transform.position, 75f, range)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (num2 < num) { num = num2; val = spawnedEnemy; } } } if ((Object)(object)val != (Object)null) { SetEnemyTargetServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)val)); return true; } return false; } public bool FindClosestPlayerInRange(float range) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; float num = range; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom && EnemyHasLineOfSightToPosition(((Component)val2).transform.position, 45f, range)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); return true; } return false; } public IEnumerator StopFlingingPlayer(PlayerControllerB player) { yield return (object)new WaitForSeconds(10f); player.SetFlingingAway(flingingAway: false); } [ServerRpc(RequireOwnership = false)] private void BurnGiantServerRpc() { BurnGiantClientRpc(); } [ClientRpc] private void BurnGiantClientRpc() { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } private IEnumerator BurnGiant() { ((EnemyAI)this).agent.speed = 30f; ((EnemyAI)this).creatureAnimator.SetFloat(RUNFUCKERRUNFloat, 2f); ((EnemyAI)this).creatureVoice.clip = BurningSound; ((EnemyAI)this).creatureVoice.loop = true; ((EnemyAI)this).creatureVoice.Play(); ParticleSystem[] array = burnParticles; foreach (ParticleSystem particleSystem in array) { particleSystem.Play(); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(10); yield return (object)new WaitForSeconds(12f); ((EnemyAI)this).KillEnemy(false); _burnGiantRoutine = null; } public override void HitFromExplosion(float distance) { ((EnemyAI)this).HitFromExplosion(distance); if (_burnGiantRoutine == null && !((EnemyAI)this).isEnemyDead) { BurnGiantServerRpc(); } } public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy) { if (!((EnemyAI)this).isEnemyDead && !((Object)(object)targetEnemy == (Object)null) && (Object)(object)collidedEnemy == (Object)(object)targetEnemy) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4); } } public override void OnCollideWithPlayer(Collider other) { if (((EnemyAI)this).isEnemyDead) { return; } PlayerControllerB component = ((Component)other).GetComponent(); if ((Object)(object)component == (Object)null) { return; } awarenessLevel += 10f; if ((Object)(object)component == (Object)(object)((EnemyAI)this).targetPlayer && ((EnemyAI)this).currentBehaviourStateIndex == 3) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(6); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); creatureNetworkAnimator.SetTrigger(GrabPlayerAnimation, true); } } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead) { return; } if (hitID == 745737 && _burnGiantRoutine == null) { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((EnemyAI)this).enemyHP <= 0) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } else { if (currentlyStunned) { return; } if (((NetworkBehaviour)this).IsServer && force == 6 && ((EnemyAI)this).currentBehaviourStateIndex != 7) { RunFarAway(); } else if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { ((EnemyAI)this).targetPlayer = playerWhoHit; smartAgentNavigator.StopSearchRoutine(); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(ChestBangPause(3, 20f)); ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } else if (force > 0 && ((EnemyAI)this).currentBehaviourStateIndex == 5) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); ((EnemyAI)this).creatureVoice.Stop(); if (_burnGiantRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_burnGiantRoutine); _burnGiantRoutine = null; ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).SetSharedMaterials(CharredMaterials); } smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(9); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(DeadAnimation, true); } } } public class Duck : QuestMasterAI { public override void Awake() { ((EnemyAI)this).Awake(); bool value = ((AssetBundleLoader)(object)ContentHandler.Instance.DuckSong).GetConfig("Duck | Global Spawn Audio").Value; creatureUltraVoice.spatialBlend = (value ? 0f : 1f); creatureUltraVoice.Play(); } public override void Start() { base.Start(); questTimer = ((AssetBundleLoader)(object)ContentHandler.Instance.DuckSong).GetConfig("Duck | Quest Timer").Value; questRepeatChance = ((AssetBundleLoader)(object)ContentHandler.Instance.DuckSong).GetConfig("Duck | Lemonade Quest Chance").Value; } } public class Guardsman : CodeRebirthEnemyAI, IVisibleThreat { [Header("Audio")] [SerializeField] private AudioClip _slamAudioClip = null; [SerializeField] private AudioClip _ripApartAudioClip = null; [SerializeField] private AudioClip[] _enemySpottedAudioClips = Array.Empty(); [SerializeField] private Transform[] _enemyHoldingPoints = Array.Empty(); [SerializeField] private Transform _spotlightHead = null; [SerializeField] private float _enemySizeThreshold = 69f; [SerializeField] private GameObject _dustLandDecal = null; [SerializeField] private ParticleSystem _dustParticleSystem = null; private Coroutine? _messWithSizeOverTimeRoutine = null; private bool _killingLargeEnemy = false; private float _bufferTimer = 0f; private List _iHittableList = new List(); private List _enemyAIList = new List(); private Collider[] _cachedHits = (Collider[])(object)new Collider[24]; internal HashSet _internalEnemyBlacklist = new HashSet(); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int IsDeadAnimation = Animator.StringToHash("isDead"); private static readonly int KillLargeAnimation = Animator.StringToHash("killLarge"); public static readonly int KillSmallAnimation = Animator.StringToHash("killSmall"); public ThreatType type => (ThreatType)6; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void Start() { base.Start(); List list = (from s in ((AssetBundleLoader)(object)ContentHandler.Instance.Merchant).GetConfig("Guardsman | Enemy Blacklist").Value.Split(',') select s.Trim()).ToList(); foreach (string nameEntry in list) { _internalEnemyBlacklist.UnionWith(from et in ((Registry)(object)LethalContent.Enemies).Values where et.EnemyType.enemyName.Equals(nameEntry, StringComparison.OrdinalIgnoreCase) select et.EnemyType.enemyName); } foreach (string item in _internalEnemyBlacklist) { Plugin.ExtendedLogging("Adding " + item + " to Guardsman's internal blacklist."); } ((MonoBehaviour)this).StartCoroutine(StartDelay()); ((MonoBehaviour)this).StartCoroutine(ProjectorUnparentDelay()); } public override void Update() { //IL_00a8: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) base.Update(); _idleTimer -= Time.deltaTime; if (_idleTimer < 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(_idleAudioClips.audioClips.Length)]); } if (_killingLargeEnemy && (Object)(object)targetEnemy != (Object)null) { Vector3 position = (_enemyHoldingPoints[0].position + _enemyHoldingPoints[1].position) / 2f; ((Component)targetEnemy).transform.position = position; ((Component)targetEnemy).transform.LookAt(_spotlightHead); } if (_bufferTimer > 0f && (Object)(object)targetEnemy != (Object)null) { Vector3 val = ((Component)targetEnemy).transform.position - ((Component)this).transform.position; Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); } } public override void DoAIInterval() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (((EnemyAI)this).isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 3f); if ((Object)(object)targetEnemy != (Object)null && targetEnemy.isEnemyDead) { targetEnemy = null; } _bufferTimer -= ((EnemyAI)this).AIIntervalTime; if (!(_bufferTimer > 0f)) { if ((Object)(object)targetEnemy == (Object)null) { HandleWandering(); } else { KillLargeOrSmallEnemy(targetEnemy); } } } private void HandleWandering() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy == (Object)null || spawnedEnemy.isEnemyDead || spawnedEnemy is Guardsman || spawnedEnemy is SandWormAI || spawnedEnemy is DebtCollector || _internalEnemyBlacklist.Contains(spawnedEnemy.enemyType.enemyName) || Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position) > 45f || EnemyHasLineOfSightToPosition(((Component)spawnedEnemy).transform.position, 60f, 45f)) { continue; } SetEnemyTargetServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)spawnedEnemy)); smartAgentNavigator.StopSearchRoutine(); break; } } private void KillLargeOrSmallEnemy(EnemyAI _targetEnemy) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) smartAgentNavigator.DoPathingToDestination(((Component)_targetEnemy).transform.position); if (!(Vector3.Distance(((Component)_targetEnemy).transform.position, ((Component)this).transform.position) > 12.5f + ((EnemyAI)this).agent.stoppingDistance)) { if (CalculateEnemySize(_targetEnemy) > _enemySizeThreshold) { _bufferTimer = 7.5f; smartAgentNavigator.DisableMovement(true); smartAgentNavigator.StopAgent(); MiscSoundsClientRpc(1); creatureNetworkAnimator.SetTrigger(KillLargeAnimation, true); } else { _bufferTimer = 7.5f; smartAgentNavigator.DisableMovement(true); smartAgentNavigator.StopAgent(); MiscSoundsClientRpc(0); creatureNetworkAnimator.SetTrigger(KillSmallAnimation, true); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimation, true); } } public override void EnemySetAsTarget(EnemyAI? enemy) { base.EnemySetAsTarget(enemy); ((EnemyAI)this).creatureVoice.PlayOneShot(_enemySpottedAudioClips[enemyRandom.Next(_enemySpottedAudioClips.Length)]); } [ClientRpc] public void MiscSoundsClientRpc(int soundID) { switch (soundID) { case 0: ((EnemyAI)this).creatureSFX.PlayOneShot(_slamAudioClip); break; case 1: ((EnemyAI)this).creatureSFX.PlayOneShot(_ripApartAudioClip); break; } } private IEnumerator MessWithSizeOverTime(int sizeMultiplier) { while (!((Object)(object)targetEnemy == (Object)null)) { ((Component)targetEnemy).transform.localScale = new Vector3(((Component)targetEnemy).transform.localScale.x, ((Component)targetEnemy).transform.localScale.y, ((Component)targetEnemy).transform.localScale.z) + new Vector3((float)sizeMultiplier * Time.deltaTime, 0f, 0f); yield return null; } ((MonoBehaviour)this).StopCoroutine(_messWithSizeOverTimeRoutine); } private IEnumerator StartDelay() { smartAgentNavigator.DisableMovement(true); smartAgentNavigator.StopAgent(); yield return (object)new WaitForSeconds(10f); ((EnemyAI)this).skinnedMeshRenderers[0].updateWhenOffscreen = false; smartAgentNavigator.DisableMovement(false); smartAgentNavigator.StartSearchRoutine(100f); } private IEnumerator ProjectorUnparentDelay() { yield return (object)new WaitUntil((Func)(() => _dustLandDecal.activeSelf)); Vector3 previousPosition = _dustLandDecal.transform.position; _dustLandDecal.transform.SetParent(RoundManager.Instance.mapPropsContainer.transform); _dustLandDecal.transform.position = previousPosition; _dustLandDecal.gameObject.SetActive(true); } private float CalculateEnemySize(EnemyAI enemyAi) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NavMeshAgent component = ((Component)enemyAi).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return 10f; } return 3.14159f * component.radius * component.radius * component.height * (((Component)enemyAi).transform.localScale.x * ((Component)enemyAi).transform.localScale.y * ((Component)enemyAi).transform.localScale.z); } private IEnumerator StartSearchRoutineWithDelay() { yield return (object)new WaitForSeconds(3f); smartAgentNavigator.DisableMovement(false); smartAgentNavigator.StopAgent(); if (!((Object)(object)targetEnemy != (Object)null)) { smartAgentNavigator.StartSearchRoutine(100f); } } public void MessWithSizeAnimEvent(int sizeMultiplier) { if (_messWithSizeOverTimeRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_messWithSizeOverTimeRoutine); } _messWithSizeOverTimeRoutine = ((MonoBehaviour)this).StartCoroutine(MessWithSizeOverTime(sizeMultiplier)); } public void StartKillLargeEnemyAnimEvent() { _killingLargeEnemy = true; } public void SmashEnemyAnimEvent() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(StartSearchRoutineWithDelay()); _dustParticleSystem.Play(); Vector3 val = (_enemyHoldingPoints[0].position + _enemyHoldingPoints[1].position) / 2f; int num = Physics.OverlapSphereNonAlloc(val, 6f, _cachedHits, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); _iHittableList.Clear(); _enemyAIList.Clear(); IHittable val2 = default(IHittable); for (int i = 0; i < num; i++) { if (!((Component)_cachedHits[i]).TryGetComponent(ref val2)) { continue; } EnemyAICollisionDetect val3 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val3 != null) { if (val3.mainScript is Guardsman || _enemyAIList.Contains(val3.mainScript)) { continue; } _enemyAIList.Add(val3.mainScript); } _iHittableList.Add(val2); } foreach (IHittable iHittable in _iHittableList) { iHittable.Hit(99, val, (PlayerControllerB)null, true, -1); } foreach (EnemyAI enemyAI in _enemyAIList) { ((Component)enemyAI).gameObject.transform.localScale = new Vector3(((Component)enemyAI).transform.localScale.x, ((Component)enemyAI).transform.localScale.y * 0.1f, ((Component)enemyAI).transform.localScale.z); bool flag = !enemyAI.enemyType.canDie; ((Behaviour)enemyAI).enabled = false; enemyAI.KillEnemyOnOwnerClient(flag); } } public void RipApartEnemyAnimEvent() { ((MonoBehaviour)this).StartCoroutine(StartSearchRoutineWithDelay()); _killingLargeEnemy = false; if (!((Object)(object)targetEnemy == (Object)null) && ((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)targetEnemy).NetworkObject.Despawn(true); } } } public class GuardsmanBullet : MonoBehaviour { internal GuardsmanTurret GuardsmanTurret = null; private float _endTimer = 10f; private Vector3 _movingDirection = Vector3.zero; public void SetMovingDirection(Vector3 startingPosition, Vector3 direction, float endTimer) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.SetActive(true); GuardsmanTurret.bulletsPool.Remove(this); _endTimer = endTimer; _movingDirection = direction; ((Component)this).transform.position = startingPosition; ((Component)this).transform.forward = direction; } private void Start() { ResetBullet(); } public void FixedUpdate() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (!(_movingDirection == Vector3.zero) && !((Object)(object)GuardsmanTurret == (Object)null)) { _endTimer -= Time.fixedDeltaTime; ((Component)this).transform.position = ((Component)this).transform.position + _movingDirection * 50f * Time.fixedDeltaTime; if (Physics.CheckSphere(((Component)this).transform.position, 2f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || !(_endTimer > 0f)) { CRUtilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 25, 0f, 6f, 1, null, null, 25f); ResetBullet(); } } } private void ResetBullet() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) ((Component)this).transform.localPosition = Vector3.zero; _movingDirection = Vector3.zero; GuardsmanTurret.bulletsPool.Add(this); ((Component)this).gameObject.SetActive(false); } } public class GuardsmanTurret : MonoBehaviour { [SerializeField] private AudioSource _audioSource = null; [SerializeField] private AudioClip[] _shootSounds = null; [SerializeField] private Guardsman GuardsmanOwner = null; [HideInInspector] public EnemyAI? targetEnemy = null; internal List bulletsPool = new List(); private float hitTimer = 5f; private IEnumerator Start() { for (int i = 0; i < 10; i++) { yield return null; GameObject bullet = Object.Instantiate(ContentHandler.Instance.Merchant.ProjectilePrefab, ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform); GuardsmanBullet GSbullet = bullet.GetComponent(); GSbullet.GuardsmanTurret = this; } } public void Update() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)GuardsmanOwner).isEnemyDead || bulletsPool.Count == 0) { return; } if ((Object)(object)targetEnemy == (Object)null) { HandleFindingTargetEnemy(); return; } if (targetEnemy.isEnemyDead || (targetEnemy.isOutside && !((EnemyAI)GuardsmanOwner).isOutside) || (!targetEnemy.isOutside && ((EnemyAI)GuardsmanOwner).isOutside)) { targetEnemy = null; return; } Vector3 val = ((Component)targetEnemy).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.LookRotation(normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); hitTimer -= Time.deltaTime; if (!(hitTimer > 0f)) { hitTimer = 5f; float num = Vector3.Dot(((Component)this).transform.forward, normalized); if (!((double)num < 0.7)) { ShootShot(); } } } private void ShootShot() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 2f; Vector3 forward = ((Component)this).transform.forward; ((Component)_audioSource).transform.position = val; _audioSource.PlayOneShot(_shootSounds[Random.Range(0, _shootSounds.Length)]); bulletsPool[0].SetMovingDirection(val, forward, 30f); } private void HandleFindingTargetEnemy() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && !spawnedEnemy.isEnemyDead && !(spawnedEnemy is Guardsman) && !(spawnedEnemy is SandWormAI) && !(spawnedEnemy is DebtCollector) && !((Object)(object)GuardsmanOwner.targetEnemy == (Object)(object)spawnedEnemy) && !GuardsmanOwner._internalEnemyBlacklist.Contains(spawnedEnemy.enemyType.enemyName)) { Vector3 val = ((Component)spawnedEnemy).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (!(num > 140f) && !Physics.Raycast(((Component)this).transform.position, normalized, num, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { targetEnemy = spawnedEnemy; break; } } } } } public class Guillotine : NetworkBehaviour { public Transform scrapSpawnTransform = null; public Transform playerBone = null; public AudioSource audioSource = null; public AudioClip GuillotineSound = null; internal Mistress mistress = null; [HideInInspector] public PlayerControllerB? playerToKill = null; [HideInInspector] public bool sequenceFinished = false; public void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!sequenceFinished && (Object)(object)playerToKill != (Object)null) { ((Component)playerToKill).transform.SetPositionAndRotation(playerBone.position, playerBone.rotation); } } public void FinishGuillotineSequenceAnimEvent() { sequenceFinished = true; if ((Object)(object)playerToKill != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(playerToKill)) { PseudoKillPlayerServerRpc(PlayerControllerReference.op_Implicit(playerToKill)); } } [ServerRpc(RequireOwnership = false)] public void SyncGuillotineServerRpc(PlayerControllerReference playerControllerReference, NetworkBehaviourReference mistressNetworkBehaviourReference) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SyncGuillotineClientRpc(playerControllerReference, mistressNetworkBehaviourReference); } [ClientRpc] public void SyncGuillotineClientRpc(PlayerControllerReference playerControllerReference, NetworkBehaviourReference mistressNetworkBehaviourReference) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) playerToKill = PlayerControllerReference.op_Implicit(playerControllerReference); mistress = (Mistress)(object)NetworkBehaviourReference.op_Implicit(mistressNetworkBehaviourReference); if (PlayerControllerBExtensions.IsLocalPlayer(playerToKill) && playerToKill.isCrouching) { playerToKill.Crouch(false); } } [ServerRpc(RequireOwnership = false)] public void PseudoKillPlayerServerRpc(PlayerControllerReference playerControllerReference) { PseudoKillPlayerClientRpc(playerControllerReference); } [ClientRpc] private void PseudoKillPlayerClientRpc(PlayerControllerReference playerControllerReference) { //IL_00d6: 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_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) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) playerToKill = PlayerControllerReference.op_Implicit(playerControllerReference); Plugin.ExtendedLogging($"Killing player {playerToKill}!"); int num = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB player) => player.isPlayerControlled && !player.isPlayerDead && !player.IsPseudoDead()); if (StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB player) => player.isPlayerControlled && !player.isPlayerDead && !player.IsPseudoDead()) == 1) { if (PlayerControllerBExtensions.IsLocalPlayer(playerToKill)) { playerToKill.KillPlayer(Vector3.zero, false, (CauseOfDeath)17, 0, default(Vector3), false); } return; } MoreCompanySoftCompat.TryDisableOrEnableCosmetics(playerToKill, disable: true); playerToKill.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); playerToKill.DisablePlayerModel(((Component)playerToKill).gameObject, false, true); playerToKill.disableMoveInput = true; playerToKill.disableInteract = true; ((Component)playerToKill.playerBadgeMesh).gameObject.SetActive(false); ((Component)playerToKill.thisPlayerModelLOD2).gameObject.SetActive(false); ((Component)playerToKill.thisPlayerModelLOD1).gameObject.SetActive(false); ((Component)playerToKill.headCostumeContainer).gameObject.SetActive(false); ((Component)playerToKill.headCostumeContainerLocal).gameObject.SetActive(false); ((Component)playerToKill.playerBetaBadgeMesh).gameObject.SetActive(false); playerToKill.inAnimationWithEnemy = (EnemyAI)(object)mistress; if (PlayerControllerBExtensions.IsLocalPlayer(playerToKill)) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.Igotaheadache); HUDManager.Instance.HideHUD(true); StartOfRound.Instance.allowLocalPlayerDeath = false; } if (((NetworkBehaviour)this).IsServer) { GameObject val = NetworkObjectReference.op_Implicit(CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.TalkingHead].Item, scrapSpawnTransform.position)); TalkingHead component = val.GetComponent(); component.player = playerToKill; component.mistress = mistress; component.SyncTalkingHeadServerRpc(PlayerControllerReference.op_Implicit(playerToKill), new NetworkBehaviourReference((NetworkBehaviour)(object)mistress)); } playerToKill = null; } public void PlayGuillotineSoundAnimEvent() { audioSource.PlayOneShot(GuillotineSound); } } public class Janitor : CodeRebirthEnemyAI, IVisibleThreat { public enum JanitorStates { Idle, StoringScrap, FollowingPlayer, ZoomingOff, Dead } [Header("References & Transforms")] public GameObject sirenLights = null; public Transform handTransform = null; public Transform playerBoneTransform = null; public Transform placeToHideScrap = null; public GameObject[] headLights = Array.Empty(); [Header("Audio & Sounds")] public AudioSource StunSource = null; public AudioClip[] deathSounds = Array.Empty(); public AudioClip[] postDeathSounds = Array.Empty(); public AudioClip[] detectItemDroppedSounds = Array.Empty(); public AudioClip[] grabPlayerSounds = Array.Empty(); public AudioClip[] throwPlayerSounds = Array.Empty(); private Collider[] _hitColliders = (Collider[])(object)new Collider[12]; public static List janitors = new List(); private Vector3[] _pathCorners = Array.Empty(); private int _currentCornerIndex = 0; private bool _isRotating = false; private TrashCan? _targetTrashCan = null; private GrabbableObject? _targetScrap = null; private GrabbableObject? _lastScrapGrabbed = null; private List _storedScrap = new List(); [HideInInspector] public static List trashCans = new List(); [HideInInspector] public bool currentlyGrabbingScrap = false; [HideInInspector] public bool currentlyGrabbingPlayer = false; [HideInInspector] public bool currentlyThrowingPlayer = false; private static readonly int RightTreadFloat = Animator.StringToHash("RightTreadFloat"); private static readonly int LeftTreadFloat = Animator.StringToHash("LeftTreadFloat"); private static readonly int IsAngryAnimation = Animator.StringToHash("isAngry"); private static readonly int HoldingPlayerAnimation = Animator.StringToHash("holdingPlayer"); private static readonly int IsDeadAnimation = Animator.StringToHash("isDead"); private static readonly int GrabScrapAnimation = Animator.StringToHash("grabScrap"); private static readonly int BreakMovementAnimation = Animator.StringToHash("break"); private static readonly int ThrowPlayerAnimation = Animator.StringToHash("throwPlayer"); private static readonly int StunnedAnimation = Animator.StringToHash("Stunned"); private bool currentlyStunned = false; public ThreatType type => (ThreatType)7; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return _lastScrapGrabbed; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); janitors.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); janitors.Remove(this); } public override void Start() { base.Start(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(CheckForScrapNearby()); } } public override void Update() { base.Update(); if (((EnemyAI)this).stunNormalizedTimer > 0f && !currentlyStunned) { currentlyThrowingPlayer = false; currentlyGrabbingPlayer = false; currentlyGrabbingScrap = false; _targetScrap = null; _targetTrashCan = null; if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; ((EnemyAI)this).targetPlayer.disableMoveInput = false; ((EnemyAI)this).targetPlayer = null; } foreach (GrabbableObject item in _storedScrap) { if (!((Object)(object)item == (Object)null)) { item.EnableItemMeshes(true); item.EnablePhysics(true); item.grabbable = true; item.grabbableToEnemies = true; item.isHeldByEnemy = false; item.isHeld = false; if (!HoarderBugAI.grabbableObjectsInMap.Contains(((Component)item).gameObject)) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)item).gameObject); } } } _storedScrap.Clear(); _targetScrap = null; StunSource.Play(); currentlyStunned = true; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, true); ((EnemyAI)this).creatureAnimator.SetBool(HoldingPlayerAnimation, false); } } if (currentlyStunned && ((EnemyAI)this).stunNormalizedTimer <= 0f) { StunSource.Stop(); currentlyStunned = false; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, false); } } if (currentlyStunned) { smartAgentNavigator.StopAgent(); return; } if (((EnemyAI)this).currentBehaviourStateIndex == 0 || ((EnemyAI)this).currentBehaviourStateIndex == 4) { HandleIdleSoundTimer(); } if (((NetworkBehaviour)this).IsServer && _isRotating) { HandleRotation(); } } public void LateUpdate() { if (((EnemyAI)this).currentBehaviourStateIndex == 3) { KeepPlayerAttachedDuringZoom(); } } private IEnumerator CheckForScrapNearby() { while (!((EnemyAI)this).isEnemyDead) { yield return (object)new WaitUntil((Func)(() => ((EnemyAI)this).currentBehaviourStateIndex == 0 && (Object)(object)_targetScrap == (Object)null && !currentlyStunned)); TryFindScrapNearby(); } } public IEnumerator WaitUntilNotDoingAnythingCurrently(PlayerControllerB playerWhoHit) { yield return (object)new WaitUntil((Func)(() => !currentlyGrabbingScrap && !currentlyGrabbingPlayer && !currentlyThrowingPlayer && !currentlyStunned)); DetectDroppedScrapServerRpc(((Component)playerWhoHit).transform.position, PlayerControllerReference.op_Implicit(playerWhoHit)); } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead && !currentlyStunned) { switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoIdle(); break; case 1: DoStoringScrap(); break; case 2: DoFollowingPlayer(); break; case 3: DoZoomingOff(); break; case 4: break; } } } private void DoIdle() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) if (_isRotating) { return; } if (!IsPathValid()) { CalculateAndSetNewPath(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 50f, default(NavMeshHit))); } else if (ReachedCurrentCorner()) { if (IsAtFinalCorner()) { CalculateAndSetNewPath(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 50f, default(NavMeshHit))); } else { BeginRotation(); } } else { HandleMovement(); } } private void DoStoringScrap() { if (!IsScrapStillValid()) { ResetToIdleServerRpc(); } else { if (_isRotating) { return; } HandleMovement(); if (ReachedCurrentCorner()) { if (IsAtFinalCorner()) { TryGrabScrap(); } else { BeginRotation(); } } } } private void DoFollowingPlayer() { if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || !((EnemyAI)this).targetPlayer.isPlayerControlled || ((EnemyAI)this).targetPlayer.IsPseudoDead()) { ResetChaseAndRevertToIdle(); } else { if (_isRotating) { return; } if (!IsPathValid()) { UpdatePathToTargetPlayer(); return; } HandleMovement(); if (IsPlayerInRange() && !currentlyGrabbingPlayer) { StartGrabPlayer(); } else if (ReachedCurrentCorner()) { if (IsAtFinalCorner() || (!currentlyGrabbingPlayer && IsPlayerTooFarFromFinalCorner())) { UpdatePathToTargetPlayer(); } else { BeginRotation(); } } } } private void DoZoomingOff() { if (!IsPathValid() || (Object)(object)_targetTrashCan == (Object)null) { if (!currentlyThrowingPlayer && !TryFindAnyValidTrashCan()) { TriggerPlayerThrowAnimation(); } } else { if (_isRotating) { return; } HandleMovement(); if (ReachedCurrentCorner()) { if (IsAtFinalCorner() && !currentlyThrowingPlayer) { TriggerPlayerThrowAnimation(); } else { BeginRotation(); } } } } [ServerRpc(RequireOwnership = false)] public void SetBlendShapeWeightServerRpc(int weight) { SetBlendShapeWeightClientRpc(weight); } [ClientRpc] public void SetBlendShapeWeightClientRpc(int weight) { sirenLights.SetActive(weight == 100); ((EnemyAI)this).skinnedMeshRenderers[0].SetBlendShapeWeight(0, (float)weight); } [ServerRpc(RequireOwnership = false)] public void DetectDroppedScrapServerRpc(Vector3 noisePosition, PlayerControllerReference playerControllerReference) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(noisePosition, ref val, 5f, -1)) { if (ObjectIsPathable(((NavMeshHit)(ref val)).position, 20f, out NavMeshPath _)) { ((EnemyAI)this).targetPlayer = PlayerControllerReference.op_Implicit(playerControllerReference); SetPlayerTargetClientRpc(playerControllerReference); UpdateBlendShapeAndSpeedForChase(); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); UpdatePathToTargetPlayer(); } PlayDetectScrapSoundClientRpc(); } } [ClientRpc] public void PlayDetectScrapSoundClientRpc() { ((EnemyAI)this).creatureVoice.PlayOneShot(detectItemDroppedSounds[enemyRandom.Next(detectItemDroppedSounds.Length)]); } [ServerRpc(RequireOwnership = false)] public void SetPlayerImmovableServerRpc(int playerIndex) { SetPlayerImmovableClientRpc(playerIndex); } [ClientRpc] public void SetPlayerImmovableClientRpc(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; val.inAnimationWithEnemy = (EnemyAI)(object)this; ((EnemyAI)this).targetPlayer = val; val.disableMoveInput = true; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(HoldingPlayerAnimation, true); } } [ServerRpc(RequireOwnership = false)] public void SetTargetScrapUngrabbableServerRpc(NetworkObjectReference netObjRef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetTargetScrapUngrabbableClientRpc(netObjRef); } [ClientRpc] public void SetTargetScrapUngrabbableClientRpc(NetworkObjectReference netObjRef) { NetworkObject val = default(NetworkObject); NetworkObject obj = (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val, (NetworkManager)null) ? val : null); GrabbableObject val2 = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)val2 == (Object)null) { _targetScrap = null; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); return; } if (val2.isHeld && (Object)(object)val2.playerHeldBy != (Object)null) { SwitchToChaseState(val2.playerHeldBy); return; } val2.grabbable = false; HoarderBugAI.grabbableObjectsInMap.Remove(((Component)val2).gameObject); _targetScrap = val2; if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(GrabScrapAnimation, true); } } private void BeginRotation() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) _isRotating = true; Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).magnitude > 7.5f) { creatureNetworkAnimator.SetTrigger(BreakMovementAnimation, true); } smartAgentNavigator.DisableMovement(true); ((EnemyAI)this).agent.velocity = Vector3.zero; ((EnemyAI)this).agent.isStopped = true; ((EnemyAI)this).creatureAnimator.SetFloat(LeftTreadFloat, 0f); ((EnemyAI)this).creatureAnimator.SetFloat(RightTreadFloat, 0f); } private void HandleRotation() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (_pathCorners.Length == 0) { StopRotating(); return; } Plugin.ExtendedLogging($"Rotating: Current corner index: {_currentCornerIndex}"); Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.forward, ((Component)this).transform.up); Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.ProjectOnPlane(GetRotationDirection(), ((Component)this).transform.up); Vector3 normalized2 = ((Vector3)(ref val)).normalized; float num = Vector3.SignedAngle(normalized, normalized2, ((Component)this).transform.up); bool flag = num > 0f; float num2 = ((!sirenLights.activeSelf) ? 1 : 6); float num3 = 60f * Time.deltaTime * num2 * (float)(flag ? 1 : (-1)); ((Component)this).transform.Rotate(((Component)this).transform.up, num3, (Space)0); ((EnemyAI)this).creatureAnimator.SetFloat(LeftTreadFloat, flag ? 1f : (-1f)); ((EnemyAI)this).creatureAnimator.SetFloat(RightTreadFloat, flag ? (-1f) : 1f); ((EnemyAI)this).creatureSFX.volume = 1f; if (Mathf.Abs(num) <= 10f) { StopRotating(); } } private Vector3 GetRotationDirection() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((_currentCornerIndex < _pathCorners.Length - 1) ? _pathCorners[_currentCornerIndex + 1] : _pathCorners[_currentCornerIndex]); Vector3 val2 = val - ((Component)this).transform.position; val2 = Vector3.ProjectOnPlane(val2, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < Mathf.Epsilon) { return ((Component)this).transform.forward; } return ((Vector3)(ref val2)).normalized; } private void HandleMovement() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = ((EnemyAI)this).agent.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; ((EnemyAI)this).creatureAnimator.SetFloat(LeftTreadFloat, magnitude); ((EnemyAI)this).creatureAnimator.SetFloat(RightTreadFloat, magnitude); ((EnemyAI)this).creatureSFX.volume = ((magnitude > 0f) ? 1f : 0f); if (!((EnemyAI)this).agent.pathPending) { smartAgentNavigator.DoPathingToDestination(_pathCorners[_currentCornerIndex]); } } private void StopRotating() { _isRotating = false; ((EnemyAI)this).agent.isStopped = false; smartAgentNavigator.DisableMovement(false); if (_currentCornerIndex < _pathCorners.Length - 1) { _currentCornerIndex++; } ((EnemyAI)this).creatureSFX.volume = 0f; ((EnemyAI)this).creatureAnimator.SetFloat(LeftTreadFloat, 0f); ((EnemyAI)this).creatureAnimator.SetFloat(RightTreadFloat, 0f); HandleMovement(); } public void GrabScrapAnimEvent() { if ((Object)(object)_targetScrap == (Object)null) { ResetToIdle(); return; } if (((EnemyAI)this).currentBehaviourStateIndex != 1) { _targetScrap = null; return; } if ((Object)(object)_targetScrap.playerHeldBy != (Object)null) { SwitchToChaseState(_targetScrap.playerHeldBy); return; } ((MonoBehaviour)this).StartCoroutine(PlaceScrapInsideJanitor(_targetScrap)); _targetScrap = null; } public void GrabPlayerAnimEvent() { _targetScrap = null; ((EnemyAI)this).creatureVoice.PlayOneShot(grabPlayerSounds[enemyRandom.Next(grabPlayerSounds.Length)]); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); currentlyGrabbingPlayer = false; } public void ThrowPlayerAnimEvent() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_008c: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).creatureVoice.PlayOneShot(throwPlayerSounds[enemyRandom.Next(throwPlayerSounds.Length)]); if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { currentlyThrowingPlayer = false; return; } Vector3 val; Vector3 val2; if (!((Object)(object)_targetTrashCan != (Object)null)) { val = ((Component)this).transform.forward; } else { val2 = ((Component)_targetTrashCan).transform.position - ((Component)((EnemyAI)this).targetPlayer).transform.position; val = ((Vector3)(ref val2)).normalized; } Vector3 val3 = val; ((EnemyAI)this).targetPlayer.externalForceAutoFade = Vector3.up * 25f + val3 * 25f; _targetTrashCan = null; currentlyThrowingPlayer = false; ((EnemyAI)this).targetPlayer.disableMoveInput = false; ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; PlayerControllerB targetPlayer = ((EnemyAI)this).targetPlayer; val2 = default(Vector3); targetPlayer.DamagePlayer(15, true, true, (CauseOfDeath)2, 0, false, val2); if (PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { DuskAchievementExtensions.TryTriggerAchievement(DuskModContent.Achievements, CodeRebirthAchievementKeys.TrashTrashTrash); } ((EnemyAI)this).targetPlayer = null; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(HoldingPlayerAnimation, false); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead) { return; } if (!((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) || !((Object)(object)((EnemyAI)this).targetPlayer == (Object)(object)playerWhoHit) || !((EnemyAI)this).targetPlayer.disableMoveInput) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; } if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } else if (!((Object)(object)playerWhoHit == (Object)null) && ((NetworkBehaviour)this).IsServer && ((EnemyAI)this).currentBehaviourStateIndex != 2 && ((EnemyAI)this).currentBehaviourStateIndex != 3) { if (!currentlyGrabbingPlayer && !currentlyGrabbingScrap && !currentlyThrowingPlayer) { DetectDroppedScrapServerRpc(((Component)playerWhoHit).transform.position, PlayerControllerReference.op_Implicit(playerWhoHit)); } else { ((MonoBehaviour)this).StartCoroutine(WaitUntilNotDoingAnythingCurrently(playerWhoHit)); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); StunSource.Stop(); ((EnemyAI)this).creatureVoice.PlayOneShot(deathSounds[enemyRandom.Next(deathSounds.Length)]); currentlyThrowingPlayer = false; currentlyGrabbingPlayer = false; currentlyGrabbingScrap = false; _targetScrap = null; _targetTrashCan = null; if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { ((EnemyAI)this).targetPlayer.inAnimationWithEnemy = null; ((EnemyAI)this).targetPlayer.disableMoveInput = false; } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4); foreach (GrabbableObject item in _storedScrap) { if (!((Object)(object)item == (Object)null)) { item.EnableItemMeshes(true); item.EnablePhysics(true); item.grabbable = true; item.grabbableToEnemies = true; item.isHeldByEnemy = false; item.isHeld = false; if (!HoarderBugAI.grabbableObjectsInMap.Contains(((Component)item).gameObject)) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)item).gameObject); } } } _storedScrap.Clear(); _targetScrap = null; ((EnemyAI)this).creatureSFX.volume = 0f; sirenLights.SetActive(false); ((EnemyAI)this).skinnedMeshRenderers[0].SetBlendShapeWeight(0, 0f); GameObject[] array = headLights; foreach (GameObject val in array) { val.SetActive(false); } ((EnemyAI)this).creatureVoice.pitch = 0.75f; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(HoldingPlayerAnimation, false); ((EnemyAI)this).creatureAnimator.SetFloat(LeftTreadFloat, 0f); ((EnemyAI)this).creatureAnimator.SetFloat(RightTreadFloat, 0f); ((EnemyAI)this).creatureAnimator.SetBool(IsAngryAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimation, true); } } private void HandleIdleSoundTimer() { _idleTimer -= Time.deltaTime; if (!(_idleTimer > 0f)) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); AudioClip val = (AudioClip)(((EnemyAI)this).isEnemyDead ? ((object)postDeathSounds[enemyRandom.Next(postDeathSounds.Length)]) : ((object)_idleAudioClips.audioClips[enemyRandom.Next(_idleAudioClips.audioClips.Length)])); ((EnemyAI)this).creatureVoice.PlayOneShot(val); } } private void KeepPlayerAttachedDuringZoom() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || !((EnemyAI)this).targetPlayer.isPlayerControlled) { ((EnemyAI)this).targetPlayer = null; sirenLights.SetActive(false); _targetScrap = null; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); ((EnemyAI)this).skinnedMeshRenderers[0].SetBlendShapeWeight(0, 0f); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 7.5f; ((EnemyAI)this).creatureAnimator.SetBool(HoldingPlayerAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(IsAngryAnimation, false); } } else { ((Component)((EnemyAI)this).targetPlayer).transform.position = playerBoneTransform.position; ((Component)((EnemyAI)this).targetPlayer).transform.rotation = playerBoneTransform.rotation; } } internal void CalculateAndSetNewPath(Vector3 targetPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 NavMeshPath val = new NavMeshPath(); ((EnemyAI)this).agent.CalculatePath(targetPosition, val); if (val.corners.Length != 0 && (int)val.status <= 0) { SetPathAsDestination(val); } } private void SetPathAsDestination(NavMeshPath navMeshPath) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).agent.ResetPath(); ((EnemyAI)this).agent.SetPath(navMeshPath); _pathCorners = navMeshPath.corners; _currentCornerIndex = 0; if (ReachedCurrentCorner()) { BeginRotation(); } else { smartAgentNavigator.DoPathingToDestination(_pathCorners[_currentCornerIndex]); } } private float DoCalculatePathDistance(NavMeshPath path) { //IL_0025: 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) float num = 0f; if (path.corners.Length > 1) { for (int i = 1; i < path.corners.Length; i++) { float num2 = Vector3.Distance(path.corners[i - 1], path.corners[i]); num += num2; } } return num; } private bool IsPathValid() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 return _currentCornerIndex < _pathCorners.Length && ((EnemyAI)this).agent.path != null && ((EnemyAI)this).agent.path.corners.Length != 0 && (int)((EnemyAI)this).agent.path.status == 0; } private bool ReachedCurrentCorner() { //IL_0007: 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) float num = Vector3.Distance(((Component)this).transform.position, _pathCorners[_currentCornerIndex]); return num <= 0.35f; } private bool IsAtFinalCorner() { return _currentCornerIndex == _pathCorners.Length - 1; } private bool IsScrapStillValid() { return IsPathValid() && (Object)(object)_targetScrap != (Object)null && !_targetScrap.isHeld && !_targetScrap.isHeldByEnemy && (Object)(object)_targetScrap.playerHeldBy == (Object)null; } private void TryGrabScrap() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_targetScrap == (Object)null) && !currentlyGrabbingScrap) { currentlyGrabbingScrap = true; SetTargetScrapUngrabbableServerRpc(new NetworkObjectReference(((Component)_targetScrap).gameObject)); } } private void ResetChaseAndRevertToIdle() { ((EnemyAI)this).agent.ResetPath(); ((EnemyAI)this).targetPlayer = null; _targetScrap = null; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); ((EnemyAI)this).agent.speed = 7.5f; ((EnemyAI)this).creatureAnimator.SetBool(IsAngryAnimation, false); SetBlendShapeWeightServerRpc(0); } private void UpdatePathToTargetPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)((EnemyAI)this).targetPlayer).transform.position, ref val, 1.5f, -1)) { CalculateAndSetNewPath(((NavMeshHit)(ref val)).position); } } private bool IsPlayerInRange() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position); Vector3 val = ((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = Vector3.Dot(((Component)this).transform.forward, normalized); return num <= ((EnemyAI)this).agent.stoppingDistance + 2f && num2 > 0.25f; } private void StartGrabPlayer() { currentlyGrabbingPlayer = true; int playerImmovableServerRpc = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer); SetPlayerImmovableServerRpc(playerImmovableServerRpc); } private bool IsPlayerTooFarFromFinalCorner() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, _pathCorners[^1]); return num > 3f && _currentCornerIndex != 0; } private bool TryFindAnyValidTrashCan() { //IL_0033: 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) List<(TrashCan, NavMeshPath)> list = new List<(TrashCan, NavMeshPath)>(); NavMeshHit val = default(NavMeshHit); foreach (TrashCan trashCan in trashCans) { if (!((Object)(object)trashCan == (Object)null)) { NavMesh.SamplePosition(((Component)trashCan).transform.position, ref val, 5f, -1); if (ObjectIsPathable(((NavMeshHit)(ref val)).position, 500f, out NavMeshPath path)) { list.Add((trashCan, path)); } } } Plugin.ExtendedLogging($"Found {list.Count} viable trash cans"); if (list.Count > 0) { (TrashCan, NavMeshPath) tuple = list[Random.Range(0, list.Count)]; TrashCan item = tuple.Item1; NavMeshPath item2 = tuple.Item2; _targetTrashCan = item; SetPathAsDestination(item2); return true; } return false; } private void TriggerPlayerThrowAnimation() { currentlyThrowingPlayer = true; creatureNetworkAnimator.SetTrigger(ThrowPlayerAnimation, true); } private IEnumerator PlaceScrapInsideJanitor(GrabbableObject scrap) { scrap.parentObject = handTransform; scrap.isHeldByEnemy = true; scrap.hasHitGround = false; scrap.EnablePhysics(false); yield return (object)new WaitForSeconds(0.2f); scrap.isInElevator = false; scrap.isInShipRoom = false; PlayerControllerB playerHeldBy = scrap.playerHeldBy; if (playerHeldBy != null) { playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } yield return (object)new WaitForSeconds(0.2f); _lastScrapGrabbed = scrap; _storedScrap.Add(scrap); scrap.parentObject = placeToHideScrap; ((Component)scrap).transform.position = placeToHideScrap.position; scrap.EnableItemMeshes(false); ResetToIdle(); currentlyGrabbingScrap = false; } [ServerRpc(RequireOwnership = false)] private void ResetToIdleServerRpc() { ResetToIdleClientRpc(); } [ClientRpc] private void ResetToIdleClientRpc() { ResetToIdle(); } private void ResetToIdle() { smartAgentNavigator.StopAgent(); _targetScrap = null; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); } private void SwitchToChaseState(PlayerControllerB player) { sirenLights.SetActive(true); _targetScrap = null; ((EnemyAI)this).targetPlayer = player; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); ((EnemyAI)this).skinnedMeshRenderers[0].SetBlendShapeWeight(0, 100f); smartAgentNavigator.StopAgent(); UpdatePathToTargetPlayer(); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).agent.speed = 15f; ((EnemyAI)this).creatureAnimator.SetBool(IsAngryAnimation, true); } } private void TryFindScrapNearby() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 15f, _hitColliders, MoreLayerMasks.PropsMask, (QueryTriggerInteraction)2); GrabbableObject val = default(GrabbableObject); for (int i = 0; i < num; i++) { if (!((Component)_hitColliders[i]).TryGetComponent(ref val) || val.isInShipRoom || val.isHeld || val.isHeldByEnemy || (Object)(object)val.playerHeldBy != (Object)null || _storedScrap.Contains(val)) { continue; } bool flag = false; foreach (Janitor janitor in janitors) { if ((Object)(object)janitor._targetScrap == (Object)(object)val) { flag = true; break; } } if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent())) { flag = true; } if (!flag && ObjectIsPathable(((Component)val).transform.position, 12.5f, out NavMeshPath path)) { _targetScrap = val; SetPathAsDestination(path); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); break; } } } private bool ObjectIsPathable(Vector3 position, float maxPathLength, out NavMeshPath path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 path = new NavMeshPath(); if (!((EnemyAI)this).agent.CalculatePath(position, path)) { return false; } if ((int)path.status > 0) { return false; } if (DoCalculatePathDistance(path) > maxPathLength) { return false; } return true; } private void UpdateBlendShapeAndSpeedForChase() { SetBlendShapeWeightClientRpc(100); ((EnemyAI)this).agent.speed = 15f; ((EnemyAI)this).creatureAnimator.SetBool(IsAngryAnimation, true); ((EnemyAI)this).agent.ResetPath(); _targetScrap = null; } } public class MilitaryPlane : NetworkBehaviour { private Vector3 dropPosition = Vector3.zero; private Vector3 explodePosition = Vector3.zero; private static int militaryPlaneCount; private bool exploded = false; private bool droppedBoxChute = false; [field: SerializeField] public GameObject ExplosionPrefab { get; private set; } = null; [field: SerializeField] public GameObject BoxChutePrefab { get; private set; } = null; [field: SerializeField] public float FlyingSpeed { get; private set; } = 25f; [field: SerializeField] public AudioSource AudioSource { get; private set; } = null; [field: SerializeField] public AudioSource EngineAudioSource { get; private set; } = null; [field: SerializeField] public AudioClip AmbientFlyingSound { get; private set; } = null; [field: SerializeField] public AudioClip WarningSirenSound { get; private set; } = null; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnStartNewRound)); } public void OnStartNewRound() { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: 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_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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) militaryPlaneCount++; AudioSource.PlayOneShot(WarningSirenSound); EngineAudioSource.PlayOneShot(AmbientFlyingSound); Random random = new Random(StartOfRound.Instance.randomMapSeed + 12345 + militaryPlaneCount); if (RoundManager.Instance.outsideAINodes == null) { RoundManager.Instance.outsideAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } List list = RoundManager.Instance.outsideAINodes.OrderBy((GameObject x) => Vector3.Distance(x.transform.position, StartOfRound.Instance.shipLandingPosition.position)).ToList(); if (list.Count == 0) { Plugin.Logger.LogError((object)"No outside AI nodes found for military plane to spawn at!"); return; } List list2 = list.Where((GameObject x) => Vector3.Distance(x.transform.position, StartOfRound.Instance.shipLandingPosition.position) > 40f).ToList(); GameObject val = list2[random.Next(0, list2.Count)]; float num = Vector3.Distance(val.transform.position, StartOfRound.Instance.shipLandingPosition.position); ((Component)this).transform.position = val.transform.position + Vector3.up * RandomExtensions.NextFloat(random, 200f, 250f); ((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, Mathf.Clamp(((Component)this).transform.position.y, -2.1474836E+09f, StartOfRound.Instance.shipLandingPosition.position.y + 250f), ((Component)this).transform.position.z); ((Component)this).transform.LookAt(StartOfRound.Instance.shipLandingPosition); Transform transform = ((Component)this).transform; Quaternion rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f); Transform transform2 = ((Component)this).transform; transform2.position -= ((Component)this).transform.forward * 100f; Vector3 position = StartOfRound.Instance.shipLandingPosition.position; position.y = ((Component)this).transform.position.y; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val2, num, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { explodePosition = ((RaycastHit)(ref val2)).point; dropPosition = ((Component)this).transform.position + ((Component)this).transform.forward * (Vector3.Distance(((RaycastHit)(ref val2)).point, ((Component)this).transform.position) / 2f); Plugin.ExtendedLogging($"Calculated drop position for military plane: {dropPosition} based on raycast hit with {((Object)((RaycastHit)(ref val2)).collider).name} (Explosion related)"); return; } if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val2, 300f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { explodePosition = ((RaycastHit)(ref val2)).point; Plugin.ExtendedLogging($"Calculated explosion position for military plane: {explodePosition} based on raycast hit with {((Object)((RaycastHit)(ref val2)).collider).name} (Explosion related)"); } float num2 = RandomExtensions.NextFloat(random, 20f, 30f) * (float)RandomExtensions.NextSign(random); Vector3 val3 = ((Component)this).transform.position - position; Vector3 normalized = ((Vector3)(ref val3)).normalized; dropPosition = position + normalized * num2; Plugin.ExtendedLogging("Military plane failed to calculate drop position based on raycast, defaulting to ship landing position"); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); militaryPlaneCount--; } public void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * Time.deltaTime * FlyingSpeed; Vector3 forward = ((Component)this).transform.forward; Vector3 val = dropPosition - ((Component)this).transform.position; float num = Vector3.Dot(forward, ((Vector3)(ref val)).normalized); Plugin.ExtendedLogging($"Military plane position: {((Component)this).transform.position} | drop position: {dropPosition} | dot: {num} | exploded: {exploded} | droppedBoxChute: {droppedBoxChute}"); if (!droppedBoxChute && num < 0f && dropPosition != Vector3.zero) { GameObject val2 = Object.Instantiate(BoxChutePrefab, dropPosition, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); BoxChute component = val2.GetComponent(); component.SetupBoxChute(); droppedBoxChute = true; } if (!exploded && Vector3.Distance(((Component)this).transform.position, explodePosition) <= 0.5f) { exploded = true; CRUtilities.CreateExplosion(explodePosition, spawnExplosionEffect: true, 100, 0f, 100f, 100, null, ExplosionPrefab, 200f); if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } } public class Mistress : CodeRebirthEnemyAI { public enum State { Spawning, Stalking, Attack, Execution } public float teleportCooldown = 20f; public float killCooldown = 10f; public Transform HeadTransform = null; public AudioClip LoseSightSound = null; public AudioClip[] AttackSounds = null; public AnimationCurve BlackOutAnimationCurve = null; private HashSet previousTargetPlayers = new HashSet(); private PlayerControllerB? playerToKill; private float teleporterTimer = 20f; private float timeSpentInState = 69f; private readonly NetworkVariable killTimerNet = new NetworkVariable(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private int localLookCount = 0; private bool serverConfirmLook = false; private float nextLookReportTime = 0f; private static readonly int DoVanishAnimation = Animator.StringToHash("doVanish"); private static readonly int IdleIntAnimation = Animator.StringToHash("idleInt"); public override void Start() { base.Start(); ((EnemyAI)this).AIIntervalTime = 0.1f; ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).enabled = false; ((MonoBehaviour)this).StartCoroutine(ResetMistressToStalking(null)); } public override void Update() { base.Update(); if (((NetworkBehaviour)this).IsServer) { UpdateServerAuthoritative(); } UpdateLocalTargetClient(); if (killTimerNet.Value >= killCooldown) { if (((NetworkBehaviour)this).IsServer) { killTimerNet.Value = 0f; } playerToKill = ((EnemyAI)this).targetPlayer; playerToKill.inSpecialInteractAnimation = false; playerToKill.shockingTarget = null; playerToKill.inShockingMinigame = false; playerToKill.disableLookInput = false; Plugin.ExtendedLogging($"Executing player so please work please please {playerToKill}"); ((MonoBehaviour)this).StartCoroutine(ResetVolumeWeightTo0(playerToKill)); ((MonoBehaviour)this).StartCoroutine(InitiateKillingSequence(playerToKill)); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); } else { UpdateFacing(); } } private void UpdateFacing() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && !((Object)(object)((EnemyAI)this).targetPlayer == (Object)null)) { Vector3 val = ((Component)((EnemyAI)this).targetPlayer.gameplayCamera).transform.position - ((Component)this).transform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); } } } private void UpdateServerAuthoritative() { if (StartOfRound.Instance.allPlayersDead || ((EnemyAI)this).isEnemyDead || (Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { return; } if (((EnemyAI)this).currentBehaviourStateIndex == 2 && StartOfRound.Instance.shipIsLeaving) { if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { ResetMistressStalkingServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer)); ((EnemyAI)this).targetPlayer = null; } return; } if (((EnemyAI)this).targetPlayer.isPlayerDead) { ((MonoBehaviour)this).StartCoroutine(ResetMistressToStalking(((EnemyAI)this).targetPlayer)); return; } if (((EnemyAI)this).currentBehaviourStateIndex == 1) { teleporterTimer -= Time.deltaTime; timeSpentInState -= Time.deltaTime; if (teleporterTimer <= 0f) { teleporterTimer = RandomExtensions.NextFloat(enemyRandom, teleportCooldown - 5f, teleportCooldown + 5f); TeleportRoutineServer(); return; } if (serverConfirmLook) { serverConfirmLook = false; if (timeSpentInState <= 0f) { timeSpentInState = Random.Range(50f, 80f); TemporarilyCripplePlayerServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer), cripple: true); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } else { teleporterTimer = 0f; } } } if (((EnemyAI)this).currentBehaviourStateIndex == 2) { if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { killTimerNet.Value = 0f; return; } NetworkVariable obj = killTimerNet; obj.Value += Time.deltaTime; } else if (killTimerNet.Value != 0f) { killTimerNet.Value = 0f; } } private void TeleportRoutineServer() { //IL_0009: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) SyncRendererMistressClientRpc(); Vector3 val = ChooseNewTeleportPoint(); if (val == Vector3.zero) { Plugin.Logger.LogError((object)"Could not find a good teleport position"); teleporterTimer = 0f; } else { Plugin.ExtendedLogging($"Teleporting to: {val}"); ((EnemyAI)this).creatureAnimator.SetInteger(IdleIntAnimation, Random.Range(0, 3)); ((EnemyAI)this).agent.Warp(val); } } private void UpdateLocalTargetClient() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { return; } if (((EnemyAI)this).currentBehaviourStateIndex == 2 && (Object)(object)playerToKill == (Object)null) { ((EnemyAI)this).targetPlayer.JumpToFearLevel(0.7f, true); float num = Mathf.Clamp01(killTimerNet.Value / killCooldown); CodeRebirthUtils.Instance.CloseEyeVolume.weight = BlackOutAnimationCurve.Evaluate(num); } bool flag = ((EnemyAI)this).targetPlayer.HasLineOfSightToPosition(HeadTransform.position, 45f, 50, -1f, -1) && !((EnemyAI)this).targetPlayer.inVehicleAnimation; if (((EnemyAI)this).currentBehaviourStateIndex == 1) { localLookCount = (flag ? (localLookCount + 1) : 0); if (localLookCount >= 20) { localLookCount = 0; ConfirmLookThresholdServerRpc(); } } else if (((EnemyAI)this).currentBehaviourStateIndex == 2) { localLookCount = Mathf.Clamp(localLookCount + (flag ? 1 : (-1)), -10, 0); if (localLookCount <= -10) { localLookCount = 0; ResetMistressStalkingServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer)); } } else { localLookCount = 0; } } private void TryReportLookStateToServer(bool lookedAtEnemy) { if (!(Time.unscaledTime < nextLookReportTime)) { nextLookReportTime = Time.unscaledTime + 0.16f; ReportLookStateServerRpc(lookedAtEnemy); } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || StartOfRound.Instance.allPlayersDead || ((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).targetPlayer.isPlayerDead) { ((MonoBehaviour)this).StartCoroutine(ResetMistressToStalking(((EnemyAI)this).targetPlayer)); return; } switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: break; case 1: DoStalking(); break; case 2: DoAttack(); break; case 3: DoExecution(); break; } } private void DoStalking() { } private void DoAttack() { } private void DoExecution() { } private IEnumerator InitiateKillingSequence(PlayerControllerB playerToExecute) { yield return null; RaycastHit hit = default(RaycastHit); Physics.Raycast(Vector3.zero + Vector3.up * 50f, Vector3.down, ref hit, 100f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1); if (playerToExecute.isInsideFactory && PlayerControllerBExtensions.IsLocalPlayer(playerToExecute)) { EntranceTeleport entrance = ((IEnumerable)CodeRebirthUtils.EntrancePoints).FirstOrDefault((Func)((EntranceTeleport e) => !e.isEntranceToBuilding)); if (entrance != null) { entrance.TeleportPlayer(); } } playerToExecute.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); if (((NetworkBehaviour)this).IsServer) { GameObject guillotineGO = Object.Instantiate(ContentHandler.Instance.Mistress.GuillotinePrefab, ((RaycastHit)(ref hit)).point, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform); NetworkObject netObj = guillotineGO.GetComponent(); netObj.Spawn(false); Guillotine guillotine = guillotineGO.GetComponent(); yield return (object)new WaitUntil((Func)(() => netObj.IsSpawned)); guillotine.SyncGuillotineServerRpc(PlayerControllerReference.op_Implicit(playerToExecute), new NetworkBehaviourReference((NetworkBehaviour)(object)this)); yield return (object)new WaitUntil((Func)(() => guillotine.sequenceFinished)); ((MonoBehaviour)this).StartCoroutine(ResetMistressToStalking(playerToExecute)); yield return (object)new WaitForSeconds(20f); ((NetworkBehaviour)guillotine).NetworkObject.Despawn(true); } } private IEnumerator ResetMistressToStalking(PlayerControllerB? lastTargetPlayer) { Plugin.ExtendedLogging("Resetting mistress to stalking phase!"); if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { previousTargetPlayers.Add(((EnemyAI)this).targetPlayer); ((EnemyAI)this).targetPlayer = null; } playerToKill = null; localLookCount = 0; serverConfirmLook = false; if (((NetworkBehaviour)this).IsServer) { killTimerNet.Value = 0f; PlayVanishClientRpc(); yield return (object)new WaitForSeconds(1f); if ((Object)(object)lastTargetPlayer != (Object)null) { TemporarilyCripplePlayerServerRpc(PlayerControllerReference.op_Implicit(lastTargetPlayer), cripple: false); } else if (((EnemyAI)this).currentBehaviourStateIndex != 0) { Plugin.Logger.LogError((object)("Target player was not supposed to be null with this state: " + ((EnemyAI)this).currentBehaviourStateIndex)); } ((EnemyAI)this).SwitchToBehaviourServerRpc(0); teleporterTimer = 0f; yield return (object)new WaitForSeconds(20f); timeSpentInState = Random.Range(50f, 80f); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); PickATargetPlayer(); } } private Vector3 ChooseNewTeleportPoint() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { return Vector3.zero; } Vector3 val = default(Vector3); NavMeshHit val3 = default(NavMeshHit); for (int i = 0; i < 10; i++) { ((Vector3)(ref val))..ctor(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f)); if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { ((Vector3)(ref val)).Normalize(); float num = Random.Range(10f, 30f); Vector3 val2 = ((Component)((EnemyAI)this).targetPlayer).transform.position + val * num; val2.y += Random.Range(-3f, 3f); if (NavMesh.SamplePosition(val2, ref val3, 10f, -1)) { return ((NavMeshHit)(ref val3)).position; } } } return Vector3.zero; } private void PickATargetPlayer() { if (!((NetworkBehaviour)this).IsServer) { return; } Dictionary dictionary = new Dictionary(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !val.isPlayerDead && val.isPlayerControlled && !val.IsPseudoDead()) { int num = 0; if (previousTargetPlayers.Contains(val)) { num += 200; } if (val.isInsideFactory) { num++; } if (val.isPlayerAlone) { num++; } dictionary[val] = num; } } if (dictionary.Count == 0) { Plugin.Logger.LogError((object)"Mistress target selection found no valid players. Aborting."); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } foreach (GalAI instance in GalAI.Instances) { if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.ownerPlayer == (Object)null) && !instance.ownerPlayer.isPlayerDead && instance.ownerPlayer.isPlayerControlled && !instance.ownerPlayer.IsPseudoDead() && dictionary.ContainsKey(instance.ownerPlayer)) { dictionary[instance.ownerPlayer]++; } } int maxPriority = dictionary.Values.Max(); List list = (from kvp in dictionary where kvp.Value == maxPriority select kvp.Key).ToList(); PlayerControllerB val2 = list[Random.Range(0, list.Count)]; SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val2)); } private IEnumerator ResetVolumeWeightTo0(PlayerControllerB player) { if (PlayerControllerBExtensions.IsLocalPlayer(player)) { Volume closeEyeVolume = CodeRebirthUtils.Instance.CloseEyeVolume; while (closeEyeVolume.weight > 0f) { yield return null; closeEyeVolume.weight = Mathf.MoveTowards(closeEyeVolume.weight, 0f, Time.deltaTime * 0.5f); } } } private IEnumerator UnHideMistress() { yield return (object)new WaitForSeconds(1f); ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).enabled = true; } [ServerRpc(RequireOwnership = false)] private void ReportLookStateServerRpc(bool lookedAtEnemy) { } [ServerRpc(RequireOwnership = false)] private void ConfirmLookThresholdServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) && ((EnemyAI)this).currentBehaviourStateIndex == 1) { serverConfirmLook = true; } } [ServerRpc(RequireOwnership = false)] private void ResetMistressStalkingServerRpc(PlayerControllerReference playerRef) { ResetMistressStalkingClientRpc(playerRef); } [ClientRpc] private void ResetMistressStalkingClientRpc(PlayerControllerReference playerRef) { ((MonoBehaviour)this).StartCoroutine(ResetMistressToStalking(PlayerControllerReference.op_Implicit(playerRef))); } [ClientRpc] private void SyncRendererMistressClientRpc() { if (((EnemyAI)this).skinnedMeshRenderers != null && ((EnemyAI)this).skinnedMeshRenderers.Length != 0) { ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).enabled = false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)((EnemyAI)this).targetPlayer) { ((MonoBehaviour)this).StartCoroutine(UnHideMistress()); } } [ClientRpc] private void PlayVanishClientRpc() { creatureNetworkAnimator.SetTrigger(DoVanishAnimation, true); } [ServerRpc(RequireOwnership = false)] private void TemporarilyCripplePlayerServerRpc(PlayerControllerReference playerReference, bool cripple) { TemporarilyCripplePlayerClientRpc(playerReference, cripple); } [ClientRpc] private void TemporarilyCripplePlayerClientRpc(PlayerControllerReference playerReference, bool cripple) { PlayerControllerB val = PlayerControllerReference.op_Implicit(playerReference); if (cripple) { if (PlayerControllerBExtensions.IsLocalPlayer(val)) { ((EnemyAI)this).creatureVoice.PlayOneShot(AttackSounds[Random.Range(0, AttackSounds.Length)]); } val.inAnimationWithEnemy = (EnemyAI)(object)this; ((EnemyAI)this).inSpecialAnimationWithPlayer = val; val.inSpecialInteractAnimation = true; val.shockingTarget = HeadTransform; val.inShockingMinigame = true; val.isMovementHindered++; val.sprintMeter = 0f; } else { if (PlayerControllerBExtensions.IsLocalPlayer(val)) { ((EnemyAI)this).creatureVoice.PlayOneShot(LoseSightSound, 0.75f); } if (((EnemyAI)this).skinnedMeshRenderers != null && ((EnemyAI)this).skinnedMeshRenderers.Length != 0) { ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).enabled = false; } val.inAnimationWithEnemy = null; ((EnemyAI)this).inSpecialAnimationWithPlayer = null; val.inSpecialInteractAnimation = false; val.shockingTarget = null; val.inShockingMinigame = false; val.isMovementHindered--; ((MonoBehaviour)this).StartCoroutine(ResetVolumeWeightTo0(val)); } val.disableLookInput = cripple; } } public class Monarch : CodeRebirthEnemyAI, IVisibleThreat { public enum MonarchState { Idle, AttackingGround, AttackingAir, Death } [SerializeField] private MonarchBeamController BeamController = null; [SerializeField] private AudioSource UltraCreatureVoice = null; [SerializeField] private AudioClip[] _biteSounds = Array.Empty(); [SerializeField] private AudioClip _stunSound = null; [SerializeField] private Transform MouthTransform = null; public static List Monarchs = new List(); private bool canAttack = true; private bool isAttacking = false; private RaycastHit[] _cachedHits = (RaycastHit[])(object)new RaycastHit[16]; private bool wasParallaxOnLastFrame = false; private ConfigEntry _parallaxWingConfig = null; private static readonly int DoAttackAnimation = Animator.StringToHash("doAttack"); private static readonly int IsFlyingAnimation = Animator.StringToHash("isFlying"); private static readonly int IsDeadAnimation = Animator.StringToHash("isDead"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int StunnedAnimation = Animator.StringToHash("Stunned"); private static readonly int ParallaxSwitch = Shader.PropertyToID("_ParallaxSwitch"); private bool currentlyStunned = false; private Vector3 _currentBeamEnd = Vector3.zero; private Collider[] _cachedColliders = (Collider[])(object)new Collider[24]; private List _iHittableList = new List(); private List _enemyAIList = new List(); private List _playerList = new List(); public ThreatType type => (ThreatType)3; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void OnNetworkSpawn() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); Monarchs.Add(this); HUDManager.Instance.ShakeCamera((ScreenShakeType)3); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); UltraCreatureVoice.Play(); if (!((NetworkBehaviour)this).IsServer) { return; } int num = RoundManager.Instance.SpawnedEnemies.Count((EnemyAI x) => (Object)(object)x != (Object)null && (Object)(object)x.enemyType == (Object)(object)((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.CutieFly].EnemyType); if (num < 15) { int num2 = Random.Range(2, 5); for (int num3 = 0; num3 <= num2; num3++) { RoundManager.Instance.SpawnEnemyGameObject(RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)this).transform.position, 30f, default(NavMeshHit)), -1f, -1, ((Registry)(object)LethalContent.Enemies)[CodeRebirthEnemyKeys.CutieFly].EnemyType); } } } public override void Start() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) base.Start(); _parallaxWingConfig = ((AssetBundleLoader)(object)ContentHandler.Instance.Monarch).GetConfig("Monarch | Parallax Wing Effect"); wasParallaxOnLastFrame = _parallaxWingConfig.Value; ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).sharedMaterials[0].SetInt(ParallaxSwitch, wasParallaxOnLastFrame ? 1 : 0); ((Component)BeamController._monarchParticle).transform.SetParent((Transform)null); ((Component)BeamController._monarchParticle).transform.position = Vector3.zero; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } } public override void Update() { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0172: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).stunNormalizedTimer > 0f && !currentlyStunned) { currentlyStunned = true; VisualEffect? monarchParticle = BeamController._monarchParticle; if (monarchParticle != null) { monarchParticle.Stop(); } ((EnemyAI)this).creatureVoice.PlayOneShot(_stunSound); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, true); } } if (currentlyStunned && ((EnemyAI)this).stunNormalizedTimer <= 0f) { currentlyStunned = false; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, false); } } if (currentlyStunned) { smartAgentNavigator.StopAgent(); return; } if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && isAttacking && ((EnemyAI)this).currentBehaviourStateIndex == 1) { Vector3 val = ((Component)((EnemyAI)this).targetPlayer.gameplayCamera).transform.position - ((Component)this).transform.position; val.y = 0f; Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); } _idleTimer -= Time.deltaTime; if (!(_idleTimer > 0f)) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(0, _idleAudioClips.audioClips.Length)]); } } public override void DoAIInterval() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!StartOfRound.Instance.allPlayersDead && !((EnemyAI)this).isEnemyDead && !currentlyStunned) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 3f); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoIdleUpdate(); break; case 1: DoAttackingGroundUpdate(); break; case 2: DoAttackingAirUpdate(); break; case 3: DoDeathUpdate(); break; } } } private void DoIdleUpdate() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a9: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled && !val.IsPseudoDead() && (!val.isInHangarShipRoom || ((EnemyAI)this).isInsidePlayerShip)) { Vector3 forward = ((Component)this).transform.forward; Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float num = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized); if (!(num < 0.2f) && !(Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > 40f)) { ((EnemyAI)this).creatureAnimator.SetBool(IsFlyingAnimation, true); smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = 10f; ((EnemyAI)this).agent.stoppingDistance = 10f; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); break; } } } } private void DoAttackingGroundUpdate() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) float distanceToClosestPlayer; PlayerControllerB val = GetClosestPlayerToMonarch(out distanceToClosestPlayer); if (((Object)(object)val == (Object)null || (val.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed && !((EnemyAI)this).isInsidePlayerShip)) && !isAttacking) { ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.stoppingDistance = 1f; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } if (distanceToClosestPlayer > 10f && !isAttacking && (Object)(object)val != (Object)null && !val.isInHangarShipRoom) { ((EnemyAI)this).agent.speed = 10f; ((EnemyAI)this).creatureAnimator.SetBool(IsFlyingAnimation, true); ((EnemyAI)this).agent.stoppingDistance = 10f; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); return; } if (isAttacking) { val = ((EnemyAI)this).targetPlayer; } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)$"closestPlayer is null, distanceToClosestPlayer: {distanceToClosestPlayer}, isAttacking: {isAttacking}, targetPlayer: {((EnemyAI)this).targetPlayer}"); return; } smartAgentNavigator.DoPathingToDestination(((Component)val).transform.position); if (canAttack && distanceToClosestPlayer <= 1.5f + ((EnemyAI)this).agent.stoppingDistance) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); ((MonoBehaviour)this).StartCoroutine(AttackCooldownTimer(1.5f)); isAttacking = true; creatureNetworkAnimator.SetTrigger(DoAttackAnimation, true); } } private void DoAttackingAirUpdate() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) float distanceToClosestPlayer; PlayerControllerB val = GetClosestPlayerToMonarch(out distanceToClosestPlayer); if (((Object)(object)val == (Object)null || (val.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed && !((EnemyAI)this).isInsidePlayerShip)) && !isAttacking) { ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.stoppingDistance = 1f; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } if (isAttacking) { val = ((EnemyAI)this).targetPlayer; } smartAgentNavigator.DoPathingToDestination(((Component)val).transform.position); if ((Object)(object)val != (Object)null && canAttack && distanceToClosestPlayer > ((EnemyAI)this).agent.stoppingDistance && distanceToClosestPlayer <= 5f + ((EnemyAI)this).agent.stoppingDistance) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); ((MonoBehaviour)this).StartCoroutine(AttackCooldownTimer(5f)); isAttacking = true; creatureNetworkAnimator.SetTrigger(DoAttackAnimation, true); } else if (!isAttacking && (distanceToClosestPlayer <= 15f || ((Object)(object)val != (Object)null && val.isInHangarShipRoom))) { ((EnemyAI)this).agent.speed = 5f; ((EnemyAI)this).creatureAnimator.SetBool(IsFlyingAnimation, false); ((EnemyAI)this).agent.stoppingDistance = 2f; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } } private void DoDeathUpdate() { } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!((EnemyAI)this).isEnemyDead) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((NetworkBehaviour)this).IsOwner && ((EnemyAI)this).enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)BeamController._monarchParticle != (Object)null) { Object.Destroy((Object)(object)((Component)BeamController._monarchParticle).gameObject); } smartAgentNavigator.StopSearchRoutine(); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimation, true); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); if (Monarchs.Contains(this)) { Monarchs.Remove(this); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)BeamController._monarchParticle != (Object)null) { Object.Destroy((Object)(object)((Component)BeamController._monarchParticle).gameObject); } if (Monarchs.Contains(this)) { Monarchs.Remove(this); } } public IEnumerator AttackCooldownTimer(float seconds) { canAttack = false; yield return (object)new WaitForSeconds(seconds); canAttack = true; } public PlayerControllerB? GetClosestPlayerToMonarch(out float distanceToClosestPlayer) { //IL_0046: 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) PlayerControllerB val = null; distanceToClosestPlayer = -1f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!val2.isPlayerDead && val2.isPlayerControlled && !val2.IsPseudoDead()) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (!(num > 50f) && ((Object)(object)val == (Object)null || num < distanceToClosestPlayer)) { val = val2; distanceToClosestPlayer = num; } } } return val; } public IEnumerator ShootingEffect() { ((EnemyAI)this).creatureSFX.PlayOneShot(BeamController._beamSound); VisualEffect? monarchParticle = BeamController._monarchParticle; if (monarchParticle != null) { monarchParticle.Play(); } float totalDuration = 3f; float damageInterval = 0.25f; _currentBeamEnd = GetDesiredBeamEnd(40f, 7.5f); BeamController.SetBeamPosition(_currentBeamEnd); while (totalDuration > 0f) { yield return null; Vector3 targetEnd = GetDesiredBeamEnd(40f, 7.5f); _currentBeamEnd = Vector3.Lerp(_currentBeamEnd, targetEnd, 5f * Time.deltaTime); BeamController.SetBeamPosition(_currentBeamEnd); if (damageInterval <= 0f) { DoHitStuff(2, _currentBeamEnd); damageInterval = 0.25f; } damageInterval -= Time.deltaTime; totalDuration -= Time.deltaTime; } ((EnemyAI)this).agent.speed = 5f; ((EnemyAI)this).targetPlayer = null; isAttacking = false; } private Vector3 GetDesiredBeamEnd(float maxRange, float followRadius) { //IL_001a: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Transform startBeamTransform = BeamController._startBeamTransform; Transform raycastDirectionBeamTransform = BeamController._raycastDirectionBeamTransform; RaycastHit val = default(RaycastHit); bool flag = Physics.Raycast(startBeamTransform.position, raycastDirectionBeamTransform.forward, ref val, maxRange, MoreLayerMasks.CollidersAndRoomAndRailingAndTerrainAndHazardAndVehicleAndDefaultMask, (QueryTriggerInteraction)1); Vector3 result = (flag ? ((RaycastHit)(ref val)).point : (startBeamTransform.position + raycastDirectionBeamTransform.forward * maxRange)); if (flag && (Object)(object)((EnemyAI)this).targetPlayer != (Object)null) { float num = Vector3.Distance(((RaycastHit)(ref val)).point, ((Component)((EnemyAI)this).targetPlayer).transform.position); if (num <= followRadius) { return ((Component)((EnemyAI)this).targetPlayer).transform.position; } } return result; } private void DoHitStuff(int damageToDeal, Vector3 startPosition) { //IL_0025: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) _iHittableList.Clear(); _enemyAIList.Clear(); _playerList.Clear(); int num = Physics.OverlapSphereNonAlloc(startPosition, 2f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val = default(IHittable); for (int i = 0; i < num; i++) { if (!((Component)_cachedColliders[i]).gameObject.TryGetComponent(ref val)) { continue; } EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null); if (val2 != null) { if (!_enemyAIList.Contains(val2.mainScript)) { _enemyAIList.Add(val2.mainScript); val2.mainScript.HitEnemyOnLocalClient(damageToDeal, startPosition, (PlayerControllerB)null, false, -1); } continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null); if (val3 != null) { if (!_playerList.Contains(val3)) { _playerList.Add(val3); val3.DamagePlayer(damageToDeal * 10, true, true, (CauseOfDeath)13, 0, false, default(Vector3)); } } else { _iHittableList.Add(val); } } foreach (IHittable iHittable in _iHittableList) { if (((NetworkBehaviour)this).IsOwner) { iHittable.Hit(damageToDeal, startPosition, (PlayerControllerB)null, true, -1); } } } public void GroundAttackAnimationEvent() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) int num = Physics.SphereCastNonAlloc(MouthTransform.position, 2.5f, ((Component)this).transform.up, _cachedHits, 1f, StartOfRound.Instance.playersMask, (QueryTriggerInteraction)1); PlayerControllerB val = default(PlayerControllerB); for (int i = 0; i < num; i++) { if (((Component)((RaycastHit)(ref _cachedHits[i])).collider).TryGetComponent(ref val) && ((NetworkBehaviour)val).IsOwner && !val.IsJumping()) { val.DamagePlayer(33, true, true, (CauseOfDeath)17, 7, true, default(Vector3)); } } ((EnemyAI)this).creatureSFX.PlayOneShot(_biteSounds[enemyRandom.Next(0, _biteSounds.Length)]); ((EnemyAI)this).targetPlayer = null; isAttacking = false; } public void AirAttackStartAnimEvent() { ((EnemyAI)this).agent.speed = 0.25f; ((MonoBehaviour)this).StartCoroutine(ShootingEffect()); } } public class Nancy : CodeRebirthEnemyAI { public enum NancyState { Wandering, ChasingHealTarget, HealingTarget } [Header("Audio")] [SerializeField] private AudioSource _rollingSource = null; [Header("Voicelines")] [SerializeField] private AudioClip[] _detectInjuredPlayerVoicelines = Array.Empty(); [SerializeField] private AudioClip[] _specialDetectInjuredPlayerVoicelines = Array.Empty(); [SerializeField] private ulong[] _baldPlayerSteamIds = Array.Empty(); [SerializeField] private AudioClip[] _healFailVoicelines = Array.Empty(); [Header("Sound")] [SerializeField] private AudioSource _stunSource = null; [SerializeField] private AudioSource _healDuringSource = null; private float checkLengthTimer = 2f; private float checkTimer = 0f; private Vector3 playersLastPosition = Vector3.zero; private float healTimer = 1f; private float failTimer = 1f; private static readonly int HealModeAnimation = Animator.StringToHash("HealMode"); private static readonly int HealingPlayerAnimation = Animator.StringToHash("HealingPlayer"); private static readonly int FailHealAnimation = Animator.StringToHash("FailHeal"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int StunnedAnimation = Animator.StringToHash("Stunned"); private bool currentlyStunned = false; public override void Start() { base.Start(); smartAgentNavigator.StartSearchRoutine(30f); } public override void Update() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).stunNormalizedTimer > 0f && !currentlyStunned) { _stunSource.Play(); _healDuringSource.Stop(); currentlyStunned = true; playersLastPosition = new Vector3(3000f, 3000f, 3000f); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, true); } } if (currentlyStunned && ((EnemyAI)this).stunNormalizedTimer <= 0f) { _stunSource.Stop(); currentlyStunned = false; playersLastPosition = new Vector3(3000f, 3000f, 3000f); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, false); } } if (currentlyStunned) { smartAgentNavigator.StopAgent(); return; } _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { PlayVoiceline(_idleAudioClips.audioClips); _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); } _rollingSource.volume = (((double)((EnemyAI)this).creatureAnimator.GetFloat(RunSpeedFloat) > 0.01) ? 1 : 0); checkTimer -= Time.deltaTime; if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null || ((EnemyAI)this).currentBehaviourStateIndex != 0 || checkTimer > 0f) { return; } checkTimer = checkLengthTimer; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isPlayerDead || !localPlayerController.isPlayerControlled || localPlayerController.health >= 100 || (localPlayerController.isInsideFactory && ((EnemyAI)this).isOutside) || (!((EnemyAI)this).isOutside && !localPlayerController.isInsideFactory)) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (!(num > 30f)) { float num2 = smartAgentNavigator.CanPathToPoint(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num2 != 0f && !(num2 > 20f)) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(localPlayerController)); DoBoolAnimationServerRpc(HealModeAnimation, value: true); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } } } public override void DoAIInterval() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.allPlayersDead || ((EnemyAI)this).isEnemyDead || currentlyStunned) { return; } failTimer -= ((EnemyAI)this).AIIntervalTime; Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude); if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && ((EnemyAI)this).targetPlayer.isPlayerDead) { ((EnemyAI)this).creatureAnimator.SetBool(HealModeAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(HealingPlayerAnimation, false); ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(30f); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoWandering(); break; case 1: DoChasingHealTarget(); break; case 2: DoHealingTarget(); break; } } public void DoWandering() { } public void DoChasingHealTarget() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position); if (num > 35f) { ((EnemyAI)this).creatureAnimator.SetBool(HealModeAnimation, false); ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(30f); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); if (Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) <= ((EnemyAI)this).agent.stoppingDistance) { CrippleTargetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer)); StartHealingPlayerServerRpc(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); playersLastPosition = ((Component)((EnemyAI)this).targetPlayer).transform.position; ((EnemyAI)this).agent.velocity = Vector3.zero; ((EnemyAI)this).creatureAnimator.SetBool(HealingPlayerAnimation, true); } } public void DoHealingTarget() { //IL_001a: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) healTimer -= ((EnemyAI)this).AIIntervalTime; float num = Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position); int health = ((EnemyAI)this).targetPlayer.health; if (health >= 100) { StopHealSourceServerRpc(); ((EnemyAI)this).creatureAnimator.SetBool(HealModeAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(HealingPlayerAnimation, false); ClearPlayerTargetServerRpc(); smartAgentNavigator.StartSearchRoutine(30f); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); return; } float num2 = Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, playersLastPosition); playersLastPosition = ((Component)((EnemyAI)this).targetPlayer).transform.position; Plugin.ExtendedLogging($"Distance from last AI interval: {num2}"); if (num2 > 0.25f && num2 <= 20f && failTimer <= 0f) { failTimer = 1f; creatureNetworkAnimator.SetTrigger(FailHealAnimation, true); if (PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { ((EnemyAI)this).targetPlayer.DamagePlayer(20, true, true, (CauseOfDeath)14, 0, false, default(Vector3)); } else { CodeRebirthUtils.Instance.DamagePlayerOnOwnerServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer), 20, hasDamageSFX: true, 14, 0, fallDamage: false, default(Vector3)); } } else if (health < 100 && healTimer <= 0f) { healTimer = 1f; if (PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { ((EnemyAI)this).targetPlayer.DamagePlayer(-10, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); } else { CodeRebirthUtils.Instance.DamagePlayerOnOwnerServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer), -10, hasDamageSFX: false, 0, 0, fallDamage: false, default(Vector3)); } } if (num > 35f) { ((EnemyAI)this).creatureAnimator.SetBool(HealModeAnimation, false); ((EnemyAI)this).creatureAnimator.SetBool(HealingPlayerAnimation, false); ClearPlayerTargetServerRpc(); StopHealSourceServerRpc(); smartAgentNavigator.StartSearchRoutine(30f); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); } else if (num > 2.5f) { ((EnemyAI)this).creatureAnimator.SetBool(HealingPlayerAnimation, false); StopHealSourceServerRpc(); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } } [ServerRpc(RequireOwnership = false)] private void StopHealSourceServerRpc() { StopHealSourceClientRpc(); } [ClientRpc] private void StopHealSourceClientRpc() { _healDuringSource.Stop(); } [ServerRpc(RequireOwnership = false)] private void StartHealingPlayerServerRpc() { StartHealingPlayerClientRpc(); } [ClientRpc] private void StartHealingPlayerClientRpc() { _healDuringSource.Play(); } [ServerRpc(RequireOwnership = false)] private void HealPlayerSuccessServerRpc() { HealPlayerSuccessClientRpc(); } [ClientRpc] private void HealPlayerSuccessClientRpc() { } [ServerRpc(RequireOwnership = false)] private void DoBoolAnimationServerRpc(int animationHash, bool value) { ((EnemyAI)this).creatureAnimator.SetBool(animationHash, value); } [ServerRpc(RequireOwnership = false)] private void CrippleTargetServerRpc(int playerIndex) { CrippleTargetClientRpc(playerIndex); } [ClientRpc] private void CrippleTargetClientRpc(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; val.disableMoveInput = true; ((MonoBehaviour)this).StartCoroutine(ReEnableMoveInput(val)); } private IEnumerator ReEnableMoveInput(PlayerControllerB player) { yield return (object)new WaitForSeconds(0.15f); player.disableMoveInput = false; } private void PlayVoiceline(AudioClip[] voicelines) { ((EnemyAI)this).creatureVoice.Stop(); AudioClip clip = voicelines[enemyRandom.Next(voicelines.Length)]; ((EnemyAI)this).creatureVoice.clip = clip; ((EnemyAI)this).creatureVoice.Play(); } public void FailHealAnimationEvent() { PlayVoiceline(_healFailVoicelines); } public void DetectPlayerAnimationEvent() { if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && _baldPlayerSteamIds.Contains(((EnemyAI)this).targetPlayer.playerSteamId)) { PlayVoiceline(_specialDetectInjuredPlayerVoicelines); } else { PlayVoiceline(_detectInjuredPlayerVoicelines); } } public void EndHealingAnimationEvent() { _healDuringSource.Stop(); } } public class PeaceKeeper : CodeRebirthEnemyAI, IVisibleThreat { public enum PeaceKeeperState { Idle, FollowPlayer, AttackingPlayer } [SerializeField] private Transform _gunStartTransform = null; [SerializeField] private Transform _gunEndTransform = null; [Header("Movement")] [SerializeField] internal float _walkingSpeed = 2f; [SerializeField] internal float _chasingSpeed = 5f; [SerializeField] internal float _shootingSpeed = 0.1f; [Header("Visuals")] [SerializeField] internal GameObject _gunParticleSystemGO = null; [SerializeField] private GameObject _fakeGunGO = null; [SerializeField] private List _ammoParticles = new List(); [Header("Audio")] [SerializeField] private AudioSource _treadsSource = null; [SerializeField] private AudioSource _aggroSFX = null; [SerializeField] private AudioClip _revUpSound = null; [SerializeField] private AudioClip _revDownSound = null; [SerializeField] private AudioClip _bitchSlapSound = null; [SerializeField] private AudioClip _bitchSlapStartSound = null; private Vector3 _lastPosition = Vector3.zero; private List _materials = new List(); private float _backOffTimer = 0f; private bool _isShooting = false; private bool _killedByPlayer = false; internal float _damageInterval = 0f; private Coroutine? _bitchSlappingRoutine = null; private Coroutine? _rotatingToHitter = null; private Collider[] _cachedColliders = (Collider[])(object)new Collider[30]; private static readonly int ShootingAnimation = Animator.StringToHash("shooting"); private static readonly int IsDeadAnimation = Animator.StringToHash("isDead"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int BitchSlapAnimation = Animator.StringToHash("bitchSlap"); private static readonly int StunAnimation = Animator.StringToHash("stun"); internal static readonly int ScrollSpeedID = Shader.PropertyToID("_ScrollSpeed"); public static List Instances = new List(); [Header("Gatling Gun")] [SerializeField] private float _gatlingDamageInterval = 0.21f; [SerializeField] private float _minigunRange = 30f; [SerializeField] private float _minigunWidth = 1f; [SerializeField] private int _minigunDamage = 5; [SerializeField] private Transform _leftGunStartTransform = null; [SerializeField] private Transform _rightGunStartTransform = null; public ThreatType type => (ThreatType)6; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Instances.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Instances.Remove(this); } public override void Start() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) base.Start(); _lastPosition = ((Component)this).transform.position; _materials.Add(((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).materials[2]); _materials.Add(((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).materials[3]); if (((NetworkBehaviour)this).IsServer) { HandleSwitchingToIdle(); } } public override void Update() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } if (((EnemyAI)this).stunNormalizedTimer > 0f) { smartAgentNavigator.StopAgent(); ((EnemyAI)this).creatureAnimator.SetTrigger(StunAnimation); ((EnemyAI)this).stunNormalizedTimer = 0f; } _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(0, _idleAudioClips.audioClips.Length)]); } if (!_aggroSFX.isPlaying && ((EnemyAI)this).currentBehaviourStateIndex == 2) { _aggroSFX.Play(); } else if (_aggroSFX.isPlaying && ((EnemyAI)this).currentBehaviourStateIndex != 2) { _aggroSFX.Stop(); } Vector3 val = _lastPosition - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; _materials[0].SetVector(ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, 0f - magnitude, 0f))); _materials[1].SetVector(ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, magnitude, 0f))); if (magnitude > 0f) { _treadsSource.volume = 1f; } else { _treadsSource.volume = 0f; } _lastPosition = ((Component)this).transform.position; if (_bitchSlappingRoutine != null && _rotatingToHitter == null) { if (((NetworkBehaviour)this).IsServer) { RotateTowardsNearestPlayer(); } } else if (_isShooting && _gunParticleSystemGO.activeSelf) { DoGatlingGunDamage(); } } public override void DoAIInterval() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead) { Vector3 velocity = ((EnemyAI)this).agent.velocity; float num = ((Vector3)(ref velocity)).magnitude / 3f; ((EnemyAI)this).creatureAnimator.SetFloat(RunSpeedFloat, num); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoIdle(); break; case 1: DoFollowPlayer(); break; case 2: DoAttackingPlayer(); break; } } } public void DoIdle() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled && !((Object)(object)val.currentlyHeldObjectServer == (Object)null) && val.currentlyHeldObjectServer.itemProperties.isDefensiveWeapon && EnemySeesPlayer(val, 0f)) { smartAgentNavigator.StopSearchRoutine(); SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); smartAgentNavigator.DoPathingToDestination(((Component)val).transform.position); Plugin.ExtendedLogging("Player spotted holding weapon: " + ((Object)val).name); break; } } } public void DoFollowPlayer() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead) { HandleSwitchingToIdle(); return; } if ((Object)(object)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer == (Object)null || !((EnemyAI)this).targetPlayer.currentlyHeldObjectServer.itemProperties.isDefensiveWeapon) { _backOffTimer += ((EnemyAI)this).AIIntervalTime; if (_backOffTimer > 10f) { HandleSwitchingToIdle(); return; } } else { _backOffTimer = 0f; } smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); } public void DoAttackingPlayer() { //IL_0059: 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_007a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead) { SetShootingServerRpc(isShooting: false); ((EnemyAI)this).creatureAnimator.SetBool(ShootingAnimation, false); HandleSwitchingToIdle(); return; } smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); float num = Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position); if (num > 3f) { if (!EnemySeesPlayer(((EnemyAI)this).targetPlayer, 0.6f)) { if (_isShooting) { SetShootingServerRpc(isShooting: false); ((EnemyAI)this).agent.speed = _chasingSpeed; ((EnemyAI)this).creatureAnimator.SetBool(ShootingAnimation, false); } } else if (!_isShooting) { ((EnemyAI)this).agent.speed = _shootingSpeed; SetShootingServerRpc(isShooting: true); ((EnemyAI)this).creatureAnimator.SetBool(ShootingAnimation, true); } } else { if (_isShooting) { SetShootingServerRpc(isShooting: false); ((EnemyAI)this).agent.speed = _chasingSpeed; ((EnemyAI)this).creatureAnimator.SetBool(ShootingAnimation, false); } if (_bitchSlappingRoutine == null) { _bitchSlappingRoutine = ((MonoBehaviour)this).StartCoroutine(DoBitchSlapping()); } } } [ServerRpc(RequireOwnership = false)] private void SetShootingServerRpc(bool isShooting) { SetShootingClientRpc(isShooting); } [ClientRpc] private void SetShootingClientRpc(bool isShooting) { _isShooting = isShooting; } private IEnumerator RotateToTargetPlayer(PlayerControllerB player) { float timeElapsed = 0f; while (timeElapsed < 0.25f) { RotateToPlayer(player); timeElapsed += Time.deltaTime; yield return null; } _rotatingToHitter = null; } public void RotateTowardsNearestPlayer() { //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) PlayerControllerB val = null; float num = float.MaxValue; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!val2.isPlayerDead && val2.isPlayerControlled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (!(num2 > num)) { val = val2; } } } if (!((Object)(object)val == (Object)null)) { RotateToPlayer(val); } } private void RotateToPlayer(PlayerControllerB player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; val.y = 0f; Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime); } public void HandleSwitchingToIdle() { _backOffTimer = 0f; ((EnemyAI)this).agent.speed = _walkingSpeed; ClearPlayerTargetServerRpc(); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); smartAgentNavigator.StartSearchRoutine(40f); } public IEnumerator DoBitchSlapping() { ((EnemyAI)this).creatureAnimator.SetTrigger(BitchSlapAnimation); yield return (object)new WaitForSeconds(2f); _bitchSlappingRoutine = null; } public void DoGatlingGunDamage() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0158: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) if (_damageInterval < _gatlingDamageInterval) { _damageInterval += Time.deltaTime; return; } _damageInterval = 0f; if (!((NetworkBehaviour)this).IsServer) { return; } HashSet hashSet = new HashSet(); Transform[] array = (Transform[])(object)new Transform[2] { _leftGunStartTransform, _rightGunStartTransform }; Transform[] array2 = array; IHittable val4 = default(IHittable); foreach (Transform val in array2) { Vector3 position = val.position; Vector3 val2 = val.position + val.forward * _minigunRange; int num = Physics.OverlapCapsuleNonAlloc(position, val2, _minigunWidth, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); for (int j = 0; j < num; j++) { Collider val3 = _cachedColliders[j]; if (!((Component)val3).TryGetComponent(ref val4) || hashSet.Contains(val4)) { continue; } hashSet.Add(val4); EnemyAICollisionDetect val5 = (EnemyAICollisionDetect)(object)((val4 is EnemyAICollisionDetect) ? val4 : null); if (val5 != null && (Object)(object)((Component)val5.mainScript).gameObject == (Object)(object)((Component)this).gameObject) { continue; } PlayerControllerB val6 = (PlayerControllerB)(object)((val4 is PlayerControllerB) ? val4 : null); if (val6 != null) { Vector3 val7 = ((Component)val6).transform.position - val.position; Vector3 normalized = ((Vector3)(ref val7)).normalized; val6.DamagePlayer(_minigunDamage, true, true, (CauseOfDeath)7, 0, false, normalized * 10f); val6.externalForceAutoFade += normalized * 2f; continue; } EnemyAICollisionDetect val8 = (EnemyAICollisionDetect)(object)((val4 is EnemyAICollisionDetect) ? val4 : null); if (val8 != null) { if (((NetworkBehaviour)this).IsServer) { val8.mainScript.HitEnemyOnLocalClient(_minigunDamage, val.position, (PlayerControllerB)null, true, 1921); } } else if (((NetworkBehaviour)this).IsServer) { val4.Hit(_minigunDamage, val.position, (PlayerControllerB)null, true, 1921); } } } } public void AlertPeaceKeeperToLocalPlayer(PlayerControllerB playerWhoHit) { if (!((EnemyAI)this).isEnemyDead && !playerWhoHit.isPlayerDead && ((EnemyAI)this).currentBehaviourStateIndex != 2) { if (((EnemyAI)this).currentBehaviourStateIndex == 1 && (Object)(object)((EnemyAI)this).targetPlayer == (Object)(object)playerWhoHit) { AlertPeaceKeeperToPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit)); } else if (EnemySeesPlayer(playerWhoHit, 0f)) { AlertPeaceKeeperToPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit)); } } } [ServerRpc(RequireOwnership = false)] private void AlertPeaceKeeperToPlayerServerRpc(int playerIndex) { ((EnemyAI)this).targetPlayer = StartOfRound.Instance.allPlayerScripts[playerIndex]; smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = _chasingSpeed; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0087: 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_00c2: Unknown result type (might be due to invalid IL or missing references) base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead || hitID == 1921) { return; } if ((Object)(object)playerWhoHit != (Object)null) { if (((EnemyAI)this).currentBehaviourStateIndex != 2) { ((EnemyAI)this).targetPlayer = playerWhoHit; smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.speed = _chasingSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); } else if (Vector3.Distance(((Component)playerWhoHit).transform.position, ((Component)this).transform.position) <= 4f && _rotatingToHitter == null) { smartAgentNavigator.DoPathingToDestination(((Component)playerWhoHit).transform.position); _rotatingToHitter = ((MonoBehaviour)this).StartCoroutine(RotateToTargetPlayer(playerWhoHit)); if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(BitchSlapAnimation, true); } } } else if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(BitchSlapAnimation, true); } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - Mathf.Clamp(force, -10, 10); if (((EnemyAI)this).enemyHP <= 0) { if ((Object)(object)playerWhoHit != (Object)null) { Plugin.ExtendedLogging($"PeaceKeeper killed by player: {((Object)playerWhoHit).name} who dealt {force} damage with hit ID: {hitID}."); _killedByPlayer = true; } if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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 (((EnemyAI)this).enemyHP > 10) { return; } base.KillEnemy(destroy); smartAgentNavigator.StopSearchRoutine(); _aggroSFX.Stop(); ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).dieSFX); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimation, true); Vector3 velocity = ((EnemyAI)this).agent.velocity; float num = ((Vector3)(ref velocity)).magnitude / 3f; ((EnemyAI)this).creatureAnimator.SetFloat(RunSpeedFloat, num); _materials[0].SetVector(ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, 0f - num, 0f))); _materials[1].SetVector(ScrollSpeedID, Vector4.op_Implicit(new Vector3(0f, num, 0f))); if (num > 0f) { _treadsSource.volume = 1f; } else { _treadsSource.volume = 0f; } } } public void EnableBulletParticles() { foreach (ParticleSystem ammoParticle in _ammoParticles) { ammoParticle.Play(); } } public void DisableBulletParticles() { foreach (ParticleSystem ammoParticle in _ammoParticles) { ammoParticle.Stop(); } } public void ReplaceAndSpawnRealGunAnimationEvent() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging($"PeaceKeeper has been defeated by player? {_killedByPlayer}."); if (!_killedByPlayer) { _fakeGunGO.SetActive(true); return; } ((Component)_fakeGunGO.transform).gameObject.SetActive(false); if (((NetworkBehaviour)this).IsServer) { CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.Ceasefire].Item, _fakeGunGO.transform.position, isQuest: false, defaultRotation: false, 0, _fakeGunGO.transform.rotation); } } public void BitchSlapAnimationEvent() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapCapsuleNonAlloc(_gunStartTransform.position, _gunEndTransform.position, 2f, _cachedColliders, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask, (QueryTriggerInteraction)2); IHittable val2 = default(IHittable); for (int i = 0; i < num; i++) { Collider val = _cachedColliders[i]; Plugin.ExtendedLogging("Bitch Slap hit " + ((Object)val).name); if (!((Component)val).TryGetComponent(ref val2)) { continue; } PlayerControllerB val3 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val3 != null) { Vector3 val4 = ((Component)val3).transform.position - ((Component)this).transform.position; Vector3 val5 = ((Vector3)(ref val4)).normalized * 100f; val3.DamagePlayer(40, true, true, (CauseOfDeath)1, 0, false, val5); val3.externalForceAutoFade += val5; continue; } EnemyAICollisionDetect val6 = (EnemyAICollisionDetect)(object)((val2 is EnemyAICollisionDetect) ? val2 : null); if (val6 != null) { if (((NetworkBehaviour)this).IsServer && !((Object)(object)((Component)val6.mainScript).gameObject == (Object)(object)((Component)this).gameObject)) { val6.mainScript.HitEnemyOnLocalClient(2, ((Component)this).transform.position, (PlayerControllerB)null, true, 1921); } } else if (((NetworkBehaviour)this).IsServer) { val2.Hit(2, ((Component)this).transform.position, (PlayerControllerB)null, true, 1921); } } } public void PlayMiscSoundsAnimationEvent(int soundID) { switch (soundID) { case 0: ((EnemyAI)this).creatureSFX.PlayOneShot(_revUpSound); break; case 1: ((EnemyAI)this).creatureSFX.PlayOneShot(_revDownSound); break; case 2: ((EnemyAI)this).creatureSFX.PlayOneShot(_bitchSlapSound); break; case 3: ((EnemyAI)this).creatureSFX.PlayOneShot(_bitchSlapStartSound); break; } } } public class Puppeteer : CodeRebirthEnemyAI { private enum PuppeteerState { Spawn, Idle, Sneaking, Attacking, DefensiveMask, Dead } [Header("General Configuration")] public PuppetDamageDealer puppetDamageDealer = null; public Transform playerStabPosition = null; [Header("Puppeteer Configuration")] public float sneakSpeed = 1.5f; public float chaseSpeed = 3f; public float detectionRange = 20f; public int puppetDamageToPlayerMultiplier = 20; public Transform needleAttachPoint = null; [Header("Audio & Animation")] public AudioClip[] normalFootstepSounds = Array.Empty(); public AudioClip[] combatFootstepSounds = Array.Empty(); public AudioClip grabPlayerSound = null; public AudioClip makePuppetSound = null; public AudioClip stabSound = null; public AudioClip swipeSound = null; public AudioClip maskDefensiveSound = null; public AudioClip[] reflectSounds = null; [HideInInspector] public bool isAttacking = false; private bool enteredDefensiveModeOnce = false; private PlayerControllerB? targetPlayerToNeedle = null; private PlayerControllerB? priorityPlayer = null; private float timeSinceLastTakenDamage = 0f; private bool teleporting = false; private Dictionary playerPuppetMap = new Dictionary(); private static readonly int DoStabAnimation = Animator.StringToHash("doStab"); private static readonly int DoSwipeAnimation = Animator.StringToHash("doSwipe"); private static readonly int DoHitAnimation = Animator.StringToHash("isHit"); private static readonly int DoGrabPlayerAnimation = Animator.StringToHash("doGrabPlayer"); private static readonly int MaskPhaseAnimation = Animator.StringToHash("maskPhase"); private static readonly int InCombatAnimation = Animator.StringToHash("inCombat"); private static readonly int DeadAnimation = Animator.StringToHash("isDead"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); public override void Start() { base.Start(); ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); } public override void Update() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead) { return; } timeSinceLastTakenDamage += Time.deltaTime; if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) { return; } GameObject val = playerPuppetMap[((EnemyAI)this).targetPlayer]; if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; normalized.y = 0f; if (((Vector3)(ref normalized)).sqrMagnitude > 0.001f) { Quaternion val3 = Quaternion.LookRotation(normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, 5f * Time.deltaTime); } } } public override void DoAIInterval() { //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) ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: break; case 1: DoIdleUpdate(); break; case 2: DoSneakingUpdate(); break; case 3: DoAttackingUpdate(); break; case 4: break; case 5: break; } } } private void DoIdleUpdate() { PlayerControllerB nearestPlayerWithinRange = GetNearestPlayerWithinRange(detectionRange); if ((Object)(object)nearestPlayerWithinRange != (Object)null || (Object)(object)priorityPlayer != (Object)null) { smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } private void DoSneakingUpdate() { //IL_0063: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB nearestPlayerWithinRange = GetNearestPlayerWithinRange(detectionRange + 10f); if ((Object)(object)priorityPlayer != (Object)null) { nearestPlayerWithinRange = priorityPlayer; } if ((Object)(object)nearestPlayerWithinRange == (Object)null) { smartAgentNavigator.StartSearchRoutine(40f); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); return; } smartAgentNavigator.DoPathingToDestination(((Component)nearestPlayerWithinRange).transform.position); if (((EnemyAI)this).agent.speed != 0f && Vector3.Distance(((Component)nearestPlayerWithinRange).transform.position, ((Component)this).transform.position) <= 3f) { SetTargetNeedlePlayerClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, nearestPlayerWithinRange)); ((EnemyAI)this).agent.speed = 0f; ((EnemyAI)this).agent.velocity = Vector3.zero; Plugin.ExtendedLogging("Grabbing player!"); creatureNetworkAnimator.SetTrigger(DoGrabPlayerAnimation, true); ((MonoBehaviour)this).StartCoroutine(FixPlayerJustIncase(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, nearestPlayerWithinRange))); } } private IEnumerator FixPlayerJustIncase(int playerIndex) { yield return (object)new WaitForSeconds(4f); UnSetTargetNeedlePlayerClientRpc(playerIndex); } private void DoAttackingUpdate() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || !((EnemyAI)this).targetPlayer.isPlayerControlled) { Plugin.ExtendedLogging("Target player is dead or not controlled, stopping attack."); ((EnemyAI)this).creatureAnimator.SetBool(InCombatAnimation, false); smartAgentNavigator.StartSearchRoutine(40f); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); return; } GameObject val = playerPuppetMap[((EnemyAI)this).targetPlayer]; if (!((Object)(object)val == (Object)null) && !isAttacking) { smartAgentNavigator.DoPathingToDestination(val.transform.position); float num = Vector3.Distance(val.transform.position, ((Component)this).transform.position); if (num <= 2f) { ((EnemyAI)this).agent.speed = chaseSpeed / 4f; PlayMiscSoundClientRpc(1); creatureNetworkAnimator.SetTrigger(DoSwipeAnimation, true); isAttacking = true; } else if (num <= 5f) { ((EnemyAI)this).agent.speed = chaseSpeed / 4f; PlayMiscSoundClientRpc(0); creatureNetworkAnimator.SetTrigger(DoStabAnimation, true); isAttacking = true; } } } [ClientRpc] private void PlayMiscSoundClientRpc(int index) { switch (index) { case 0: ((EnemyAI)this).creatureSFX.PlayOneShot(stabSound); break; case 1: ((EnemyAI)this).creatureSFX.PlayOneShot(swipeSound); break; } } private void CreatePlayerPuppet(PlayerControllerB player) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!playerPuppetMap.ContainsKey(player)) { GameObject val = Object.Instantiate(ContentHandler.Instance.ManorLord.PuppeteerPuppetPrefab, needleAttachPoint.position, Quaternion.identity); val.GetComponent().Spawn(true); CreatePlayerPuppetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player), new NetworkObjectReference(val)); } } [ServerRpc(RequireOwnership = false)] private void CreatePlayerPuppetServerRpc(int playerIndex, NetworkObjectReference netObj) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreatePlayerPuppetClientRpc(playerIndex, netObj); } [ClientRpc] private void CreatePlayerPuppetClientRpc(int playerIndex, NetworkObjectReference netObj) { //IL_0020: 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) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; ((EnemyAI)this).creatureSFX.PlayOneShot(makePuppetSound); GameObject val2 = NetworkObjectReference.op_Implicit(netObj); val2.transform.localScale = ((Component)this).transform.localScale; PuppeteersVoodoo component = val2.GetComponent(); ((Component)component).transform.SetParent(StartOfRound.Instance.propsContainer); component.Init(val, this, puppetDamageToPlayerMultiplier); playerPuppetMap[val] = val2; } private void TeleportAway() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { Vector3 randomFarPointInFacility = GetRandomFarPointInFacility(new List { ((Component)this).transform.position }); ((EnemyAI)this).agent.Warp(randomFarPointInFacility); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } teleporting = false; } public Vector3 GetRandomFarPointInFacility(List pointsToStayAwayFrom) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) List list = new List(); GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; foreach (GameObject val in insideAINodes) { if (!((Object)(object)val == (Object)null)) { Vector3 nodePos = val.transform.position; if (pointsToStayAwayFrom.All((Vector3 pt) => Vector3.Distance(pt, nodePos) > 30f)) { list.Add(nodePos); } } } if (list.Count == 0) { GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; foreach (GameObject val2 in outsideAINodes) { Vector3 nodePos2 = val2.transform.position; if (pointsToStayAwayFrom.All((Vector3 pt) => Vector3.Distance(pt, nodePos2) > 30f)) { list.Add(nodePos2); } } if (list.Count == 0) { return ((Component)this).transform.position; } } return list[Random.Range(0, list.Count)]; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead || (Object)(object)playerWhoHit == (Object)null || teleporting || timeSinceLastTakenDamage <= 1f) { return; } if (((EnemyAI)this).currentBehaviourStateIndex == 4) { ((EnemyAI)this).creatureSFX.PlayOneShot(reflectSounds[enemyRandom.Next(reflectSounds.Length)]); playerWhoHit.DamagePlayer(force * 25, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); return; } force = 1; if (((EnemyAI)this).currentBehaviourStateIndex != 3) { if (!playerPuppetMap.ContainsKey(playerWhoHit)) { priorityPlayer = playerWhoHit; return; } ((EnemyAI)this).targetPlayer = playerWhoHit; ((EnemyAI)this).agent.speed = chaseSpeed; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(InCombatAnimation, true); } smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); } else { if (!playerPuppetMap.ContainsKey(playerWhoHit)) { priorityPlayer = playerWhoHit; return; } ((EnemyAI)this).targetPlayer = playerWhoHit; } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((NetworkBehaviour)this).IsServer && ((EnemyAI)this).currentBehaviourStateIndex != 3) { creatureNetworkAnimator.SetTrigger(DoHitAnimation, true); } if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead) { timeSinceLastTakenDamage = 1f; if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } [ClientRpc] public void SetTargetNeedlePlayerClientRpc(int playerIndex) { //IL_0072: 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) teleporting = true; targetPlayerToNeedle = StartOfRound.Instance.allPlayerScripts[playerIndex]; if (PlayerControllerBExtensions.IsLocalPlayer(targetPlayerToNeedle)) { ((EnemyAI)this).creatureSFX.PlayOneShot(grabPlayerSound); } targetPlayerToNeedle.disableMoveInput = true; targetPlayerToNeedle.disableLookInput = true; targetPlayerToNeedle.inAnimationWithEnemy = (EnemyAI)(object)this; ((Component)targetPlayerToNeedle).transform.SetPositionAndRotation(playerStabPosition.position, playerStabPosition.rotation); } [ClientRpc] public void UnSetTargetNeedlePlayerClientRpc(int playerIndex) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerIndex]; if (!((Object)(object)targetPlayerToNeedle != (Object)(object)val)) { targetPlayerToNeedle.disableMoveInput = false; targetPlayerToNeedle.disableLookInput = false; if ((Object)(object)targetPlayerToNeedle.inAnimationWithEnemy == (Object)(object)this) { targetPlayerToNeedle.inAnimationWithEnemy = null; } Plugin.ExtendedLogging($"{this} unsetting target player {val.playerUsername}"); targetPlayerToNeedle = null; } } private IEnumerator SwitchToStateAfterDelay(PuppeteerState state, float delay) { int randomNumber = enemyRandom.Next(100); Plugin.ExtendedLogging($"Random Number: {randomNumber}"); if (((NetworkBehaviour)this).IsServer) { if (randomNumber < 1) { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Jester].EnemyType); } else if (randomNumber < 20) { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Nutcracker].EnemyType); } else if (randomNumber < 30) { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Butler].EnemyType); } else { RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Masked].EnemyType); } RoundManager.Instance.SpawnEnemyGameObject(((Component)this).transform.position, -1f, -1, ((Registry)(object)LethalContent.Enemies)[EnemyKeys.Masked].EnemyType); } yield return (object)new WaitForSeconds(delay); if (state == PuppeteerState.Attacking) { smartAgentNavigator.StopSearchRoutine(); } if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(InCombatAnimation, state == PuppeteerState.Attacking); ((EnemyAI)this).creatureAnimator.SetBool(MaskPhaseAnimation, false); } ((EnemyAI)this).agent.speed = chaseSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient((int)state); } public override void KillEnemy(bool destroy = false) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Plugin.ExtendedLogging("Puppeteer killed?"); if (!enteredDefensiveModeOnce) { timeSinceLastTakenDamage = 0f; enteredDefensiveModeOnce = true; ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP + 1; ((EnemyAI)this).creatureVoice.PlayOneShot(maskDefensiveSound); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(MaskPhaseAnimation, true); } ((EnemyAI)this).agent.speed = 0f; ((MonoBehaviour)this).StartCoroutine(SwitchToStateAfterDelay(PuppeteerState.Attacking, maskDefensiveSound.length)); } else { if (timeSinceLastTakenDamage < 0.5f) { return; } if (((EnemyAI)this).currentBehaviourStateIndex == 4) { DawnEnemyAdditionalData val = DawnEnemyAdditionalData.CreateOrGet((EnemyAI)(object)this); PlayerControllerB playerThatLastHit = val.PlayerThatLastHit; if (playerThatLastHit != null) { playerThatLastHit.KillPlayer(val.PlayerThatLastHit.velocityLastFrame, true, (CauseOfDeath)13, 6, default(Vector3), false); } return; } base.KillEnemy(destroy); ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).dieSFX); ((Behaviour)((EnemyAI)this).agent).enabled = false; ((Behaviour)smartAgentNavigator).enabled = false; if (!((NetworkBehaviour)this).IsServer) { return; } ((EnemyAI)this).creatureAnimator.SetBool(DeadAnimation, true); PuppeteersVoodoo puppeteersVoodoo = default(PuppeteersVoodoo); foreach (KeyValuePair item in playerPuppetMap) { GameObject value = item.Value; if ((Object)(object)value != (Object)null && value.TryGetComponent(ref puppeteersVoodoo)) { puppeteersVoodoo.breakDollRoutine = ((MonoBehaviour)this).StartCoroutine(puppeteersVoodoo.BreakDoll()); } } playerPuppetMap.Clear(); CodeRebirthUtils.Instance.SpawnScrapServerRpc(CodeRebirthItemKeys.PuppeteersNeedle, ((Component)this).transform.position); } } private PlayerControllerB? GetNearestPlayerWithinRange(float range) { //IL_005e: 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) float num = float.MaxValue; PlayerControllerB result = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isPlayerDead && !((Object)(object)val.inAnimationWithEnemy != (Object)null) && !playerPuppetMap.ContainsKey(val)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < range && num2 < num) { num = num2; result = val; } } } return result; } public void PlayFootstepSoundAnimEvent() { if (((EnemyAI)this).currentBehaviourStateIndex == 3) { ((EnemyAI)this).creatureVoice.PlayOneShot(combatFootstepSounds[enemyRandom.Next(combatFootstepSounds.Length)]); } else { ((EnemyAI)this).creatureVoice.PlayOneShot(normalFootstepSounds[enemyRandom.Next(normalFootstepSounds.Length)]); } } public void SpawnAnimationTransitionAnimEvent() { if (((EnemyAI)this).currentBehaviourStateIndex != 3) { ((EnemyAI)this).targetPlayer = null; ((EnemyAI)this).agent.speed = sneakSpeed; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(40f); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); } } public void PuppetPlayerAnimEvent() { if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)targetPlayerToNeedle == (Object)null) { Plugin.Logger.LogError((object)"No player to grab???"); } else { CreatePlayerPuppet(targetPlayerToNeedle); } } } public void ReleasePlayerAnimEvent() { if ((Object)(object)targetPlayerToNeedle == (Object)null) { Plugin.Logger.LogError((object)"No player to release???"); return; } targetPlayerToNeedle.disableMoveInput = false; targetPlayerToNeedle.disableLookInput = false; if ((Object)(object)targetPlayerToNeedle.inAnimationWithEnemy == (Object)(object)this) { targetPlayerToNeedle.inAnimationWithEnemy = null; } if ((Object)(object)targetPlayerToNeedle == (Object)(object)priorityPlayer) { priorityPlayer = null; } Plugin.ExtendedLogging($"{this} unsetting target player {targetPlayerToNeedle.playerUsername}"); targetPlayerToNeedle = null; ((EnemyAI)this).agent.speed = sneakSpeed; } public void TeleportEnemyAnimEvent() { TeleportAway(); } public void EndAttackAnimEvent() { if (((EnemyAI)this).currentBehaviourStateIndex == 3) { ((EnemyAI)this).agent.speed = chaseSpeed; } else { ((EnemyAI)this).agent.speed = sneakSpeed; } isAttacking = false; } } [RequireComponent(typeof(SmartAgentNavigator))] public class PuppeteersVoodoo : NetworkBehaviour, IHittable { public NavMeshAgent agent = null; public Animator animator = null; public Renderer renderer = null; public Material[] materialVariants = null; public SmartAgentNavigator smartAgentNavigator = null; [Header("Football-Like Kick Settings")] [Tooltip("Upward force added on kick.")] public float ballHitUpwardAmount = 0.5f; [Header("Sounds")] public AudioClip[] puppetFootstepSounds = Array.Empty(); public AudioClip[] hitSounds = Array.Empty(); public AudioClip deathSound = null; [Header("Curves for the Arc/Fall Behavior")] public AnimationCurve dollFallCurve; public AnimationCurve dollVerticalFallCurve; public AnimationCurve dollVerticalOffset; public AnimationCurve dollVerticalFallCurveNoBounce; [Tooltip("Collision layers for the 'kick' raycast, etc.")] public LayerMask dollBallMask = LayerMask.op_Implicit(369101057); [Space(5f)] public AudioClip[] hitBallSFX = Array.Empty(); public AudioClip[] ballHitFloorSFX = Array.Empty(); public AudioSource dollAudio = null; internal Coroutine? breakDollRoutine = null; private Ray dollRay; private RaycastHit dollHit; private float hitTimer; private float fallTime; private bool hasHitGround; private Vector3 startFallingPosition; private Vector3 targetFloorPosition; private int damageTransferMultiplier = 20; internal float lastTimeTakenDamageFromEnemy = 0f; internal Puppeteer puppeteerCreatedBy = null; internal PlayerControllerB? playerControlled = null; internal static HashSet blacklistedEnemies = new HashSet(); private static readonly int OnHitAnimation = Animator.StringToHash("onHit"); private static readonly int IsKickedAnimation = Animator.StringToHash("isKicked"); private static readonly int IsDeadAnimation = Animator.StringToHash("isDead"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private Random puppetRandom = new Random(69); public static List puppeteerList = new List(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); puppeteerList.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); puppeteerList.Remove(this); } internal static void CreateBlacklist() { if (ContentHandler.Instance.ManorLord == null) { return; } string value = ((AssetBundleLoader)(object)ContentHandler.Instance.ManorLord).GetConfig("Lord Of The Manor | Puppet Enemy Blacklist").Value; if (string.IsNullOrEmpty(value)) { return; } foreach (string item in from s in value.Split(',') select s.Trim()) { foreach (DawnEnemyInfo value2 in ((Registry)(object)LethalContent.Enemies).Values) { if (!value2.EnemyType.enemyName.Equals(item, StringComparison.OrdinalIgnoreCase)) { continue; } blacklistedEnemies.Add(value2.EnemyType); break; } } } public void Start() { hitTimer = Time.realtimeSinceStartup + 3f; smartAgentNavigator.SetAllValues(((EnemyAI)puppeteerCreatedBy).isOutside); puppetRandom = new Random(StartOfRound.Instance.randomMapSeed + puppeteerList.Count); if (puppetRandom.Next(5) == 0) { renderer.sharedMaterial = materialVariants[puppetRandom.Next(materialVariants.Length)]; } } public void Init(PlayerControllerB player, Puppeteer puppeteer, int damageTransferMultiplier) { playerControlled = player; if (((NetworkBehaviour)this).IsOwner) { ((NetworkBehaviour)this).NetworkObject.ChangeOwnership(((NetworkBehaviour)playerControlled).OwnerClientId); } puppeteerCreatedBy = puppeteer; this.damageTransferMultiplier = damageTransferMultiplier; } public void Update() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) lastTimeTakenDamageFromEnemy += Time.deltaTime; if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)puppeteerCreatedBy == (Object)null && breakDollRoutine == null) { breakDollRoutine = ((MonoBehaviour)this).StartCoroutine(BreakDoll()); playerControlled = null; return; } if (((Object)(object)playerControlled == (Object)null || playerControlled.isPlayerDead) && breakDollRoutine == null) { breakDollRoutine = ((MonoBehaviour)this).StartCoroutine(BreakDoll()); playerControlled = null; return; } } if ((Object)(object)playerControlled == (Object)null) { return; } if (!hasHitGround && fallTime < 1f) { FallWithCurve(); } if (((Behaviour)agent).enabled) { Animator obj = animator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = agent.velocity; obj.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 2f); smartAgentNavigator.DoPathingToDestination(((Component)playerControlled).transform.position); smartAgentNavigator.AdjustSpeedBasedOnDistance(0f, 40f, 2.5f, 10f, 1f); } else { animator.SetFloat(RunSpeedFloat, 0f); if (hasHitGround) { ((Component)this).transform.position = ((Component)playerControlled).transform.position; ((Behaviour)agent).enabled = true; } } } public void OnDollDamaged(int damage, CauseOfDeath causeOfDeath) { if ((Object)(object)playerControlled != (Object)null) { int finalDamage = Mathf.RoundToInt((float)(damage * damageTransferMultiplier)); DoHitAnimationServerRpc(finalDamage); } } [ServerRpc(RequireOwnership = false)] private void DoHitAnimationServerRpc(int finalDamage) { PlayMiscSoundsClientRpc(1, finalDamage); } [ServerRpc(RequireOwnership = false)] private void PlayMiscSoundsServerRpc(int soundID) { PlayMiscSoundsClientRpc(soundID); } [ClientRpc] private void PlayMiscSoundsClientRpc(int soundID, int finalDamage = 0) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) switch (soundID) { case 0: dollAudio.PlayOneShot(deathSound); break; case 1: animator.SetTrigger(OnHitAnimation); lastTimeTakenDamageFromEnemy = 0f; if ((Object)(object)playerControlled != (Object)null) { playerControlled.DamagePlayer(finalDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } else { Plugin.Logger.LogError((object)"PlayerControlled is null"); } dollAudio.PlayOneShot(hitSounds[puppetRandom.Next(hitSounds.Length)]); break; } } public IEnumerator BreakDoll() { PlayMiscSoundsServerRpc(0); animator.SetBool(IsDeadAnimation, true); DeadAnimationRpc(); yield return (object)new WaitForSeconds(4f); if ((Object)(object)playerControlled != (Object)null && !playerControlled.isPlayerDead) { CodeRebirthUtils.Instance.SpawnScrap(((Registry)(object)LethalContent.Items)[CodeRebirthItemKeys.PuppeteersVoodoo].Item, ((Component)this).transform.position); } ((NetworkBehaviour)this).NetworkObject.Despawn(true); } [Rpc(/*Could not decode attribute arguments.*/)] private void DeadAnimationRpc() { animator.SetBool(IsDeadAnimation, true); } public bool Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (force == -22) { force = 1; } OnDollDamaged(force, (CauseOfDeath)1); if ((Object)(object)playerWhoHit != (Object)null) { Vector3 hitFromPosition = ((Component)playerWhoHit).transform.position + Vector3.up; BeginKickDoll(hitFromPosition); } return true; } public void OnTriggerEnter(Collider other) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (Time.realtimeSinceStartup - hitTimer < 0.5f || !((NetworkBehaviour)this).IsOwner) { return; } if (((Component)other).tag.StartsWith("Enemy")) { EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect); EnemyAI val3 = default(EnemyAI); foreach (EnemyType blacklistedEnemy in blacklistedEnemies) { EnemyAI val = null; if (((Component)other).TryGetComponent(ref val2)) { val = val2.mainScript; } else { if (!((Component)other).TryGetComponent(ref val3)) { break; } val = val3; } if ((Object)(object)val.enemyType == (Object)(object)blacklistedEnemy) { return; } } BeginKickDoll(((Component)other).transform.position + Vector3.up); } else if (((Component)other).tag.StartsWith("PlayerBody")) { BeginKickDoll(((Component)other).transform.position + Vector3.up); } } private void BeginKickDoll(Vector3 hitFromPosition) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) hitTimer = Time.realtimeSinceStartup; Vector3 kickDestination = GetKickDestination(hitFromPosition); if (!(kickDestination == Vector3.zero)) { KickDollLocalClient(kickDestination); Vector3 val = kickDestination; val.y = ((Component)this).transform.position.y; ((Component)this).transform.LookAt(val); KickDollRpc(kickDestination); } } private Vector3 GetKickDestination(Vector3 hitFromPosition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - hitFromPosition; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0.2f; float num = 10f; dollRay = new Ray(((Component)this).transform.position + Vector3.up * 0.22f, normalized); if (Physics.Raycast(dollRay, ref dollHit, num, LayerMask.op_Implicit(dollBallMask), (QueryTriggerInteraction)1)) { return ((Ray)(ref dollRay)).GetPoint(Mathf.Max(0.1f, ((RaycastHit)(ref dollHit)).distance - 0.05f)); } return ((Ray)(ref dollRay)).GetPoint(num); } private void KickDollLocalClient(Vector3 destinationPos) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) animator.SetBool(IsKickedAnimation, true); ((Behaviour)smartAgentNavigator).enabled = false; ((Behaviour)agent).enabled = false; dollAudio.PlayOneShot(hitBallSFX[puppetRandom.Next(hitBallSFX.Length)]); ((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true); fallTime = 0f; hasHitGround = false; Vector3 val = SnapToFloor(destinationPos); startFallingPosition = ((Component)this).transform.localPosition + Vector3.up * 0.07f; targetFloorPosition = ((Component)this).transform.parent.InverseTransformPoint(val); } private Vector3 SnapToFloor(Vector3 desiredWorldPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Vector3 val = desiredWorldPos + Vector3.up; Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val, Vector3.down); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 65f, LayerMask.op_Implicit(dollBallMask), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val3)).point; } return desiredWorldPos; } [Rpc(/*Could not decode attribute arguments.*/)] private void KickDollRpc(Vector3 dest) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) KickDollLocalClient(dest); } public void FallWithCurve() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) Vector3 val = startFallingPosition - targetFloorPosition; float magnitude = ((Vector3)(ref val)).magnitude; Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles; localEulerAngles.x = 0f; localEulerAngles.z = 0f; ((Component)this).transform.localEulerAngles = Vector3.Lerp(((Component)this).transform.localEulerAngles, localEulerAngles, 14f * Time.deltaTime / Mathf.Max(magnitude, 0.01f)); Vector3 localPosition = Vector3.Lerp(startFallingPosition, targetFloorPosition, dollFallCurve.Evaluate(fallTime)); if (magnitude < 3f) { float y = Mathf.Lerp(startFallingPosition.y, targetFloorPosition.y, dollVerticalFallCurveNoBounce.Evaluate(fallTime)); localPosition.y = y; } else { float num = Mathf.Lerp(startFallingPosition.y, targetFloorPosition.y, dollVerticalFallCurve.Evaluate(fallTime)); localPosition.y = num + dollVerticalOffset.Evaluate(fallTime) * ballHitUpwardAmount; } ((Component)this).transform.localPosition = localPosition; fallTime += Mathf.Abs(Time.deltaTime * 12f / Mathf.Max(magnitude, 0.01f)); if (fallTime >= 1f && !hasHitGround) { PlayDropSFX(); } } private void PlayDropSFX() { dollAudio.PlayOneShot(ballHitFloorSFX[puppetRandom.Next(ballHitFloorSFX.Length)]); animator.SetBool(IsKickedAnimation, false); hasHitGround = true; SnapToClosestNavmeshPoint(); ((Behaviour)agent).enabled = true; ((Behaviour)smartAgentNavigator).enabled = true; } private void SnapToClosestNavmeshPoint() { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) float maxDistance = 1f; Vector3 position = ((Component)this).transform.position; if (TryFindClosestNavmeshPoint(position, maxDistance, out var result)) { ((Component)this).transform.position = result; } else if ((Object)(object)playerControlled != (Object)null) { Vector3 position2 = ((Component)playerControlled).transform.position; if (TryFindClosestNavmeshPoint(position2, maxDistance, out var result2)) { ((Component)this).transform.position = result2; } } } private bool TryFindClosestNavmeshPoint(Vector3 origin, float maxDistance, out Vector3 result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(origin, ref val, maxDistance, -1)) { result = ((NavMeshHit)(ref val)).position; return true; } result = Vector3.zero; return false; } public void PlayFootstepSoundAnimEvent() { dollAudio.PlayOneShot(puppetFootstepSounds[puppetRandom.Next(puppetFootstepSounds.Length)]); } } public abstract class QuestMasterAI : CodeRebirthEnemyAI { public enum State { Spawning, Wandering, Approaching, OngoingQuest, Docile } public enum QuestCompletion { TimedOut, Completed, Null } [Header("Quest Variables")] [Tooltip("How long a player has to complete the assigned quest")] [SerializeField] public float questTimer = 120f; [Tooltip("List of items' names the player needs to collect to complete the quest")] [SerializeField] public NamespacedKey[] questItems; [Tooltip("Name of the given quest")] [SerializeField] public string questName; [Tooltip("Chance of the player receiving another quest after completing the current one")] [SerializeField] public float questRepeatChance = 30f; [Tooltip("Number of possible quest repeats")] [SerializeField] public int questRepeats = 1; [Space(5f)] [Header("Animations")] [SerializeField] public AnimationClip spawnAnimation = null; [Space(5f)] [Header("Audio")] [SerializeField] public AudioSource creatureUltraVoice = null; [SerializeField] public AudioClip questGiveClip = null; [SerializeField] public AudioClip questSucceedClip = null; [SerializeField] public AudioClip questFailClip = null; [SerializeField] public AudioClip questGiveAgainClip = null; [SerializeField] public AudioClip questAfterFailClip = null; [Header("Behaviour")] [Tooltip("Detection Range")] [SerializeField] public float range = 20f; [Tooltip("Dead Body Prefabs")] public List deadBodies = new List(); [Tooltip("Bloody Duck Mat")] public Material[] bloodyMaterials = (Material[])(object)new Material[3]; [Space(5f)] [Header("Speeds")] [Tooltip("Speed for the spawning state")] [SerializeField] public float spawnSpeed; [Tooltip("Speed for the walking state")] [SerializeField] public float walkSpeed; [Tooltip("Speed for the approach state")] [SerializeField] public float approachSpeed; [Tooltip("Speed for the quest state")] [SerializeField] public float questSpeed; [Tooltip("Speed for the docile state")] [SerializeField] public float docileSpeed; [HideInInspector] public NetworkVariable questCompletionTimes = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public NetworkVariable currentQuestOrder = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public NetworkVariable questTimedOut = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public NetworkVariable questCompleted = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public NetworkVariable questStarted = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public NetworkVariable questOrder = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [HideInInspector] public List spawnedBodies = new List(); [HideInInspector] public float internalQuestTimer = 0f; [HideInInspector] public int questsFailed = 0; [HideInInspector] public List questItemsList = new List(); [HideInInspector] public List deadBodiesList = new List(); [HideInInspector] public bool changingState = false; private static readonly int startWalkAnimation = Animator.StringToHash("startWalk"); private static readonly int startGiveQuestAnimation = Animator.StringToHash("startGiveQuest"); private static readonly int startQuestAnimation = Animator.StringToHash("startQuest"); private static readonly int startFailQuestAnimation = Animator.StringToHash("startFailQuest"); private static readonly int startSucceedQuestAnimation = Animator.StringToHash("startSucceedQuest"); private static readonly int isTalkingAnimation = Animator.StringToHash("isTalking"); private static readonly int isSittingAnimation = Animator.StringToHash("isSitting"); private static readonly int runSpeedFloat = Animator.StringToHash("RunSpeed"); public override void Start() { base.Start(); ((EnemyAI)this).agent.speed = spawnSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(DoSpawning()); } } protected virtual IEnumerator DoSpawning() { yield return (object)new WaitForSeconds(spawnAnimation.length); smartAgentNavigator.StartSearchRoutine(40f); ((EnemyAI)this).agent.speed = walkSpeed; creatureNetworkAnimator.SetTrigger(startWalkAnimation, true); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } protected virtual void DoWandering() { if (!changingState && FindClosestPlayerInRange(range)) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer)); ((MonoBehaviour)this).StartCoroutine(ChangingToApproaching(questCompleted.Value == 1)); } } protected virtual IEnumerator ChangingToApproaching(bool doDelay) { if (doDelay) { changingState = true; yield return (object)new WaitForSeconds(1f); changingState = false; } ((EnemyAI)this).agent.speed = approachSpeed; smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } protected virtual void DoApproaching() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) < 3f && questStarted.Value == 0) { questStarted.Value = 1; creatureNetworkAnimator.SetTrigger(startGiveQuestAnimation, true); ((MonoBehaviour)this).StartCoroutine(DoGiveQuest()); } smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); } [ClientRpc] public void PlayMiscSoundsClientRpc(int soundIndex) { AudioClip val = null; switch (soundIndex) { case 0: val = questGiveAgainClip; break; case 1: val = questGiveClip; break; case 2: val = questFailClip; break; case 3: val = questSucceedClip; break; case 4: val = questAfterFailClip; break; } ((EnemyAI)this).creatureSFX.PlayOneShot(val); } protected virtual IEnumerator DoGiveQuest() { Plugin.ExtendedLogging("Starting Quest: " + questName); SetDuckTextManuallyClientRpc(""); if (questCompleted.Value == 1) { PlayMiscSoundsClientRpc(0); SetDuckStartTalkingClientRpc("And one more thing for you!", 0.13f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer), isGlobal: false, setUIInvisibleAfter: false); } else { PlayMiscSoundsClientRpc(1); } ((EnemyAI)this).creatureAnimator.SetBool(isTalkingAnimation, true); yield return (object)new WaitUntil((Func)(() => !((EnemyAI)this).creatureSFX.isPlaying)); ((EnemyAI)this).creatureAnimator.SetBool(isTalkingAnimation, false); creatureNetworkAnimator.SetTrigger(startQuestAnimation, true); questStarted.Value = 1; ((EnemyAI)this).agent.speed = questSpeed; Vector3 randomSpawnPosition = ((Component)this).transform.position; if (RoundManager.Instance.insideAINodes.Length != 0) { randomSpawnPosition = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position; } SetDuckUIVisibleClientRpc(visible: true); string itemName = ((Registry)(object)LethalContent.Items)[questItems[Math.Clamp(questOrder.Value, 0, questItems.Length - 1)]].Item.itemName; SetDuckStartTalkingClientRpc("Find the " + itemName + "!!!", 0.12f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer), isGlobal: false, setUIInvisibleAfter: false); ((MonoBehaviour)this).StartCoroutine(QuestTimer(randomSpawnPosition, 0.5f)); } protected virtual IEnumerator QuestTimer(Vector3 randomSpawnPosition, float delay = 5f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) SetDuckUIItemUIPlayerClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer)); yield return (object)new WaitForSeconds(delay / 5f); DawnItemInfo itemInfo = default(DawnItemInfo); if (((Registry)(object)LethalContent.Items).TryGetValue(questItems[Math.Clamp(questOrder.Value, 0, questItems.Length - 1)], ref itemInfo)) { NetworkObjectReference item = CodeRebirthUtils.Instance.SpawnScrap(itemInfo.Item, randomSpawnPosition, isQuest: true); questItemsList.Add(NetworkObjectReference.op_Implicit(item)); currentQuestOrder.Value = Math.Clamp(questOrder.Value, 0, questItems.Length - 1); NetworkVariable obj = questOrder; int value = obj.Value; obj.Value = value + 1; yield return (object)new WaitForSeconds(delay / 5f * 4f); ((EnemyAI)this).SwitchToBehaviourClientRpc(3); while (internalQuestTimer <= questTimer) { internalQuestTimer += Time.deltaTime; yield return null; } questTimedOut.Value = 1; } } [ClientRpc] public void SetDuckUIItemUIPlayerClientRpc(int playerIndex) { DuckUI.Instance.itemUI.player = StartOfRound.Instance.allPlayerScripts[playerIndex]; } protected virtual void DoOngoingQuest() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || !((NetworkBehaviour)((EnemyAI)this).targetPlayer).IsSpawned || !((EnemyAI)this).targetPlayer.isPlayerControlled) { DoCompleteQuest(QuestCompletion.Null); } else if (questTimedOut.Value == 1) { SetDuckStartTalkingClientRpc("Too bad!!!", 0.05f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer), isGlobal: false, setUIInvisibleAfter: true); DoCompleteQuest(QuestCompletion.TimedOut); } else if (Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, ((Component)this).transform.position) < 5f && (Object)(object)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer != (Object)null && (Object)(object)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer.itemProperties == (Object)(object)((Registry)(object)LethalContent.Items)[questItems[currentQuestOrder.Value]].Item) { if (!questItemsList.Contains(((Component)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer).gameObject)) { SetDuckStartTalkingClientRpc("Too bad!!!", 0.05f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer), isGlobal: false, setUIInvisibleAfter: true); DoCompleteQuest(QuestCompletion.TimedOut); } else { TryCompleteQuest(); } } else { smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); } } protected virtual void TryCompleteQuest() { if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && (Object)(object)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer != (Object)null && (Object)(object)((EnemyAI)this).targetPlayer.currentlyHeldObjectServer.itemProperties == (Object)(object)((Registry)(object)LethalContent.Items)[questItems[currentQuestOrder.Value]].Item) { Plugin.ExtendedLogging("completed!"); SetDuckStartTalkingClientRpc("Good Job!!", 0.05f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, ((EnemyAI)this).targetPlayer), isGlobal: false, setUIInvisibleAfter: true); DoCompleteQuest(QuestCompletion.Completed); questStarted.Value = 0; } } protected virtual void DoCompleteQuest(QuestCompletion reason) { switch (reason) { case QuestCompletion.TimedOut: PlayMiscSoundsClientRpc(2); ((MonoBehaviour)this).StartCoroutine(QuestFailSequence(((EnemyAI)this).targetPlayer)); break; case QuestCompletion.Completed: { ((MonoBehaviour)this).StartCoroutine(QuestSucceedSequence()); NetworkVariable obj = questCompletionTimes; int value = obj.Value; obj.Value = value + 1; break; } case QuestCompletion.Null: Plugin.ExtendedLogging("Target Player or Enemy vents is null?"); PlayMiscSoundsClientRpc(2); ((MonoBehaviour)this).StartCoroutine(QuestFailSequence(((EnemyAI)this).targetPlayer)); break; } questItemsList.Clear(); if ((float)Random.Range(0, 100) < questRepeatChance && reason == QuestCompletion.Completed && questCompletionTimes.Value <= questRepeats) { questStarted.Value = 0; questTimedOut.Value = 0; questCompleted.Value = 1; ((EnemyAI)this).SwitchToBehaviourClientRpc(1); return; } if (reason == QuestCompletion.Completed) { PlayMiscSoundsClientRpc(3); } questCompleted.Value = 1; ((EnemyAI)this).agent.speed = docileSpeed; ((EnemyAI)this).SwitchToBehaviourClientRpc(4); float timer = Random.Range(45, 61); if (reason == QuestCompletion.Completed) { timer = Random.Range(180, 301); if (!StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { timer = 2.1474836E+09f; } } ((MonoBehaviour)this).StartCoroutine(RestartEnemy(timer)); smartAgentNavigator.StartSearchRoutine(40f); } protected virtual IEnumerator RestartEnemy(float timer) { yield return (object)new WaitForSeconds(timer); ResetEverything(); } protected virtual void ResetEverything() { questCompletionTimes.Value = 0; currentQuestOrder.Value = 0; questTimedOut.Value = 0; questCompleted.Value = 0; questStarted.Value = 0; questOrder.Value = 0; internalQuestTimer = 0f; ((EnemyAI)this).agent.speed = spawnSpeed; ((MonoBehaviour)this).StartCoroutine(DoSpawning()); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); } protected virtual IEnumerator QuestSucceedSequence() { yield return StartAnimation(startSucceedQuestAnimation); } protected virtual IEnumerator QuestFailSequence(PlayerControllerB? failure) { yield return (object)new WaitUntil((Func)(() => !((EnemyAI)this).creatureSFX.isPlaying)); creatureNetworkAnimator.SetTrigger(startFailQuestAnimation, true); yield return (object)new WaitForSeconds(1f); int bodyIndexToSpawn = Random.Range(0, deadBodies.Count); if ((Object)(object)failure != (Object)null) { SpawnDeadBodyClientRpc(bodyIndexToSpawn, ((Component)failure).transform.position, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, failure)); } PlayMiscSoundsClientRpc(4); yield return null; } [ClientRpc] public void SpawnDeadBodyClientRpc(int bodyIndexToSpawn, Vector3 deadPosition, int failureIndex) { //IL_001d: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) questsFailed++; GameObject val = deadBodies[bodyIndexToSpawn]; GameObject val2 = Object.Instantiate(val, deadPosition, default(Quaternion), (Transform)null); spawnedBodies.Add(val2); val2.gameObject.SetActive(true); StartOfRound.Instance.allPlayerScripts[failureIndex].KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 1, default(Vector3), false); Plugin.ExtendedLogging($"Spawning Deadbody, with questsFailed: {questsFailed} and this many stages of bloodiness {bloodyMaterials.Length}"); if (questsFailed <= bloodyMaterials.Length) { ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).SetMaterial(bloodyMaterials[questsFailed - 1]); } } protected IEnumerator StartAnimation(int animationInt, int layerIndex = 0, string stateName = "Walking Animation") { yield return (object)new WaitUntil((Func)(() => !((EnemyAI)this).creatureSFX.isPlaying)); creatureNetworkAnimator.SetTrigger(animationInt, true); yield return (object)new WaitUntil((Func)delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = ((EnemyAI)this).creatureAnimator.GetCurrentAnimatorStateInfo(layerIndex); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(stateName); }); } protected virtual void DoDocile() { } protected virtual void OnDisable() { DuckUI.Instance.SetUIVisible(visible: false); DuckUI.Instance.SetTextManually(""); foreach (GameObject spawnedBody in spawnedBodies) { Object.Destroy((Object)(object)spawnedBody); } } public override void Update() { base.Update(); if (((EnemyAI)this).creatureSFX.isPlaying || ((EnemyAI)this).currentBehaviourStateIndex == 1 || ((EnemyAI)this).currentBehaviourStateIndex == 4) { ((EnemyAI)this).creatureVoice.volume = 0f; } else { ((EnemyAI)this).creatureVoice.volume = 0.39f; } } public override void DoAIInterval() { //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) ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead && ((NetworkBehaviour)this).IsHost) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int num = runSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 2f); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: break; case 1: DoWandering(); break; case 2: DoApproaching(); break; case 3: DoOngoingQuest(); break; case 4: DoDocile(); break; default: Plugin.ExtendedLogging("This Behavior State doesn't exist!"); break; } } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((NetworkBehaviour)this).IsServer && ((EnemyAI)this).currentBehaviourStateIndex == 3) { internalQuestTimer += force; } } [ClientRpc] public void SetDuckTextManuallyClientRpc(string text) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)((EnemyAI)this).targetPlayer) { DuckUI.Instance.SetTextManually(text); } } [ClientRpc] public void SetDuckStartTalkingClientRpc(string text, float talkspeed, int targetPlayerIndex, bool isGlobal, bool setUIInvisibleAfter) { PlayerControllerB targetPlayer = StartOfRound.Instance.allPlayerScripts[targetPlayerIndex]; if (setUIInvisibleAfter) { DuckUI.Instance.StartTalking(text, talkspeed, targetPlayer, isGlobal, delegate { DuckUI.Instance.SetUIVisible(visible: false); }); } else { DuckUI.Instance.StartTalking(text, talkspeed, targetPlayer, isGlobal); } } [ClientRpc] public void SetDuckUIVisibleClientRpc(bool visible) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)((EnemyAI)this).targetPlayer) { DuckUI.Instance.SetUIVisible(visible); } } } public class QuestItem : MonoBehaviour { } public class RabbitMagician : CodeRebirthEnemyAI { public enum RabbitMagicianState { Spawn, Idle, Attached, SwitchingTarget } [Header("Audio")] [SerializeField] private AudioClip _spottedFromGroundAudioClip = null; [SerializeField] private AudioClip _spottedFromBackAudioClip = null; [SerializeField] private AudioClip[] _fallingAudioClips = null; [Header("Animation")] [SerializeField] private AnimationClip _spawnAnimation = null; [SerializeField] private AnimationClip _spottedFromGroundAnimation = null; [SerializeField] private AnimationClip _spottedFromBackAnimation = null; [Header("Misc")] [SerializeField] private Collider[] _collidersToDisable = null; [SerializeField] private ParticleSystem _confettiParticles = null; [SerializeField] private Vector3 _offsetPosition = new Vector3(0.031f, -0.109f, -0.471f); private Coroutine? _killRoutine = null; private Coroutine? _attachRoutine = null; private Coroutine? _idleRoutine = null; private Transform? _targetPlayerSpine3 = null; private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); private static readonly int LatchOnAnimation = Animator.StringToHash("LatchOn"); private static readonly int SpottedFromGroundAnimation = Animator.StringToHash("SpottedFromGround"); private static readonly int SpottedFromBackAnimation = Animator.StringToHash("SpottedFromBack"); private static readonly int ResetToIdleAnimation = Animator.StringToHash("ResetToIdle"); internal static VehicleController? vehicleController = null; public override void Start() { base.Start(); Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { foreach (Collider playerCollider in GameNetworkManager.Instance.localPlayerController.GetCRPlayerData().playerColliders) { Physics.IgnoreCollision(val, playerCollider, true); } if (!((Object)(object)vehicleController == (Object)null)) { Collider[] componentsInChildren2 = ((Component)vehicleController).GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren2) { Physics.IgnoreCollision(val, val2, true); } } } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { _idleRoutine = ((MonoBehaviour)this).StartCoroutine(SwitchToIdle()); } } [ServerRpc(RequireOwnership = false)] private void AttachToPlayerServerRpc(PlayerControllerReference player) { PlayerControllerB playerToAttachTo = PlayerControllerReference.op_Implicit(player); ((EnemyAI)this).SwitchToBehaviourClientRpc(3); _attachRoutine = ((MonoBehaviour)this).StartCoroutine(AttachToPlayer(playerToAttachTo, null)); } public override void Update() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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) //IL_024d: Unknown result type (might be due to invalid IL or missing references) base.Update(); if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer)) { _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(0, _idleAudioClips.audioClips.Length)]); } } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (((EnemyAI)this).currentBehaviourStateIndex == 1) { if (!((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) && _attachRoutine == null && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled && !localPlayerController.IsPseudoDead() && localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.5f, 30f, 50, -1f, -1)) { SpottedSoundServerRpc(PlayerControllerReference.op_Implicit(localPlayerController), fromGround: true); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); AttachToPlayerServerRpc(PlayerControllerReference.op_Implicit(localPlayerController)); } } else if (((EnemyAI)this).currentBehaviourStateIndex == 2 && !((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) && !((EnemyAI)this).targetPlayer.isPlayerDead && !((EnemyAI)this).targetPlayer.IsPseudoDead() && !PlayerControllerBExtensions.IsLocalPlayer(((EnemyAI)this).targetPlayer) && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled && !localPlayerController.IsPseudoDead() && _killRoutine == null && CodeRebirthEnemyAI.PlayerLookingAtPosition(localPlayerController, ((Component)((EnemyAI)this).targetPlayer).transform.position, 0.2f) && !(Vector3.Dot(((Component)localPlayerController.gameplayCamera).transform.forward, ((Component)((EnemyAI)this).targetPlayer.gameplayCamera).transform.forward) <= 0.45f)) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); localPlayerController.JumpToFearLevel(0.4f, true); KillAndSwitchTargetServerRpc(PlayerControllerReference.op_Implicit(localPlayerController)); } } [ServerRpc(RequireOwnership = false)] private void KillAndSwitchTargetServerRpc(PlayerControllerReference player) { PlayerControllerB newTargetPlayer = PlayerControllerReference.op_Implicit(player); _killRoutine = ((MonoBehaviour)this).StartCoroutine(KillPlayerAndSwitchTarget(newTargetPlayer)); } public void LateUpdate() { if (((EnemyAI)this).currentBehaviourStateIndex == 3 && (Object)(object)previousTargetPlayer != (Object)null && !previousTargetPlayer.isPlayerDead) { SetPositionAndRotation(previousTargetPlayer); } else if (((EnemyAI)this).currentBehaviourStateIndex == 2 && _attachRoutine == null && !((Object)(object)((EnemyAI)this).targetPlayer == (Object)null)) { SetPositionAndRotation(((EnemyAI)this).targetPlayer); } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoSpawn(); break; case 1: DoIdle(); break; case 2: DoAttached(); break; case 3: DoSwitchingTarget(); break; } } public void DoSpawn() { } public void DoIdle() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (_attachRoutine == null) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 3f); } } public void DoAttached() { if (((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || ((EnemyAI)this).targetPlayer.IsPseudoDead()) && _killRoutine == null && _idleRoutine == null) { _idleRoutine = ((MonoBehaviour)this).StartCoroutine(SwitchToIdle()); } } public void DoSwitchingTarget() { } private void SetPositionAndRotation(PlayerControllerB player) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0076: Unknown result type (might be due to invalid IL or missing references) if (PlayerControllerBExtensions.IsLocalPlayer(player)) { _targetPlayerSpine3 = ((Component)player.gameplayCamera).transform; Vector3 val = _targetPlayerSpine3.rotation * (_offsetPosition + new Vector3(0f, -0.32f, 0.1f)); ((Component)this).transform.position = _targetPlayerSpine3.position + val; ((Component)this).transform.rotation = _targetPlayerSpine3.rotation; } else { _targetPlayerSpine3 = player.upperSpine; Vector3 val = _targetPlayerSpine3.rotation * _offsetPosition; ((Component)this).transform.position = _targetPlayerSpine3.position + val; ((Component)this).transform.rotation = _targetPlayerSpine3.rotation; } } private IEnumerator KillPlayerAndSwitchTarget(PlayerControllerB newTargetPlayer) { ((EnemyAI)this).SwitchToBehaviourServerRpc(3); SpottedSoundServerRpc(PlayerControllerReference.op_Implicit(((EnemyAI)this).targetPlayer), fromGround: false); _attachRoutine = ((MonoBehaviour)this).StartCoroutine(AttachToPlayer(newTargetPlayer, ((EnemyAI)this).targetPlayer)); yield return _attachRoutine; _killRoutine = null; } [ServerRpc(RequireOwnership = false)] private void SpottedSoundServerRpc(PlayerControllerReference oldTargetPlayer, bool fromGround) { SpottedSoundClientRpc(oldTargetPlayer, fromGround); } [ClientRpc] private void SpottedSoundClientRpc(PlayerControllerReference oldTargetPlayer, bool fromGround) { PlayerControllerB val = PlayerControllerReference.op_Implicit(oldTargetPlayer); if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)val)) { if (fromGround) { ((EnemyAI)this).creatureSFX.PlayOneShot(_spottedFromGroundAudioClip); return; } val.JumpToFearLevel(0.4f, true); ((EnemyAI)this).creatureSFX.PlayOneShot(_spottedFromBackAudioClip); } } [ServerRpc(RequireOwnership = false)] private void FallSoundServerRpc(PlayerControllerReference newTargetPlayer) { FallSoundClientRpc(newTargetPlayer); } [ClientRpc] private void FallSoundClientRpc(PlayerControllerReference newTargetPlayer) { PlayerControllerB val = PlayerControllerReference.op_Implicit(newTargetPlayer); if (PlayerControllerBExtensions.IsLocalPlayer(val)) { ((EnemyAI)this).creatureSFX.PlayOneShot(_fallingAudioClips[Random.Range(0, _fallingAudioClips.Length)]); } } private IEnumerator SwitchToIdle() { creatureNetworkAnimator.SetTrigger(ResetToIdleAnimation, true); yield return (object)new WaitForSeconds(_spawnAnimation.length); ((Behaviour)smartAgentNavigator).enabled = true; ((Behaviour)((EnemyAI)this).agent).enabled = true; ((EnemyAI)this).SwitchToBehaviourServerRpc(1); smartAgentNavigator.StartSearchRoutine(20f); TurnOnCollidersClientRpc(); _idleRoutine = null; } [ClientRpc] private void TurnOnCollidersClientRpc() { Collider[] collidersToDisable = _collidersToDisable; foreach (Collider val in collidersToDisable) { ((Component)val).gameObject.SetActive(true); } } public IEnumerator AttachToPlayer(PlayerControllerB playerToAttachTo, PlayerControllerB? previouslyAttachedToPlayer) { smartAgentNavigator.StopSearchRoutine(); SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(playerToAttachTo)); Plugin.ExtendedLogging($"Attaching to {playerToAttachTo} from {previouslyAttachedToPlayer}"); if ((Object)(object)previouslyAttachedToPlayer != (Object)null) { creatureNetworkAnimator.SetTrigger(SpottedFromBackAnimation, true); yield return (object)new WaitForSeconds(8.54f); if (playerToAttachTo.isPlayerDead || playerToAttachTo.IsPseudoDead()) { ((EnemyAI)this).SwitchToBehaviourServerRpc(2); SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(playerToAttachTo)); yield break; } PlayConfettiServerRpc(); FallSoundServerRpc(PlayerControllerReference.op_Implicit(playerToAttachTo)); CodeRebirthUtils.Instance.KillPlayerOnOwnerServerRpc(PlayerControllerReference.op_Implicit(previouslyAttachedToPlayer), spawnBody: true, 0, 1, Vector3.zero); } ((Behaviour)smartAgentNavigator).enabled = false; if (!((Behaviour)((EnemyAI)this).agent).enabled) { RaycastHit hit = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.5f, Vector3.down, ref hit, 20f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((Component)this).transform.position = ((RaycastHit)(ref hit)).point; } yield return null; } ((Behaviour)((EnemyAI)this).agent).enabled = false; if ((Object)(object)previouslyAttachedToPlayer == (Object)null) { creatureNetworkAnimator.SetTrigger(SpottedFromGroundAnimation, true); yield return (object)new WaitForSeconds(_spottedFromGroundAnimation.length); } else { yield return (object)new WaitForSeconds(_spottedFromBackAnimation.length - 8.54f); } if ((Object)(object)playerToAttachTo == (Object)null || playerToAttachTo.isPlayerDead || playerToAttachTo.IsPseudoDead()) { _idleRoutine = ((MonoBehaviour)this).StartCoroutine(SwitchToIdle()); _attachRoutine = null; } else { AttachedPlayerHandleLOSClientRpc(); } } [ClientRpc] private void AttachedPlayerHandleLOSClientRpc() { Collider[] collidersToDisable = _collidersToDisable; foreach (Collider val in collidersToDisable) { ((Component)val).gameObject.SetActive(false); } if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)((EnemyAI)this).targetPlayer)) { ((MonoBehaviour)this).StartCoroutine(HandleLOS()); } } private IEnumerator HandleLOS() { bool lookedAt = true; while (lookedAt) { yield return (object)new WaitForSeconds(0.25f); if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || ((EnemyAI)this).targetPlayer.isPlayerDead || ((EnemyAI)this).targetPlayer.IsPseudoDead()) { BackToIdleServerRpc(); yield break; } lookedAt = CodeRebirthEnemyAI.PlayerLookingAtPosition(((EnemyAI)this).targetPlayer, ((Component)this).transform.position, 0.2f); } StartAttachedServerRpc(); } [ServerRpc(RequireOwnership = false)] public void PlayConfettiServerRpc() { PlayConfettiClientRpc(); } [ClientRpc] public void PlayConfettiClientRpc() { _confettiParticles.Play(true); } [ServerRpc(RequireOwnership = false)] public void BackToIdleServerRpc() { _attachRoutine = null; _idleRoutine = ((MonoBehaviour)this).StartCoroutine(SwitchToIdle()); } [ServerRpc(RequireOwnership = false)] public void StartAttachedServerRpc() { _attachRoutine = null; creatureNetworkAnimator.SetTrigger(LatchOnAnimation, true); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } public class RedwoodTitanAI : CodeRebirthEnemyAI, IVisibleThreat { private enum State { Spawn, Idle, Wandering, RunningToTarget, EatingTargetGiant } public Material AlbinoCharredMaterial = null; public Material NormalCharredMaterial = null; public ParticleSystem[] BurnParticles = Array.Empty(); public AudioClip BurningSound = null; public Collider[] DeathColliders = null; public Collider CollisionFootR = null; public Collider CollisionFootL = null; public ParticleSystem DustParticlesLeft = null; public ParticleSystem DustParticlesRight = null; public ParticleSystem ForestKeeperParticles = null; public ParticleSystem DriftwoodGiantParticles = null; public ParticleSystem CactusBudlingParticles = null; public ParticleSystem OldBirdParticles = null; public ParticleSystem DeathParticles = null; public AudioSource creatureSFXFar = null; public AudioClip eatenSound = null; public AudioClip roarSound = null; public AudioClip crunchySquishSound = null; public GameObject holdingBone = null; public GameObject eatingArea = null; public AnimationClip eating = null; private Vector3 eatPosition = Vector3.zero; private bool sizeUp = false; private bool eatingEnemy = false; private float walkingSpeed = 0f; private float seeableDistance = 0f; private float distanceFromShip = 0f; private Transform shipBoundaries = null; private Collider[] enemyColliders = null; private static readonly int startEnrage = Animator.StringToHash("startEnrage"); private static readonly int eatEnemyGiant = Animator.StringToHash("eatEnemyGiant"); private static readonly int IsDeadAnimation = Animator.StringToHash("IsDead"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeedFloat"); internal static int instanceNumbers = 0; private Coroutine? _burnGiantRoutine = null; private bool burnedOnce = false; ThreatType IVisibleThreat.type => (ThreatType)4; int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 18; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return ((EnemyAI)this).eye; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return ((EnemyAI)this).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).isEnemyDead) { return 0f; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { return 1f; } return 0.75f; } bool IVisibleThreat.IsThreatDead() { return ((EnemyAI)this).isEnemyDead; } GrabbableObject? IVisibleThreat.GetHeldObject() { return null; } public override void Start() { base.Start(); instanceNumbers++; walkingSpeed = Plugin.ModConfig.ConfigRedwoodSpeed.Value; distanceFromShip = Plugin.ModConfig.ConfigRedwoodShipPadding.Value; seeableDistance = Plugin.ModConfig.ConfigRedwoodEyesight.Value; shipBoundaries = ((Component)StartOfRound.Instance.shipBounds).transform; enemyColliders = ((Component)this).GetComponentsInChildren(); creatureSFXFar.PlayOneShot(spawnSound); ((EnemyAI)this).creatureVoice.PlayOneShot(roarSound); smartAgentNavigator.StopAgent(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); CodeRebirthPlayerManager.OnDoorStateChange += OnShipDoorStateChange; ((MonoBehaviour)this).StartCoroutine(UpdateAudio()); } private IEnumerator UpdateAudio() { while (!((EnemyAI)this).isEnemyDead) { if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { ((EnemyAI)this).creatureSFX.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value * Plugin.ModConfig.ConfigRedwoodInShipVolume.Value; creatureSFXFar.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value * Plugin.ModConfig.ConfigRedwoodInShipVolume.Value; ((EnemyAI)this).creatureVoice.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value * Plugin.ModConfig.ConfigRedwoodInShipVolume.Value; } else { ((EnemyAI)this).creatureSFX.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value; creatureSFXFar.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value; ((EnemyAI)this).creatureVoice.volume = Plugin.ModConfig.ConfigRedwoodNormalVolume.Value; } yield return (object)new WaitForSeconds(1f); } } private void OnShipDoorStateChange(object sender, bool shipDoorClosed) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || val.isPlayerDead || !val.isPlayerControlled || !val.ContainsCRPlayerData()) { continue; } foreach (Collider playerCollider in val.GetPlayerColliders()) { if ((Object)(object)playerCollider == (Object)null) { continue; } Collider[] array = enemyColliders; foreach (Collider val2 in array) { if (!((Object)(object)val2 == (Object)null)) { Physics.IgnoreCollision(playerCollider, val2, shipDoorClosed && val.isInHangarShipRoom); } } } } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); CodeRebirthPlayerManager.OnDoorStateChange -= OnShipDoorStateChange; instanceNumbers--; } public void LateUpdate() { if (!((EnemyAI)this).isEnemyDead) { EatTargetGiantLateUpdate(); } } public void EatTargetGiantLateUpdate() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_009c: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)this).currentBehaviourStateIndex == 4 && !((Object)(object)targetEnemy == (Object)null)) { ((Component)this).transform.position = eatPosition; Vector3 position = holdingBone.transform.position; ((Component)targetEnemy).transform.position = position + new Vector3(0f, -1f, 0f); ((Component)targetEnemy).transform.LookAt(eatingArea.transform.position); ((Component)targetEnemy).transform.position = position + new Vector3(0f, -5.5f, 0f); if (!sizeUp) { ((Component)targetEnemy).transform.position = position + new Vector3(0f, -1f, 0f); ((Component)targetEnemy).transform.LookAt(eatingArea.transform.position); ((Component)targetEnemy).transform.position = position + new Vector3(0f, -6f, 0f); Vector3 localScale = ((Component)targetEnemy).transform.localScale; localScale.x *= 1.4f; localScale.y *= 1.3f; localScale.z *= 1.4f; ((Component)targetEnemy).transform.localScale = localScale; sizeUp = true; } Transform transform = ((Component)targetEnemy).transform; transform.position += new Vector3(0f, 0.02f, 0f); Vector3 localScale2 = ((Component)targetEnemy).transform.localScale; localScale2 *= 0.9995f; ((Component)targetEnemy).transform.localScale = Vector3.Lerp(((Component)targetEnemy).transform.localScale, localScale2, Time.deltaTime); } } [ServerRpc(RequireOwnership = false)] private void PlayMiscSoundsServerRpc(int soundID) { PlayMiscSoundsClientRpc(soundID); } [ClientRpc] private void PlayMiscSoundsClientRpc(int soundID) { switch (soundID) { case 2: ((EnemyAI)this).creatureSFX.PlayOneShot(crunchySquishSound); creatureSFXFar.PlayOneShot(crunchySquishSound); break; case 3: ((EnemyAI)this).creatureVoice.PlayOneShot(roarSound); break; } } public override void DoAIInterval() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead) { Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude); switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: break; case 1: break; case 2: DoWandering(); break; case 3: DoRunningToTarget(); break; case 4: break; } } } public void DoWandering() { if (FindClosestAliveGiantInRange(seeableDistance)) { Plugin.ExtendedLogging("Start Target Giant"); smartAgentNavigator.StopSearchRoutine(); PlayMiscSoundsClientRpc(3); ((EnemyAI)this).SwitchToBehaviourServerRpc(3); ((MonoBehaviour)this).StartCoroutine(SetSpeedForChasingGiant()); } } public IEnumerator SetSpeedForChasingGiant() { ((EnemyAI)this).agent.speed = 0f; smartAgentNavigator.StopAgent(); creatureNetworkAnimator.SetTrigger(startEnrage, true); yield return (object)new WaitForSeconds(6.9f); if (((EnemyAI)this).currentBehaviourStateIndex != 3) { Plugin.Logger.LogWarning((object)$"Redwood Not running to target with speed: {((EnemyAI)this).agent.speed}, plus is dead: {((EnemyAI)this).isEnemyDead}"); if (((EnemyAI)this).agent.speed < 0.5f && !((EnemyAI)this).isEnemyDead) { ((EnemyAI)this).agent.angularSpeed = 40f; ((EnemyAI)this).agent.speed = walkingSpeed; } } else { ((EnemyAI)this).agent.angularSpeed = 100f; ((EnemyAI)this).agent.speed = walkingSpeed * 4f; } } public void DoRunningToTarget() { //IL_007b: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEnemy == (Object)null || targetEnemy.isEnemyDead) { ClearEnemyTargetServerRpc(); Plugin.ExtendedLogging("Stop Target Giant"); ((EnemyAI)this).agent.angularSpeed = 40f; smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = walkingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } else if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) >= seeableDistance + 10f && !RWHasLineOfSightToPosition(((Component)targetEnemy).transform.position, 120f, seeableDistance, 5f)) { Plugin.ExtendedLogging("Stop Target Giant"); ((EnemyAI)this).agent.angularSpeed = 40f; smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).agent.speed = walkingSpeed; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } else { smartAgentNavigator.DoPathingToDestination(((Component)targetEnemy).transform.position); } } public void DealEnemyDamageFromShockwave(EnemyAI enemy, float distanceFromEnemy) { if (distanceFromEnemy <= 3f) { enemy.HitEnemy(2 * ((_burnGiantRoutine == null) ? 1 : 2), (PlayerControllerB)null, false, -1); } else if (distanceFromEnemy <= 10f) { enemy.HitEnemy((_burnGiantRoutine == null) ? 1 : 2, (PlayerControllerB)null, false, -1); } if (_burnGiantRoutine != null) { enemy.HitFromExplosion(distanceFromEnemy); } } public void ParticlesFromEatingForestKeeper(EnemyAI targetEnemy) { if (targetEnemy is ForestGiantAI) { ForestKeeperParticles.Play(); } else if (targetEnemy is DriftwoodMenaceAI) { DriftwoodGiantParticles.Play(); } else if (targetEnemy is CactusBudling) { CactusBudlingParticles.Play(); } else if (targetEnemy is RadMechAI) { OldBirdParticles.Play(); } targetEnemy.KillEnemyOnOwnerClient(true); } public bool FindClosestAliveGiantInRange(float range) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) EnemyAI val = null; float num = range; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!spawnedEnemy.isEnemyDead && (spawnedEnemy is DriftwoodMenaceAI || spawnedEnemy is ForestGiantAI || spawnedEnemy is CactusBudling)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (num2 < num && Vector3.Distance(((Component)spawnedEnemy).transform.position, shipBoundaries.position) > distanceFromShip) { num = num2; val = spawnedEnemy; } } } if ((Object)(object)val != (Object)null) { SetEnemyTargetServerRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)val)); return true; } return false; } public IEnumerator EatTargetEnemy(EnemyAI targetEnemy) { AudioSource[] componentsInChildren = ((Component)targetEnemy).GetComponentsInChildren(); foreach (AudioSource audioSource in componentsInChildren) { audioSource.mute = true; } ((EnemyAI)this).creatureVoice.PlayOneShot(eatenSound, 1f); if (((NetworkBehaviour)this).IsServer) { creatureNetworkAnimator.SetTrigger(eatEnemyGiant, true); if (targetEnemy is DriftwoodMenaceAI driftwoodMenaceAI) { ((EnemyAI)driftwoodMenaceAI).SwitchToBehaviourServerRpc(8); ((EnemyAI)driftwoodMenaceAI).creatureAnimator.SetBool(DriftwoodMenaceAI.GrabbedAnimation, true); } else if (targetEnemy is CactusBudling cactusBudling) { ((EnemyAI)cactusBudling).SwitchToBehaviourServerRpc(5); ((EnemyAI)cactusBudling).creatureAnimator.SetBool(CactusBudling.GrabbedAnimation, true); ((EnemyAI)cactusBudling).creatureAnimator.SetBool(CactusBudling.RollingAnimation, false); ((EnemyAI)cactusBudling).creatureAnimator.SetBool(CactusBudling.RootingAnimation, false); } } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4); smartAgentNavigator.StopAgent(); ((EnemyAI)this).agent.speed = 0f; yield return (object)new WaitForSeconds(eating.length + 5f); if (((EnemyAI)this).isEnemyDead) { yield break; } if ((Object)(object)targetEnemy != (Object)null) { foreach (EnemyAI enemy in RoundManager.Instance.SpawnedEnemies) { RadMechAI radMech = (RadMechAI)(object)((enemy is RadMechAI) ? enemy : null); if (radMech != null && (Object)(object)radMech.focusedThreatTransform == (Object)(object)((Component)targetEnemy).transform) { radMech.targetedThreatCollider = null; radMech.CheckSightForThreat(); } } } ((EnemyAI)this).agent.angularSpeed = 40f; ((EnemyAI)this).agent.speed = walkingSpeed; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); } [ServerRpc(RequireOwnership = false)] private void BurnGiantServerRpc() { BurnGiantClientRpc(); } [ClientRpc] private void BurnGiantClientRpc() { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } private IEnumerator BurnGiant() { ParticleSystem[] burnParticles = BurnParticles; foreach (ParticleSystem particleSystem in burnParticles) { particleSystem.Play(); } ((EnemyAI)this).creatureSFX.clip = BurningSound; ((EnemyAI)this).creatureSFX.loop = true; ((EnemyAI)this).creatureSFX.Play(); yield return (object)new WaitForSeconds(30f); ((EnemyAI)this).creatureSFX.Stop(); if (!burnedOnce) { if (((Object)((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).sharedMaterials[3]).name == "AlbinoBody") { List materials = ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).sharedMaterials.ToList(); materials[3] = AlbinoCharredMaterial; ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).SetSharedMaterials(materials); } else { List materials2 = ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).sharedMaterials.ToList(); materials2[3] = NormalCharredMaterial; ((Renderer)((EnemyAI)this).skinnedMeshRenderers[0]).SetSharedMaterials(materials2); } burnedOnce = true; } ((EnemyAI)this).HitEnemy(20, (PlayerControllerB)null, false, -1); _burnGiantRoutine = null; } public override void HitFromExplosion(float distance) { ((EnemyAI)this).HitFromExplosion(distance); if (_burnGiantRoutine == null) { BurnGiantServerRpc(); } } public override void OnCollideWithPlayer(Collider other) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)this).isEnemyDead) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (!((Object)(object)val == (Object)null)) { val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)8, (_burnGiantRoutine != null) ? 6 : 0, default(Vector3), false); } } } public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (((EnemyAI)this).isEnemyDead || !((Object)(object)collidedEnemy == (Object)(object)targetEnemy) || eatingEnemy || ((EnemyAI)this).currentBehaviourStateIndex != 3) { return; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).magnitude >= 1f) { eatPosition = ((Component)this).transform.position; eatingEnemy = true; ((Behaviour)collidedEnemy.agent).enabled = false; Collider[] componentsInChildren = ((Component)collidedEnemy).GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { val.enabled = false; } Plugin.ExtendedLogging("Eating Giant"); ((MonoBehaviour)this).StartCoroutine(EatTargetEnemy(collidedEnemy)); } } public bool RWHasLineOfSightToPosition(Vector3 pos, float width, float range, float proximityAwareness) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((EnemyAI)this).eye.position, pos) < range && !Physics.Linecast(((EnemyAI)this).eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { Vector3 val = pos - ((EnemyAI)this).eye.position; if (Vector3.Angle(((EnemyAI)this).eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness) { return true; } } return false; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((EnemyAI)this).isEnemyDead) { return; } if (hitID == 745737 && _burnGiantRoutine == null) { _burnGiantRoutine = ((MonoBehaviour)this).StartCoroutine(BurnGiant()); } if (force >= 6 && TargetClosestRadMech(seeableDistance) && ((EnemyAI)this).currentBehaviourStateIndex == 2 && Plugin.ModConfig.ConfigRedwoodCanEatOldBirds.Value) { if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StopSearchRoutine(); ((MonoBehaviour)this).StartCoroutine(SetSpeedForChasingGiant()); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); } ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead) { if (((EnemyAI)this).currentBehaviourStateIndex == 4) { ((EnemyAI)this).enemyHP = 1; } else if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); CollisionFootL.enabled = false; CollisionFootR.enabled = false; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).creatureAnimator.SetBool(IsDeadAnimation, true); } if ((Object)(object)targetEnemy != (Object)null && (Object)(object)targetEnemy.agent != (Object)null) { if (((NetworkBehaviour)this).IsServer && targetEnemy is DriftwoodMenaceAI driftwoodMenaceAI) { ((EnemyAI)driftwoodMenaceAI).SwitchToBehaviourServerRpc(1); ((EnemyAI)driftwoodMenaceAI).creatureAnimator.SetBool(DriftwoodMenaceAI.GrabbedAnimation, false); } else if (((NetworkBehaviour)this).IsServer && targetEnemy is CactusBudling cactusBudling) { ((EnemyAI)cactusBudling).SwitchToBehaviourServerRpc(0); cactusBudling.GetNextRootPosition(); ((EnemyAI)cactusBudling).creatureAnimator.SetBool(CactusBudling.GrabbedAnimation, false); } ((Behaviour)targetEnemy.agent).enabled = true; } } public bool TargetClosestRadMech(float range) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) EnemyAI val = null; float num = float.MaxValue; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!spawnedEnemy.isEnemyDead && spawnedEnemy is RadMechAI) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (num2 < range && num2 < num) { num = num2; val = spawnedEnemy; } } } if ((Object)(object)val != (Object)null) { targetEnemy = val; return true; } return false; } public void WanderAroundAfterSpawnAnimation() { if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } Plugin.ExtendedLogging("Start Walking Around"); ((EnemyAI)this).agent.speed = walkingSpeed; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); } public void EnableDeathColliders() { ToggleDeathColliders(enable: true); } public void DisableDeathColliders() { DeathParticles.Play(); ToggleDeathColliders(enable: false); } private void ToggleDeathColliders(bool enable) { Collider[] deathColliders = DeathColliders; foreach (Collider val in deathColliders) { ((Component)val).gameObject.GetComponent().enabledScript = enable; } } public void EatingTargetGiant() { if (!((Object)(object)targetEnemy == (Object)null) && !((EnemyAI)this).isEnemyDead) { ParticlesFromEatingForestKeeper(targetEnemy); eatingEnemy = false; sizeUp = false; targetEnemy = null; } } public void LeftFootStepInteractions() { FootstepInteractions(ref CollisionFootL, ref DustParticlesLeft); } public void RightFootStepInteractions() { FootstepInteractions(ref CollisionFootR, ref DustParticlesRight); } public void FootstepInteractions(ref Collider foot, ref ParticleSystem footParticles) { //IL_0044: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) footParticles.Play(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (((NetworkBehaviour)localPlayerController).IsSpawned && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead && !localPlayerController.isInHangarShipRoom) { float num = Vector3.Distance(((Component)foot).transform.position, ((Component)localPlayerController).transform.position); if (num <= 10f) { localPlayerController.DamagePlayer(10 * ((_burnGiantRoutine == null) ? 1 : 3), true, true, (CauseOfDeath)8, 0, false, default(Vector3)); } } List spawnedEnemies = RoundManager.Instance.SpawnedEnemies; for (int num2 = spawnedEnemies.Count - 1; num2 >= 0; num2--) { if (!((Object)(object)spawnedEnemies[num2] == (Object)null) && !spawnedEnemies[num2].isEnemyDead && !(spawnedEnemies[num2] is RedwoodTitanAI)) { float num3 = Vector3.Distance(((Component)foot).transform.position, ((Component)spawnedEnemies[num2]).transform.position); if (num3 <= 7.5f) { DealEnemyDamageFromShockwave(spawnedEnemies[num2], num3); } } } } } public class SnailCatAI : CodeRebirthEnemyAI { public enum State { Wandering, Following, Sleeping, Sitting, Grabbed } public SnailCatPhysicsProp propScript = null; public ScanNodeProperties scanNodeProperties = null; public AudioClip[] enemyDetectSounds = Array.Empty(); public AudioClip[] wiwiwiiiSound = Array.Empty(); [SerializeField] internal Renderer _specialRenderer = null; internal string currentName = ""; private bool holdingBaby = false; private Coroutine? dropBabyCoroutine = null; internal PlayerControllerB? playerHolding = null; private float specialActionTimer = 1f; private float detectEnemyInterval = 0f; private bool isWiWiWiii = false; internal Vector3 fakeLocalScale = Vector3.one; internal float shiftHash = 0f; internal bool wasFake = false; private float _previousLightValue = 0f; private DetectLightInSurroundings detectLightInSurroundings = null; internal static int ShiftHash = Shader.PropertyToID("_Shift"); private static int TemperatureHash = Shader.PropertyToID("_Temperature"); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); smartAgentNavigator.OnUseEntranceTeleport.AddListener((UnityAction)OnUseEntranceTeleport); if (((NetworkBehaviour)this).IsServer) { DelayForBit(); } } public void OnUseEntranceTeleport(bool setOutside) { ((GrabbableObject)propScript).isInFactory = setOutside; ((MonoBehaviour)this).StartCoroutine(SetItemPhysics((GrabbableObject)(object)propScript)); } private IEnumerator SetItemPhysics(GrabbableObject grabbableObject) { yield return (object)new WaitForSeconds(0.1f); grabbableObject.EnablePhysics(false); } private void DelayForBit() { //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!wasFake) { List list = new List(); list = (from s in ((AssetBundleLoader)(object)ContentHandler.Instance.SnailCat).GetConfig("SnailCat | Possible SnailCat Names").Value.Split(';') select s.Trim()).ToList(); if (list.Count == 0) { list.Add("Salted Beef"); } string text = list[enemyRandom.Next(list.Count)]; float num = RandomExtensions.NextFloat(enemyRandom, 0.75f, 1.25f); Transform transform = ((Component)this).transform; transform.localScale *= num; currentName = text; scanNodeProperties.headerText = currentName; if (currentName == "Salted Beef") { Transform transform2 = ((Component)this).transform; transform2.localScale *= 0.1f; } ((GrabbableObject)propScript).originalScale = ((Component)this).transform.localScale; fakeLocalScale = ((Component)this).transform.localScale; isWiWiWiii = currentName == "Wiwiwii"; shiftHash = ApplyVariants(_specialRenderer); } SyncNewSnailCatServerRpc(fakeLocalScale, currentName, shiftHash, PlayerControllerReference.op_Implicit(playerHolding)); } [ServerRpc(RequireOwnership = false)] public void SyncNewSnailCatServerRpc(Vector3 scale, string name, float magicalHashNumber, PlayerControllerReference playerControllerReference) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SyncNewSnailCatClientRpc(scale, name, magicalHashNumber, playerControllerReference); } [ClientRpc] private void SyncNewSnailCatClientRpc(Vector3 scale, string name, float magicalHashNumber, PlayerControllerReference playerControllerReference) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = scale; ((GrabbableObject)propScript).originalScale = scale; currentName = name; scanNodeProperties.headerText = currentName; isWiWiWiii = currentName == "Wiwiwii"; _specialRenderer.materials[0].SetFloat(ShiftHash, magicalHashNumber); detectLightInSurroundings = ((Component)this).gameObject.AddComponent(); detectLightInSurroundings.OnLightValueChange.AddListener((UnityAction)OnLightValueChange); playerHolding = PlayerControllerReference.op_Implicit(playerControllerReference); if ((Object)(object)playerHolding != (Object)null && PlayerControllerBExtensions.IsLocalPlayer(playerHolding)) { CRUtilities.MakePlayerGrabObject(playerHolding, (GrabbableObject)(object)propScript); } } public override void Start() { base.Start(); QualitySettings.skinWeights = (SkinWeights)4; if (((NetworkBehaviour)this).IsServer) { smartAgentNavigator.StartSearchRoutine(50f); } } private float ApplyVariants(Renderer renderer) { return RandomExtensions.NextFloat(enemyRandom, 0f, 1f); } public virtual void OnLightValueChange(float lightValue) { float newValue = Mathf.Sqrt(lightValue); ((MonoBehaviour)this).StartCoroutine(LerpToHotOrCold(_previousLightValue, newValue)); } private IEnumerator LerpToHotOrCold(float oldValue, float newValue) { if (!((Object)(object)_specialRenderer == (Object)null)) { for (int i = 1; i <= 3; i++) { float step = Mathf.Lerp(oldValue, newValue, (float)i / 3f); _specialRenderer.GetMaterial().SetFloat(TemperatureHash, Mathf.Clamp(step / 5f - 0.5f, -0.5f, 0.5f)); yield return null; } _previousLightValue = newValue; } } public override void Update() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); if (isWiWiWiii) { ((EnemyAI)this).creatureVoice.PlayOneShot(wiwiwiiiSound[enemyRandom.Next(wiwiwiiiSound.Length)]); } else { ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(_idleAudioClips.audioClips.Length)]); } } if (((EnemyAI)this).currentBehaviourStateIndex != 4 && ((EnemyAI)this).currentBehaviourStateIndex != 1) { return; } detectEnemyInterval -= Time.deltaTime; if (!(detectEnemyInterval <= 0f)) { return; } detectEnemyInterval = RandomExtensions.NextFloat(enemyRandom, 4f, 8f); foreach (ItemCrate instance in ItemCrate.Instances) { if (instance.crateType != ItemCrate.CrateType.Wooden && instance.crateType != ItemCrate.CrateType.Metal) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position); if (num < 7f) { ((EnemyAI)this).creatureVoice.PlayOneShot(enemyDetectSounds[Random.Range(0, enemyDetectSounds.Length)], 1.2f); return; } } } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy.enemyType == (Object)(object)((EnemyAI)this).enemyType)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position); if (num2 < 15f) { ((EnemyAI)this).creatureVoice.PlayOneShot(enemyDetectSounds[Random.Range(0, enemyDetectSounds.Length)], 1.2f); break; } } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((EnemyAI)this).isEnemyDead && !StartOfRound.Instance.allPlayersDead) { switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoWandering(); break; case 1: DoFollowing(); break; case 2: break; case 3: break; case 4: break; } } } private void DoWandering() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (!(num > 5f)) { SetPlayerTargetServerRpc(PlayerControllerReference.op_Implicit(val)); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); return; } } } specialActionTimer -= ((EnemyAI)this).AIIntervalTime; if (specialActionTimer <= 0f) { smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).agent.SetDestination(((Component)this).transform.position); specialActionTimer = Random.Range(7.5f, 15f); if (Random.Range(0, 100) < 50) { ((EnemyAI)this).creatureAnimator.SetBool(SnailCatPhysicsProp.SleepingAnimation, true); ((EnemyAI)this).SwitchToBehaviourServerRpc(2); ((MonoBehaviour)this).StartCoroutine(ChangeStateWithDelayRoutine(20f, State.Sleeping, SnailCatPhysicsProp.SleepingAnimation)); } else { ((EnemyAI)this).creatureAnimator.SetBool(SnailCatPhysicsProp.SittingAnimation, true); ((EnemyAI)this).SwitchToBehaviourServerRpc(3); ((MonoBehaviour)this).StartCoroutine(ChangeStateWithDelayRoutine(10f, State.Sitting, SnailCatPhysicsProp.SittingAnimation)); } } } private void DoFollowing() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) smartAgentNavigator.DoPathingToDestination(((Component)((EnemyAI)this).targetPlayer).transform.position); float num = Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position); if (num > 15f) { ClearPlayerTargetServerRpc(); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); smartAgentNavigator.StartSearchRoutine(50f); } } public IEnumerator ChangeStateWithDelayRoutine(float delay, State stateToSwitchOutOf, int animationToSwitchOutOf) { yield return (object)new WaitForSeconds(delay); if (((EnemyAI)this).currentBehaviourStateIndex == (int)stateToSwitchOutOf) { smartAgentNavigator.StartSearchRoutine(50f); ((EnemyAI)this).creatureAnimator.SetBool(animationToSwitchOutOf, false); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); } } public void PickUpBabyLocalClient() { Plugin.ExtendedLogging($"picked up by {((GrabbableObject)propScript).playerHeldBy}"); ((EnemyAI)this).SwitchToBehaviourServerRpc(4); EnableOrDisableAgentWithRoutineServerRpc(enable: false, startSearchRoutine: false); ((EnemyAI)this).currentOwnershipOnThisClient = (int)((GrabbableObject)propScript).playerHeldBy.playerClientId; ((EnemyAI)this).inSpecialAnimation = true; holdingBaby = true; if (dropBabyCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(dropBabyCoroutine); } playerHolding = ((GrabbableObject)propScript).playerHeldBy; } public void DropBabyLocalClient() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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) Plugin.ExtendedLogging($"dropped by {propScript.previousPlayerHeldBy}"); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); holdingBaby = false; playerHolding = null; if (((NetworkBehaviour)this).IsOwner && !((NetworkBehaviour)this).IsOwnedByServer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } bool flag = true; Vector3 position = ((Component)this).transform.position; if ((Object)(object)propScript.previousPlayerHeldBy == (Object)null) { flag = false; } else { position = ((Component)propScript.previousPlayerHeldBy).transform.position; } Vector3 itemFloorPosition = ((GrabbableObject)propScript).GetItemFloorPosition(position + Vector3.up * 0.5f); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(itemFloorPosition, default(NavMeshHit), 10f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { flag = false; itemFloorPosition = ((GrabbableObject)propScript).startFallingPosition; if ((Object)(object)((Component)propScript).transform.parent != (Object)null) { itemFloorPosition = ((Component)propScript).transform.parent.TransformPoint(((GrabbableObject)propScript).startFallingPosition); } Transform val = ChooseClosestNodeToPositionNoPathCheck(itemFloorPosition); navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)val).transform.position, default(NavMeshHit), 5f, -1); } if ((Object)(object)((Component)propScript).transform.parent == (Object)null) { ((GrabbableObject)propScript).targetFloorPosition = navMeshPosition; } else { ((GrabbableObject)propScript).targetFloorPosition = ((Component)propScript).transform.parent.InverseTransformPoint(navMeshPosition); } if (flag) { if (dropBabyCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(dropBabyCoroutine); } dropBabyCoroutine = ((MonoBehaviour)this).StartCoroutine(DropBabyAnimation(navMeshPosition)); return; } ((Component)this).transform.position = navMeshPosition; ((EnemyAI)this).inSpecialAnimation = false; if (((NetworkBehaviour)this).IsServer) { ((Behaviour)((EnemyAI)this).agent).enabled = true; ((Behaviour)smartAgentNavigator).enabled = true; smartAgentNavigator.StartSearchRoutine(50f); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (((NetworkBehaviour)propScript).IsOwner) { ((NetworkAnimator)propScript.ownerNetworkAnimator).SetTrigger(SnailCatPhysicsProp.HitAnimation, true); } } private IEnumerator DropBabyAnimation(Vector3 dropOnPosition) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float time = Time.realtimeSinceStartup; yield return (object)new WaitUntil((Func)(() => ((GrabbableObject)propScript).reachedFloorTarget || Time.realtimeSinceStartup - time > 2f)); ((Component)this).transform.position = dropOnPosition; ((EnemyAI)this).inSpecialAnimation = false; dropBabyCoroutine = null; if (((NetworkBehaviour)this).IsServer) { ((Behaviour)((EnemyAI)this).agent).enabled = true; ((Behaviour)smartAgentNavigator).enabled = true; smartAgentNavigator.StartSearchRoutine(50f); } } public Transform ChooseClosestNodeToPositionNoPathCheck(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) List source = RoundManager.Instance.insideAINodes.Concat(RoundManager.Instance.outsideAINodes).ToList(); IOrderedEnumerable source2 = from x in source where (Object)(object)x != (Object)null orderby Vector3.Distance(pos, x.transform.position) select x; return source2.First().transform; } [ServerRpc(RequireOwnership = false)] private void EnableOrDisableAgentWithRoutineServerRpc(bool enable, bool startSearchRoutine) { ((Behaviour)((EnemyAI)this).agent).enabled = enable; ((Behaviour)smartAgentNavigator).enabled = enable; if (startSearchRoutine) { smartAgentNavigator.StartSearchRoutine(50f); } else { smartAgentNavigator.StopSearchRoutine(); } } public override void OnNetworkDespawn() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) ((NetworkBehaviour)this).OnNetworkDespawn(); DetectLightInSurroundings obj = detectLightInSurroundings; if (obj != null) { obj.OnLightValueChange.RemoveListener((UnityAction)OnLightValueChange); } if (((NetworkBehaviour)this).IsServer) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)this).transform.position) && !((Object)(object)((GrabbableObject)propScript).playerHeldBy == (Object)null)) { CodeRebirthUtils.Instance.SpawnFakeSnailCat(((GrabbableObject)propScript).playerHeldBy, ((GrabbableObject)propScript).originalScale, currentName, _specialRenderer.materials[0].GetFloat(ShiftHash)); } } } } public class SnailCatPhysicsProp : GrabbableObject { public Animator animator = null; public OwnerNetworkAnimator ownerNetworkAnimator = null; public SnailCatAI snailCatScript = null; public PlayerControllerB? previousPlayerHeldBy = null; internal static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeed"); internal static readonly int HitAnimation = Animator.StringToHash("doHit"); internal static readonly int GrabbedAnimation = Animator.StringToHash("grabbed"); internal static readonly int SittingAnimation = Animator.StringToHash("sitting"); internal static readonly int SleepingAnimation = Animator.StringToHash("sleeping"); public override void EquipItem() { ((GrabbableObject)this).EquipItem(); animator.SetBool(GrabbedAnimation, true); animator.SetBool(SittingAnimation, false); animator.SetBool(SleepingAnimation, false); snailCatScript.PickUpBabyLocalClient(); previousPlayerHeldBy = base.playerHeldBy; } public override void FallWithCurve() { if (((EnemyAI)snailCatScript).inSpecialAnimation) { ((GrabbableObject)this).FallWithCurve(); } } public override void Start() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) base.propColliders = ((Component)this).gameObject.GetComponentsInChildren(); for (int i = 0; i < base.propColliders.Length; i++) { if (!((Component)base.propColliders[i]).CompareTag("DoNotSet") && !((Component)base.propColliders[i]).CompareTag("Enemy")) { base.propColliders[i].excludeLayers = LayerMask.op_Implicit(-2621449); } } base.originalScale = ((Component)this).transform.localScale; if (base.itemProperties.itemSpawnsOnGround) { base.startFallingPosition = ((Component)this).transform.position; if ((Object)(object)((Component)this).transform.parent != (Object)null) { base.startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(base.startFallingPosition); } ((GrabbableObject)this).FallToGround(false, false, default(Vector3)); } else { base.fallTime = 1f; base.hasHitGround = true; base.reachedFloorTarget = true; base.targetFloorPosition = ((Component)this).transform.localPosition; } if (base.itemProperties.isScrap) { base.fallTime = 1f; base.hasHitGround = true; } if (base.itemProperties.isScrap && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { base.radarIcon = Object.Instantiate(StartOfRound.Instance.itemRadarIconPrefab, RoundManager.Instance.mapPropsContainer.transform).transform; } if (!base.itemProperties.isScrap) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)this).gameObject); } MeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren.Length; j++) { ((Renderer)componentsInChildren[j]).renderingLayerMask = 1u; } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren(); for (int k = 0; k < componentsInChildren2.Length; k++) { ((Renderer)componentsInChildren2[k]).renderingLayerMask = 1u; } } public override void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_0179: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { Animator obj = animator; int runSpeedFloat = RunSpeedFloat; Vector3 velocity = ((EnemyAI)snailCatScript).agent.velocity; obj.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude / 3f); if (!base.wasOwnerLastFrame) { base.wasOwnerLastFrame = true; } } else if (base.wasOwnerLastFrame) { base.wasOwnerLastFrame = false; } if (!base.isHeld && (Object)(object)base.parentObject == (Object)null) { if (base.fallTime < 1f) { base.reachedFloorTarget = false; ((GrabbableObject)this).FallWithCurve(); if (((Component)this).transform.localPosition.y - base.targetFloorPosition.y < 0.05f && !base.hasHitGround) { ((GrabbableObject)this).PlayDropSFX(); ((GrabbableObject)this).OnHitGround(); } return; } if (!base.reachedFloorTarget) { if (!base.hasHitGround) { ((GrabbableObject)this).PlayDropSFX(); ((GrabbableObject)this).OnHitGround(); } base.reachedFloorTarget = true; if (base.floorYRot == -1) { ((Component)this).transform.rotation = Quaternion.Euler(base.itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, base.itemProperties.restingRotation.z); } else { ((Component)this).transform.rotation = Quaternion.Euler(base.itemProperties.restingRotation.x, (float)(base.floorYRot + base.itemProperties.floorYOffset) + 90f, base.itemProperties.restingRotation.z); } } if (((EnemyAI)snailCatScript).inSpecialAnimation) { ((Component)this).transform.localPosition = base.targetFloorPosition; } } else if (base.isHeld || base.isHeldByEnemy) { base.reachedFloorTarget = false; } } public override void LateUpdate() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)snailCatScript).inSpecialAnimation && (Object)(object)base.parentObject != (Object)null) { ((Component)this).transform.rotation = base.parentObject.rotation; ((Component)this).transform.Rotate(base.itemProperties.rotationOffset); ((Component)this).transform.position = base.parentObject.position; Vector3 positionOffset = base.itemProperties.positionOffset; positionOffset = base.parentObject.rotation * positionOffset; Transform transform = ((Component)this).transform; transform.position += positionOffset; } } public override void EnableItemMeshes(bool enable) { MeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Component)componentsInChildren[i]).gameObject.CompareTag("DoNotSet") && !((Component)componentsInChildren[i]).gameObject.CompareTag("InteractTrigger") && !((Component)componentsInChildren[i]).gameObject.CompareTag("Enemy")) { ((Renderer)componentsInChildren[i]).enabled = enable; } } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).enabled = enable; } } public override void DiscardItem() { snailCatScript.DropBabyLocalClient(); DropBabyServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); previousPlayerHeldBy = base.playerHeldBy; ((GrabbableObject)this).DiscardItem(); Plugin.ExtendedLogging($"Snail Cat Discarded and isBeingUsed: {base.isBeingUsed}"); } [ServerRpc(RequireOwnership = false)] public void DropBabyServerRpc(int playerClientId) { animator.SetBool(GrabbedAnimation, false); DropBabyClientRpc(playerClientId); } [ClientRpc] public void DropBabyClientRpc(int playerClientId) { if (playerClientId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { snailCatScript.DropBabyLocalClient(); } } } public class TemplateAI : CodeRebirthEnemyAI { public enum TemplateState { Spawning, Idle, Death } public override void Start() { base.Start(); } public override void Update() { base.Update(); } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!StartOfRound.Instance.allPlayersDead && !((EnemyAI)this).isEnemyDead) { switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoSpawning(); break; case 1: DoIdle(); break; case 2: DoDeath(); break; } } } private void DoSpawning() { } private void DoIdle() { } private void DoDeath() { } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!((EnemyAI)this).isEnemyDead) { ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (((EnemyAI)this).enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } public override void KillEnemy(bool destroy = false) { base.KillEnemy(destroy); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); } } [Serializable] public class GameObjectWithPriority(GameObject gameObject, int priority) : IWeighted { public GameObject gameObject = gameObject; public int priority = priority; public int GetWeight() { return priority; } } public class Transporter : CodeRebirthEnemyAI { public enum TransporterStates { Idle, Transporting, Repositioning } public PlayerPhysicsRegion PhysicsRegion = null; public AudioSource StunSource = null; public AudioClip[] engineAndIdleSounds = null; public AudioClip dumpHazardSound = null; public AudioClip hitJimothySound = null; public AudioClip pickUpHazardSound = null; public Transform palletTransform = null; public Transform jimothyTransform = null; internal static List objectsWithPriorityToTransport = new List(); private Coroutine? onHitRoutine = null; private GameObjectWithPriority? transportTarget = null; private Scene previousSceneOfTransportTarget = default(Scene); private bool droppingObject = false; private NavMeshHit currentEndHit = default(NavMeshHit); private bool repositioning = false; private float speedIncrease = 0f; private static readonly int PickUpObjectAnimation = Animator.StringToHash("pickUpObject"); private static readonly int DropObjectAnimation = Animator.StringToHash("dropObject"); private static readonly int OnHitAnim = Animator.StringToHash("onHit"); private static readonly int RunSpeedFloat = Animator.StringToHash("RunSpeedFloat"); private static readonly int RotationSpeed = Animator.StringToHash("RotationSpeed"); private static readonly int StunnedAnimation = Animator.StringToHash("Stunned"); [HideInInspector] public static List transporters = new List(); private bool currentlyStunned = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); transporters.Add(this); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if (transportTarget != null && ((EnemyAI)this).currentBehaviourStateIndex == 2) { NetworkObject component = transportTarget.gameObject.GetComponent(); if (component.IsSpawned) { if (((NetworkBehaviour)this).IsServer) { component.Despawn(true); } } else { Object.Destroy((Object)(object)transportTarget.gameObject); } } transporters.Remove(this); } public override void Start() { //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_006b: Unknown result type (might be due to invalid IL or missing references) base.Start(); smartAgentNavigator.OnUseEntranceTeleport.AddListener((UnityAction)OnUseEntranceTeleport); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { GameObject val = Object.Instantiate(Plugin.Assets.EmptyNetworkObject, palletTransform.position, Quaternion.identity); val.GetComponent().Spawn(false); SyncNetworkObjectParentServerRpc(new NetworkObjectReference(val)); palletTransform = val.transform; TryFindAnyTransportableObjectViaAsyncPathfinding(); } } private void OnUseEntranceTeleport(bool setOutside) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) GrabbableObject[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren(); foreach (GrabbableObject val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { val.EnableItemMeshes(true); val.EnablePhysics(true); } } ((Component)this).transform.position = ((Component)smartAgentNavigator.lastUsedEntranceTeleport.exitScript).transform.position; if (!((Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform.parent != (Object)(object)((Component)this).transform)) { PhysicsRegion.disablePhysicsRegion = true; ((MonoBehaviour)this).StartCoroutine(ReEnableRegion()); if (StartOfRound.Instance.CurrentPlayerPhysicsRegions.Contains(PhysicsRegion)) { StartOfRound.Instance.CurrentPlayerPhysicsRegions.Remove(PhysicsRegion); } smartAgentNavigator.lastUsedEntranceTeleport.TeleportPlayer(); } } private IEnumerator ReEnableRegion() { yield return null; smartAgentNavigator.lastUsedEntranceTeleport.TeleportPlayer(); yield return (object)new WaitForSeconds(0.2f); smartAgentNavigator.lastUsedEntranceTeleport.TeleportPlayer(); PhysicsRegion.disablePhysicsRegion = false; } [ServerRpc(RequireOwnership = false)] public void SyncNetworkObjectParentServerRpc(NetworkObjectReference netObjRef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SyncNetworkObjectParentClientRpc(netObjRef); } [ClientRpc] public void SyncNetworkObjectParentClientRpc(NetworkObjectReference netObjRef) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkObjectReference.op_Implicit(netObjRef); val.transform.SetParent(palletTransform, true); val.transform.SetPositionAndRotation(palletTransform.position, palletTransform.rotation); } public override void Update() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((EnemyAI)this).stunNormalizedTimer > 0f && !currentlyStunned) { StunSource.Play(); currentlyStunned = true; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, true); } } if (currentlyStunned && ((EnemyAI)this).stunNormalizedTimer <= 0f) { StunSource.Stop(); currentlyStunned = false; if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).creatureAnimator.SetBool(StunnedAnimation, false); } } if (currentlyStunned) { smartAgentNavigator.StopAgent(); return; } Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).magnitude > 0.5f && (Object)(object)((EnemyAI)this).creatureSFX.clip != (Object)(object)engineAndIdleSounds[0]) { ((EnemyAI)this).creatureSFX.clip = engineAndIdleSounds[0]; ((EnemyAI)this).creatureSFX.Play(); } else if ((Object)(object)((EnemyAI)this).creatureSFX.clip != (Object)(object)engineAndIdleSounds[1]) { velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).magnitude <= 0.5f) { ((EnemyAI)this).creatureSFX.clip = engineAndIdleSounds[1]; ((EnemyAI)this).creatureSFX.Play(); } } _idleTimer -= Time.deltaTime; if (_idleTimer <= 0f) { _idleTimer = RandomExtensions.NextFloat(enemyRandom, _idleAudioClips.minTime, _idleAudioClips.maxTime); ((EnemyAI)this).creatureVoice.PlayOneShot(_idleAudioClips.audioClips[enemyRandom.Next(_idleAudioClips.audioClips.Length)]); } Animator creatureAnimator = ((EnemyAI)this).creatureAnimator; int runSpeedFloat = RunSpeedFloat; velocity = ((EnemyAI)this).agent.velocity; creatureAnimator.SetFloat(runSpeedFloat, ((Vector3)(ref velocity)).magnitude); } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!smartAgentNavigator.CheckPathsOngoing() && !currentlyStunned) { switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: DoIdle(); break; case 1: DoTransporting(); break; case 2: DoRepositioning(); break; } } } private void DoIdle() { if (objectsWithPriorityToTransport.Count == 0) { transportTarget = null; } } private void TryFindAnyTransportableObjectViaAsyncPathfinding() { Plugin.ExtendedLogging($"Transporter: Transporting {objectsWithPriorityToTransport.Count} objects"); IEnumerable<(GameObjectWithPriority, Vector3)> enumerable = from kv in objectsWithPriorityToTransport where (Object)(object)kv.gameObject != (Object)null select (kv: kv, position: kv.gameObject.transform.position); smartAgentNavigator.CheckPaths(enumerable, (Action>>)CheckIfNeedToChangeState); } public void CheckIfNeedToChangeState(List> args) { int count = args.Count; if (count > 0) { Plugin.ExtendedLogging($"Transporter: Found {count} objects"); List list = args.Select, GameObjectWithPriority>((GenericPath x) => x.Generic).ToList(); transportTarget = RandomExtensions.NextWeighted(enemyHostRandom, (IList)list); objectsWithPriorityToTransport.Remove(transportTarget); smartAgentNavigator.StopSearchRoutine(); ((EnemyAI)this).SwitchToBehaviourServerRpc(1); } else { droppingObject = false; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); smartAgentNavigator.StartSearchRoutine(20f); Plugin.ExtendedLogging("Transporter: No more objects to transport"); } } private void DoTransporting() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) if (transportTarget == null) { droppingObject = false; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); TryFindAnyTransportableObjectViaAsyncPathfinding(); return; } float num = Vector3.Distance(transportTarget.gameObject.transform.position, ((Component)this).transform.position); smartAgentNavigator.DoPathingToDestination(transportTarget.gameObject.transform.position); if (num <= ((EnemyAI)this).agent.stoppingDistance) { repositioning = true; IEnumerable<(GameObject, Vector3)> enumerable = Array.Empty<(GameObject, Vector3)>(); GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; List list = new List(outsideAINodes.Length + insideAINodes.Length); list.AddRange(outsideAINodes); list.AddRange(insideAINodes); List source = list; enumerable = from kv in source where (Object)(object)kv != (Object)null select (kv: kv, position: kv.transform.position); creatureNetworkAnimator.SetTrigger(PickUpObjectAnimation, true); previousSceneOfTransportTarget = transportTarget.gameObject.scene; transportTarget.gameObject.transform.SetParent(palletTransform, true); SyncPositionRotationOfTransportTargetServerRpc(new NetworkObjectReference(transportTarget.gameObject)); smartAgentNavigator.StopAgent(); smartAgentNavigator.CheckPaths(enumerable, (Action>>)CheckIfCanReposition); } } public void CheckIfCanReposition(List> args) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (transportTarget == null) { Plugin.Logger.LogError((object)"Transporter: transportTarget is null??"); ((EnemyAI)this).SwitchToBehaviourServerRpc(0); TryFindAnyTransportableObjectViaAsyncPathfinding(); } else if (args.Count > 0) { Vector3 position = args[Random.Range(0, args.Count)].Generic.transform.position; NavMesh.SamplePosition(position, ref currentEndHit, 4f, -1); if (repositioning) { ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } } private void DoRepositioning() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (droppingObject || repositioning) { return; } if (transportTarget == null) { droppingObject = false; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); TryFindAnyTransportableObjectViaAsyncPathfinding(); return; } smartAgentNavigator.DoPathingToDestination(((NavMeshHit)(ref currentEndHit)).position); if (Vector3.Distance(((Component)this).transform.position, ((NavMeshHit)(ref currentEndHit)).position) <= ((EnemyAI)this).agent.stoppingDistance) { Vector3 val = ((NavMeshHit)(ref currentEndHit)).position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((Component)this).transform.LookAt(normalized); smartAgentNavigator.StopAgent(); creatureNetworkAnimator.SetTrigger(DropObjectAnimation, true); droppingObject = true; } } [ServerRpc(RequireOwnership = false)] public void SyncPositionRotationOfTransportTargetServerRpc(NetworkObjectReference netObjRef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SyncPositionRotationOfTransportTargetClientRpc(netObjRef); } [ClientRpc] public void SyncPositionRotationOfTransportTargetClientRpc(NetworkObjectReference netObjRef) { //IL_0001: 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_001f: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkObjectReference.op_Implicit(netObjRef); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { base.HitEnemy(force, playerWhoHit, playHitSFX, hitID); ((EnemyAI)this).creatureVoice.PlayOneShot(hitJimothySound); if (onHitRoutine == null && !((Object)(object)playerWhoHit == (Object)null) && ((NetworkBehaviour)this).IsServer) { onHitRoutine = ((MonoBehaviour)this).StartCoroutine(OnHitAnimation(playerWhoHit)); } } public IEnumerator OnHitAnimation(PlayerControllerB playerWhoHit) { creatureNetworkAnimator.SetTrigger(OnHitAnim, true); smartAgentNavigator.StopAgent(); ((EnemyAI)this).agent.speed = 0f; Vector3 val = ((Component)playerWhoHit).transform.position - jimothyTransform.position; Vector3 direction = ((Vector3)(ref val)).normalized; direction.y = 0f; float angleToPlayer = Vector3.SignedAngle(jimothyTransform.forward, direction, Vector3.up); float timeToLookAtPlayer = ((angleToPlayer <= 0f) ? (angleToPlayer * -1f / 360f) : ((360f - angleToPlayer) / 360f)); ((EnemyAI)this).creatureAnimator.SetFloat(RotationSpeed, 1f); yield return (object)new WaitForSeconds(timeToLookAtPlayer); ((EnemyAI)this).creatureAnimator.SetFloat(RotationSpeed, 0f); yield return (object)new WaitForSeconds(0.5f); speedIncrease += 0.5f; ((EnemyAI)this).agent.speed = 4f + speedIncrease; ((EnemyAI)this).creatureAnimator.SetFloat(RotationSpeed, 1f); yield return (object)new WaitForSeconds(1f - timeToLookAtPlayer); ((EnemyAI)this).creatureAnimator.SetFloat(RotationSpeed, 0f); onHitRoutine = null; } public void OnLiftOrDropObjectImmediateAnimEvent(int liftNumber) { if (liftNumber == 0) { ((EnemyAI)this).creatureVoice.PlayOneShot(pickUpHazardSound); } else { ((EnemyAI)this).creatureVoice.PlayOneShot(dumpHazardSound); } } public void OnLiftHazardAnimEvent() { ((MonoBehaviour)this).StartCoroutine(WaitUntilFinishedCalculatingPath()); } private IEnumerator WaitUntilFinishedCalculatingPath() { while (smartAgentNavigator.CheckPathsOngoing()) { yield return null; } repositioning = false; if (((EnemyAI)this).currentBehaviourStateIndex != 2) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); } } public void OnReleaseHazardAnimEvent() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (transportTarget == null) { Plugin.Logger.LogError((object)"Transporter: transportTarget is null"); return; } transportTarget.gameObject.transform.SetParent((Transform)null, true); SceneManager.MoveGameObjectToScene(transportTarget.gameObject, previousSceneOfTransportTarget); transportTarget.gameObject.transform.position = ((NavMeshHit)(ref currentEndHit)).position; transportTarget.gameObject.transform.up = ((NavMeshHit)(ref currentEndHit)).normal; droppingObject = false; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer) { objectsWithPriorityToTransport.Add(transportTarget); transportTarget = null; TryFindAnyTransportableObjectViaAsyncPathfinding(); } } } public class TrashCan : NetworkBehaviour { [SerializeField] private MeshFilter? meshFilter = null; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Janitor.trashCans.Add(this); if (Plugin.ModConfig.ConfigDisableTrashCans.Value && (Object)(object)meshFilter != (Object)null) { ((Component)meshFilter).gameObject.SetActive(false); } } private void Start() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } if (Vector3.Distance(((Component)this).transform.position, RoundManager.FindMainEntrancePosition(true, false)) <= 5f) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } if (!RoundManager.Instance.currentLevel.spawnEnemiesAndScrap) { return; } List list = RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.AllTiles.Where((Tile x) => x.UsedDoorways.Count == 1).ToList(); if (list.Count > 0) { Tile val = list[Random.Range(0, list.Count)]; Bounds bounds = val.Bounds; Vector3 val2 = ((Bounds)(ref bounds)).center; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, Vector3.down, ref val3, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point; } Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(val2, 6f, default(NavMeshHit)); ((Component)this).transform.position = randomNavMeshPositionInRadius; SyncPositionRpc(randomNavMeshPositionInRadius); Plugin.ExtendedLogging($"Moved trash can to {randomNavMeshPositionInRadius}"); } if ((Object)(object)meshFilter != (Object)null && Vector3.Distance(((Component)this).transform.position, RoundManager.FindMainEntrancePosition(true, false)) <= 5f) { ((Component)meshFilter).gameObject.SetActive(false); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SyncPositionRpc(Vector3 position) { //IL_0007: 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_0029: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = position; if ((Object)(object)meshFilter != (Object)null && Vector3.Distance(((Component)this).transform.position, RoundManager.FindMainEntrancePosition(true, false)) <= 8f) { ((Component)meshFilter).gameObject.SetActive(false); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); Janitor.trashCans.Remove(this); } } } namespace CodeRebirth.src.Content.DevTools { public class DevToolHandler : ContentHandler { public class DevToolsAssets : AssetBundleLoader { public DevToolsAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public DevToolsAssets? DevTools = null; public DevToolHandler(DuskMod mod) : base(mod) { } } public class DebugStick : GrabbableObject { private Dictionary _hologramCopies = new Dictionary(); private DawnMapObjectInfo _currentlySelectedHazard; private bool _updateNavMesh = false; private GameObject? _navMeshObject; private static bool doneOnce; [field: SerializeField] public List NavMeshMaterials { get; private set; } [field: SerializeField] public AudioSource Source { get; private set; } [field: SerializeField] public AudioClip PlaceSound { get; private set; } [field: SerializeField] public float PlaceDistance { get; private set; } = 20f; private void NavMeshSurface_BuildNavMesh(orig_BuildNavMesh orig, NavMeshSurface self) { orig.Invoke(self); VisualiseNavMesh(); } private bool CanPlaceHologram([NotNullWhen(true)] out RaycastHit raycastHit) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)localPlayerController.gameplayCamera).transform.position, ((Component)localPlayerController.gameplayCamera).transform.forward); if (!Physics.Raycast(val, ref raycastHit, PlaceDistance, StartOfRound.Instance.collidersAndRoomMaskAndDefault | MoreLayerMasks.HazardMask, (QueryTriggerInteraction)1)) { return false; } if (((Component)((RaycastHit)(ref raycastHit)).collider).gameObject.layer == LayerMask.NameToLayer("MapHazard")) { return false; } return true; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); _currentlySelectedHazard = ((Registry)(object)LethalContent.MapObjects).Values.First(); foreach (DawnMapObjectInfo value in ((Registry)(object)LethalContent.MapObjects).Values) { _hologramCopies[value] = new HologramCopy(); _hologramCopies[value].SetUpHologram(value.GetMapObjectPrefab()); } FixControlTips(); } private void FixControlTips() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (!doneOnce) { doneOnce = true; int num = 10; TextMeshProUGUI val = HUDManager.Instance.controlTipLines[3]; List list = HUDManager.Instance.controlTipLines.ToList(); for (int i = 0; i < num; i++) { GameObject val2 = Object.Instantiate(((Component)HUDManager.Instance.controlTipLines[3]).gameObject, ((TMP_Text)val).transform.parent); TextMeshProUGUI component = val2.GetComponent(); ((TMP_Text)component).text = string.Empty; RectTransform val3 = (RectTransform)val2.transform; val3.anchoredPosition3D -= new Vector3(0f, 20.5f * (float)(i + 1), 0f); list.Add(component); } HUDManager.Instance.controlTipLines = list.ToArray(); } } public void CycleSelectedHazard(int direction) { _hologramCopies[GetCurrentHazard()].HologramObject.SetActive(false); _currentlySelectedHazard = ((direction > 0) ? GetNextHazard() : GetPreviousHazard()); } public DawnMapObjectInfo GetPreviousHazard() { List list = ((Registry)(object)LethalContent.MapObjects).Values.ToList(); int num = list.IndexOf(GetCurrentHazard()); int num2 = (num - 1) % list.Count; if (num2 < 0) { num2 += list.Count; } return list[num2]; } public DawnMapObjectInfo GetCurrentHazard() { return _currentlySelectedHazard; } public DawnMapObjectInfo GetNextHazard() { List list = ((Registry)(object)LethalContent.MapObjects).Values.ToList(); int num = list.IndexOf(GetCurrentHazard()); int num2 = (num + 1) % list.Count; if (num2 < 0) { num2 += list.Count; } return list[num2]; } public override void Update() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!base.isHeld || base.isPocketed || (Object)(object)base.playerHeldBy == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(base.playerHeldBy) || base.playerHeldBy.inSpecialMenu || base.playerHeldBy.inTerminalMenu) { _hologramCopies[GetCurrentHazard()].HologramObject.SetActive(false); return; } if (CanPlaceHologram(out var raycastHit)) { _hologramCopies[GetCurrentHazard()].UpdateTick(raycastHit); Mouse current = Mouse.current; if (current != null && current.leftButton.wasPressedThisFrame) { _hologramCopies[GetCurrentHazard()].HandleSpawningOriginal(GetCurrentHazard(), raycastHit); Source.PlayOneShot(PlaceSound); } } else { _hologramCopies[GetCurrentHazard()].HologramObject.SetActive(false); } Keyboard current2 = Keyboard.current; if (current2 != null) { if (((ButtonControl)current2.qKey).wasPressedThisFrame) { CycleSelectedHazard(-1); SetHazardTooltips(); } else if (((ButtonControl)current2.eKey).wasPressedThisFrame) { CycleSelectedHazard(1); SetHazardTooltips(); } else if (((ButtonControl)current2.rKey).wasPressedThisFrame) { DeleteAllMapObjectsSpawned(); } else if (((ButtonControl)current2.xKey).wasPressedThisFrame) { ResetAllRotationAndPositionEdits(); } else if (((ButtonControl)current2.leftArrowKey).wasPressedThisFrame) { RotateLeftRight(current2.leftArrowKey); } else if (((ButtonControl)current2.rightArrowKey).wasPressedThisFrame) { RotateLeftRight(current2.rightArrowKey); } else if (((ButtonControl)current2.upArrowKey).wasPressedThisFrame) { RotateUpDown(current2.upArrowKey); } else if (((ButtonControl)current2.downArrowKey).wasPressedThisFrame) { RotateUpDown(current2.downArrowKey); } else if (((ButtonControl)current2.zKey).wasPressedThisFrame) { TeleportToRandomHazard(GetCurrentHazard()); } else if (((ButtonControl)current2.iKey).wasPressedThisFrame) { MoveForwardBack(current2.iKey); } else if (((ButtonControl)current2.kKey).wasPressedThisFrame) { MoveForwardBack(current2.kKey); } else if (((ButtonControl)current2.jKey).wasPressedThisFrame) { MoveLeftRight(current2.jKey); } else if (((ButtonControl)current2.lKey).wasPressedThisFrame) { MoveLeftRight(current2.lKey); } else if (((ButtonControl)current2.uKey).wasPressedThisFrame) { MoveUpDown(current2.uKey); } else if (((ButtonControl)current2.oKey).wasPressedThisFrame) { MoveUpDown(current2.oKey); } else if (((ButtonControl)current2.pKey).wasPressedThisFrame) { ToggleNavMesh(); } } } private void ToggleNavMesh() { _updateNavMesh = !_updateNavMesh; VisualiseNavMesh(); } private void VisualiseNavMesh() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown if (!_updateNavMesh) { if ((Object)(object)_navMeshObject != (Object)null) { Object.Destroy((Object)(object)_navMeshObject); } return; } if ((Object)(object)_navMeshObject != (Object)null) { Object.Destroy((Object)(object)_navMeshObject); } _navMeshObject = new GameObject("NavMesh Visualiser"); NavMeshTriangulation val = NavMesh.CalculateTriangulation(); Vector3[] vertices = val.vertices; int[] indices = val.indices; int[] areas = val.areas; List vertices2 = vertices.ToList(); List indices2 = new List(); List triangleAreas = new List(); Dictionary<(int, int), int> midpointCache = new Dictionary<(int, int), int>(); for (int i = 0; i < areas.Length; i++) { int num = indices[i * 3]; int num2 = indices[i * 3 + 1]; int num3 = indices[i * 3 + 2]; int num4 = GetMidpointIndex(num, num2); int num5 = GetMidpointIndex(num2, num3); int num6 = GetMidpointIndex(num3, num); int area = areas[i]; AddTriangle(num, num4, num6, area); AddTriangle(num4, num2, num5, area); AddTriangle(num6, num5, num3, area); AddTriangle(num4, num5, num6, area); } SnapVerticesToGroundHeightOnly(vertices2, 0.5f, 1f, 5f, 0.03f, LayerMask.GetMask(new string[3] { "Default", "Room", "NavigationSurface" })); MeshFilter val2 = _navMeshObject.AddComponent(); MeshRenderer val3 = _navMeshObject.AddComponent(); Dictionary> dictionary = new Dictionary>(); for (int j = 0; j < triangleAreas.Count; j++) { int key = triangleAreas[j]; if (!dictionary.ContainsKey(key)) { dictionary.Add(key, new List()); } dictionary[key].Add(indices2[j * 3]); dictionary[key].Add(indices2[j * 3 + 1]); dictionary[key].Add(indices2[j * 3 + 2]); } Mesh val4 = new Mesh { vertices = vertices2.ToArray(), subMeshCount = dictionary.Count }; int num7 = 0; foreach (KeyValuePair> item2 in dictionary) { val4.SetTriangles(item2.Value, num7++); } val4.RecalculateNormals(); val4.RecalculateBounds(); val2.sharedMesh = val4; List list = new List(); foreach (KeyValuePair> item3 in dictionary) { list.Add(NavMeshMaterials[item3.Key]); } ((Renderer)val3).SetSharedMaterials(list); void AddTriangle(int a, int b, int c, int item) { indices2.Add(a); indices2.Add(b); indices2.Add(c); triangleAreas.Add(item); } int GetMidpointIndex(int a, int b) { //IL_0038: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (a > b) { int num8 = b; b = a; a = num8; } if (midpointCache.TryGetValue((a, b), out var value)) { return value; } Vector3 item = (vertices2[a] + vertices2[b]) * 0.5f; int count = vertices2.Count; vertices2.Add(item); midpointCache[(a, b)] = count; return count; } } private static void SnapVerticesToGroundHeightOnly(List vertices, float rayStartHeight, float sampleDistance, float rayDistance, float visualOffset, int groundMask) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) RaycastHit val3 = default(RaycastHit); NavMeshHit val4 = default(NavMeshHit); for (int i = 0; i < vertices.Count; i++) { Vector3 val = vertices[i]; Vector3 val2 = val + Vector3.up * rayStartHeight; if (Physics.Raycast(val2, Vector3.down, ref val3, rayDistance, groundMask, (QueryTriggerInteraction)1)) { vertices[i] = new Vector3(val.x, ((RaycastHit)(ref val3)).point.y + visualOffset, val.z); } else if (NavMesh.SamplePosition(val2, ref val4, sampleDistance, -1)) { vertices[i] = new Vector3(val.x, ((NavMeshHit)(ref val4)).position.y + visualOffset, val.z); } else { vertices[i] = new Vector3(val.x, val.y + visualOffset, val.z); } } } private void ResetAllRotationAndPositionEdits() { foreach (HologramCopy value in _hologramCopies.Values) { value.ResetRotationAndPositionEdits(); } } private void TeleportToRandomHazard(DawnMapObjectInfo currentlySelectedHazard) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) List list = (from x in Object.FindObjectsOfType() where x.Value == ((DawnBaseInfo)(object)currentlySelectedHazard).Key select ((Component)x).transform.position).ToList(); if (list.Count > 0) { ((Component)base.playerHeldBy).transform.position = list[Random.Range(0, list.Count)] + Vector3.up * 5f; } } private void MoveUpDown(KeyControl keyControl) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _hologramCopies[GetCurrentHazard()].EditPositionOffset(Vector3.up, keyControl, (keyControl == Keyboard.current.uKey) ? 0.1f : (-0.1f)); } private void MoveLeftRight(KeyControl keyControl) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _hologramCopies[GetCurrentHazard()].EditPositionOffset(Vector3.right, keyControl, (keyControl == Keyboard.current.jKey) ? (-0.1f) : 0.1f); } private void MoveForwardBack(KeyControl keyControl) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _hologramCopies[GetCurrentHazard()].EditPositionOffset(Vector3.forward, keyControl, (keyControl == Keyboard.current.iKey) ? 0.1f : (-0.1f)); } private void RotateUpDown(KeyControl keyControl) { _hologramCopies[GetCurrentHazard()].RotateUpDown(keyControl, (keyControl == Keyboard.current.upArrowKey) ? 10 : (-10)); } private void RotateLeftRight(KeyControl keyControl) { _hologramCopies[GetCurrentHazard()].RotateLeftRight(keyControl, (keyControl == Keyboard.current.leftArrowKey) ? 10 : (-10)); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if (ImperiumCompat.Enabled) { ImperiumCompat.ToggleInputs(enable: false); } SetHazardTooltips(); } public override void GrabItem() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown ((GrabbableObject)this).GrabItem(); NavMeshSurface.BuildNavMesh += new hook_BuildNavMesh(NavMeshSurface_BuildNavMesh); NavMeshSurface.UpdateNavMesh += new hook_UpdateNavMesh(NavMeshSurface_UpdateNavMesh); NavMeshSurface.OnDisable += new hook_OnDisable(NavMeshSurface_OnDisable); NavMeshSurface.OnEnable += new hook_OnEnable(NavMeshSurface_OnEnable); } private void NavMeshSurface_UpdateDataIfTransformChanged(orig_UpdateDataIfTransformChanged orig, NavMeshSurface self) { orig.Invoke(self); VisualiseNavMesh(); } private void NavMeshSurface_OnEnable(orig_OnEnable orig, NavMeshSurface self) { orig.Invoke(self); VisualiseNavMesh(); } private void NavMeshSurface_OnDisable(orig_OnDisable orig, NavMeshSurface self) { orig.Invoke(self); VisualiseNavMesh(); } private AsyncOperation NavMeshSurface_UpdateNavMesh(orig_UpdateNavMesh orig, NavMeshSurface self, NavMeshData data) { AsyncOperation val = orig.Invoke(self, data); val.completed += delegate { VisualiseNavMesh(); }; return val; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if (ImperiumCompat.Enabled) { ImperiumCompat.ToggleInputs(enable: true); } } public override void DiscardItem() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown ((GrabbableObject)this).DiscardItem(); if (ImperiumCompat.Enabled) { ImperiumCompat.ToggleInputs(enable: true); } NavMeshSurface.BuildNavMesh -= new hook_BuildNavMesh(NavMeshSurface_BuildNavMesh); NavMeshSurface.UpdateNavMesh -= new hook_UpdateNavMesh(NavMeshSurface_UpdateNavMesh); NavMeshSurface.OnDisable -= new hook_OnDisable(NavMeshSurface_OnDisable); NavMeshSurface.OnEnable -= new hook_OnEnable(NavMeshSurface_OnEnable); } public void SetHazardTooltips() { HUDManager.Instance.ClearControlTips(); List list = new List(5) { "Cycle Selection : [Q & E]", "Previous: " + CutoffString(FormatWordsNicely(((DawnBaseInfo)(object)GetPreviousHazard()).Key.Key.Replace("_", " ")).Replace(" ", ""), 17), "Current: " + CutoffString(FormatWordsNicely(((DawnBaseInfo)(object)GetCurrentHazard()).Key.Key.Replace("_", " ")).Replace(" ", ""), 17), "Next: " + CutoffString(FormatWordsNicely(((DawnBaseInfo)(object)GetNextHazard()).Key.Key.Replace("_", " ")).Replace(" ", ""), 21), "Remove all Hazards : [R]" }; HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), false, (Item)null); } public string FormatWordsNicely(string text) { string[] array = text.Split(' '); int num = 0; string[] array2 = array; foreach (string text2 in array2) { array[num] = StringExtensions.ToCapitalized(text2); num++; } text = string.Join(" ", array); return text; } public string CutoffString(string text, int maxLength) { if (text.Length > maxLength) { return text.Substring(0, maxLength) + "..."; } return text; } public void DeleteAllMapObjectsSpawned() { DawnMapObjectNamespacedKeyContainer[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { GameObject gameObject = ((Component)array[i]).gameObject; if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { NetworkObject[] componentsInChildren = gameObject.GetComponentsInChildren(); foreach (NetworkObject val in componentsInChildren) { if (val.IsSpawned) { val.Despawn(true); } } } else { Object.Destroy((Object)(object)gameObject); } } } } public class HologramCopy { private enum OffsetAxis { UpDown, LeftRight, ForwardBack, RotateX, RotateY, RotateZ } private Vector3 rotationOffset = Vector3.zero; private float upDownOffset = 0f; private float leftRightOffset = 0f; private float forwardBackOffset = 0f; public GameObject HologramObject { get; private set; } public void SetUpHologram(GameObject gameObject) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) HologramObject = Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity); ((Object)HologramObject).name = ((Object)gameObject).name + " - HologramCopy"; List list = HologramObject.GetComponentsInChildren().ToList(); List list2 = new List(); foreach (Component item in list) { if ((!(item is Transform) && !(item is MeshFilter) && !(item is Renderer) && !(item is ProBuilderMesh)) || 1 == 0) { list2.Add(item); } } foreach (Component item2 in list2) { Object.Destroy((Object)(object)item2); } HologramObject.SetActive(false); } public void UpdateTick(RaycastHit raycastHit) { //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_0007: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Vector3 zero = Vector3.zero; zero += upDownOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.up; zero += leftRightOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.right; zero += forwardBackOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.forward; HologramObject.transform.position = ((RaycastHit)(ref raycastHit)).point + zero; HologramObject.transform.rotation = Quaternion.Euler(rotationOffset); HologramObject.SetActive(true); } private void AddOffset(OffsetAxis axis, float delta) { switch (axis) { case OffsetAxis.UpDown: upDownOffset += delta; break; case OffsetAxis.LeftRight: leftRightOffset += delta; break; case OffsetAxis.ForwardBack: forwardBackOffset += delta; break; case OffsetAxis.RotateX: rotationOffset.x += delta; break; case OffsetAxis.RotateY: rotationOffset.y += delta; break; case OffsetAxis.RotateZ: rotationOffset.z += delta; break; } } internal void ResetRotationAndPositionEdits() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) upDownOffset = 0f; leftRightOffset = 0f; forwardBackOffset = 0f; rotationOffset = Vector3.zero; } internal void EditPositionOffset(Vector3 normalizedDirection, KeyControl keyControl, float amount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (normalizedDirection == Vector3.up) { upDownOffset += amount; ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(IncreaseNumberOverTime(OffsetAxis.UpDown, keyControl, amount)); } else if (normalizedDirection == Vector3.right) { leftRightOffset += amount; ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(IncreaseNumberOverTime(OffsetAxis.LeftRight, keyControl, amount)); } else if (normalizedDirection == Vector3.forward) { forwardBackOffset += amount; ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(IncreaseNumberOverTime(OffsetAxis.ForwardBack, keyControl, amount)); } } internal void RotateUpDown(KeyControl keyControl, float angleIncrease) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) rotationOffset += new Vector3(angleIncrease, 0f, 0f); ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(IncreaseNumberOverTime(OffsetAxis.RotateX, keyControl, angleIncrease)); } internal void RotateLeftRight(KeyControl keyControl, float angleIncrease) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) rotationOffset += new Vector3(0f, angleIncrease, 0f); ((MonoBehaviour)GameNetworkManager.Instance.localPlayerController).StartCoroutine(IncreaseNumberOverTime(OffsetAxis.RotateY, keyControl, angleIncrease)); } private IEnumerator IncreaseNumberOverTime(OffsetAxis offsetAxis, KeyControl keyControl, float amountToIncrease) { yield return (object)new WaitForSeconds(0.1f); if (!((ButtonControl)keyControl).isPressed) { yield break; } AddOffset(offsetAxis, amountToIncrease); yield return (object)new WaitForSeconds(0.1f); if (!((ButtonControl)keyControl).isPressed) { yield break; } AddOffset(offsetAxis, amountToIncrease); yield return (object)new WaitForSeconds(0.05f); if (((ButtonControl)keyControl).isPressed) { AddOffset(offsetAxis, amountToIncrease); yield return null; while (((ButtonControl)keyControl).isPressed) { AddOffset(offsetAxis, amountToIncrease); yield return null; } } } internal void HandleSpawningOriginal(DawnMapObjectInfo dawnMapObjectInfoContainer, RaycastHit raycastHit) { //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_0007: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Vector3 zero = Vector3.zero; zero += upDownOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.up; zero += leftRightOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.right; zero += forwardBackOffset * ((Component)GameNetworkManager.Instance.localPlayerController).transform.forward; if (dawnMapObjectInfoContainer.HasNetworkObject) { if (NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate(dawnMapObjectInfoContainer.GetMapObjectPrefab(), ((RaycastHit)(ref raycastHit)).point + zero, Quaternion.Euler(rotationOffset)); val.GetComponent().Spawn(false); } } else { Object.Instantiate(dawnMapObjectInfoContainer.GetMapObjectPrefab(), ((RaycastHit)(ref raycastHit)).point + zero, Quaternion.Euler(rotationOffset)); } } } public enum DeathAnimation { Default, HeadBurst, Spring, Electrocuted, ComedyMask, TragedyMask, Burnt, Snipped, SliceHead, Pieces } public class StoatGun : GrabbableObject { [CompilerGenerated] private static class <>O { public static hook_Crouch_performed <0>__PlayerControllerB_Crouch_performed; } private bool damageSelf = false; private static readonly int IsHeldAnimation = Animator.StringToHash("IsHeld"); private static readonly int ShootAnimation = Animator.StringToHash("Shoot"); private bool holdingCtrl = false; [field: SerializeField] public StoatProjectile StoatProjectile { get; private set; } [field: SerializeField] public Transform GunTip { get; private set; } [field: SerializeField] public Animator Animator { get; private set; } [field: SerializeField] public int Damage { get; private set; } [field: SerializeField] public DeathAnimation DeathAnimation { get; private set; } [field: SerializeField] public CauseOfDeath CauseOfDeath { get; private set; } public override void Start() { ((GrabbableObject)this).Start(); SetHazardTooltips(); } internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_Crouch_performed; if (obj == null) { hook_Crouch_performed val = PlayerControllerB_Crouch_performed; <>O.<0>__PlayerControllerB_Crouch_performed = val; obj = (object)val; } PlayerControllerB.Crouch_performed += (hook_Crouch_performed)obj; } private static void PlayerControllerB_Crouch_performed(orig_Crouch_performed orig, PlayerControllerB self, CallbackContext context) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)self.currentlyHeldObjectServer != (Object)null) || !(self.currentlyHeldObjectServer is StoatGun)) { orig.Invoke(self, context); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); SetHazardTooltips(); Animator.SetBool(IsHeldAnimation, true); if (base.playerHeldBy.isCrouching) { base.playerHeldBy.Crouch(false); } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); Animator.SetBool(IsHeldAnimation, false); } public override void Update() { ((GrabbableObject)this).Update(); if (!((Object)(object)base.playerHeldBy == (Object)null) && !base.isPocketed) { KeyboardInteractions(); MouseInteractions(); } } private void KeyboardInteractions() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current != null) { if (InputControlExtensions.IsPressed((InputControl)(object)current.ctrlKey, 0f)) { holdingCtrl = true; base.playerHeldBy.twoHanded = true; } else { holdingCtrl = false; base.playerHeldBy.twoHanded = false; } if (((ButtonControl)current.pKey).wasPressedThisFrame) { damageSelf = !damageSelf; SetHazardTooltips(); } if (((ButtonControl)current.qKey).wasPressedThisFrame) { CauseOfDeath = (CauseOfDeath)((CauseOfDeath + 1) % Enum.GetValues(typeof(CauseOfDeath)).Length); SetHazardTooltips(); } if (((ButtonControl)current.eKey).wasPressedThisFrame) { DeathAnimation = (DeathAnimation)((int)(DeathAnimation + 1) % Enum.GetValues(typeof(DeathAnimation)).Length); SetHazardTooltips(); } if (((ButtonControl)current.rKey).wasPressedThisFrame) { KillEnemiesServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void KillEnemiesServerRpc() { foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && ((NetworkBehaviour)spawnedEnemy).NetworkObject.IsSpawned) { ((NetworkBehaviour)spawnedEnemy).NetworkObject.Despawn(true); } } } private void MouseInteractions() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00ee: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) Mouse current = Mouse.current; if (current == null) { return; } if (holdingCtrl) { Vector2 val = ((InputControl)(object)current.scroll).ReadValue(); Vector2 normalized = ((Vector2)(ref val)).normalized; Damage += (int)normalized.y; SetHazardTooltips(); } if (!current.leftButton.wasPressedThisFrame) { return; } Animator.SetTrigger(ShootAnimation); HUDManager.Instance.ShakeCamera((ScreenShakeType)0); if (damageSelf) { if (holdingCtrl) { base.playerHeldBy.KillPlayer(Vector3.zero, true, CauseOfDeath, (int)DeathAnimation, default(Vector3), false); } else { base.playerHeldBy.DamagePlayer(Damage, true, true, CauseOfDeath, (int)DeathAnimation, false, default(Vector3)); } } else { StoatProjectile stoatProjectile = Object.Instantiate(StoatProjectile, GunTip.position, Quaternion.identity); stoatProjectile.SetupProjectile(((Component)base.playerHeldBy.gameplayCamera).transform.forward, Damage, base.playerHeldBy, holdingCtrl, CauseOfDeath, DeathAnimation); } } public void SetHazardTooltips() { //IL_0076: 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) HUDManager.Instance.ClearControlTips(); List list = new List(7) { "Gugugugugugu others : [LMB]", "Damage : " + Damage + " [Ctrl & Scroll]", "InstaKill : [Ctrl & LMB]", "Self Damage : " + damageSelf + " [P]", "CoDeath : " + ((object)CauseOfDeath/*cast due to .constrained prefix*/).ToString() + " [Q]", "Death Anim : " + DeathAnimation.ToString() + " [E]", "Remove all Enemies : [R]" }; HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), false, (Item)null); } } public class StoatProjectile : MonoBehaviour { private int force = 0; private PlayerControllerB playerHeldBy = null; private bool instaKill = false; private CauseOfDeath CauseOfDeath = (CauseOfDeath)7; private DeathAnimation DeathAnimation = DeathAnimation.Default; private Collider[] collidersHit = (Collider[])(object)new Collider[16]; private List playersHit = new List(); private List enemiesHit = new List(); private List hittablesHit = new List(); private List explodeablesHit = new List(); private float timer = 30f; [field: SerializeField] public float Speed { get; private set; } = 12f; [field: SerializeField] public SpriteRenderer SpriteRenderer { get; private set; } = null; [field: SerializeField] public List Sprites { get; private set; } = new List(); [field: SerializeField] public float DetectionRadius { get; private set; } = 1f; public void SetupProjectile(Vector3 direction, int force, PlayerControllerB playerHeldBy, bool instaKill, CauseOfDeath causeOfDeath, DeathAnimation deathAnimation) { //IL_0007: 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_0027: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.forward = direction; this.force = force; this.playerHeldBy = playerHeldBy; this.instaKill = instaKill; CauseOfDeath = causeOfDeath; DeathAnimation = deathAnimation; SpriteRenderer.sprite = Sprites[Random.Range(0, Sprites.Count)]; } public void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0308: 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_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) timer -= Time.deltaTime; if (timer <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * Time.deltaTime * Speed; int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, DetectionRadius, collidersHit, MoreLayerMasks.PlayersAndInteractableAndEnemiesAndPropsHazardMask | StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)2); if (num <= 0) { return; } playersHit.Clear(); enemiesHit.Clear(); hittablesHit.Clear(); explodeablesHit.Clear(); List list = collidersHit.Take(num).ToList(); foreach (Collider item in list) { IExplodeable component = ((Component)item).GetComponent(); IHittable component2 = ((Component)item).GetComponent(); if (component != null) { if (explodeablesHit.Contains(component)) { continue; } explodeablesHit.Add(component); } if (component2 == null) { continue; } PlayerControllerB val = (PlayerControllerB)(object)((component2 is PlayerControllerB) ? component2 : null); if (val != null) { if (!playersHit.Contains(val) && !((Object)(object)val == (Object)(object)playerHeldBy)) { playersHit.Add(val); } continue; } EnemyAICollisionDetect val2 = (EnemyAICollisionDetect)(object)((component2 is EnemyAICollisionDetect) ? component2 : null); if (val2 != null) { if (!enemiesHit.Contains(val2.mainScript)) { enemiesHit.Add(val2.mainScript); } } else if (!hittablesHit.Contains(component2)) { hittablesHit.Add(component2); } } foreach (PlayerControllerB item2 in playersHit) { if (instaKill) { item2.KillPlayer(Vector3.zero, true, CauseOfDeath, (int)DeathAnimation, default(Vector3), false); } else { item2.DamagePlayer(force, true, true, CauseOfDeath, (int)DeathAnimation, false, default(Vector3)); } } foreach (EnemyAI item3 in enemiesHit) { if (instaKill) { item3.KillEnemyServerRpc(false); } else { item3.HitEnemyOnLocalClient(force, ((Component)this).transform.position, playerHeldBy, true, -1); } } foreach (IHittable item4 in hittablesHit) { if (instaKill) { item4.Hit(int.MaxValue, ((Component)this).transform.position, playerHeldBy, true, -1); } else { item4.Hit(force, ((Component)this).transform.position, playerHeldBy, true, -1); } } foreach (IExplodeable item5 in explodeablesHit) { if (instaKill) { item5.OnExplosion(int.MaxValue, ((Component)this).transform.position, DetectionRadius); } else { item5.OnExplosion(force, ((Component)this).transform.position, DetectionRadius); } } if (playersHit.Count > 0 || enemiesHit.Count > 0 || hittablesHit.Count > 0 || explodeablesHit.Count > 0) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class XuBuck : GrabbableObject { public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); DawnUnlockableItemInfo val = default(DawnUnlockableItemInfo); if (((Registry)(object)LethalContent.Unlockables).TryGetValue(CodeRebirthUnlockableItemKeys.DenominationAnalyzer, ref val)) { if (val.UnlockableItem.inStorage && (val.UnlockableItem.hasBeenUnlockedByPlayer || val.UnlockableItem.alreadyUnlocked)) { StartOfRound.Instance.ReturnUnlockableFromStorageServerRpc(StartOfRound.Instance.unlockablesList.unlockables.IndexOf(val.UnlockableItem)); return; } StartOfRound.Instance.BuyShipUnlockableServerRpc(StartOfRound.Instance.unlockablesList.unlockables.IndexOf(val.UnlockableItem), TerminalRefs.Instance.groupCredits); ((MonoBehaviour)this).StartCoroutine(WaitToMaxCounter()); } } public override void Update() { ((GrabbableObject)this).Update(); if (base.isPocketed || !base.isHeld) { return; } Keyboard current = Keyboard.current; if (current != null && !((Object)(object)NetworkSingleton.Instance == (Object)null)) { if (((ButtonControl)current.rKey).wasPressedThisFrame) { NetworkSingleton.Instance.RemoveMoney(NetworkSingleton.Instance.MoneyStored()); } else if (((ButtonControl)current.zKey).wasPressedThisFrame && NetworkSingleton.Instance.MoneyStored() >= 0) { NetworkSingleton.Instance.RemoveMoney(NetworkSingleton.Instance.MoneyStored() + 1); } } } private IEnumerator WaitToMaxCounter() { yield return (object)new WaitForSeconds(1f); int moneyRequired = Math.Clamp(999 - NetworkSingleton.Instance.MoneyStored(), 0, 999); NetworkSingleton.Instance.AddMoney(moneyRequired); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }