The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of RaceToThePeak v0.2.1
plugins/RaceToThePeak.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PeakRace.Core; using PeakRace.Patch; using PeakRace.src; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RaceToThePeak")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyInformationalVersion("0.2.1+e9e1d8b575a5e654b4f0baca834c1789f0283c53")] [assembly: AssemblyProduct("RaceToThePeak")] [assembly: AssemblyTitle("PeakRace")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakRace { [BepInPlugin("RaceToThePeak", "PeakRace", "0.2.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony(Name); public static List<(string, Color)> teamList; public static TMP_FontAsset FontAsset; public static Shader shader; public static Color Color = new Color(0.8745f, 0.8549f, 0.7608f, 1f); public const string Id = "RaceToThePeak"; internal static ManualLogSource Log { get; private set; } = null; public static string Name => "PeakRace"; public static string Version => "0.2.1"; private void Awake() { //IL_0039: 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_008b: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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) Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Plugin RaceToThePeak Loaded"); teamList = new List<(string, Color)> { ("Troop BingBong", new Color(0.5f, 1f, 0.42f, 1f)), ("Troop Antlion", new Color(1f, 0.6f, 0.34f, 1f)), ("Troop Scorpion", new Color(0.56f, 0.25f, 1f, 1f)), ("Troop Cheetah", new Color(1f, 1f, 0f, 1f)), ("Troop Lovebird", new Color(1f, 0.5f, 1f, 1f)), ("Troop Narwhal", new Color(0.25f, 0.5f, 1f, 1f)), ("Troop AntEater", new Color(0.3f, 0.82f, 0.28f, 1f)), ("Troop Condor", new Color(0.36f, 1f, 1f, 1f)), ("Troop Crab", new Color(1f, 0.24f, 0.28f, 1f)), ("Troop Salamander", new Color(0.9f, 0.29f, 1f, 1f)), ("Troop Capybara", new Color(0.64f, 0.44f, 0.25f, 1f)), ("Troop Mushroom", new Color(0.6f, 0.57f, 0.79f, 1f)) }; TeamHandler.Initialize(); TimerHandler.Initialize(); TeamSelectorHandler.Initialize(); harmony.PatchAll(typeof(CharacterTeamInfo)); Log.LogInfo((object)"Character Team Handler Successful"); harmony.PatchAll(typeof(MapPatch)); Log.LogInfo((object)"Map Patches Successful"); harmony.PatchAll(typeof(Armband)); Log.LogInfo((object)"Armband Successful"); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } } namespace PeakRace.Core { public class TeamSelectorHandler { public static GameObject TeamKiosk; public static GameObject[] TeamSelectors = (GameObject[])(object)new GameObject[12]; public static Vector3[] TeamSelectorsPos; private static AssetBundle kioskBundle; public static void Initialize() { Debug.Log((object)"[RaceToThePeak] TeamSelectorHandler was started"); SceneManager.activeSceneChanged += OnActiveSceneChanged; } private static void OnActiveSceneChanged(Scene oldScene, Scene newScene) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) if (((Scene)(ref newScene)).name == "Airport") { TeamHandler.findShader(); Vector3[] array = (Vector3[])(object)new Vector3[12] { new Vector3(-5.37f, 1.5f, 111.15f), new Vector3(-4.07f, 1.5f, 111.15f), new Vector3(-2.77f, 1.5f, 111.15f), new Vector3(-1.47f, 1.5f, 111.15f), new Vector3(-0.17f, 1.5f, 111.15f), new Vector3(1.27f, 1.5f, 111.15f), new Vector3(-5.37f, 1.5f, 112.45f), new Vector3(-4.07f, 1.5f, 112.45f), new Vector3(-2.77f, 1.5f, 112.45f), new Vector3(-1.47f, 1.5f, 112.45f), new Vector3(-0.17f, 1.5f, 112.45f), new Vector3(1.27f, 1.5f, 112.45f) }; Debug.Log((object)"[RaceToThePeak] Team Selectors are being loaded"); Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PeakRace.Resources.teamkiosk"); if (manifestResourceStream == null) { Debug.Log((object)"[RaceToThePeak] Stream Path was null"); return; } if ((Object)(object)kioskBundle == (Object)null) { kioskBundle = AssetBundle.LoadFromStream(manifestResourceStream); } if ((Object)(object)kioskBundle == (Object)null) { Debug.Log((object)"[RaceToThePeak] Asset bundle was null"); return; } if ((Object)(object)Plugin.shader == (Object)null) { findShader(); } GameObject val = kioskBundle.LoadAsset<GameObject>("assets/bundledassets/racetothepeak/prefabs/armbandcollision.prefab"); TeamKiosk = new GameObject("TeamKiosk"); Material val2 = new Material(Plugin.shader); for (int i = 0; i < TeamSelectors.Length; i++) { TeamSelectors[i] = Object.Instantiate<GameObject>(val, array[i], default(Quaternion)); TeamSelectors[i].transform.SetParent(TeamKiosk.transform, false); TeamSelectors[i].transform.localScale = new Vector3(1f, 0.5f, 1f); TeamSelectors[i].GetComponent<Renderer>().material = TeamHandler.TroopMat[i]; TeamSelectors[i].transform.localEulerAngles = new Vector3(270f, 270f, 0f); TeamSelectors[i].transform.localScale = new Vector3(1f, 1f, 1f); ((Object)TeamSelectors[i]).name = $"Team Selector {i}"; TeamSelector teamSelector = TeamSelectors[i].AddComponent<TeamSelector>(); TeamSelectors[i].SetActive(true); teamSelector.setTeam(i); } Debug.Log((object)"[RaceToThePeak] Closed Stream Path"); manifestResourceStream.Dispose(); kioskBundle.Unload(false); } else { TeamSelectors = (GameObject[])(object)new GameObject[12]; } } private static void findShader() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Object[] array = Resources.FindObjectsOfTypeAll(typeof(Shader)); Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { Shader val = (Shader)array2[i]; if (((Object)val).name == "Universal Render Pipeline/Lit") { Plugin.shader = val; Debug.Log((object)"[RaceToThePeak] Successfully found Universal Render Pipeline/Lit shader"); } } } } internal class TimerHandler { private static GameObject timerUI; public static void Initialize() { Debug.Log((object)"[RaceToThePeak] TimerHandler was started"); SceneManager.sceneLoaded += OnSceneLoaded; } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if (((Scene)(ref scene)).name == "Airport" || ((Scene)(ref scene)).name.ToLower().StartsWith("level_")) { Debug.Log((object)"[RaceToThePeak] Starting Timer"); timerUI = new GameObject("TimerUI"); RectTransform val = timerUI.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(0f, 1f); val.pivot = new Vector2(0f, 1f); timerUI.AddComponent<TimerUI>(); } else { timerUI = new GameObject(); } } } } namespace PeakRace.src { public class TeamSelector : MonoBehaviour, IInteractibleConstant, IInteractible { private float switchTime = 0.25f; private string teamName; private int team; private Renderer mainRenderer; public bool holdOnFinish => false; private void Awake() { mainRenderer = ((Component)this).GetComponentInChildren<Renderer>(); GameObject gameObject = ((Component)this).gameObject; } public void setTeam(int teamInt) { team = teamInt; teamName = Plugin.teamList[teamInt].Item1.ToUpper(); } public string GetInteractionText() { return "JOIN"; } public void Interact_CastFinished(Character interactor) { CharacterTeamInfo component = ((Component)interactor).GetComponent<CharacterTeamInfo>(); Debug.Log((object)$"[RaceToThePeak] Updated {((Object)component.myChar).name} to team {team}"); component.changeTeam(team); } public void Interact(Character interactor) { } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } public void HoverEnter() { } public void HoverExit() { } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = mainRenderer.bounds; return ((Bounds)(ref bounds)).center; } public bool IsInteractible(Character interactor) { return true; } public bool IsConstantlyInteractable(Character interactor) { return true; } public float GetInteractTime(Character interactor) { return switchTime; } public string GetName() { return teamName; } public Transform GetTransform() { return ((Component)this).transform; } } } namespace PeakRace.Patch { [RequireComponent(typeof(PhotonView))] internal class TeamHandler { public static List<(string charName, int team)> charTeam; public static Material[] TroopMat = (Material[])(object)new Material[12]; public static GameObject baseArmband; public static Material troopBaseMat; public static Shader CharShader; public static void Initialize() { charTeam = new List<(string, int)>(); Debug.Log((object)"[RaceToThePeak] Finished Loading Armband Assets"); } public static void addCharacter(string character, int newTeam) { if (character == "Bot") { return; } for (int i = 0; i < charTeam.Count; i++) { if (charTeam[i].charName == character) { charTeam[i] = (character, newTeam); Debug.Log((object)$"[RaceToThePeak] changed {character} to team {newTeam}"); return; } } charTeam.Add((character, newTeam)); Debug.Log((object)$"[RaceToThePeak] added {character} to team {newTeam}"); } public static int getPlayerTeam(string name) { foreach (var (text, num) in charTeam) { if (text == name) { Debug.Log((object)$"[RaceToThePeak] Loading Player {text} to team {num}"); return num; } } Debug.Log((object)("[RaceToThePeak] " + name + " was not found")); return 0; } private static void setupArmbandPrefabs() { Debug.Log((object)"[RaceToThePeak] Loading Armband Resources"); Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PeakRace.Resources.armband"); if (manifestResourceStream == null) { Debug.Log((object)"[RaceToThePeak] Stream Path was null"); return; } AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream); if ((Object)(object)val == (Object)null) { Debug.Log((object)"[RaceToThePeak] Asset bundle was null"); return; } baseArmband = val.LoadAsset<GameObject>("assets/bundledassets/racetothepeak/prefabs/armband.prefab"); troopBaseMat = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/basearmband.mat"); configureShader(troopBaseMat); TroopMat[0] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/0troopbing.mat"); configureShader(TroopMat[0]); TroopMat[1] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/1troopantlion.mat"); configureShader(TroopMat[1]); TroopMat[2] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/2troopscorpion.mat"); configureShader(TroopMat[2]); TroopMat[3] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/3troopcheetah.mat"); configureShader(TroopMat[3]); TroopMat[4] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/4trooplovebird.mat"); configureShader(TroopMat[4]); TroopMat[5] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/5troopnarwhal.mat"); configureShader(TroopMat[5]); TroopMat[6] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/7troopanteater.mat"); configureShader(TroopMat[6]); TroopMat[7] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/8troopcondor.mat"); configureShader(TroopMat[7]); TroopMat[8] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/9troopcrab.mat"); configureShader(TroopMat[8]); TroopMat[9] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/10troopsalamander.mat"); configureShader(TroopMat[9]); TroopMat[10] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/6troopcapybara.mat"); configureShader(TroopMat[10]); TroopMat[11] = val.LoadAsset<Material>("assets/bundledassets/racetothepeak/mats/11troopmushroom.mat"); configureShader(TroopMat[11]); manifestResourceStream.Dispose(); val.Unload(false); } private static void configureShader(Material mat) { mat.shader = CharShader; mat.SetFloat("_UseTextureAlpha", 1f); } public static void findShader() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if ((Object)(object)CharShader != (Object)null) { return; } Object[] array = Resources.FindObjectsOfTypeAll(typeof(Shader)); Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { Shader val = (Shader)array2[i]; if (((Object)val).name == "W/Character") { CharShader = val; Debug.Log((object)"[RaceToThePeak] Successfully found W/Character shader"); setupArmbandPrefabs(); return; } } Debug.Log((object)"[RaceToThePeak] Could not find W/Character shader"); } } [HarmonyPatch] internal class Armband : MonoBehaviour { private Rigidbody arm; private int teamInt = 1; public Character myChar; public GameObject myArmband; public Renderer renderer; [HarmonyPatch(typeof(HideTheBody), "Start")] [HarmonyPrefix] private static void PosPatch(HideTheBody __instance) { if ((Object)(object)TeamHandler.CharShader == (Object)null) { TeamHandler.findShader(); } Character componentInParent = ((Component)__instance).GetComponentInParent<Character>(); ((Component)componentInParent).gameObject.AddComponent<Armband>(); Debug.Log((object)("[RaceToThePeak] Armband Created for " + ((Object)componentInParent).name)); } private void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) myChar = ((Component)this).gameObject.GetComponent<Character>(); teamInt = TeamHandler.getPlayerTeam(((Object)myChar).name); Rigidbody bodypartRig = myChar.GetBodypartRig((BodypartType)5); myArmband = Object.Instantiate<GameObject>(TeamHandler.baseArmband, new Vector3(-0.0276f, 0.4798f, 0.0064f), Quaternion.identity); myArmband.transform.SetParent(((Component)bodypartRig).transform, false); myArmband.transform.localScale = new Vector3(2.33f, 2.33f, 2.33f); myArmband.transform.localEulerAngles = new Vector3(89.5015f, 303.6035f, 130.6423f); ((Object)myArmband).name = "TeamArmband"; renderer = myArmband.GetComponent<Renderer>(); renderer.material = TeamHandler.TroopMat[teamInt]; Debug.Log((object)"[RaceToThePeak] Finished Armband Load Step"); ((Component)myChar).GetComponent<CharacterTeamInfo>().InitializeTeam(); } [HarmonyPatch(typeof(HideTheBody), "Toggle")] [HarmonyPostfix] private static void wornOnPlayer(HideTheBody __instance, bool show) { Armband armband = default(Armband); if (!((Component)__instance.character).gameObject.TryGetComponent<Armband>(ref armband)) { Debug.Log((object)"[RaceToThePeak] Armband hasnt been built yet"); return; } Renderer val = armband.renderer; if (show) { __instance.SetShowing(val, 0f); } else { __instance.SetShowing(val, 1f); } } public void changeArmband(int team) { teamInt = team; renderer.material = TeamHandler.TroopMat[team]; myChar.refs.hideTheBody.Refresh(); } } [HarmonyPatch] internal class CharacterTeamInfo : MonoBehaviourPunCallbacks { public bool teamOn; public bool teamGUIOn; public bool timeOn; public int teamInt; public float time; public string timeString; public float checkpointRadius; private GameObject GameMap; private GameObject EndFlag; private List<Campfire> campfireList; public Character myChar; [HarmonyPatch(typeof(Character), "Awake")] [HarmonyPostfix] private static void PosPatch(Character __instance) { ((Component)__instance).gameObject.AddComponent<CharacterTeamInfo>(); Debug.Log((object)("[RaceToThePeak] TeamInfo Object Created for " + ((Object)__instance).name)); } [HarmonyPatch(typeof(Character), "RPCA_Die")] [HarmonyPostfix] private static void deathTimer(Character __instance) { CharacterTeamInfo component = ((Component)__instance).GetComponent<CharacterTeamInfo>(); component.time += 300f; int num = 0; int num2 = 0; foreach (Character allCharacter in Character.AllCharacters) { if (!allCharacter.data.dead) { num++; if (((Component)allCharacter).GetComponent<CharacterTeamInfo>().timeOn) { num2++; } } } if (num2 == 0 && num > 0) { Campfire campfire = component.campfireList[0]; component.timeOn = false; Debug.Log((object)"[RaceToThePeak] Respawning all players due to last climber dying"); respawnPlayers(campfire); } } private void Awake() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!(name == "Title")) { teamOn = true; teamGUIOn = true; checkpointRadius = 15f; myChar = ((Component)this).gameObject.GetComponent<Character>(); if (name == "Airport") { timeOn = false; } else { timeOn = true; } time = 0f; timeString = "00:00:00"; if (name != "Airport") { GameMap = GameObject.Find("Map"); campfireList = GameMap.GetComponentsInChildren<Campfire>(true).Cast<Campfire>().ToList(); campfireList.RemoveAt(0); EndFlag = GameObject.Find("Map/Biome_4/Volcano/Peak/Flag_planted_seagull"); } } } public void InitializeTeam() { changeTeam(TeamHandler.getPlayerTeam(((Object)myChar).name)); } private void FixedUpdate() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (timeOn) { time += Time.fixedDeltaTime; timeToString(); } if (name != "Airport") { checkpointHandler(); } } private void timeToString() { int num = (int)(time / 3600f); int num2 = (int)(time % 3600f / 60f); int num3 = (int)(time % 60f); timeString = needZero(num) + ":" + needZero(num2) + ":" + needZero(num3); } private string needZero(int time) { if (time / 10 < 1) { return $"0{time}"; } return $"{time}"; } private void resetTimer() { time = 0f; } private void checkpointHandler() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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 = 0; foreach (Campfire campfire in campfireList) { if (Vector3.Distance(((Component)campfire).transform.position, myChar.Center) <= checkpointRadius) { campfireList.RemoveAt(num); timeOn = false; num--; Debug.Log((object)("[RaceToThePeak] Timer was turned off for " + ((Object)myChar).name + " due to campfire")); respawnPlayers(campfire); return; } num++; } if (Vector3.Distance(EndFlag.transform.position, myChar.Center) <= checkpointRadius) { timeOn = false; Debug.Log((object)("[RaceToThePeak] Timer was turned off for " + ((Object)myChar).name + " due to reaching the PEAK")); } } private static void respawnPlayers(Campfire campfire) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) bool flag = true; int num = 0; foreach (Character allCharacter in Character.AllCharacters) { if (!allCharacter.data.dead || !allCharacter.data.fullyPassedOut) { if (((Component)allCharacter).GetComponent<CharacterTeamInfo>().timeOn) { flag = false; break; } num++; } } if (!flag || num <= 0) { return; } Vector3 val = default(Vector3); foreach (Character allCharacter2 in Character.AllCharacters) { if (allCharacter2.data.dead || allCharacter2.data.fullyPassedOut) { ((Vector3)(ref val))..ctor(3f, 5f, 3f); ((MonoBehaviourPun)allCharacter2).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2] { ((Component)campfire).transform.position + val, true }); } } } public void changeTeam(int newTeam) { if (((MonoBehaviourPun)this).photonView.IsMine) { ((MonoBehaviourPun)this).photonView.RPC("RPCA_ChangeTeam", (RpcTarget)3, new object[1] { newTeam }); } } [PunRPC] public void RPCA_ChangeTeam(int newTeam) { teamInt = newTeam; TeamHandler.addCharacter(((Object)myChar).name, newTeam); Armband armband = default(Armband); if (((Component)myChar).TryGetComponent<Armband>(ref armband)) { armband.changeArmband(newTeam); } } } [HarmonyPatch] internal class MapPatch { [HarmonyPatch(typeof(Campfire), "Light_Rpc")] [HarmonyPostfix] private static void restartTimer() { foreach (Character allCharacter in Character.AllCharacters) { Debug.Log((object)"[RaceToThePeak] Timer was turned back on due to map transition"); CharacterTeamInfo componentInChildren = ((Component)allCharacter).GetComponentInChildren<CharacterTeamInfo>(); componentInChildren.timeOn = true; } } [HarmonyPatch(typeof(RespawnChest), "GetInteractionText")] [HarmonyPostfix] private static void disableRespawnStatueText(ref string __result) { __result = LocalizedText.GetText("TOUCH", true); } [HarmonyPatch(typeof(RespawnChest), "SpawnItems")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); for (int i = 6; i <= 18; i++) { list[i].opcode = OpCodes.Nop; } Debug.Log((object)"[RaceToThePeak] Successfully set Respawn Statue to Only Items"); return list; } } public class TimerUI : MonoBehaviour { private int leaderboardPosX = 23; private int leaderboardPosY = -60; private int troopPosX = 270; private int troopPosY = 10; private int clockPosX = 20; private int clockPosY = 5; private Canvas canvas; private TextMeshProUGUI leaderboard; private TextMeshProUGUI troop; private TextMeshProUGUI clock; private static int shadowMaterialID; private void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown GameObject gameObject = ((Component)this).gameObject; canvas = gameObject.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; CanvasScaler val = ((Component)canvas).gameObject.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); Object[] array = Resources.FindObjectsOfTypeAll(typeof(Material)); Object[] array2 = array; foreach (Object val2 in array2) { if (val2.name == "DarumaDropOne-Regular SDF Shadow") { shadowMaterialID = val2.GetInstanceID(); Debug.Log((object)"[RaceToThePeak] Successfully found Daruma Shadow Material"); } } if ((Object)(object)Plugin.FontAsset == (Object)null) { Object[] array3 = (Object[])(object)Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); Object[] array4 = array3; Object[] array5 = array4; for (int j = 0; j < array5.Length; j++) { TMP_FontAsset val3 = (TMP_FontAsset)array5[j]; if (((Object)val3).name.Equals("DarumaDropOne-Regular SDF")) { Plugin.FontAsset = val3; Debug.Log((object)"[RaceToThePeak] Successfully found Daruma Font"); } } } InitializeUI(); } private void InitializeUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0030: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009e: 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_00c3: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("LeaderboardUI"); val.transform.SetParent(((Component)canvas).transform, false); leaderboard = val.AddComponent<TextMeshProUGUI>(); Vector3 anchoredPos = default(Vector3); anchoredPos.x = leaderboardPosX; anchoredPos.y = leaderboardPosY; ((TMP_Text)leaderboard).text = ""; SetupText(leaderboard, anchoredPos); ((TMP_Text)leaderboard).font = Plugin.FontAsset; ((TMP_Text)leaderboard).fontMaterial = (Material)Resources.InstanceIDToObject(shadowMaterialID); ((Graphic)leaderboard).color = Plugin.Color; ((TMP_Text)leaderboard).fontSize = 18f; GameObject val2 = new GameObject("TroopUI"); val2.transform.SetParent(((Component)canvas).transform, false); troop = val2.AddComponent<TextMeshProUGUI>(); Vector3 anchoredPos2 = default(Vector3); anchoredPos2.x = troopPosX; anchoredPos2.y = troopPosY; ((TMP_Text)troop).text = "Troop Null"; ((Graphic)troop).color = Plugin.Color; SetupText(troop, anchoredPos2); ((TMP_Text)troop).font = Plugin.FontAsset; ((TMP_Text)troop).fontMaterial = (Material)Resources.InstanceIDToObject(shadowMaterialID); ((TMP_Text)troop).fontSize = 50f; GameObject val3 = new GameObject("ClockUI"); val3.transform.SetParent(((Component)canvas).transform, false); clock = val3.AddComponent<TextMeshProUGUI>(); Vector3 anchoredPos3 = default(Vector3); anchoredPos3.x = clockPosX; anchoredPos3.y = clockPosY; ((TMP_Text)clock).text = "00:00:00"; SetupText(clock, anchoredPos3); ((TMP_Text)clock).font = Plugin.FontAsset; ((TMP_Text)clock).fontMaterial = (Material)Resources.InstanceIDToObject(shadowMaterialID); ((Graphic)clock).color = Plugin.Color; ((TMP_Text)clock).fontSize = 46f; Debug.Log((object)"[RaceToThePeak] GUI Initialized"); } public static void SetupText(TextMeshProUGUI text, Vector3 anchoredPos) { //IL_0012: 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_003c: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((TMP_Text)text).rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(0f, 1f); rectTransform.pivot = new Vector2(0f, 1f); ((Transform)rectTransform).position = ((Transform)rectTransform).position + anchoredPos; rectTransform.sizeDelta = new Vector2(500f, 500f); ((TMP_Text)text).alignment = (TextAlignmentOptions)257; } private void LateUpdate() { //IL_0081: 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_00e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Character.localCharacter == (Object)null) { Debug.Log((object)"[RaceToThePeak] the Local Character has not been loaded yet"); return; } CharacterTeamInfo component = ((Component)Character.localCharacter).GetComponent<CharacterTeamInfo>(); if ((Object)(object)component == (Object)null) { Debug.Log((object)("[RaceToThePeak] the " + ((Object)Character.localCharacter).name + " CharacterTeamHandler couldnt be found")); return; } ((TMP_Text)troop).text = Plugin.teamList[component.teamInt].Item1; ((Graphic)troop).color = Plugin.teamList[component.teamInt].Item2; if (((Behaviour)leaderboard).enabled != component.teamOn) { ((Behaviour)leaderboard).enabled = component.teamOn; ((Behaviour)troop).enabled = component.teamOn; ((Behaviour)clock).enabled = component.teamOn; } ((TMP_Text)clock).text = component.timeString; Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name != "Airport" && component.teamGUIOn) { updateScoreboard(); } } private void updateScoreboard() { //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) CharacterTeamInfo component = ((Component)Character.localCharacter).GetComponent<CharacterTeamInfo>(); int num = 0; Dictionary<int, List<CharacterTeamInfo>> dictionary = new Dictionary<int, List<CharacterTeamInfo>>(); foreach (Character allCharacter in Character.AllCharacters) { CharacterTeamInfo component2 = ((Component)allCharacter).GetComponent<CharacterTeamInfo>(); if (dictionary.ContainsKey(component2.teamInt)) { dictionary[component2.teamInt].Add(component2); continue; } dictionary.Add(component2.teamInt, new List<CharacterTeamInfo>()); dictionary[component2.teamInt].Add(component2); } List<(int, float)> list = new List<(int, float)>(); foreach (KeyValuePair<int, List<CharacterTeamInfo>> item in dictionary) { float num2 = 0f; foreach (CharacterTeamInfo item2 in item.Value) { num2 += item2.time; } list.Add((item.Key, num2 / (float)item.Value.Count)); } (int, float)[] array = new(int, float)[12] { (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f), (-1, 0f) }; int num3 = 0; while (list.Count > 0) { int index = findNextPole(list); array[num3].Item1 = list[index].Item1; array[num3].Item2 = list[index].Item2; if (component.teamInt == list[index].Item1) { num = num3; } list.RemoveAt(index); num3++; } string[] array2 = new string[5] { "", "", "", "", "" }; if (num < 5) { array2[0] = colorizeLeaderboard("1st", array[0].Item2, Plugin.teamList[array[0].Item1].Item2); if (array[1].Item2 > 0f) { array2[1] = colorizeLeaderboard("\n2nd", array[1].Item2, Plugin.teamList[array[1].Item1].Item2); } if (array[2].Item2 > 0f) { array2[2] = colorizeLeaderboard("\n3rd", array[2].Item2, Plugin.teamList[array[2].Item1].Item2); } if (array[3].Item2 > 0f) { array2[3] = colorizeLeaderboard("\n4th", array[3].Item2, Plugin.teamList[array[3].Item1].Item2); } if (array[4].Item2 > 0f) { array2[4] = colorizeLeaderboard("\n5th", array[4].Item2, Plugin.teamList[array[4].Item1].Item2); } array2[num] += " (You)"; ((TMP_Text)leaderboard).text = array2[0] + array2[1] + array2[2] + array2[3] + array2[4]; } else { array2[0] = colorizeLeaderboard("1st", array[0].Item2, Plugin.teamList[array[0].Item1].Item2); array2[1] = colorizeLeaderboard("\n2nd", array[1].Item2, Plugin.teamList[array[1].Item1].Item2); array2[2] = "\n- - - - - - - - - -"; array2[3] = colorizeLeaderboard($"\n{num}th", array[num - 1].Item2, Plugin.teamList[array[num - 1].Item1].Item2); array2[4] = colorizeLeaderboard($"\n{num + 1}th", array[num].Item2, Plugin.teamList[array[num].Item1].Item2) + " (You)"; ((TMP_Text)leaderboard).text = array2[0] + array2[1] + array2[2] + array2[3] + array2[4]; } } private string colorizeLeaderboard(string place, float time, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = ColorUtility.ToHtmlStringRGBA(color); return "<color=#" + text + ">" + place + " " + timeToString(time) + "</color>"; } private int findNextPole(List<(int team, float time)> teamTimer) { int result = 0; float item = teamTimer[0].time; for (int i = 1; i < teamTimer.Count; i++) { if (teamTimer[i].time < item) { result = i; item = teamTimer[i].time; } } return result; } private string timeToString(float time) { int time2 = (int)(time / 3600f); int time3 = (int)(time % 3600f / 60f); int time4 = (int)(time % 60f); return needZero(time2) + ":" + needZero(time3) + ":" + needZero(time4); } private string needZero(int time) { if (time / 10 < 1) { return $"0{time}"; } return $"{time}"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }