using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Configgy;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RevampedULTRAWTF")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RevampedULTRAWTF")]
[assembly: AssemblyTitle("RevampedULTRAWTF")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 RevampedULTRAWTF
{
public static class ObjTools
{
public static bool ContainsComp<T>(this GameObject o) where T : Component
{
return (Object)(object)o.GetComponent<T>() != (Object)null;
}
}
[BepInPlugin("doomahreal.ultrakill.thismodisnotmine", "RevampedULTRAWTF", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[Configgable("", "Toggle", 0, null)]
public static ConfigKeybind toggle = new ConfigKeybind((KeyCode)110);
[Configgable("", "Speed", 0, null)]
public static ConfigInputField<float> speed = new ConfigInputField<float>(1f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null);
[Configgable("", "Enable erratic rotation", 0, null)]
public static ConfigToggle erraticrotation = new ConfigToggle(false);
[Configgable("", "Affect sizes", 0, null)]
public static ConfigToggle affectsizes = new ConfigToggle(false);
public static bool effectsActive;
private ConfigBuilder config;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
new Harmony("doomahreal.ultrakill.thismodisnotmine").PatchAll();
SceneManager.activeSceneChanged += delegate(Scene x, Scene y)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
SceneSwap(y);
};
config = new ConfigBuilder("doomahreal.ultrakill.thismodisnotmine", "RevampedULTRAWTF");
config.BuildAll();
}
private void OnDestroy()
{
SceneManager.activeSceneChanged -= delegate(Scene x, Scene y)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
SceneSwap(y);
};
}
private void Update()
{
if (toggle.WasPeformed())
{
effectsActive = !effectsActive;
if (effectsActive)
{
EnableEffects();
}
}
}
private void EnableEffects()
{
ScanCanvases();
ApplyToColliders<BoxCollider>();
ApplyToColliders<MeshCollider>();
}
private void SceneSwap(Scene s)
{
if (!effectsActive)
{
return;
}
Canvas[] array = Object.FindObjectsOfType<Canvas>(true);
foreach (Canvas val in array)
{
if (!((Component)val).gameObject.ContainsComp<TiltTransform>())
{
ScanCanvases();
}
}
ApplyToColliders<BoxCollider>();
ApplyToColliders<MeshCollider>();
}
private static void ApplyToColliders<T>() where T : Collider
{
T[] array = Object.FindObjectsOfType<T>(true);
foreach (T val in array)
{
GameObject gameObject = ((Component)(object)val).gameObject;
if (!gameObject.isStatic && !gameObject.ContainsComp<TiltTransform>() && ((Object)gameObject).name != "OutOfBounds")
{
gameObject.AddComponent<TiltTransform>();
}
}
}
private static void ScanCanvases(GameObject r = null)
{
if ((Object)(object)r != (Object)null)
{
try
{
ApplyCanvas(r.GetComponent<Canvas>());
}
catch
{
}
Transform transform = r.transform;
for (int i = 0; i < transform.childCount; i++)
{
ScanCanvases(((Component)transform.GetChild(i)).gameObject);
}
return;
}
Canvas[] array = Object.FindObjectsOfType<Canvas>(true);
foreach (Canvas val in array)
{
if (!((Component)val).gameObject.isStatic && !((Component)val).gameObject.ContainsComp<TiltTransform>())
{
try
{
ApplyCanvas(val);
}
catch
{
}
}
}
}
private static void ApplyCanvas(Canvas c)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
if ((Object)(object)c == (Object)null || ((Component)c).gameObject.isStatic)
{
return;
}
((Component)c).gameObject.AddComponent<TiltTransform>();
foreach (Transform item in ((Component)c).transform)
{
Transform e = item;
ConvertElem(e);
}
}
private static void ConvertElem(Transform e)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
if (!((Component)e).gameObject.isStatic)
{
((Component)e).gameObject.AddComponent<TiltTransform>();
}
foreach (Transform item in e)
{
Transform e2 = item;
ConvertElem(e2);
}
}
}
public class TiltTransform : MonoBehaviour
{
private static float t;
private bool isUI;
private void Start()
{
Transform val = ((Component)this).transform;
while ((Object)(object)val != (Object)null)
{
if ((Object)(object)((Component)val).GetComponent<Canvas>() != (Object)null)
{
isUI = true;
break;
}
val = val.parent;
}
}
private void Update()
{
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.effectsActive)
{
return;
}
float value = ((ConfigValueElement<float>)(object)Plugin.speed).Value;
bool value2 = ((ConfigValueElement<bool>)(object)Plugin.erraticrotation).Value;
bool value3 = ((ConfigValueElement<bool>)(object)Plugin.affectsizes).Value;
float num = (value2 ? (-15f) : (-2.5f));
float num2 = (value2 ? 15f : 1f);
float num3 = 0f;
float num4 = 0f;
float num5 = 0f;
float value4 = Random.value;
if (!value2)
{
num3 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
num4 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
num5 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
}
else
{
if (value4 < 0.7f)
{
num3 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
}
if (value4 < 0.5f)
{
num4 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
}
if (value4 < 0.3f)
{
num5 = Mathf.Lerp(Random.Range(num, num2), Random.Range(num, num2), t) * value;
}
}
Transform transform = ((Component)this).transform;
transform.localRotation *= Quaternion.Euler(num3, num4, num5);
if (value3 && !isUI)
{
float num6 = 1f + Random.Range(-0.03f, 0.03f) * value;
Vector3 val = ((Component)this).transform.localScale * num6;
val.x = Mathf.Clamp(val.x, 0.3f, 3f);
val.y = Mathf.Clamp(val.y, 0.3f, 3f);
val.z = Mathf.Clamp(val.z, 0.3f, 3f);
((Component)this).transform.localScale = val;
}
t += 0.1f * value * Time.deltaTime;
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "doomahreal.ultrakill.thismodisnotmine";
public const string PLUGIN_NAME = "RevampedULTRAWTF";
public const string PLUGIN_VERSION = "1.0.0";
}
}