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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OhGodHelpYou.Scripts;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using plog;
using plog.Models;
[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("OhGodHelpYou")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Description")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OhGodHelpYou")]
[assembly: AssemblyTitle("OhGodHelpYou")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 OhGodHelpYou
{
[BepInPlugin("eveD.ultratelephone3.real.get.free.on.thunderstore.r2modman.github.nexus.and.more.now.quick.before.you.miss.it.com", "OhGodHelpYou", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
public static ManualLogSource Loge = new ManualLogSource("SuperAwesomeUltraTelephoneRipoff");
public static Logger Loge2 = new Logger("SuperAwesomeUltraTelephoneRipoff");
public static string catPath;
public static MainCode Instance;
public static List<AudioClip> music = new List<AudioClip>();
private static Texture horrors;
private static Sprite horrors2;
private static Texture2D horrors3;
private static List<string> shaderBlacklist = new List<string> { "ultrakill/postprocessv2", "ultrakill/portal", "text", "unityexplorer" };
private static List<string> shaderWhitelist = new List<string> { "psx", "master", "standard", "sprite", "ui", "skybox" };
private static List<string> materialBlacklist = new List<string> { "PostProcessV2_VSRM", "InvisibleFace", "M_HeatWave_Camera", "CreateScreenNormal" };
private static List<string> varBlacklist = new List<string> { "_cube" };
private static List<string> keywordBlacklist = new List<string> { "limbo_walls" };
public static void SendHudMessage(string msg, int delay = 0, bool silent = false)
{
MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", delay, silent, false, true);
}
public static IEnumerator ClearHudMessage(float time)
{
yield return (object)new WaitForSeconds(time);
MonoSingleton<HudMessageReceiver>.Instance.ClearMessage();
}
public static Type Fetch<Type>(string name)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<Type>((object)name).WaitForCompletion();
}
public static Type FetchFromBundle<Type>(string name, bool autofill = true)
{
return Fetch<Type>(autofill ? ("Assets/formods/OGHY/" + name) : name);
}
public static void Log(string log, int type = 1, bool plog = false)
{
log = "[SuperAwesomeUltraTelephoneRipoff] " + log;
switch (type)
{
case 1:
if (plog)
{
Loge2.Info(log, (IEnumerable<Tag>)null, (string)null, (object)null);
}
Loge.LogInfo((object)log);
break;
case 2:
if (plog)
{
Loge2.Warning(log, (IEnumerable<Tag>)null, (string)null, (object)null);
}
Loge.LogWarning((object)log);
break;
case 3:
if (plog)
{
Loge2.Error(log, (IEnumerable<Tag>)null, (string)null, (object)null);
}
Loge.LogError((object)log);
break;
}
}
public void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).gameObject != (Object)null && (int)((Object)((Component)this).gameObject).hideFlags != 61)
{
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
}
Instance = this;
Loge = ((BaseUnityPlugin)this).Logger;
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = (catPath = directoryName);
music = new List<AudioClip>();
if (text != null)
{
string text2 = "Got bundle ";
Log(text2 + text);
string text3 = Path.Combine(directoryName, "catalog.json");
string text4 = Path.Combine(directoryName, "settings.json");
AsyncOperationHandle<IResourceLocator> cat = Addressables.LoadContentCatalogAsync(text3, true, (string)null);
cat.Completed += delegate
{
//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)
Log("Got Content Catalog!");
foreach (string key in cat.Result.Keys)
{
if (key.StartsWith("Assets/formods/OGHY/") && (key.EndsWith(".mp3") || key.EndsWith(".ogg") || key.EndsWith(".wav")))
{
Log(key);
AsyncOperationHandle<AudioClip> handle = Addressables.LoadAssetAsync<AudioClip>((object)key);
handle.Completed += delegate
{
Log(((object)handle.Result)?.ToString() ?? "");
music.Add(handle.Result);
};
}
}
};
}
else
{
Log("Failed to get bundles!", 3);
}
new Harmony("eveD.ultratelephone3.real.get.free.on.thunderstore.r2modman.github.nexus.and.more.now.quick.before.you.miss.it.com").PatchAll();
SceneManager.sceneLoaded += OnSceneLoad;
}
public static void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
}
public static void Process(Material m)
{
bool flag = false;
if ((Object)(object)m == (Object)null || (Object)(object)m.shader == (Object)null || ((Object)m.shader).name == null)
{
return;
}
foreach (string item in shaderWhitelist)
{
if (((Object)m.shader).name.ToLower().Contains(item))
{
flag = true;
}
}
if (flag)
{
foreach (string item2 in shaderBlacklist)
{
if (((Object)m.shader).name.ToLower().Contains(item2))
{
flag = false;
}
}
}
if (flag)
{
foreach (string item3 in keywordBlacklist)
{
string[] shaderKeywords = m.shaderKeywords;
foreach (string text in shaderKeywords)
{
if (text.ToLower().Contains(item3))
{
flag = false;
}
}
}
}
if (!flag)
{
return;
}
foreach (string item4 in materialBlacklist)
{
if (((Object)m).name.Contains(item4))
{
return;
}
}
string[] texturePropertyNames = m.GetTexturePropertyNames();
foreach (string text2 in texturePropertyNames)
{
bool flag2 = true;
foreach (string item5 in varBlacklist)
{
if (text2.ToLower().Contains(item5))
{
flag2 = false;
}
}
if (flag2)
{
try
{
m.SetTexture(text2, horrors);
}
catch (Exception)
{
}
}
}
}
public static void ProcessStatic(Renderer r)
{
r.material.mainTexture = horrors;
}
public static void Evils()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Expected O, but got Unknown
if (horrors == null)
{
horrors = FetchFromBundle<Texture>("Painting.jpg");
}
if (horrors2 == null)
{
horrors2 = FetchFromBundle<Sprite>("Painting.jpg");
}
if (horrors3 == null)
{
horrors3 = FetchFromBundle<Texture2D>("Painting.jpg");
}
Object[] array = Object.FindObjectsByType(typeof(SpriteRenderer), (FindObjectsInactive)1, (FindObjectsSortMode)0);
for (int i = 0; i < array.Length; i++)
{
SpriteRenderer val = (SpriteRenderer)array[i];
val.sprite = horrors2;
}
Object[] array2 = Object.FindObjectsByType(typeof(Image), (FindObjectsInactive)1, (FindObjectsSortMode)0);
for (int j = 0; j < array2.Length; j++)
{
Image val2 = (Image)array2[j];
val2.sprite = horrors2;
}
Object[] array3 = Object.FindObjectsByType(typeof(Renderer), (FindObjectsInactive)1, (FindObjectsSortMode)0);
for (int k = 0; k < array3.Length; k++)
{
Renderer val3 = (Renderer)array3[k];
if (val3.isPartOfStaticBatch)
{
ProcessStatic(val3);
}
}
Material[] array4 = Resources.FindObjectsOfTypeAll<Material>();
foreach (Material m in array4)
{
Process(m);
}
Object[] array5 = Object.FindObjectsByType(typeof(AudioSource), (FindObjectsInactive)1, (FindObjectsSortMode)0);
for (int n = 0; n < array5.Length; n++)
{
AudioSource val4 = (AudioSource)array5[n];
ComponentExtensions.GetOrAddComponent<AudioTwister>((Component)(object)val4);
}
}
}
public class PluginInfo
{
public const string GUID = "eveD.ultratelephone3.real.get.free.on.thunderstore.r2modman.github.nexus.and.more.now.quick.before.you.miss.it.com";
public const string Name = "OhGodHelpYou";
public const string Version = "1.0.0";
}
[HarmonyPatch]
public class Patches
{
private static float playerSpawnTime;
[HarmonyPrefix]
[HarmonyPatch(typeof(DifficultyTitle), "Check")]
public static bool Difficulty(DifficultyTitle __instance)
{
int num = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0);
string text = "";
if (__instance.lines)
{
text += "-- ";
}
if (num < 5)
{
text += "<color=yellow>";
}
switch (num)
{
case 0:
text = text ?? "";
break;
case 1:
text = text ?? "";
break;
case 2:
text = text ?? "";
break;
case 3:
text = text ?? "";
break;
case 4:
text = text ?? "";
break;
case 5:
text = text ?? "";
break;
}
if (__instance.lines)
{
text += " </color>--";
}
if (!Object.op_Implicit((Object)(object)__instance.txt2))
{
__instance.txt2 = ((Component)__instance).GetComponent<TMP_Text>();
}
if (Object.op_Implicit((Object)(object)__instance.txt2))
{
__instance.txt2.text = text;
return false;
}
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(NewMovement), "Start")]
[HarmonyPatch(typeof(NewMovement), "ActivatePlayer")]
public static async void DoEvils()
{
playerSpawnTime = Time.time;
await Task.Yield();
await Task.Yield();
MainCode.Evils();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(NewMovement), "Update")]
public static void Gravity()
{
//IL_0049: 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_005d: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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: Unknown result type (might be due to invalid IL or missing references)
float num = 3f;
Vector3 val = new Vector3(Mathf.Sin((Time.time - playerSpawnTime) * num), Mathf.Sin((Time.time - playerSpawnTime) * 0.8f * num), Mathf.Sin((Time.time - playerSpawnTime) * 0.7f * num)) * Time.deltaTime * 4f * num;
Vector3 val2 = default(Vector3);
Vector3 val3;
if (PhysicsExtensions.TryGetCustomGravity(MonoSingleton<NewMovement>.Instance.rb, ref val2))
{
NewMovement instance = MonoSingleton<NewMovement>.Instance;
val3 = val2 + val;
instance.SwitchGravity(((Vector3)(ref val3)).normalized * 40f, false, true);
}
else
{
NewMovement instance2 = MonoSingleton<NewMovement>.Instance;
val3 = new Vector3(0f, -40f, 0f) + val;
instance2.SwitchGravity(((Vector3)(ref val3)).normalized * 40f, false, true);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(EnemyIdentifierIdentifier), "Awake")]
public static void Eidid(EnemyIdentifierIdentifier __instance)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
EnemyIdentifier val = default(EnemyIdentifier);
if (((Component)__instance).TryGetComponent<EnemyIdentifier>(ref val))
{
return;
}
float num = Random.Range(0.1f, 3f);
Transform transform = ((Component)__instance).transform;
transform.localScale *= num;
foreach (Transform item in ((Component)__instance).transform)
{
Transform val2 = item;
val2.localScale /= num;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MusicChanger), "Change")]
[HarmonyPatch(typeof(MusicChanger), "ChangeTo")]
public static void Music2(MusicChanger __instance)
{
__instance.pitch *= Random.Range(0.2f, 2f);
__instance.battle = MainCode.music[Random.Range(0, MainCode.music.Count)];
__instance.clean = MainCode.music[Random.Range(0, MainCode.music.Count)];
__instance.boss = MainCode.music[Random.Range(0, MainCode.music.Count)];
}
}
}
namespace OhGodHelpYou.Scripts
{
public class AudioTwister : MonoBehaviour
{
private AudioSource src;
private int type = 0;
public void Start()
{
src = ((Component)this).GetComponent<AudioSource>();
type = Random.Range(0, 3);
if (((Object)(object)src.outputAudioMixerGroup != (Object)null && (Object)(object)src.outputAudioMixerGroup.audioMixer != (Object)null && (((Object)src.outputAudioMixerGroup.audioMixer).name.ToLower().Contains("music") || ((Object)src.outputAudioMixerGroup).name.ToLower().Contains("music"))) || ((Object)src).name.ToLower().Contains("music"))
{
AudioSource obj = src;
obj.pitch *= Random.Range(0.2f, 2f);
src.clip = MainCode.music[Random.Range(0, MainCode.music.Count)];
}
}
public void Update()
{
if ((!((Object)(object)src.outputAudioMixerGroup != (Object)null) || !((Object)(object)src.outputAudioMixerGroup.audioMixer != (Object)null) || (!((Object)src.outputAudioMixerGroup.audioMixer).name.ToLower().Contains("music") && !((Object)src.outputAudioMixerGroup).name.ToLower().Contains("music"))) && !((Object)src).name.ToLower().Contains("music"))
{
switch (type)
{
case 0:
{
AudioSource obj2 = src;
obj2.pitch += ((src.pitch > 3f) ? (-3f) : (Time.deltaTime * 0.05f));
break;
}
case 1:
{
AudioSource obj = src;
obj.pitch -= ((src.pitch < 0f) ? (-3f) : (Time.deltaTime * 0.05f));
break;
}
case 2:
src.pitch = 1f + Mathf.Sin(Time.time) * 0.75f;
break;
default:
src.pitch = 1f + Mathf.Sin(Time.time * 10f) * 2f;
break;
}
}
}
}
public class Fog : MonoBehaviour
{
public class LightDisabler : MonoBehaviour
{
private Light light;
public void Start()
{
light = ((Component)this).GetComponent<Light>();
}
public void Update()
{
if (Object.op_Implicit((Object)(object)light) && ((Behaviour)light).enabled)
{
((Behaviour)light).enabled = false;
}
}
}
private float t = 0f;
private float t2 = 1f;
private bool fog = false;
private Color fogColor = default(Color);
private FogMode mode = (FogMode)0;
private float start;
private float end;
private Fog instance;
public void Start()
{
//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_0058: 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_00c3: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Invalid comparison between Unknown and I4
if ((Object)(object)instance != (Object)null)
{
Object.Destroy((Object)(object)((Component)instance).gameObject);
instance = this;
}
t = 0.5f;
t2 = 0f;
fog = RenderSettings.fog;
fogColor = Color.black;
mode = RenderSettings.fogMode;
start = (RenderSettings.fog ? RenderSettings.fogStartDistance : 999f);
end = (RenderSettings.fog ? RenderSettings.fogEndDistance : 1000f);
MonoSingleton<CameraController>.Instance.cam.clearFlags = (CameraClearFlags)2;
MonoSingleton<CameraController>.Instance.cam.backgroundColor = new Color(0f, 0f, 0f, 1f);
RenderSettings.fog = true;
RenderSettings.fogColor = Color.black;
RenderSettings.fogMode = (FogMode)1;
RenderSettings.fogStartDistance = 10f;
RenderSettings.fogEndDistance = 30f;
RenderSettings.ambientLight = Color.black;
Light[] array = Object.FindObjectsOfType<Light>();
foreach (Light val in array)
{
if ((int)val.type == 1)
{
ComponentExtensions.GetOrAddComponent<LightDisabler>((Component)(object)val);
}
}
}
public void Update()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
t -= Time.deltaTime;
if (t <= 0f)
{
t2 += Time.deltaTime * 2f;
RenderSettings.fogColor = Color.Lerp(Color.black, fogColor, t2);
RenderSettings.fogStartDistance = Mathf.Lerp(10f, start, t2);
RenderSettings.fogEndDistance = Mathf.Lerp(30f, end, t2);
if (t2 >= 1f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public void OnDestroy()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.fog = fog;
RenderSettings.fogMode = mode;
RenderSettings.fogStartDistance = start;
RenderSettings.fogEndDistance = end;
}
public static void Activate()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
GameObject val = new GameObject("Fog", new Type[1] { typeof(Fog) });
}
}
}