using System;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bitmotte.HALT")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("HALT")]
[assembly: AssemblyTitle("bitmotte.HALT")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 HALT
{
public static class BundleTool
{
public static AssetBundle Load(string fileName)
{
return AssetBundle.LoadFromMemory(EmbeddedAccess.AccessFile(fileName));
}
}
public static class Configurator
{
[CompilerGenerated]
private static class <>O
{
public static OnClick <0>__OpenDiscord;
}
public static FloatField chance;
public static BoolField music;
public static ButtonField joinDC;
public static PluginConfigurator CreateConfigurator()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
PluginConfigurator val = PluginConfigurator.Create("HALT", "bitmotte.HALT");
chance = new FloatField(val.rootPanel, "Chance ( % )", "chance", 0.1f);
music = new BoolField(val.rootPanel, "Change Music", "music", true);
ConfigSpace val2 = new ConfigSpace(val.rootPanel, 15f);
ConfigHeader val3 = new ConfigHeader(val.rootPanel, "Join my discord for sneak peeks,devlogs,and the possibility to test my mods early ! !", 20, (TextAlignmentOptions)513);
joinDC = new ButtonField(val.rootPanel, "Join my Discord", "joinDC");
ConfigSpace val4 = new ConfigSpace(val.rootPanel, 15f);
ButtonField obj = joinDC;
object obj2 = <>O.<0>__OpenDiscord;
if (obj2 == null)
{
OnClick val5 = OpenDiscord;
<>O.<0>__OpenDiscord = val5;
obj2 = (object)val5;
}
obj.onClick += (OnClick)obj2;
return val;
}
private static void OpenDiscord()
{
Process.Start("https://discord.gg/PjSpcEvuB7");
}
}
public static class EmbeddedAccess
{
public static byte[] AccessFile(string fileName)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
byte[] array;
using (Stream stream = executingAssembly.GetManifestResourceStream("HALT.resources." + fileName))
{
if (stream == null)
{
return null;
}
array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
}
return array;
}
}
public class HALTPowerManager : MonoSingleton<HALTPowerManager>
{
private MusicManager mm;
private AudioSource musicSource;
private int powerCount;
private int prevPowerCount;
private bool sharted;
public int PowerCount
{
get
{
return powerCount;
}
set
{
prevPowerCount = powerCount;
powerCount = value;
Check();
}
}
public void Start()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_0062: Unknown result type (might be due to invalid IL or missing references)
if (!sharted)
{
sharted = true;
mm = MonoSingleton<MusicManager>.Instance;
musicSource = ((Component)this).gameObject.AddComponent<AudioSource>();
musicSource.clip = Addressables.LoadAssetAsync<AudioClip>((object)"Assets/Music/8-3.wav").WaitForCompletion();
musicSource.outputAudioMixerGroup = Addressables.LoadAssetAsync<AudioMixerGroup>((object)"MusicAudio").WaitForCompletion();
AudioSourceExtensions.SetSpatialBlend(musicSource, 0f);
musicSource.loop = true;
musicSource.Stop();
}
}
private void Check()
{
Start();
if (!((Object)(object)mm == (Object)null))
{
if (powerCount == 1 && prevPowerCount == 0 && Configurator.music.value)
{
musicSource.Play();
mm.volume = 0f;
}
if (powerCount == 0)
{
musicSource.Stop();
mm.volume = mm.defaultVolume;
}
}
}
public void Decrement()
{
PowerCount--;
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
public static class patcg
{
private static void Prefix(EnemyIdentifier __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Invalid comparison between Unknown and I4
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Expected O, but got Unknown
if ((int)__instance.enemyType == 40 || (int)__instance.enemyType == 21 || (int)__instance.enemyType == 39)
{
return;
}
float num = Random.Range(0f, 100f);
if (num < Configurator.chance.value)
{
GameObject val = Object.Instantiate<GameObject>(AssetHelper.LoadPrefab("Assets/Prefabs/Enemies/PowerWithSpawnEffect.prefab"));
val.transform.parent = ((Component)__instance).transform.parent;
if ((int)__instance.enemyType == 4)
{
val.transform.parent = ((Component)__instance).transform.parent.parent;
}
val.transform.position = ((Component)__instance).transform.position;
val.transform.rotation = ((Component)__instance).transform.rotation;
PowerIntro component = val.GetComponent<PowerIntro>();
component.introOverride = Addressables.LoadAssetAsync<AudioClip>((object)"Assets/Sounds/Voices/Power/pow_SpecialIntro1.ogg").WaitForCompletion();
component.animationSpeedMultiplier = 1f;
SubtitledAudioSource val2 = val.AddComponent<SubtitledAudioSource>();
SubtitleDataLine val3 = new SubtitleDataLine();
val3.subtitle = "HALT!";
val3.time = 0f;
SubtitleDataLine val4 = new SubtitleDataLine();
val4.subtitle = "Where is Gabriel and what have you done to him?";
val4.time = 1f;
SubtitleData val5 = new SubtitleData();
val5.lines = (SubtitleDataLine[])(object)new SubtitleDataLine[2] { val3, val4 };
val2.subtitles = val5;
val2.audioSource = val.GetComponent<AudioSource>();
if ((Object)(object)MonoSingleton<HALTPowerManager>.Instance == (Object)null)
{
GameObject val6 = new GameObject("HALT Power Manager");
val6.AddComponent<HALTPowerManager>();
}
MonoSingleton<HALTPowerManager>.Instance.PowerCount++;
UnityEvent val7 = new UnityEvent();
val7.AddListener(new UnityAction(MonoSingleton<HALTPowerManager>.Instance.Decrement));
val.GetComponentInChildren<EnemyIdentifier>().onDeath = val7;
Object.Destroy((Object)(object)((Component)__instance).gameObject);
}
}
}
[BepInPlugin("bitmotte.HALT", "HALT", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static PluginConfigurator config;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin bitmotte.HALT is loaded!");
Harmony val = new Harmony("bitmotte.HALT");
val.PatchAll();
config = Configurator.CreateConfigurator();
SceneManager.sceneLoaded += OnSceneLoad;
}
private void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
}
}
public static class SetupResource
{
public static GameObject FixShader(GameObject gameObject)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
Shader shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Environment/Metal/Pattern 1/Metal Pattern 1 8.mat").WaitForCompletion().shader;
SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer val in componentsInChildren)
{
Material[] materials = ((Renderer)val).materials;
foreach (Material val2 in materials)
{
if (((Object)val2.shader).name == "ULTRAKILL/Master")
{
val2.shader = shader;
}
if (((Object)val2.shader).name == "Hidden/InternalErrorShader")
{
val2.shader = Addressables.LoadAssetAsync<Material>((object)"Assets/Materials/Dev/FadeToWhite.mat").WaitForCompletion().shader;
}
}
}
MeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val3 in componentsInChildren2)
{
Material[] materials2 = ((Renderer)val3).materials;
foreach (Material val4 in materials2)
{
val4.shader = shader;
}
}
return gameObject;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "bitmotte.HALT";
public const string PLUGIN_NAME = "HALT";
public const string PLUGIN_VERSION = "1.1.0";
}
}