Decompiled source of HatefulTrifecta v0.5.3
plugins/HatefulTrifecta/HatefulScripts.dll
Decompiled a month 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.Globalization; 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 System.Threading; using System.Threading.Tasks; using BepInEx; using DoomahLevelLoader.UnityComponents; using HarmonyLib; using HatefulScripts; using Logic; using LustForGrey.Hate_Buttons; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public static class AssetBundleLoader { public static void LoadSceneFromAssetBundle(string assetBundlePath, string sceneName) { AssetBundle assetBundle = AssetBundle.LoadFromFile(assetBundlePath); if ((Object)(object)assetBundle == (Object)null) { Debug.LogError((object)("Failed to load AssetBundle from path: " + assetBundlePath)); } else if (assetBundle.isStreamedSceneAssetBundle) { string scenePath = GetScenePath(assetBundle.GetAllScenePaths(), sceneName); if (!string.IsNullOrEmpty(scenePath)) { SceneManager.LoadSceneAsync(Path.GetFileNameWithoutExtension(scenePath)).completed += delegate { Debug.Log((object)"Scene loaded successfully."); assetBundle.Unload(false); }; } else { Debug.LogError((object)"Scene not found in AssetBundle."); assetBundle.Unload(false); } } else { Debug.LogError((object)"AssetBundle does not contain scenes."); assetBundle.Unload(false); } } private static string GetScenePath(string[] scenePaths, string sceneName) { foreach (string text in scenePaths) { if (Path.GetFileNameWithoutExtension(text) == sceneName) { return text; } } return null; } } public class AssetBundleSceneLoader : MonoBehaviour { [SerializeField] private string assetBundlePath; [SerializeField] public string sceneNameToLoad; private AssetBundle loadedBundle; public Assembly why; public string resourceName = "hate"; public string bundlePath; public static bool doit; public static string ModPath() { return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar)); } private void Start() { why = Assembly.GetExecutingAssembly(); bundlePath = Path.Combine(ModPath(), resourceName); loadedBundle = AssetBundle.LoadFromFile(bundlePath); } private void OnTriggerEnter(Collider other) { if (((Component)other).gameObject.CompareTag("Player")) { ((MonoBehaviour)this).StartCoroutine(LoadAssetBundleAndScene(resourceName, sceneNameToLoad)); doit = true; } } public IEnumerator LoadAssetBundleAndScene(string resourceName, string sceneName) { bundlePath = Path.Combine(ModPath(), resourceName); sceneNameToLoad = sceneName; yield return AssetBundle.LoadFromFileAsync(bundlePath); if ((Object)(object)loadedBundle == (Object)null) { Debug.LogError((object)("Failed to load AssetBundle from path: " + assetBundlePath)); yield break; } Debug.Log((object)"AssetBundle loaded successfully."); if (!loadedBundle.isStreamedSceneAssetBundle) { Debug.LogError((object)"The AssetBundle does not contain any scenes."); UnloadBundle(); yield break; } string[] allScenePaths = loadedBundle.GetAllScenePaths(); string text = null; string[] array = allScenePaths; foreach (string text2 in array) { if (text2.EndsWith(sceneNameToLoad + ".unity")) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Debug.LogError((object)("Scene " + sceneNameToLoad + " not found in the AssetBundle.")); UnloadBundle(); yield break; } AsyncOperation sceneLoadRequest = SceneManager.LoadSceneAsync(text, (LoadSceneMode)0); yield return sceneLoadRequest; doit = true; if (sceneLoadRequest.isDone) { Debug.Log((object)("Scene loaded successfully from AssetBundle: " + sceneNameToLoad)); } else { Debug.LogError((object)"Failed to load the scene from AssetBundle."); } } private void UnloadBundle() { if ((Object)(object)loadedBundle != (Object)null) { loadedBundle.Unload(false); loadedBundle = null; Debug.Log((object)"AssetBundle unloaded."); } } private void OnDestroy() { UnloadBundle(); } } public class CustomButton : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler { public Color normalColor = Color.white; public Color hoverColor = Color.gray; public Color clickColor = Color.red; private Image buttonImage; private event Action onClick; private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) buttonImage = ((Component)this).GetComponent<Image>(); ((Graphic)buttonImage).color = normalColor; } public void AddOnClickListener(Action listener) { onClick += listener; } public void RemoveOnClickListener(Action listener) { onClick -= listener; } public void OnPointerEnter(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)buttonImage).color = hoverColor; } public void OnPointerExit(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)buttonImage).color = normalColor; } public void OnPointerDown(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)buttonImage).color = clickColor; } public void OnPointerUp(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)buttonImage).color = hoverColor; InvokeOnClick(); } private void InvokeOnClick() { this.onClick?.Invoke(); } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Input.GetMouseButtonDown(0) && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val) && (Object)(object)((RaycastHit)(ref val)).collider == (Object)(object)((Component)this).GetComponent<Collider>()) { InvokeOnClick(); } } } public class DisableGameObject : MonoBehaviour { public void DISABLEIT() { string text = "Outdoors/OOB Minefield/Plane(Clone)"; GameObject val = GameObject.Find(text); if ((Object)(object)val != (Object)null) { val.gameObject.SetActive(false); Debug.Log((object)("GameObject found and disabled: " + ((Object)val).name)); } else { Debug.LogWarning((object)("GameObject not found at path: " + text)); } } } public class ParticleRenderingRange : MonoBehaviour { public float maxRenderDistance = 50f; private ParticleSystem ps; private Transform cameraTransform; private bool isCheckingDistance; private void Start() { ps = ((Component)this).GetComponent<ParticleSystem>(); cameraTransform = ((Component)Camera.main).transform; isCheckingDistance = false; CheckDistanceAsync(); } private async void CheckDistanceAsync() { isCheckingDistance = true; while (isCheckingDistance) { await Task.Delay(100); if (Vector3.Distance(((Component)this).transform.position, cameraTransform.position) <= maxRenderDistance) { EnableParticles(); } else { DisableParticles(); } } } private void EnableParticles() { //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) EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).enabled = true; if (!ps.isPlaying) { ps.Play(); } } private void DisableParticles() { //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) EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).enabled = false; if (ps.isPlaying) { ps.Stop(true, (ParticleSystemStopBehavior)1); } } private void OnDestroy() { isCheckingDistance = false; } private void OnDrawGizmosSelected() { //IL_0000: 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) Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, maxRenderDistance); } } public class EnableOnTrigger : MonoBehaviour { public Transform trigger; private void Start() { ((Component)this).gameObject.SetActive(false); } private void Update() { if ((Object)(object)trigger != (Object)null && ((Component)trigger).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(true); } } } public class EoTM : MonoBehaviour { public GameObject targetObject; public Transform trigger; private void Update() { } } public class GameManager : MonoBehaviour { public string sceneName; private AssetBundle loadedBundle; public Assembly why; public string resourceName = "hate1scene"; public string bundlePath; public static string ModPath() { return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar)); } private void Start() { why = Assembly.GetExecutingAssembly(); bundlePath = Path.Combine(ModPath(), resourceName); } private void OnTriggerEnter(Collider other) { if (((Component)other).gameObject.CompareTag("Player")) { AssetBundleLoader.LoadSceneFromAssetBundle(bundlePath, sceneName); } } } public class HABundle : MonoBehaviour { public string publicModPath; public string publicSceneName; private Plugin pluginInstance; public string ModPath() { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } private void Awake() { pluginInstance = Plugin.Instance; if ((Object)(object)pluginInstance == (Object)null) { Debug.LogError((object)"Plugin instance is null. Ensure the Plugin is properly loaded by BepInEx."); } } private void OnEnable() { SceneManager.sceneUnloaded += OnSceneUnloaded; } private void OnDisable() { SceneManager.sceneUnloaded -= OnSceneUnloaded; } private void OnSceneUnloaded(Scene scene) { UnloadAllBundles(); } public IEnumerator LoadAssetBundleAndScene(string resourceName, string sceneNameToLoad) { if (string.IsNullOrEmpty(resourceName) || string.IsNullOrEmpty(sceneNameToLoad)) { Debug.LogError((object)"Invalid resource or scene name provided."); yield break; } string bundlePath = Path.Combine(ModPath(), resourceName); if (pluginInstance.loadedBundlesList.Any((AssetBundle bundle) => (Object)(object)bundle != (Object)null && ((Object)bundle).name == resourceName)) { Debug.LogError((object)("AssetBundle '" + resourceName + "' is already loaded.")); yield break; } Debug.Log((object)("Attempting to load AssetBundle: " + bundlePath)); AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(bundlePath); yield return bundleRequest; AssetBundle assetBundle = bundleRequest.assetBundle; if ((Object)(object)assetBundle == (Object)null) { Debug.LogError((object)("Failed to load AssetBundle from path: " + bundlePath)); yield break; } Debug.Log((object)"AssetBundle loaded successfully."); AddBundleToGlobalList(assetBundle); if (!assetBundle.isStreamedSceneAssetBundle) { Debug.LogError((object)"The AssetBundle does not contain any scenes."); yield break; } string[] allScenePaths = assetBundle.GetAllScenePaths(); string scenePathToLoad = Array.Find(allScenePaths, (string path) => path.EndsWith(sceneNameToLoad + ".unity", StringComparison.OrdinalIgnoreCase)); if (string.IsNullOrEmpty(scenePathToLoad)) { Debug.LogError((object)("Scene '" + sceneNameToLoad + "' not found in AssetBundle.")); yield break; } Scene activeScene = SceneManager.GetActiveScene(); string currentSceneName = ((Scene)(ref activeScene)).name; if (allScenePaths.Any((string path) => path.EndsWith(currentSceneName + ".unity"))) { yield return SceneManager.UnloadSceneAsync(currentSceneName); Debug.Log((object)("Unloaded current scene: " + currentSceneName)); } AsyncOperation sceneLoadRequest = SceneManager.LoadSceneAsync(scenePathToLoad, (LoadSceneMode)0); yield return sceneLoadRequest; if (sceneLoadRequest.isDone) { Debug.Log((object)("Scene '" + sceneNameToLoad + "' loaded successfully.")); ReloadCurrentScene(); } else { Debug.LogError((object)("Failed to load scene '" + sceneNameToLoad + "' from AssetBundle.")); } } private void AddBundleToGlobalList(AssetBundle bundle) { if ((Object)(object)pluginInstance != (Object)null) { for (int i = 0; i < pluginInstance.loadedBundlesList.Length; i++) { if ((Object)(object)pluginInstance.loadedBundlesList[i] == (Object)null) { pluginInstance.loadedBundlesList[i] = bundle; Debug.Log((object)$"Added AssetBundle '{((Object)bundle).name}' to global list at index {i}."); return; } } Debug.LogWarning((object)"Global loaded bundles list is full; unable to add the AssetBundle."); } else { Debug.LogError((object)"Plugin instance not found."); } } public void UnloadAllBundles() { if (!((Object)(object)pluginInstance != (Object)null)) { return; } for (int i = 0; i < pluginInstance.loadedBundlesList.Length; i++) { AssetBundle val = pluginInstance.loadedBundlesList[i]; if ((Object)(object)val != (Object)null) { val.Unload(true); pluginInstance.loadedBundlesList[i] = null; Debug.Log((object)$"Unloaded AssetBundle at index {i}: {((Object)val).name}"); } } Debug.Log((object)"All AssetBundles unloaded."); } public AsyncOperation ReloadCurrentScene() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; Debug.Log((object)("Reloading current scene: " + name)); AsyncOperation obj = SceneManager.LoadSceneAsync(name); obj.completed += delegate { SceneHelper.DismissBlockers(); Plugin.Fixorsmth(); }; return obj; } } public class HatefulAbruptLevelChanger : MonoBehaviour { public bool loadingSplash; public bool saveMission; public string bundleName; public string levelname; [SerializeField] private AssetReference finalRoomPit; [SerializeField] private GameObject loadingBlocker; [SerializeField] private TMP_Text loadingBar; [SerializeField] private GameObject preloadingBadge; [SerializeField] private GameObject eventSystem; public string CurrentScene { get; private set; } public string LastScene { get; private set; } public string PendingScene { get; private set; } public void AbruptChangeLevel() { if (saveMission) { MonoSingleton<PreviousMissionSaver>.Instance.previousMission = MonoSingleton<StatsManager>.Instance.levelNumber; } LoadSceneAsync(levelname, bundleName); } public string SanitizeLevelPath(string scene) { if (scene.StartsWith("Assets/Scenes/")) { scene = scene.Substring("Assets/Scenes/".Length); } if (scene.EndsWith(".unity")) { scene = scene.Substring(0, scene.Length - ".unity".Length); } return scene; } public IEnumerator LoadSceneAsync(string sceneName, string assetBundlePath, bool noSplash = false) { if (PendingScene == null) { PendingScene = sceneName; sceneName = SanitizeLevelPath(sceneName); Debug.Log((object)("(LoadSceneAsync) Loading scene " + sceneName)); loadingBlocker.SetActive(!noSplash); yield return null; if (CurrentScene != sceneName) { LastScene = CurrentScene; } CurrentScene = sceneName; if ((Object)(object)MonoSingleton<MapVarManager>.Instance != (Object)null) { MonoSingleton<MapVarManager>.Instance.ReloadMapVars(); } AssetBundleLoader.LoadSceneFromAssetBundle(assetBundlePath, sceneName); if ((Object)(object)GameStateManager.Instance != (Object)null) { GameStateManager.Instance.currentCustomGame = null; } if ((Object)(object)preloadingBadge != (Object)null) { preloadingBadge.SetActive(false); } if ((Object)(object)loadingBlocker != (Object)null) { loadingBlocker.SetActive(false); } if ((Object)(object)loadingBar != (Object)null) { ((Component)loadingBar).gameObject.SetActive(false); } PendingScene = null; } } public void NormalChangeLevel() { LoadSceneAsync(levelname, bundleName); } public void GoToLevel(int missionNumber) { SceneHelper.LoadScene(GetMissionName.GetSceneName(missionNumber), false); } public void GoToSavedLevel() { PreviousMissionSaver instance = MonoSingleton<PreviousMissionSaver>.Instance; if ((Object)(object)instance != (Object)null) { _ = instance.previousMission; Object.Destroy((Object)(object)((Component)instance).gameObject); GoToLevel(instance.previousMission); } else { GoToLevel(GameProgressSaver.GetProgress(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0))); } } } public static class HatefulAssetBundleSceneLoader { public static string publicModPath; public static string publicSceneName; private static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); public static string ModPath() { return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar)); } public static IEnumerator LoadAssetBundleAndScene(string resourceName, string sceneNameToLoad) { string bundlePath = (publicModPath = Path.Combine(ModPath(), resourceName)); publicSceneName = sceneNameToLoad; AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(bundlePath); yield return bundleRequest; AssetBundle loadedBundle = bundleRequest.assetBundle; if ((Object)(object)loadedBundle == (Object)null) { Debug.LogError((object)("Failed to load AssetBundle from path: " + bundlePath)); yield break; } Debug.Log((object)"AssetBundle loaded successfully."); if (!loadedBundle.isStreamedSceneAssetBundle) { Debug.LogError((object)"The AssetBundle does not contain any scenes."); UnloadBundle(loadedBundle); yield break; } string[] allScenePaths = loadedBundle.GetAllScenePaths(); string text = null; string[] array = allScenePaths; foreach (string text2 in array) { if (text2.EndsWith(sceneNameToLoad + ".unity")) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { Debug.LogError((object)("Scene " + sceneNameToLoad + " not found in the AssetBundle.")); UnloadBundle(loadedBundle); yield break; } AsyncOperation sceneLoadRequest = SceneManager.LoadSceneAsync(text, (LoadSceneMode)0); yield return sceneLoadRequest; if (sceneLoadRequest.isDone) { Debug.Log((object)("Scene loaded successfully from AssetBundle: " + sceneNameToLoad)); Plugin.Fixorsmth(); } else { Debug.LogError((object)"Failed to load the scene from AssetBundle."); } UnloadBundle(loadedBundle); } public static AsyncOperation ReloadCurrentScene() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); AsyncOperation obj = SceneManager.LoadSceneAsync(((Scene)(ref activeScene)).name); obj.completed += delegate { SceneHelper.DismissBlockers(); Plugin.Fixorsmth(); }; return obj; } public static void UnloadAssetBundle(string bundlePath) { if (loadedBundles.TryGetValue(bundlePath, out var value)) { value.Unload(true); loadedBundles.Remove(bundlePath); Debug.Log((object)("AssetBundle unloaded: " + bundlePath)); } } private static void UnloadBundle(AssetBundle bundle) { if ((Object)(object)bundle != (Object)null) { bundle.Unload(false); Debug.Log((object)"AssetBundle unloaded."); } } } public class HatefulController : MonoBehaviour { public string sceneNameToLoad; public string BundleName; private AssetBundle[] loadedBundles = (AssetBundle[])(object)new AssetBundle[3]; private int bundleIndex; private AssetBundle currentBundle; [SerializeField] private Button loadLevelButton; private void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)loadLevelButton != (Object)null) { ((UnityEvent)loadLevelButton.onClick).AddListener((UnityAction)delegate { LoadLevel(); }); } else { Debug.LogWarning((object)"LoadLevel button is not assigned in the inspector."); } SceneManager.sceneUnloaded += OnSceneUnloaded; } private void OnDestroy() { SceneManager.sceneUnloaded -= OnSceneUnloaded; } private void OnSceneUnloaded(Scene scene) { UnloadAllBundles(); } public string ModPath() { return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar)); } public void LoadLevel() { ((MonoBehaviour)this).StartCoroutine(LoadAssetBundleAndScene(BundleName, sceneNameToLoad)); } private IEnumerator LoadAssetBundleAndScene(string resourceName, string sceneNameToLoad) { string bundlePath = Path.Combine(ModPath(), resourceName); AssetBundle[] array = loadedBundles; foreach (AssetBundle val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name == resourceName) { Debug.LogError((object)("AssetBundle '" + resourceName + "' is already loaded.")); yield break; } } if ((Object)(object)currentBundle != (Object)null) { currentBundle.Unload(true); Debug.Log((object)"Unloaded previous AssetBundle."); } AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(bundlePath); yield return bundleRequest; AssetBundle loadedBundle = bundleRequest.assetBundle; if ((Object)(object)loadedBundle == (Object)null) { Debug.LogError((object)("Failed to load AssetBundle from path: " + bundlePath)); yield break; } Debug.Log((object)"AssetBundle loaded successfully."); currentBundle = loadedBundle; loadedBundles[bundleIndex] = loadedBundle; bundleIndex = (bundleIndex + 1) % loadedBundles.Length; AddBundleToGlobalList(loadedBundle); if (!loadedBundle.isStreamedSceneAssetBundle) { Debug.LogError((object)"The AssetBundle does not contain any scenes."); yield break; } Scene activeScene = SceneManager.GetActiveScene(); string currentSceneName = ((Scene)(ref activeScene)).name; if (loadedBundle.GetAllScenePaths().Any((string path) => path.EndsWith(currentSceneName + ".unity"))) { yield return SceneManager.UnloadSceneAsync(currentSceneName); Debug.Log((object)("Unloaded current scene: " + currentSceneName)); } string text = loadedBundle.GetAllScenePaths().FirstOrDefault((string path) => path.EndsWith(sceneNameToLoad + ".unity")); if (string.IsNullOrEmpty(text)) { Debug.LogError((object)("Scene " + sceneNameToLoad + " not found in the AssetBundle.")); yield break; } AsyncOperation sceneLoadRequest = SceneManager.LoadSceneAsync(text, (LoadSceneMode)0); yield return sceneLoadRequest; if (sceneLoadRequest.isDone) { Debug.Log((object)("Scene loaded successfully from AssetBundle: " + sceneNameToLoad)); Plugin.Fixorsmth(); } else { Debug.LogError((object)"Failed to load the scene from AssetBundle."); } } private void AddBundleToGlobalList(AssetBundle bundle) { Plugin instance = Plugin.Instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"Plugin instance not found."); return; } for (int i = 0; i < instance.loadedBundlesList.Length; i++) { if ((Object)(object)instance.loadedBundlesList[i] == (Object)null) { instance.loadedBundlesList[i] = bundle; Debug.Log((object)$"Added AssetBundle '{((Object)bundle).name}' to global list at index {i}."); return; } } Debug.LogWarning((object)"Global loaded bundles list is full; unable to add the AssetBundle."); } public void UnloadAllBundles() { for (int i = 0; i < loadedBundles.Length; i++) { if ((Object)(object)loadedBundles[i] != (Object)null) { loadedBundles[i].Unload(true); loadedBundles[i] = null; Debug.Log((object)("Unloaded AssetBundle at index " + i)); } } currentBundle = null; } } public class HatefulFinalPit : MonoBehaviour { private NewMovement nmov; private StatsManager sm; private Rigidbody rb; private bool rotationReady; private GameObject player; private bool infoSent; public bool rankless; public bool secondPit; public string targetLevelName; private int levelNumber; public bool musicFadeOut; private Quaternion targetRotation; public string bundlename; public string lvlname; public HatefulFinalRank hatefulFinalRank; public void LoadLevel(string bundlename, string lvlname) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) HABundle hABundle = new GameObject("HABundleObject").AddComponent<HABundle>(); Debug.Log((object)("Loading via HABundle: " + bundlename + ", Scene: " + lvlname)); ((MonoBehaviour)this).StartCoroutine(hABundle.LoadAssetBundleAndScene(bundlename, lvlname)); } private void Start() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) sm = MonoSingleton<StatsManager>.Instance; player = ((Component)MonoSingleton<NewMovement>.Instance).gameObject; Quaternion rotation = ((Component)this).transform.rotation; targetRotation = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + Vector3.up * 0.01f); hatefulFinalRank = new GameObject("HatefulFinalRank").AddComponent<HatefulFinalRank>(); } private void OnTriggerEnter(Collider other) { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)other).gameObject == (Object)(object)player) { NewMovement instance = MonoSingleton<NewMovement>.Instance; if (instance != null && instance.hp > 0) { HatefulAssetBundleSceneLoader.publicModPath = Path.Combine(ShaderManager.ModPath(), bundlename); HatefulAssetBundleSceneLoader.publicSceneName = Path.Combine(ShaderManager.ModPath(), lvlname); if (musicFadeOut) { MonoSingleton<MusicManager>.Instance.off = true; } GameStateManager.Instance.RegisterState(new GameState("pit-falling", ((Component)this).gameObject) { cursorLock = (LockMode)1, cameraInputLock = (LockMode)1 }); nmov = MonoSingleton<NewMovement>.Instance; ((Component)nmov).gameObject.layer = 15; rb = nmov.rb; nmov.activated = false; ((Behaviour)nmov.cc).enabled = false; nmov.levelOver = true; sm.HideShit(); sm.StopTimer(); if (nmov.sliding) { nmov.StopSlide(); } rb.velocity = new Vector3(0f, rb.velocity.y, 0f); if (Object.op_Implicit((Object)(object)MonoSingleton<PowerUpMeter>.Instance)) { MonoSingleton<PowerUpMeter>.Instance.juice = 0f; } CrateCounter instance2 = MonoSingleton<CrateCounter>.Instance; if (instance2 != null) { instance2.SaveStuff(); } CrateCounter instance3 = MonoSingleton<CrateCounter>.Instance; if (instance3 != null) { instance3.CoinsToPoints(); } OutOfBounds[] array = Object.FindObjectsOfType<OutOfBounds>(); for (int i = 0; i < array.Length; i++) { ((Component)array[i]).gameObject.SetActive(false); } DeathZone[] array2 = Object.FindObjectsOfType<DeathZone>(); for (int i = 0; i < array2.Length; i++) { ((Component)array2[i]).gameObject.SetActive(false); } ((MonoBehaviour)this).Invoke("SendInfo", 5f); return; } } if (((Component)other).gameObject.CompareTag("Player")) { PlatformerMovement instance4 = MonoSingleton<PlatformerMovement>.Instance; if (instance4 != null && !instance4.dead) { MonoSingleton<PlayerTracker>.Instance.ChangeToFPS(); } } } private void OnTriggerStay(Collider other) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)other).gameObject != (Object)(object)player) { return; } NewMovement instance = MonoSingleton<NewMovement>.Instance; if (instance != null && instance.hp <= 0) { return; } if ((Object)(object)nmov == (Object)null) { nmov = ((Component)other).gameObject.GetComponent<NewMovement>(); rb = nmov.rb; } if (((Component)other).transform.position.x != ((Component)this).transform.position.x || ((Component)other).transform.position.z != ((Component)this).transform.position.z) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Component)this).transform.position.x, ((Component)other).transform.position.y, ((Component)this).transform.position.z); float num = Vector3.Distance(((Component)other).transform.position, val); ((Component)other).transform.position = Vector3.MoveTowards(((Component)other).transform.position, val, 1f + num * Time.deltaTime); rb.velocity = new Vector3(0f, rb.velocity.y, 0f); } if (!rotationReady) { ((Component)nmov.cc).transform.rotation = Quaternion.RotateTowards(((Component)nmov.cc).transform.rotation, targetRotation, Time.fixedDeltaTime * 10f * (Quaternion.Angle(((Component)nmov.cc).transform.rotation, targetRotation) + 1f)); if (Quaternion.Angle(((Component)nmov.cc).transform.rotation, targetRotation) < 0.01f) { ((Component)nmov.cc).transform.rotation = targetRotation; rotationReady = true; } } if (rotationReady && !infoSent) { SendInfo(); } } private void SendInfo() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).CancelInvoke(); if (infoSent) { return; } infoSent = true; if (!rankless) { FinalRank fr = sm.fr; if (!sm.infoSent) { levelNumber = MonoSingleton<StatsManager>.Instance.levelNumber; if (SceneHelper.IsPlayingCustom) { GameProgressSaver.SaveProgress(SceneHelper.CurrentLevelNumber); } else if (levelNumber >= 420) { GameProgressSaver.SaveProgress(0); } else { GameProgressSaver.SaveProgress(levelNumber + 1); } hatefulFinalRank.targetLevelName = targetLevelName; LoadLevel(bundlename, lvlname); } if (secondPit) { fr.finalPitPos = ((Component)this).transform.position; fr.reachedSecondPit = true; hatefulFinalRank.finalPitPos = ((Component)this).transform.position; hatefulFinalRank.reachedSecondPit = true; LoadLevel(bundlename, lvlname); } if (!sm.infoSent) { sm.SendInfo(); } } else if (secondPit) { GameProgressSaver.SetTutorial(true); LoadLevel(bundlename, lvlname); } } } public class HatefulFinalRank : MonoBehaviour { public bool casual; public bool dontSavePos; public bool reachedSecondPit; public TMP_Text time; private float savedTime; public TMP_Text timeRank; private bool countTime; private int minutes; private float seconds; private float checkedSeconds; public TMP_Text kills; private int savedKills; public TMP_Text killsRank; private bool countKills; private float checkedKills; public TMP_Text style; private int savedStyle; public TMP_Text styleRank; private bool countStyle; private float checkedStyle; public TMP_Text extraInfo; public TMP_Text totalRank; public TMP_Text secrets; public Image[] secretsInfo; private int secretsFound; public GameObject[] levelSecrets; private int checkedSecrets; private int secretsCheckProgress; private int allSecrets; public List<int> prevSecrets; public Image[] challenges; public GameObject[] toAppear; private int i; private bool flashFade; private Image flashPanel; private Color flashColor; private float flashMultiplier = 1f; private Vector3 maxPos; private Vector3 startingPos; private Vector3 goalPos; public bool complete; public GameObject playerPosInfo; public Vector3 finalPitPos; private AsyncOperation asyncLoad; private string oldBundle; private bool rankless; public GameObject ppiObject; public string targetLevelName; public TMP_Text pointsText; public int totalPoints; private bool loadAndActivateScene; public bool dependenciesLoaded; private bool sceneBundleLoaded; private bool skipping; private float timeBetween = 0.25f; private bool noRestarts; private bool noDamage; private bool majorAssists; public string gbundlename; public string glvlname; private void Start() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); } public void LoadLevel(string bundlename, string lvlname) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) HABundle hABundle = new GameObject("HABundleObject").AddComponent<HABundle>(); Debug.Log((object)("Loading via HABundle: " + bundlename + ", Scene: " + lvlname)); ((MonoBehaviour)this).StartCoroutine(hABundle.LoadAssetBundleAndScene(bundlename, lvlname)); } private void Update() { //IL_055d: Unknown result type (might be due to invalid IL or missing references) if (countTime) { if ((Object)(object)time == (Object)null) { Debug.LogError((object)"Time component is null!"); return; } if (savedTime >= checkedSeconds) { if (savedTime > checkedSeconds) { float num = savedTime - checkedSeconds; checkedSeconds += Time.deltaTime * 20f + Time.deltaTime * num * 1.5f; seconds += Time.deltaTime * 20f + Time.deltaTime * num * 1.5f; } if (checkedSeconds >= savedTime || skipping) { checkedSeconds = savedTime; seconds = savedTime; minutes = 0; while (seconds >= 60f) { seconds -= 60f; minutes++; } countTime = false; if ((Object)(object)((Component)time).GetComponent<AudioSource>() != (Object)null) { ((Component)time).GetComponent<AudioSource>().Stop(); } else { Debug.LogError((object)"AudioSource on time is null!"); } ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); } if (seconds >= 60f) { seconds -= 60f; minutes++; } time.text = minutes + ":" + seconds.ToString("00.000"); } } else if (countKills) { if ((Object)(object)kills == (Object)null) { Debug.LogError((object)"Kills component is null!"); return; } if ((float)savedKills >= checkedKills) { if ((float)savedKills > checkedKills) { checkedKills += Time.deltaTime * 45f; } if (checkedKills >= (float)savedKills || skipping) { checkedKills = savedKills; countKills = false; if ((Object)(object)((Component)kills).GetComponent<AudioSource>() != (Object)null) { ((Component)kills).GetComponent<AudioSource>().Stop(); } else { Debug.LogError((object)"AudioSource on kills is null!"); } ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); } kills.text = checkedKills.ToString("0"); } } else if (countStyle && (float)savedStyle >= checkedStyle) { if ((Object)(object)style == (Object)null) { Debug.LogError((object)"Style component is null!"); return; } _ = checkedStyle; if ((float)savedStyle > checkedStyle) { checkedStyle += Time.deltaTime * 4500f; } if (checkedStyle >= (float)savedStyle || skipping) { checkedStyle = savedStyle; countStyle = false; if ((Object)(object)((Component)style).GetComponent<AudioSource>() != (Object)null) { ((Component)style).GetComponent<AudioSource>().Stop(); } else { Debug.LogError((object)"AudioSource on style is null!"); } ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); totalPoints += savedStyle; PointsShow(); } else { int num2 = totalPoints + Mathf.RoundToInt(checkedStyle); int num3 = 0; while (num2 >= 1000) { num3++; num2 -= 1000; } if (num3 > 0) { if ((Object)(object)pointsText == (Object)null) { Debug.LogError((object)"pointsText component is null!"); return; } if (num2 < 10) { pointsText.text = "+" + num3 + ",00" + num2 + "<color=orange>P</color>"; } else if (num2 < 100) { pointsText.text = "+" + num3 + ",0" + num2 + "<color=orange>P</color>"; } else { pointsText.text = "+" + num3 + "," + num2 + "<color=orange>P</color>"; } } else { pointsText.text = "+" + num2 + "<color=orange>P</color>"; } } LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } if (flashFade) { if ((Object)(object)flashPanel == (Object)null) { Debug.LogError((object)"flashPanel component is null!"); return; } flashColor.a -= Time.deltaTime * flashMultiplier; ((Graphic)flashPanel).color = flashColor; if (flashColor.a <= 0f) { flashFade = false; } } InputManager instance = MonoSingleton<InputManager>.Instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"InputManager instance is null!"); } else if (!instance.PerformingCheatMenuCombo() && instance.InputSource.Fire1.WasPerformedThisFrame && complete && Time.timeScale != 0f && reachedSecondPit) { LevelChange(); } else if (!instance.PerformingCheatMenuCombo() && instance.InputSource.Fire1.WasPerformedThisFrame && !complete && Time.timeScale != 0f) { skipping = true; timeBetween = 0.01f; } else if (rankless && asyncLoad != null && asyncLoad.progress >= 0.9f) { LevelChange(); } } public void SetTime(float seconds, string rank) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) savedTime = seconds; timeRank.text = rank; SceneManager.GetSceneByName(targetLevelName); } public void SetKills(int killAmount, string rank) { savedKills = killAmount; killsRank.text = rank; } public void SetStyle(int styleAmount, string rank) { savedStyle = styleAmount; styleRank.text = rank; } public void SetInfo(int restarts, bool damage, bool majorUsed, bool cheatsUsed) { extraInfo.text = ""; int num = 1; if (!damage) { num++; } if (majorUsed) { num++; } if (cheatsUsed) { num++; } if (cheatsUsed) { TMP_Text obj = extraInfo; obj.text += "- <color=#44FF45>CHEATS USED</color>\n"; } if (majorUsed) { if (!MonoSingleton<AssistController>.Instance.hidePopup) { TMP_Text obj2 = extraInfo; obj2.text += "- <color=#4C99E6>MAJOR ASSISTS USED</color>\n"; } majorAssists = true; } if (restarts == 0) { if (num >= 3) { TMP_Text obj3 = extraInfo; obj3.text += "+ NO RESTARTS\n"; } else { TMP_Text obj4 = extraInfo; obj4.text += "+ NO RESTARTS\n (+500<color=orange>P</color>)\n"; } noRestarts = true; } else { TMP_Text obj5 = extraInfo; obj5.text = obj5.text + "- <color=red>" + restarts + "</color> RESTARTS\n"; } if (!damage) { if (num >= 3) { TMP_Text obj6 = extraInfo; obj6.text += "+ <color=orange>NO DAMAGE</color>\n"; } else { TMP_Text obj7 = extraInfo; obj7.text += "+ <color=orange>NO DAMAGE\n (</color>+5,000<color=orange>P)</color>\n"; } noDamage = true; } } public void SetRank(string rank) { totalRank.text = rank; } public void SetSecrets(int secretsAmount, int maxSecrets) { secrets.text = 0 + " / " + maxSecrets; allSecrets = maxSecrets; secretsFound = secretsAmount; } public void Appear() { //IL_02c0: Unknown result type (might be due to invalid IL or missing references) if (i < toAppear.Length) { if (!casual) { if (skipping) { HudOpenEffect component = toAppear[i].GetComponent<HudOpenEffect>(); if ((Object)(object)component != (Object)null) { component.skip = true; } } if ((Object)(object)toAppear[i] == (Object)(object)((Component)time).gameObject) { if (skipping) { checkedSeconds = savedTime; seconds = savedTime; minutes = 0; while (seconds >= 60f) { seconds -= 60f; minutes++; } ((Component)time).GetComponent<AudioSource>().playOnAwake = false; ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); time.text = minutes + ":" + seconds.ToString("00.000"); } else { countTime = true; } } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)kills).gameObject) { if (skipping) { checkedKills = savedKills; ((Component)kills).GetComponent<AudioSource>().playOnAwake = false; ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); kills.text = checkedKills.ToString("0"); } else { countKills = true; } } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)style).gameObject) { if (skipping) { checkedStyle = savedStyle; style.text = checkedStyle.ToString("0"); ((Component)style).GetComponent<AudioSource>().playOnAwake = false; ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); totalPoints += savedStyle; PointsShow(); } else { countStyle = true; } } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)secrets).gameObject) { if (prevSecrets.Count > 0) { foreach (int prevSecret in prevSecrets) { ((Graphic)secretsInfo[prevSecret]).color = new Color(0.5f, 0.5f, 0.5f); checkedSecrets++; secrets.text = checkedSecrets + " / " + levelSecrets.Length; } } toAppear[i].gameObject.SetActive(true); ((MonoBehaviour)this).Invoke("CountSecrets", timeBetween); } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)timeRank).gameObject || (Object)(object)toAppear[i] == (Object)(object)((Component)killsRank).gameObject || (Object)(object)toAppear[i] == (Object)(object)((Component)styleRank).gameObject) { switch (toAppear[i].GetComponent<TMP_Text>().text) { case "<color=#FF0000>S</color>": AddPoints(2500); break; case "<color=#FF6A00>A</color>": AddPoints(2000); break; case "<color=#FFD800>B</color>": AddPoints(1500); break; case "<color=#4CFF00>C</color>": AddPoints(1000); break; case "<color=#0094FF>D</color>": AddPoints(500); break; } LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); FlashPanel(((Component)toAppear[i].transform.parent.GetChild(1)).gameObject); ((MonoBehaviour)this).Invoke("Appear", timeBetween * 2f); if (skipping) { toAppear[i].GetComponentInChildren<AudioSource>().playOnAwake = false; } } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)totalRank).gameObject) { FlashPanel(((Component)toAppear[i].transform.parent.GetChild(1)).gameObject); flashMultiplier = 0.5f; ((MonoBehaviour)this).Invoke("Appear", timeBetween * 4f); } else if ((Object)(object)toAppear[i] == (Object)(object)((Component)extraInfo).gameObject) { if (noRestarts) { AddPoints(500); } if (noDamage) { AddPoints(5000); } ((MonoBehaviour)this).Invoke("Appear", timeBetween); } else { ((MonoBehaviour)this).Invoke("Appear", timeBetween); } } else { ((MonoBehaviour)this).Invoke("Appear", timeBetween); } toAppear[i].gameObject.SetActive(true); i++; if (!toAppear[0].gameObject.activeSelf) { toAppear[0].gameObject.SetActive(true); } if (i >= toAppear.Length && !complete) { complete = true; GameProgressSaver.AddMoney(totalPoints); LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } } else if (!complete) { complete = true; GameProgressSaver.AddMoney(totalPoints); } LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } public void FlashPanel(GameObject panel) { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (flashFade) { flashColor.a = 0f; ((Graphic)flashPanel).color = flashColor; } flashPanel = panel.GetComponent<Image>(); flashColor = ((Graphic)flashPanel).color; flashColor.a = 1f; ((Graphic)flashPanel).color = flashColor; flashFade = true; LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } private void CountSecrets() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (levelSecrets.Length != 0) { if ((Object)(object)levelSecrets[secretsCheckProgress] == (Object)null && !prevSecrets.Contains(secretsCheckProgress)) { checkedSecrets++; secrets.text = checkedSecrets + " / " + levelSecrets.Length; ((Component)secrets).GetComponent<AudioSource>().Play(); ((Graphic)secretsInfo[secretsCheckProgress]).color = Color.white; secretsCheckProgress++; AddPoints(1000); if (secretsCheckProgress < levelSecrets.Length) { ((MonoBehaviour)this).Invoke("CountSecrets", timeBetween); } else { ((MonoBehaviour)this).Invoke("Appear", timeBetween); } } else if (secretsCheckProgress < levelSecrets.Length - 1) { secretsCheckProgress++; CountSecrets(); } else { secretsCheckProgress++; ((MonoBehaviour)this).Invoke("Appear", timeBetween); } } else { ((MonoBehaviour)this).Invoke("Appear", timeBetween); } } public void NotRanklessNextLevel(string bundlename, string lvlname) { if (lvlname != "") { LoadLevel(bundlename, lvlname); } } public void LevelChange(bool force = false) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) if (SceneHelper.IsPlayingCustom) { if (force) { MonoSingleton<OptionsManager>.Instance.QuitMission(); } else if (Object.op_Implicit((Object)(object)MonoSingleton<AdditionalMapDetails>.Instance) && MonoSingleton<AdditionalMapDetails>.Instance.hasAuthorLinks) { ((Component)this).gameObject.SetActive(false); MonoSingleton<WorkshopMapEndLinks>.Instance.Show(); } else if (GameStateManager.Instance.currentCustomGame != null && GameStateManager.Instance.currentCustomGame.workshopId.HasValue) { ((Behaviour)MonoSingleton<WorkshopMapEndRating>.Instance).enabled = true; ((Component)this).gameObject.SetActive(false); } else { MonoSingleton<OptionsManager>.Instance.QuitMission(); } if (Plugin.IsCustomLevel) { LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); } if ((Object)(object)playerPosInfo != (Object)null) { if ((Object)(object)ppiObject == (Object)null) { ppiObject = Object.Instantiate<GameObject>(playerPosInfo); } PlayerPosInfo component = ppiObject.GetComponent<PlayerPosInfo>(); Rigidbody component2 = ((Component)MonoSingleton<NewMovement>.Instance).gameObject.GetComponent<Rigidbody>(); component.velocity = component2.velocity; component.position = ((Component)component2).transform.position - finalPitPos; component.position = new Vector3(component.position.x, component.position.y, component.position.z - 990f); component.wooshTime = ((Component)((Component)component2).GetComponentInChildren<WallCheck>()).GetComponent<AudioSource>().time; if (dontSavePos || targetLevelName == "Main Menu") { component.noPosition = true; } } ((Component)this).gameObject.SetActive(false); LoadLevel(gbundlename, glvlname); } public void AddPoints(int points) { totalPoints += points; PointsShow(); } private void PointsShow() { LoadLevel(HatefulAssetBundleSceneLoader.publicModPath, HatefulAssetBundleSceneLoader.publicSceneName); int num = totalPoints; int num2 = 0; while (num >= 1000) { num2++; num -= 1000; } if (num2 > 0) { if (num < 10) { pointsText.text = "+" + num2 + ",00" + num + "<color=orange>P</color>"; } else if (num < 100) { pointsText.text = "+" + num2 + ",0" + num + "<color=orange>P</color>"; } else { pointsText.text = "+" + num2 + "," + num + "<color=orange>P</color>"; } } else { pointsText.text = "+" + num + "<color=orange>P</color>"; } } } public class HatefulLevelSelectPanel : MonoBehaviour { public float collapsedHeight = 260f; public float expandedHeight = 400f; public GameObject leaderboardPanel; private RectTransform rectTransform; public int levelNumber; public int levelNumberInLayer; private bool allSecrets; public Sprite lockedSprite; public Sprite unlockedSprite; private Sprite origSprite; public Image[] secretIcons; public Image challengeIcon; private int tempInt; private string origName; private GameObject challengeChecker; public bool forceOff; public void CheckScore() { //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) rectTransform = ((Component)this).GetComponent<RectTransform>(); if ((Object)(object)origSprite == (Object)null) { origSprite = ((Component)((Component)this).transform.Find("Image")).GetComponent<Image>().sprite; } if (levelNumber == 666) { tempInt = GameProgressSaver.GetPrime(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0), levelNumberInLayer); } if (levelNumber >= 500 && levelNumber < 666) { tempInt = GameProgressSaver.GetPrime(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0), levelNumberInLayer); } else { tempInt = GameProgressSaver.GetProgress(MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0)); } int num = levelNumber; if (levelNumber == 666) { num += levelNumberInLayer - 1; } if (levelNumber >= 500 && levelNumber < 666) { num += levelNumberInLayer - 1; } origName = GetMissionName.GetMission(num); if ((levelNumber == 666 && tempInt == 0) || (levelNumber != 666 && tempInt < levelNumber) || forceOff) { string text = "10"; ((Component)((Component)this).transform.Find("Name")).GetComponent<TMP_Text>().text = text + "-" + levelNumberInLayer + ": ???"; ((Component)((Component)this).transform.Find("Image")).GetComponent<Image>().sprite = lockedSprite; ((Behaviour)((Component)this).GetComponent<Button>()).enabled = false; rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, collapsedHeight); leaderboardPanel.SetActive(false); } else { bool flag; if (tempInt == levelNumber || (levelNumber == 666 && tempInt == 1)) { flag = false; ((Component)((Component)this).transform.Find("Image")).GetComponent<Image>().sprite = unlockedSprite; } else { flag = true; ((Component)((Component)this).transform.Find("Image")).GetComponent<Image>().sprite = origSprite; } ((Component)((Component)this).transform.Find("Name")).GetComponent<TMP_Text>().text = origName; ((Behaviour)((Component)this).GetComponent<Button>()).enabled = true; if ((Object)(object)challengeIcon != (Object)null) { if ((Object)(object)challengeChecker == (Object)null) { challengeChecker = ((Component)((Component)challengeIcon).transform.Find("EventTrigger")).gameObject; } if (tempInt > levelNumber) { challengeChecker.SetActive(true); } } if (MonoSingleton<PrefsManager>.Instance.GetBool("levelLeaderboards", false) && flag) { rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, expandedHeight); leaderboardPanel.SetActive(true); } else { rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, collapsedHeight); leaderboardPanel.SetActive(false); } } RankData rank = GameProgressSaver.GetRank(num, false); if (rank != null) { int @int = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0); if (rank.levelNumber == levelNumber || (levelNumber == 666 && rank.levelNumber == levelNumber + levelNumberInLayer - 1) || (levelNumber >= 500 && levelNumber < 666 && rank.levelNumber == levelNumber + levelNumberInLayer - 1)) { TMP_Text componentInChildren = ((Component)((Component)this).transform.Find("Stats").Find("Rank")).GetComponentInChildren<TMP_Text>(); if (rank.ranks[@int] == 12 && (rank.majorAssists == null || !rank.majorAssists[@int])) { componentInChildren.text = "<color=#FFFFFF>P</color>"; Image component = ((Component)componentInChildren.transform.parent).GetComponent<Image>(); ((Graphic)component).color = new Color(1f, 0.686f, 0f, 1f); component.fillCenter = true; } else if (rank.majorAssists != null && rank.majorAssists[@int]) { if (rank.ranks[@int] < 0) { componentInChildren.text = ""; } else { Image component2 = ((Component)componentInChildren.transform.parent).GetComponent<Image>(); ((Graphic)component2).color = new Color(0.3f, 0.6f, 0.9f, 1f); component2.fillCenter = true; } } else if (rank.ranks[@int] < 0) { componentInChildren.text = ""; Image component3 = ((Component)componentInChildren.transform.parent).GetComponent<Image>(); ((Graphic)component3).color = Color.white; component3.fillCenter = false; } else { Image component4 = ((Component)componentInChildren.transform.parent).GetComponent<Image>(); ((Graphic)component4).color = Color.white; component4.fillCenter = false; } if (rank.secretsAmount > 0) { allSecrets = true; for (int i = 0; i < 5; i++) { if (i < rank.secretsAmount && rank.secretsFound[i]) { secretIcons[i].fillCenter = true; } else if (i < rank.secretsAmount) { allSecrets = false; secretIcons[i].fillCenter = false; } else if (i >= rank.secretsAmount) { ((Behaviour)secretIcons[i]).enabled = false; } } } else { Image[] array = secretIcons; for (int j = 0; j < array.Length; j++) { ((Behaviour)array[j]).enabled = false; } } if (Object.op_Implicit((Object)(object)challengeIcon)) { if (rank.challenge) { challengeIcon.fillCenter = true; TMP_Text componentInChildren2 = ((Component)challengeIcon).GetComponentInChildren<TMP_Text>(); componentInChildren2.text = "C O M P L E T E"; if (rank.ranks[@int] == 12 && (allSecrets || rank.secretsAmount == 0)) { ((Graphic)componentInChildren2).color = new Color(0.6f, 0.4f, 0f, 1f); } else { ((Graphic)componentInChildren2).color = Color.black; } } else { challengeIcon.fillCenter = false; TMP_Text componentInChildren3 = ((Component)challengeIcon).GetComponentInChildren<TMP_Text>(); componentInChildren3.text = "C H A L L E N G E"; ((Graphic)componentInChildren3).color = Color.white; } } } else { Debug.Log((object)("Error in finding " + levelNumber + " Data")); Image component5 = ((Component)((Component)this).transform.Find("Stats").Find("Rank")).GetComponent<Image>(); ((Graphic)component5).color = Color.white; component5.fillCenter = false; ((Component)component5).GetComponentInChildren<TMP_Text>().text = ""; allSecrets = false; Image[] array2 = secretIcons; foreach (Image obj in array2) { ((Behaviour)obj).enabled = true; obj.fillCenter = false; } } if ((rank.challenge || !Object.op_Implicit((Object)(object)challengeIcon)) && rank.ranks[@int] == 12 && (allSecrets || rank.secretsAmount == 0)) { ((Graphic)((Component)this).GetComponent<Image>()).color = new Color(1f, 0.686f, 0f, 0.75f); } else { ((Graphic)((Component)this).GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.75f); } } else { Debug.Log((object)("Didn't Find Level " + levelNumber + " Data")); Image component6 = ((Component)((Component)this).transform.Find("Stats").Find("Rank")).GetComponent<Image>(); ((Graphic)component6).color = Color.white; component6.fillCenter = false; ((Component)component6).GetComponentInChildren<TMP_Text>().text = ""; allSecrets = false; Image[] array2 = secretIcons; foreach (Image obj2 in array2) { ((Behaviour)obj2).enabled = true; obj2.fillCenter = false; } } } } public class HatefulSceneHelper : MonoBehaviour { [SerializeField] private AssetReference finalRoomPit; [SerializeField] private GameObject loadingBlocker; [SerializeField] private TMP_Text loadingBar; [SerializeField] private GameObject preloadingBadge; [SerializeField] private GameObject eventSystem; [Space] [SerializeField] private AudioMixerGroup masterMixer; [SerializeField] private AudioMixerGroup musicMixer; [SerializeField] private AudioMixer allSound; [SerializeField] private AudioMixer goreSound; [SerializeField] private AudioMixer musicSound; [SerializeField] private AudioMixer doorSound; [SerializeField] private AudioMixer unfreezeableSound; [Space] [SerializeField] private EmbeddedSceneInfo embeddedSceneInfo; [SerializeField] private string assetBundlePath; public bool IsPlayingCustom => GameStateManager.Instance.currentCustomGame != null; public bool IsSceneRankless => embeddedSceneInfo.ranklessScenes.Contains(CurrentScene); public int CurrentLevelNumber { get { if (!IsPlayingCustom) { return MonoSingleton<StatsManager>.Instance.levelNumber; } return GameStateManager.Instance.currentCustomGame.levelNumber; } } public string CurrentScene { get; private set; } public string LastScene { get; private set; } public string PendingScene { get; private set; } private void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnEnable() { //IL_0012: 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) SceneManager.sceneLoaded += OnSceneLoaded; OnSceneLoaded(SceneManager.GetActiveScene(), (LoadSceneMode)0); if (string.IsNullOrEmpty(CurrentScene)) { Scene activeScene = SceneManager.GetActiveScene(); CurrentScene = ((Scene)(ref activeScene)).name; } } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; } public bool IsSceneSpecial(string sceneName) { sceneName = SanitizeLevelPath(sceneName); if (!((Object)(object)embeddedSceneInfo == (Object)null)) { return embeddedSceneInfo.specialScenes.Contains(sceneName); } return false; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if ((Object)(object)EventSystem.current != (Object)null) { Object.Destroy((Object)(object)((Component)EventSystem.current).gameObject); } Object.Instantiate<GameObject>(eventSystem); if ((int)mode == 0) { GameStateManager.Instance.ResetGravity(); } } public string SanitizeLevelPath(string scene) { if (scene.StartsWith("Assets/Scenes/")) { scene = scene.Substring("Assets/Scenes/".Length); } if (scene.EndsWith(".unity")) { scene = scene.Substring(0, scene.Length - ".unity".Length); } return scene; } public void ShowLoadingBlocker() { loadingBlocker.SetActive(true); } public void DismissBlockers() { loadingBlocker.SetActive(false); ((Component)loadingBar).gameObject.SetActive(false); } public void LoadScene(string sceneName, string bundleName, bool noBlocker = false) { ((MonoBehaviour)this).StartCoroutine(LoadSceneAsync(sceneName, Path.Combine(Plugin.ModPath(), bundleName), noBlocker)); } public IEnumerator LoadSceneAsync(string sceneName, string assetBundlePath, bool noSplash = false) { if (PendingScene == null) { PendingScene = sceneName; sceneName = SanitizeLevelPath(sceneName); Debug.Log((object)("(LoadSceneAsync) Loading scene " + sceneName)); loadingBlocker.SetActive(!noSplash); yield return null; if (CurrentScene != sceneName) { LastScene = CurrentScene; } CurrentScene = sceneName; if ((Object)(object)MonoSingleton<MapVarManager>.Instance != (Object)null) { MonoSingleton<MapVarManager>.Instance.ReloadMapVars(); } AssetBundleLoader.LoadSceneFromAssetBundle(assetBundlePath, sceneName); if ((Object)(object)GameStateManager.Instance != (Object)null) { GameStateManager.Instance.currentCustomGame = null; } if ((Object)(object)preloadingBadge != (Object)null) { preloadingBadge.SetActive(false); } if ((Object)(object)loadingBlocker != (Object)null) { loadingBlocker.SetActive(false); } if ((Object)(object)loadingBar != (Object)null) { ((Component)loadingBar).gameObject.SetActive(false); } PendingScene = null; } } public void RestartScene() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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) MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(); Scene val2; foreach (MonoBehaviour val in array) { if ((Object)(object)val != (Object)null) { val2 = ((Component)val).gameObject.scene; if (((Scene)(ref val2)).name != "DontDestroyOnLoad") { val.CancelInvoke(); ((Behaviour)val).enabled = false; } } } if (string.IsNullOrEmpty(CurrentScene)) { val2 = SceneManager.GetActiveScene(); CurrentScene = ((Scene)(ref val2)).name; } AssetBundleLoader.LoadSceneFromAssetBundle(assetBundlePath, CurrentScene); if ((Object)(object)MonoSingleton<MapVarManager>.Instance != (Object)null) { MonoSingleton<MapVarManager>.Instance.ReloadMapVars(); } } public void LoadPreviousScene() { string text = LastScene; if (string.IsNullOrEmpty(text)) { text = "Main Menu"; } SceneHelper.LoadScene(text, false); } public void SpawnFinalPitAndFinish() { //IL_006f: 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_0039: Unknown result type (might be due to invalid IL or missing references) FinalRoom val = Object.FindObjectOfType<FinalRoom>(); if ((Object)(object)val != (Object)null) { if ((Object)(object)val.doorOpener != (Object)null) { val.doorOpener.SetActive(true); } ((Component)MonoSingleton<NewMovement>.Instance).transform.position = val.dropPoint.position; } else { GameObject obj = Object.Instantiate<GameObject>(AssetHelper.LoadPrefab(finalRoomPit)); val = obj.GetComponent<FinalRoom>(); obj.transform.position = new Vector3(50000f, -1000f, 50000f); ((Component)MonoSingleton<NewMovement>.Instance).transform.position = val.dropPoint.position; } } public void SetLoadingSubtext(string text) { if ((Object)(object)loadingBlocker != (Object)null) { ((Component)loadingBar).gameObject.SetActive(true); loadingBar.text = text; } } public int? GetLevelIndexAfterIntermission(string intermissionScene) { //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_0030: 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) int? result; if ((Object)(object)embeddedSceneInfo == (Object)null) { result = null; } else { IntermissionRelation[] intermissions = embeddedSceneInfo.intermissions; foreach (IntermissionRelation val in intermissions) { if (val.intermissionScene == intermissionScene) { return val.nextLevelIndex; } } result = null; } return result; } } public class LevelChecker : MonoBehaviour { private string filePath; private string firstLevelInfoPath = Path.Combine(GameProgressSaver.SavePath, "lvl500progress.bepis"); private string secondLevelInfoPath = Path.Combine(GameProgressSaver.SavePath, "lvl501progress.bepis"); private string thirdLevelInfoPath = Path.Combine(GameProgressSaver.SavePath, "lvl502progress.bepis"); public bool isFirstLevel; public bool isSecondLevel; public bool isThirdLevel; [Header("Objects to Disable")] [Tooltip("List of GameObjects to disable if the level's saved data does not exist.")] public List<GameObject> objectsToDisable; private void Start() { CheckFileAndDisableObjects(); } private void CheckFileAndDisableObjects() { if (!isFirstLevel) { if (!isSecondLevel) { if (isThirdLevel) { filePath = thirdLevelInfoPath; } } else { filePath = secondLevelInfoPath; } } else { filePath = firstLevelInfoPath; } if (File.Exists(filePath)) { return; } foreach (GameObject item in objectsToDisable) { if ((Object)(object)item != (Object)null) { item.SetActive(false); } } } } public class PRankMaterialChanger : MonoBehaviour { [SerializeField] private bool isFirstLevel; [SerializeField] private bool isSecondLevel; [SerializeField] private bool isThirdLevel; [SerializeField] private Material newMaterial; private void Start() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; string path = Path.Combine(configPath, "HatefulScripts" + directorySeparatorChar + "rankScores.json"); if (!File.Exists(path)) { Debug.Log((object)"JSON file not found, returning."); return; } JObject val = JObject.Parse(File.ReadAllText(path)); bool flag = false; bool flag2; if (isFirstLevel) { JToken val2 = val["firstLevel"]; if (val2 == null) { flag2 = false; } else { JToken val3 = val2[(object)"isPRanked"]; flag2 = ((val3 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val3)) : null) == true; } } else { flag2 = false; } if (flag2) { ChangeMaterial(); flag = true; } else { bool flag3; if (isSecondLevel) { JToken val4 = val["secondLevel"]; if (val4 == null) { flag3 = false; } else { JToken val5 = val4[(object)"isPRanked"]; flag3 = ((val5 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val5)) : null) == true; } } else { flag3 = false; } if (flag3) { ChangeMaterial(); flag = true; } else { bool flag4; if (isThirdLevel) { JToken val6 = val["thirdLevel"]; if (val6 == null) { flag4 = false; } else { JToken val7 = val6[(object)"isPRanked"]; flag4 = ((val7 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val7)) : null) == true; } } else { flag4 = false; } if (flag4) { ChangeMaterial(); flag = true; } } } if (!flag) { Debug.Log((object)"No conditions met for changing material, returning."); } } private void ChangeMaterial() { Renderer component = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.material = newMaterial; Debug.Log((object)("Material changed to: " + ((Object)newMaterial).name)); } else { Debug.LogError((object)"Renderer component not found on the GameObject."); } } } public class RankScoreChecker : MonoBehaviour { private AssistController asscon; [SerializeField] private StatsManager stman; [SerializeField] private bool isFirstLevel; [SerializeField] private bool isSecondLevel; [SerializeField] private bool isThirdLevel; private int rankScore; public static string getConfigPath() { string configPath = Paths.ConfigPath; if (configPath == null) { Debug.LogError((object)"Paths.ConfigPath is null."); return null; } string[] array = new string[1]; char directorySeparatorChar = Path.DirectorySeparatorChar; array[0] = configPath + directorySeparatorChar + "HatefulScripts"; return Path.Combine(array); } private void OnTriggerEnter(Collider other) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown if ((Object)(object)stman == (Object)null) { Debug.LogError((object)"StatsManager (stman) is not assigned."); return; } rankScore = stman.rankScore; asscon = MonoSingleton<AssistController>.Instance; if ((Object)(object)asscon == (Object)null) { Debug.LogError((object)"AssistController (asscon) is not assigned."); } else { if (rankScore != 12 || asscon.cheatsEnabled) { return; } string configPath = getConfigPath(); if (configPath == null) { Debug.LogError((object)"Config path is null."); return; } string text = Path.Combine(configPath, "rankScores.json"); if (!Directory.Exists(configPath)) { Directory.CreateDirectory(configPath); } JObject val = (JObject)((!File.Exists(text)) ? ((object)new JObject()) : ((object)JObject.Parse(File.ReadAllText(text)))); bool flag; if (isFirstLevel) { JToken val2 = val["firstLevel"]; if (val2 == null) { flag = false; } else { JToken val3 = val2[(object)"isPRanked"]; flag = ((val3 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val3)) : null) == true; } } else { flag = false; } if (flag) { Debug.Log((object)"firstLevel is already PRanked, returning."); return; } bool flag2; if (isSecondLevel) { JToken val4 = val["secondLevel"]; if (val4 == null) { flag2 = false; } else { JToken val5 = val4[(object)"isPRanked"]; flag2 = ((val5 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val5)) : null) == true; } } else { flag2 = false; } if (flag2) { Debug.Log((object)"secondLevel is already PRanked, returning."); return; } bool flag3; if (isThirdLevel) { JToken val6 = val["thirdLevel"]; if (val6 == null) { flag3 = false; } else { JToken val7 = val6[(object)"isPRanked"]; flag3 = ((val7 != null) ? new bool?(Extensions.Value<bool>((IEnumerable<JToken>)val7)) : null) == true; } } else { flag3 = false; } if (flag3) { Debug.Log((object)"thirdLevel is already PRanked, returning."); return; } if (isFirstLevel) { string text2 = "firstLevel"; JObject val8 = new JObject(); val8["isPRanked"] = JToken.op_Implicit(true); val[text2] = (JToken)(object)val8; } if (isSecondLevel) { string text3 = "secondLevel"; JObject val9 = new JObject(); val9["isPRanked"] = JToken.op_Implicit(true); val[text3] = (JToken)(object)val9; } if (isThirdLevel) { string text4 = "thirdLevel"; JObject val10 = new JObject(); val10["isPRanked"] = JToken.op_Implicit(true); val[text4] = (JToken)(object)val10; } File.WriteAllText(text, ((object)val).ToString()); Debug.Log((object)("Data saved to JSON file: " + text)); } } } [RequireComponent(typeof(Camera))] [ExecuteInEditMode] public class ScreenSpaceLocalReflection : MonoBehaviour { private enum Quality { High, Middle, Low } [SerializeField] private Shader shader; [Header("Quality")] [SerializeField] private Quality quality = Quality.Middle; [Range(0f, 1f)] [SerializeField] private float resolution = 0.5f; [Header("Raytrace")] [SerializeField] private float raytraceMaxLength = 2f; [SerializeField] private float raytraceMaxThickness = 0.2f; [Header("Blur")] [SerializeField] private Vector2 blurOffset = new Vector2(1f, 1f); [Range(0f, 10f)] [SerializeField] private uint blurNum = 3u; [Header("Reflection")] [Range(0f, 5f)] [SerializeField] private float reflectionEnhancer = 1f; [Header("Smoothness")] [SerializeField] private bool useSmoothness; [Range(3f, 10f)] [SerializeField] private int maxSmoothness = 5; [Header("Accumulation")] [Range(0f, 1f)] [SerializeField] private float accumulationBlendRatio = 0.1f; private Material material_; private Mesh screenQuad_; private RenderTexture[] accumulationTextures_ = (RenderTexture[])(object)new RenderTexture[2]; private Matrix4x4 preViewProj_ = Matrix4x4.identity; private int width => (int)((float)((Component)this).GetComponent<Camera>().pixelWidth * resolution); private int height => (int)((float)((Component)this).GetComponent<Camera>().pixelHeight * resolution); private Mesh CreateQuad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); ((Object)val).name = "Quad"; val.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(1f, 1f, 0f), new Vector3(-1f, 1f, 0f), new Vector3(-1f, -1f, 0f), new Vector3(1f, -1f, 0f) }; val.triangles = new int[6] { 0, 1, 2, 2, 3, 0 }; return val; } private void ReleaseTexture(ref RenderTexture texture) { if ((Object)(object)texture != (Object)null) { texture.Release(); texture = null; } } private void UpdateTexture(ref RenderTexture texture, RenderTextureFormat format) { //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_0068: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)texture != (Object)null && (((Texture)texture).width != width || ((Texture)texture).height != height)) { ReleaseTexture(ref texture); } if ((Object)(object)texture == (Object)null || !texture.IsCreated()) { texture = new RenderTexture(width, height, 0, format); ((Texture)texture).filterMode = (FilterMode)1; texture.useMipMap = false; texture.enableRandomWrite = true; texture.Create(); Graphics.SetRenderTarget(texture); GL.Clear(false, true, new Color(0f, 0f, 0f, 0f)); } } private void ReleaseTextures() { for (int i = 0; i < 2; i++) { ReleaseTexture(ref accumulationTextures_[i]); } } private void UpdateAccumulationTexture() { for (int i = 0; i < 2; i++) { UpdateTexture(ref accumulationTextures_[i], (RenderTextureFormat)0); } } [ImageEffectOpaque] private void OnRenderImage(RenderTexture src, RenderTexture dst) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)shader == (Object)null)) { if ((Object)(object)material_ == (Object)null) { material_ = new Material(shader); } if ((Object)(object)screenQuad_ == (Object)null) { screenQuad_ = CreateQuad(); } UpdateAccumulationTexture(); material_.SetVector("_Params1", new Vector4(raytraceMaxLength, raytraceMaxThickness, reflectionEnhancer, accumulationBlendRatio)); Camera component = ((Component)this).GetComponent<Camera>(); Matrix4x4 worldToCameraMatrix = component.worldToCameraMatrix; Matrix4x4 val = GL.GetGPUProjectionMatrix(component.projectionMatrix, false) * worldToCameraMatrix; material_.SetMatrix("_ViewProj", val); material_.SetMatrix("_InvViewProj", ((Matrix4x4)(ref val)).inverse); RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0, (RenderTextureFormat)0); ((Texture)temporary).filterMode = (FilterMode)1; RenderTexture temporary2 = RenderTexture.GetTemporary(width, height, 0, (RenderTextureFormat)0); ((Texture)temporary2).filterMode = (FilterMode)1; RenderTexture temporary3 = RenderTexture.GetTemporary(width, height, 0, (RenderTextureFormat)0); ((Texture)temporary3).filterMode = (FilterMode)1; switch (quality) { case Quality.High: material_.EnableKeyword("QUALITY_HIGH"); material_.DisableKeyword("QUALITY_MIDDLE"); material_.DisableKeyword("QUALITY_LOW"); break; case Quality.Middle: material_.DisableKeyword("QUALITY_HIGH"); material_.EnableKeyword("QUALITY_MIDDLE"); material_.DisableKeyword("QUALITY_LOW"); break; case Quality.Low: material_.DisableKeyword("QUALITY_HIGH"); material_.DisableKeyword("QUALITY_MIDDLE"); material_.EnableKeyword("QUALITY_LOW"); break; } Graphics.Blit((Texture)(object)src, temporary, material_, 0); material_.SetTexture("_ReflectionTexture", (Texture)(object)temporary); if (blurNum != 0) { Graphics.SetRenderTarget(temporary2); material_.SetVector("_BlurParams", new Vector4(blurOffset.x, 0f, (float)blurNum, 0f)); material_.SetPass(1); Graphics.DrawMeshNow(screenQuad_, Matrix4x4.identity); material_.SetTexture("_ReflectionTexture", (Texture)(object)temporary2); Graphics.SetRenderTarget(temporary3); material_.SetVector("_BlurParams", new Vector4(0f, blurOffset.y, (float)blurNum, 0f)); material_.SetPass(1); Graphics.DrawMeshNow(screenQuad_, Matrix4x4.identity); material_.SetTexture("_ReflectionTexture", (Texture)(object)temporary3); } if (preViewProj_ == Matrix4x4.identity) { preViewProj_ = val; } Graphics.SetRenderTarget(accumulationTextures_[0]); material_.SetMatrix("_PreViewProj", preViewProj_); material_.SetTexture("_PreAccumulationTexture", (Texture)(object)accumulationTextures_[1]); material_.SetPass(2); Graphics.DrawMeshNow(screenQuad_, Matrix4x4.identity); material_.SetTexture("_AccumulationTexture", (Texture)(object)accumulationTextures_[0]); RenderTexture val2 = accumulationTextures_[1]; accumulationTextures_[1] = accumulationTextures_[0]; accumulationTextures_[0] = val2; preViewProj_ = val; if (useSmoothness) { material_.EnableKeyword("USE_SMOOTHNESS"); material_.SetTexture("_ReflectionTexture", (Texture)(object)accumulationTextures_[1]); Graphics.SetRenderTarget(temporary2); material_.SetVector("_BlurParams", new Vector4(blurOffset.x, 0f, (float)maxSmoothness, 0f)); material_.SetPass(1); Graphics.DrawMeshNow(screenQuad_, Matrix4x4.identity); Graphics.SetRenderTarget(temporary3); material_.SetTexture("_ReflectionTexture", (Texture)(object)temporary2); material_.SetVector("_BlurParams", new Vector4(0f, blurOffset.y, (float)maxSmoothness, 0f)); material_.SetPass(1); Graphics.DrawMeshNow(screenQuad_, Matrix4x4.identity); material_.SetTexture("_SmoothnessTexture", (Texture)(object)temporary3); } else { material_.DisableKeyword("USE_SMOOTHNESS"); } Graphics.SetRenderTarget(dst); Graphics.Blit((Texture)(object)src, dst, material_, 3); RenderTexture.ReleaseTemporary(temporary); RenderTexture.ReleaseTemporary(temporary2); RenderTexture.ReleaseTemporary(temporary3); } } } public static class ShaderManager { public class ShaderInfo { public string Name { get; set; } } public static Dictionary<string, Shader> shaderDictionary = new Dictionary<string, Shader>(); private static HashSet<Material> modifiedMaterials = new HashSet<Material>(); public static IEnumerator LoadShadersAsync() { AsyncOperationHandle<IResourceLocator> handle = Addressables.InitializeAsync(); while (!handle.IsDone) { yield return null; } if ((int)handle.Status == 1) { IResourceLocator result = handle.Result; foreach (string key in ((ResourceLocationMap)result).Keys) { if (!key.EndsWith(".shader")) { continue; } AsyncOperationHandle<Shader> shaderHandle = Addressables.LoadAssetAsync<Shader>((object)key); while (!shaderHandle.IsDone) { yield return null; } if ((int)shaderHandle.Status == 1) { Shader result2 = shaderHandle.Result; if ((Object)(object)result2 != (Object)null && ((Object)result2).name != "ULTRAKILL/PostProcessV2" && !shaderDictionary.ContainsKey(((Object)result2).name)) { shaderDictionary[((Object)result2).name] = result2; } } else { Debug.LogError((object)("Failed to load shader: " + shaderHandle.OperationException)); } } } else { Debug.LogError((object)("Addressables initialization failed: " + handle.OperationException)); } } public static string ModPath() { return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar)); } public static IEnumerator ApplyShadersAsync(GameObject[] allGameObjects) { if (allGameObjects == null) { yield break; } foreach (GameObject val in allGameObjects) { if ((Object)(object)val == (Object)null) { continue; } Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null) { continue; } Material[] array = (Material[])(object)new Material[val2.sharedMaterials.Length]; for (int k = 0; k < val2.sharedMaterials.Length; k++) { Material val3 = (array[k] = val2.sharedMaterials[k]); if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3.shader == (Object)null) && !modifiedMaterials.Contains(val3) && !(((Object)val3.shader).name == "ULTRAKILL/PostProcessV2") && shaderDictionary.TryGetValue(((Object)val3.shader).name, out var value)) { array[k].shader = value; modifiedMaterials.Add(val3); } } val2.materials = array; } yield return null; } } public static IEnumerator ApplyShadersAsyncContinuously() { new GameObject("ShaderManagerObject").AddComponent<ShaderManagerRunner>().StartApplyingShaders(); yield return null; } public static void CreateShaderDictionary() { List<ShaderInfo> list = new List<ShaderInfo>(); Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader shader in array) { if (!list.Any((ShaderInfo s) => s.Name == ((Object)shader).name)) { list.Add(new ShaderInfo { Name = ((Object)shader).name }); } } string contents = JsonConvert.SerializeObject((object)list, (Formatting)1); File.WriteAllText(Path.Combine(ModPath(), "ShaderList.json"), contents); } public static IEnumerator LoadShadersFromDictionaryAsync() { string path = Path.Combine(ModPath(), "ShaderList.json"); if (!File.Exists(path)) { yield break; } Task<string> shaderDataTask = ReadAllTextAsync(path); while (!shaderDataTask.IsCompleted) { yield return null; } List<ShaderInfo> list = JsonConvert.DeserializeObject<List<ShaderInfo>>(shaderDataTask.Result); Dictionary<string, Shader> dictionary = new Dictionary<string, Shader>(); foreach (ShaderInfo item in list) { Shader val = Shader.Find(item.Name); if ((Object)(object)val != (Object)null) { if (!dictionary.ContainsKey(item.Name)) { dictionary[item.Name] = val; } else { Debug.LogWarning((object)("Duplicate shader name found: " + item.Name)); } } } Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val2 in array) { if (dictionary.TryGetValue(((Object)val2.shader).name, out var value) && (Object)(object)val2.shader != (Object)(object)value) { val2.shader = value; } } } private static async Task<string> ReadAllTextAsync(string path) { using StreamReader reader = new StreamReader(path); return await reader.ReadToEndAsync(); } } public class ShaderManagerRunner : MonoBehaviour { public void StartApplyingShaders() { ((MonoBehaviour)this).StartCoroutine(ApplyShadersContinuously()); } private IEnumerator ApplyShadersContinuously() { while (true) { yield return (object)new WaitForSeconds(0.15f); Scene activeScene = SceneManager.GetActiveScene(); yield return ShaderManager.ApplyShadersAsync(((Scene)(ref activeScene)).GetRootGameObjects()); yield return ShaderManager.LoadShadersFromDictionaryAsync(); } } } public class ShaderReplacerThing : MonoBehaviour { private void Start() { Plugin.Fixorsmth(); } } public class TriggerZoneBehavior : MonoBehaviour { public float delay = 2f; public float activationDelay = 0.1f; private bool hasActivated; private List<Transform> ignoreList = new List<Transform>(); private void Start() { Collider component = ((Component)this).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { component.isTrigger = true; } DelayedInitialization(); } private void DelayedInitialization() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in ((Component)this).transform) { ((Component)item).gameObject.SetActive(false); } } private IEnumerator ActivateChildrenWithDelay() { bool allChildrenActivated; do { allChildrenActivated = true; foreach (object item in ((Component)this).transform) { Transform child = (Transform)item; if ((Object)(object)child == (Object)null) { continue; } if (!ignoreList.Contains(child) && !((Object)child).name.Contains("Gore Zone") && !((Component)child).gameObject.activeSelf) { allChildrenActivated = false; if (((Object)child).name != null && (((Object)child).name != "NoPass(Clone)" || (Object)(object)((Component)child).GetComponent<AddressableReplacer>() == (Object)null)) { yield return (object)new WaitForSeconds(activationDelay); } ((Component)child).gameObject.SetActive(true); Debug.Log((object)("Trigger Activated child: " + ((Object)child).name)); } else { ignoreList.Add(child); } } } while (!allChildrenActivated); hasActivated = true; } private void OnTriggerEnter(Collider other) { if (((Object)((Component)other).gameObject).name == "Player" && !hasActivated) { ((MonoBehaviour)this).StartCoroutine(ActivateChildrenWithDelay()); } } } public class WaveComponent : MonoBehaviour { public float checkInterval = 1f; private float timer; private float activationDelay = 0.1f; private bool hasActivated; private List<Transform> activatedChildren = new List<Transform>(); private List<Transform> ignoreList = new List<Transform>(); private void Start() { DisableAllChildren(); } private void DisableAllChildren() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in ((Component)this).transform) { ((Component)item).gameObject.SetActive(false); } } private void Update() { timer += Time.deltaTime; if (timer >= checkInterval) { timer = 0f; CheckChildren(); } } private IEnumerator ActivateChildrenWithDelay(Transform[] childrenToActivate) { foreach (Transform val in childrenToActivate) { if (((Object)val).name != "NoPass(Clone)" || (Object)(object)((Component)val).GetComponent<AddressableReplacer>() == (Object)null) { ((Component)val).gameObject.SetActive(true); yield return (object)new WaitForSeconds(activationDelay); } else { ((Component)val).gameObject.SetActive(true); } } } private void CheckChildren() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject; List<GameObject> list = new List<GameObject>(); foreach (Transform item in ((Component)this).transform) { Transform val = item; list.Add(((Component)val).gameObject); } List<Transform> list2 = new List<Transform>(); list2.AddRange(gameObject.GetComponentsInChildren<Transform>()); list2.Remove(((Component)this).transform); List<Transform> list3 = new List<Transform>(); foreach (Transform item2 in list2) { EnemyIdentifier component = ((Component)item2).GetComponent<EnemyIdentifier>(); if ((Object)(object)component != (Object)null && !component.dead) { list3.Add(item2); } else if ((Object)(object)component != (Object)null && component.dead && list3.Contains(item2)) { list3.Remove(item2); } } Transform[] array = (Transform[])(object)new Transform[list.Count]; for (int i = 0; i < list.Count; i++) { array[i] = list[i].transform; } if (list3.Count == 0 && !hasActivated) { hasActivated = true; ((MonoBehaviour)this).StartCoroutine(ActivateChildrenWithDelay(array)); } } } public class Wretch : MonoBehaviour { private Coroutine gasolineCoroutine; private NavMeshAgent nma; [SerializeField] private SwingCheck2 sc; [SerializeField] private GameObject weakpoint; private Animator anim; public Transform EnrageSpot; public GameObject flash; public GameObject blueflash; public Transform parryTransform; private EnemyIdentifier eid; private Machine mach; private Rigidbody rb; private bool inAction; private bool enraged; private int difficulty; private EnemySimplifier[] ensims; public GameObject enrageEffect; public GameObject gasoline; private GameObject currentEnrageEffect; private bool moving; private float maxHealth; public bool isEnraged { get; private set; } private void Start() { nma = ((Component)this).GetComponent<NavMeshAgent>(); anim = ((Component)this).GetComponent<Animator>(); eid = ((Component)this).GetComponent<EnemyIdentifier>(); mach = ((Component)this).GetComponent<Machine>(); maxHealth = mach.health; rb = ((Component)this).GetComponent<Rigidbody>(); anim.SetFloat("Speed", 1f); if (eid.difficultyOverride >= 0) { difficulty = eid.difficultyOverride; } else { difficulty = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0); } SlowUpdate(); if (difficulty > 2) { gasolineCoroutine = ((MonoBehaviour)this).StartCoroutine(InstantiateGasolineRoutine()); } } private IEnumerator InstantiateGasolineRoutine() { RaycastHit val = default(RaycastHit); while (true) { if ((Object)(object)gasoline != (Object)null && Physics.Raycast(((Component)this).gameObject.transform.position, Vector3.down, ref val, 120f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)))) { Object.Instantiate<GameObject>(gasoline, ((RaycastHit)(ref val)).point, Quaternion.identity); } yield return (object)new WaitForSeconds(0.5f); } } private void SlowUpdate() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).Invoke("SlowUpdate", 0.25f); RaycastHit val = default(RaycastHit); if (eid.target != null && !inAction && ((Behaviour)nma).enabled && nma.isOnNavMesh && Physics.Raycast(eid.target.position, Vector3.down, ref val, 120f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)))) { nma.SetDestination(((RaycastHit)(ref val)).point); } } private void Update() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_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_00c7: Unknown result type (might be due to invalid IL or missing r