Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Empress Hub World v1.0.1
BepInEx\plugins\Empress-Repo64\Repo64.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using TMPro; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Repo64")] [assembly: AssemblyTitle("Repo64")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.Repo64 { internal static class Repo64Access { private delegate void ModuleSetAllChecklistDelegate(Module module); private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info); private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone"); private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera"); private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor"); private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew"); private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious"); private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp"); private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor"); private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew"); private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious"); private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance"); private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew"); private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious"); private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance"); private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew"); private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious"); private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady"); private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady"); private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned"); private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned"); private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious"); private static readonly FieldInfo RunManagerGameOverField = AccessTools.Field(typeof(RunManager), "gameOver"); private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone"); private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX"); private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY"); private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First"); private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom"); private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null); private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null); private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod); public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentFogColorField, director, color); SetField(EnvironmentFogColorNewField, director, color); SetField(EnvironmentFogColorPreviousField, director, color); SetField(EnvironmentFogStartDistanceField, director, startDistance); SetField(EnvironmentFogStartDistanceNewField, director, startDistance); SetField(EnvironmentFogStartDistancePreviousField, director, startDistance); SetField(EnvironmentFogEndDistanceField, director, endDistance); SetField(EnvironmentFogEndDistanceNewField, director, endDistance); SetField(EnvironmentFogEndDistancePreviousField, director, endDistance); } public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentAmbientColorField, director, ambient); SetField(EnvironmentAmbientColorNewField, director, ambient); SetField(EnvironmentAmbientColorPreviousField, director, ambient); SetField(EnvironmentAmbientColorAdaptationField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation); } public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value) { SetField(EnvironmentDarkAdaptationLerpField, director, value); } public static Camera GetEnvironmentMainCamera(EnvironmentDirector director) { return Get<Camera>(EnvironmentMainCameraField, director); } public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera) { SetField(EnvironmentMainCameraField, director, camera); } public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value) { SetField(EnvironmentSetupDoneField, director, value); } public static void SetAllPlayersReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorAllPlayersReadyField, generator, value); } public static bool GetAllPlayersReady(LevelGenerator generator) { return GetBool(LevelGeneratorAllPlayersReadyField, generator); } public static void SetEnemyReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorEnemyReadyField, generator, value); } public static void SetModulesSpawned(LevelGenerator generator, int value) { SetField(LevelGeneratorModulesSpawnedField, generator, value); } public static void SetPlayerSpawnedCount(LevelGenerator generator, int value) { SetField(LevelGeneratorPlayerSpawnedField, generator, value); } public static int GetPlayerSpawnedCount(LevelGenerator generator) { return GetInt(LevelGeneratorPlayerSpawnedField, generator); } public static void SetLevelPrevious(RunManager manager, Level level) { SetField(RunManagerLevelPreviousField, manager, level); } public static bool GetGameOver(RunManager manager) { return GetBool(RunManagerGameOverField, manager); } public static bool GetIsDisabled(PlayerAvatar avatar) { return GetBool(PlayerAvatarIsDisabledField, avatar); } public static bool GetDeadSet(PlayerAvatar avatar) { return GetBool(PlayerAvatarDeadSetField, avatar); } public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar) { return Get<PlayerTumble>(PlayerAvatarTumbleField, avatar); } public static void ConfigureStartRoomModule(Module module, int gridX, int gridY) { ModuleSetAllChecklistCall?.Invoke(module); SetField(ModuleSetupDoneField, module, true); SetField(ModuleStartRoomField, module, true); SetField(ModuleFirstField, module, true); SetField(ModuleGridXField, module, gridX); SetField(ModuleGridYField, module, gridY); } public static void MarkLevelPointInStartRoom(LevelPoint point, bool value) { SetField(LevelPointInStartRoomField, point, value); } public static void GenerateDone(LevelGenerator generator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo)); } private static T Get<T>(FieldInfo field, object instance) where T : class { if (field == null || instance == null) { return null; } return field.GetValue(instance) as T; } private static bool GetBool(FieldInfo field, object instance) { if (field == null || instance == null) { return false; } object value = field.GetValue(instance); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private static int GetInt(FieldInfo field, object instance) { if (field == null || instance == null) { return 0; } object value = field.GetValue(instance); if (value is int) { return (int)value; } return 0; } private static void SetField(FieldInfo field, object instance, object value) { if (!(field == null) && instance != null) { field.SetValue(instance, value); } } private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true); } } internal enum Repo64MusicTrack { Hub, Cutscene, Course } internal static class Repo64Audio { private const int SampleRate = 44100; public const string HubMusicFile = "repo64_hub.ogg"; public const string CutsceneMusicFile = "repo64_cutscene.ogg"; public const string CourseMusicFile = "repo64_course.ogg"; private static AudioClip _chime; private static AudioClip _unlock; private static AudioClip _whoosh; private static AudioClip _sting; private static AudioClip _quack; private static AudioClip _fanfare; private static AudioClip _click; private static AudioClip _thud; private static AudioClip _hubMusic; private static AudioClip _cutsceneMusic; private static AudioClip _courseMusic; private static AudioSource _musicSource; private static bool _initialized; public static void Initialize() { if (!_initialized) { _initialized = true; _chime = BuildChime(); _unlock = BuildUnlock(); _whoosh = BuildWhoosh(); _sting = BuildSting(); _quack = BuildQuack(); _fanfare = BuildFanfare(); _click = BuildClick(); _thud = BuildThud(); } } public static void LoadMusicAsync(MonoBehaviour host) { if (!((Object)(object)host == (Object)null) && !string.IsNullOrEmpty(Repo64Plugin.PluginDirectory)) { host.StartCoroutine(LoadOgg(Path.Combine(Repo64Plugin.PluginDirectory, "repo64_hub.ogg"), delegate(AudioClip clip) { _hubMusic = clip; })); host.StartCoroutine(LoadOgg(Path.Combine(Repo64Plugin.PluginDirectory, "repo64_cutscene.ogg"), delegate(AudioClip clip) { _cutsceneMusic = clip; })); host.StartCoroutine(LoadOgg(Path.Combine(Repo64Plugin.PluginDirectory, "repo64_course.ogg"), delegate(AudioClip clip) { _courseMusic = clip; })); } } private static IEnumerator LoadOgg(string path, Action<AudioClip> onLoaded) { if (!File.Exists(path)) { Repo64Plugin.DebugLog("Repo64 optional music not found: " + Path.GetFileName(path)); yield break; } string text = "file:///" + path.Replace("\\", "/"); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)14); try { yield return request.SendWebRequest(); if ((int)request.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content != (Object)null) { ((Object)content).name = Path.GetFileNameWithoutExtension(path); onLoaded?.Invoke(content); Repo64Plugin.DebugLog("Repo64 loaded music: " + Path.GetFileName(path)); } } else { Repo64Plugin.Log.LogWarning((object)("Repo64 failed to load music " + Path.GetFileName(path) + ": " + request.error)); } } finally { ((IDisposable)request)?.Dispose(); } } public static void PlayMusic(Repo64MusicTrack track, bool loop) { AudioClip val = (AudioClip)(track switch { Repo64MusicTrack.Cutscene => _cutsceneMusic, Repo64MusicTrack.Hub => _hubMusic, _ => _courseMusic, }); EnsureMusicSource(); if (!((Object)(object)_musicSource == (Object)null)) { if ((Object)(object)val == (Object)null) { _musicSource.Stop(); return; } float num = ((Repo64Plugin.Settings != null) ? Repo64Plugin.Settings.MusicVolume.Value : 0.6f); _musicSource.clip = val; _musicSource.loop = loop; _musicSource.volume = Mathf.Clamp01(num); _musicSource.Play(); } } public static void StopMusic() { if ((Object)(object)_musicSource != (Object)null) { _musicSource.Stop(); } } private static void EnsureMusicSource() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_musicSource != (Object)null)) { GameObject val = new GameObject("Repo64 Music"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; _musicSource = val.AddComponent<AudioSource>(); _musicSource.spatialBlend = 0f; _musicSource.playOnAwake = false; _musicSource.priority = 0; } } public static void PlayChime(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_chime, position, 0.6f, 0.98f, 1.04f); } public static void PlayUnlock(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_unlock, position, 0.75f, 0.95f, 1.05f); } public static void PlayWhoosh(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_whoosh, position, 0.7f, 0.92f, 1.08f); } public static void PlaySting(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_sting, position, 0.7f, 0.9f, 1.05f); } public static void PlayQuack(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_quack, position, 0.8f, 0.9f, 1.15f); } public static void PlayFanfare(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_fanfare, position, 0.85f, 0.99f, 1.01f); } public static void PlayClick(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_click, position, 0.5f, 0.95f, 1.05f); } public static void PlayThud(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_thud, position, 0.6f, 0.9f, 1.1f); } private static void Play(AudioClip clip, Vector3 position, float volume, float pitchMin, float pitchMax) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { float num = ((Repo64Plugin.Settings != null) ? Repo64Plugin.Settings.MasterVolume.Value : 0.85f); if (!(num <= 0f)) { GameObject val = new GameObject("Repo64 Audio"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.volume = Mathf.Clamp01(volume * num); val2.pitch = Random.Range(pitchMin, pitchMax); val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 2f; val2.maxDistance = 40f; val2.dopplerLevel = 0f; val2.Play(); Object.Destroy((Object)val, clip.length / Mathf.Max(0.5f, val2.pitch) + 0.2f); } } } private static AudioClip MakeClip(string name, float[] data) { AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false); obj.SetData(data, 0); return obj; } private static AudioClip BuildChime() { int num = 39690; float[] array = new float[num]; float[] array2 = new float[3] { 784f, 1046f, 1318f }; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = 0f; for (int j = 0; j < array2.Length; j++) { float num4 = (float)j * 0.12f; if (!(num2 < num4)) { float num5 = num2 - num4; num3 += Mathf.Sin(MathF.PI * 2f * array2[j] * num5) * Mathf.Exp((0f - num5) / 0.25f); } } array[i] = Mathf.Clamp(num3 * 0.3f, -1f, 1f); } return MakeClip("Repo64Chime", array); } private static AudioClip BuildUnlock() { int num = 30870; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Sin(MathF.PI * 440f * num2) * Mathf.Exp((0f - num2) / 0.08f); float num4 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.02f) * 0.5f; float num5 = Mathf.Sin(MathF.PI * 2f * (300f + 500f * num2) * num2) * Mathf.Exp((0f - num2) / 0.3f) * 0.3f; array[i] = Mathf.Clamp(num3 * 0.5f + num4 + num5, -1f, 1f) * 0.7f; } return MakeClip("Repo64Unlock", array); } private static AudioClip BuildWhoosh() { int num = 35280; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = num2 / 0.8f; float num4 = Random.value * 2f - 1f; float num5 = Mathf.Sin(MathF.PI * 2f * (200f + 900f * num3) * num2); float num6 = Mathf.Sin(num3 * MathF.PI); array[i] = Mathf.Clamp((num4 * 0.4f + num5 * 0.3f) * num6, -1f, 1f) * 0.6f; } return MakeClip("Repo64Whoosh", array); } private static AudioClip BuildSting() { int num = 61740; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 1.4f; float num5 = 90f - 40f * num4; num2 += MathF.PI * 2f * num5 / 44100f; float num6 = Mathf.Sin(num2) + 0.4f * Mathf.Sin(num2 * 1.5f); float num7 = Mathf.Sin(MathF.PI * 122f * num3) * 0.3f; float num8 = Mathf.Sin(num4 * MathF.PI); array[i] = Mathf.Clamp((num6 * 0.4f + num7) * num8, -1f, 1f) * 0.6f; } return MakeClip("Repo64Sting", array); } private static AudioClip BuildQuack() { int num = 17640; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f / 0.4f; float num4 = 320f + 160f * Mathf.Sin(num3 * MathF.PI * 2f); num2 += MathF.PI * 2f * num4 / 44100f; float num5 = Mathf.Sign(Mathf.Sin(num2)) * 0.5f + Mathf.Sin(num2) * 0.5f; float num6 = Mathf.Sin(num3 * MathF.PI); array[i] = Mathf.Clamp(num5 * num6, -1f, 1f) * 0.6f; } return MakeClip("Repo64Quack", array); } private static AudioClip BuildFanfare() { int num = 70560; float[] array = new float[num]; float[] array2 = new float[4] { 523f, 659f, 784f, 1046f }; float[] array3 = new float[4] { 0f, 0.18f, 0.36f, 0.6f }; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = 0f; for (int j = 0; j < array2.Length; j++) { if (!(num2 < array3[j])) { float num4 = num2 - array3[j]; float num5 = ((num4 < 0.05f) ? (num4 / 0.05f) : Mathf.Exp((0f - (num4 - 0.05f)) / 0.6f)); num3 += (Mathf.Sin(MathF.PI * 2f * array2[j] * num4) + 0.3f * Mathf.Sin(MathF.PI * 2f * array2[j] * 2f * num4)) * num5; } } array[i] = Mathf.Clamp(num3 * 0.22f, -1f, 1f); } return MakeClip("Repo64Fanfare", array); } private static AudioClip BuildClick() { int num = 5292; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Sin(MathF.PI * 1760f * num2) * Mathf.Exp((0f - num2) / 0.02f); array[i] = Mathf.Clamp(num3, -1f, 1f) * 0.5f; } return MakeClip("Repo64Click", array); } private static AudioClip BuildThud() { int num = 13230; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Sin(MathF.PI * 180f * num2) * Mathf.Exp((0f - num2) / 0.06f); float num4 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.02f) * 0.4f; array[i] = Mathf.Clamp(num3 * 0.7f + num4, -1f, 1f) * 0.6f; } return MakeClip("Repo64Thud", array); } } internal static class Repo64LevelRegistry { private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3"); private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject"); private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject"); public static Level RegisterLevel() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Level val = ScriptableObject.CreateInstance<Level>(); ((Object)val).name = "Level - Empress Hub World"; val.NarrativeName = "Empress Hub World"; LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>(); ((Object)val2).name = "Valuables - Repo64"; val2.tiny = new List<PrefabRef>(); val2.small = new List<PrefabRef>(); val2.medium = new List<PrefabRef>(); val2.big = new List<PrefabRef>(); val2.wide = new List<PrefabRef>(); val2.tall = new List<PrefabRef>(); val2.veryTall = new List<PrefabRef>(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 }); SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>()); SetLevelField(val, "FogColor", (object)new Color(0.06f, 0.05f, 0.12f)); SetLevelField(val, "FogStartDistance", 12f); SetLevelField(val, "FogEndDistance", 95f); SetLevelField(val, "AmbientColor", (object)new Color(0.34f, 0.32f, 0.45f)); SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.16f, 0.15f, 0.22f)); SetLevelField(val, "ColorTemperature", 5f); SetLevelField(val, "ColorFilter", (object)new Color(1f, 0.95f, 0.85f, 1f)); SetLevelField(val, "BloomIntensity", 1.35f); SetLevelField(val, "BloomThreshold", 0.9f); SetLevelField(val, "VignetteColor", (object)new Color(0.03f, 0.02f, 0.06f, 1f)); SetLevelField(val, "VignetteIntensity", 0.32f); SetLevelField(val, "VignetteSmoothness", 0.85f); SetLevelField(val, "DiscordIcon", "level"); EnsureLevelFieldInstance(val, "LoadingGraphic01"); EnsureLevelFieldInstance(val, "LoadingGraphic02"); EnsureLevelFieldInstance(val, "LoadingGraphic03"); EnsureLevelFieldInstance(val, "ConnectObject"); EnsureLevelFieldInstance(val, "BlockObject"); LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>(); ((Object)val3).name = "Empress Hub World Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>(); LevelContentConnectObjectRef.Invoke(val3) = null; LevelContentBlockObjectRef.Invoke(val3) = null; Levels.RegisterLevel(val3); return val; } private static void SetLevelField(Level level, string fieldName, object value) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value)) { fieldInfo.SetValue(level, value); } } private static void EnsureLevelFieldInstance(Level level, string fieldName) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null) { object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType); fieldInfo.SetValue(level, uninitializedObject); } } } internal sealed class Repo64LoadingScreen : MonoBehaviour { private const int StarCount = 48; private const int BarCount = 10; private static readonly Color BackgroundA = new Color(0.015f, 0.012f, 0.04f, 1f); private static readonly Color BackgroundB = new Color(0.06f, 0.025f, 0.11f, 1f); private static readonly Color Gold = new Color(1f, 0.72f, 0.18f, 0.75f); private static readonly Color Cyan = new Color(0.1f, 0.85f, 1f, 0.65f); private static readonly Color Magenta = new Color(1f, 0.18f, 0.75f, 0.55f); private static bool _repo64LoadingActive; private static float _muteUntilRealtime; private readonly List<RectTransform> _stars = new List<RectTransform>(); private readonly List<RectTransform> _bars = new List<RectTransform>(); private GameObject _root; private Image _background; private Image _ringA; private Image _ringB; private Image _ringC; private RectTransform _ringARect; private RectTransform _ringBRect; private RectTransform _ringCRect; private RectTransform _coreRect; private Image _core; private float _time; public static void Show(LoadingUI ui) { if (!((Object)(object)ui == (Object)null)) { Repo64LoadingScreen repo64LoadingScreen = ((Component)ui).GetComponent<Repo64LoadingScreen>(); if ((Object)(object)repo64LoadingScreen == (Object)null) { repo64LoadingScreen = ((Component)ui).gameObject.AddComponent<Repo64LoadingScreen>(); } repo64LoadingScreen.ShowInternal(ui); } } public static void Hide(LoadingUI ui) { if (!((Object)(object)ui == (Object)null)) { Repo64LoadingScreen component = ((Component)ui).GetComponent<Repo64LoadingScreen>(); if ((Object)(object)component != (Object)null) { component.HideInternal(); } } } public static bool OwnsCurrentLoading() { if (_repo64LoadingActive || Time.realtimeSinceStartup < _muteUntilRealtime) { return true; } Level val = null; if (Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { val = LevelGenerator.Instance.Level; } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)RunManager.instance)) { val = RunManager.instance.levelCurrent; } return Repo64Plugin.IsGameLevel(val); } private void ShowInternal(LoadingUI ui) { EnsureBuilt(((Component)ui).transform); ClearGraphic(ui.loadingGraphic01); ClearGraphic(ui.loadingGraphic02); ClearGraphic(ui.loadingGraphic03); _time = 0f; _repo64LoadingActive = true; _muteUntilRealtime = Time.realtimeSinceStartup + 18f; _root.SetActive(true); PlaceLoadingLayers(ui); } private void HideInternal() { _repo64LoadingActive = false; _muteUntilRealtime = Time.realtimeSinceStartup + 1.5f; if ((Object)(object)_root != (Object)null) { _root.SetActive(false); } } private void Update() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root == (Object)null || !_root.activeSelf) { return; } if (!OwnsCurrentLoading()) { _repo64LoadingActive = false; _root.SetActive(false); return; } _time += Time.unscaledDeltaTime; float num = 0.5f + Mathf.Sin(_time * 2.4f) * 0.5f; ((Graphic)_background).color = Color.Lerp(BackgroundA, BackgroundB, num); ((Transform)_ringARect).localRotation = Quaternion.Euler(0f, 0f, _time * 36f); ((Transform)_ringBRect).localRotation = Quaternion.Euler(0f, 0f, (0f - _time) * 58f); ((Transform)_ringCRect).localRotation = Quaternion.Euler(0f, 0f, _time * 92f); float num2 = 0.9f + Mathf.Sin(_time * 5.8f) * 0.08f; ((Transform)_coreRect).localScale = new Vector3(num2, num2, 1f); ((Graphic)_core).color = Color.Lerp(Cyan, Gold, num); for (int i = 0; i < _stars.Count; i++) { RectTransform obj = _stars[i]; Vector2 anchoredPosition = obj.anchoredPosition; anchoredPosition.y -= Time.unscaledDeltaTime * (24f + (float)(i % 7) * 9f); if (anchoredPosition.y < -420f) { anchoredPosition.y = 420f; } obj.anchoredPosition = anchoredPosition; float num3 = 0.7f + Mathf.Sin(_time * 3f + (float)i) * 0.25f; ((Transform)obj).localScale = new Vector3(num3, num3, 1f); } for (int j = 0; j < _bars.Count; j++) { RectTransform obj2 = _bars[j]; Vector2 anchoredPosition2 = obj2.anchoredPosition; anchoredPosition2.x = Mathf.Sin(_time * (0.7f + (float)j * 0.05f) + (float)j) * 90f; obj2.anchoredPosition = anchoredPosition2; } } private void PlaceLoadingLayers(LoadingUI ui) { if (!((Object)(object)_root == (Object)null) && !((Object)(object)ui == (Object)null)) { _root.transform.SetAsLastSibling(); if ((Object)(object)ui.levelNumberText != (Object)null) { BringToFront(((TMP_Text)ui.levelNumberText).transform); } if ((Object)(object)ui.levelNameText != (Object)null) { BringToFront(((TMP_Text)ui.levelNameText).transform); } if ((Object)(object)ui.stuckTransform != (Object)null) { BringToFront((Transform)(object)ui.stuckTransform); } } } private void BringToFront(Transform target) { if (!((Object)(object)target == (Object)null) && !((Object)(object)_root == (Object)null)) { Transform parent = _root.transform.parent; Transform val = target; while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)parent) { val = val.parent; } if ((Object)(object)val.parent == (Object)(object)parent) { val.SetAsLastSibling(); } target.SetAsLastSibling(); } } private void EnsureBuilt(Transform parent) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00d2: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_root != (Object)null)) { _root = CreateObject("Empress Repo64 Loading", parent); Stretch(_root.GetComponent<RectTransform>()); _background = _root.AddComponent<Image>(); ((Graphic)_background).raycastTarget = false; ((Graphic)_background).color = BackgroundA; for (int i = 0; i < 10; i++) { RectTransform rectTransform = ((Graphic)CreateImage("Empress Repo64 Band", _root.transform, (i % 3 == 0) ? Gold : ((i % 3 == 1) ? Cyan : Magenta))).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(1f, 0.5f); rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(0f, (i % 2 == 0) ? 12f : 5f); rectTransform.anchoredPosition = new Vector2(0f, -235f + (float)i * 52f); _bars.Add(rectTransform); } Sprite sprite = CreateRingSprite(); _ringA = CreateImage("Empress Repo64 Ring A", _root.transform, Cyan); _ringB = CreateImage("Empress Repo64 Ring B", _root.transform, Gold); _ringC = CreateImage("Empress Repo64 Ring C", _root.transform, Magenta); _ringA.sprite = sprite; _ringB.sprite = sprite; _ringC.sprite = sprite; _ringARect = ((Graphic)_ringA).rectTransform; _ringBRect = ((Graphic)_ringB).rectTransform; _ringCRect = ((Graphic)_ringC).rectTransform; Center(_ringARect, 360f); Center(_ringBRect, 250f); Center(_ringCRect, 150f); _core = CreateImage("Empress Repo64 Core", _root.transform, Gold); _coreRect = ((Graphic)_core).rectTransform; Center(_coreRect, 58f); for (int j = 0; j < 48; j++) { RectTransform rectTransform2 = ((Graphic)CreateImage("Empress Repo64 Spark", _root.transform, (j % 2 == 0) ? Gold : Cyan)).rectTransform; rectTransform2.anchorMin = new Vector2(0.5f, 0.5f); rectTransform2.anchorMax = new Vector2(0.5f, 0.5f); rectTransform2.sizeDelta = new Vector2((j % 3 == 0) ? 5f : 3f, (j % 3 == 0) ? 5f : 3f); rectTransform2.anchoredPosition = new Vector2(DeterministicRange(j, -560f, 560f), DeterministicRange(j * 7 + 3, -400f, 400f)); _stars.Add(rectTransform2); } _root.SetActive(false); } } private static GameObject CreateObject(string name, Transform parent) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(CanvasRenderer) }); val.transform.SetParent(parent, false); return val; } private static Image CreateImage(string name, Transform parent, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) Image obj = CreateObject(name, parent).AddComponent<Image>(); ((Graphic)obj).raycastTarget = false; ((Graphic)obj).color = color; return obj; } private static void Stretch(RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; rect.pivot = new Vector2(0.5f, 0.5f); } private static void Center(RectTransform rect, float size) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.sizeDelta = new Vector2(size, size); rect.anchoredPosition = Vector2.zero; } private static void ClearGraphic(Image image) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)image == (Object)null)) { image.sprite = null; ((Graphic)image).color = Color.clear; } } private static float DeterministicRange(int seed, float min, float max) { uint num = (uint)(seed * 747796405 + 2891336453u); num = ((num >> (int)((num >> 28) + 4)) ^ num) * 277803737; num = (num >> 22) ^ num; return Mathf.Lerp(min, max, (float)(num & 0xFFFF) / 65535f); } private static Sprite CreateRingSprite() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)0; Color clear = Color.clear; Color white = Color.white; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(63.5f, 63.5f); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), val2); bool flag = num > 45f && num < 52f; bool flag2 = j % 17 < 9 || i % 19 < 11; val.SetPixel(j, i, (flag && flag2) ? white : clear); } } val.Apply(false, true); return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); } } internal static class Repo64Materials { private static int _seed = 6464; public static Material StoneBrickMaterial { get; private set; } public static Material StoneFloorMaterial { get; private set; } public static Material CarpetMaterial { get; private set; } public static Material WoodMaterial { get; private set; } public static Material GoldMaterial { get; private set; } public static Material MarbleMaterial { get; private set; } public static Material GlassMaterial { get; private set; } public static Material TorchMaterial { get; private set; } public static void EnsureCreated() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)StoneBrickMaterial != (Object)null)) { StoneBrickMaterial = OpaqueTextured(Bricks(new Color(0.4f, 0.4f, 0.46f), new Color(0.2f, 0.2f, 0.26f), 24), 0.05f, 0.2f); StoneFloorMaterial = OpaqueTextured(Tiles(new Color(0.46f, 0.43f, 0.4f), new Color(0.26f, 0.24f, 0.22f), 32), 0.1f, 0.35f); CarpetMaterial = OpaqueTextured(Carpet(new Color(0.55f, 0.12f, 0.13f), new Color(0.36f, 0.06f, 0.08f)), 0f, 0.08f); WoodMaterial = OpaqueTextured(Wood(new Color(0.32f, 0.19f, 0.1f), new Color(0.2f, 0.11f, 0.05f)), 0.05f, 0.25f); GoldMaterial = OpaqueColor(new Color(0.85f, 0.68f, 0.25f), 0.95f, 0.78f); MarbleMaterial = OpaqueTextured(Marble(new Color(0.82f, 0.8f, 0.78f), new Color(0.5f, 0.48f, 0.5f)), 0.2f, 0.6f); GlassMaterial = CreateTransparent(new Color(0.4f, 0.55f, 0.75f, 0.35f)); TorchMaterial = CreateEmissive(new Color(1f, 0.6f, 0.2f), 3.2f); } } public static Material CreateEmissive(Color color, float strength) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = new Color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f, 1f); if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.4f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", color * strength); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } public static Material CreateTransparent(Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetInt("_ZWrite", 0); val.DisableKeyword("_ALPHATEST_ON"); val.EnableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.renderQueue = 3000; val.color = color; if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.8f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } return val; } public static Texture2D LoadPaintingTexture(int paintingNumber) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown string pluginDirectory = Repo64Plugin.PluginDirectory; if (string.IsNullOrEmpty(pluginDirectory)) { return null; } string path = Path.Combine(pluginDirectory, "repo64_painting_" + paintingNumber + ".png"); if (!File.Exists(path)) { path = Path.Combine(pluginDirectory, "repo64_painting_" + paintingNumber + ".jpg"); if (!File.Exists(path)) { return null; } } try { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Repo64Plugin.DebugLog("Repo64 loaded painting image: " + Path.GetFileName(path)); return val; } } catch (Exception ex) { Repo64Plugin.Log.LogWarning((object)("Repo64 painting image load failed: " + ex.Message)); } return null; } public static Material CreateRippleMaterial() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Legacy Shaders/Particles/Additive"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Particles/Additive"); } if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } Material val2 = new Material(val); val2.mainTexture = (Texture)(object)Ring(); if (val2.HasProperty("_TintColor")) { val2.SetColor("_TintColor", Color.white); } if (val2.HasProperty("_Color")) { val2.color = Color.white; } val2.renderQueue = 3250; return val2; } private static Texture2D Ring() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = new Texture2D(num, num, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = (float)j / (float)(num - 1) * 2f - 1f; float num3 = (float)i / (float)(num - 1) * 2f - 1f; float num4 = Mathf.Exp(0f - Mathf.Pow((Mathf.Sqrt(num2 * num2 + num3 * num3) - 0.78f) / 0.12f, 2f)); array[i * num + j] = new Color(1f, 1f, 1f, Mathf.Clamp01(num4)); } } val.SetPixels(array); val.Apply(); return val; } public static Material CreatePortalMaterial(Texture2D image, Color top, Color bottom) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.mainTexture = (Texture)(object)(((Object)(object)image != (Object)null) ? image : Canvas(top, bottom)); val.color = Color.white; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.1f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.white * 0.85f); val.SetTexture("_EmissionMap", val.mainTexture); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } return val; } public static Material CreatePaintingCanvas(Color top, Color bottom) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.mainTexture = (Texture)(object)Canvas(top, bottom); val.color = Color.white; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.3f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.Lerp(bottom, top, 0.5f) * 0.7f); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } val.SetTextureScale("_MainTex", Vector2.one); return val; } public static Material OpaqueColor(Color color, float metallic, float gloss) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = color; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", gloss); } return val; } private static Material OpaqueTextured(Texture2D texture, float metallic, float gloss) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); val.color = Color.white; val.mainTexture = (Texture)(object)texture; if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", gloss); } return val; } private static float Noise(int x, int y) { int num = x + y * 57 + _seed * 131; num = (num << 13) ^ num; return 1f - (float)((num * (num * num * 15731 + 789221) + 1376312589) & 0x7FFFFFFF) / 1.0737418E+09f; } private static Texture2D Bricks(Color brick, Color mortar, int cell) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { int num2 = i / (cell / 2) % 2 * (cell / 2); for (int j = 0; j < num; j++) { int num3 = (j + num2) % cell; int num4 = i % (cell / 2); bool num5 = num3 < 3 || num4 < 3; float num6 = Mathf.Clamp01(Noise(j, i) * 0.3f + 0.78f); Color val2 = (num5 ? mortar : (brick * num6)); if (!num5 && Noise(j / 6, i / 6) > 0.82f) { val2 = Color.Lerp(val2, mortar, 0.4f); } array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Tiles(Color tile, Color grout, int cell) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { bool flag = j % cell < 2 || i % cell < 2; float num2 = Mathf.Clamp01(Noise(j / 3, i / 3) * 0.18f + 0.9f); array[i * num + j] = (flag ? grout : (tile * num2)); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Carpet(Color baseColor, Color shade) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = (Noise(j, i) * 0.5f + 0.5f) * 0.25f; float num3 = Mathf.Clamp01(Noise(j / 12, i / 12) * 0.4f + 0.7f); bool num4 = j < 8 || j > num - 8; Color val2 = Color.Lerp(shade, baseColor, 0.5f + num2) * num3; if (num4) { val2 = Color.Lerp(val2, new Color(0.85f, 0.68f, 0.25f), 0.6f); } array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Wood(Color baseColor, Color shade) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = Mathf.Sin((float)j * 0.35f + Noise(j / 8, i / 24) * 3f) * 0.12f; float num3 = ((j % 42 < 2) ? 0.6f : 1f); Color val2 = Color.Lerp(shade, baseColor, 0.6f + num2) * num3; array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Marble(Color baseColor, Color vein) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = Mathf.Abs(Mathf.Sin((float)(j + i) * 0.08f + Noise(j / 5, i / 5) * 4f)); Color val2 = Color.Lerp(baseColor, vein, Mathf.Pow(1f - num2, 6f)); array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D Canvas(Color top, Color bottom) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) int num = 128; Texture2D val = NewTexture(num); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { float num2 = (float)i / (float)num; for (int j = 0; j < num; j++) { float num3 = Mathf.PerlinNoise((float)j * 0.05f + (float)_seed, (float)i * 0.05f) * 0.4f; Color val2 = Color.Lerp(bottom, top, Mathf.Clamp01(num2 + num3 - 0.2f)); float num4 = ((Noise(j / 2, i / 2) > 0.86f) ? 0.4f : 0f); val2 += new Color(num4, num4, num4); array[i * num + j] = val2; } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D NewTexture(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return new Texture2D(size, size, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1 }; } } [HarmonyPatch(typeof(RunManager), "SetRunLevel")] internal static class Repo64PatchSetRunLevel { private static void Postfix(RunManager __instance) { if (Repo64Plugin.Settings != null && !((Object)(object)Repo64Plugin.GameLevel == (Object)null) && (Repo64Plugin.Settings.HubTakeover.Value || Repo64Plugin.Settings.ForceLevel.Value) && !Repo64Access.GetGameOver(__instance) && !((Object)(object)__instance.levelCurrent == (Object)(object)Repo64Plugin.GameLevel) && __instance.levels != null && __instance.levels.Contains(__instance.levelCurrent)) { __instance.levelCurrent = Repo64Plugin.GameLevel; } } } [HarmonyPatch(typeof(LevelGenerator), "Generate")] internal static class Repo64PatchGenerate { private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result) { if (!Repo64Plugin.IsGameLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = Repo64Runtime.EnsureHost().GenerateLevel(__instance); return false; } } [HarmonyPatch(typeof(LevelPoint), "NavMeshCheck")] internal static class Repo64PatchNavMeshCheck { private static bool Prefix(ref IEnumerator __result) { if (!Repo64Plugin.IsGameLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { return true; } __result = Repo64Runtime.EmptyCoroutine(); return false; } } [HarmonyPatch(typeof(EnvironmentDirector), "Setup")] internal static class Repo64PatchEnvironmentSetup { private static bool Prefix(EnvironmentDirector __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_009d: 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) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance)) { return true; } Level level = LevelGenerator.Instance.Level; if (!Object.op_Implicit((Object)(object)level) || !Repo64Plugin.IsGameLevel(level)) { return true; } Repo64Runtime instance = Repo64Runtime.Instance; Color val = (((Object)(object)instance != (Object)null) ? instance.CurrentFogColor : level.FogColor); Color val2 = (((Object)(object)instance != (Object)null) ? instance.CurrentAmbientColor : level.AmbientColor); Repo64Access.SetEnvironmentFog(__instance, val, level.FogStartDistance, level.FogEndDistance); Repo64Access.SetEnvironmentAmbient(__instance, val2, level.AmbientColorAdaptation); RenderSettings.fogColor = val; RenderSettings.fogStartDistance = level.FogStartDistance; RenderSettings.fogEndDistance = level.FogEndDistance; RenderSettings.ambientLight = val2; Camera val3 = Repo64Access.GetEnvironmentMainCamera(__instance); if (!Object.op_Implicit((Object)(object)val3)) { val3 = Camera.main; Repo64Access.SetEnvironmentMainCamera(__instance, val3); } if (Object.op_Implicit((Object)(object)val3)) { val3.backgroundColor = RenderSettings.fogColor; val3.farClipPlane = RenderSettings.fogEndDistance + 10f; } Repo64Access.SetEnvironmentDarkAdaptation(__instance, 0.5f); Repo64Access.SetEnvironmentSetupDone(__instance, value: true); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class Repo64PatchLoadingUi { private static void Postfix(LoadingUI __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!Repo64Plugin.IsGameLevel(Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.Level : null)) { Repo64LoadingScreen.Hide(__instance); return; } Repo64LoadingScreen.Show(__instance); if ((Object)(object)__instance.levelNumberText != (Object)null) { ((TMP_Text)__instance.levelNumberText).text = "HUB"; ((Graphic)__instance.levelNumberText).color = new Color(0.95f, 0.82f, 0.35f); ((Component)__instance.levelNumberText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNumberText).transform.SetAsLastSibling(); } if ((Object)(object)__instance.levelNameText != (Object)null) { ((TMP_Text)__instance.levelNameText).text = "Empress Hub World"; ((Graphic)__instance.levelNameText).color = new Color(0.95f, 0.9f, 0.7f); ((Component)__instance.levelNameText).gameObject.SetActive(true); ((TMP_Text)__instance.levelNameText).transform.SetAsLastSibling(); } } } [HarmonyPatch(typeof(LoadingUI), "StopLoading")] internal static class Repo64PatchLoadingUiStopLoading { private static void Prefix(LoadingUI __instance) { Repo64LoadingScreen.Hide(__instance); } } [HarmonyPatch(typeof(LoadingUI), "PlayTurn")] internal static class Repo64PatchLoadingUiPlayTurn { [HarmonyPriority(800)] private static bool Prefix() { return !Repo64LoadingScreen.OwnsCurrentLoading(); } } [HarmonyPatch(typeof(LoadingUI), "PlayRevUp")] internal static class Repo64PatchLoadingUiPlayRevUp { [HarmonyPriority(800)] private static bool Prefix() { return !Repo64LoadingScreen.OwnsCurrentLoading(); } } [HarmonyPatch(typeof(LoadingUI), "PlayCrash")] internal static class Repo64PatchLoadingUiPlayCrash { [HarmonyPriority(800)] private static bool Prefix() { return !Repo64LoadingScreen.OwnsCurrentLoading(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.empress.repo.repo64", "Empress REPO 64", "1.0.0")] public sealed class Repo64Plugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.repo64"; public const string PluginName = "Empress REPO 64"; public const string PluginVersion = "1.0.0"; public const string LevelName = "Level - Empress Hub World"; public const string DisplayName = "Empress Hub World"; internal const byte PaintingEventCode = 180; internal const byte ProgressEventCode = 181; internal const byte ExitVoteEventCode = 182; internal const byte CourseEventCode = 183; private static bool _photonHooked; private Harmony _harmony; internal static Repo64Plugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static Repo64Settings Settings { get; private set; } internal static Level GameLevel { get; private set; } internal static string PluginDirectory { get; private set; } private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Settings = new Repo64Settings(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); GameLevel = Repo64LevelRegistry.RegisterLevel(); Repo64Audio.Initialize(); _harmony = new Harmony("com.empress.repo.repo64"); _harmony.PatchAll(typeof(Repo64Plugin).Assembly); Repo64Runtime.EnsureHost(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress REPO 64 v1.0.0 loaded. Level registered: Level - Empress Hub World"); } private void OnDestroy() { RemovePhotonHook(); } internal static bool IsGameLevel(Level level) { if ((Object)(object)level != (Object)null) { return ((Object)level).name == "Level - Empress Hub World"; } return false; } internal static void EnsurePhotonHooked() { if (!_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; networkingClient.EventReceived += OnPhotonEvent; _photonHooked = true; } } } internal static void RemovePhotonHook() { if (_photonHooked) { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null) { networkingClient.EventReceived -= OnPhotonEvent; } _photonHooked = false; } } private static void OnPhotonEvent(EventData ev) { if (ev.CustomData is object[] data) { Dispatch(ev.Code, data); } } private static void Dispatch(byte code, object[] data) { Repo64Runtime instance = Repo64Runtime.Instance; if (!((Object)(object)instance == (Object)null) && data != null) { switch (code) { case 180: instance.ReceivePainting(data); break; case 182: instance.ReceiveExitVote(data); break; case 181: instance.ReceiveProgress(data); break; case 183: instance.ReceiveCourse(data); break; } } } internal static void DebugLog(string message) { if (Settings != null && Settings.DebugLogs.Value) { Log.LogInfo((object)message); } } internal static void RaiseToOthers(byte code, object[] data, bool reliable = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (PhotonNetwork.InRoom) { RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; PhotonNetwork.RaiseEvent(code, (object)data, val, reliable ? SendOptions.SendReliable : SendOptions.SendUnreliable); } } internal static void RaiseToAll(byte code, object[] data) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (!PhotonNetwork.InRoom) { Dispatch(code, data); return; } RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable); } } internal sealed class Repo64Settings { public readonly ConfigEntry<bool> HubTakeover; public readonly ConfigEntry<bool> ForceLevel; public readonly ConfigEntry<float> VoteSeconds; public readonly ConfigEntry<int> MaxPaintings; public readonly ConfigEntry<float> MasterVolume; public readonly ConfigEntry<float> MusicVolume; public readonly ConfigEntry<bool> DebugLogs; public Repo64Settings(ConfigFile config) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown DebugLogs = config.Bind<bool>("Debug", "DebugLogs", false, "Logs verbose Repo64 diagnostics. Off by default."); ForceLevel = config.Bind<bool>("Debug", "ForceLevel", false, "Forces every run level to load the Repo64 hub even if HubTakeover is off."); HubTakeover = config.Bind<bool>("Hub", "HubTakeover", true, "The Empress Hub World loads before every run level and the crew votes on which registered level to play."); VoteSeconds = config.Bind<float>("Hub", "VoteSeconds", 45f, new ConfigDescription("Seconds the crew has to vote before the gallery auto-picks the leading level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 180f), Array.Empty<object>())); MaxPaintings = config.Bind<int>("Hub", "MaxPaintings", 24, new ConfigDescription("Maximum number of level paintings to hang in the gallery.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 40), Array.Empty<object>())); MasterVolume = config.Bind<float>("Audio", "MasterVolume", 0.85f, new ConfigDescription("Volume of Repo64 sound effects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); MusicVolume = config.Bind<float>("Audio", "MusicVolume", 0.6f, new ConfigDescription("Volume of Repo64 music tracks (drop your own .ogg files beside the dll).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); } } internal enum Repo64Phase { Loading, Voting, Resolving } internal sealed class Repo64Runtime : MonoBehaviour { private Repo64World _world; private Transform _root; private Transform _moduleRoot; private int _sceneHandle = -1; private bool _active; private int _seed; private readonly List<Level> _levels = new List<Level>(); private int[] _voteCounts = new int[0]; private readonly Dictionary<int, int> _votes = new Dictionary<int, int>(); private Repo64Phase _phase; private bool _localVoted; private int _localChoice = -1; private float _voteTimer; private bool _resolved; private float _voteNag; private float _enterCooldown; public static Repo64Runtime Instance { get; private set; } public Color CurrentFogColor { get; private set; } = new Color(0.06f, 0.05f, 0.12f); public Color CurrentAmbientColor { get; private set; } = new Color(0.34f, 0.32f, 0.45f); public static Repo64Runtime EnsureHost() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Repo64 Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<Repo64Runtime>(); return Instance; } public static IEnumerator EmptyCoroutine() { yield break; } private void Awake() { Instance = this; Repo64Audio.LoadMusicAsync((MonoBehaviour)(object)this); } private void Update() { HandleSceneTransition(); if (!_active) { return; } if (!Repo64Plugin.IsGameLevel(Object.op_Implicit((Object)(object)RunManager.instance) ? RunManager.instance.levelCurrent : null)) { Deactivate(); return; } float deltaTime = Time.deltaTime; bool host = SemiFunc.IsMasterClientOrSingleplayer(); if (_enterCooldown > 0f) { _enterCooldown -= deltaTime; } if (_localVoted && _phase != Repo64Phase.Loading) { HoldSpectate(); } UpdateVoting(deltaTime, host); } private void HoldSpectate() { //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) if ((Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.InputDisable(0.25f); } if ((Object)(object)CameraPosition.instance != (Object)null && (Object)(object)_moduleRoot != (Object)null) { CameraPosition.instance.OverridePosition(_moduleRoot.TransformPoint(SpectateLocal()), 0.3f); } } private Vector3 SpectateLocal() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return new Vector3(0f, 5.5f, 0f); } private void UpdateVoting(float dt, bool host) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (_phase != Repo64Phase.Voting) { return; } _voteNag -= dt; if (_voteNag <= 0f) { _voteNag = 2.5f; int num = Mathf.CeilToInt(Mathf.Max(0f, _voteTimer)); if (_localVoted) { SemiFunc.UIFocusText("You voted for " + ChoiceTitle() + ". Watching the crew decide... " + num + "s", new Color(0.7f, 0.9f, 1f), Color.white, 2.5f); } else { SemiFunc.UIFocusText("Walk into a painting to vote for a level. " + num + "s left.", new Color(0.95f, 0.9f, 0.5f), Color.white, 2.5f); } } if (host) { _voteTimer -= dt; if (_voteTimer <= 0f) { ResolveVote(); } } } public IEnumerator GenerateLevel(LevelGenerator generator) { Repo64Plugin.EnsurePhotonHooked(); yield return (object)new WaitForSeconds(0.2f); if (!SemiFunc.IsMultiplayer()) { Repo64Access.SetAllPlayersReady(generator, value: true); } while (!Repo64Access.GetAllPlayersReady(generator)) { generator.State = (LevelState)1; yield return (object)new WaitForSeconds(0.1f); } yield return (object)new WaitForSeconds(0.2f); generator.Level = RunManager.instance.levelCurrent; Repo64Access.SetLevelPrevious(RunManager.instance, generator.Level); generator.Generated = false; Repo64Access.SetEnemyReady(generator, value: true); Repo64Access.SetModulesSpawned(generator, 0); Repo64Access.SetPlayerSpawnedCount(generator, 0); generator.LevelPathPoints = new List<LevelPoint>(); generator.LevelPathTruck = null; generator.State = (LevelState)3; _seed = ComputeSeed(); BuildLevel(generator); Repo64Runtime repo64Runtime = this; Scene activeScene = SceneManager.GetActiveScene(); repo64Runtime._sceneHandle = ((Scene)(ref activeScene)).handle; yield return (object)new WaitForSeconds(0.2f); if (Object.op_Implicit((Object)(object)EnvironmentDirector.Instance)) { EnvironmentDirector.Instance.Setup(); } if (Object.op_Implicit((Object)(object)PostProcessing.Instance)) { PostProcessing.Instance.Setup(); } if (Object.op_Implicit((Object)(object)LevelMusic.instance)) { LevelMusic.instance.Setup(); } if (Object.op_Implicit((Object)(object)ConstantMusic.instance)) { ConstantMusic.instance.Setup(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { NavMeshSurface component = ((Component)generator).GetComponent<NavMeshSurface>(); if ((Object)(object)component != (Object)null) { component.collectObjects = (CollectObjects)0; component.useGeometry = (NavMeshCollectGeometry)1; component.layerMask = LayerMask.op_Implicit(-1); component.defaultArea = 0; } generator.NavMeshSetup(); yield return null; while ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList.Count == 0) { generator.State = (LevelState)12; yield return (object)new WaitForSeconds(0.1f); } generator.PlayerSpawn(); yield return null; while (Repo64Access.GetPlayerSpawnedCount(generator) < GameDirector.instance.PlayerList.Count) { generator.State = (LevelState)13; yield return (object)new WaitForSeconds(0.1f); } if (SemiFunc.IsMultiplayer()) { generator.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty<object>()); } else { Repo64Access.GenerateDone(generator); } } else { while (!generator.Generated) { yield return (object)new WaitForSeconds(0.1f); } } yield return (object)new WaitForSeconds(0.5f); Activate(); } private void BuildLevel(LevelGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) Repo64Materials.EnsureCreated(); if ((Object)(object)generator.LevelParent != (Object)null) { for (int num = generator.LevelParent.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)generator.LevelParent.transform.GetChild(num)).gameObject); } } GameObject val = new GameObject("Repo64 Root"); val.transform.SetParent(generator.LevelParent.transform, false); _root = val.transform; GameObject val2 = new GameObject("Repo64 Module"); val2.transform.SetParent(val.transform, false); _moduleRoot = val2.transform; val2.AddComponent<PhotonView>().ObservedComponents = new List<Component>(); Repo64Access.ConfigureStartRoomModule(val2.AddComponent<Module>(), 0, 0); val2.AddComponent<StartRoom>(); GameObject val3 = new GameObject("Repo64 Room Volume"); val3.transform.SetParent(val2.transform, false); RoomVolume roomVolume = val3.AddComponent<RoomVolume>(); BoxCollider obj = val3.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = true; obj.size = new Vector3(70f, 40f, 60f); obj.center = new Vector3(0f, 8f, 0f); GatherLevels(); _voteCounts = new int[_levels.Count]; _world = Repo64World.Build(val2.transform, _seed, _levels); BuildSpawnPoints(val2.transform, roomVolume, generator); } private void GatherLevels() { _levels.Clear(); int num = ((Repo64Plugin.Settings != null) ? Repo64Plugin.Settings.MaxPaintings.Value : 24); if ((Object)(object)RunManager.instance == (Object)null || RunManager.instance.levels == null) { return; } foreach (Level level in RunManager.instance.levels) { if (!((Object)(object)level == (Object)null) && !((Object)(object)level == (Object)(object)Repo64Plugin.GameLevel) && !_levels.Contains(level)) { _levels.Add(level); if (_levels.Count >= num) { break; } } } Repo64Plugin.DebugLog("Repo64 gallery hung " + _levels.Count + " level painting(s)."); } private void BuildSpawnPoints(Transform parent, RoomVolume roomVolume, LevelGenerator generator) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _world.SpawnPositions.Count; i++) { GameObject val = new GameObject("Repo64 Spawn"); val.transform.SetParent(parent, false); val.transform.localPosition = _world.SpawnPositions[i]; val.transform.localRotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); val.AddComponent<SpawnPoint>(); } LevelPoint val2 = CreateLevelPoint(parent, roomVolume, generator, _world.PlayerStart, truck: true); LevelPoint val3 = CreateLevelPoint(parent, roomVolume, generator, _world.PlayerStart + new Vector3(0f, 0f, 4f), truck: false); val2.ConnectedPoints = new List<LevelPoint> { val3 }; val3.ConnectedPoints = new List<LevelPoint> { val2 }; } private static LevelPoint CreateLevelPoint(Transform parent, RoomVolume roomVolume, LevelGenerator generator, Vector3 localPosition, bool truck) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Repo64 Level Point") { layer = LayerMask.NameToLayer("Other") }; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; SphereCollider obj = val.AddComponent<SphereCollider>(); ((Collider)obj).isTrigger = true; obj.radius = 0.35f; LevelPoint val2 = val.AddComponent<LevelPoint>(); val2.ConnectedPoints = new List<LevelPoint>(); val2.Room = roomVolume; val2.Truck = truck; val2.ModuleConnect = false; Repo64Access.MarkLevelPointInStartRoom(val2, value: true); if (generator.LevelPathPoints == null) { generator.LevelPathPoints = new List<LevelPoint>(); } generator.LevelPathPoints.Add(val2); return val2; } private void Activate() { _active = true; _phase = Repo64Phase.Loading; _localVoted = false; _localChoice = -1; _resolved = false; _votes.Clear(); for (int i = 0; i < _voteCounts.Length; i++) { _voteCounts[i] = 0; } ((MonoBehaviour)this).StartCoroutine(BeginVotingWhenReady()); Repo64Plugin.DebugLog("Repo64 gallery active with " + _levels.Count + " level(s)."); } private IEnumerator BeginVotingWhenReady() { float waited = 0f; while (waited < 25f && ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2 || (Object)(object)PlayerController.instance == (Object)null || (Object)(object)PlayerController.instance.playerAvatarScript == (Object)null)) { waited += Time.deltaTime; yield return null; } yield return (object)new WaitForSeconds(0.6f); if (_active && _phase == Repo64Phase.Loading) { BeginVoting(); } } private void BeginVoting() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) _phase = Repo64Phase.Voting; _voteTimer = ((Repo64Plugin.Settings != null) ? Repo64Plugin.Settings.VoteSeconds.Value : 45f); _voteNag = 1.5f; Repo64Audio.PlayMusic(Repo64MusicTrack.Hub, loop: true); SemiFunc.UIBigMessage("THE GALLERY OF REPO 64", "{!}", 32f, new Color(0.95f, 0.85f, 0.4f), Color.white); SemiFunc.UIFocusText("Walk into a painting to VOTE for the level. Most votes wins.", new Color(0.9f, 0.85f, 0.6f), Color.white, 5f); if (!SemiFunc.IsMasterClientOrSingleplayer()) { Repo64Plugin.RaiseToOthers(183, new object[1] { 0 }); } } public void OnVote(int levelIndex) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (_phase == Repo64Phase.Voting && !_localVoted && !(_enterCooldown > 0f) && levelIndex >= 0 && levelIndex < _levels.Count) { _enterCooldown = 1.5f; _localVoted = true; _localChoice = levelIndex; Repo64Audio.PlayWhoosh(LocalWorldPosition()); if (levelIndex < _world.Paintings.Count) { _world.Paintings[levelIndex].MarkClaimed(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { RegisterVote(LocalActor(), levelIndex); return; } Repo64Plugin.RaiseToOthers(180, new object[3] { 0, levelIndex, LocalActor() }); } } private void RegisterVote(int actor, int levelIndex) { if (_phase == Repo64Phase.Voting && levelIndex >= 0 && levelIndex < _levels.Count) { _votes[actor] = levelIndex; RecountAndBroadcast(); CheckResolve(); } } private void RecountAndBroadcast() { for (int i = 0; i < _voteCounts.Length; i++) { _voteCounts[i] = 0; } foreach (KeyValuePair<int, int> vote in _votes) { if (vote.Value >= 0 && vote.Value < _voteCounts.Length) { _voteCounts[vote.Value]++; } } object[] array = new object[_voteCounts.Length]; for (int j = 0; j < _voteCounts.Length; j++) { array[j] = _voteCounts[j]; } Repo64Plugin.RaiseToOthers(181, array); ApplyTally(_voteCounts); } private void ApplyTally(int[] counts) { if (_world != null) { for (int i = 0; i < _world.Paintings.Count && i < counts.Length; i++) { _world.Paintings[i].SetVotes(counts[i]); } } } private void CheckResolve() { if (SemiFunc.IsMasterClientOrSingleplayer() && !_resolved) { int num = ((!((Object)(object)GameDirector.instance != (Object)null) || GameDirector.instance.PlayerList == null) ? 1 : GameDirector.instance.PlayerList.Count); if (_votes.Count >= Mathf.Max(1, num)) { ResolveVote(); } } } private void ResolveVote() { if (!_resolved && SemiFunc.IsMasterClientOrSingleplayer() && _levels.Count != 0) { _resolved = true; int num = PickWinner(); Repo64Plugin.RaiseToOthers(182, new object[1] { num }); ApplyResolve(num); } } private int PickWinner() { int num = -1; List<int> list = new List<int>(); for (int i = 0; i < _voteCounts.Length; i++) { if (_voteCounts[i] > num) { num = _voteCounts[i]; list.Clear(); list.Add(i); } else if (_voteCounts[i] == num) { list.Add(i); } } if (num <= 0) { return Random.Range(0, _levels.Count); } return list[Random.Range(0, list.Count)]; } private void ApplyResolve(int winner) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (winner >= 0 && winner < _levels.Count) { _phase = Repo64Phase.Resolving; string text = ((!string.IsNullOrEmpty(_levels[winner].NarrativeName)) ? _levels[winner].NarrativeName : ((Object)_levels[winner]).name); if (winner < _world.Paintings.Count) { _world.Paintings[winner].PlayRipple(); } Repo64Audio.PlayFanfare(LocalWorldPosition()); SemiFunc.UIBigMessage("THE CREW CHOSE: " + text.ToUpperInvariant(), "{!}", 36f, new Color(0.6f, 1f, 0.7f), Color.white); if (SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviour)this).StartCoroutine(LoadWinnerRoutine(winner)); } } } private IEnumerator LoadWinnerRoutine(int winner) { yield return (object)new WaitForSeconds(3.5f); if ((Object)(object)RunManager.instance != (Object)null && winner >= 0 && winner < _levels.Count) { RunManager.instance.levelCurrent = _levels[winner]; RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)0); } } private string ChoiceTitle() { if (_localChoice < 0 || _localChoice >= _levels.Count) { return "a level"; } if (string.IsNullOrEmpty(_levels[_localChoice].NarrativeName)) { return ((Object)_levels[_localChoice]).name; } return _levels[_localChoice].NarrativeName; } public int ExpectedVoters() { int num = ((!((Object)(object)GameDirector.instance != (Object)null) || GameDirector.instance.PlayerList == null) ? 1 : GameDirector.instance.PlayerList.Count); return Mathf.Max(1, num); } private Vector3 LocalWorldPosition() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val != (Object)null)) { return Vector3.zero; } return ((Component)val).transform.position; } private static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } private static int LocalActor() { if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return 1; } return PhotonNetwork.LocalPlayer.ActorNumber; } private int ComputeSeed() { int num = 64; if ((Object)(object)GameDirector.instance != (Object)null) { num = (num * 397) ^ GameDirector.instance.Seed; } if ((Object)(object)RunManager.instance != (Object)null) { num = (num * 397) ^ Run