Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Fall Guys v1.0.0
BepInEx/plugins/Omniscye-Empress_Fall_Guys/EmpressFallGuys.dll
Decompiled 9 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using TMPro; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressFallGuys")] [assembly: AssemblyTitle("EmpressFallGuys")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.FallGuys { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.empress.repo.fallguys", "Empress Fall Guys", "1.0.0")] public sealed class EmpressFallGuysPlugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.fallguys"; public const string PluginName = "Empress Fall Guys"; public const string PluginVersion = "1.0.0"; public const string LevelName = "Level - Empress Fall Guys"; public const string DisplayName = "Empress - Fall Guys"; internal const byte FinishEventCode = 176; private static bool _photonHooked; private Harmony _harmony; internal static EmpressFallGuysPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static FallGuysSettings Settings { get; private set; } internal static Level FallGuysLevel { get; private set; } internal static string PluginDirectory { get; private set; } private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Settings = new FallGuysSettings(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); FallGuysAssets.Load(); FallGuysLevel = FallGuysLevelRegistry.RegisterLevel(); _harmony = new Harmony("com.empress.repo.fallguys"); _harmony.PatchAll(typeof(EmpressFallGuysPlugin).Assembly); FallGuysRuntime.EnsureHost(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress Fall Guys v1.0.0 loaded. Level registered: Level - Empress Fall Guys"); } private void OnDestroy() { RemovePhotonHook(); } internal static bool IsFallGuysLevel(Level level) { if ((Object)(object)level != (Object)null) { return ((Object)level).name == "Level - Empress Fall Guys"; } return false; } internal static void EnsurePhotonHooked() { if (!_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; networkingClient.EventReceived += OnPhotonEvent; _photonHooked = true; } } } internal static void RemovePhotonHook() { if (_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; } _photonHooked = false; } } private static void OnPhotonEvent(EventData ev) { if (ev.CustomData is object[] data && ev.Code == 176) { FallGuysRuntime instance = FallGuysRuntime.Instance; if ((Object)(object)instance != (Object)null) { instance.ReceiveFinish(data); } } } internal static void DebugLog(string message) { if (Settings != null && Settings.DebugLogs.Value) { Log.LogInfo((object)message); } } internal static void RaiseToAll(byte code, object[] data) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (!PhotonNetwork.InRoom) { if (code == 176) { FallGuysRuntime.Instance?.ReceiveFinish(data); } } else { RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable); } } } internal sealed class FallGuysSettings { public readonly ConfigEntry<bool> ForceLevel; public readonly ConfigEntry<float> MasterVolume; public readonly ConfigEntry<float> VoidY; public readonly ConfigEntry<float> FinishRadius; public readonly ConfigEntry<int> FinishReward; public readonly ConfigEntry<bool> DebugLogs; public readonly ConfigEntry<float> SpawnX; public readonly ConfigEntry<float> SpawnY; public readonly ConfigEntry<float> SpawnZ; public readonly ConfigEntry<float> SpawnYaw; public readonly ConfigEntry<KeyCode> CaptureSpawnKey; public readonly ConfigEntry<bool> Hazards; public readonly ConfigEntry<bool> UnlimitedStamina; public readonly ConfigEntry<float> JumpBoost; public Vector3 SpawnPosition => new Vector3(SpawnX.Value, SpawnY.Value, SpawnZ.Value); public Quaternion SpawnRotation => Quaternion.Euler(0f, SpawnYaw.Value, 0f); public FallGuysSettings(ConfigFile config) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown DebugLogs = config.Bind<bool>("Debug", "DebugLogs", false, "Logs verbose Empress Fall Guys diagnostics. Off by default."); ForceLevel = config.Bind<bool>("Debug", "ForceLevel", false, "Forces every real run level to load Empress - Fall Guys. Useful for testing."); MasterVolume = config.Bind<float>("Audio", "MasterVolume", 0.2f, new ConfigDescription("Volume of the Fall Guys music.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); VoidY = config.Bind<float>("Level", "VoidY", -80f, new ConfigDescription("Players below this Y position are returned to the start.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-250f, 50f), Array.Empty<object>())); FinishRadius = config.Bind<float>("Level", "FinishRadius", 8f, new ConfigDescription("Distance from the crown needed to finish the level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 30f), Array.Empty<object>())); FinishReward = config.Bind<int>("Reward", "FinishReward", 50, new ConfigDescription("Money in thousands awarded to the whole lobby when the crown is reached.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>())); SpawnX = config.Bind<float>("Spawn", "SpawnX", -20f, "World X where the truck opens and players spawn. Stand where you want the start and press the capture key to set this."); SpawnY = config.Bind<float>("Spawn", "SpawnY", 0.5f, "World Y of the spawn point."); SpawnZ = config.Bind<float>("Spawn", "SpawnZ", -22f, "World Z of the spawn point."); SpawnYaw = config.Bind<float>("Spawn", "SpawnYaw", -90f, new ConfigDescription("Facing of the spawn in degrees.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>())); CaptureSpawnKey = config.Bind<KeyCode>("Spawn", "CaptureSpawnKey", (KeyCode)289, "Press while standing in the level to set the spawn and respawn to your current position."); Hazards = config.Bind<bool>("Level", "Hazards", true, "When on, the moving obstacles kill players on contact."); UnlimitedStamina = config.Bind<bool>("Level", "UnlimitedStamina", true, "When on, players never run out of sprint stamina on this level."); JumpBoost = config.Bind<float>("Level", "JumpBoost", 1.98f, new ConfigDescription("Jump strength multiplier on this level. 1 is normal, higher jumps higher.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2.5f), Array.Empty<object>())); } } internal static class FallGuysAccess { private delegate void ModuleSetAllChecklistDelegate(Module module); private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info); private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone"); private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera"); private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor"); private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew"); private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious"); private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp"); private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor"); private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew"); private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious"); private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance"); private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew"); private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious"); private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance"); private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew"); private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious"); private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady"); private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady"); private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned"); private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned"); private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious"); private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); private static readonly FieldInfo PlayerAvatarPlayerNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName"); private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo PlayerTumblePhysGrabObjectField = AccessTools.Field(typeof(PlayerTumble), "physGrabObject"); private static readonly FieldInfo PlayerAvatarRbField = AccessTools.Field(typeof(PlayerAvatar), "rb"); private static readonly FieldInfo PlayerAvatarVisualPositionField = AccessTools.Field(typeof(PlayerAvatarVisuals), "visualPosition"); private static readonly FieldInfo PlayerControllerRbField = AccessTools.Field(typeof(PlayerController), "rb"); private static readonly FieldInfo PlayerControllerVelocityField = AccessTools.Field(typeof(PlayerController), "Velocity"); private static readonly FieldInfo PlayerControllerVelocityRelativeField = AccessTools.Field(typeof(PlayerController), "VelocityRelative"); private static readonly FieldInfo PlayerControllerVelocityRelativeNewField = AccessTools.Field(typeof(PlayerController), "VelocityRelativeNew"); private static readonly FieldInfo PlayerControllerMoveForceTimerField = AccessTools.Field(typeof(PlayerController), "MoveForceTimer"); private static readonly MethodInfo PlayerControllerInputDisableMethod = AccessTools.Method(typeof(PlayerController), "InputDisable", new Type[1] { typeof(float) }, (Type[])null); private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints"); private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted"); private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList"); private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone"); private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX"); private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY"); private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First"); private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom"); private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null); private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null); private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod); public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentFogColorField, director, color); SetField(EnvironmentFogColorNewField, director, color); SetField(EnvironmentFogColorPreviousField, director, color); SetField(EnvironmentFogStartDistanceField, director, startDistance); SetField(EnvironmentFogStartDistanceNewField, director, startDistance); SetField(EnvironmentFogStartDistancePreviousField, director, startDistance); SetField(EnvironmentFogEndDistanceField, director, endDistance); SetField(EnvironmentFogEndDistanceNewField, director, endDistance); SetField(EnvironmentFogEndDistancePreviousField, director, endDistance); } public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentAmbientColorField, director, ambient); SetField(EnvironmentAmbientColorNewField, director, ambient); SetField(EnvironmentAmbientColorPreviousField, director, ambient); SetField(EnvironmentAmbientColorAdaptationField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation); } public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value) { SetField(EnvironmentDarkAdaptationLerpField, director, value); } public static Camera GetEnvironmentMainCamera(EnvironmentDirector director) { return Get<Camera>(EnvironmentMainCameraField, director); } public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera) { SetField(EnvironmentMainCameraField, director, camera); } public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value) { SetField(EnvironmentSetupDoneField, director, value); } public static void SetAllPlayersReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorAllPlayersReadyField, generator, value); } public static bool GetAllPlayersReady(LevelGenerator generator) { return GetBool(LevelGeneratorAllPlayersReadyField, generator); } public static void SetLevelPrevious(RunManager manager, Level level) { SetField(RunManagerLevelPreviousField, manager, level); } public static void SetEnemyReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorEnemyReadyField, generator, value); } public static void SetModulesSpawned(LevelGenerator generator, int value) { SetField(LevelGeneratorModulesSpawnedField, generator, value); } public static void SetPlayerSpawnedCount(LevelGenerator generator, int value) { SetField(LevelGeneratorPlayerSpawnedField, generator, value); } public static int GetPlayerSpawnedCount(LevelGenerator generator) { return GetInt(LevelGeneratorPlayerSpawnedField, generator); } public static bool GetIsDisabled(PlayerAvatar avatar) { return GetBool(PlayerAvatarIsDisabledField, avatar); } public static bool GetDeadSet(PlayerAvatar avatar) { return GetBool(PlayerAvatarDeadSetField, avatar); } public static string GetPlayerName(PlayerAvatar avatar) { return Get<string>(PlayerAvatarPlayerNameField, avatar); } public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar) { return Get<PlayerTumble>(PlayerAvatarTumbleField, avatar); } public static void ResetRoundExtraction(RoundDirector director) { SetField(RoundDirectorExtractionPointsField, director, 0); SetField(RoundDirectorExtractionPointsCompletedField, director, 0); Get<List<GameObject>>(RoundDirectorExtractionPointListField, director)?.Clear(); } public static void ConfigureStartRoomModule(Module module, int gridX, int gridY) { ModuleSetAllChecklistCall?.Invoke(module); SetField(ModuleSetupDoneField, module, true); SetField(ModuleStartRoomField, module, true); SetField(ModuleFirstField, module, true); SetField(ModuleGridXField, module, gridX); SetField(ModuleGridYField, module, gridY); } public static void MarkLevelPointInStartRoom(LevelPoint point, bool value) { SetField(LevelPointInStartRoomField, point, value); } public static void GenerateDone(LevelGenerator generator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo)); } public static void TeleportLocalPlayer(Vector3 position, Quaternion rotation) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerController.instance.playerAvatarScript : null); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)val.physGrabber != (Object)null) { val.physGrabber.ReleaseObject(-1, 0.1f); } PlayerTumble playerTumble = GetPlayerTumble(val); PhysGrabObject val2 = Get<PhysGrabObject>(PlayerTumblePhysGrabObjectField, playerTumble); if ((Object)(object)val2 != (Object)null) { val2.Teleport(position, rotation); } Rigidbody val3 = Get<Rigidbody>(PlayerAvatarRbField, val); if ((Object)(object)val3 != (Object)null) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; val3.position = position; val3.rotation = rotation; } ((Component)val).transform.SetPositionAndRotation(position, rotation); if ((Object)(object)val.playerTransform != (Object)null) { val.playerTransform.SetPositionAndRotation(position, rotation); } if ((Object)(object)val.playerAvatarVisuals != (Object)null) { ((Component)val.playerAvatarVisuals).transform.position = position; SetField(PlayerAvatarVisualPositionField, val.playerAvatarVisuals, position); } PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null) { ((Component)instance).transform.SetPositionAndRotation(position, rotation); Rigidbody val4 = Get<Rigidbody>(PlayerControllerRbField, instance); if ((Object)(object)val4 != (Object)null) { val4.velocity = Vector3.zero; val4.angularVelocity = Vector3.zero; val4.position = position; val4.rotation = rotation; } SetField(PlayerControllerVelocityField, instance, Vector3.zero); SetField(PlayerControllerVelocityRelativeField, instance, Vector3.zero); SetField(PlayerControllerVelocityRelativeNewField, instance, Vector3.zero); SetField(PlayerControllerMoveForceTimerField, instance, 0f); PlayerControllerInputDisableMethod?.Invoke(instance, new object[1] { 0.25f }); } } private static T Get<T>(FieldInfo field, object instance) where T : class { if (field == null || instance == null) { return null; } return field.GetValue(instance) as T; } private static bool GetBool(FieldInfo field, object instance) { if (field == null || instance == null) { return false; } object value = field.GetValue(instance); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private static int GetInt(FieldInfo field, object instance) { if (field == null || instance == null) { return 0; } object value = field.GetValue(instance); if (value is int) { return (int)value; } return 0; } private static void SetField(FieldInfo field, object instance, object value) { if (!(field == null) && instance != null) { field.SetValue(instance, value); } } private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true); } } internal static class FallGuysAssets { private const string BundleFileName = "empress_fall_guys_level.empress"; private const string LevelPrefabName = "EmpressFallGuysLevel"; public static GameObject LevelPrefab { get; private set; } public static void Load() { if ((Object)(object)LevelPrefab != (Object)null) { return; } string text = Path.Combine(EmpressFallGuysPlugin.PluginDirectory, "bundles", "empress_fall_guys_level.empress"); if (!File.Exists(text)) { EmpressFallGuysPlugin.Log.LogError((object)("Missing Empress Fall Guys bundle: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { EmpressFallGuysPlugin.Log.LogError((object)("Could not load Empress Fall Guys bundle: " + text)); return; } LevelPrefab = val.LoadAsset<GameObject>("EmpressFallGuysLevel"); if ((Object)(object)LevelPrefab == (Object)null) { EmpressFallGuysPlugin.Log.LogError((object)"Could not find prefab EmpressFallGuysLevel in empress_fall_guys_level.empress."); } else { EmpressFallGuysPlugin.DebugLog("Loaded EmpressFallGuysLevel from empress_fall_guys_level.empress."); } } } internal static class FallGuysLevelRegistry { private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3"); private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject"); private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject"); public static Level RegisterLevel() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Level val = ScriptableObject.CreateInstance<Level>(); ((Object)val).name = "Level - Empress Fall Guys"; val.NarrativeName = "Empress - Fall Guys"; LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>(); ((Object)val2).name = "Valuables - Empress Fall Guys"; val2.tiny = new List<PrefabRef>(); val2.small = new List<PrefabRef>(); val2.medium = new List<PrefabRef>(); val2.big = new List<PrefabRef>(); val2.wide = new List<PrefabRef>(); val2.tall = new List<PrefabRef>(); val2.veryTall = new List<PrefabRef>(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 }); SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>()); SetLevelField(val, "FogColor", (object)new Color(0.62f, 0.78f, 0.95f)); SetLevelField(val, "FogStartDistance", 70f); SetLevelField(val, "FogEndDistance", 650f); SetLevelField(val, "AmbientColor", (object)new Color(0.88f, 0.82f, 0.72f)); SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.45f, 0.5f, 0.58f)); SetLevelField(val, "ColorTemperature", 8f); SetLevelField(val, "ColorFilter", (object)new Color(1f, 0.92f, 0.82f, 1f)); SetLevelField(val, "BloomIntensity", 0.45f); SetLevelField(val, "BloomThreshold", 1.15f); SetLevelField(val, "VignetteColor", (object)new Color(0f, 0f, 0f, 1f)); SetLevelField(val, "VignetteIntensity", 0.18f); SetLevelField(val, "VignetteSmoothness", 0.7f); SetLevelField(val, "DiscordIcon", "level"); EnsureLevelFieldInstance(val, "LoadingGraphic01"); EnsureLevelFieldInstance(val, "LoadingGraphic02"); EnsureLevelFieldInstance(val, "LoadingGraphic03"); EnsureLevelFieldInstance(val, "ConnectObject"); EnsureLevelFieldInstance(val, "BlockObject"); LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>(); ((Object)val3).name = "Empress Fall Guys Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>(); LevelContentConnectObjectRef.Invoke(val3) = null; LevelContentBlockObjectRef.Invoke(val3) = null; Levels.RegisterLevel(val3); return val; } private static void SetLevelField(Level level, string fieldName, object value) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value)) { fieldInfo.SetValue(level, value); } } private static void EnsureLevelFieldInstance(Level level, string fieldName) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null) { object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType); fieldInfo.SetValue(level, uninitializedObject); } } } [HarmonyPatch(typeof(RunManager), "SetRunLevel")] internal static class FallGuysPatchSetRunLevel { private static void Postfix(RunManager __instance) { if (EmpressFallGuysPlugin.Settings != null && EmpressFallGuysPlugin.Settings.ForceLevel.Value && !((Object)(object)EmpressFallGuysPlugin.FallGuysLevel == (Object)null)) { __instance.levelCurrent = EmpressFallGuysPlugin.FallGuysLevel; } } } [HarmonyPatch(typeof(LevelGenerator), "Generate")] internal static class FallGuysPatchGenerate { private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result) { if (!EmpressFallGuysPlugin.IsFallGuysLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = FallGuysRuntime.EnsureHost().GenerateLevel(__instance); return false; } } [HarmonyPatch(typeof(LevelPoint), "NavMeshCheck")] internal static class FallGuysPatchNavMeshCheck { private static bool Prefix(ref IEnumerator __result) { if (!EmpressFallGuysPlugin.IsFallGuysLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = FallGuysRuntime.EmptyCoroutine(); return false; } } [HarmonyPatch(typeof(EnvironmentDirector), "Setup")] internal static class FallGuysPatchEnvironmentSetup { private static bool Prefix(EnvironmentDirector __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00b9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return true; } Level level = LevelGenerator.Instance.Level; if (!Object.op_Implicit((Object)(object)level) || !EmpressFallGuysPlugin.IsFallGuysLevel(level)) { return true; } Color fogColor = level.FogColor; Color ambientColor = level.AmbientColor; FallGuysAccess.SetEnvironmentFog(__instance, fogColor, level.FogStartDistance, level.FogEndDistance); FallGuysAccess.SetEnvironmentAmbient(__instance, ambientColor, level.AmbientColorAdaptation); RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)1; RenderSettings.fogColor = fogColor; RenderSettings.fogStartDistance = level.FogStartDistance; RenderSettings.fogEndDistance = level.FogEndDistance; RenderSettings.ambientLight = ambientColor; RenderSettings.ambientMode = (AmbientMode)3; Camera val = FallGuysAccess.GetEnvironmentMainCamera(__instance); if (!Object.op_Implicit((Object)(object)val)) { val = Camera.main; FallGuysAccess.SetEnvironmentMainCamera(__instance, val); } if (Object.op_Implicit((Object)(object)val)) { val.clearFlags = (CameraClearFlags)2; val.backgroundColor = fogColor; val.farClipPlane = 950f; } FallGuysAccess.SetEnvironmentDarkAdaptation(__instance, 0.25f); FallGuysAccess.SetEnvironmentSetupDone(__instance, value: true); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class FallGuysPatchLoadingUi { private static Sprite _loadingSprite; private static bool _loadingSpriteAttempted; private static void Postfix(LoadingUI __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (EmpressFallGuysPlugin.IsFallGuysLevel(Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.Level : null)) { ApplyLoadingImage(__instance); if ((Object)(object)__instance.levelNumberText != (Object)null) { ((TMP_Text)__instance.levelNumberText).text = "FINAL FALL"; ((Graphic)__instance.levelNumberText).color = new Color(1f, 0.74f, 0.36f); ((Component)__instance.levelNumberText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNumberText).transform.SetAsLastSibling(); } if ((Object)(object)__instance.levelNameText != (Object)null) { ((TMP_Text)__instance.levelNameText).text = "Empress - Fall Guys"; ((Graphic)__instance.levelNameText).color = new Color(1f, 0.92f, 0.74f); ((Component)__instance.levelNameText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNameText).transform.SetAsLastSibling(); ApplyHint(__instance); } } } private static void ApplyLoadingImage(LoadingUI loadingUI) { Sprite loadingSprite = GetLoadingSprite(); if (!((Object)(object)loadingSprite == (Object)null)) { SetGraphic(loadingUI.loadingGraphic01, loadingSprite); SetGraphic(loadingUI.loadingGraphic02, loadingSprite); SetGraphic(loadingUI.loadingGraphic03, loadingSprite); } } private static void SetGraphic(Image image, Sprite sprite) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)image == (Object)null)) { image.sprite = sprite; ((Graphic)image).color = Color.white; image.preserveAspect = true; ((Component)image).gameObject.SetActive(true); } } private static Sprite GetLoadingSprite() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (_loadingSpriteAttempted) { return _loadingSprite; } _loadingSpriteAttempted = true; string path = Path.Combine(EmpressFallGuysPlugin.PluginDirectory, "loading.png"); if (!File.Exists(path)) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { return null; } _loadingSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); return _loadingSprite; } private static void ApplyHint(LoadingUI loadingUI) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)loadingUI == (Object)null || (Object)(object)loadingUI.levelNameText == (Object)null) { return; } Transform parent = ((TMP_Text)loadingUI.levelNameText).transform.parent; if (!((Object)(object)parent == (Object)null)) { Transform val = parent.Find("Empress Fall Guys Loading Hint"); TextMeshProUGUI val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate<TextMeshProUGUI>(loadingUI.levelNameText, parent); ((Object)val2).name = "Empress Fall Guys Loading Hint"; } ((TMP_Text)val2).text = "Get to the crown. Falling just means trying again."; ((Graphic)val2).color = new Color(0.82f, 0.9f, 1f); ((TMP_Text)val2).fontSize = Mathf.Max(15f, ((TMP_Text)loadingUI.levelNameText).fontSize * 0.45f); ((TMP_Text)val2).enableAutoSizing = true; ((TMP_Text)val2).fontSizeMin = 12f; ((TMP_Text)val2).fontSizeMax = ((TMP_Text)val2).fontSize; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Component)val2).gameObject.SetActive(true); RectTransform rectTransform = ((TMP_Text)val2).rectTransform; RectTransform rectTransform2 = ((TMP_Text)loadingUI.levelNameText).rectTransform; rectTransform.anchorMin = rectTransform2.anchorMin; rectTransform.anchorMax = rectTransform2.anchorMax; rectTransform.pivot = rectTransform2.pivot; rectTransform.anchoredPosition = rectTransform2.anchoredPosition + new Vector2(0f, -72f); rectTransform.sizeDelta = new Vector2(Mathf.Max(rectTransform2.sizeDelta.x, 760f), 90f); ((TMP_Text)val2).transform.SetAsLastSibling(); } } } [HarmonyPatch(typeof(ItemManager), "TurnOffIconLights")] internal static class FallGuysPatchIconLights { private static bool Prefix(ItemManager __instance, ref IEnumerator __result) { if (!EmpressFallGuysPlugin.IsFallGuysLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = SafeTurnOffIconLights(__instance); return false; } private static IEnumerator SafeTurnOffIconLights(ItemManager itemManager) { if (!((Object)(object)itemManager.itemIconLights == (Object)null)) { while ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { yield return (object)new WaitForSeconds(0.2f); } itemManager.itemIconLights.SetActive(false); } } } internal sealed class FallGuysRuntime : MonoBehaviour { private static readonly Dictionary<string, Color> SolidColors = new Dictionary<string, Color> { { "Dark Blue New", new Color(0f, 0.592f, 0.961f) }, { "Light Blue New", new Color(0.247f, 0.769f, 0.973f) }, { "background New", new Color(0.166f, 0.558f, 0.906f) }, { "Pink New", new Color(0.855f, 0.278f, 0.631f) }, { "Purple New", new Color(0.584f, 0.271f, 0.698f) }, { "Yellow New", new Color(0.863f, 0.655f, 0.078f) }, { "Light Yellow New", new Color(0.969f, 0.875f, 0.671f) }, { "Dark Grey New", new Color(0.906f, 0.906f, 0.906f) }, { "皮肤", new Color(0.906f, 0.906f, 0.906f) }, { "眼白", new Color(0.906f, 0.906f, 0.906f) }, { "ENV", new Color(0f, 0f, 0f) } }; private static readonly string[] HazardDecorKeywords = new string[6] { "character", "paimon", "派蒙", "crown", "coin", "sun" }; private static readonly Dictionary<int, Mesh> DoubleSidedCache = new Dictionary<int, Mesh>(); private Transform _root; private Transform _moduleRoot; private Transform _levelInstance; private Transform _finishPoint; private Vector3 _respawnPosition; private Quaternion _respawnRotation; private List<AudioSource> _musicSources = new List<AudioSource>(); private int _sceneHandle = -1; private bool _active; private bool _finishAnnounced; private bool _finishSequenceStarted; private float _finishCheckTimer; private float _respawnLockedUntil; private float _baseJumpForce; private bool _jumpCaptured; public static FallGuysRuntime Instance { get; private set; } internal bool Active => _active; public static FallGuysRuntime EnsureHost() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Empress Fall Guys Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<FallGuysRuntime>(); return Instance; } public static IEnumerator EmptyCoroutine() { yield break; } private void Awake() { Instance = this; } private void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) HandleSceneTransition(); if (!_active) { return; } if (!EmpressFallGuysPlugin.IsFallGuysLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { Deactivate(); return; } if (Input.GetKeyDown(EmpressFallGuysPlugin.Settings.CaptureSpawnKey.Value)) { CaptureSpawnHere(); } if (EmpressFallGuysPlugin.Settings.UnlimitedStamina.Value) { RefillStamina(); } ApplyJumpBoost(); UpdateMusic(); CheckLocalVoidRespawn(); if (SemiFunc.IsMasterClientOrSingleplayer() && !_finishAnnounced) { CheckFinish(); } } public IEnumerator GenerateLevel(LevelGenerator generator) { EmpressFallGuysPlugin.EnsurePhotonHooked(); FallGuysAssets.Load(); yield return (object)new WaitForSeconds(0.2f); if (!SemiFunc.IsMultiplayer()) { FallGuysAccess.SetAllPlayersReady(generator, value: true); } while (!FallGuysAccess.GetAllPlayersReady(generator)) { generator.State = (LevelState)1; yield return (object)new WaitForSeconds(0.1f); } yield return (object)new WaitForSeconds(0.2f); generator.Level = RunManager.instance.levelCurrent; FallGuysAccess.SetLevelPrevious(RunManager.instance, generator.Level); generator.Generated = false; FallGuysAccess.SetEnemyReady(generator, value: true); FallGuysAccess.SetModulesSpawned(generator, 0); FallGuysAccess.SetPlayerSpawnedCount(generator, 0); generator.LevelPathPoints = new List<LevelPoint>(); generator.LevelPathTruck = null; if ((Object)(object)RoundDirector.instance != (Object)null) { FallGuysAccess.ResetRoundExtraction(RoundDirector.instance); } generator.State = (LevelState)3; BuildLevel(generator); FallGuysRuntime fallGuysRuntime = this; Scene activeScene = SceneManager.GetActiveScene(); fallGuysRuntime._sceneHandle = ((Scene)(ref activeScene)).handle; yield return (object)new WaitForSeconds(0.2f); if (Object.op_Implicit((Object)(object)EnvironmentDirector.Instance)) { EnvironmentDirector.Instance.Setup(); } if (Object.op_Implicit((Object)(object)PostProcessing.Instance)) { PostProcessing.Instance.Setup(); } if (Object.op_Implicit((Object)(object)LevelMusic.instance)) { LevelMusic.instance.Setup(); } if (Object.op_Implicit((Object)(object)ConstantMusic.instance)) { ConstantMusic.instance.Setup(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { generator.NavMeshSetup(); yield return null; while ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList.Count == 0) { generator.State = (LevelState)12; yield return (object)new WaitForSeconds(0.1f); } generator.PlayerSpawn(); yield return null; while (FallGuysAccess.GetPlayerSpawnedCount(generator) < GameDirector.instance.PlayerList.Count) { generator.State = (LevelState)13; yield return (object)new WaitForSeconds(0.1f); } if (SemiFunc.IsMultiplayer()) { generator.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty<object>()); } else { FallGuysAccess.GenerateDone(generator); } } else { while (!generator.Generated) { yield return (object)new WaitForSeconds(0.1f); } } yield return (object)new WaitForSeconds(0.5f); Activate(); } private void BuildLevel(LevelGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)generator.LevelParent != (Object)null) { for (int num = generator.LevelParent.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)generator.LevelParent.transform.GetChild(num)).gameObject); } } GameObject val = new GameObject("Empress Fall Guys Root"); val.transform.SetParent(generator.LevelParent.transform, false); _root = val.transform; GameObject val2 = new GameObject("Empress Fall Guys Module"); val2.transform.SetParent(val.transform, false); _moduleRoot = val2.transform; val2.AddComponent<PhotonView>().ObservedComponents = new List<Component>(); FallGuysAccess.ConfigureStartRoomModule(val2.AddComponent<Module>(), 0, 0); val2.AddComponent<StartRoom>(); GameObject levelPrefab = FallGuysAssets.LevelPrefab; if ((Object)(object)levelPrefab != (Object)null) { bool activeSelf = levelPrefab.activeSelf; levelPrefab.SetActive(false); GameObject val3 = Object.Instantiate<GameObject>(levelPrefab, val2.transform, false); levelPrefab.SetActive(activeSelf); ((Object)val3).name = "Empress Fall Guys Course"; _levelInstance = val3.transform; RemoveLeftovers(_levelInstance); FixMaterials(_levelInstance); DisableLevelLights(_levelInstance); MakeDoubleSided(_levelInstance); BuildHurtZones(_levelInstance); val3.SetActive(true); } _respawnPosition = EmpressFallGuysPlugin.Settings.SpawnPosition; _respawnRotation = EmpressFallGuysPlugin.Settings.SpawnRotation; _finishPoint = FindInLevel("COINS-and-CROWN_SF") ?? FindInLevel("CROWN"); RoomVolume roomVolume = BuildRoomVolume(val2); ConfigureMusicAndTriggers(); BuildSpawnPoints(val2.transform, roomVolume, generator); } private RoomVolume BuildRoomVolume(GameObject moduleObject) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Bounds val = CalculateCourseBounds(moduleObject, _respawnPosition); GameObject val2 = new GameObject("Empress Fall Guys Room Volume"); val2.transform.SetParent(moduleObject.transform, false); RoomVolume result = val2.AddComponent<RoomVolume>(); BoxCollider obj = val2.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = true; obj.center = ((Bounds)(ref val)).center; obj.size = new Vector3(Mathf.Max(((Bounds)(ref val)).size.x + 90f, 420f), Mathf.Max(((Bounds)(ref val)).size.y + 140f, 220f), Mathf.Max(((Bounds)(ref val)).size.z + 90f, 180f)); return result; } private Bounds CalculateCourseBounds(GameObject root, Vector3 fallback) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(fallback, Vector3.one); Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!flag) { bounds = componentsInChildren[i].bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } } Collider[] componentsInChildren2 = root.GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if (!flag) { bounds = componentsInChildren2[j].bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren2[j].bounds); } } return bounds; } private void ConfigureMusicAndTriggers() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) _musicSources = new List<AudioSource>(); if ((Object)(object)_levelInstance == (Object)null) { return; } AudioSource[] componentsInChildren = ((Component)_levelInstance).GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.clip == (Object)null)) { val.spatialBlend = 0f; val.loop = true; val.playOnAwake = false; val.volume = EmpressFallGuysPlugin.Settings.MasterVolume.Value; _musicSources.Add(val); } } float num = _respawnPosition.y - 5f; Transform[] componentsInChildren2 = ((Component)_levelInstance).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren2) { if (((Object)val2).name.IndexOf("KillTrigger", StringComparison.OrdinalIgnoreCase) < 0) { continue; } bool flag = val2.position.y < num; Collider[] componentsInChildren3 = ((Component)val2).GetComponentsInChildren<Collider>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if (flag) { componentsInChildren3[k].isTrigger = true; if ((Object)(object)((Component)componentsInChildren3[k]).GetComponent<FallGuysRespawnTrigger>() == (Object)null) { ((Component)componentsInChildren3[k]).gameObject.AddComponent<FallGuysRespawnTrigger>(); } } else { componentsInChildren3[k].enabled = false; } } } } private void BuildSpawnPoints(Transform parent, RoomVolume roomVolume, LevelGenerator generator) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _respawnRotation * Vector3.right; Vector3 val2 = _respawnRotation * Vector3.forward; Vector3[] array = (Vector3[])(object)new Vector3[4] { Vector3.zero, val * 1.3f, -val * 1.3f, -val2 * 1.3f }; for (int i = 0; i < array.Length; i++) { GameObject val3 = new GameObject("Empress Fall Guys Spawn"); val3.transform.SetParent(parent, false); val3.transform.position = _respawnPosition + array[i] + Vector3.up * 0.15f; val3.transform.rotation = _respawnRotation; val3.AddComponent<SpawnPoint>(); } Vector3 position = _respawnPosition + val2 * 5f; LevelPoint val4 = CreateLevelPoint(parent, roomVolume, generator, _respawnPosition, truck: true); LevelPoint val5 = CreateLevelPoint(parent, roomVolume, generator, position, truck: false); val4.ConnectedPoints = new List<LevelPoint> { val5 }; val5.ConnectedPoints = new List<LevelPoint> { val4 }; generator.LevelPathTruck = val4; } private static LevelPoint CreateLevelPoint(Transform parent, RoomVolume roomVolume, LevelGenerator generator, Vector3 position, bool truck) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Empress Fall Guys Level Point"); int num = LayerMask.NameToLayer("Other"); if (num >= 0) { val.layer = num; } val.transform.SetParent(parent, false); val.transform.position = position; SphereCollider obj = val.AddComponent<SphereCollider>(); ((Collider)obj).isTrigger = true; obj.radius = 0.35f; LevelPoint val2 = val.AddComponent<LevelPoint>(); val2.ConnectedPoints = new List<LevelPoint>(); val2.Room = roomVolume; val2.Truck = truck; val2.ModuleConnect = false; FallGuysAccess.MarkLevelPointInStartRoom(val2, value: true); if (generator.LevelPathPoints == null) { generator.LevelPathPoints = new List<LevelPoint>(); } generator.LevelPathPoints.Add(val2); return val2; } private void FixMaterials(Transform levelRoot) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)levelRoot == (Object)null) { return; } Shader val = Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { EmpressFallGuysPlugin.Log.LogWarning((object)"Standard shader not found; Fall Guys materials may render pink."); } HashSet<Material> hashSet = new HashSet<Material>(); Renderer[] componentsInChildren = ((Component)levelRoot).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null) && hashSet.Add(val2)) { if ((Object)(object)val != (Object)null) { val2.shader = val; } if (SolidColors.TryGetValue(((Object)val2).name, out var value)) { val2.SetColor("_Color", value); } } } } EmpressFallGuysPlugin.DebugLog("Fixed " + hashSet.Count + " Fall Guys materials."); } private void RemoveLeftovers(Transform levelRoot) { Transform[] componentsInChildren = ((Component)levelRoot).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf("StoryLog", StringComparison.OrdinalIgnoreCase) >= 0) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } } private void DisableLevelLights(Transform levelRoot) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 Light[] componentsInChildren = ((Component)levelRoot).GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((int)componentsInChildren[i].type == 1) { componentsInChildren[i].intensity = Mathf.Min(componentsInChildren[i].intensity, 1f); } else { ((Behaviour)componentsInChildren[i]).enabled = false; } } } private void MakeDoubleSided(Transform levelRoot) { MeshFilter[] componentsInChildren = ((Component)levelRoot).GetComponentsInChildren<MeshFilter>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Mesh sharedMesh = componentsInChildren[i].sharedMesh; if (!((Object)(object)sharedMesh == (Object)null) && sharedMesh.isReadable) { if (!DoubleSidedCache.TryGetValue(((Object)sharedMesh).GetInstanceID(), out var value)) { value = BuildDoubleSided(sharedMesh); DoubleSidedCache[((Object)sharedMesh).GetInstanceID()] = value; } if ((Object)(object)value != (Object)null) { componentsInChildren[i].sharedMesh = value; } } } } private static Mesh BuildDoubleSided(Mesh source) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = source.vertices; Vector3[] normals = source.normals; Vector2[] uv = source.uv; int num = vertices.Length; if (num == 0) { return null; } Vector3[] array = (Vector3[])(object)new Vector3[num * 2]; Vector2[] array2 = (Vector2[])(object)((uv != null && uv.Length == num) ? new Vector2[num * 2] : null); Vector3[] array3 = (Vector3[])(object)((normals != null && normals.Length == num) ? new Vector3[num * 2] : null); for (int i = 0; i < num; i++) { array[i] = vertices[i]; array[i + num] = vertices[i]; if (array2 != null) { array2[i] = uv[i]; array2[i + num] = uv[i]; } if (array3 != null) { array3[i] = normals[i]; array3[i + num] = -normals[i]; } } Mesh val = new Mesh { indexFormat = (IndexFormat)1 }; val.vertices = array; if (array2 != null) { val.uv = array2; } if (array3 != null) { val.normals = array3; } val.subMeshCount = source.subMeshCount; for (int j = 0; j < source.subMeshCount; j++) { int[] triangles = source.GetTriangles(j); int[] array4 = new int[triangles.Length * 2]; for (int k = 0; k < triangles.Length; k++) { array4[k] = triangles[k]; } for (int l = 0; l < triangles.Length; l += 3) { array4[triangles.Length + l] = triangles[l] + num; array4[triangles.Length + l + 1] = triangles[l + 2] + num; array4[triangles.Length + l + 2] = triangles[l + 1] + num; } val.SetTriangles(array4, j); } if (array3 == null) { val.RecalculateNormals(); } val.RecalculateBounds(); return val; } private void BuildHurtZones(Transform levelRoot) { if (!EmpressFallGuysPlugin.Settings.Hazards.Value) { return; } Animator[] componentsInChildren = ((Component)levelRoot).GetComponentsInChildren<Animator>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (IsDecor(((Object)((Component)componentsInChildren[i]).gameObject).name) || ((Object)((Component)componentsInChildren[i]).gameObject).name.IndexOf("Circle", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } Collider[] componentsInChildren2 = ((Component)componentsInChildren[i]).GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].enabled = false; } MeshFilter[] componentsInChildren3 = ((Component)componentsInChildren[i]).GetComponentsInChildren<MeshFilter>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { Mesh sharedMesh = componentsInChildren3[k].sharedMesh; if (!((Object)(object)sharedMesh == (Object)null) && sharedMesh.isReadable) { GameObject gameObject = ((Component)componentsInChildren3[k]).gameObject; if (!((Object)(object)gameObject.GetComponent<FallGuysHurtZone>() != (Object)null)) { MeshCollider obj = gameObject.AddComponent<MeshCollider>(); obj.sharedMesh = sharedMesh; obj.convex = true; ((Collider)obj).isTrigger = true; gameObject.AddComponent<FallGuysHurtZone>(); } } } } } private static bool IsDecor(string name) { string text = name.ToLowerInvariant(); for (int i = 0; i < HazardDecorKeywords.Length; i++) { if (text.Contains(HazardDecorKeywords[i])) { return true; } } return false; } private void RefillStamina() { PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null) { instance.EnergyCurrent = instance.EnergyStart; } } private void ApplyJumpBoost() { PlayerController instance = PlayerController.instance; if (!((Object)(object)instance == (Object)null)) { if (!_jumpCaptured) { _baseJumpForce = instance.JumpForce; _jumpCaptured = true; } instance.JumpForce = _baseJumpForce * EmpressFallGuysPlugin.Settings.JumpBoost.Value; } } private void RestoreJumpBoost() { if (_jumpCaptured && (Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.JumpForce = _baseJumpForce; } _jumpCaptured = false; } private void CaptureSpawnHere() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (IsPlayable(val)) { Vector3 position = ((Component)val).transform.position; float y = ((Component)val).transform.eulerAngles.y; EmpressFallGuysPlugin.Settings.SpawnX.Value = position.x; EmpressFallGuysPlugin.Settings.SpawnY.Value = position.y; EmpressFallGuysPlugin.Settings.SpawnZ.Value = position.z; EmpressFallGuysPlugin.Settings.SpawnYaw.Value = ((y > 180f) ? (y - 360f) : y); _respawnPosition = position; _respawnRotation = Quaternion.Euler(0f, y, 0f); EmpressFallGuysPlugin.Log.LogInfo((object)("Fall Guys spawn set to " + position.x.ToString("F2") + ", " + position.y.ToString("F2") + ", " + position.z.ToString("F2") + " (yaw " + y.ToString("F1") + ").")); SemiFunc.UIFocusText("Spawn set: " + position.x.ToString("F0") + ", " + position.y.ToString("F0") + ", " + position.z.ToString("F0"), new Color(0.6f, 1f, 0.6f), Color.white, 2.5f); } } private void Activate() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) _active = true; _finishAnnounced = false; _finishSequenceStarted = false; _finishCheckTimer = 0f; _respawnLockedUntil = 0f; UpdateMusic(); for (int i = 0; i < _musicSources.Count; i++) { AudioSource val = _musicSources[i]; if ((Object)(object)val != (Object)null && (Object)(object)val.clip != (Object)null && !val.isPlaying) { val.Play(); } } SemiFunc.UIFocusText("Get to the crown.", new Color(1f, 0.72f, 0.34f), Color.white, 4f); } private void Deactivate() { _active = false; RestoreJumpBoost(); for (int i = 0; i < _musicSources.Count; i++) { if ((Object)(object)_musicSources[i] != (Object)null && _musicSources[i].isPlaying) { _musicSources[i].Stop(); } } _musicSources.Clear(); _root = null; _moduleRoot = null; _levelInstance = null; _finishPoint = null; } private void HandleSceneTransition() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (_active) { Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; if (_sceneHandle != -1 && handle != _sceneHandle) { Deactivate(); } } } private void UpdateMusic() { float volume = ((EmpressFallGuysPlugin.Settings != null) ? EmpressFallGuysPlugin.Settings.MasterVolume.Value : 0.8f); for (int i = 0; i < _musicSources.Count; i++) { if ((Object)(object)_musicSources[i] != (Object)null) { _musicSources[i].volume = volume; } } } private void CheckLocalVoidRespawn() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (IsPlayable(val)) { float num = ((EmpressFallGuysPlugin.Settings != null) ? EmpressFallGuysPlugin.Settings.VoidY.Value : (-80f)); if (((Component)val).transform.position.y < num) { RespawnLocal(force: true); } } } private void CheckFinish() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_finishPoint == (Object)null) { return; } _finishCheckTimer -= Time.deltaTime; if (_finishCheckTimer > 0f) { return; } _finishCheckTimer = 0.2f; float value = EmpressFallGuysPlugin.Settings.FinishRadius.Value; List<PlayerAvatar> list = PlayablePlayers(); for (int i = 0; i < list.Count; i++) { if (Vector3.Distance(((Component)list[i]).transform.position, _finishPoint.position) <= value) { CompleteHost(list[i]); break; } } } private void CompleteHost(PlayerAvatar winner) { if (!_finishAnnounced) { _finishAnnounced = true; int value = EmpressFallGuysPlugin.Settings.FinishReward.Value; string text = (((Object)(object)winner != (Object)null) ? FallGuysAccess.GetPlayerName(winner) : null); SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() + value); SemiFunc.StatSetRunTotalHaul(SemiFunc.StatGetRunTotalHaul() + value); if ((Object)(object)CurrencyUI.instance != (Object)null) { CurrencyUI.instance.FetchCurrency(); } EmpressFallGuysPlugin.RaiseToAll(176, new object[2] { value, text }); } } internal void ReceiveFinish(object[] data) { if (!_finishSequenceStarted) { _finishSequenceStarted = true; int reward = ((data != null && data.Length != 0) ? ToInt(data[0]) : 50); string winnerName = ((data != null && data.Length > 1) ? (data[1] as string) : null); ((MonoBehaviour)this).StartCoroutine(FinishSequence(reward, winnerName)); } } private IEnumerator FinishSequence(int reward, string winnerName) { SemiFunc.UIFocusText((string.IsNullOrEmpty(winnerName) ? "A player" : winnerName) + " grabbed the crown!\n$" + reward + ",000 to the team", new Color(1f, 0.86f, 0.28f), Color.white, 5f); if ((Object)(object)CurrencyUI.instance != (Object)null) { CurrencyUI.instance.FetchCurrency(); } float timer = 5f; while (timer > 0f) { timer -= Time.unscaledDeltaTime; yield return null; } if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)RunManager.instance != (Object)null && EmpressFallGuysPlugin.IsFallGuysLevel(RunManager.instance.levelCurrent)) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } internal void RespawnFromTrigger(Collider other) { if (!_active || (Object)(object)other == (Object)null) { return; } PlayerAvatar val = LocalAvatar(); if (IsPlayable(val)) { PlayerAvatar componentInParent = ((Component)other).GetComponentInParent<PlayerAvatar>(); PlayerController componentInParent2 = ((Component)other).GetComponentInParent<PlayerController>(); if ((Object)(object)componentInParent == (Object)(object)val || (Object)(object)componentInParent2 == (Object)(object)PlayerController.instance || ((Component)other).transform.IsChildOf(((Component)val).transform)) { RespawnLocal(force: false); } } } private void RespawnLocal(bool force) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (force || !(Time.time < _respawnLockedUntil)) { _respawnLockedUntil = Time.time + 1.2f; FallGuysAccess.TeleportLocalPlayer(_respawnPosition + Vector3.up * 0.8f, _respawnRotation); SemiFunc.UIFocusText("Back to the start.", new Color(0.58f, 0.88f, 1f), Color.white, 1.8f); } } private Transform FindInLevel(string name) { if ((Object)(object)_levelInstance == (Object)null) { return null; } Transform[] componentsInChildren = ((Component)_levelInstance).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (((Object)componentsInChildren[i]).name == name) { return componentsInChildren[i]; } } return null; } private static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } private static bool IsPlayable(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null && !FallGuysAccess.GetIsDisabled(avatar)) { return !FallGuysAccess.GetDeadSet(avatar); } return false; } private List<PlayerAvatar> PlayablePlayers() { List<PlayerAvatar> list = new List<PlayerAvatar>(); if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; if (IsPlayable(val)) { list.Add(val); } } } if (list.Count == 0) { PlayerAvatar val2 = LocalAvatar(); if (IsPlayable(val2)) { list.Add(val2); } } return list; } private static int ToInt(object value) { if (value is int) { return (int)value; } if (value is short) { return (short)value; } if (value is byte) { return (byte)value; } if (value is long num) { return (int)num; } if (value is float num2) { return Mathf.RoundToInt(num2); } if (value is double num3) { return Mathf.RoundToInt((float)num3); } return 0; } } internal sealed class FallGuysRespawnTrigger : MonoBehaviour { private void OnTriggerEnter(Collider other) { FallGuysRuntime.Instance?.RespawnFromTrigger(other); } } internal sealed class FallGuysHurtZone : MonoBehaviour { private void OnTriggerEnter(Collider other) { TryKill(other); } private void OnTriggerStay(Collider other) { TryKill(other); } private static void TryKill(Collider other) { FallGuysRuntime instance = FallGuysRuntime.Instance; if ((Object)(object)instance == (Object)null || !instance.Active || (Object)(object)other == (Object)null) { return; } PlayerAvatar val = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerController.instance.playerAvatarScript : null); if (!((Object)(object)val == (Object)null) && !FallGuysAccess.GetIsDisabled(val) && !FallGuysAccess.GetDeadSet(val)) { PlayerAvatar componentInParent = ((Component)other).GetComponentInParent<PlayerAvatar>(); PlayerController componentInParent2 = ((Component)other).GetComponentInParent<PlayerController>(); if ((Object)(object)componentInParent == (Object)(object)val || (Object)(object)componentInParent2 == (Object)(object)PlayerController.instance || ((Component)other).transform.IsChildOf(((Component)val).transform)) { val.PlayerDeath(-1); } } } } }