using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Configgy;
using Configgy.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.Events;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ImpactParry")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e6c8eb4e3b9273d48ec90c6c8ac3e75c854db028")]
[assembly: AssemblyProduct("ImpactParry")]
[assembly: AssemblyTitle("ImpactParry")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[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;
}
}
}
public class RGBSliderConfig : ConfigValueElement<int[]>
{
private Slider[] sliders = (Slider[])(object)new Slider[3];
private Image colorPreview;
public RGBSliderConfig(int[] defaultValue)
: base(defaultValue)
{
base.value = (int[])defaultValue.Clone();
}
protected override void BuildElementCore(RectTransform rect)
{
((ConfigValueElement)this).LoadValue();
ConfigUI.CreateElementSlot<int[]>(rect, (ConfigValueElement<int[]>)this, (Action<RectTransform>)delegate(RectTransform elementsDiv)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
Color[] channelColors = (Color[])(object)new Color[3]
{
Color.red,
Color.green,
Color.blue
};
for (int i = 0; i < 3; i++)
{
int index = i;
DynUI.Div(elementsDiv, (Action<RectTransform>)delegate(RectTransform sliderDiv)
{
DynUI.Slider(sliderDiv, (Action<Slider>)delegate(Slider slider)
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
slider.minValue = 0f;
slider.maxValue = 255f;
slider.wholeNumbers = true;
if (base.value == null || base.value.Length < 3)
{
base.value = new int[3] { 255, 255, 255 };
}
slider.value = base.value[index];
sliders[index] = slider;
RectTransform fillRect = slider.fillRect;
Image val = ((fillRect != null) ? ((Component)fillRect).GetComponent<Image>() : null);
if ((Object)(object)val != (Object)null)
{
((Graphic)val).color = channelColors[index] * ((float)base.value[index] / 255f + 0.2f);
}
((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
{
base.value[index] = (int)v;
base.SetValue((int[])base.value.Clone());
UpdateSliderColors();
UpdateColorPreview();
});
});
});
}
DynUI.Div(elementsDiv, (Action<RectTransform>)delegate(RectTransform previewDiv)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
previewDiv.sizeDelta = new Vector2(40f, 40f);
colorPreview = ((Component)previewDiv).gameObject.AddComponent<Image>();
UpdateColorPreview();
});
}, (Action<RectTransform>)null);
((ConfigValueElement)this).RefreshElementValue();
}
private void UpdateSliderColors()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
if (sliders == null)
{
return;
}
Color[] array = (Color[])(object)new Color[3]
{
Color.red,
Color.green,
Color.blue
};
for (int i = 0; i < 3; i++)
{
if (!((Object)(object)sliders[i] == (Object)null))
{
RectTransform fillRect = sliders[i].fillRect;
Image val = ((fillRect != null) ? ((Component)fillRect).GetComponent<Image>() : null);
if ((Object)(object)val != (Object)null)
{
((Graphic)val).color = array[i] * ((float)base.value[i] / 255f + 0.2f);
}
}
}
}
private void UpdateColorPreview()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)colorPreview == (Object)null) && base.value != null)
{
((Graphic)colorPreview).color = new Color((float)base.value[0] / 255f, (float)base.value[1] / 255f, (float)base.value[2] / 255f);
}
}
protected override void RefreshElementValueCore()
{
if (base.value == null)
{
((ConfigValueElement)this).LoadValue();
}
for (int i = 0; i < 3; i++)
{
if ((Object)(object)sliders[i] != (Object)null)
{
sliders[i].SetValueWithoutNotify((float)base.value[i]);
}
}
UpdateSliderColors();
UpdateColorPreview();
}
protected override void ResetValueCore()
{
base.value = (int[])((ConfigValueElement<int[]>)this).DefaultValue.Clone();
base.SetValue((int[])base.value.Clone());
((ConfigValueElement)this).RefreshElementValue();
}
protected override int[] GetValueCore()
{
if (base.value == null)
{
base.value = (int[])((ConfigValueElement<int[]>)this).DefaultValue.Clone();
}
return (int[])base.value.Clone();
}
}
namespace ImpactParry
{
[HarmonyPatch]
public static class FixOutdoorEnemies
{
private class ChildGetter<T> where T : Component
{
private readonly T instance;
public ChildGetter(T instance)
{
this.instance = instance;
base..ctor();
}
public GameObject Get(string path)
{
string[] array = path.Split('/');
Transform val = null;
string[] array2 = array;
foreach (string text in array2)
{
val = (((Object)(object)val == (Object)null) ? ((Component)instance).transform.Find(text) : (val = val.Find(text)));
}
return (val != null) ? ((Component)val).gameObject : null;
}
}
private static readonly Logger log = new Logger("FixOutdoorEnemies::");
private static readonly List<ForceDefaultOnActive> forcers = new List<ForceDefaultOnActive>();
public static void ApplyDefaultLayers()
{
forcers.ForEach(delegate(ForceDefaultOnActive forcer)
{
if ((Object)(object)forcer != (Object)null && (Object)(object)((forcer != null) ? ((Component)forcer).gameObject : null) != (Object)null)
{
forcer?.SetDefault();
}
});
}
public static void ApplyPreviousLayers()
{
forcers.ForEach(delegate(ForceDefaultOnActive forcer)
{
if ((Object)(object)forcer != (Object)null && (Object)(object)((forcer != null) ? ((Component)forcer).gameObject : null) != (Object)null)
{
forcer?.ResetToPrevious();
}
});
}
public static void AddForcers([ParamCollection] List<GameObject> gameObjects)
{
gameObjects.ForEach(delegate(GameObject obj)
{
if ((Object)(object)obj != (Object)null)
{
forcers.Add(obj.AddComponent<ForceDefaultOnActive>());
}
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Guttertank), "Start")]
public static void GuttertankFix(Guttertank __instance)
{
GameObject val = new ChildGetter<Guttertank>(__instance).Get("Guttertank/Guttertank");
log.Info($"GuttertankFix:: gameobject.name: {((Object)val).name} gameobject.layer: {val.layer}", (IEnumerable<Tag>)null, (string)null, (object)null);
AddForcers(new List<GameObject>(1) { val });
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Gutterman), "Start")]
public static void GuttermanFix(Gutterman __instance)
{
ChildGetter<Gutterman> childGetter = new ChildGetter<Gutterman>(__instance);
List<GameObject> gameObjects = new List<GameObject>(3)
{
childGetter.Get("Gutterman"),
childGetter.Get("Gutterman/Gutterman"),
childGetter.Get("Gutterman/Shield")
};
AddForcers(gameObjects);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MortarLauncher), "Start")]
public static void MortarLauncherFix(MortarLauncher __instance)
{
bool flag = (Object)(object)((Component)__instance).transform.Find("Tower") != (Object)null;
GameObject item = new ChildGetter<MortarLauncher>(__instance).Get(flag ? "Tower" : "MortarLauncher");
AddForcers(new List<GameObject>(1) { item });
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SpiderBody), "Start")]
public static void MauriceFix(SpiderBody __instance)
{
GameObject item = new ChildGetter<SpiderBody>(__instance).Get("MaliciousFace/MaliciousFace");
AddForcers(new List<GameObject>(1) { item });
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Statue), "Start")]
public static void CerberiFix(Statue __instance)
{
ChildGetter<Statue> childGetter = new ChildGetter<Statue>(__instance);
List<GameObject> gameObjects = new List<GameObject>(2)
{
childGetter.Get("Cerberus/Cerberus"),
childGetter.Get("Cerberus/Cerb_Apple")
};
AddForcers(gameObjects);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Minotaur), "Start")]
public static void MinotaurFix(Minotaur __instance)
{
ChildGetter<Minotaur> childGetter = new ChildGetter<Minotaur>(__instance);
List<GameObject> gameObjects = new List<GameObject>(2)
{
childGetter.Get("Minotaur_Rigging02/Minotaur"),
childGetter.Get("Minotaur_Rigging02/Minotaur_Staff")
};
AddForcers(gameObjects);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Mandalore), "Start")]
public static void MandaloreFix(Mandalore __instance)
{
ChildGetter<Mandalore> childGetter = new ChildGetter<Mandalore>(__instance);
List<GameObject> gameObjects = new List<GameObject>(3)
{
childGetter.Get("Mandalore (Skeleton)/Skeleton"),
childGetter.Get("Mandalore (Skeleton)/Armature.001/Base/Hips/Chest/Shammy/ShammyMesh"),
childGetter.Get("Mandalore (Skeleton)/Armature.001/Base/Hips/Chest/Neck/Head/Cylinder/Mandalore_Head")
};
AddForcers(gameObjects);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(FleshPrison), "Start")]
public static void PanopticonFix(FleshPrison __instance)
{
ChildGetter<FleshPrison> childGetter = new ChildGetter<FleshPrison>(__instance);
List<GameObject> gameObjects = ((__instance.eid.FullName == "FLESH PANOPTICON") ? new List<GameObject>(3)
{
childGetter.Get("FleshPrison2"),
childGetter.Get("FleshPrison2/FleshPrison2_Base"),
childGetter.Get("FleshPrison2/FleshPrison2_Head")
} : new List<GameObject>(1) { childGetter.Get("fleshprisonrigged/FleshPrison") });
AddForcers(gameObjects);
}
}
public class ForceDefaultOnActive : MonoBehaviour
{
public int PrevLayer = 0;
public bool Active = false;
public void SetDefault()
{
Active = true;
if (!((Object)(object)((Component)this).gameObject == (Object)null))
{
GameObject gameObject = ((Component)this).gameObject;
PrevLayer = ((gameObject != null) ? gameObject.layer : PrevLayer);
((Component)this).gameObject.layer = 0;
}
}
public void ResetToPrevious()
{
Active = false;
if (!((Object)(object)((Component)this).gameObject == (Object)null))
{
((Component)this).gameObject.layer = PrevLayer;
}
}
public void Update()
{
if (Active && (Object)(object)((Component)this).gameObject != (Object)null)
{
GameObject gameObject = ((Component)this).gameObject;
if (gameObject == null || gameObject.layer != 0)
{
SetDefault();
}
}
}
}
public class ImpactCheat : ICheat
{
public string LongName => "Impact Parry Test";
public string Identifier => "doomahreal.impactparrycheat";
public string ButtonEnabledOverride => null;
public string ButtonDisabledOverride => null;
public string Icon => null;
public bool DefaultState => false;
public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;
public bool IsActive { get; private set; }
public void Enable(CheatsManager manager)
{
if (!IsActive)
{
IsActive = true;
ImpactManager instance = ImpactManager.Instance;
if ((Object)(object)instance != (Object)null)
{
instance.forceEffect = true;
}
instance?.EnableEffect();
}
}
public void Disable()
{
if (IsActive)
{
IsActive = false;
ImpactManager instance = ImpactManager.Instance;
if ((Object)(object)instance != (Object)null)
{
instance.forceEffect = false;
}
instance?.DisableEffect();
}
}
}
[HarmonyPatch]
public static class Patches
{
[CompilerGenerated]
private sealed class <HandleImpactWindow>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float length;
private ImpactManager <mgr>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HandleImpactWindow>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<mgr>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<mgr>5__1 = ImpactManager.Instance;
<mgr>5__1.EnableEffect();
<>2__current = (object)new WaitForSecondsRealtime(length);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<mgr>5__1.DisableEffect();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TimeController), "TimeIsStopped")]
private static void ImpactPatch(float length)
{
if (((ConfigValueElement<bool>)(object)Settings.enabled).Value)
{
ImpactManager instance = ImpactManager.Instance;
if (!((Object)(object)instance == (Object)null) && length >= 0.15f)
{
((MonoBehaviour)instance).StartCoroutine(HandleImpactWindow(length));
}
}
}
[IteratorStateMachine(typeof(<HandleImpactWindow>d__1))]
private static IEnumerator HandleImpactWindow(float length)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HandleImpactWindow>d__1(0)
{
length = length
};
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CheatsManager), "Start")]
private static void CreateCheat(CheatsManager __instance)
{
__instance.RegisterExternalCheat((ICheat)(object)new ImpactCheat());
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TimeController), "ParryFlash")]
private static bool Prefix(TimeController __instance)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
if (!((ConfigValueElement<bool>)(object)Settings.enabled).Value)
{
return true;
}
__instance.parryFlashEnabled = false;
Light val = default(Light);
if (Object.op_Implicit((Object)(object)__instance.parryLight) && Object.Instantiate<GameObject>(__instance.parryLight, MonoSingleton<PlayerTracker>.Instance.GetTarget().position, Quaternion.identity, MonoSingleton<PlayerTracker>.Instance.GetTarget()).TryGetComponent<Light>(ref val))
{
((Behaviour)val).enabled = false;
}
__instance.TrueStop(0.25f);
MonoSingleton<CameraController>.Instance.CameraShake(0.5f);
MonoSingleton<RumbleManager>.Instance.SetVibration(RumbleProperties.ParryFlash);
return false;
}
}
[BepInPlugin("doomahreal.ultrakill.impactparry", "ImpactParry", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private ConfigBuilder config;
private Harmony harmony;
[Configgable("Shader", "Reset Values To Defaults", 10, null)]
public static ConfigButton ResetMySettingsButton = new ConfigButton((Action)ResetSettings, (string)null);
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"hreoo worrl");
config = new ConfigBuilder("doomahreal.ultrakill.impactparry", "ImpactParry");
config.BuildAll();
harmony = new Harmony("doomahreal.ultrakill.impactparry");
harmony.PatchAll();
SceneManager.sceneLoaded += OnSceneLoaded;
TryCreateManager();
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if ((Object)(object)ImpactManager.Instance != (Object)null)
{
ImpactManager.Instance.forceEffect = false;
}
string currentScene = SceneHelper.CurrentScene;
if (!string.IsNullOrEmpty(currentScene) && currentScene != "Bootstrap" && currentScene != "Main Menu" && currentScene != "Intro")
{
if ((Object)(object)ImpactManager.Instance == (Object)null)
{
TryCreateManager();
}
else
{
((MonoBehaviour)ImpactManager.Instance).StartCoroutine(ImpactManager.Instance.DelayedCameraDiscovery());
}
}
}
private static void TryCreateManager()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
if (!((Object)(object)ImpactManager.Instance != (Object)null) || !((Object)(object)ImpactManager.Instance != (Object)null) || !((Object)(object)((Component)ImpactManager.Instance).gameObject != (Object)null))
{
if ((Object)(object)ImpactManager.Instance != (Object)null && (Object)(object)((Component)ImpactManager.Instance).gameObject == (Object)null)
{
ImpactManager.Instance = null;
}
GameObject val = new GameObject("ImpactManager");
val.AddComponent<ImpactManager>();
Object.DontDestroyOnLoad((Object)(object)val);
}
}
private static void ResetSettings()
{
Type typeFromHandle = typeof(Settings);
BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
IEnumerable<ConfigValueElement> enumerable = (from o in (from f in typeFromHandle.GetFields(bindingAttr)
select f.GetValue(null)).Concat<object>(typeFromHandle.GetProperties(bindingAttr).Select(delegate(PropertyInfo p)
{
try
{
return p.GetValue(null);
}
catch
{
return null;
}
}))
where o is ConfigValueElement
select o).Cast<ConfigValueElement>();
foreach (ConfigValueElement item in enumerable)
{
AccessTools.Method(((object)item).GetType(), "ResetValue", Array.Empty<Type>(), (Type[])null)?.Invoke(item, null);
}
}
}
public class ImpactManager : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DelayedCameraDiscovery>d__20 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ImpactManager <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedCameraDiscovery>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.DiscoverCamera();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public bool forceEffect = false;
public Shader blackShader;
public Shader whiteShader;
public AssetBundle loadedBundle;
public Camera hudCamera;
public Camera mainCamera;
public int activeCount = 0;
public CameraClearFlags mainPrevClear;
public Color mainPrevBg;
public int mainPrevMask;
public static ImpactManager Instance { get; internal set; }
private void Awake()
{
Instance = this;
LoadEmbeddedBundleAndShaders();
DiscoverCamera();
SubscribeToConfigChanges();
}
private void SubscribeToConfigChanges()
{
FloatSlider posterizeLevels = Settings.PosterizeLevels;
((ConfigValueElement<float>)(object)posterizeLevels).OnValueChanged = (Action<float>)Delegate.Combine(((ConfigValueElement<float>)(object)posterizeLevels).OnValueChanged, (Action<float>)delegate
{
UpdateShaderValues();
});
FloatSlider posterizeStrength = Settings.PosterizeStrength;
((ConfigValueElement<float>)(object)posterizeStrength).OnValueChanged = (Action<float>)Delegate.Combine(((ConfigValueElement<float>)(object)posterizeStrength).OnValueChanged, (Action<float>)delegate
{
UpdateShaderValues();
});
FloatSlider shadingBlend = Settings.ShadingBlend;
((ConfigValueElement<float>)(object)shadingBlend).OnValueChanged = (Action<float>)Delegate.Combine(((ConfigValueElement<float>)(object)shadingBlend).OnValueChanged, (Action<float>)delegate
{
UpdateShaderValues();
});
FloatSlider contrast = Settings.Contrast;
((ConfigValueElement<float>)(object)contrast).OnValueChanged = (Action<float>)Delegate.Combine(((ConfigValueElement<float>)(object)contrast).OnValueChanged, (Action<float>)delegate
{
UpdateShaderValues();
});
FloatSlider brightness = Settings.Brightness;
((ConfigValueElement<float>)(object)brightness).OnValueChanged = (Action<float>)Delegate.Combine(((ConfigValueElement<float>)(object)brightness).OnValueChanged, (Action<float>)delegate
{
UpdateShaderValues();
});
RGBSliderConfig whiteTint = Settings.WhiteTint;
((ConfigValueElement<int[]>)whiteTint).OnValueChanged = (Action<int[]>)Delegate.Combine(((ConfigValueElement<int[]>)whiteTint).OnValueChanged, (Action<int[]>)delegate
{
if (!((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
RGBSliderConfig blackTint = Settings.BlackTint;
((ConfigValueElement<int[]>)blackTint).OnValueChanged = (Action<int[]>)Delegate.Combine(((ConfigValueElement<int[]>)blackTint).OnValueChanged, (Action<int[]>)delegate
{
if (!((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
RGBSliderConfig bColor = Settings.BColor;
((ConfigValueElement<int[]>)bColor).OnValueChanged = (Action<int[]>)Delegate.Combine(((ConfigValueElement<int[]>)bColor).OnValueChanged, (Action<int[]>)delegate
{
if (!((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigToggle useIndividualInputs = Settings.UseIndividualInputs;
((ConfigValueElement<bool>)(object)useIndividualInputs).OnValueChanged = (Action<bool>)Delegate.Combine(((ConfigValueElement<bool>)(object)useIndividualInputs).OnValueChanged, (Action<bool>)delegate
{
UpdateShaderValues();
});
ConfigInputField<int> whiteR = Settings.WhiteR;
((ConfigValueElement<int>)(object)whiteR).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)whiteR).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> whiteG = Settings.WhiteG;
((ConfigValueElement<int>)(object)whiteG).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)whiteG).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> whiteB = Settings.WhiteB;
((ConfigValueElement<int>)(object)whiteB).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)whiteB).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> blackR = Settings.BlackR;
((ConfigValueElement<int>)(object)blackR).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)blackR).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> blackG = Settings.BlackG;
((ConfigValueElement<int>)(object)blackG).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)blackG).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> blackB = Settings.BlackB;
((ConfigValueElement<int>)(object)blackB).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)blackB).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> bGR = Settings.BGR;
((ConfigValueElement<int>)(object)bGR).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)bGR).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> bGG = Settings.BGG;
((ConfigValueElement<int>)(object)bGG).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)bGG).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
ConfigInputField<int> bGB = Settings.BGB;
((ConfigValueElement<int>)(object)bGB).OnValueChanged = (Action<int>)Delegate.Combine(((ConfigValueElement<int>)(object)bGB).OnValueChanged, (Action<int>)delegate
{
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
UpdateShaderValues();
}
});
}
private void LoadEmbeddedBundleAndShaders()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string n) => n.EndsWith("ImpactParry.doomahfunnyshaders.bundle"));
if (text == null)
{
return;
}
using Stream stream = executingAssembly.GetManifestResourceStream(text);
if (stream != null)
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
loadedBundle = AssetBundle.LoadFromMemory(array);
if ((Object)(object)loadedBundle != (Object)null)
{
blackShader = loadedBundle.LoadAsset<Shader>("assets/custom/hiddenblackoutreplacement.shader");
whiteShader = loadedBundle.LoadAsset<Shader>("assets/custom/whiteshaded.shader");
}
}
}
private void DiscoverCamera()
{
GameObject val = GameObject.Find("Player/Main Camera/HUD Camera");
if ((Object)(object)val != (Object)null)
{
hudCamera = val.GetComponent<Camera>();
}
GameObject val2 = GameObject.Find("Player/Main Camera");
if ((Object)(object)val2 != (Object)null)
{
mainCamera = val2.GetComponent<Camera>();
}
}
public void EnableEffect()
{
if (activeCount <= 0)
{
activeCount = 1;
ApplyShaders();
SetUIVisible(visible: false);
}
}
public void DisableEffect()
{
if (activeCount > 0 && !forceEffect)
{
activeCount = 0;
ResetReplacementShaderFromHUD();
SetUIVisible(visible: true);
}
}
[IteratorStateMachine(typeof(<DelayedCameraDiscovery>d__20))]
public IEnumerator DelayedCameraDiscovery()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedCameraDiscovery>d__20(0)
{
<>4__this = this
};
}
private void SetUIVisible(bool visible)
{
CheatsManager instance = MonoSingleton<CheatsManager>.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
HideUI cheatInstance = instance.GetCheatInstance<HideUI>();
if (cheatInstance != null)
{
if (visible)
{
cheatInstance.Disable();
}
else
{
cheatInstance.Enable(instance);
}
}
}
private void ApplyShaders()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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)
if ((Object)(object)whiteShader != (Object)null)
{
Camera obj = hudCamera;
if (obj != null)
{
obj.SetReplacementShader(whiteShader, "RenderType");
}
}
else if ((Object)(object)blackShader != (Object)null)
{
Camera obj2 = hudCamera;
if (obj2 != null)
{
obj2.SetReplacementShader(blackShader, "RenderType");
}
}
if ((Object)(object)mainCamera != (Object)null)
{
mainPrevClear = mainCamera.clearFlags;
mainPrevBg = mainCamera.backgroundColor;
mainPrevMask = mainCamera.cullingMask;
if ((Object)(object)whiteShader != (Object)null)
{
mainCamera.SetReplacementShader(whiteShader, "RenderType");
}
else if ((Object)(object)blackShader != (Object)null)
{
mainCamera.SetReplacementShader(blackShader, "RenderType");
}
mainCamera.clearFlags = (CameraClearFlags)2;
mainCamera.backgroundColor = Color.black;
Camera obj3 = mainCamera;
obj3.cullingMask ^= LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)) | LayerMask.GetMask(new string[1] { "Outdoors Non-solid" });
}
UpdateShaderValues();
FixOutdoorEnemies.ApplyDefaultLayers();
}
private void UpdateShaderValues()
{
//IL_021f: 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)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)blackShader == (Object)null) || !((Object)(object)whiteShader == (Object)null))
{
Shader.SetGlobalFloat("_PosterizeLevels", ((ConfigValueElement<float>)(object)Settings.PosterizeLevels).Value);
Shader.SetGlobalFloat("_PosterizeStrength", ((ConfigValueElement<float>)(object)Settings.PosterizeStrength).Value);
Shader.SetGlobalFloat("_ShadingBlend", ((ConfigValueElement<float>)(object)Settings.ShadingBlend).Value);
Shader.SetGlobalFloat("_Contrast", ((ConfigValueElement<float>)(object)Settings.Contrast).Value);
Shader.SetGlobalFloat("_Brightness", ((ConfigValueElement<float>)(object)Settings.Brightness).Value);
Color val = default(Color);
Color val2 = default(Color);
Color backgroundColor = default(Color);
if (((ConfigValueElement<bool>)(object)Settings.UseIndividualInputs).Value)
{
((Color)(ref val))..ctor((float)((ConfigValueElement<int>)(object)Settings.WhiteR).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.WhiteG).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.WhiteB).Value / 255f);
((Color)(ref val2))..ctor((float)((ConfigValueElement<int>)(object)Settings.BlackR).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.BlackG).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.BlackB).Value / 255f);
((Color)(ref backgroundColor))..ctor((float)((ConfigValueElement<int>)(object)Settings.BGR).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.BGG).Value / 255f, (float)((ConfigValueElement<int>)(object)Settings.BGB).Value / 255f);
}
else
{
((Color)(ref val))..ctor((float)((ConfigValueElement<int[]>)Settings.WhiteTint).Value[0] / 255f, (float)((ConfigValueElement<int[]>)Settings.WhiteTint).Value[1] / 255f, (float)((ConfigValueElement<int[]>)Settings.WhiteTint).Value[2] / 255f);
((Color)(ref val2))..ctor((float)((ConfigValueElement<int[]>)Settings.BlackTint).Value[0] / 255f, (float)((ConfigValueElement<int[]>)Settings.BlackTint).Value[1] / 255f, (float)((ConfigValueElement<int[]>)Settings.BlackTint).Value[2] / 255f);
((Color)(ref backgroundColor))..ctor((float)((ConfigValueElement<int[]>)Settings.BColor).Value[0] / 255f, (float)((ConfigValueElement<int[]>)Settings.BColor).Value[1] / 255f, (float)((ConfigValueElement<int[]>)Settings.BColor).Value[2] / 255f);
}
Shader.SetGlobalColor("_WhiteTint", val);
Shader.SetGlobalColor("_BlackTint", val2);
if ((Object)(object)mainCamera != (Object)null)
{
mainCamera.backgroundColor = backgroundColor;
}
}
}
private void ResetReplacementShaderFromHUD()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
FixOutdoorEnemies.ApplyPreviousLayers();
Camera obj = hudCamera;
if (obj != null)
{
obj.ResetReplacementShader();
}
if ((Object)(object)mainCamera != (Object)null)
{
mainCamera.ResetReplacementShader();
mainCamera.clearFlags = mainPrevClear;
mainCamera.backgroundColor = mainPrevBg;
mainCamera.cullingMask = mainPrevMask;
}
}
private void OnDestroy()
{
if ((Object)(object)Instance == (Object)(object)this)
{
Instance = null;
}
AssetBundle obj = loadedBundle;
if (obj != null)
{
obj.Unload(false);
}
}
}
public class Settings
{
[Configgable("", null, 0, null)]
public static ConfigToggle enabled = new ConfigToggle(true);
[Configgable("Shader", "Posterize Levels", 0, null)]
public static FloatSlider PosterizeLevels = new FloatSlider(5.6f, 2f, 16f, 0.1f);
[Configgable("Shader", "Posterize Strength", 0, null)]
public static FloatSlider PosterizeStrength = new FloatSlider(1f, 0f, 1f, 0.1f);
[Configgable("Shader", "Shading Blend", 0, null)]
public static FloatSlider ShadingBlend = new FloatSlider(0f, 0f, 1f, 0.1f);
[Configgable("Shader", "Contrast", 0, null)]
public static FloatSlider Contrast = new FloatSlider(1.3f, 0.1f, 3f, 0.1f);
[Configgable("Shader", "Brightness", 0, null)]
public static FloatSlider Brightness = new FloatSlider(2.25f, 0.1f, 10f, 0.1f);
[Configgable("Shader", "White Tint", 0, null)]
public static RGBSliderConfig WhiteTint = new RGBSliderConfig(new int[3] { 255, 255, 255 });
[Configgable("Shader", "Black Tint", 0, null)]
public static RGBSliderConfig BlackTint = new RGBSliderConfig(new int[3]);
[Configgable("Shader", "Background color", 0, null)]
public static RGBSliderConfig BColor = new RGBSliderConfig(new int[3]);
[Configgable("Shader", "Use numbers instead of sliders (go to the Individual tab ontop)", 0, null)]
public static ConfigToggle UseIndividualInputs = new ConfigToggle(false);
[Configgable("Shader/Individual/White", "White R", 0, null)]
public static ConfigInputField<int> WhiteR = new ConfigInputField<int>(255, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/White", "White G", 0, null)]
public static ConfigInputField<int> WhiteG = new ConfigInputField<int>(255, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/White", "White B", 0, null)]
public static ConfigInputField<int> WhiteB = new ConfigInputField<int>(255, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Black", "Black R", 0, null)]
public static ConfigInputField<int> BlackR = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Black", "Black G", 0, null)]
public static ConfigInputField<int> BlackG = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Black", "Black B", 0, null)]
public static ConfigInputField<int> BlackB = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Background", "BG R", 0, null)]
public static ConfigInputField<int> BGR = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Background", "BG G", 0, null)]
public static ConfigInputField<int> BGG = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
[Configgable("Shader/Individual/Background", "BG B", 0, null)]
public static ConfigInputField<int> BGB = new ConfigInputField<int>(0, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ImpactParry";
public const string PLUGIN_NAME = "ImpactParry";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}