Decompiled source of GreenDemonChallenge v1.0.2
plugins/com.github.MiiMii1205.GreenDemonChallenge.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.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 GreenDemonChallenge.Behaviour; using GreenDemonChallenge.Behaviour.GUI; using GreenDemonChallenge.Compatibility; using GreenDemonChallenge.Compatibility.Patchers; 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 UnityEngine; 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.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+0c498cb1bee3a817c691a77ed664a63f0de89a38")] [assembly: AssemblyProduct("com.github.MiiMii1205.GreenDemonChallenge")] [assembly: AssemblyTitle("GreenDemonChallenge")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.*/)] [BepInPlugin("com.github.MiiMii1205.GreenDemonChallenge", "GreenDemonChallenge", "1.0.2")] public class GreenDemonChallenge : BaseUnityPlugin { public static GreenDemonCaughtEffects RoomGreenDemonCaughtEffect = GreenDemonCaughtEffects.KILL; public static Dictionary<BiomeType, bool> 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 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 { get; private set; } = null; internal static ManualLogSource Log { get; private set; } = null; public static PhotonScopedManager? Manager { get; private set; } public static ConfigEntry<GreenDemonCaughtEffects> GreenDemonCaughtEffect { get; private set; } = null; public static ConfigEntry<GreenDemonTrackerSettings> GreenDemonTrackerSetting { get; private set; } = null; public static ConfigEntry<float> GreenDemonVolume { get; private set; } = null; public static Dictionary<BiomeType, ConfigEntry<bool>> BiomeConfig { get; private set; } = null; public static GameObject TriggerEntryPrefab { get; set; } = null; public static GameObject TriggerExitPrefab { get; set; } = null; public static GameObject TheDemonIsHerePrefab { get; set; } = null; public static GameObject TrackerPrefab { get; set; } = null; public static GameObject PoisonCloudPrefab { get; set; } = null; public static GameObject SporeCloudPrefab { get; set; } = null; public static GameObject IceCloudPrefab { get; set; } = null; public static GameObject FireCloudPrefab { get; set; } = null; public static TMP_FontAsset DarumaDropOne { get { if ((Object)(object)_darumaFontAsset == (Object)null) { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); _darumaFontAsset = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)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<Material>(Object.Instantiate<Material>(((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<int> GreenDemonAmount { get; set; } = null; public static ConfigEntry<bool> EnableGreenDemonInTheKiln { get; private set; } = null; public static ConfigEntry<bool> StopGreenDemonInTomb { get; private set; } = null; public static ConfigEntry<GreenDemonSpeeds> GreenDemonSpeed { get; set; } = null; public static ConfigEntry<float> GreenDemonDelay { get; set; } = null; public static ConfigEntry<GreenDemonModes> GreenDemonMode { get; set; } = null; public static string Name => "GreenDemonChallenge"; public static string Version => "1.0.2"; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_0232: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0537: 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<GreenDemonCaughtEffects>(GetValidEffects()), Array.Empty<object>()); GreenDemonCaughtEffect = ((BaseUnityPlugin)this).Config.Bind<GreenDemonCaughtEffects>("General", "Green Demon Caught Effect", GreenDemonCaughtEffects.KILL, val); GreenDemonVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "Green Demon Volume", 1f, new ConfigDescription("The volume of the Green Demon Music", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); GreenDemonTrackerSetting = ((BaseUnityPlugin)this).Config.Bind<GreenDemonTrackerSettings>("Gameplay", "Green Demon Tracker Mode", GreenDemonTrackerSettings.OFFSCREEN, "When on-screen trackers should appear."); GreenDemonAmount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Green Demon amount", 1, new ConfigDescription("The amount of Green Demons that spawns in.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); GreenDemonSpeed = ((BaseUnityPlugin)this).Config.Bind<GreenDemonSpeeds>("General", "Green Demon Speed", GreenDemonSpeeds.MEDIUM, "How fast green demons goes."); GreenDemonDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Green Demon Delay", 1f, "How long the demon has to wait before starting to chase players after spawning."); GreenDemonMode = ((BaseUnityPlugin)this).Config.Bind<GreenDemonModes>("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 ."); GreenDemonCaughtEffect.SettingChanged += UpdateGreenDemonConfig; GreenDemonAmount.SettingChanged += UpdateGreenDemonConfig; GreenDemonSpeed.SettingChanged += UpdateGreenDemonConfig; GreenDemonMode.SettingChanged += UpdateGreenDemonConfig; GreenDemonVolume.SettingChanged += UpdateDemonVolumes; GreenDemonTrackerSetting.SettingChanged += UpdateTrackersSettings; BiomeConfig = new Dictionary<BiomeType, ConfigEntry<bool>>(); RoomBiomeConfig = new Dictionary<BiomeType, bool>(); foreach (object enumValue in typeof(BiomeType).GetEnumValues()) { if ((int)enumValue <= 7) { string text = typeof(BiomeType).GetEnumName((object)(BiomeType)enumValue)?.Replace("Volcano", "Caldera"); ConfigEntry<bool> val2 = ((BaseUnityPlugin)this).Config.Bind<bool>("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<bool>("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; BundleLoader.LoadBundleAndContentsWithName((BaseUnityPlugin)(object)this, "greendemon.peakbundle", (Action<PeakBundle>)delegate(PeakBundle bundle) { GreenDemonPrefab = bundle.LoadAsset<GameObject>("GreenDemon.prefab"); TriggerEntryPrefab = bundle.LoadAsset<GameObject>("GreenDemonEntry.prefab"); TriggerExitPrefab = bundle.LoadAsset<GameObject>("GreenDemonExit.prefab"); TheDemonIsHerePrefab = bundle.LoadAsset<GameObject>("TheDemonIsHere.prefab"); TrackerPrefab = bundle.LoadAsset<GameObject>("GreenDemonTracker.prefab"); TrackerPrefab.GetComponentInChildren<CanvasGroup>(true).alpha = 0f; ExtGameObject.GetOrAddComponent<GreenDemonTombTrigger>(TriggerEntryPrefab); ExtGameObject.GetOrAddComponent<GreenDemonTombTrigger>(TriggerExitPrefab); PoisonCloudPrefab = bundle.LoadAsset<GameObject>("PoisonCloud.prefab"); SporeCloudPrefab = bundle.LoadAsset<GameObject>("SporeCloud.prefab"); IceCloudPrefab = bundle.LoadAsset<GameObject>("IceCloud.prefab"); FireCloudPrefab = bundle.LoadAsset<GameObject>("FireCloud.prefab"); GameObject val4 = bundle.LoadAsset<GameObject>("GreenDemonConsumeVFX.prefab"); GameObject val5 = bundle.LoadAsset<GameObject>("GreenDemonPoofVFX.prefab"); ShaderExtensions.ReplaceShaders(val4); ShaderExtensions.ReplaceShaders(val5); ReplaceShaders(new List<string>(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<string>(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<DestroyAfterEmit>(val4); orAddComponent.m_particle = val4.GetComponent<ParticleSystem>(); DestroyAfterEmit orAddComponent2 = ExtGameObject.GetOrAddComponent<DestroyAfterEmit>(val5); orAddComponent2.m_particle = val5.GetComponent<ParticleSystem>(); GreenDemon orAddComponent3 = ExtGameObject.GetOrAddComponent<GreenDemon>(GreenDemonPrefab); orAddComponent3.mainRenderer = GreenDemonPrefab.GetComponentInChildren<Renderer>(); orAddComponent3.m_demonTransform = ((Component)orAddComponent3.mainRenderer).transform.parent; Item val6 = default(Item); Item val7 = default(Item); if (ItemDatabase.TryGetItem((ushort)158, ref val6) && ItemDatabase.TryGetItem((ushort)13, ref val7)) { ItemImpactSFX component = ((Component)val6).GetComponent<ItemImpactSFX>(); ItemImpactSFX component2 = ((Component)val7).GetComponent<ItemImpactSFX>(); orAddComponent3.m_impact = CollectionExtensions.AddRangeToArray<SFX_Instance>(orAddComponent3.m_impact, component.impact); SFX_Instance[] impact = component2.impact; foreach (SFX_Instance val8 in impact) { if (((Object)val8).name == "SFXI BingBong 2") { orAddComponent3.m_impact = CollectionExtensions.AddToArray<SFX_Instance>(orAddComponent3.m_impact, val8); } } } SFX_PlayOneShot component3 = GreenDemonPrefab.GetComponent<SFX_PlayOneShot>(); SFX_Instance[] sfxs = component3.sfxs; SFX_Instance[] array = sfxs; foreach (SFX_Instance val9 in array) { if (((Object)val9).name == "SFXI Heal Hunger Stamina") { orAddComponent3.consumedSfx = CollectionExtensions.AddToArray<SFX_Instance>(orAddComponent3.consumedSfx, val9); } } orAddComponent3.shrunkSfx = CollectionExtensions.AddToArray<SFX_Instance>(orAddComponent3.shrunkSfx, bundle.LoadAsset<SFX_Instance>("SFXI Demon_Despawn.asset")); orAddComponent3.consumedSfx = CollectionExtensions.AddToArray<SFX_Instance>(CollectionExtensions.AddToArray<SFX_Instance>(orAddComponent3.consumedSfx, bundle.LoadAsset<SFX_Instance>("SFXI Demon_Consume.asset")), bundle.LoadAsset<SFX_Instance>("SFXI Demon_Consume_Jingle.asset")); orAddComponent3.m_vfxPrefab = val4; orAddComponent3.m_poofVfxPrefab = val5; Object.Destroy((Object)(object)component3); orAddComponent3.source = GreenDemonPrefab.GetComponent<AudioSource>(); ReplaceShaders(new List<string>(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<string>(2) { "Scouts/UI", "TextMeshPro/Distance Field" }, TheDemonIsHerePrefab); ReplaceShaders(new List<string>(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); TMP_Text[] componentsInChildren = TheDemonIsHerePrefab.GetComponentsInChildren<TMP_Text>(); foreach (TMP_Text val10 in componentsInChildren) { val10.font = DarumaDropOne; val10.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); bundle.Mod.RegisterContent(); Log.LogInfo((object)"Green Demon bundle is loaded!"); }); Manager.RegisterRoomProperty<int>("RoomGreenDemonSpeed", (RoomEventType)2, (Action<int>)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", (GreenDemonSpeeds)v, "RoomGreenDemonSpeed")); RoomGreenDemonSpeed = (GreenDemonSpeeds)v; } }); Manager.RegisterRoomProperty<int>("RoomGreenDemonAmount", (RoomEventType)2, (Action<int>)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomGreenDemonAmount")); RoomGreenDemonAmount = v; } }); Manager.RegisterRoomProperty<bool>("RoomEnableGreenDemonInTheKiln", (RoomEventType)2, (Action<bool>)delegate(bool v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomEnableGreenDemonInTheKiln")); RoomEnableGreenDemonInTheKiln = v; } }); Manager.RegisterRoomProperty<int>("RoomGreenDemonCaughtEffect", (RoomEventType)2, (Action<int>)delegate(int v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", (GreenDemonCaughtEffects)v, "RoomGreenDemonCaughtEffect")); RoomGreenDemonCaughtEffect = (GreenDemonCaughtEffects)v; } }); Manager.RegisterRoomProperty<float>("RoomGreenDemonDelay", (RoomEventType)2, (Action<float>)delegate(float v) { if (!PhotonNetwork.IsMasterClient) { Log.LogInfo((object)string.Format("Received {0} as new {1}!", v, "RoomGreenDemonDelay")); RoomGreenDemonDelay = v; } }); foreach (KeyValuePair<BiomeType, bool> keyValuePair in RoomBiomeConfig) { string text2 = string.Format("{0}_{1}", keyValuePair.Key, "RoomBiomeConfig"); Manager.RegisterRoomProperty<bool>(text2, (RoomEventType)2, (Action<bool>)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<Player>)SetupGreenDemonSettings); AddLocalizedTextCsv(); Harmony val3 = new Harmony("com.github.MiiMii1205.GreenDemonChallenge"); val3.PatchAll(typeof(GreenDemonPatcher)); if (LuckyBlocksCompatibilityHandler.Enabled) { LuckyBlocksCompatibilityHandler.PatchLuckyBlocks(val3); } Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } 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 GreenDemonCaughtEffects[] GetValidEffects() { List<GreenDemonCaughtEffects> list = new List<GreenDemonCaughtEffects>(); 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 (Chainloader.PluginInfos.ContainsKey("legocool.LuckyBlocks")) { list.Add(value); } break; default: list.Add(value); break; } } return list.ToArray(); } private 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: 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); foreach (KeyValuePair<BiomeType, ConfigEntry<bool>> 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 void ReplaceShaders(List<string> shaderNames, GameObject go) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(); foreach (Renderer ren in componentsInChildren) { ReplaceAllShaderInRenderer(shaderNames, ren); } } private void ReplaceAllShaderInRenderer(List<string> 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<char>)Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), (ReadOnlySpan<char>)"GreenDemonChallengeLocalizedText.csv")); int num = 0; while (!streamReader.EndOfStream) { string text = streamReader.ReadLine(); if (text == null) { break; } num++; List<string> list = new List<string>(CSVReader.SplitCsvLine(text, true)); string text2 = ExtCollections.Deque<string>(list); string text3 = ExtCollections.Pop<string>(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 SpawnGreenDemon() { 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<GameObject>(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<GameObject>(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<GameObject>(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<GameObject>(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<GreenDemonHandler>(((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<GreenDemonGUIManager>(((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<T> : 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 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)("Lucky Blocks support is " + (_enabled.Value ? "enabled" : "disabled"))); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchLuckyBlocks(Harmony harmony) { harmony.PatchAll(typeof(LuckyBlocksPatcher)); } } 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<StickyFireballController>(); 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<GameObject>(val, character.Center, Quaternion.identity); } } [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<Item>(), 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<BackpackData>((DataEntryKey)7, ref backpackData) && ((Component)val).TryGetComponent<BackpackVisuals>(ref backpackVisuals)) { num += ChangeBackpackItems(backpackData, backpackVisuals); } } else if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren<BackpackVisuals>(true); BackpackData backpackData2 = default(BackpackData); if (componentInChildren != null && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<BackpackData>((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<byte>.Some((byte)num2)); itemSlot.SetItem(unnamedVariant2.GetComponent<Item>(), data2); num++; } } else if (UnnamedPlugin.HasUnnamedVariant(itemSlot.prefab)) { GameObject unnamedVariant3 = UnnamedPlugin.GetUnnamedVariant(itemSlot.prefab); itemSlot.prefab = unnamedVariant3.GetComponent<Item>(); num++; } } } character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray<InventorySyncData>(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<Item>(), 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<Item>() : val); PhotonNetwork.InstantiateItemRoom(((Object)((Component)val2).gameObject).name, spawnPos + Vector3.up * 0.09147437f * (float)i, Quaternion.identity); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static int RemoveFlairsFormGarbageBags(Item sPrefab, ItemInstanceData sData) { int num = 0; UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (((Component)sPrefab).TryGetComponent<UnnamedGarbageBagController>(ref val) && sData.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2)) { 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()) { if (((Component)val3.prefab).TryGetComponent<Flare>(ref val4)) { val3.EmptyOut(); num++; } else if (((Component)val3.prefab).TryGetComponent<UnnamedGarbageBagController>(ref val5)) { num += RemoveFlairsFormGarbageBags(val3.prefab, val3.data); } } } } return num; } [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<UnnamedGarbageBagController>(ref val) && sData.TryGetDataEntry<BackpackData>((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<UnnamedGarbageBagController>(ref val4)) { num += CookGarbageBags(val3.prefab, val3.data); } if (val3.data.TryGetDataEntry<IntItemData>((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<IntItemData>((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<UnnamedGarbageBagController>(ref val) && sData.TryGetDataEntry<BackpackData>((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<UnnamedGarbageBagController>(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<Item>(), data); num++; } } } } return num; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsGarbageBag(Item sPrefab) { UnnamedGarbageBagController val = default(UnnamedGarbageBagController); return ((Component)sPrefab).TryGetComponent<UnnamedGarbageBagController>(ref val); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool HasAnyFlares(Character character) { Flare val3 = default(Flare); if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { if (GreenDemon.IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)character.data.currentItem)) { Backpack val = default(Backpack); if (((Component)character.data.currentItem).TryGetComponent<Backpack>(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<Flare>(ref val3) || CheckForFlareInGarbageBag(val2))) { return true; } } } } else if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren<BackpackVisuals>(true); if (componentInChildren != null) { ItemSlot[] itemSlots2 = componentInChildren.GetBackpackData().itemSlots; foreach (ItemSlot val4 in itemSlots2) { if (!val4.IsEmpty() && (((Component)val4.prefab).TryGetComponent<Flare>(ref val3) || CheckForFlareInGarbageBag(val4))) { return true; } } } } } ItemSlot[] itemSlots3 = character.player.itemSlots; foreach (ItemSlot val5 in itemSlots3) { if (!val5.IsEmpty() && (((Component)val5.prefab).TryGetComponent<Flare>(ref val3) || CheckForFlareInGarbageBag(val5))) { return true; } } return false; } private static bool CheckForFlareInGarbageBag(ItemSlot itemSlot) { UnnamedGarbageBagController val = default(UnnamedGarbageBagController); BackpackData val2 = default(BackpackData); if (((Component)itemSlot.prefab).TryGetComponent<UnnamedGarbageBagController>(ref val) && itemSlot.data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val2)) { ItemSlot[] itemSlots = val2.itemSlots; Flare val4 = default(Flare); foreach (ItemSlot val3 in itemSlots) { if (!itemSlot.IsEmpty() && (((Component)val3.prefab).TryGetComponent<Flare>(ref val4) || CheckForFlareInGarbageBag(val3))) { return true; } } } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TryTurnIntoUnnamed(ref Item item) { if (UnnamedPlugin.HasUnnamedVariant(item) && UnnamedPlugin.ShouldBeUnnamed) { item = UnnamedPlugin.GetUnnamedVariant(item).GetComponent<Item>(); } } } } namespace GreenDemonChallenge.Compatibility.Patchers { public static class LuckyBlocksPatcher { [HarmonyPatch(typeof(Outcomes), "TriggerRandom")] [HarmonyPrefix] public static void TriggerRandomPostfix(LuckyBreakable lb, Collision coll, ref bool __runOriginal) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Random.value < 0.01f) { __runOriginal = false; GreenDemonHandler instance = GreenDemonHandler.Instance; ContactPoint contact = coll.GetContact(0); instance.SpawnGreenDemon(((ContactPoint)(ref contact)).point); } } } } namespace GreenDemonChallenge.Behaviour { public class DestroyAfterEmit : MonoBehaviour { public ParticleSystem m_particle; private void Awake() { if (m_particle == null) { m_particle = ((Component)this).GetComponent<ParticleSystem>(); } } private IEnumerator Start() { m_particle.Play(); yield return (object)new WaitUntil((Func<bool>)(() => !m_particle.IsAlive())); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class GreenDemon : MonoBehaviourPunCallbacks { public static List<GreenDemon> AllDemons = new List<GreenDemon>(); public SphereCollider collider; public Vector3 centerOfMass; 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 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; protected 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<SFX_Instance>(); public SFX_Instance[] shrunkSfx = Array.Empty<SFX_Instance>(); 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 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<Renderer>(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 { get { if (HasTarget) { return !m_chasingCharacter.IsLocal; } return true; } } 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<MapHandler>.Instance.currentSegment != 3) { if (Singleton<MapHandler>.Instance.currentSegment != 4 || GreenDemonHandler.Instance.m_reachedPeak) { return m_baseSpeed; } return m_kilnBaseSpeed; } return Vector3.one; } } 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<PhotonView>(); } AddPhysics(); if (m_physSyncer == null) { m_physSyncer = ((Component)this).GetComponent<PhysicsSyncer>(); } if (animator == null) { animator = ((Component)this).GetComponent<Animator>(); } if (source == null) { source = ((Component)this).GetComponent<AudioSource>(); } if (mainRenderer == null) { mainRenderer = ((Component)this).GetComponent<Renderer>(); } if (m_demonTransform == null) { m_demonTransform = ((Component)mainRenderer).transform; } } private void Start() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) GreenDemonChallenge.Log.LogInfo((object)"SPAWN A GREEN DEMON!"); GreenDemonGUIManager.Instance.TheDemonIsHere(); 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<bool>)(() => !PExt.IsPlaying(animator, "GreenDemonSpawn", 0))); yield return (object)new WaitForSecondsRealtime(GreenDemonChallenge.RoomGreenDemonDelay); 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_0068: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!m_isSpawning && PhotonNetwork.InRoom && !m_isConsumed) { m_chaseTimeout += Time.fixedDeltaTime; if (m_stopTick > 0f) { m_stopTick -= Time.fixedDeltaTime; } else if (view.IsMine && HasTarget) { Vector3 val = TargetPosition - Center; Vector3 val2 = Vector3.Scale(((Vector3)(ref val)).normalized, CalcMoveSpeed()); rig.AddForce(val2 * Time.fixedDeltaTime, (ForceMode)5); m_movement = ((Vector3)(ref val2)).normalized; CheckForCaughtPlayers(); } } } public void RefreshVolume() { source.volume = GreenDemonChallenge.GreenDemonVolume.Value; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private Vector3 CalcMoveSpeed() { //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)); } private void OnDestroy() { AllDemons.Remove(this); } private void PlayImpactSounds(Collision collision) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rig)) { if (vel > 4f && !ExtGameObject.IsInLayer(((Component)collision.collider).gameObject, m_characterLayerMask)) { view.RPC("RPC_PlayImpactSFX", (RpcTarget)0, new object[1] { ((ContactPoint)(ref collision.contacts[0])).point }); } vel = 0f; } } private void OnCollisionEnter(Collision col) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_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<Character>(); if (componentInParent != null && Object.op_Implicit((Object)(object)componentInParent) && componentInParent.IsLocal && TargetIsValid(componentInParent)) { CatchPlayer(Character.localCharacter); return; } } Rigidbody obj = rig; Vector3 val = col.impulse; Vector3 val2 = Vector3.Scale(((Vector3)(ref val)).normalized, CalcMoveSpeed()); val = TargetPosition - Center; obj.AddForce(val2 + Vector3.Scale(((Vector3)(ref val)).normalized, -CalcMoveSpeed() * 0.5f) * Time.fixedDeltaTime, (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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!ExtGameObject.IsInLayer(col.gameObject, m_characterLayerMask)) { Rigidbody obj = rig; Vector3 val = col.impulse; Vector3 val2 = Vector3.Scale(((Vector3)(ref val)).normalized, CalcMoveSpeed()); val = TargetPosition - Center; obj.AddForce(val2 + Vector3.Scale(((Vector3)(ref val)).normalized, -CalcMoveSpeed()) * Time.fixedDeltaTime, (ForceMode)5); if (view.IsMine) { PlayImpactSounds(col); } } } private void AddPhysics() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (rig == null) { rig = ExtGameObject.GetOrAddComponent<Rigidbody>(((Component)this).gameObject); } rig.mass = mass; centerOfMass = rig.centerOfMass; rig.interpolation = (RigidbodyInterpolation)1; rig.collisionDetectionMode = (CollisionDetectionMode)2; if (collider == null) { collider = ((Component)this).GetComponent<SphereCollider>(); } 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); } } } 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 int RemoveFlairFromBackpack(BackpackData backpackData, BackpackVisuals backpackVisuals) { int num = 0; Flare val2 = default(Flare); 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.RemoveFlairsFormGarbageBags(backpackData.itemSlots[i].prefab, backpackData.itemSlots[i].data); } else if (((Component)val).TryGetComponent<Flare>(ref val2)) { PhotonNetwork.Destroy(((Component)val).gameObject); num++; backpackData.itemSlots[(byte)i].EmptyOut(); backpackVisuals.RefreshVisuals(); } } } return num; } 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_0fb9: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0fc6: Unknown result type (might be due to invalid IL or missing references) //IL_0fcd: Unknown result type (might be due to invalid IL or missing references) //IL_0fde: Expected O, but got Unknown //IL_0c9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ca1: Unknown result type (might be due to invalid IL or missing references) //IL_0b62: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) //IL_0bb6: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0cd2: Unknown result type (might be due to invalid IL or missing references) //IL_0cd7: Unknown result type (might be due to invalid IL or missing references) //IL_0ee2: Unknown result type (might be due to invalid IL or missing references) //IL_0ee7: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0c01: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: Expected O, but got Unknown //IL_0c1e: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c34: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_0214: 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_0d67: Unknown result type (might be due to invalid IL or missing references) //IL_0da0: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0daf: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_0de4: Unknown result type (might be due to invalid IL or missing references) //IL_0df0: Unknown result type (might be due to invalid IL or missing references) //IL_0df5: Unknown result type (might be due to invalid IL or missing references) //IL_0dfa: Unknown result type (might be due to invalid IL or missing references) //IL_0dfd: Unknown result type (might be due to invalid IL or missing references) //IL_0e07: Unknown result type (might be due to invalid IL or missing references) //IL_0e11: Unknown result type (might be due to invalid IL or missing references) //IL_0e16: Unknown result type (might be due to invalid IL or missing references) //IL_0e1f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0f37: Unknown result type (might be due to invalid IL or missing references) //IL_0f3c: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_0a96: Unknown result type (might be due to invalid IL or missing references) //IL_0aa1: Unknown result type (might be due to invalid IL or missing references) //IL_0aa6: Unknown result type (might be due to invalid IL or missing references) GreenDemonChallenge.Log.LogInfo((object)$"Applying effect: {effect} to {character}..."); Vector3 val6; switch (effect) { case GreenDemonCaughtEffects.RANDOM: { GreenDemonCaughtEffects[] array2 = (GreenDemonCaughtEffects[])Enum.GetValues(typeof(GreenDemonCaughtEffects)); GreenDemonCaughtEffects random; do { random = ArrayExtensions.GetRandom<GreenDemonCaughtEffects>(array2); } while (!IsEffectRandoValid(character, random)); 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: val6 = Center - character.Center; character.AddForce(((Vector3)(ref val6)).normalized * 125f / Time.fixedDeltaTime, 1f, 1f); break; case GreenDemonCaughtEffects.FALL: character.Fall(30f, 0f); break; case GreenDemonCaughtEffects.SCOUTMASTER: { Scoutmaster val2 = default(Scoutmaster); if (Scoutmaster.GetPrimaryScoutmaster(ref val2)) { val2.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 num3 = 0; Item currentItem2 = character.data.currentItem; if (IsHoldingSomethingTemporary(character) && Object.op_Implicit((Object)(object)currentItem2)) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); PhotonNetwork.Destroy(((Component)character.data.currentItem).gameObject); num3++; } if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { BackpackData val9 = default(BackpackData); if (IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)currentItem2)) { Backpack val7 = (Backpack)(object)((currentItem2 is Backpack) ? currentItem2 : null); BackpackData val8 = default(BackpackData); if (val7 != null && ((Item)val7).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val8)) { num3 += val8.FilledSlotCount(); num3++; character.player.EmptySlot(Optionable<byte>.Some(((ItemSlot)character.player.backpackSlot).itemSlotID)); PhotonNetwork.Destroy(((Component)character.data.currentItem).gameObject); } } else if (character.player.backpackSlot.hasBackpack && ((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val9)) { num3 += val9.FilledSlotCount(); character.player.EmptySlot(Optionable<byte>.Some(((ItemSlot)character.player.backpackSlot).itemSlotID)); num3++; } } for (int num4 = character.player.itemSlots.Length - 1; num4 >= 0; num4--) { ItemSlot itemSlot2 = character.player.GetItemSlot((byte)num4); if (!itemSlot2.IsEmpty()) { if (IsHoldingOutSlot(character, itemSlot2) && Object.op_Implicit((Object)(object)currentItem2)) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); PhotonNetwork.Destroy(((Component)character.data.currentItem).gameObject); num3++; } else { character.player.EmptySlot(Optionable<byte>.Some((byte)num4)); num3++; } } } character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray<InventorySyncData>(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Removed {num3} item(s)."); break; } case GreenDemonCaughtEffects.NO_FLARE: { int num = 0; Item currentItem = character.data.currentItem; Flare val3 = default(Flare); if (IsHoldingSomethingTemporary(character) && Object.op_Implicit((Object)(object)currentItem)) { if (((Component)currentItem).TryGetComponent<Flare>(ref val3)) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); num++; } else if (UnnamedCompatibilityHandler.Enabled) { num += UnnamedCompatibilityHandler.RemoveFlairsFormGarbageBags(character.player.tempFullSlot.prefab, currentItem.data); } } if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { if (IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)currentItem)) { Backpack val4 = (Backpack)(object)((currentItem is Backpack) ? currentItem : null); BackpackData backpackData = default(BackpackData); BackpackVisuals backpackVisuals = default(BackpackVisuals); if (val4 != null && ((Item)val4).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref backpackData) && ((Component)val4).TryGetComponent<BackpackVisuals>(ref backpackVisuals)) { num += RemoveFlairFromBackpack(backpackData, backpackVisuals); } } else if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren<BackpackVisuals>(true); BackpackData backpackData2 = default(BackpackData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref backpackData2)) { num += RemoveFlairFromBackpack(backpackData2, componentInChildren); } } } for (int num2 = character.player.itemSlots.Length - 1; num2 >= 0; num2--) { ItemSlot itemSlot = character.player.GetItemSlot((byte)num2); if (!itemSlot.IsEmpty()) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot.prefab)) { num += UnnamedCompatibilityHandler.RemoveFlairsFormGarbageBags(itemSlot.prefab, itemSlot.data); } else if (IsHoldingOutSlot(character, itemSlot) && Object.op_Implicit((Object)(object)currentItem)) { if (((Component)currentItem).TryGetComponent<Flare>(ref val3)) { character.player.EmptySlot(character.refs.items.currentSelectedSlot); num++; } } else if (((Component)itemSlot.prefab).TryGetComponent<Flare>(ref val3)) { character.player.EmptySlot(Optionable<byte>.Some((byte)num2)); num++; } } } character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray<InventorySyncData>(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Removed {num} flare(s)."); if (num <= 0 || (int)MapHandler.CurrentMapSegment.biome != 0) { break; } SingleItemSpawner[] componentsInChildren = MapHandler.CurrentMapSegment.segmentParent.GetComponentsInChildren<SingleItemSpawner>(true); SingleItemSpawner[] array = componentsInChildren; foreach (SingleItemSpawner val5 in array) { if (val5.prefab.TryGetComponent<Flare>(ref val3)) { ((MonoBehaviourPun)GreenDemonHandler.Instance).photonView.RPC("RPC_RespawnFlares", (RpcTarget)0, new object[2] { ((Component)val5).transform.position, num }); } } break; } case GreenDemonCaughtEffects.COOKED: { int num5 = 0; Item currentItem3 = character.data.currentItem; if (IsHoldingSomethingTemporary(character)) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(character.player.tempFullSlot.prefab)) { num5 += UnnamedCompatibilityHandler.CookGarbageBags(character.player.tempFullSlot.prefab, character.player.tempFullSlot.data); } else { currentItem3.cooking.FinishCooking(); num5++; } } if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { if (IsHoldingBackpack(character) && Object.op_Implicit((Object)(object)currentItem3)) { Backpack val13 = (Backpack)(object)((currentItem3 is Backpack) ? currentItem3 : null); BackpackData backpackData3 = default(BackpackData); BackpackVisuals backpackVisuals2 = default(BackpackVisuals); if (val13 != null && ((Item)val13).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref backpackData3) && ((Component)val13).TryGetComponent<BackpackVisuals>(ref backpackVisuals2)) { num5 += CookItemFromBackpack(backpackData3, backpackVisuals2); } currentItem3.cooking.FinishCooking(); } else if (character.player.backpackSlot.hasBackpack) { BackpackVisuals componentInChildren2 = ((Component)character.refs.backpackTransform).GetComponentInChildren<BackpackVisuals>(true); BackpackData backpackData4 = default(BackpackData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref backpackData4)) { num5 += CookItemFromBackpack(backpackData4, componentInChildren2); } IntItemData val14 = default(IntItemData); if (((ItemSlot)character.player.backpackSlot).data.TryGetDataEntry<IntItemData>((DataEntryKey)1, ref val14)) { IntItemData obj2 = val14; obj2.Value++; num5++; BackpackOnBackVisuals val15 = (BackpackOnBackVisuals)(object)((componentInChildren2 is BackpackOnBackVisuals) ? componentInChildren2 : null); if (val15 != null) { val15.RefreshCooking(); } } } } IntItemData val16 = default(IntItemData); for (int num6 = character.player.itemSlots.Length - 1; num6 >= 0; num6--) { ItemSlot itemSlot3 = character.player.GetItemSlot((byte)num6); if (!itemSlot3.IsEmpty()) { if (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot3.prefab)) { num5 += UnnamedCompatibilityHandler.CookGarbageBags(itemSlot3.prefab, itemSlot3.data); } else if (IsHoldingOutSlot(character, itemSlot3) && Object.op_Implicit((Object)(object)currentItem3)) { currentItem3.cooking.FinishCooking(); num5++; } else { if (itemSlot3.data.TryGetDataEntry<IntItemData>((DataEntryKey)1, ref val16)) { IntItemData obj3 = val16; obj3.Value++; } num5++; } if ((Object.op_Implicit((Object)(object)itemSlot3.prefab.cooking) && itemSlot3.prefab.cooking.hasExplosion && itemSlot3.prefab.cooking.additionalCookingBehaviors.Any((AdditionalCookingBehavior cb) => cb is CookingBehavior_Explode)) || (UnnamedCompatibilityHandler.Enabled && UnnamedCompatibilityHandler.IsGarbageBag(itemSlot3.prefab))) { GreenDemonChallenge.Log.LogInfo((object)$"{((Component)itemSlot3.prefab).gameObject} has special interaction when being cooked! Automatically droping cooked {((Component)itemSlot3.prefab).gameObject}..."); ((MonoBehaviourPun)character).photonView.RPC("DropItemFromSlotRPC", (RpcTarget)0, new object[2] { itemSlot3.itemSlotID, character.Center + character.data.lookDirection }); } } } character.view.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { IBinarySerializable.ToManagedArray<InventorySyncData>(new InventorySyncData(character.player.itemSlots, character.player.backpackSlot, character.player.tempFullSlot)), false }); GreenDemonChallenge.Log.LogInfo((object)$"Cooked {num5} 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<int>((IEnumerable<int>)Action_RandomMushroomEffect.BadEffects))); break; case GreenDemonCaughtEffects.EXPLODE: { GameObject val12 = PhotonNetwork.Instantiate("0_Items/Dynamite", character.Center, Quaternion.identity, (byte)0, (object[])null); Dynamite component4 = val12.GetComponent<Dynamite>(); component4.LightFlare(); component4.startingFuseTime = 0f; break; } case GreenDemonCaughtEffects.TORNADO: { GameObject val11 = PhotonNetwork.Instantiate("Tornado", character.Center, Quaternion.identity, (byte)0, (object[])null); Tornado component3 = val11.GetComponent<Tornado>(); component3.tornadoLifetimeMax = 12f; component3.tornadoLifetimeMin = 20f; component3.force = 75f; component3.selectNewTargetInSeconds = 35f; component3.targetParent = ((Component)character.refs.hip).transform; component3.target = ((Component)character).transform; 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) { Item component2 = PhotonNetwork.Instantiate("0_Items/legocool.LuckyBlocks:LuckyBlock", ((Component)character.refs.head).transform.position + Vector3.up * 1.85f, Quaternion.identity, (byte)0, (object[])null).GetComponent<Item>(); component2.lastThrownCharacter = character; val6 = ((Component)character.refs.head).transform.position - ((Component)component2).transform.position; Vector3 val10 = ((Vector3)(ref val6)).normalized * 25f / Time.deltaTime; component2.rig.AddForce(val10, (ForceMode)5); } 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: { BeeSwarm component = PhotonNetwork.Instantiate("BeeSwarm", character.Head, Quaternion.identity, (byte)0, (object[])null).GetComponent<BeeSwarm>(); ((MonoBehaviourPun)component).photonView.RPC("SetBeesAngryRPC", (RpcTarget)0, new object[1] { true }); break; } case GreenDemonCaughtEffects.SLIP: { BananaPeel obj = Object.FindAnyObjectByType<BananaPeel>(); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null) ?? PhotonNetwork.InstantiateItem("Berrynana Peel Pink Variant", character.Head, Quaternion.identity); val.GetComponent<PhotonView>().RPC("RPCA_TriggerBanana", (RpcTarget)0, new object[1] { character.view.ViewID }); 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"); } } 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; } } private static bool IsEffectRandoValid(Character c, GreenDemonCaughtEffects eff) { switch (eff) { case GreenDemonCaughtEffects.RANDOM: return false; case GreenDemonCaughtEffects.FULL_POISON: case GreenDemonCaughtEffects.HALF_POISON: case GreenDemonCaughtEffects.FULL_SPORES: case GreenDemonCaughtEffects.HALF_SPORES: case GreenDemonCaughtEffects.EPPY: case GreenDemonCaughtEffects.BAD_SHROOMBERRY: return !c.data.isSkeleton; case GreenDemonCaughtEffects.BEES: return !c.data.isSkeleton && (!RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)1300, false) >= 1); case GreenDemonCaughtEffects.SCORPION: return !c.data.isSkeleton && (!RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2125, false) >= 1); case GreenDemonCaughtEffects.SET_FIRE: return UnnamedCompatibilityHandler.Enabled && !c.data.isSkeleton; case GreenDemonCaughtEffects.FIREBALL: case GreenDemonCaughtEffects.UNNAMIFY: return UnnamedCompatibilityHandler.Enabled; case GreenDemonCaughtEffects.SPAWN_LUCKY_BLOCK: return LuckyBlocksCompatibilityHandler.Enabled; case GreenDemonCaughtEffects.NO_FLARE: return !Ascents.shouldSpawnFlare && IsAFlareBearer(c); case GreenDemonCaughtEffects.SCOUTMASTER: return RunSettings.IsCustomRun ? (RunSettings.GetValue((SETTINGTYPE)2700, false) >= 1) : (Ascents.currentAscent < 0); case GreenDemonCaughtEffects.ZOMBIFY: return Ascents.shouldSpawnZombie; case GreenDemonCaughtEffects.TORNADO: return !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2100, false) >= 1; case GreenDemonCaughtEffects.MANDRAKE: return !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2600, false) >= 1; case GreenDemonCaughtEffects.DYNA_BRUH: return !RunSettings.IsCustomRun || RunSettings.GetValue((SETTINGTYPE)2300, false) >= 1; default: return true; } } private static bool IsAFlareBearer(Character character) { if (!UnnamedCompatibilityHandler.Enabled) { if (!((ItemSlot)character.player.backpackSlot).IsEmpty()) { 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) { BackpackVisuals componentInChildren = ((Component)character.refs.backpackTransform).GetComponentInChildren<BackpackVisuals>(true); if (componentInChildren != null) { ItemSlot[] itemSlots2 = componentInChildren.GetBackpackData().itemSlots; foreach (ItemSlot val3 in itemSlots2) { if (!val3.IsEmpty() && val3.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((ST