using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using GreenDemonChallenge.Behaviour; using GreenDemonChallenge.Behaviour.GUI; using GreenDemonChallenge.Compatibility; using GreenDemonChallenge.Data; using GreenDemonChallenge.Patchers; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.Core.Extensions; using Peak.Afflictions; using Peak.Network; using Photon.Pun; using Photon.Realtime; using Photon.Voice.Unity.Demos; using PhotonCustomPropsUtils; using TMPro; using TimeTheme; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.TextCore; using UnityEngine.UI; using UnityEngine.UI.Extensions; using UnnamedProducts; using UnnamedProducts.Behaviours; using UnnamedProducts.Behaviours.Item.GarbageBag; using Zorro.Core; using Zorro.Core.CLI; using Zorro.Core.Serizalization; using pworld.Scripts.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.MiiMii1205.GreenDemonChallenge")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.2.0")] [assembly: AssemblyInformationalVersion("1.3.2+4c6b6631aeff1ceb174c5bb669516119e8734517")] [assembly: AssemblyProduct("com.github.MiiMii1205.GreenDemonChallenge")] [assembly: AssemblyTitle("GreenDemonChallenge")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace GreenDemonChallenge { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.MiiMii1205.GreenDemonChallenge", "GreenDemonChallenge", "1.3.2")] public class GreenDemonChallenge : BaseUnityPlugin { public static GreenDemonCaughtEffects RoomGreenDemonCaughtEffect = GreenDemonCaughtEffects.KILL; public static Dictionary RoomBiomeConfig = null; private static TMP_FontAsset? _darumaFontAsset; private static Material? _darumaShadowMaterial; public static GreenDemonSpeeds RoomGreenDemonSpeed = GreenDemonSpeeds.MEDIUM; public static int RoomGreenDemonAmount = 1; public static bool RoomEnableGreenDemonInTheKiln; public static float RoomGreenDemonDelay; public static GreenDemonRandomTypes RoomGreenDemonRandomType; public static GreenDemonModes RoomGreenDemonMode; private static readonly int UnderlayDilate = Shader.PropertyToID("_UnderlayDilate"); private static readonly int UnderlayOffsetY = Shader.PropertyToID("_UnderlayOffsetY"); private static readonly int UnderlaySoftness = Shader.PropertyToID("_UnderlaySoftness"); private static readonly int UnderlayColor = Shader.PropertyToID("_UnderlayColor"); public const string Id = "com.github.MiiMii1205.GreenDemonChallenge"; public static GameObject GreenDemonPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; internal static ManualLogSource Log { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static PhotonScopedManager? Manager { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public static ConfigEntry GreenDemonCaughtEffect { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static ConfigEntry GreenDemonTrackerSetting { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static ConfigEntry GreenDemonVolume { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static Dictionary> BiomeConfig { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject TriggerEntryPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject TriggerExitPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject TheDemonIsHerePrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject TrackerPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject PoisonCloudPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject SporeCloudPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject IceCloudPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static GameObject FireCloudPrefab { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static TMP_FontAsset DarumaDropOne { get { if ((Object)(object)_darumaFontAsset == (Object)null) { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll(); _darumaFontAsset = ((IEnumerable)source).FirstOrDefault((Func)delegate(TMP_FontAsset fontAsset) { //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) FaceInfo faceInfo = ((TMP_Asset)fontAsset).faceInfo; return ((FaceInfo)(ref faceInfo)).familyName == "Daruma Drop One"; }); Log.LogInfo((object)"Daruma Drop One font found!"); } return _darumaFontAsset; } } public static Material DarumaDropOneFogShadowMaterial { get { //IL_0097: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_darumaShadowMaterial == (Object)null) { _darumaShadowMaterial = ThrowHelper.ThrowIfArgumentNull(Object.Instantiate(((TMP_Asset)DarumaDropOne).material), "Instantiate(DarumaDropOne.material)"); _darumaShadowMaterial.EnableKeyword("UNDERLAY_ON"); _darumaShadowMaterial.SetFloat(UnderlayDilate, 1f); _darumaShadowMaterial.SetFloat(UnderlayOffsetY, -0.7f); _darumaShadowMaterial.SetFloat(UnderlaySoftness, 1f); _darumaShadowMaterial.SetColor(UnderlayColor, new Color(0f, 0f, 0f, 0.1960784f)); Log.LogInfo((object)"Shadow material for Green Demon Challenge was successfully generated!"); } return _darumaShadowMaterial; } } private static bool IsRunStarted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return RunManager.Instance?.runStarted ?? false; } } public static ConfigEntry GreenDemonAmount { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } = null; public static ConfigEntry EnableGreenDemonInTheKiln { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static ConfigEntry StopGreenDemonInTomb { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } = null; public static ConfigEntry GreenDemonSpeed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } = null; public static ConfigEntry GreenDemonDelay { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } = null; public static ConfigEntry GreenDemonMode { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } = null; public static ConfigEntry GreenDemonRandomType { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] set; } = null; public static string Name => "GreenDemonChallenge"; public static string Version => "1.3.2"; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Manager = PhotonCustomPropsUtilsPlugin.GetManager("com.github.MiiMii1205.GreenDemonChallenge"); ConfigDescription val = new ConfigDescription("What happens to players caught by Green Demons", (AcceptableValueBase)(object)new AcceptableEnumList(GetValidEffects()), Array.Empty()); GreenDemonCaughtEffect = ((BaseUnityPlugin)this).Config.Bind("General", "Green Demon Caught Effect", GreenDemonCaughtEffects.KILL, val); GreenDemonVolume = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "Green Demon Volume", 1f, new ConfigDescription("The volume of the Green Demon Music", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); GreenDemonTrackerSetting = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "Green Demon Tracker Mode", GreenDemonTrackerSettings.OFFSCREEN, "When on-screen trackers should appear."); GreenDemonAmount = ((BaseUnityPlugin)this).Config.Bind("General", "Green Demon amount", 1, new ConfigDescription("The amount of Green Demons that spawns in.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); GreenDemonSpeed = ((BaseUnityPlugin)this).Config.Bind("General", "Green Demon Speed", GreenDemonSpeeds.MEDIUM, "How fast green demons goes."); GreenDemonDelay = ((BaseUnityPlugin)this).Config.Bind("General", "Green Demon Delay", 1f, "How long the demon has to wait before starting to chase players after spawning."); GreenDemonMode = ((BaseUnityPlugin)this).Config.Bind("General", "Green Demon Mode", GreenDemonModes.NORMAL, "The current Green Demon Challenge mode. 'NORMAL' despawns all active demons after starting a campfire, 'HARD' stops them momentarily but max out demon count to \"Green Demon amount\", 'VERY_HARD' is 'HARD' but demon keeps spawning ."); GreenDemonRandomType = ((BaseUnityPlugin)this).Config.Bind("General", "Type of Green Demon Random Effects", GreenDemonRandomTypes.STANDARD, "Restricts the kind of effects that can happen when the Caught Effect is RANDOM. 'CASUAL' removes the harsher effects (like 'KILL', 'POOR_BOY'), 'HARDCORE' removes the softer effects (like 'SLIP' or 'BEES'), and 'STANDARD' keeps every effects."); GreenDemonCaughtEffect.SettingChanged += UpdateGreenDemonConfig; GreenDemonAmount.SettingChanged += UpdateGreenDemonConfig; GreenDemonSpeed.SettingChanged += UpdateGreenDemonConfig; GreenDemonMode.SettingChanged += UpdateGreenDemonConfig; GreenDemonRandomType.SettingChanged += UpdateGreenDemonConfig; GreenDemonVolume.SettingChanged += UpdateDemonVolumes; GreenDemonTrackerSetting.SettingChanged += UpdateTrackersSettings; BiomeConfig = new Dictionary>(); RoomBiomeConfig = new Dictionary(); foreach (object enumValue in typeof(BiomeType).GetEnumValues()) { if ((int)enumValue <= 7) { string text = typeof(BiomeType).GetEnumName((object)(BiomeType)enumValue)?.Replace("Volcano", "Caldera"); ConfigEntry val2 = ((BaseUnityPlugin)this).Config.Bind("Biomes", "Enable " + text, true, "Enables/disables Green Demons for " + text); val2.SettingChanged += UpdateGreenDemonConfig; BiomeConfig.Add((BiomeType)enumValue, val2); RoomBiomeConfig.Add((BiomeType)enumValue, val2.Value); } } EnableGreenDemonInTheKiln = ((BaseUnityPlugin)this).Config.Bind("Biomes", "Enable The Kiln", true, "Enables/Disables the Green Demon for The Kiln"); EnableGreenDemonInTheKiln.SettingChanged += UpdateGreenDemonConfig; GreenDemonDelay.SettingChanged += UpdateGreenDemonConfig; RoomGreenDemonAmount = GreenDemonAmount.Value; RoomGreenDemonSpeed = GreenDemonSpeed.Value; RoomGreenDemonCaughtEffect = GreenDemonCaughtEffect.Value; RoomEnableGreenDemonInTheKiln = EnableGreenDemonInTheKiln.Value; RoomGreenDemonDelay = GreenDemonDelay.Value; RoomGreenDemonMode = GreenDemonMode.Value; RoomGreenDemonRandomType = GreenDemonRandomType.Value; BundleLoader.LoadBundleAndContentsWithName((BaseUnityPlugin)(object)this, "greendemon.peakbundle", (Action)delegate(PeakBundle bundle) { //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) GreenDemonPrefab = bundle.LoadAsset("GreenDemon.prefab"); TriggerEntryPrefab = bundle.LoadAsset("GreenDemonEntry.prefab"); TriggerExitPrefab = bundle.LoadAsset("GreenDemonExit.prefab"); TheDemonIsHerePrefab = bundle.LoadAsset("TheDemonIsHere.prefab"); TrackerPrefab = bundle.LoadAsset("GreenDemonTracker.prefab"); TrackerPrefab.GetComponentInChildren(true).alpha = 0f; ExtGameObject.GetOrAddComponent(TriggerEntryPrefab); ExtGameObject.GetOrAddComponent(TriggerExitPrefab); PoisonCloudPrefab = bundle.LoadAsset("PoisonCloud.prefab"); SporeCloudPrefab = bundle.LoadAsset("SporeCloud.prefab"); IceCloudPrefab = bundle.LoadAsset("IceCloud.prefab"); FireCloudPrefab = bundle.LoadAsset("FireCloud.prefab"); GameObject val4 = bundle.LoadAsset("GreenDemonConsumeVFX.prefab"); GameObject val5 = bundle.LoadAsset("GreenDemonPoofVFX.prefab"); ShaderExtensions.ReplaceShaders(val4); ShaderExtensions.ReplaceShaders(val5); ReplaceShaders(new List(16) { "W/Peak_Standard", "W/Character", "W/Peak_Transparent", "W/Peak_Glass", "W/Peak_Clip", "W/Peak_glass_liquid", "W/Peak_GroundTransition", "W/Peak_Guidebook", "W/Peak_Honey", "W/Peak_Ice", "W/Peak_Rock", "W/Peak_Rope", "W/Peak_Splash", "W/Peak_Waterfall", "GD/FireParticle", "SmokeParticle" }, val4); ReplaceShaders(new List(16) { "W/Peak_Standard", "W/Character", "W/Peak_Transparent", "W/Peak_Glass", "W/Peak_Clip", "W/Peak_glass_liquid", "W/Peak_GroundTransition", "W/Peak_Guidebook", "W/Peak_Honey", "W/Peak_Ice", "W/Peak_Rock", "W/Peak_Rope", "W/Peak_Splash", "W/Peak_Waterfall", "GD/FireParticle", "SmokeParticle" }, val5); DestroyAfterEmit orAddComponent = ExtGameObject.GetOrAddComponent(val4); orAddComponent.m_particle = val4.GetComponent(); DestroyAfterEmit orAddComponent2 = ExtGameObject.GetOrAddComponent(val5); orAddComponent2.m_particle = val5.GetComponent(); GreenDemon orAddComponent3 = ExtGameObject.GetOrAddComponent(GreenDemonPrefab); orAddComponent3.mainRenderer = GreenDemonPrefab.GetComponentInChildren(); orAddComponent3.m_demonTransform = ((Component)orAddComponent3.mainRenderer).transform.parent; GameObject val6 = new GameObject("GreenDemonTrigger"); GreenDemonDetector greenDemonDetector = val6.AddComponent(); SphereCollider val7 = val6.AddComponent(); orAddComponent3.m_detector = greenDemonDetector; ((Collider)val7).isTrigger = true; float detectorRadius = (val7.radius = 100f); greenDemonDetector.m_detectorRadius = detectorRadius; val6.transform.SetParent(((Component)orAddComponent3.mainRenderer).transform, false); val6.transform.localPosition = ExtDataTypes.ToVec(0); val6.transform.localRotation = Quaternion.identity; Item val8 = default(Item); Item val9 = default(Item); if (ItemDatabase.TryGetItem((ushort)158, ref val8) && ItemDatabase.TryGetItem((ushort)13, ref val9)) { ItemImpactSFX component = ((Component)val8).GetComponent(); ItemImpactSFX component2 = ((Component)val9).GetComponent(); orAddComponent3.m_impact = CollectionExtensions.AddRangeToArray(orAddComponent3.m_impact, component.impact); SFX_Instance[] impact = component2.impact; foreach (SFX_Instance val10 in impact) { if (((Object)val10).name == "SFXI BingBong 2") { orAddComponent3.m_impact = CollectionExtensions.AddToArray(orAddComponent3.m_impact, val10); } } } SFX_PlayOneShot component3 = GreenDemonPrefab.GetComponent(); SFX_Instance[] sfxs = component3.sfxs; SFX_Instance[] array = sfxs; foreach (SFX_Instance val11 in array) { if (((Object)val11).name == "SFXI Heal Hunger Stamina") { orAddComponent3.consumedSfx = CollectionExtensions.AddToArray(orAddComponent3.consumedSfx, val11); } } orAddComponent3.shrunkSfx = CollectionExtensions.AddToArray(orAddComponent3.shrunkSfx, bundle.LoadAsset("SFXI Demon_Despawn.asset")); orAddComponent3.consumedSfx = CollectionExtensions.AddToArray(CollectionExtensions.AddToArray(orAddComponent3.consumedSfx, bundle.LoadAsset("SFXI Demon_Consume.asset")), bundle.LoadAsset("SFXI Demon_Consume_Jingle.asset")); orAddComponent3.m_vfxPrefab = val4; orAddComponent3.m_poofVfxPrefab = val5; Object.Destroy((Object)(object)component3); orAddComponent3.source = GreenDemonPrefab.GetComponent(); GameObject val12 = Resources.Load("Character"); orAddComponent3.source.outputAudioMixerGroup = val12.GetComponentInChildren(true).mainMusic.outputAudioMixerGroup; ReplaceShaders(new List(16) { "W/Peak_Standard", "W/Character", "W/Peak_Transparent", "W/Peak_Glass", "W/Peak_Clip", "W/Peak_glass_liquid", "W/Peak_GroundTransition", "W/Peak_Guidebook", "W/Peak_Honey", "W/Peak_Ice", "W/Peak_Rock", "W/Peak_Rope", "W/Peak_Splash", "W/Peak_Waterfall", "GD/FireParticle", "W/Vine" }, GreenDemonPrefab); ReplaceShaders(new List(2) { "Scouts/UI", "TextMeshPro/Distance Field" }, TheDemonIsHerePrefab); ReplaceShaders(new List(2) { "Scouts/UI", "TextMeshPro/Distance Field" }, TrackerPrefab); ShaderExtensions.ReplaceShaders(TheDemonIsHerePrefab); ShaderExtensions.ReplaceShaders(TrackerPrefab); ShaderExtensions.ReplaceShaders(GreenDemonPrefab); ShaderExtensions.ReplaceShaders(PoisonCloudPrefab); ShaderExtensions.ReplaceShaders(SporeCloudPrefab); ShaderExtensions.ReplaceShaders(IceCloudPrefab); ShaderExtensions.ReplaceShaders(FireCloudPrefab); ReplaceAudioMixerOutput(TheDemonIsHerePrefab); ReplaceAudioMixerOutput(TrackerPrefab); ReplaceAudioMixerOutput(GreenDemonPrefab); ReplaceAudioMixerOutput(PoisonCloudPrefab); ReplaceAudioMixerOutput(SporeCloudPrefab); ReplaceAudioMixerOutput(IceCloudPrefab); ReplaceAudioMixerOutput(FireCloudPrefab); TMP_Text[] componentsInChildren = TheDemonIsHerePrefab.GetComponentsInChildren(); foreach (TMP_Text val13 in componentsInChildren) { val13.font = DarumaDropOne; val13.fontMaterial = DarumaDropOneFogShadowMaterial; } NetworkPrefabManager.TryRegisterNetworkPrefab(((Object)GreenDemonPrefab).name, GreenDemonPrefab); NetworkPrefabManager.TryRegisterNetworkPrefab(((Object)PoisonCloudPrefab).name, PoisonCloudPrefab); NetworkPrefabManager.TryRegisterNetworkPrefab(((Object)SporeCloudPrefab).name, SporeCloudPrefab); NetworkPrefabManager.TryRegisterNetworkPrefab(((Object)IceCloudPrefab).name, IceCloudPrefab); NetworkPrefabManager.TryRegisterNetworkPrefab(((Object)FireCloudPrefab).name, FireCloudPrefab); GreenDemonTracker orAddComponent4 = ExtGameObject.GetOrAddComponent(TrackerPrefab); AnimationCurve val14 = AnimationCurve.EaseInOut(0f, 0f, 1.25f, 1f); val14.preWrapMode = (WrapMode)4; val14.postWrapMode = (WrapMode)4; orAddComponent4.m_pulseTintCurve = val14; orAddComponent4.m_group = ((Component)orAddComponent4).GetComponent(); orAddComponent4.m_rotatorTransform = ((Component)((Component)orAddComponent4).transform.Find("DemonArrowRotator")).GetComponent(); orAddComponent4.m_arrowImage = ((Component)((Transform)orAddComponent4.m_rotatorTransform).Find("Arrow").Find("Image")).GetComponent(); orAddComponent4.m_demonTransform = ((Component)((Component)orAddComponent4).transform.Find("DemonImage")).GetComponent(); orAddComponent4.m_demonImage = ((Component)orAddComponent4.m_demonTransform).GetComponent(); bundle.Mod.RegisterContent(); Log.LogInfo((object)"Green Demon bundle is loaded!"); }); Manager.RegisterRoomProperty("RoomGreenDemonSpeed", (RoomEventType)2, (Action)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", (GreenDemonSpeeds)v, "RoomGreenDemonSpeed")); RoomGreenDemonSpeed = (GreenDemonSpeeds)v; } }); Manager.RegisterRoomProperty("RoomGreenDemonAmount", (RoomEventType)2, (Action)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomGreenDemonAmount")); RoomGreenDemonAmount = v; } }); Manager.RegisterRoomProperty("RoomEnableGreenDemonInTheKiln", (RoomEventType)2, (Action)delegate(bool v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomEnableGreenDemonInTheKiln")); RoomEnableGreenDemonInTheKiln = v; } }); Manager.RegisterRoomProperty("RoomGreenDemonRandomType", (RoomEventType)2, (Action)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomGreenDemonRandomType")); RoomGreenDemonRandomType = (GreenDemonRandomTypes)v; } }); Manager.RegisterRoomProperty("RoomGreenDemonCaughtEffect", (RoomEventType)2, (Action)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", (GreenDemonCaughtEffects)v, "RoomGreenDemonCaughtEffect")); RoomGreenDemonCaughtEffect = (GreenDemonCaughtEffects)v; } }); Manager.RegisterRoomProperty("RoomGreenDemonDelay", (RoomEventType)2, (Action)delegate(float v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomGreenDemonDelay")); RoomGreenDemonDelay = v; } }); foreach (KeyValuePair keyValuePair in RoomBiomeConfig) { string text2 = string.Format("{0}_{1}", keyValuePair.Key, "RoomBiomeConfig"); Manager.RegisterRoomProperty(text2, (RoomEventType)2, (Action)delegate(bool v) { //IL_0022: 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) if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}[{2}]!", v, "RoomBiomeConfig", keyValuePair.Key)); RoomBiomeConfig[keyValuePair.Key] = v; } }); } Manager.RegisterOnJoinedRoom((Action)SetupGreenDemonSettings); AddLocalizedTextCsv(); Harmony val3 = new Harmony("com.github.MiiMii1205.GreenDemonChallenge"); val3.PatchAll(typeof(GreenDemonPatcher)); if (LuckyBlocksCompatibilityHandler.Enabled) { LuckyBlocksCompatibilityHandler.PatchLuckyBlocks(val3); } if (TimeThemeCompatibilityHandler.Enabled) { TimeThemeCompatibilityHandler.Init(); } Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void ReplaceAudioMixerOutput(GameObject trackerPrefab) { AudioMixerGroup[] source = Resources.FindObjectsOfTypeAll(); AudioSource[] componentsInChildren = trackerPrefab.GetComponentsInChildren(true); foreach (AudioSource s in componentsInChildren) { Log.LogInfo((object)("MixerGroup name is " + ((Object)s.outputAudioMixerGroup).name)); AudioMixerGroup outputAudioMixerGroup = source.First((AudioMixerGroup g) => ((Object)g).name == ((Object)s.outputAudioMixerGroup).name); s.outputAudioMixerGroup = outputAudioMixerGroup; } } private static void UpdateDemonVolumes(object sender, EventArgs e) { foreach (GreenDemon allDemon in GreenDemon.AllDemons) { allDemon.RefreshVolume(); } } private static void UpdateTrackersSettings(object sender, EventArgs e) { foreach (GreenDemonTracker allTracker in GreenDemonTracker.AllTrackers) { allTracker.RefreshTrackerVisibility(); } } private static GreenDemonCaughtEffects[] GetValidEffects() { List list = new List(); foreach (GreenDemonCaughtEffects value in Enum.GetValues(typeof(GreenDemonCaughtEffects))) { switch (value) { case GreenDemonCaughtEffects.SET_FIRE: case GreenDemonCaughtEffects.FIREBALL: case GreenDemonCaughtEffects.UNNAMIFY: if (UnnamedCompatibilityHandler.Enabled) { list.Add(value); } break; case GreenDemonCaughtEffects.SPAWN_LUCKY_BLOCK: if (LuckyBlocksCompatibilityHandler.Enabled) { list.Add(value); } break; default: list.Add(value); break; } } return list.ToArray(); } private static void UpdateGreenDemonConfig(object sender, EventArgs e) { if (!IsRunStarted) { SetupGreenDemonSettings(PhotonNetwork.LocalPlayer); } else { Log.LogWarning((object)"Run has already started. Can't change the settings mid-run..."); } } private static void SetupGreenDemonSettings(Player player) { //IL_02ae: 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_0300: Unknown result type (might be due to invalid IL or missing references) if (!player.IsMasterClient) { Log.LogWarning((object)$"{player} is NOT the host. Can't send our Settings."); } if (!PhotonNetwork.InRoom || !player.IsMasterClient || Manager == null) { return; } Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonSpeed", GreenDemonSpeed.Value)); RoomGreenDemonSpeed = GreenDemonSpeed.Value; Manager.SetRoomProperty("RoomGreenDemonSpeed", (object)(int)GreenDemonSpeed.Value); Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonAmount", GreenDemonAmount.Value)); RoomGreenDemonAmount = GreenDemonAmount.Value; Manager.SetRoomProperty("RoomGreenDemonAmount", (object)GreenDemonAmount.Value); Log.LogInfo((object)string.Format("Sending our current {0} in the kiln of {1}...", "RoomEnableGreenDemonInTheKiln", EnableGreenDemonInTheKiln.Value)); RoomEnableGreenDemonInTheKiln = EnableGreenDemonInTheKiln.Value; Manager.SetRoomProperty("RoomEnableGreenDemonInTheKiln", (object)EnableGreenDemonInTheKiln.Value); Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonCaughtEffect", GreenDemonCaughtEffect.Value)); RoomGreenDemonCaughtEffect = GreenDemonCaughtEffect.Value; Manager.SetRoomProperty("RoomGreenDemonCaughtEffect", (object)(int)GreenDemonCaughtEffect.Value); Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonMode", GreenDemonMode.Value)); RoomGreenDemonMode = GreenDemonMode.Value; Manager.SetRoomProperty("RoomGreenDemonMode", (object)(int)GreenDemonMode.Value); Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonDelay", GreenDemonDelay.Value)); RoomGreenDemonDelay = GreenDemonDelay.Value; Manager.SetRoomProperty("RoomGreenDemonDelay", (object)GreenDemonDelay.Value); Log.LogInfo((object)string.Format("Sending our current {0} of {1}...", "RoomGreenDemonRandomType", GreenDemonRandomType.Value)); RoomGreenDemonRandomType = GreenDemonRandomType.Value; Manager.SetRoomProperty("RoomGreenDemonRandomType", (object)GreenDemonRandomType.Value); foreach (KeyValuePair> item in BiomeConfig) { string text = string.Format("{0}_{1}", item.Key, "RoomBiomeConfig"); Log.LogInfo((object)string.Format("Sending our current ${0}[{1}] of {2}...", "RoomBiomeConfig", item.Key, item.Value.Value)); RoomBiomeConfig[item.Key] = item.Value.Value; Manager.SetRoomProperty(text, (object)item.Value.Value); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void ReplaceShaders(List shaderNames, GameObject go) { Renderer[] componentsInChildren = go.GetComponentsInChildren(); foreach (Renderer ren in componentsInChildren) { ReplaceAllShaderInRenderer(shaderNames, ren); } } private static void ReplaceAllShaderInRenderer(List shaderNames, Renderer ren) { foreach (string shaderName in shaderNames) { Shader val = Shader.Find(shaderName); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)(": Shader " + shaderName + " was not found.")); continue; } Material[] sharedMaterials = ren.sharedMaterials; foreach (Material mat in sharedMaterials) { ReplaceShader(val, mat); } Material[] materials = ren.materials; foreach (Material mat2 in materials) { ReplaceShader(val, mat2); } } } private void AddLocalizedTextCsv() { using StreamReader streamReader = new StreamReader(Path.Join((ReadOnlySpan)Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), (ReadOnlySpan)"GreenDemonChallengeLocalizedText.csv")); int num = 0; while (!streamReader.EndOfStream) { string text = streamReader.ReadLine(); if (text == null) { break; } num++; List list = new List(CSVReader.SplitCsvLine(text, true)); string text2 = ExtCollections.Deque(list); string text3 = ExtCollections.Pop(list); if (text3 != "ENDLINE") { Log.LogError((object)$"Invalid localization at line {num}"); } if (text2 != "CURRENT_LANGUAGE") { LocalizedText.mainTable[text2.ToUpper()] = list; Log.LogDebug((object)("Added localization of " + text2.ToUpper())); } } Log.LogDebug((object)$"Added {num - 1} localizations"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void ReplaceShader(Shader shader, Material mat) { if (((Object)mat.shader).name == ((Object)shader).name) { mat.shader = shader; } } private void OnGUI() { } [ConsoleCommand] public static void SpawnGreenDemons(int nb) { GreenDemonHandler.Instance.SpawnGreenDemon(nb); } [ConsoleCommand] public static void SpawnGreenDemons() { GreenDemonHandler.Instance.SpawnGreenDemon(1); } [ConsoleCommand] public static void DespawnGreenDemons() { GreenDemonHandler.Instance.ShrinkAllDemons(); } [ConsoleCommand] public static void SpawnIceCloud() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(IceCloudPrefab, Character.localCharacter.Center, Quaternion.identity); } [ConsoleCommand] public static void SpawnFireCloud() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(FireCloudPrefab, Character.localCharacter.Center, Quaternion.identity); } [ConsoleCommand] public static void SpawnSporeCloud() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(SporeCloudPrefab, Character.localCharacter.Center, Quaternion.identity); } [ConsoleCommand] public static void SpawnPoisonCloud() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(PoisonCloudPrefab, Character.localCharacter.Center, Quaternion.identity); } } } namespace GreenDemonChallenge.Patchers { public static class GreenDemonPatcher { [HarmonyPatch(typeof(RunManager), "Awake")] [HarmonyPostfix] public static void RunManagerAwakePostfix(RunManager __instance) { GreenDemonHandler orAddComponent = ExtensionMethods.GetOrAddComponent(((Component)__instance).gameObject); if ((Object)(object)orAddComponent == (Object)null) { GreenDemonChallenge.Log.LogError((object)string.Format("{0} was not found on {1}", "GreenDemonHandler", ((Component)__instance).gameObject)); } } [HarmonyPatch(typeof(GUIManager), "Awake")] [HarmonyPostfix] public static void GUIManagerAwakePostfix(GUIManager __instance) { GreenDemonGUIManager orAddComponent = ExtensionMethods.GetOrAddComponent(((Component)__instance).gameObject); if ((Object)(object)orAddComponent == (Object)null) { GreenDemonChallenge.Log.LogError((object)string.Format("{0} was not found on {1}", "GreenDemonGUIManager", ((Component)__instance).gameObject)); } } [HarmonyPatch(typeof(PeakHandler), "EndScreenComplete")] [HarmonyPostfix] public static void EndCutsceneCreditAwakePostfix(PeakHandler __instance) { GreenDemonHandler.Instance.ShrinkAllDemons(); } [HarmonyPatch(typeof(MapHandler), "JumpToSegment")] [HarmonyPostfix] public static void JumpToPostfix(MapHandler __instance, Segment segment) { switch (GreenDemonChallenge.RoomGreenDemonMode) { case GreenDemonModes.NORMAL: GreenDemonHandler.Instance.ShrinkAllDemons(); break; case GreenDemonModes.HARD: case GreenDemonModes.VERY_HARD: GreenDemonHandler.Instance.StopAllDemon((MapHandler.PreviousCampfire?.burnsFor ?? 0f) + 0.25f); break; default: throw new ArgumentOutOfRangeException(); } GreenDemonHandler.Instance.ResumeSpawning((MapHandler.PreviousCampfire?.burnsFor ?? 0f) + 0.25f); } [HarmonyPatch(typeof(TriggerEvent), "OnTriggerEnter")] [HarmonyPrefix] public static void TriggerEventPrefix(TriggerEvent __instance, Collider other, ref bool __runOriginal) { if (__instance is GreenDemonTombTrigger greenDemonTombTrigger) { __runOriginal = false; greenDemonTombTrigger.OnGDCTriggerEnter(other); } } [HarmonyPatch(typeof(CharacterInput), "GetMovementInput")] [HarmonyPostfix] public static void TriggerEventPrefix(CharacterInput __instance, ref Vector2 __result) { if ((Object)(object)GreenDemonHandler.Instance != (Object)null && GreenDemonHandler.IsWKeyStuck) { __result.y = 1f; } } [HarmonyPatch(typeof(Campfire), "Light_Rpc")] [HarmonyPostfix] public static void LightPostfix(Campfire __instance, bool updateSegment) { if (updateSegment) { switch (GreenDemonChallenge.RoomGreenDemonMode) { case GreenDemonModes.NORMAL: GreenDemonHandler.Instance.ShrinkAllDemons(); break; case GreenDemonModes.HARD: case GreenDemonModes.VERY_HARD: GreenDemonHandler.Instance.StopAllDemon(__instance.burnsFor + 1f); break; default: throw new ArgumentOutOfRangeException(); } GreenDemonHandler.Instance.ResumeSpawning(__instance.burnsFor + 1f); } } } } namespace GreenDemonChallenge.Data { public class AcceptableEnumList : AcceptableValueBase where T : Enum { public virtual T[] AcceptableValues { get; } public AcceptableEnumList(params T[] acceptableValues) : base(typeof(T)) { if (acceptableValues == null) { throw new ArgumentNullException("acceptableValues"); } if (acceptableValues.Length == 0) { throw new ArgumentException("At least one acceptable value is needed", "acceptableValues"); } AcceptableValues = acceptableValues; } public override object Clamp(object value) { if (!((AcceptableValueBase)this).IsValid(value)) { return AcceptableValues[0]; } return value; } public override bool IsValid(object value) { if (value is T) { T e = (T)value; return AcceptableValues.Any((T x) => x.Equals(e)); } return false; } public override string ToDescriptionString() { return "# Acceptable values: " + string.Join(", ", AcceptableValues.Select((T x) => x.ToString()).ToArray()); } } public enum GreenDemonCaughtEffects { RANDOM, KILL, ZOMBIFY, FULL_INJURY, HALF_INJURY, FULL_POISON, HALF_POISON, FULL_SPORES, HALF_SPORES, CURSE, EPPY, NO_STAM, ASTORNAUT, EXPLODE, POISON_CLOUD, SPORE_CLOUD, FIRE_CLOUD, ICE_CLOUD, BIOME_CLOUD, TORNADO, DYNA_BRUH, MANDRAKE, SCORPION, BEES, SCOUTMASTER, BLINDS, FALL, BAD_SHROOMBERRY, NUMBS, FLING, GO_BACK, SLIP, W_KEY_STUCK, POOR_BOY, COOKED, NO_FLARE, SET_FIRE, FIREBALL, SPAWN_LUCKY_BLOCK, UNNAMIFY } public enum GreenDemonModes { NORMAL, HARD, VERY_HARD } public enum GreenDemonRandomTypes { CASUAL, STANDARD, HARDCORE } public enum GreenDemonSpeeds { SLOW, MEDIUM, FAST } public enum GreenDemonTrackerSettings { OFFSCREEN, ALWAYS, NEVER } } namespace GreenDemonChallenge.Compatibility { public static class LuckyBlocksCompatibilityHandler { private static bool? _enabled; public static bool Enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("legocool.LuckyBlocks"); GreenDemonChallenge.Log.LogInfo((object)("LuckyBlocks support is " + (_enabled.Value ? "enabled" : "disabled"))); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchLuckyBlocks(Harmony harmony) { Outcomes.AddOutcome((Action)SpawnDemon, 1, "Green Demon Spawn"); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SpawnDemon(LuckyBreakable lb, Collision coll) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) GreenDemonHandler.Instance.SpawnGreenDemon(((Component)lb).transform.position); } } public static class TimeThemeCompatibilityHandler { private static bool? _enabled; private static readonly Color TrackerArrowColorDay = new Color(139f / 159f, 0.8567384f, 0.7615007f, 1f); private static readonly Color TrackerArrowColorNight = new Color(0.6509804f, 32f / 85f, 64f / 85f, 1f); public static bool Enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.github.MiiMii1205.TimeTheme"); GreenDemonChallenge.Log.LogInfo((object)("TimeTheme support is " + (_enabled.Value ? "enabled" : "disabled"))); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Init() { TimeThemePlugin.OnThemeChanged = (Action)Delegate.Combine(TimeThemePlugin.OnThemeChanged, new Action(UpdateAllTrackers)); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void UpdateAllTrackers(bool isDay) { //IL_000a: 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_000f: 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_0043: Unknown result type (might be due to invalid IL or missing references) Color val = (isDay ? TrackerArrowColorDay : TrackerArrowColorNight); int i = 0; for (int count = GreenDemonTracker.AllTrackers.Count; i < count; i++) { GreenDemonTracker greenDemonTracker = GreenDemonTracker.AllTrackers[i]; if (greenDemonTracker.m_group.alpha > 0f) { DOTweenModuleUI.DOColor(greenDemonTracker.m_arrowImage, val, 0.25f); } else { ((Graphic)greenDemonTracker.m_arrowImage).color = val; } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void InitTracker(GreenDemonTracker tracker) { //IL_000e: 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_003f: 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) Color val = (TimeThemePlugin.IsDarkTheme ? TrackerArrowColorNight : TrackerArrowColorDay); if (tracker.m_group.alpha > 0f) { DOTweenModuleUI.DOColor(tracker.m_arrowImage, val, 0.25f); } else { ((Graphic)tracker.m_arrowImage).color = val; } } } public static class UnnamedCompatibilityHandler { private static bool? _enabled; public static bool Enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.github.MiiMii1205.UnnamedProducts"); GreenDemonChallenge.Log.LogInfo((object)("UnnamedProducts support is " + (_enabled.Value ? "enabled" : "disabled"))); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetCharacterOnFire(Character character) { //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) Bodypart head = character.refs.head; GameObject val = PhotonNetwork.Instantiate(((Object)StickyFireballController.FireballPrefab).name, ((Component)head.rig).transform.position, ((Component)head.rig).transform.rotation, (byte)0, (object[])null); StickyFireballController component = val.GetComponent(); component.StickTo(((Component)character.refs.head).gameObject); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SpawnFireball(Character character) { //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) GameObject val = default(GameObject); if (NetworkPrefabManager.TryGetNetworkPrefab("com.github.MiiMii1205.UnnamedProducts:AntifreezeExplosion", ref val)) { Object.Instantiate(val, character.Center, Quaternion.identity); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsUnnamed(Item it) { return UnnamedPlugin.IsUnnamed(((Component)it).gameObject); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void UnnamifyInventory(Character character) { //IL_0250: 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) int num = 0; Item currentItem = character.data.currentItem; if (GreenDemon.IsHoldingSomethingTemporary(character) && Object.op_Implicit((Object)(object)currentItem)) { if (IsGarbageBag(currentItem)) { num += UnnamifyGarbageBags(character.player.tempFullSlot.prefab, currentItem.data); } else if (UnnamedPlugin.HasUnnamedVariant(currentItem)) { ItemInstanceData data = currentItem.data; GameObject unnamedVariant = UnnamedPlugin.GetUnnamedVariant(currentItem); character.player.tempFullSlot.EmptyOut(); character.player.tempFullSlot.SetItem(unnamedVariant.GetComponent(), data); num++; } } if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { if (GreenDemon.IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)currentItem)) { Backpack val = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); BackpackData backpackData = default(BackpackData); BackpackVisuals backpackVisuals = default(BackpackVisuals); if (val != null && ((Item)val).data.TryGetDataEntry((DataEntryKey)7, ref backpackData) && ((Component)val).TryGetComponent(ref backpackVisuals)) { num += ChangeBackpackItems(backpackData, backpackVisuals); } } else if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren(true); BackpackData backpackData2 = default(BackpackData); if (componentInChildren != null && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref backpackData2)) { num += ChangeBackpackItems(backpackData2, componentInChildren); } } } for (int num2 = character.player.itemSlots.Length - 1; num2 >= 0; num2--) { ItemSlot itemSlot = character.player.GetItemSlot((byte)num2); if (!itemSlot.IsEmpty()) { if (IsGarbageBag(itemSlot.prefab)) { num += UnnamifyGarbageBags(itemSlot.prefab, itemSlot.data); } else if (GreenDemon.IsHoldingOutSlot(character, itemSlot) && Object.op_Implicit((Object)(object)currentItem)) { if (UnnamedPlugin.HasUnnamedVariant(currentItem)) { ItemInstanceData data2 = currentItem.data; GameObject unnamedVariant2 = UnnamedPlugin.GetUnnamedVariant(currentItem); character.player.EmptySlot(Optionable.Some((byte)num2)); itemSlot.SetItem(unnamedVariant2.GetComponent(), data2); num++; } } else if (UnnamedPlugin.HasUnnamedVariant(itemSlot.prefab)) { GameObject unnamedVariant3 = UnnamedPlugin.GetUnnamedVariant(itemSlot.prefab); itemSlot.prefab = unnamedVariant3.GetComponent(); num++; } } } character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Unnameified {num} item(s)."); } private static int ChangeBackpackItems(BackpackData backpackData, BackpackVisuals backpackVisuals) { int num = 0; for (int i = 0; i < backpackData.itemSlots.Length; i++) { if (!backpackData.itemSlots[i].IsEmpty()) { Item val = backpackVisuals.spawnedVisualItems[(byte)i]; if (IsGarbageBag(val)) { num += UnnamifyGarbageBags(backpackData.itemSlots[i].prefab, backpackData.itemSlots[i].data); } else if (UnnamedPlugin.HasUnnamedVariant(val)) { ItemInstanceData data = val.data; GameObject unnamedVariant = UnnamedPlugin.GetUnnamedVariant(val); backpackData.itemSlots[(byte)i].EmptyOut(); backpackVisuals.RefreshVisuals(); backpackData.itemSlots[(byte)i].SetItem(unnamedVariant.GetComponent(), data); num++; } } } return num; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RespawnFlares(Vector3 spawnPos, int amountToRespawn) { //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_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) Item val = default(Item); if (ItemDatabase.TryGetItem((ushort)32, ref val)) { for (int i = 0; i < amountToRespawn; i++) { Item val2 = (UnnamedPlugin.ShouldBeUnnamed ? UnnamedPlugin.GetUnnamedVariant(val).GetComponent() : val); PhotonNetwork.InstantiateItemRoom(((Object)((Component)val2).gameObject).name, spawnPos + Vector3.up * 0.09147437f * (float)i, Quaternion.identity); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RespawnUnnamedFlares(Vector3 spawnPos, int amountToRespawn) { //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_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) //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) Item val = default(Item); Item val2 = default(Item); if (ItemDatabase.TryGetItem((ushort)32, ref val) && UnnamedPlugin.GetUnnamedVariant(val).TryGetComponent(ref val2)) { for (int i = 0; i < amountToRespawn; i++) { PhotonNetwork.InstantiateItemRoom(((Object)((Component)val2).gameObject).name, spawnPos + Vector3.up * 0.09147437f * (float)i, Quaternion.identity); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RemoveFlairsFormGarbageBags(Item sPrefab, ItemInstanceData sData, ref int flareRemoved, ref int unnamedFlareRemoved) { UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (!((Component)sPrefab).TryGetComponent(ref val) || !sData.TryGetDataEntry((DataEntryKey)7, ref val2)) { return; } Flare val4 = default(Flare); UnnamedGarbageBagController val5 = default(UnnamedGarbageBagController); for (int i = 0; i < val2.itemSlots.Length; i++) { ItemSlot val3 = val2.itemSlots[i]; if (val3.IsEmpty()) { continue; } if (((Component)val3.prefab).TryGetComponent(ref val4)) { if (IsUnnamed(val3.prefab)) { unnamedFlareRemoved++; } else { flareRemoved++; } val3.EmptyOut(); } else if (((Component)val3.prefab).TryGetComponent(ref val5)) { RemoveFlairsFormGarbageBags(val3.prefab, val3.data, ref flareRemoved, ref unnamedFlareRemoved); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static int CookGarbageBags(Item sPrefab, ItemInstanceData sData, Item? bakcpackItem = null) { int num = 0; UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (((Component)sPrefab).TryGetComponent(ref val) && sData.TryGetDataEntry((DataEntryKey)7, ref val2)) { UnnamedGarbageBagController val4 = default(UnnamedGarbageBagController); IntItemData val5 = default(IntItemData); for (int i = 0; i < val2.itemSlots.Length; i++) { ItemSlot val3 = val2.itemSlots[i]; if (!val3.IsEmpty()) { if (((Component)val3.prefab).TryGetComponent(ref val4)) { num += CookGarbageBags(val3.prefab, val3.data); } if (val3.data.TryGetDataEntry((DataEntryKey)1, ref val5)) { IntItemData obj = val5; obj.Value++; num++; } num++; } } IntItemData val6 = default(IntItemData); if (Object.op_Implicit((Object)(object)bakcpackItem)) { bakcpackItem.cooking.FinishCooking(); num++; } else if (sData.TryGetDataEntry((DataEntryKey)1, ref val6)) { IntItemData obj2 = val6; obj2.Value++; num++; } } return num; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static int UnnamifyGarbageBags(Item sPrefab, ItemInstanceData sData) { int num = 0; UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (((Component)sPrefab).TryGetComponent(ref val) && sData.TryGetDataEntry((DataEntryKey)7, ref val2)) { UnnamedGarbageBagController val4 = default(UnnamedGarbageBagController); for (int i = 0; i < val2.itemSlots.Length; i++) { ItemSlot val3 = val2.itemSlots[i]; if (!val3.IsEmpty()) { if (((Component)val3.prefab).TryGetComponent(ref val4)) { num += UnnamifyGarbageBags(val3.prefab, val3.data); } else if (UnnamedPlugin.HasUnnamedVariant(val3.prefab)) { ItemInstanceData data = val3.data; GameObject unnamedVariant = UnnamedPlugin.GetUnnamedVariant(val3.prefab); val2.itemSlots[(byte)i].EmptyOut(); val2.itemSlots[(byte)i].SetItem(unnamedVariant.GetComponent(), data); num++; } } } } return num; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsGarbageBag(Item sPrefab) { UnnamedGarbageBagController val = default(UnnamedGarbageBagController); return ((Component)sPrefab).TryGetComponent(ref val); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool HasAnyFlares(Character character) { Flare val3 = default(Flare); if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { BackpackData val4 = default(BackpackData); if (GreenDemon.IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)character.data.currentItem)) { Backpack val = default(Backpack); if (((Component)character.data.currentItem).TryGetComponent(ref val)) { (byte, BackpackReference) value = ((Item)val).backpackReference.Value; ItemSlot[] itemSlots = ((BackpackReference)(ref value.Item2)).GetData().itemSlots; foreach (ItemSlot val2 in itemSlots) { if (!val2.IsEmpty() && (((Component)val2.prefab).TryGetComponent(ref val3) || CheckForFlareInGarbageBag(val2))) { return true; } } } } else if (character.player.backpackSlot.hasBackpack && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref val4)) { ItemSlot[] itemSlots2 = val4.itemSlots; foreach (ItemSlot val5 in itemSlots2) { if (!val5.IsEmpty() && (((Component)val5.prefab).TryGetComponent(ref val3) || CheckForFlareInGarbageBag(val5))) { return true; } } } } ItemSlot[] itemSlots3 = character.player.itemSlots; foreach (ItemSlot val6 in itemSlots3) { if (!val6.IsEmpty() && (((Component)val6.prefab).TryGetComponent(ref val3) || CheckForFlareInGarbageBag(val6))) { return true; } } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool CheckForFlareInGarbageBag(ItemSlot itemSlot) { UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (((Component)itemSlot.prefab).TryGetComponent(ref val) && itemSlot.data.TryGetDataEntry((DataEntryKey)7, ref val2)) { ItemSlot[] itemSlots = val2.itemSlots; Flare val4 = default(Flare); foreach (ItemSlot val3 in itemSlots) { if (!itemSlot.IsEmpty() && (((Component)val3.prefab).TryGetComponent(ref val4) || CheckForFlareInGarbageBag(val3))) { return true; } } } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TryTurnIntoUnnamed(ref Item item) { Item val = default(Item); if (UnnamedPlugin.HasUnnamedVariant(item) && UnnamedPlugin.ShouldBeUnnamed && UnnamedPlugin.GetUnnamedVariant(item).TryGetComponent(ref val)) { item = val; } } } } namespace GreenDemonChallenge.Behaviour { public class DestroyAfterEmit : MonoBehaviour { public ParticleSystem m_particle; private void Awake() { if (m_particle == null) { m_particle = ((Component)this).GetComponent(); } } private IEnumerator Start() { m_particle.Play(); yield return (object)new WaitUntil((Func)(() => !m_particle.IsAlive())); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class GreenDemon : MonoBehaviourPunCallbacks { public static List AllDemons = new List(); public SphereCollider collider; public float mass = 5f; public Rigidbody rig; public AudioSource source; public Transform m_demonTransform; public Renderer mainRenderer; public Animator animator; public float m_catchRadius = 1f; private float m_chaseTimeout; private float m_chaseUpdateCooldown = 3f; private readonly LayerMask m_characterLayerMask = LayerMask.op_Implicit(1024); private Character m_chasingCharacter; private float m_destroyTick; private bool m_inActiveChase; private bool m_isConsumed; private bool m_isShrinking; private const float MovementForce = 250f; public float m_stopTick; public Action? OnPlayerCaught; public Action? OnShrink; private PhysicsSyncer m_physSyncer; private float m_shrinkDuration = 1.25f; private double m_timeSinceTick; private PhotonView view; private bool m_isSpawning = true; public float vel; public SFX_Instance[] m_impact; public float velMult = 10f; public SFX_Instance[] consumedSfx = Array.Empty(); public SFX_Instance[] shrunkSfx = Array.Empty(); public GameObject? m_vfxPrefab; public GameObject? m_poofVfxPrefab; private Vector3 m_movement = Vector3.forward; private float m_minSpeedSqrDistance; private float m_maxSpeedSqrDistance; private Vector3 m_baseSpeed; private Vector3 m_kilnBaseSpeed; private float m_roomSpeedMultiplier; public GreenDemonDetector m_detector; public int m_demonIndex; public Vector3 Center { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (ClassExtensionsMethods.UnityObjectExists(mainRenderer)) { Bounds bounds = mainRenderer.bounds; return ((Bounds)(ref bounds)).center; } return ((Component)this).transform.position; } } public bool IsChasingLocalPlayer { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } private bool ShouldSearchForAnotherTarget { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (HasTarget) { return !m_chasingCharacter.IsLocal; } return true; } } private float ChaseDelay { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (m_demonIndex <= 0) { return 0f; } return (float)m_demonIndex * (GreenDemonChallenge.RoomGreenDemonDelay / 2f) + RandomDelayOffset; } } private static float RandomDelayOffset { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return Random.Range((0f - GreenDemonChallenge.RoomGreenDemonDelay) / 4f, GreenDemonChallenge.RoomGreenDemonDelay / 4f); } } public Vector3 TargetPosition { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //IL_0015: 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) Character chasingCharacter = m_chasingCharacter; if (chasingCharacter == null) { return GreenDemonHandler.Instance.GroupPosition; } return chasingCharacter.Center; } } private Vector3 BaseSpeed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //IL_0034: 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) if (Singleton.Instance.currentSegment != 3) { if (Singleton.Instance.currentSegment != 4 || GreenDemonHandler.Instance.m_reachedPeak) { return m_baseSpeed; } return m_kilnBaseSpeed; } return Vector3.one; } } private Vector3 MoveSpeed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //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_000c: 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_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_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 val = BaseSpeed + ExtDataTypes.ToVec(0); float minSpeedSqrDistance = m_minSpeedSqrDistance; float maxSpeedSqrDistance = m_maxSpeedSqrDistance; Vector3 val2 = TargetPosition - Center; return val * (Util.RangeLerp(0.5f, 1f, minSpeedSqrDistance, maxSpeedSqrDistance, ((Vector3)(ref val2)).sqrMagnitude, true, (AnimationCurve)null) * (250f * m_roomSpeedMultiplier)); } } public bool HasTarget { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return Object.op_Implicit((Object)(object)m_chasingCharacter); } } private void Awake() { if (view == null) { view = ((Component)this).GetComponent(); } AddPhysics(); if (m_physSyncer == null) { m_physSyncer = ((Component)this).GetComponent(); } if (animator == null) { animator = ((Component)this).GetComponent(); } if (source == null) { source = ((Component)this).GetComponent(); } if (mainRenderer == null) { mainRenderer = ((Component)this).GetComponent(); } if (m_demonTransform == null) { m_demonTransform = ((Component)mainRenderer).transform; } } private void Start() { //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_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) GreenDemonChallenge.Log.LogInfo((object)"SPAWN A GREEN DEMON!"); GreenDemonGUIManager.Instance.TheDemonIsHere(); source.volume = GreenDemonChallenge.GreenDemonVolume.Value; m_inActiveChase = true; AllDemons.Add(this); GreenDemonGUIManager.Instance.AddDemonTracker(this); m_minSpeedSqrDistance = Mathf.Pow(source.minDistance, 2f); m_maxSpeedSqrDistance = Mathf.Pow(source.maxDistance, 2f); m_baseSpeed = new Vector3(1f, 0.5f, 1f); m_kilnBaseSpeed = new Vector3(0.8f, 0.95f, 0.8f); m_roomSpeedMultiplier = GreenDemonChallenge.RoomGreenDemonSpeed switch { GreenDemonSpeeds.SLOW => 0.5f, GreenDemonSpeeds.MEDIUM => 1f, GreenDemonSpeeds.FAST => 2f, _ => throw new ArgumentOutOfRangeException(), }; ((MonoBehaviour)this).StartCoroutine(WaitForSpawnAnimationToFinish()); } private IEnumerator WaitForSpawnAnimationToFinish() { m_isSpawning = true; yield return (object)new WaitUntil((Func)(() => !PExt.IsPlaying(animator, "GreenDemonSpawn", 0))); yield return (object)new WaitForSecondsRealtime(GreenDemonChallenge.RoomGreenDemonDelay + ChaseDelay); m_isSpawning = false; source.Play(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void PlayImpactSound(Vector3 pos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) int i = 0; for (int num = m_impact.Length; i < num; i++) { m_impact[i].Play(pos); } } private void Update() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!m_isSpawning && !m_isConsumed) { UpdateChase(); } if (Object.op_Implicit((Object)(object)rig) && !rig.isKinematic) { vel = Mathf.Lerp(vel, Vector3.SqrMagnitude(rig.linearVelocity) * velMult, 10f * Time.deltaTime); } } private void FixedUpdate() { //IL_00ba: 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_00ca: 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_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) //IL_007e: 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_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_009b: 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_00fd: 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_010d: 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_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_0137: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0185: 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) if (m_isSpawning || !PhotonNetwork.InRoom || m_isConsumed) { return; } m_chaseTimeout += Time.fixedDeltaTime; if (m_stopTick > 0f) { m_stopTick -= Time.fixedDeltaTime; } else { if (!view.IsMine) { return; } if (HasTarget) { Vector3 val = TargetPosition - Center; Vector3 val2 = Vector3.Scale(((Vector3)(ref val)).normalized, MoveSpeed); rig.AddForce(val2 * Time.fixedDeltaTime, (ForceMode)5); m_movement = ((Vector3)(ref val2)).normalized; CheckForCaughtPlayers(); } Vector3 val3 = TargetPosition - Center; foreach (GreenDemon value in m_detector.m_demons.Values) { if (Object.op_Implicit((Object)(object)value)) { Vector3 val4 = value.Center - Center; Vector3 val5 = Vector3.Scale(((Vector3)(ref val4)).normalized, -MoveSpeed * Util.RangeLerp(Util.RangeLerp(0.125f, 0.75f, m_minSpeedSqrDistance, m_maxSpeedSqrDistance, Vector3.SqrMagnitude(val3), true, (AnimationCurve)null), 0f, 0f, m_detector.m_detectorRadius * m_detector.m_detectorRadius, Vector3.SqrMagnitude(val4), true, (AnimationCurve)null)); rig.AddForce(val5 * Time.fixedDeltaTime, (ForceMode)5); } } } } public void RefreshVolume() { source.volume = GreenDemonChallenge.GreenDemonVolume.Value; } private void OnDestroy() { AllDemons.Remove(this); } private void PlayImpactSounds(Collision collision) { //IL_0021: 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.op_Implicit((Object)(object)rig)) { if (vel > 4f && !ExtGameObject.IsInLayer(collision.gameObject, m_characterLayerMask)) { view.RPC("RPC_PlayImpactSFX", (RpcTarget)0, new object[1] { Center }); } vel = 0f; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private Vector3 CalculateCollisionForce(Collision col) { //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_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0086: 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_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_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_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_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_00bf: 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_002b: 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_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_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_005e: 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_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_0076: Unknown result type (might be due to invalid IL or missing references) Vector3 val = col.impulse; Vector3 normalized = ((Vector3)(ref val)).normalized; if (col.contactCount > 0) { Vector3 val2 = Vector3.zero; for (int num = col.contacts.Length - 1; num >= 0; num--) { val2 += ((ContactPoint)(ref col.contacts[num])).normal; } Vector3 val3 = normalized; val = Vector3.Lerp(normalized, ((Vector3)(ref val2)).normalized, 0.65f); normalized = val3 + Vector3.Scale(((Vector3)(ref val)).normalized, MoveSpeed); } else { normalized = Vector3.Scale(normalized, MoveSpeed); } Vector3 val4 = normalized; val = TargetPosition - Center; return val4 + Vector3.Scale(((Vector3)(ref val)).normalized, -MoveSpeed) * Time.fixedDeltaTime; } private void OnCollisionEnter(Collision col) { //IL_0056: 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) if (m_inActiveChase && ExtGameObject.IsInLayer(col.gameObject, m_characterLayerMask)) { Character componentInParent = col.gameObject.GetComponentInParent(); if (componentInParent != null && Object.op_Implicit((Object)(object)componentInParent) && componentInParent.IsLocal && TargetIsValid(componentInParent)) { CatchPlayer(Character.localCharacter); return; } } rig.AddForce(CalculateCollisionForce(col), (ForceMode)5); if (view.IsMine) { PlayImpactSounds(col); } } private void OnCollisionStay(Collision col) { //IL_0007: 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) if (!ExtGameObject.IsInLayer(col.gameObject, m_characterLayerMask)) { rig.AddForce(CalculateCollisionForce(col), (ForceMode)5); if (view.IsMine) { PlayImpactSounds(col); } } } private void AddPhysics() { if (rig == null) { rig = ExtGameObject.GetOrAddComponent(((Component)this).gameObject); } rig.mass = mass; rig.interpolation = (RigidbodyInterpolation)1; rig.collisionDetectionMode = (CollisionDetectionMode)2; if (collider == null) { collider = ((Component)this).GetComponent(); } m_catchRadius = collider.radius * 1.25f; } private void ForceSyncForFrames(int frames = 10) { if (Object.op_Implicit((Object)(object)m_physSyncer)) { m_physSyncer.forceSyncFrames = frames; } } public override void OnPlayerEnteredRoom(Player newPlayer) { ((MonoBehaviourPunCallbacks)this).OnPlayerEnteredRoom(newPlayer); if (view.IsMine) { ForceSyncForFrames(); view.RPC("UpdateNewChasingCharacter", newPlayer, new object[1] { m_chasingCharacter.view.ViewID }); } } [PunRPC] public void RequestUpdatePlayerChase(int viewId, float distSqr) { //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_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) Vector3 center = Center; Character val = default(Character); if (!HasTarget || (Character.GetCharacterWithPhotonID(viewId, ref val) && Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)m_chasingCharacter && TargetIsValid(val) && distSqr < Vector3.SqrMagnitude(m_chasingCharacter.Center - center))) { GreenDemonChallenge.Log.LogInfo((object)"Sending update for chase change"); view.RPC("UpdateNewChasingCharacter", (RpcTarget)0, new object[1] { viewId }); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool TargetIsValid(Character target) { if (!target.isBot && !target.data.dead && !target.data.fullyPassedOut) { return GreenDemonHandler.Instance.ShouldChaseCharacter(target); } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsHoldingSomethingTemporary(Character c) { if (!c.player.tempFullSlot.IsEmpty() && c.refs.items.currentSelectedSlot.IsSome) { return c.refs.items.currentSelectedSlot.Value == c.player.tempFullSlot.itemSlotID; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsHoldingBackpack(Character c) { if (!((ItemSlot)c.player.backpackSlot).IsEmpty() && c.refs.items.currentSelectedSlot.IsSome) { return c.refs.items.currentSelectedSlot.Value == ((ItemSlot)c.player.backpackSlot).itemSlotID; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsHoldingOutSlot(Character c, ItemSlot s) { if (!s.IsEmpty() && c.refs.items.currentSelectedSlot.IsSome) { return c.refs.items.currentSelectedSlot.Value == s.itemSlotID; } return false; } [PunRPC] public void UpdateNewChasingCharacter(int viewId) { Character val = default(Character); if (Character.GetCharacterWithPhotonID(viewId, ref val) && (Object)(object)m_chasingCharacter != (Object)(object)val) { m_chasingCharacter = val; GreenDemonChallenge.Log.LogInfo((object)$"New target: {val}!"); IsChasingLocalPlayer = m_chasingCharacter.IsLocal; m_chaseTimeout = 0f; if (view.IsMine && !object.Equals(val.view.Owner, view.Owner)) { GreenDemonChallenge.Log.LogInfo((object)$"Transferring ownership to {val.view.Owner}..."); view.TransferOwnership(val.view.Owner); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void CheckForCaughtPlayers() { //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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (m_inActiveChase && Object.op_Implicit((Object)(object)Character.localCharacter) && TargetIsValid(Character.localCharacter) && Vector3.SqrMagnitude(Character.localCharacter.Center - Center) <= m_catchRadius * m_catchRadius) { CatchPlayer(Character.localCharacter); } } private static void RemoveFlairFromBackpack(BackpackData backpackData, BackpackVisuals backpackVisuals, ref int flareRemoved, ref int unnamedFlareRemoved) { Flare val2 = default(Flare); for (int i = 0; i < backpackData.itemSlots.Length; i++) { if (backpackData.itemSlots[i].IsEmpty()) { continue; } Item val = backpackVisuals.spawnedVisualItems[(byte)i]; if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(backpackData.itemSlots[i].prefab)) { UnnamedCompatibilityHandler.RemoveFlairsFormGarbageBags(backpackData.itemSlots[i].prefab, backpackData.itemSlots[i].data, ref flareRemoved, ref unnamedFlareRemoved); } else if (((Component)val).TryGetComponent(ref val2)) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsUnnamed(val)) { unnamedFlareRemoved++; } else { flareRemoved++; } PhotonNetwork.Destroy(((Component)val).gameObject); backpackData.itemSlots[(byte)i].EmptyOut(); backpackVisuals.RefreshVisuals(); } } } private static int CookItemFromBackpack(BackpackData backpackData, BackpackVisuals backpackVisuals) { int num = 0; for (int i = 0; i < backpackData.itemSlots.Length; i++) { if (!backpackData.itemSlots[i].IsEmpty()) { Item val = backpackVisuals.spawnedVisualItems[(byte)i]; if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(backpackData.itemSlots[i].prefab)) { num += UnnamedCompatibilityHandler.CookGarbageBags(backpackData.itemSlots[i].prefab, backpackData.itemSlots[i].data, val); continue; } val.cooking.FinishCooking(); num++; } } return num; } private void ApplyEffect(Character character, GreenDemonCaughtEffects effect) { //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Expected O, but got Unknown //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: 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_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Expected O, but got Unknown //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Expected O, but got Unknown //IL_01f1: 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_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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0217: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_08e6: Unknown result type (might be due to invalid IL or missing references) GreenDemonChallenge.Log.LogInfo((object)$"Applying effect: {effect} to {character}..."); Vector3 val9; switch (effect) { case GreenDemonCaughtEffects.RANDOM: { GreenDemonCaughtEffects[] array = (GreenDemonCaughtEffects[])Enum.GetValues(typeof(GreenDemonCaughtEffects)); GreenDemonCaughtEffects random; do { random = ArrayExtensions.GetRandom(array); } while (!IsEffectRandoValid(character, random, GreenDemonChallenge.RoomGreenDemonRandomType)); ApplyEffect(character, random); break; } case GreenDemonCaughtEffects.KILL: character.DieInstantly(); break; case GreenDemonCaughtEffects.ZOMBIFY: if (!character.TryCheckpoint()) { character.view.RPC("RPCA_Zombify", (RpcTarget)0, new object[1] { character.Center }); } break; case GreenDemonCaughtEffects.FULL_INJURY: character.refs.afflictions.AddStatus((STATUSTYPE)0, 1f, false, true, true); break; case GreenDemonCaughtEffects.HALF_INJURY: character.refs.afflictions.AddStatus((STATUSTYPE)0, 0.5f, false, true, true); break; case GreenDemonCaughtEffects.FULL_POISON: character.refs.afflictions.AddStatus((STATUSTYPE)3, 1f, false, true, true); break; case GreenDemonCaughtEffects.HALF_POISON: character.refs.afflictions.AddStatus((STATUSTYPE)3, 0.5f, false, true, true); break; case GreenDemonCaughtEffects.FULL_SPORES: character.refs.afflictions.AddStatus((STATUSTYPE)10, 1f, false, true, true); break; case GreenDemonCaughtEffects.HALF_SPORES: character.refs.afflictions.AddStatus((STATUSTYPE)10, 0.5f, false, true, true); break; case GreenDemonCaughtEffects.CURSE: character.refs.afflictions.AddStatus((STATUSTYPE)5, 0.25f, false, true, true); break; case GreenDemonCaughtEffects.FLING: { Vector3 back = Vector3.back; val9 = Center - character.Center; val9 = back + ((Vector3)(ref val9)).normalized; character.AddForce(((Vector3)(ref val9)).normalized * 125f / Time.fixedDeltaTime, 1f, 1f); break; } case GreenDemonCaughtEffects.FALL: character.Fall(30f, 0f); break; case GreenDemonCaughtEffects.SCOUTMASTER: { Scoutmaster val6 = default(Scoutmaster); if (Scoutmaster.GetPrimaryScoutmaster(ref val6)) { val6.SetCurrentTarget(character, 60f); break; } GreenDemonChallenge.Log.LogWarning((object)"Can't call the SCOUTMASTER right now. Flinging you instead..."); ApplyEffect(character, GreenDemonCaughtEffects.FLING); break; } case GreenDemonCaughtEffects.POOR_BOY: { int itemRemoved = 0; RemoveTemporaryItem(character, ref itemRemoved); RemoveBackpack(character, ref itemRemoved); RemoveWholeInventory(character, ref itemRemoved); character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Removed {itemRemoved} item(s)."); break; } case GreenDemonCaughtEffects.NO_FLARE: { int flareRemoved = 0; int unnamedFlareRemoved = 0; RemoveTemporaryFlares(character, ref unnamedFlareRemoved, ref flareRemoved); RemoveFlaresFromBackpack(character, ref flareRemoved, ref unnamedFlareRemoved); RemoveFlaresFromInventory(character, ref flareRemoved, ref unnamedFlareRemoved); character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); int num = flareRemoved + unnamedFlareRemoved; GreenDemonChallenge.Log.LogInfo((object)$"Removed {num} flare(s)."); RespawnFlares(unnamedFlareRemoved, flareRemoved); break; } case GreenDemonCaughtEffects.COOKED: { int cookedItems = 0; CookTemporaryItem(character, ref cookedItems); CookBackpackItems(character, ref cookedItems); CookInventoryItems(character, ref cookedItems); character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Cooked {cookedItems} item(s)."); break; } case GreenDemonCaughtEffects.EPPY: character.refs.afflictions.AddStatus((STATUSTYPE)6, 1f, false, true, true); break; case GreenDemonCaughtEffects.POISON_CLOUD: ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_SpawnPoisonCloud", (RpcTarget)0, new object[1] { character.Center }); break; case GreenDemonCaughtEffects.ICE_CLOUD: ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_SpawnIceCloud", (RpcTarget)0, new object[1] { character.Center }); break; case GreenDemonCaughtEffects.FIRE_CLOUD: ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_SpawnFireCloud", (RpcTarget)0, new object[1] { character.Center }); break; case GreenDemonCaughtEffects.SPORE_CLOUD: ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_SpawnSporeCloud", (RpcTarget)0, new object[1] { character.Center }); break; case GreenDemonCaughtEffects.BLINDS: character.refs.afflictions.AddAffliction((Affliction)new Affliction_Blind { totalTime = 60f }, false); break; case GreenDemonCaughtEffects.NUMBS: character.refs.afflictions.AddAffliction((Affliction)new Affliction_Numb { totalTime = 60f }, false); break; case GreenDemonCaughtEffects.BIOME_CLOUD: SpawnBiomeCloud(character); break; case GreenDemonCaughtEffects.DYNA_BRUH: ForceGiveItem(character, 106, GreenDemonCaughtEffects.HALF_INJURY); break; case GreenDemonCaughtEffects.MANDRAKE: ForceGiveItem(character, 155, GreenDemonCaughtEffects.EPPY); break; case GreenDemonCaughtEffects.SCORPION: ForceGiveItem(character, 111, GreenDemonCaughtEffects.HALF_POISON); break; case GreenDemonCaughtEffects.BAD_SHROOMBERRY: character.refs.afflictions.AddStatus((STATUSTYPE)10, 0.05f, false, true, true); ((MonoBehaviour)character).StartCoroutine(DoRandomShroomberryEffect(character, IEnumerableExtensions.RandomElement((IEnumerable)Action_RandomMushroomEffect.BadEffects))); break; case GreenDemonCaughtEffects.EXPLODE: { GameObject val13 = PhotonNetwork.Instantiate("0_Items/Dynamite", character.Center, Quaternion.identity, (byte)0, (object[])null); Dynamite val14 = default(Dynamite); if (val13.TryGetComponent(ref val14)) { val14.LightFlare(); val14.startingFuseTime = 0f; } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find dynamite. Deleting spawned object and make you hurt instead"); PhotonNetwork.Destroy(val13); ApplyEffect(character, GreenDemonCaughtEffects.HALF_INJURY); } break; } case GreenDemonCaughtEffects.TORNADO: { GameObject val11 = PhotonNetwork.Instantiate("Tornado", character.Center, Quaternion.identity, (byte)0, (object[])null); Tornado val12 = default(Tornado); if (val11.TryGetComponent(ref val12)) { val12.tornadoLifetimeMax = 12f; val12.tornadoLifetimeMin = 20f; val12.force = 75f; val12.selectNewTargetInSeconds = 35f; val12.targetParent = ((Component)character.refs.hip).transform; val12.target = ((Component)character).transform; ((MonoBehaviour)GreenDemonHandler.Instance).StartCoroutine(GreenDemonHandler.ForceTornadoTarget(val12, ((Component)character).transform, val12.selectNewTargetInSeconds)); } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find tornado. Deleting spawned object and make you fling instead"); PhotonNetwork.Destroy(val11); ApplyEffect(character, GreenDemonCaughtEffects.FLING); } break; } case GreenDemonCaughtEffects.GO_BACK: if (!character.TryCheckpoint()) { character.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { MapHandler.CurrentBaseCampSpawnPoint.position, true }); } break; case GreenDemonCaughtEffects.SPAWN_LUCKY_BLOCK: if (LuckyBlocksCompatibilityHandler.Enabled) { GameObject val7 = PhotonNetwork.Instantiate("0_Items/legocool.LuckyBlocks:LuckyBlock", ((Component)character.refs.head).transform.position + Vector3.up * 1.85f, Quaternion.identity, (byte)0, (object[])null); Item val8 = default(Item); if (val7.TryGetComponent(ref val8)) { val8.lastThrownCharacter = character; val9 = ((Component)character.refs.head).transform.position - ((Component)val8).transform.position; Vector3 val10 = ((Vector3)(ref val9)).normalized * 25f / Time.deltaTime; val8.rig.AddForce(val10, (ForceMode)5); } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find item component. Deleting spawned object and give you a RANDOM effect instead."); PhotonNetwork.Destroy(val7); ApplyEffect(character, GreenDemonCaughtEffects.RANDOM); } } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find Lucky Blocks... Giving you a RANDOM effect instead."); ApplyEffect(character, GreenDemonCaughtEffects.RANDOM); } break; case GreenDemonCaughtEffects.UNNAMIFY: if (UnnamedCompatibilityHandler.Enabled) { UnnamedCompatibilityHandler.UnnamifyInventory(character); break; } GreenDemonChallenge.Log.LogWarning((object)"Can't find Unnamed Products... Giving you a RANDOM effect instead."); ApplyEffect(character, GreenDemonCaughtEffects.RANDOM); break; case GreenDemonCaughtEffects.SET_FIRE: if (UnnamedCompatibilityHandler.Enabled) { UnnamedCompatibilityHandler.SetCharacterOnFire(character); break; } GreenDemonChallenge.Log.LogWarning((object)"Can't find Unnamed Products... Giving you a FIRE CLOUD effect instead."); ApplyEffect(character, GreenDemonCaughtEffects.FIRE_CLOUD); break; case GreenDemonCaughtEffects.FIREBALL: if (UnnamedCompatibilityHandler.Enabled) { ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_ThrowFireball", (RpcTarget)2, new object[1] { character.view.ViewID }); } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find Unnamed Products... Giving you a FIRE CLOUD effect instead."); ApplyEffect(character, GreenDemonCaughtEffects.FIRE_CLOUD); } break; case GreenDemonCaughtEffects.BEES: { GameObject val4 = PhotonNetwork.Instantiate("BeeSwarm", character.Head, Quaternion.identity, (byte)0, (object[])null); BeeSwarm val5 = default(BeeSwarm); if (val4.TryGetComponent(ref val5)) { ((MonoBehaviourPun)val5).photonView.RPC("SetBeesAngryRPC", (RpcTarget)0, new object[1] { true }); } else { GreenDemonChallenge.Log.LogWarning((object)"Can't find bees. Deleting spawned object and give you a HALF_POISON effect instead."); PhotonNetwork.Destroy(val4); ApplyEffect(character, GreenDemonCaughtEffects.HALF_POISON); } break; } case GreenDemonCaughtEffects.SLIP: { BananaPeel obj = Object.FindAnyObjectByType(); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); GameObject val2 = val ?? PhotonNetwork.InstantiateItem("Berrynana Peel Pink Variant", character.Head, Quaternion.identity); PhotonView val3 = default(PhotonView); if (val2.TryGetComponent(ref val3)) { val3.RPC("RPCA_TriggerBanana", (RpcTarget)0, new object[1] { character.view.ViewID }); break; } GreenDemonChallenge.Log.LogWarning((object)"Can't find berrynana peel. Make you FALL instead."); if (!Object.op_Implicit((Object)(object)val)) { GreenDemonChallenge.Log.LogWarning((object)"Destroying the spawned peel."); PhotonNetwork.Destroy(val2); } ApplyEffect(character, GreenDemonCaughtEffects.FALL); break; } case GreenDemonCaughtEffects.NO_STAM: character.UseStamina(1f, false); ((MonoBehaviour)GreenDemonHandler.Instance).StartCoroutine(GreenDemonHandler.KeepStamEmpty(character, 60f)); break; case GreenDemonCaughtEffects.W_KEY_STUCK: ((MonoBehaviour)GreenDemonHandler.Instance).StartCoroutine(GreenDemonHandler.StickWFor(60f)); break; case GreenDemonCaughtEffects.ASTORNAUT: character.refs.afflictions.AddAffliction((Affliction)new Affliction_LowGravity { lowGravAmount = 10, warning = false, totalTime = 15f }, false); character.view.RPC("JumpRpc", (RpcTarget)0, new object[1] { false }); break; default: throw new ArgumentOutOfRangeException("RoomGreenDemonCaughtEffect"); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveWholeInventory(Character character, ref int itemRemoved) { //IL_0083: 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) for (int num = character.player.itemSlots.Length - 1; num >= 0; num--) { ItemSlot itemSlot = character.player.GetItemSlot((byte)num); if (itemSlot.IsEmpty()) { continue; } if (IsHoldingOutSlot(character, itemSlot)) { Item currentItem = character.data.currentItem; if (currentItem != null) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); PhotonNetwork.Destroy(((Component)character.data.currentItem).gameObject); itemRemoved++; continue; } } character.player.EmptySlot(Optionable.Some((byte)num)); itemRemoved++; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveBackpack(Character character, ref int itemRemoved) { //IL_00e0: 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 (((ItemSlot)character.player.backpackSlot).IsEmpty()) { return; } if (IsHoldingBackpack(character)) { Item currentItem = character.data.currentItem; if (currentItem != null) { Backpack val = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); BackpackData val2 = default(BackpackData); if (val != null && ((Item)val).data.TryGetDataEntry((DataEntryKey)7, ref val2)) { itemRemoved += val2.FilledSlotCount(); itemRemoved++; character.player.EmptySlot(Optionable.Some(((ItemSlot)character.player.backpackSlot).itemSlotID)); PhotonNetwork.Destroy(((Component)character.data.currentItem).gameObject); } return; } } BackpackData val3 = default(BackpackData); if (character.player.backpackSlot.hasBackpack && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref val3)) { itemRemoved += val3.FilledSlotCount(); character.player.EmptySlot(Optionable.Some(((ItemSlot)character.player.backpackSlot).itemSlotID)); itemRemoved++; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveTemporaryItem(Character character, ref int itemRemoved) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (IsHoldingSomethingTemporary(character)) { Item currentItem = character.data.currentItem; if (currentItem != null) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); PhotonNetwork.Destroy(((Component)currentItem).gameObject); itemRemoved++; } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void CookInventoryItems(Character character, ref int cookedItems) { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) IntItemData val = default(IntItemData); for (int num = character.player.itemSlots.Length - 1; num >= 0; num--) { ItemSlot itemSlot = character.player.GetItemSlot((byte)num); if (itemSlot.IsEmpty()) { continue; } if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot.prefab)) { cookedItems += UnnamedCompatibilityHandler.CookGarbageBags(itemSlot.prefab, itemSlot.data); } else { if (IsHoldingOutSlot(character, itemSlot)) { Item currentItem = character.data.currentItem; if (currentItem != null) { currentItem.cooking.FinishCooking(); cookedItems++; goto IL_00aa; } } if (itemSlot.data.TryGetDataEntry((DataEntryKey)1, ref val)) { IntItemData obj = val; obj.Value++; } cookedItems++; } goto IL_00aa; IL_00aa: if ((Object.op_Implicit((Object)(object)itemSlot.prefab.cooking) && itemSlot.prefab.cooking.hasExplosion && itemSlot.prefab.cooking.additionalCookingBehaviors.Any((AdditionalCookingBehavior cb) => cb is CookingBehavior_Explode)) || (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot.prefab))) { GreenDemonChallenge.Log.LogInfo((object)$"{((Component)itemSlot.prefab).gameObject} has special interaction when being cooked! Automatically dropping cooked {((Component)itemSlot.prefab).gameObject}..."); ((MonoBehaviourPun)character).photonView.RPC("DropItemFromSlotRPC", (RpcTarget)0, new object[2] { itemSlot.itemSlotID, character.Center + character.data.lookDirection }); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void CookBackpackItems(Character character, ref int cookedItems) { if (((ItemSlot)character.player.backpackSlot).IsEmpty()) { return; } if (IsHoldingBackpack(character)) { Item currentItem = character.data.currentItem; if (currentItem != null) { Backpack val = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); BackpackData backpackData = default(BackpackData); BackpackVisuals backpackVisuals = default(BackpackVisuals); if (val != null && ((Item)val).data.TryGetDataEntry((DataEntryKey)7, ref backpackData) && ((Component)val).TryGetComponent(ref backpackVisuals)) { cookedItems += CookItemFromBackpack(backpackData, backpackVisuals); } currentItem.cooking.FinishCooking(); return; } } if (!character.player.backpackSlot.hasBackpack) { return; } BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren(true); BackpackData backpackData2 = default(BackpackData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref backpackData2)) { cookedItems += CookItemFromBackpack(backpackData2, componentInChildren); } IntItemData val2 = default(IntItemData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)1, ref val2)) { IntItemData obj = val2; obj.Value++; cookedItems++; BackpackOnBackVisuals val3 = (BackpackOnBackVisuals)(object)((componentInChildren is BackpackOnBackVisuals) ? componentInChildren : null); if (val3 != null) { val3.RefreshCooking(); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void CookTemporaryItem(Character character, ref int cookedItems) { if (!IsHoldingSomethingTemporary(character)) { return; } Item currentItem = character.data.currentItem; if (currentItem != null) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(character.player.tempFullSlot.prefab)) { cookedItems += UnnamedCompatibilityHandler.CookGarbageBags(character.player.tempFullSlot.prefab, character.player.tempFullSlot.data); return; } currentItem.cooking.FinishCooking(); cookedItems++; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveFlaresFromInventory(Character character, ref int flareRemoved, ref int unnamedFlareRemoved) { //IL_00ef: 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) Flare val = default(Flare); for (int num = character.player.itemSlots.Length - 1; num >= 0; num--) { ItemSlot itemSlot = character.player.GetItemSlot((byte)num); if (itemSlot.IsEmpty()) { continue; } if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot.prefab)) { UnnamedCompatibilityHandler.RemoveFlairsFormGarbageBags(itemSlot.prefab, itemSlot.data, ref flareRemoved, ref unnamedFlareRemoved); continue; } if (IsHoldingOutSlot(character, itemSlot)) { Item currentItem = character.data.currentItem; if (currentItem != null) { if (((Component)currentItem).TryGetComponent(ref val)) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsUnnamed(currentItem)) { unnamedFlareRemoved++; } else { flareRemoved++; } character.player.EmptySlot(character.refs.items.currentSelectedSlot); } continue; } } if (((Component)itemSlot.prefab).TryGetComponent(ref val)) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsUnnamed(itemSlot.prefab)) { unnamedFlareRemoved++; } else { flareRemoved++; } character.player.EmptySlot(Optionable.Some((byte)num)); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveFlaresFromBackpack(Character character, ref int flareRemoved, ref int unnamedFlareRemoved) { if (((ItemSlot)character.player.backpackSlot).IsEmpty()) { return; } if (IsHoldingBackpack(character)) { Item currentItem = character.data.currentItem; if (currentItem != null) { Backpack val = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); BackpackData backpackData = default(BackpackData); BackpackVisuals backpackVisuals = default(BackpackVisuals); if (val != null && ((Item)val).data.TryGetDataEntry((DataEntryKey)7, ref backpackData) && ((Component)val).TryGetComponent(ref backpackVisuals)) { RemoveFlairFromBackpack(backpackData, backpackVisuals, ref flareRemoved, ref unnamedFlareRemoved); } return; } } if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren(true); BackpackData backpackData2 = default(BackpackData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref backpackData2)) { RemoveFlairFromBackpack(backpackData2, componentInChildren, ref flareRemoved, ref unnamedFlareRemoved); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RemoveTemporaryFlares(Character character, ref int unnamedFlareRemoved, ref int flareRemoved) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!IsHoldingSomethingTemporary(character)) { return; } Item currentItem = character.data.currentItem; if (currentItem == null) { return; } Flare val = default(Flare); if (((Component)currentItem).TryGetComponent(ref val)) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsUnnamed(currentItem)) { unnamedFlareRemoved++; } else { flareRemoved++; } character.player.EmptySlot(character.refs.items.currentSelectedSlot); } else if (UnnamedCompatibilityHandler.Enabled) { UnnamedCompatibilityHandler.RemoveFlairsFormGarbageBags(character.player.tempFullSlot.prefab, currentItem.data, ref flareRemoved, ref unnamedFlareRemoved); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RespawnFlares(int unnamedFlareRemoved, int flareRemoved) { //IL_000e: 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_006e: Unknown result type (might be due to invalid IL or missing references) if (flareRemoved + unnamedFlareRemoved <= 0 || (int)Singleton.Instance.GetCurrentSegment() != 0) { return; } SingleItemSpawner[] componentsInChildren = MapHandler.CurrentMapSegment.segmentParent.GetComponentsInChildren(true); SingleItemSpawner[] array = componentsInChildren; Flare val2 = default(Flare); foreach (SingleItemSpawner val in array) { if (val.prefab.TryGetComponent(ref val2)) { if (UnnamedCompatibilityHandler.Enabled && unnamedFlareRemoved > 0) { ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_RespawnUnnamedFlares", (RpcTarget)0, new object[2] { ((Component)val).transform.position, unnamedFlareRemoved }); } if (flareRemoved > 0) { ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_RespawnFlares", (RpcTarget)0, new object[2] { ((Component)val).transform.position, flareRemoved }); } break; } } } private void ForceGiveItem(Character character, ushort itemId, GreenDemonCaughtEffects fallback) { Item item = default(Item); if (ItemDatabase.TryGetItem(itemId, ref item)) { if (UnnamedCompatibilityHandler.Enabled) { UnnamedCompatibilityHandler.TryTurnIntoUnnamed(ref item); } GameUtils.instance.InstantiateAndGrab(item, character, 0); } else { GreenDemonChallenge.Log.LogWarning((object)$"Can't find item... Falling back to {fallback}"); ApplyEffect(character, fallback); } } private void SpawnBiomeCloud(Character character) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected I4, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) BiomeType biome = MapHandler.CurrentMapSegment._biome; switch ((int)biome) { case 0: if (Ascents.isNightCold && !Mathf.Approximately(DayNightManager.instance.isDay, 1f)) { ApplyEffect(character, GreenDemonCaughtEffects.ICE_CLOUD); } else { ApplyEffect(character, GreenDemonCaughtEffects.POISON_CLOUD); } break; case 1: ApplyEffect(character, GreenDemonCaughtEffects.POISON_CLOUD); break; case 2: ApplyEffect(character, GreenDemonCaughtEffects.ICE_CLOUD); break; case 3: ApplyEffect(character, GreenDemonCaughtEffects.FIRE_CLOUD); break; case 5: ApplyEffect(character, GreenDemonCaughtEffects.FIRE_CLOUD); break; case 6: ApplyEffect(character, GreenDemonCaughtEffects.FIRE_CLOUD); break; case 7: ApplyEffect(character, GreenDemonCaughtEffects.SPORE_CLOUD); break; default: GreenDemonChallenge.Log.LogWarning((object)$"Unknown biome type {MapHandler.CurrentMapSegment.biome}. Defaulting to poison clouds..."); ApplyEffect(character, GreenDemonCaughtEffects.POISON_CLOUD); break; } } public static bool AllowsCasuals(GreenDemonRandomTypes rand) { return rand < GreenDemonRandomTypes.HARDCORE; } public static bool AllowsHardcores(GreenDemonRandomTypes rand) { return rand > GreenDemonRandomTypes.CASUAL; } private static bool IsEffectRandoValid(Character c, GreenDemonCaughtEffects eff, GreenDemonRandomTypes rand = GreenDemonRandomTypes.STANDARD) { return eff switch { GreenDemonCaughtEffects.RANDOM => false, GreenDemonCaughtEffects.BAD_SHROOMBERRY => AllowsCasuals(rand) && !c.data.isSkeleton, GreenDemonCaughtEffects.FULL_POISON => AllowsHardcores(rand) && !c.data.isSkeleton, GreenDemonCaughtEffects.HALF_POISON => AllowsCasuals(rand) && !c.data.isSkeleton, GreenDemonCaughtEffects.FULL_SPORES => AllowsHardcores(rand) && !c.data.isSkeleton, GreenDemonCaughtEffects.HALF_SPORES => AllowsCasuals(rand) && !c.data.isSkeleton, GreenDemonCaughtEffects.EPPY => !c.data.isSkeleton, GreenDemonCaughtEffects.BEES => AllowsCasuals(rand) && !c.data.isSkeleton && (!RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)1300, false) >= 1), GreenDemonCaughtEffects.SCORPION => AllowsCasuals(rand) && !c.data.isSkeleton && (!RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2125, false) >= 1), GreenDemonCaughtEffects.SET_FIRE => UnnamedCompatibilityHandler.Enabled && !c.data.isSkeleton, GreenDemonCaughtEffects.FIREBALL => AllowsHardcores(rand) && UnnamedCompatibilityHandler.Enabled, GreenDemonCaughtEffects.UNNAMIFY => AllowsHardcores(rand) && UnnamedCompatibilityHandler.Enabled, GreenDemonCaughtEffects.SPAWN_LUCKY_BLOCK => AllowsCasuals(rand) && LuckyBlocksCompatibilityHandler.Enabled, GreenDemonCaughtEffects.NO_FLARE => AllowsHardcores(rand) && !Ascents.shouldSpawnFlare && IsAFlareBearer(c), GreenDemonCaughtEffects.SCOUTMASTER => RunSettings.IsCustomRun ? (RunSettings.GetValue((SETTINGTYPE)2700, false) >= 1) : (Ascents.currentAscent < 0), GreenDemonCaughtEffects.ZOMBIFY => AllowsHardcores(rand) && Ascents.shouldSpawnZombie, GreenDemonCaughtEffects.TORNADO => !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2100, false) >= 1, GreenDemonCaughtEffects.MANDRAKE => !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2600, false) >= 1, GreenDemonCaughtEffects.DYNA_BRUH => !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2300, false) >= 1, GreenDemonCaughtEffects.KILL => AllowsHardcores(rand), GreenDemonCaughtEffects.FLING => AllowsHardcores(rand), GreenDemonCaughtEffects.POOR_BOY => AllowsHardcores(rand), GreenDemonCaughtEffects.FULL_INJURY => AllowsHardcores(rand), GreenDemonCaughtEffects.HALF_INJURY => c.data.isSkeleton ? AllowsHardcores(rand) : AllowsCasuals(rand), GreenDemonCaughtEffects.CURSE => AllowsCasuals(rand), GreenDemonCaughtEffects.EXPLODE => AllowsHardcores(rand), GreenDemonCaughtEffects.POISON_CLOUD => AllowsCasuals(rand), GreenDemonCaughtEffects.SPORE_CLOUD => AllowsCasuals(rand), GreenDemonCaughtEffects.FIRE_CLOUD => AllowsCasuals(rand), GreenDemonCaughtEffects.ICE_CLOUD => AllowsCasuals(rand), GreenDemonCaughtEffects.BIOME_CLOUD => AllowsCasuals(rand), GreenDemonCaughtEffects.BLINDS => AllowsCasuals(rand), GreenDemonCaughtEffects.FALL => AllowsCasuals(rand), GreenDemonCaughtEffects.NUMBS => AllowsCasuals(rand), GreenDemonCaughtEffects.GO_BACK => true, GreenDemonCaughtEffects.SLIP => AllowsCasuals(rand), GreenDemonCaughtEffects.W_KEY_STUCK => AllowsCasuals(rand), GreenDemonCaughtEffects.COOKED => true, GreenDemonCaughtEffects.NO_STAM => true, GreenDemonCaughtEffects.ASTORNAUT => AllowsHardcores(rand), _ => true, }; } private static bool IsAFlareBearer(Character character) { if (!UnnamedCompatibilityHandler.Enabled) { if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { BackpackData val3 = default(BackpackData); if (IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)character.data.currentItem)) { Item currentItem = character.data.currentItem; Backpack val = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); if (val != null) { (byte, BackpackReference) value = ((Item)val).backpackReference.Value; ItemSlot[] itemSlots = ((BackpackReference)(ref value.Item2)).GetData().itemSlots; foreach (ItemSlot val2 in itemSlots) { if (!val2.IsEmpty() && val2.prefab.itemID == 32) { return true; } } } } else if (character.player.backpackSlot.hasBackpack && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref val3)) { ItemSlot[] itemSlots2 = val3.itemSlots; foreach (ItemSlot val4 in itemSlots2) { if (!val4.IsEmpty() && val4.prefab.itemID == 32) { return true; } } } } return character.player.HasInAnySlot((ushort)32); } return UnnamedCompatibilityHandler.HasAnyFlares(character); } private IEnumerator DoRandomShroomberryEffect(Character character, int effect) { switch (effect) { case 5: yield return (object)new WaitForSeconds(5f); GameUtils.instance.SpawnResourceAtPositionNetworked("VFX_SporeExploExploEdibleSpawn", character.Center, (RpcTarget)1); GameUtils.instance.RPC_SpawnResourceAtPosition("VFX_SporeExploExploEdibleSpawn_NoKnockback", character.Center); character.AddForceToBodyPart(character.GetBodypartRig((BodypartType)0), Vector3.zero, Vector3.up * 100f); break; case 6: yield return (object)new WaitForSeconds(3f); character.refs.afflictions.AddAffliction((Affliction)new Affliction_Blind { totalTime = 60f }, false); break; case 7: yield return (object)new WaitForSeconds(3f); character.Fall(8f, 0f); break; case 8: character.refs.afflictions.AdjustStatus((STATUSTYPE)10, 0.25f, false); break; case 9: yield return (object)new WaitForSeconds(3f); character.refs.afflictions.AddAffliction((Affliction)new Affliction_Numb { totalTime = 60f }, false); break; default: character.refs.afflictions.AdjustStatus((STATUSTYPE)10, 0.25f, false); break; } } private void CatchPlayer(Character character) { if (!m_isConsumed) { GreenDemonChallenge.Log.LogInfo((object)$"Catching {character}!"); ApplyEffect(character, GreenDemonChallenge.RoomGreenDemonCaughtEffect); m_isConsumed = true; view.RPC("RPC_ConsumeDemon", (RpcTarget)0, Array.Empty()); } } [PunRPC] public void RPC_ConsumeDemon() { //IL_002e: 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) m_isConsumed = true; OnPlayerCaught?.Invoke(); SFX_Instance[] array = consumedSfx; foreach (SFX_Instance val in array) { val.Play(((Component)this).transform.position); } if (Object.op_Implicit((Object)(object)m_vfxPrefab)) { Object.Instantiate(m_vfxPrefab, ((Component)this).transform.position, Quaternion.identity); } if (view.IsMine) { PhotonNetwork.Destroy(((Component)this).gameObject); } } [PunRPC] private void RPC_PlayImpactSFX(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) PlayImpactSound(position); } private void UpdateChase() { //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_00bf: 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_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_0042: Unknown result type (might be due to invalid IL or missing references) if (m_chaseTimeout > m_chaseUpdateCooldown) { if ((!HasTarget || !m_chasingCharacter.IsLocal) && TargetIsValid(Character.localCharacter)) { float num = Vector3.SqrMagnitude(Character.localCharacter.Center - Center); GreenDemonChallenge.Log.LogInfo((object)"Sending request for chase target change"); view.RPC("RequestUpdatePlayerChase", view.Owner, new object[2] { Character.localCharacter.view.ViewID, num }); } m_chaseTimeout = 0f; } m_demonTransform.rotation = Quaternion.RotateTowards(m_demonTransform.rotation, Quaternion.LookRotation(m_movement), 30f * Time.deltaTime); } [PunRPC] public void RPC_StartShrinking() { if (!m_isShrinking) { ((MonoBehaviour)GameUtils.instance).StartCoroutine(Shrink()); } } [PunRPC] public void RPC_StopDemon(float time) { m_stopTick = time; } private IEnumerator Shrink() { m_inActiveChase = false; m_isShrinking = true; OnShrink?.Invoke(); float currentTime = 0f; Vector3 originalScale = ((Component)this).transform.localScale; float originalVolume = source.volume; float originalPitch = source.pitch; while (currentTime < m_shrinkDuration) { currentTime += Time.deltaTime; ((Component)this).transform.localScale = Vector3.Lerp(originalScale, Vector3.zero, currentTime / m_shrinkDuration); source.volume = Mathf.Lerp(originalVolume, 0f, currentTime / m_shrinkDuration); source.pitch = Mathf.Lerp(originalPitch, 0f, currentTime / m_shrinkDuration); yield return null; } SFX_Instance[] array = shrunkSfx; foreach (SFX_Instance val in array) { val.Play(((Component)this).transform.position); } if (Object.op_Implicit((Object)(object)m_poofVfxPrefab)) { Object.Instantiate(m_poofVfxPrefab, ((Component)this).transform.position, Quaternion.identity); } PhotonNetwork.Destroy(((Component)this).gameObject); } } public class GreenDemonDetector : MonoBehaviour { public Dictionary m_demons = new Dictionary(); public int selfID; public float m_detectorRadius; private void Start() { selfID = ((Object)this).GetInstanceID(); } private void OnTriggerEnter(Collider other) { GreenDemon value = default(GreenDemon); if (!other.isTrigger && selfID != ((Object)other).GetInstanceID() && ((Component)other).gameObject.TryGetComponent(ref value)) { m_demons[((Object)other).GetInstanceID()] = value; } } private void OnTriggerExit(Collider other) { if (!other.isTrigger) { m_demons.Remove(((Object)other).GetInstanceID()); } } } public class GreenDemonGUIManager : MonoBehaviour { public static GreenDemonGUIManager Instance; public GameObject demonIsHere; public GameObject trackerScreen; public RectTransform trackerScreenTransform; public Vector2 m_scaleReferences; private void Awake() { //IL_0067: 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_00a0: 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_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) Instance = this; ResetDemonIsHere(); trackerScreen = Object.Instantiate(GUIManager.instance.heroObject, GUIManager.instance.heroObject.transform.parent, true); ((Object)trackerScreen).name = "GreenDemonTrackers"; trackerScreenTransform = trackerScreen.GetComponent(); trackerScreenTransform.anchoredPosition = new Vector2(0f, 100f); trackerScreenTransform.sizeDelta = new Vector2(0f, -200f); ((Transform)trackerScreenTransform).localPosition = new Vector3(0f, 100f, 0f); UiExtensions.DestroyChildren(trackerScreen.transform); trackerScreen.SetActive(true); CanvasScaler componentInParent = trackerScreen.GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { m_scaleReferences = componentInParent.referenceResolution / new Vector2((float)Screen.width, (float)Screen.height); } } public void TheDemonIsHere() { demonIsHere.SetActive(true); ((MonoBehaviour)this).StartCoroutine(DemonSpawnRoutine()); } private IEnumerator DemonSpawnRoutine() { yield return (object)new WaitForSeconds(4f); demonIsHere.SetActive(false); ResetDemonIsHere(); } private void ResetDemonIsHere() { if (Object.op_Implicit((Object)(object)demonIsHere)) { Object.Destroy((Object)(object)demonIsHere); } demonIsHere = Object.Instantiate(GreenDemonChallenge.TheDemonIsHerePrefab, GUIManager.instance.lavaRises.transform.parent, false); } public void AddDemonTracker(GreenDemon greenDemon) { GameObject val = Object.Instantiate(GreenDemonChallenge.TrackerPrefab, trackerScreen.transform, false); GreenDemonTracker orAddComponent = ExtGameObject.GetOrAddComponent(val); orAddComponent.Demon = greenDemon; } } public class GreenDemonHandler : MonoBehaviourPunCallbacks { private const float CalderaBuffTime = 120f; public static GreenDemonHandler Instance; private Transform m_peakEndTransform; private Vector3 m_peakCrowStartPos; private Vector3 m_peakSpawnPoint; private Vector3 m_kilnSpawnPoint; private Vector3 m_calderaSpawnPoint; private Transform m_kilnBridgeTransform; private Bounds m_tombBounds; private Coroutine? m_demonSpawnCoroutine; private Coroutine? m_peakCheckCoroutine; private bool m_spawnIsDone; private HashSet m_playersEnteredTomb = new HashSet(); private bool m_isTombOpened; internal bool m_reachedPeak; private int m_currentProgressPointIndex; private int m_previousProgressPoint; private int m_nextProgressPointIndex; private float m_calderBuffsStartTime; private float m_calderBuffsEndTime; private static bool WKeyIsStuck; public Vector3 GroupPosition { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public bool RunHasStarted { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public float CurrentCrowCompletion { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public bool HasCalderaBuffs { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public float CurrentClimbCompletion { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; [MethodImpl(MethodImplOptions.AggressiveInlining)] private set; } public int CurrentProgressPoint { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return m_currentProgressPointIndex; } } public bool WaitingToSpawn { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (m_demonSpawnCoroutine != null) { return !m_spawnIsDone; } return false; } } public bool HasSpawned { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return m_spawnIsDone; } } public static bool IsWKeyStuck { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return WKeyIsStuck; } } private IEnumerator Start() { RunHasStarted = false; while (!PhotonNetwork.InRoom || !Object.op_Implicit((Object)(object)Character.localCharacter) || LoadingScreenHandler.loading || (Object)(object)Singleton.Instance == (Object)null) { yield return (object)new WaitUntil((Func)(() => (Object)(object)Singleton.Instance != (Object)null)); } GreenDemonChallenge.Log.LogInfo((object)"RUN REALLY STARTED!"); StartRun(); yield return (object)new WaitForSeconds(2f); m_peakEndTransform = ((Component)Singleton.Instance).transform.Find("Box"); m_kilnBridgeTransform = Singleton.Instance.segments[4].segmentParent.transform.Find("Bridge"); m_peakCrowStartPos = new Vector3(m_kilnBridgeTransform.position.x, Singleton.Instance.progressPoints[^1].transform.position.y, m_kilnBridgeTransform.position.z); Transform val = ((Component)Singleton.Instance).transform.Find("Bridge"); m_peakSpawnPoint = new Vector3(val.position.x, m_peakCrowStartPos.y, Singleton.Instance.progressPoints[^1].transform.position.z); m_kilnSpawnPoint = new Vector3(m_kilnBridgeTransform.position.x, m_kilnBridgeTransform.position.y + 49.57996f, m_kilnBridgeTransform.position.z); Transform reconnectSpawnPos = Singleton.Instance.segments[3].reconnectSpawnPos; Campfire componentInChildren = Singleton.Instance.segments[3]._segmentCampfire.GetComponentInChildren(true); m_calderaSpawnPoint = new Vector3(reconnectSpawnPos.position.x, ((Component)componentInChildren).transform.position.y, reconnectSpawnPos.position.z + 58.367188f); ResumeSpawning(); } public void ResumeSpawning(float delay = 0f) { if (m_demonSpawnCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_demonSpawnCoroutine); } m_spawnIsDone = false; m_demonSpawnCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckForProgression(delay)); } private void AddTombTriggers() { //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_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_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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) if (Singleton.Instance.biomes.Contains((BiomeType)6) && GreenDemonChallenge.RoomBiomeConfig[(BiomeType)6]) { DesertRockSpawner componentInChildren = ((Component)Singleton.Instance).gameObject.GetComponentInChildren(true); GameObject gameObject = ((Component)((Component)componentInChildren).transform.GetChild(0)).gameObject; GameObject gameObject2 = ((Component)gameObject.GetComponentInChildren()).gameObject; if (((Object)gameObject2).name.Contains("3_E")) { GreenDemonChallenge.Log.LogInfo((object)"MESA was found and Tomb is open! Setting up Tomb Triggers..."); m_isTombOpened = true; Transform val = ((Component)componentInChildren).transform.Find("Inside/Entry"); Transform val2 = ((Component)componentInChildren).transform.Find("Inside/Exit"); GameObject val3 = Object.Instantiate(GreenDemonChallenge.TriggerEntryPrefab, val, false); GameObject val4 = Object.Instantiate(GreenDemonChallenge.TriggerEntryPrefab, gameObject2.transform, false); GameObject val5 = Object.Instantiate(GreenDemonChallenge.TriggerExitPrefab, val2, false); GameObject val6 = Object.Instantiate(GreenDemonChallenge.TriggerExitPrefab, val2, false); val3.transform.SetLocalPositionAndRotation(new Vector3(0.099f, 1.25f, -0.25f), Quaternion.identity); val4.transform.SetLocalPositionAndRotation(new Vector3(0.099f, 1.25f, -0.25f), Quaternion.identity); val6.transform.SetLocalPositionAndRotation(new Vector3(-46.486176f, 478.75f, 680.27f), Quaternion.identity); val5.transform.SetLocalPositionAndRotation(new Vector3(-46.486176f, 504.75f, 696.11f), Quaternion.identity); GreenDemonTombTrigger orAddComponent = ExtensionMethods.GetOrAddComponent(val3); GreenDemonTombTrigger component = val5.GetComponent(); GreenDemonTombTrigger component2 = val4.GetComponent(); GreenDemonTombTrigger component3 = val6.GetComponent(); orAddComponent.greenDemonTriggerEvent.AddListener((UnityAction)ManageTombEnrty); component.greenDemonTriggerEvent.AddListener((UnityAction)ManageTombExits); component2.greenDemonTriggerEvent.AddListener((UnityAction)ManageTombExits); component3.greenDemonTriggerEvent.AddListener((UnityAction)ManageTombEnrty); GlobalEvents.OnCharacterDied = (Action)Delegate.Combine(GlobalEvents.OnCharacterDied, new Action(OnCharacterDied)); GlobalEvents.OnCharacterSpawned = (Action)Delegate.Combine(GlobalEvents.OnCharacterSpawned, new Action(OnCharacterSpawned)); ((Bounds)(ref m_tombBounds)).Encapsulate(((Component)((Component)componentInChildren).transform.Find("Inside/LightBlocker")).GetComponent().bounds); TriggerRelay componentInParent = val6.gameObject.GetComponentInParent(); PhotonView componentInParent2 = gameObject2.GetComponentInParent(); ThrowHelper.ThrowIfArgumentNull(componentInParent2, "Rock entrance Photon View"); PhotonView componentInParent3 = ((Component)val).GetComponentInParent(); ThrowHelper.ThrowIfArgumentNull(componentInParent3, "Tomb entrance Photon View"); ExtensionMethods.GetOrAddComponent(((Component)componentInParent2).gameObject); ExtensionMethods.GetOrAddComponent(((Component)componentInParent3).gameObject); ExtensionMethods.GetOrAddComponent(((Component)componentInParent).gameObject); ExtensionMethods.GetOrAddComponent(((Component)componentInParent2).gameObject); } else { GreenDemonChallenge.Log.LogInfo((object)"MESA was found but Tomb is CLOSED."); } } else { if (GreenDemonChallenge.RoomBiomeConfig[(BiomeType)6]) { GreenDemonChallenge.Log.LogInfo((object)"MESA green demon is disabled."); } else { GreenDemonChallenge.Log.LogInfo((object)"No MESA were found."); } m_isTombOpened = false; } } private void OnCharacterSpawned(Character obj) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (m_isTombOpened && !obj.data.dead && obj != null && !obj.isBot && !obj.isScoutmaster && ((Bounds)(ref m_tombBounds)).Contains(obj.Center)) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombEntry", (RpcTarget)0, new object[1] { NetworkingUtilities.GetUserId(obj.player) }); } } public override void OnPlayerLeftRoom(Player otherPlayer) { ((MonoBehaviourPunCallbacks)this).OnPlayerLeftRoom(otherPlayer); if (m_isTombOpened && Singleton.Instance.currentSegment == 2) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombExit", (RpcTarget)0, new object[1] { otherPlayer.UserId }); } } public override void OnPlayerEnteredRoom(Player otherPlayer) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviourPunCallbacks)this).OnPlayerEnteredRoom(otherPlayer); if (m_isTombOpened && Singleton.Instance.currentSegment == 2) { Character playerCharacter = PlayerHandler.GetPlayerCharacter(otherPlayer); if ((Object)(object)playerCharacter != (Object)null && !playerCharacter.data.dead && playerCharacter != null && !playerCharacter.isBot && !playerCharacter.isScoutmaster && ((Bounds)(ref m_tombBounds)).Contains(playerCharacter.Center)) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombEntry", (RpcTarget)0, new object[1] { otherPlayer.UserId }); } } } private void OnCharacterDied(Character character) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombExit", (RpcTarget)0, new object[1] { NetworkingUtilities.GetUserId(character.player) }); } private void ManageTombExits(string userId) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombExit", (RpcTarget)0, new object[1] { userId }); } private void ManageTombEnrty(string userId) { ((MonoBehaviourPun)this).photonView.RPC("RPC_AddPlayerToTombEntry", (RpcTarget)0, new object[1] { userId }); } [PunRPC] private void RPC_AddPlayerToTombExit(string userId) { if (m_playersEnteredTomb.Contains(userId)) { m_playersEnteredTomb.Remove(userId); } } [PunRPC] private void RPC_AddPlayerToTombEntry(string userId) { m_playersEnteredTomb.Add(userId); } [PunRPC] public void RPC_ThrowFireball(int charView) { Character character = default(Character); if (Character.GetCharacterWithPhotonID(charView, ref character)) { UnnamedCompatibilityHandler.SpawnFireball(character); } } [PunRPC] public void RPC_RespawnFlares(Vector3 spawnPos, int amountToRespawn) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Item val = default(Item); if (PhotonNetwork.IsMasterClient && ItemDatabase.TryGetItem((ushort)32, ref val)) { for (int i = 0; i < amountToRespawn; i++) { PhotonNetwork.InstantiateItemRoom(((Object)((Component)val).gameObject).name, spawnPos + Vector3.up * 0.09147437f * (float)i, Quaternion.identity); } } } [PunRPC] public void RPC_RespawnUnnamedFlares(Vector3 spawnPos, int amountToRespawn) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && UnnamedCompatibilityHandler.Enabled) { UnnamedCompatibilityHandler.RespawnUnnamedFlares(spawnPos, amountToRespawn); } } public bool IsCharacterInTomb(Character character) { return false; } public bool ShouldChaseCharacter(Character character) { return true; } [PunRPC] public void RPC_SpawnIceCloud(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(GreenDemonChallenge.IceCloudPrefab, pos, Quaternion.identity); } [PunRPC] public void RPC_SpawnFireCloud(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(GreenDemonChallenge.FireCloudPrefab, pos, Quaternion.identity); } [PunRPC] public void RPC_SpawnSporeCloud(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(GreenDemonChallenge.SporeCloudPrefab, pos, Quaternion.identity); } [PunRPC] public void RPC_SpawnPoisonCloud(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(GreenDemonChallenge.PoisonCloudPrefab, pos, Quaternion.identity); } private IEnumerator CheckForProgression(float delay = 0f) { if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } if (m_previousProgressPoint != 0) { yield return (object)new WaitUntil((Func)(() => m_previousProgressPoint != GetCurrentProgressPointIndex())); } m_currentProgressPointIndex = GetCurrentProgressPointIndex(); m_nextProgressPointIndex = GetNextProgressPointIndex(m_currentProgressPointIndex); GreenDemonChallenge.Log.LogInfo((object)$"NEW CURRENT PROGRESS INDEX: {m_currentProgressPointIndex}. NEXT PROGRESS INDEX: {m_nextProgressPointIndex}"); while (!HasProgressedForSpawn()) { yield return (object)new WaitForSecondsRealtime(5f); } if (PhotonNetwork.IsMasterClient) { switch (GreenDemonChallenge.RoomGreenDemonMode) { case GreenDemonModes.NORMAL: SpawnGreenDemon(GreenDemonChallenge.RoomGreenDemonAmount); break; case GreenDemonModes.HARD: { int count = GreenDemon.AllDemons.Count; int num = Mathf.Clamp(GreenDemonChallenge.RoomGreenDemonAmount - count, 0, GreenDemonChallenge.RoomGreenDemonAmount); if (num > 0) { SpawnGreenDemon(num); } break; } case GreenDemonModes.VERY_HARD: SpawnGreenDemon(GreenDemonChallenge.RoomGreenDemonAmount); break; default: throw new ArgumentOutOfRangeException(); } } m_spawnIsDone = true; if (m_currentProgressPointIndex == 4) { if (m_peakCheckCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_peakCheckCoroutine); } m_peakCheckCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckForPeak()); } m_previousProgressPoint = m_currentProgressPointIndex; } private IEnumerator CheckForPeak() { while (!m_reachedPeak) { yield return (object)new WaitForSecondsRealtime(5f); if (PhotonNetwork.IsMasterClient) { UpdateGroupAverage(); if (Singleton.Instance.IsAtPeak(GroupPosition) && !m_reachedPeak) { m_reachedPeak = true; ShrinkAllDemons(); ResumeSpawning(1.5f); } } } } private void UpdateGroupAverage() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0067: 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_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_0048: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; List allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val2 = allPlayerCharacters[i]; if (Object.op_Implicit((Object)(object)val2) && !val2.data.dead && !val2.IsGhost) { val += val2.Center; num++; } } if (num != 0) { val /= (float)num; GroupPosition = val; } else { GreenDemonChallenge.Log.LogError((object)"No alive players were found."); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int GetNextProgressPointIndex(int currentProgress) { MapHandler instance = Singleton.Instance; MountainProgressHandler instance2 = Singleton.Instance; return currentProgress switch { 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 5, _ => Mathf.Clamp(currentProgress + 1, 0, instance.biomes.Count - 1), }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetCurrentProgressPointIndex() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) MapHandler instance = Singleton.Instance; MountainProgressHandler instance2 = Singleton.Instance; return instance.currentSegment switch { 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => instance2.IsAtPeak(GroupPosition) ? 5 : 4, _ => instance2.maxProgressPointReached, }; } private bool HasProgressedForSpawn() { //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_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_00bc: 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_003d: 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_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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected I4, but got Unknown //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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_011b: 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_016c: 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_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_0181: 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_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_0193: 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_0138: 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_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_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_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_022b: 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_0238: 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_01e6: 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_01f8: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_029d: 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_02ab: 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_02c4: 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_02e5: Expected I4, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) MountainProgressHandler instance = Singleton.Instance; MapHandler instance2 = Singleton.Instance; int currentSegment = instance2.currentSegment; MapSegment val = Singleton.Instance.segments[Singleton.Instance.currentSegment]; if (currentSegment >= 0 && currentSegment <= 3 && !GreenDemonChallenge.RoomBiomeConfig[instance2.biomes[currentSegment]]) { return false; } ProgressPoint val2 = instance.progressPoints[m_currentProgressPointIndex]; ProgressPoint val3 = instance.progressPoints[m_nextProgressPointIndex]; Vector3 position = val3.transform.position; Vector3 val4 = val2.transform.position; Vector3 val5 = val.reconnectSpawnPos.position; GameObject segmentCampfire = val.segmentCampfire; Vector3 val6 = ((!Object.op_Implicit((Object)(object)segmentCampfire)) ? ((Component)m_peakEndTransform).transform.position : segmentCampfire.transform.position); Segment currentSegment2 = instance2.GetCurrentSegment(); switch (currentSegment2 - 3) { case 0: val6 = segmentCampfire.transform.GetChild(0).position; break; case 1: val6 = m_peakCrowStartPos; val5 = m_kilnBridgeTransform.position; val5.y = val.reconnectSpawnPos.position.y; if (m_reachedPeak) { val6 = m_peakEndTransform.position; val5 = m_peakSpawnPoint; val4 = m_peakSpawnPoint; position = m_peakEndTransform.position; } break; case 2: val6 = m_peakEndTransform.position; val5 = m_peakSpawnPoint; val4 = m_peakSpawnPoint; position = m_peakEndTransform.position; break; } float num = 0f; float num2 = Vector3.SqrMagnitude(val6 - val5); Vector3 val7 = Vector3.zero; int num3 = 0; List allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val8 = allPlayerCharacters[i]; if (Object.op_Implicit((Object)(object)val8) && !val8.data.dead && !val8.IsGhost) { num += Vector3.SqrMagnitude(val6 - val8.Center); val7 += val8.Center; num3++; } } if (num3 != 0) { num /= (float)num3; val7 = (GroupPosition = val7 / (float)num3); if (currentSegment == 4) { if (instance.IsAtPeak(val7)) { if (!GreenDemonChallenge.RoomBiomeConfig[(BiomeType)5]) { return false; } } else if (!GreenDemonChallenge.RoomEnableGreenDemonInTheKiln) { return false; } } CurrentCrowCompletion = Mathf.Lerp(1f, 0f, num / num2); CurrentClimbCompletion = Util.RangeLerp(0f, 1f, val4.y, position.y, val7.y, true, (AnimationCurve)null); Segment currentSegment3 = instance2.GetCurrentSegment(); return (int)currentSegment3 switch { 0 => CurrentCrowCompletion >= 0.5f && CurrentClimbCompletion >= 0.25f, 1 => CurrentCrowCompletion >= 0.35f && CurrentClimbCompletion >= 0.25f, 2 => CurrentCrowCompletion >= 0.4f && CurrentClimbCompletion >= 0.25f, 3 => CurrentCrowCompletion >= 0.4f, 4 => CurrentClimbCompletion >= 1f / 3f, 5 => CurrentCrowCompletion >= 0.5f && CurrentClimbCompletion >= 0.15f, _ => CurrentCrowCompletion > 0.5f && CurrentClimbCompletion >= 0.25f, }; } GreenDemonChallenge.Log.LogError((object)"No alive players were found."); return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool MeetsCurrentCrowCompletion() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown Segment currentSegment = Singleton.Instance.GetCurrentSegment(); return (int)currentSegment switch { 0 => CurrentCrowCompletion >= 0.5f, 1 => CurrentCrowCompletion >= 0.35f, 2 => CurrentCrowCompletion >= 0.4f, 3 => CurrentCrowCompletion >= 0.4f, 4 => true, 5 => CurrentCrowCompletion >= 0.5f, _ => CurrentCrowCompletion > 0.5f, }; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool MeetsCurrentClimbCompletion() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown Segment currentSegment = Singleton.Instance.GetCurrentSegment(); return (int)currentSegment switch { 0 => CurrentClimbCompletion >= 0.25f, 1 => CurrentClimbCompletion >= 0.25f, 2 => CurrentClimbCompletion >= 0.25f, 3 => true, 4 => CurrentClimbCompletion >= 1f / 3f, 5 => CurrentClimbCompletion >= 0.25f, _ => CurrentClimbCompletion >= 0.25f, }; } public void SpawnGreenDemon(int greenDemonAmount) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //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_0063: 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_0078: 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_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_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_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_00ad: 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_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_00c2: 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_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) MapHandler instance = Singleton.Instance; MapSegment val = instance.segments[instance.currentSegment]; Vector3 val2 = val.reconnectSpawnPos.position; if ((int)instance.GetCurrentSegment() == 3) { val2 = m_calderaSpawnPoint; } else if ((int)instance.GetCurrentSegment() == 5) { val2 = m_peakSpawnPoint; } else if ((int)instance.GetCurrentSegment() == 4) { val2 = m_kilnSpawnPoint; if (m_reachedPeak) { val2 = m_peakSpawnPoint; } } RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 10f, Vector3.down, ref val3, 1000f, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)1)))) { val2 = ((RaycastHit)(ref val3)).point; } for (int i = 0; i < greenDemonAmount; i++) { GameObject val4 = NetworkPrefabManager.SpawnNetworkPrefab(((Object)GreenDemonChallenge.GreenDemonPrefab).name, val2 + Vector3.up * 10f + Vector3.right * (float)i, Quaternion.identity, (byte)0, (object[])null); val4.GetComponent().m_demonIndex = i; } } [PunRPC] public void RPC_SpawnGreenDemonInstance(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SpawnGreenDemon(position); } public void SpawnGreenDemon(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) NetworkPrefabManager.SpawnNetworkPrefab(((Object)GreenDemonChallenge.GreenDemonPrefab).name, position + Vector3.up * 10f, Quaternion.identity, (byte)0, (object[])null); } public void StartRun() { RunHasStarted = true; Instance = this; } public void ShrinkAllDemons() { GreenDemonChallenge.Log.LogInfo((object)$"Shrinking {GreenDemon.AllDemons.Count} Green Demons."); foreach (GreenDemon allDemon in GreenDemon.AllDemons) { ((MonoBehaviourPun)allDemon).photonView.RPC("RPC_StartShrinking", (RpcTarget)0, Array.Empty()); } } public void StopAllDemon(float time) { GreenDemonChallenge.Log.LogInfo((object)$"Stopping {GreenDemon.AllDemons.Count} Green Demons for {time} seconds."); foreach (GreenDemon allDemon in GreenDemon.AllDemons) { ((MonoBehaviourPun)allDemon).photonView.RPC("RPC_StopDemon", (RpcTarget)0, new object[1] { time }); } } public static IEnumerator KeepStamEmpty(Character c, float time) { float t = 0f; while (t < time) { c.UseStamina(1f, false); t += Time.deltaTime; yield return null; } } public static IEnumerator StickWFor(float f) { WKeyIsStuck = true; yield return (object)new WaitForSeconds(f); WKeyIsStuck = false; } public static IEnumerator ForceTornadoTarget(Tornado tornado, Transform target, float f) { float t = 0f; while (Object.op_Implicit((Object)(object)tornado) && t < f) { t += Time.deltaTime; tornado.target = target; yield return null; } } } public class GreenDemonImpactSFX : MonoBehaviour { private static readonly int CharacterLayerMask = LayerMask.GetMask(new string[1] { "Character" }); public float vel; public Rigidbody rig; public float velMult = 1f; public SFX_Instance[] m_impact; private void Start() { if (rig == null) { rig = ((Component)this).GetComponent(); } } private void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rig) && !rig.isKinematic) { vel = Mathf.Lerp(vel, Vector3.SqrMagnitude(rig.linearVelocity) * velMult, 10f * Time.deltaTime); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void PlayImpactSound(Vector3 pos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < m_impact.Length; i++) { m_impact[i].Play(pos); } } private void onCollisionEnter(Collision collision) { //IL_002a: 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 (Object.op_Implicit((Object)(object)rig)) { if (vel > 4f && !ExtGameObject.IsInLayer(((Component)collision.collider).gameObject, LayerMask.op_Implicit(CharacterLayerMask))) { PlayImpactSound(((ContactPoint)(ref collision.contacts[0])).point); } vel = 0f; } } } public class GreenDemonTombTrigger : TriggerEvent { public UnityEvent greenDemonTriggerEvent; public void OnGDCTriggerEnter(Collider other) { if (!other.isTrigger) { Character componentInParent = ((Component)other).GetComponentInParent(); if (componentInParent != null) { TriggerEntered(componentInParent); } } } public void TriggerEntered(Character player) { if (base.view.IsMine) { base.hasActivated = true; base.view.RPC("RPCA_GDCTrigger", (RpcTarget)0, new object[2] { ((Component)this).transform.GetSiblingIndex(), NetworkingUtilities.GetUserId(player.player) }); } } public void Trigger(string playerId) { ((MonoBehaviour)GameUtils.instance).StartCoroutine(TriggerRoutine(playerId)); } private IEnumerator TriggerRoutine(string playerID) { if (base.waitForRenderFrame) { yield return (object)new WaitForEndOfFrame(); } greenDemonTriggerEvent.Invoke(playerID); base.hasActivated = true; base.hasTriggered = true; } } public class GreenDemonTriggerRelay : MonoBehaviour { public PhotonView view; private void Awake() { if (view == null) { view = ((Component)this).GetComponent(); } } [PunRPC] public void RPCA_GDCTrigger(int childID, string characterId) { Transform child = ((Component)this).transform.GetChild(childID); GreenDemonTombTrigger greenDemonTombTrigger = default(GreenDemonTombTrigger); if (child != null && ((Component)child).TryGetComponent(ref greenDemonTombTrigger)) { greenDemonTombTrigger.Trigger(characterId); } } } } namespace GreenDemonChallenge.Behaviour.GUI { public class GreenDemonTracker : UIBehaviour { private static readonly Color RedTint = new Color(0.8862745f, 0.20784314f, 12f / 85f); private GreenDemon? m_demon; public CanvasGroup m_group; private RectTransform m_rectTransform; internal RectTransform m_rotatorTransform; public Image m_arrowImage; internal RectTransform m_demonTransform; internal RawImage m_demonImage; public static List AllTrackers = new List(); private Camera m_camera; private bool m_isValid = true; private bool m_isVisible = true; private bool m_isFading = true; private bool m_visibleOnScreen; private bool m_noVisuals; private float m_alphaTarget; private float m_distanceFromCam; private float m_demonScale; private Vector3 m_rawPosition; private bool m_isTinting; private float m_tintingTarget; private float m_maxRadius = 150f; private float m_minRadius = 0.5f; private float m_currentTinting; private bool m_isTinted; public AnimationCurve m_pulseTintCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); public GreenDemon Demon { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return m_demon ?? throw new InvalidOperationException(); } set { if (Object.op_Implicit((Object)(object)m_demon)) { GreenDemon? demon = m_demon; demon.OnPlayerCaught = (Action)Delegate.Remove(demon.OnPlayerCaught, new Action(FadeOutAndDie)); GreenDemon? demon2 = m_demon; demon2.OnShrink = (Action)Delegate.Remove(demon2.OnShrink, new Action(FadeOutAndDie)); } m_demon = value; if (Object.op_Implicit((Object)(object)m_demon)) { GreenDemon? demon3 = m_demon; demon3.OnPlayerCaught = (Action)Delegate.Combine(demon3.OnPlayerCaught, new Action(FadeOutAndDie)); GreenDemon? demon4 = m_demon; demon4.OnShrink = (Action)Delegate.Combine(demon4.OnShrink, new Action(FadeOutAndDie)); m_maxRadius = m_demon.source.maxDistance; m_minRadius = m_demon.m_catchRadius; } } } public Vector2 CurrentPosition { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return m_rectTransform.anchoredPosition; } [MethodImpl(MethodImplOptions.AggressiveInlining)] set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) m_rectTransform.anchoredPosition = value; } } private bool ShouldUpdatePosition { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (!(m_distanceFromCam <= m_maxRadius * m_maxRadius)) { if (!m_isVisible) { if (!m_isVisible) { return IsFadingIn; } return false; } return true; } return true; } } private bool IsFadingOut { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (m_isFading) { return Mathf.Approximately(m_alphaTarget, 0f); } return false; } } private bool IsFadingIn { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (m_isFading) { return Mathf.Approximately(m_alphaTarget, 1f); } return false; } } protected override void Start() { ((UIBehaviour)this).Start(); AllTrackers.Add(this); RefreshTrackerVisibility(); if (TimeThemeCompatibilityHandler.Enabled) { TimeThemeCompatibilityHandler.InitTracker(this); } if (m_alphaTarget != m_group.alpha) { m_isFading = true; } } private Vector3 GetClosestOutsidePosition(Vector3 trackPos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_002e: 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_003d: 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_0056: 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_0063: 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_0065: 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_0079: 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_009b: 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_010c: 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_0112: 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_0138: 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_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_00bc: 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_00e2: 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_0161: 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_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_0169: Unknown result type (might be due to invalid IL or missing references) Rect rect = m_rectTransform.rect; Vector2 val = ((Rect)(ref rect)).size / 2f; Rect rect2 = GreenDemonGUIManager.Instance.trackerScreenTransform.rect; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(trackPos.x, trackPos.y, trackPos.z); val2.z = 0f; Vector3 val3 = val2; Vector3 val4 = ExtSwizzle.xyo(((Rect)(ref rect2)).center); val3 -= val4; float num = (((Rect)(ref rect2)).width / 2f - val.x) / Mathf.Abs(val3.x); float num2 = (((Rect)(ref rect2)).height / 2f - val.y) / Mathf.Abs(val3.y); if (num < num2) { float num3 = Vector3.SignedAngle(Vector3.right, val3, Vector3.forward); val3.x = Mathf.Sign(val3.x) * (((Rect)(ref rect2)).width / 2f - val.x); val3.y = Mathf.Tan(MathF.PI / 180f * num3) * val3.x; } else { float num4 = Vector3.SignedAngle(Vector3.up, val3, Vector3.forward); val3.y = Mathf.Sign(val3.y) * (((Rect)(ref rect2)).height / 2f - val.y); val3.x = (0f - Mathf.Tan(MathF.PI / 180f * num4)) * val3.y; } return val3 + val4; } private void OnGUI() { //IL_0037: 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_00aa: 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_00db: 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_00e9: 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_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_00cd: 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_012c: 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_0154: 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_015c: 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_0106: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_demon) || !m_isValid) { return; } if (m_noVisuals || (!m_visibleOnScreen && ExtCamera.IsVisibleToCamera(m_camera, m_demon.Center))) { if (m_isVisible) { FadeOut(); } } else if (!m_isVisible && m_distanceFromCam <= m_maxRadius * m_maxRadius) { FadeIn(); } if (!ShouldUpdatePosition) { return; } Vector3 val = m_rawPosition; bool flag = false; if (m_rawPosition.z >= 0f) { val.z = 0f; } else { val *= -1f; flag = true; } if (!flag) { Rect rect = GreenDemonGUIManager.Instance.trackerScreenTransform.rect; if (((Rect)(ref rect)).Contains(ExtSwizzle.xy(val))) { ((Transform)m_rotatorTransform).rotation = Quaternion.Euler(Vector3.zero); val.y += 0f; goto IL_0120; } } val = GetClosestOutsidePosition(val); ((Transform)m_rotatorTransform).rotation = Quaternion.Euler(GetTrackerRotation(val)); goto IL_0120; IL_0120: ((Transform)m_demonTransform).localScale = ExtDataTypes.ToVec(m_demonScale); Vector3 localScale = ExtDataTypes.ToVec(m_demonScale); localScale.z = 1f; ((Transform)m_demonTransform).localScale = localScale; CurrentPosition = ExtSwizzle.xy(val); } private Vector3 GetTrackerRotation(Vector3 trackPos) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) Rect rect = GreenDemonGUIManager.Instance.trackerScreenTransform.rect; Vector2 center = ((Rect)(ref rect)).center; float num = Vector3.SignedAngle(Vector3.down, trackPos - ExtSwizzle.xyo(center), Vector3.forward); return new Vector3(0f, 0f, num); } protected override void Awake() { if (m_camera == null) { m_camera = MainCamera.instance.cam ?? throw new InvalidOperationException(); } if (m_rectTransform == null) { m_rectTransform = ((Component)this).GetComponent(); } if (m_group == null) { m_group = ((Component)this).GetComponent(); } if (m_rotatorTransform == null) { m_rotatorTransform = ((Component)((Component)this).transform.Find("DemonArrowRotator")).GetComponent(); } if (m_arrowImage == null) { m_arrowImage = ((Component)((Transform)m_rotatorTransform).Find("Arrow").Find("Image")).GetComponent(); } if (m_demonTransform == null) { m_demonTransform = ((Component)((Component)this).transform.Find("DemonImage")).GetComponent(); } if (m_demonImage == null) { m_demonImage = ((Component)m_demonTransform).GetComponent(); } } private void FixedUpdate() { //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_0038: 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_005d: 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 (Object.op_Implicit((Object)(object)m_demon)) { m_rawPosition = m_camera.WorldToScreenPoint(m_demon.Center) - new Vector3((float)Screen.width, (float)Screen.height, 0f) * 0.5f; m_distanceFromCam = Vector3.SqrMagnitude(((Component)m_camera).transform.position - m_demon.Center); if (m_distanceFromCam > m_maxRadius * m_maxRadius) { m_demonScale = 0.025f; if (m_isVisible) { FadeOut(); } } else { m_demonScale = Util.RangeLerp(0.025f, 1f, m_maxRadius * m_maxRadius, m_minRadius * m_minRadius, m_distanceFromCam, true, (AnimationCurve)null); if (m_demon.IsChasingLocalPlayer) { if (!m_isTinted) { m_tintingTarget = 1f; m_isTinting = true; } } else if (m_isTinted) { m_tintingTarget = 0f; m_isTinting = true; } } } UpdateTrackerTransitives(); } private void UpdateTrackerTransitives() { //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_00f4: 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_0114: Unknown result type (might be due to invalid IL or missing references) if (m_isTinting) { m_currentTinting = FRILerp.Lerp(m_currentTinting, m_tintingTarget, 40f, true); m_isTinting = !Mathf.Approximately(m_tintingTarget, m_currentTinting); if (!m_isTinting) { m_isTinted = Mathf.Approximately(m_tintingTarget, 1f); } } if (m_isFading) { m_group.alpha = FRILerp.Lerp(m_group.alpha, m_alphaTarget, 40f, true); m_isFading = !Mathf.Approximately(m_alphaTarget, m_group.alpha); if (!m_isFading) { m_isVisible = Mathf.Approximately(m_alphaTarget, 1f); if (!m_isVisible && !m_isValid) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } ((Graphic)m_demonImage).color = Color.Lerp(Color.white, Color.Lerp(Color.white, RedTint, m_pulseTintCurve.Evaluate(Time.time)), m_currentTinting); } protected override void OnDestroy() { AllTrackers.Remove(this); ((UIBehaviour)this).OnDestroy(); } private void FadeOut() { if (m_isValid) { m_alphaTarget = 0f; m_isFading = true; } } private void FadeIn() { if (m_isValid) { m_alphaTarget = 1f; m_isFading = true; } } private void FadeOutAndDie() { if (m_isValid) { m_isValid = false; m_alphaTarget = 0f; m_isFading = true; } } public void RefreshTrackerVisibility() { switch (GreenDemonChallenge.GreenDemonTrackerSetting.Value) { case GreenDemonTrackerSettings.OFFSCREEN: m_visibleOnScreen = false; m_noVisuals = false; break; case GreenDemonTrackerSettings.ALWAYS: m_visibleOnScreen = true; m_noVisuals = false; break; case GreenDemonTrackerSettings.NEVER: m_noVisuals = false; break; default: throw new ArgumentOutOfRangeException("GreenDemonTrackerSetting"); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }