using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("UltraSpeedRun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ce512c3f40b7aaaf4d7b3e1fdbdfbc5d394d47f1")]
[assembly: AssemblyProduct("UltraSpeedRun")]
[assembly: AssemblyTitle("UltraSpeedRun")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(CheatsManager), "Start")]
public class CheatsPatcher
{
[HarmonyPrefix]
public static void Prefix(CheatsManager __instance)
{
Debug.Log((object)"Yippe!");
__instance.RegisterExternalCheat((ICheat)(object)new ShowZoneCheats());
}
}
public class ShowZoneCheats : ICheat
{
private bool _active = false;
private List<MeshRenderer> objectsMadeVisible = new List<MeshRenderer>();
private Material theMaterial;
private Dictionary<Type, Color> _colors = new Dictionary<Type, Color>();
private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");
public string LongName => "Show All Trigger Zones";
public string Identifier => "ultraspeedrun.zones";
public string ButtonEnabledOverride => "Hide Zones";
public string ButtonDisabledOverride => "Show Zones";
public string Icon => "noclip";
public bool IsActive => _active;
public bool DefaultState => false;
public StatePersistenceMode PersistenceMode => (StatePersistenceMode)1;
public void Disable()
{
_active = false;
foreach (MeshRenderer item in objectsMadeVisible)
{
((Renderer)item).enabled = false;
}
}
public void Enable()
{
_active = true;
PlayerActivator val = Resources.FindObjectsOfTypeAll<PlayerActivator>()[0];
theMaterial = ((Renderer)((Component)val).GetComponent<MeshRenderer>()).material;
this.SetObjectsVisible<ObjectActivator>(includeChildren: false);
this.SetObjectsVisible<ActivateArena>(includeChildren: false);
this.SetObjectsVisible<DoorController>(includeChildren: false);
this.SetObjectsVisible<OutOfBounds>(includeChildren: false);
this.SetObjectsVisible<DeathZone>(includeChildren: true);
}
public ShowZoneCheats()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
_colors.Add(typeof(ActivateArena), new Color(0.23f, 0.5f, 0.2f, 0.25f));
_colors.Add(typeof(DoorController), new Color(0.2f, 0.2f, 0.5f, 0.25f));
_colors.Add(typeof(DeathZone), new Color(0.7f, 0.2f, 0.2f, 0.25f));
}
public void SetObjectsVisible<T>(bool includeChildren = false) where T : MonoBehaviour
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
T[] array = Resources.FindObjectsOfTypeAll<T>();
foreach (T val in array)
{
SetObjectsVisibleGameObject<T>(((Component)(object)val).gameObject);
if (!includeChildren)
{
continue;
}
foreach (Transform item in ((Component)(object)val).transform)
{
Transform val2 = item;
SetObjectsVisibleGameObject<T>(((Component)val2).gameObject);
}
}
}
public void SetObjectsVisibleGameObject<T>(GameObject obj) where T : MonoBehaviour
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
obj.gameObject.layer = 0;
MeshRenderer renderer = default(MeshRenderer);
BoxCollider val = default(BoxCollider);
if (obj.TryGetComponent<MeshRenderer>(ref renderer))
{
MakeVisible<T>(renderer);
}
else if (!((Object)(object)obj.GetComponent<Collider>() == (Object)null) && obj.TryGetComponent<BoxCollider>(ref val))
{
MeshRenderer renderer2 = obj.gameObject.AddComponent<MeshRenderer>();
MeshFilter val2 = default(MeshFilter);
if (!obj.gameObject.TryGetComponent<MeshFilter>(ref val2))
{
val2 = obj.gameObject.AddComponent<MeshFilter>();
}
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3);
Mesh sharedMesh = val3.GetComponent<MeshFilter>().sharedMesh;
Object.Destroy((Object)(object)val3);
Mesh val4 = Object.Instantiate<Mesh>(sharedMesh);
Vector3[] vertices = val4.vertices;
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = Vector3.Scale(vertices[i], val.size);
}
val4.vertices = vertices;
val4.RecalculateBounds();
val2.mesh = sharedMesh;
MakeVisible<T>(renderer2);
}
}
public void MakeVisible<T>(MeshRenderer renderer) where T : MonoBehaviour
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
((Renderer)renderer).enabled = true;
((Renderer)renderer).material = theMaterial;
if (_colors.ContainsKey(typeof(T)))
{
((Renderer)renderer).material.SetColor(EmissionColor, _colors[typeof(T)]);
((Renderer)renderer).material.color = _colors[typeof(T)];
}
if (!objectsMadeVisible.Contains(renderer))
{
objectsMadeVisible.Add(renderer);
}
}
public void Update()
{
}
}
[BepInPlugin("robi.uk.speedrun", "Speedrun Thingy", "1.1.0")]
public class SpeedRunMod : BaseUnityPlugin
{
public const string pluginGuid = "robi.uk.speedrun";
public const string pluginName = "Speedrun Thingy";
public const string pluginVersion = "1.1.0";
private static Harmony _harmony;
private void Awake()
{
Debug.Log((object)"Loaded mod.");
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_harmony = new Harmony("robi.uk.speedrun");
_harmony.PatchAll();
Debug.Log((object)("Harmony? " + (object)_harmony == null));
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Debug.Log((object)"Bye");
}
}