using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 System.Threading;
using BepInEx;
using BepInEx.Configuration;
using EnragedV1;
using EnragedV1.Classes;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mod;
using Mod.Classes;
using Mod.Helpers;
using Mod.Helpers.Attributes;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[AttributeUsage(AttributeTargets.Class)]
public class CreateOnStart : Attribute
{
}
namespace Mod
{
[BepInPlugin("duviz.EnragedV1", "EnragedV1", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
public static Plugin instance;
public static ConfigFile config;
public static ConfigEntry<int> screenFlashOpacity;
public static ConfigEntry<int> enrageVolume;
public static ConfigEntry<int> minimumSFXVolume;
public static ConfigEntry<string> customMusic;
public static ConfigEntry<bool> alwaysPlayCustomMusic;
public static ConfigEntry<bool> fadeSFX;
public static ConfigEntry<bool> shakeScreen;
public static ConfigEntry<bool> shakeWeapons;
public static AudioClip customMusicClip;
public static Dictionary<string, object> CachedAddressableAssets = new Dictionary<string, object>();
public void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
instance = this;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
new Harmony("duviz.EnragedV1").PatchAll();
config = ((BaseUnityPlugin)this).Config;
screenFlashOpacity = config.Bind<int>("Visuals", "Screen flash opacity", 50, "(0 - 100) Sets the opacity the flash does every time you toggle enrage mode");
shakeScreen = config.Bind<bool>("Visuals", "Shake screen", false, "Shakes the screen while you're enraged");
shakeWeapons = config.Bind<bool>("Visuals", "Shake weapons", true, "Shakes your weapons while you're enraged");
enrageVolume = config.Bind<int>("Audio", "Enrage volume", 50, "(0 - 100) Sets the volume for enrage audio (doesn't work in clash mode)");
customMusic = config.Bind<string>("Audio", "Custom music path", "", "Set an url or file path to play custom music instead of the normal one when enraged (leave empty for no music change, file paths start with \" file:/// \" for some reason) (requires game restart)");
alwaysPlayCustomMusic = config.Bind<bool>("Audio", "Always play custom music", false, "Makes custom music always play even if you're not enraged");
fadeSFX = config.Bind<bool>("Audio", "Gradually fade SFX", false, "Gradually fades out all in-game SFX while enraged");
minimumSFXVolume = config.Bind<int>("Audio", "Minimum SFX volume", 10, "The minimum volume the SFX will have if Gradually fade SFX is enabled");
LogInfo("Commissioned by PrismaticYaya <3");
}
public void Start()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
BundleLoader.LoadBundle("Assets.enragedv1.bundle");
if (customMusic.Value != "")
{
((MonoBehaviour)this).StartCoroutine(WebRequests.GetAudio(customMusic.Value, delegate(AudioClip clip)
{
customMusicClip = clip;
}));
}
foreach (var (type, createOnStart) in AttributeHelper.GetTypesWithAttribute<CreateOnStart>())
{
if (!(type == null) && typeof(MonoBehaviour).IsAssignableFrom(type))
{
GameObject val = new GameObject(type.Name);
Object.DontDestroyOnLoad((Object)(object)val);
val.AddComponent(type);
}
}
}
public static T Ass<T>(string key)
{
//IL_0030: 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)
if (CachedAddressableAssets.TryGetValue(key + typeof(T).Name, out var value))
{
return (T)value;
}
T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
CachedAddressableAssets.Add(key + typeof(T).Name, val);
return val;
}
public static void LogInfo(object msg)
{
((BaseUnityPlugin)instance).Logger.LogInfo(msg);
}
public static void LogWarning(object msg)
{
((BaseUnityPlugin)instance).Logger.LogWarning(msg);
}
public static void LogError(object msg)
{
((BaseUnityPlugin)instance).Logger.LogError(msg);
}
}
public class PluginInfo
{
public const string GUID = "duviz.EnragedV1";
public const string Name = "EnragedV1";
public const string Version = "0.1.0";
}
}
namespace Mod.Helpers
{
public static class BundleLoader
{
public static AssetBundle bundle { get; private set; }
public static void LoadBundle(string path)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string text = "EnragedV1." + path;
using Stream stream = executingAssembly.GetManifestResourceStream(text);
if (stream == null)
{
Plugin.LogError("Bundle not found: " + text);
return;
}
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
UnloadBundle();
bundle = AssetBundle.LoadFromMemory(memoryStream.ToArray());
}
public static void UnloadBundle()
{
AssetBundle obj = bundle;
if (obj != null)
{
obj.Unload(false);
}
}
}
public static class UniversalFloatParse
{
public static void Fix()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
}
}
public static class WebRequests
{
[CompilerGenerated]
private sealed class <GetAudio>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string url;
public Action<AudioClip> callback;
private AudioType <audType>5__1;
private UnityWebRequest <www>5__2;
private string <>s__3;
private AudioClip <clip>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetAudio>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<www>5__2 = null;
<>s__3 = null;
<clip>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Invalid comparison between Unknown and I4
//IL_00a4: 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_00bc: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
bool result;
try
{
switch (<>1__state)
{
default:
result = false;
break;
case 0:
{
<>1__state = -1;
string text = url;
int num = url.LastIndexOf('.') + 1;
<>s__3 = text.Substring(num, text.Length - num).ToLower();
if (1 == 0)
{
}
AudioType val = (AudioType)(<>s__3 switch
{
"wav" => 20,
"ogg" => 14,
"mp3" => 13,
"mp4" => 13,
_ => 13,
});
if (1 == 0)
{
}
<audType>5__1 = val;
<>s__3 = null;
<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(url, <audType>5__1);
<>1__state = -3;
<www>5__2.timeout = 5;
<>2__current = <www>5__2.SendWebRequest();
<>1__state = 1;
result = true;
break;
}
case 1:
<>1__state = -3;
if ((int)<www>5__2.result != 1)
{
Plugin.LogError("Audio download error: " + <www>5__2.error);
callback(null);
}
else
{
<clip>5__4 = DownloadHandlerAudioClip.GetContent(<www>5__2);
((Object)<clip>5__4).name = Path.GetFileNameWithoutExtension(url);
callback(<clip>5__4);
<clip>5__4 = null;
}
result = false;
<>m__Finally1();
break;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
return result;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__2 != null)
{
((IDisposable)<www>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GetString>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string url;
public Action<string> callback;
private UnityWebRequest <www>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetString>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<www>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Invalid comparison between Unknown and I4
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<www>5__1 = UnityWebRequest.Get(url);
<>1__state = -3;
<www>5__1.timeout = timeout;
<>2__current = <www>5__1.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -3;
if ((int)<www>5__1.result != 1)
{
Plugin.LogError("Failed to load string: " + <www>5__1.error);
callback?.Invoke(null);
}
else
{
callback?.Invoke(<www>5__1.downloadHandler.text);
}
<>m__Finally1();
<www>5__1 = null;
return false;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__1 != null)
{
((IDisposable)<www>5__1).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PostRequest>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string url;
public Dictionary<string, string> postData;
public Action<string> callback;
private WWWForm <form>5__1;
private Dictionary<string, string>.Enumerator <>s__2;
private KeyValuePair<string, string> <pair>5__3;
private UnityWebRequest <www>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PostRequest>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<form>5__1 = null;
<>s__2 = default(Dictionary<string, string>.Enumerator);
<pair>5__3 = default(KeyValuePair<string, string>);
<www>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Invalid comparison between Unknown and I4
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<form>5__1 = new WWWForm();
<>s__2 = postData.GetEnumerator();
try
{
while (<>s__2.MoveNext())
{
<pair>5__3 = <>s__2.Current;
<form>5__1.AddField(<pair>5__3.Key, <pair>5__3.Value);
<pair>5__3 = default(KeyValuePair<string, string>);
}
}
finally
{
((IDisposable)<>s__2).Dispose();
}
<>s__2 = default(Dictionary<string, string>.Enumerator);
<www>5__4 = UnityWebRequest.Post(url, <form>5__1);
<>1__state = -3;
<www>5__4.timeout = timeout;
<>2__current = <www>5__4.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -3;
if ((int)<www>5__4.result != 1)
{
Plugin.LogError("Failed to post request: " + <www>5__4.error);
callback?.Invoke(null);
}
else
{
callback?.Invoke(<www>5__4.downloadHandler.text);
}
<>m__Finally1();
<www>5__4 = null;
return false;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__4 != null)
{
((IDisposable)<www>5__4).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static int timeout = 15;
[IteratorStateMachine(typeof(<GetString>d__1))]
public static IEnumerator GetString(string url, Action<string> callback)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetString>d__1(0)
{
url = url,
callback = callback
};
}
[IteratorStateMachine(typeof(<GetAudio>d__2))]
public static IEnumerator GetAudio(string url, Action<AudioClip> callback)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetAudio>d__2(0)
{
url = url,
callback = callback
};
}
[IteratorStateMachine(typeof(<PostRequest>d__3))]
public static IEnumerator PostRequest(string url, Dictionary<string, string> postData, Action<string> callback)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PostRequest>d__3(0)
{
url = url,
postData = postData,
callback = callback
};
}
}
}
namespace Mod.Helpers.Attributes
{
public static class AttributeHelper
{
public static IEnumerable<(Type type, T attr)> GetTypesWithAttribute<T>() where T : Attribute
{
return from t in AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes())
select (t, t.GetCustomAttribute<T>()) into x
where x.attr != null
select x;
}
public static IEnumerable<(FieldInfo field, T attr)> GetFieldsWithAttribute<T>() where T : Attribute
{
return from f in AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()).SelectMany((Type t) => t.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
select (f, f.GetCustomAttribute<T>()) into x
where x.attr != null
select x;
}
}
}
namespace Mod.Classes
{
[CreateOnStart]
public class EnragedBind : MonoBehaviour
{
public void Awake()
{
SceneManager.sceneLoaded += OnSceneLoad;
}
public void OnSceneLoad(Scene _, LoadSceneMode __)
{
((MonoBehaviour)this).Invoke("LoadBinds", 0.1f);
}
public void LoadBinds()
{
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
Plugin.config.Reload();
string currentScene = SceneHelper.CurrentScene;
if ((currentScene == "Intro" || currentScene == "Bootstrap") ? true : false)
{
return;
}
AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true);
foreach (AudioSource val in array)
{
if ((Object)(object)val.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)val).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)val).GetComponent<EnragedController>() == (Object)null)
{
((Component)val).gameObject.AddComponent<EnragedAudio>();
}
}
GetMusicVolume[] array2 = Object.FindObjectsOfType<GetMusicVolume>(true);
foreach (GetMusicVolume val2 in array2)
{
if ((Object)(object)((Component)val2).GetComponent<EnragedAudio>() == (Object)null)
{
((Component)val2).gameObject.AddComponent<EnragedAudioVolume>();
}
}
new GameObject().AddComponent<CustomBindingsPoCPlugin.TestListener>();
}
public static void Press()
{
if (!((Object)(object)MonoSingleton<OptionsManager>.instance == (Object)null) && !MonoSingleton<OptionsManager>.instance.paused && !((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null) && (((Behaviour)MonoSingleton<NewMovement>.Instance).isActiveAndEnabled || (!((Object)(object)MonoSingleton<PlatformerMovement>.Instance == (Object)null) && ((Behaviour)MonoSingleton<PlatformerMovement>.instance).isActiveAndEnabled)))
{
EnragedController.instance.ToggleEnrage();
}
}
}
[CreateOnStart]
public class EnragedController : MonoBehaviour
{
public static EnragedController instance;
public static AudioMixerGroup mutedGroup;
public static bool isEnraged;
public GameObject canvas;
public Image enragedImg;
public Image fadeImg;
public FadeOutAnim fadeOutAnim;
public AudioSource source;
public AudioSource music;
public GameObject rageEffect;
public void Start()
{
instance = this;
canvas = Object.Instantiate<GameObject>(BundleLoader.bundle.LoadAsset<GameObject>("EnrageCanvas"));
Object.DontDestroyOnLoad((Object)(object)canvas);
source = ((Component)this).gameObject.AddComponent<AudioSource>();
source.playOnAwake = false;
music = ((Component)this).gameObject.AddComponent<AudioSource>();
music.playOnAwake = false;
enragedImg = ((Component)canvas.transform.Find("Enrage")).GetComponent<Image>();
fadeImg = ((Component)canvas.transform.Find("Animation")).GetComponent<Image>();
enragedImg.sprite = Plugin.Ass<Sprite>("Assets/Textures/UI/powerupvignette.png");
enragedImg.type = (Type)1;
enragedImg.pixelsPerUnitMultiplier = 1f;
mutedGroup = BundleLoader.bundle.LoadAsset<AudioMixerGroup>("Mute");
fadeOutAnim = ((Component)fadeImg).gameObject.AddComponent<FadeOutAnim>();
}
public void Update()
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
if (isEnraged && SceneHelper.CurrentScene == "Main Menu")
{
ToggleEnrage();
}
if ((Object)(object)rageEffect != (Object)null)
{
if (ClashPlayerEnabled() && isEnraged)
{
rageEffect.transform.position = ((Component)MonoSingleton<PlatformerMovement>.Instance.rb).transform.Find("v1_combined/metarig/spine/spine.001/spine.002/spine.003").position;
rageEffect.transform.LookAt(((Component)Camera.main).transform);
}
else
{
Object.Destroy((Object)(object)rageEffect);
Enrage();
}
}
else if (ClashPlayerEnabled() && isEnraged)
{
Enrage();
}
if (isEnraged)
{
if (Plugin.shakeScreen.Value)
{
MonoSingleton<CameraController>.Instance.CameraShake(0.05f);
}
if (Plugin.shakeWeapons.Value && (Object)(object)MonoSingleton<CameraController>.Instance != (Object)null && (Object)(object)MonoSingleton<CameraController>.Instance.hudCamera != (Object)null)
{
((Component)MonoSingleton<CameraController>.Instance.hudCamera).transform.Translate(Random.Range(-1f, 1f) * Time.deltaTime, Random.Range(-1f, 1f) * Time.deltaTime, 0f);
}
if ((!MonoSingleton<NewMovement>.instance.activated || !((Behaviour)MonoSingleton<NewMovement>.instance).isActiveAndEnabled) && ((Object)(object)MonoSingleton<PlatformerMovement>.instance == (Object)null || ((Object)(object)MonoSingleton<PlatformerMovement>.instance != (Object)null && !MonoSingleton<PlatformerMovement>.instance.activated)))
{
AudioSource obj = source;
obj.volume -= (source.volume - 0f) / (10f / (Time.unscaledDeltaTime * 60f));
}
else
{
AudioSource obj2 = source;
obj2.volume -= (source.volume - (float)Plugin.enrageVolume.Value / 100f) / (10f / (Time.unscaledDeltaTime * 60f));
}
float sfxVolume = MonoSingleton<AudioMixerController>.instance.sfxVolume;
if (Plugin.fadeSFX.Value)
{
MonoSingleton<AudioMixerController>.instance.SetSFXVolume(sfxVolume - (sfxVolume - MathF.Min(sfxVolume, (float)Plugin.minimumSFXVolume.Value / 100f)) / (100f / (Time.unscaledDeltaTime * 60f)));
}
}
if ((Object)(object)Plugin.customMusicClip != (Object)null && (isEnraged || Plugin.alwaysPlayCustomMusic.Value) && SceneHelper.CurrentScene != "Main Menu" && (Object)(object)MonoSingleton<NewMovement>.instance != (Object)null && (((Component)MonoSingleton<NewMovement>.instance).gameObject.activeInHierarchy || ((Object)(object)MonoSingleton<PlatformerMovement>.instance != (Object)null && MonoSingleton<PlatformerMovement>.instance.activated && ((Component)MonoSingleton<PlatformerMovement>.instance).gameObject.activeInHierarchy)))
{
music.volume = 1f;
if (!music.isPlaying)
{
music.outputAudioMixerGroup = MonoSingleton<AudioMixerController>.instance.musicGroup;
music.clip = Plugin.customMusicClip;
music.loop = true;
music.Play();
}
}
else
{
AudioSource obj3 = music;
if (obj3 != null)
{
obj3.Stop();
}
}
}
public void ToggleEnrage()
{
isEnraged = !isEnraged;
source.outputAudioMixerGroup = MonoSingleton<AudioMixerController>.instance.allGroup;
((MonoBehaviour)this).Invoke(isEnraged ? "Enrage" : "CalmDown", 0f);
}
public void Enrage()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
((Graphic)enragedImg).color = new Color(1f, 0f, 0f, 1f);
((Graphic)fadeImg).color = new Color(1f, 0f, 0f, (float)Plugin.screenFlashOpacity.Value / 100f);
fadeOutAnim.targetAlpha = 0.1f;
source.Stop();
if (ClashPlayerEnabled())
{
if ((Object)(object)rageEffect == (Object)null)
{
rageEffect = Object.Instantiate<GameObject>(Plugin.Ass<GameObject>("Assets/Particles/Enemies/RageEffect.prefab"));
rageEffect.GetComponentInChildren<AlwaysLookAtCamera>().preferCameraOverHead = true;
Object.DontDestroyOnLoad((Object)(object)rageEffect);
}
}
else
{
source.PlayOneShot(Plugin.Ass<AudioClip>("Assets/Sounds/Enemies/enrage.wav"));
source.clip = Plugin.Ass<AudioClip>("Assets/Sounds/Enemies/rageloop.wav");
source.loop = true;
source.Play();
}
}
public void CalmDown()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
((Graphic)enragedImg).color = new Color(1f, 0f, 0f, 0f);
((Graphic)fadeImg).color = new Color(1f, 1f, 1f, (float)Plugin.screenFlashOpacity.Value / 100f);
fadeOutAnim.targetAlpha = 0f;
source.Stop();
if (!Plugin.alwaysPlayCustomMusic.Value)
{
music.Stop();
}
source.clip = Plugin.Ass<AudioClip>("Assets/Sounds/Enemies/EnrageEndPlayer.wav");
source.loop = false;
source.Play();
MonoSingleton<AudioMixerController>.instance.sfxVolume = MonoSingleton<PrefsManager>.Instance.GetFloat("sfxVolume", 0f);
MonoSingleton<AudioMixerController>.instance.SetSFXVolume(MonoSingleton<AudioMixerController>.instance.sfxVolume);
MonoSingleton<AudioMixerController>.instance.optionsMusicVolume = MonoSingleton<PrefsManager>.Instance.GetFloat("musicVolume", 0f);
MonoSingleton<AudioMixerController>.instance.SetMusicVolume(MonoSingleton<AudioMixerController>.instance.optionsMusicVolume);
if ((Object)(object)rageEffect != (Object)null)
{
Object.Destroy((Object)(object)rageEffect);
}
}
public static bool MusicPlaying()
{
return (Object)(object)instance.music != (Object)null && instance.music.isPlaying;
}
private bool ClashPlayerEnabled()
{
return (Object)(object)MonoSingleton<PlatformerMovement>.Instance != (Object)null && MonoSingleton<PlatformerMovement>.Instance.activated && ((Component)MonoSingleton<PlatformerMovement>.Instance).gameObject.activeInHierarchy;
}
}
}
namespace EnragedV1
{
public static class CustomBindingsPoCPlugin
{
public class TestListener : MonoBehaviour
{
private YourCustomInputs inputs;
public void Start()
{
inputs = MonoSingleton<YourCustomInputs>.Instance;
}
public void Update()
{
if (!((Object)(object)inputs == (Object)null) && inputs.SomeFirstAction.WasPerformedThisFrame())
{
EnragedBind.Press();
}
}
}
[HarmonyPatch(typeof(InputActions))]
public static class InputActionPatches
{
[HarmonyPostfix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static void InputActions_Constructor_Postfix(InputActions __instance)
{
if (__instance.asset.FindActionMap("Enraged V1", false) == null)
{
MergeInputActionAssets(__instance);
}
}
private static void MergeInputActionAssets(InputActions ukInputActions)
{
Object[] array = Resources.FindObjectsOfTypeAll(typeof(InputActionAsset));
if (array.Length == 0)
{
Debug.LogError((object)"Couldn't load InputActionAsset");
}
else
{
InputActionSetupExtensions.AddActionMap(ukInputActions.asset, ActionMap);
}
}
}
[ConfigureSingleton(/*Could not decode attribute arguments.*/)]
public class YourCustomInputs : MonoSingleton<YourCustomInputs>
{
private InputActionMap _actionMap;
public InputAction SomeFirstAction { get; private set; }
public void Awake()
{
base.Awake();
_actionMap = MonoSingleton<InputManager>.Instance.InputSource.Actions.asset.FindActionMap("Enraged V1", false);
SomeFirstAction = _actionMap.FindAction("Toggle enraged", false);
}
}
[HarmonyPatch(typeof(ControlsOptions))]
public static class ControlsOptionsPatches
{
[CompilerGenerated]
private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
{
private int <>1__state;
private CodeInstruction <>2__current;
private int <>l__initialThreadId;
private IEnumerable<CodeInstruction> instructions;
public IEnumerable<CodeInstruction> <>3__instructions;
private List<CodeInstruction> <list>5__1;
private MethodInfo <addMap>5__2;
private FieldInfo <mapField>5__3;
private List<CodeInstruction>.Enumerator <>s__4;
private CodeInstruction <inst>5__5;
private Type <t>5__6;
CodeInstruction IEnumerator<CodeInstruction>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Transpiler>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 1) <= 3u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<list>5__1 = null;
<addMap>5__2 = null;
<mapField>5__3 = null;
<>s__4 = default(List<CodeInstruction>.Enumerator);
<inst>5__5 = null;
<t>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<list>5__1 = new List<CodeInstruction>(instructions);
<addMap>5__2 = AccessTools.Method(typeof(ControlsOptionsPatches), "AddMap", (Type[])null, (Type[])null);
<mapField>5__3 = AccessTools.Field(typeof(CustomBindingsPoCPlugin), "ActionMap");
<>s__4 = <list>5__1.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)<mapField>5__3);
<>1__state = 2;
return true;
case 2:
<>1__state = -3;
<>2__current = new CodeInstruction(OpCodes.Call, (object)<addMap>5__2);
<>1__state = 3;
return true;
case 3:
<>1__state = -3;
break;
case 4:
<>1__state = -3;
<t>5__6 = null;
<inst>5__5 = null;
break;
}
if (<>s__4.MoveNext())
{
<inst>5__5 = <>s__4.Current;
if (<inst>5__5.opcode == OpCodes.Newarr)
{
object operand = <inst>5__5.operand;
<t>5__6 = operand as Type;
if ((object)<t>5__6 != null && <t>5__6 == typeof(InputActionMap))
{
<>2__current = <inst>5__5;
<>1__state = 1;
return true;
}
}
<>2__current = <inst>5__5;
<>1__state = 4;
return true;
}
<>m__Finally1();
<>s__4 = default(List<CodeInstruction>.Enumerator);
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__4).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
{
<Transpiler>d__0 <Transpiler>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Transpiler>d__ = this;
}
else
{
<Transpiler>d__ = new <Transpiler>d__0(0);
}
<Transpiler>d__.instructions = <>3__instructions;
return <Transpiler>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
}
}
[IteratorStateMachine(typeof(<Transpiler>d__0))]
[HarmonyTranspiler]
[HarmonyPatch(typeof(ControlsOptions), "Rebuild")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Transpiler>d__0(-2)
{
<>3__instructions = instructions
};
}
private static InputActionMap[] AddMap(InputActionMap[] original, InputActionMap extra)
{
if (original == null)
{
return (InputActionMap[])(object)new InputActionMap[1] { extra };
}
InputActionMap[] array = (InputActionMap[])(object)new InputActionMap[original.Length + 1];
Array.Copy(original, array, original.Length);
array[^1] = extra;
return array;
}
}
private const string InputMapName = "Enraged V1";
private const string SomeFirstActionName = "Toggle enraged";
private static readonly string YourActionMapJson = "{\r\n\t\t\"maps\": [\r\n\t\t\t{\r\n\t\t\t\t\"name\": \"Enraged V1\",\r\n\t\t\t\t\"id\": \"6212261a-20ba-4c58-8568-ef2c0f5d770f\",\r\n\t\t\t\t\"actions\": [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\"name\": \"Toggle enraged\",\r\n\t\t\t\t\t\t\"type\": \"Button\",\r\n\t\t\t\t\t\t\"id\": \"bc66ba6d-9493-499b-8c3d-0cf0992fc6a8\",\r\n\t\t\t\t\t\t\"expectedControlType\": \"Button\",\r\n\t\t\t\t\t\t\"processors\": \"\",\r\n\t\t\t\t\t\t\"interactions\": \"\",\r\n\t\t\t\t\t\t\"initialStateCheck\": false\r\n\t\t\t\t\t}\r\n\t\t\t\t],\r\n\t\t\t\t\"bindings\": [\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\"name\": \"\",\r\n\t\t\t\t\t\t\"id\": \"81a50519-0cf2-4bcd-a000-892c93e461e7\",\r\n\t\t\t\t\t\t\"path\": \"<Keyboard>/h\",\r\n\t\t\t\t\t\t\"interactions\": \"\",\r\n\t\t\t\t\t\t\"processors\": \"\",\r\n\t\t\t\t\t\t\"groups\": \"Keyboard & Mouse\",\r\n\t\t\t\t\t\t\"action\": \"Toggle enraged\",\r\n\t\t\t\t\t\t\"isComposite\": false,\r\n\t\t\t\t\t\t\"isPartOfComposite\": false\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t]\r\n\t}";
private static readonly InputActionMap ActionMap = InputActionMap.FromJson(YourActionMapJson)[0];
}
}
namespace EnragedV1.Classes
{
public class EnragedAudio : MonoBehaviour
{
public AudioSource source;
public float startVolume;
public void Start()
{
source = ((Component)this).gameObject.GetComponent<AudioSource>();
startVolume = source.volume;
}
public void Update()
{
if ((Object)(object)Plugin.customMusicClip != (Object)null && EnragedController.MusicPlaying())
{
source.outputAudioMixerGroup = EnragedController.mutedGroup;
}
else
{
source.outputAudioMixerGroup = MonoSingleton<AudioMixerController>.instance.musicGroup;
}
}
}
[HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })]
public class EnragedAudioPatch
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "Play", new Type[] { typeof(double) })]
public class EnragedAudioPatch2
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "PlayDelayed", new Type[] { typeof(float) })]
public class EnragedAudioPatch23
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "PlayScheduled", new Type[] { typeof(float) })]
public class EnragedAudioPatch24
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "Play", new Type[] { typeof(ulong) })]
public class EnragedAudioPatch22
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "UnPause")]
public class EnragedAudioPatch3
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[] { typeof(AudioClip) })]
public class EnragedAudioPatch4
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
[HarmonyPatch(typeof(AudioSource), "PlayOneShot", new Type[]
{
typeof(AudioClip),
typeof(float)
})]
public class EnragedAudioPatch5
{
public static void Prefix(AudioSource __instance)
{
if (!((Object)(object)MonoSingleton<AudioMixerController>.instance == (Object)null) && (Object)(object)__instance.outputAudioMixerGroup == (Object)(object)MonoSingleton<AudioMixerController>.instance.musicGroup && (Object)(object)((Component)__instance).GetComponent<EnragedAudio>() == (Object)null && (Object)(object)((Component)__instance).GetComponent<EnragedController>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<EnragedAudio>();
}
}
}
public class EnragedAudioVolume : MonoBehaviour
{
public AudioSource source;
public float startVolume;
public void Start()
{
source = ((Component)this).gameObject.GetComponent<AudioSource>();
startVolume = source.volume;
}
public void Update()
{
if ((Object)(object)Plugin.customMusicClip != (Object)null && EnragedController.MusicPlaying())
{
source.volume = 0f;
}
}
}
public class FadeOutAnim : MonoBehaviour
{
private Image img;
public float targetAlpha = 0f;
public void Start()
{
img = ((Component)this).GetComponent<Image>();
}
public void Update()
{
//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_0027: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
((Graphic)img).color = Color.Lerp(((Graphic)img).color, new Color(((Graphic)img).color.r, ((Graphic)img).color.g, ((Graphic)img).color.b, targetAlpha), Time.unscaledDeltaTime * 5f);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}