Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Orbliterate v1.1.7
WizardObliterate.dll
Decompiled 7 months agousing System; using System.Collections; 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 IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2.UI; using R2API.Utils; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; 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: AssemblyCompany("WizardObliterate")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WizardObliterate")] [assembly: AssemblyTitle("WizardObliterate")] [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] [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 WizardObliterate { public static class Assets { public static AssetBundle mainAssetBundle = null; internal static string assetBundleName = "wizardobliterate"; internal static string assemblyDir => Path.GetDirectoryName(WizardObliterate.pluginInfo.Location); public static void PopulateAssets() { mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(assemblyDir, assetBundleName)); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("Miyowi.Orbliteration", "Orbliteration", "1.1.7")] public class WizardObliterate : BaseUnityPlugin { public const string PluginGUID = "Miyowi.Orbliteration"; public const string PluginAuthor = "Miyowi"; public const string PluginName = "Orbliteration"; public const string PluginVersion = "1.1.7"; public static PluginInfo pluginInfo; private static Random rnd = new Random(); private GameObject Whitescreen; private GameObject Wizardscreen; private float alpha; private static Coroutine currentCoroutine; public static WizardObliterate instance; private HUD hud; public void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown instance = this; pluginInfo = ((BaseUnityPlugin)this).Info; Log.Init(((BaseUnityPlugin)this).Logger); Assets.PopulateAssets(); HUD.Awake += new hook_Awake(GetHud); HealthComponent.HandleDamageDealt += new Manipulator(BestVoidHook); } public void OnDestroy() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown HUD.Awake -= new hook_Awake(GetHud); HealthComponent.HandleDamageDealt -= new Manipulator(BestVoidHook); } public Sprite LoadRandomWizard() { int num = rnd.Next(1, 7); return Assets.mainAssetBundle.LoadAsset<Sprite>($"wizard{num}.png"); } private void GetHud(orig_Awake orig, HUD self) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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) orig.Invoke(self); hud = self; Wizardscreen = new GameObject("Wizardscreen"); Wizardscreen.transform.SetParent(hud.mainContainer.transform); RectTransform val = Wizardscreen.AddComponent<RectTransform>(); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.sizeDelta = Vector2.zero; val.anchoredPosition = Vector2.zero; Wizardscreen.AddComponent<Image>(); Whitescreen = new GameObject("Whitescreen"); Whitescreen.transform.SetParent(hud.mainContainer.transform); val = Whitescreen.AddComponent<RectTransform>(); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.sizeDelta = Vector2.zero; val.anchoredPosition = Vector2.zero; Image val2 = Whitescreen.AddComponent<Image>(); val2.sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 4f, 4f), Vector2.zero); FlashAlpha(0f); Wizardscreen.gameObject.SetActive(false); Whitescreen.gameObject.SetActive(false); } private void FlashAlpha(float x) { //IL_001c: 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) ((Graphic)Whitescreen.GetComponent<Image>()).color = new Color(1f, 1f, 1f, x); ((Graphic)Wizardscreen.GetComponent<Image>()).color = new Color(1f, 1f, 1f, x); } public void WizardbangPlayer() { if ((Object)(object)Whitescreen != (Object)null && (Object)(object)Wizardscreen != (Object)null) { Wizardscreen.GetComponent<Image>().sprite = LoadRandomWizard(); if (currentCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(currentCoroutine); } currentCoroutine = ((MonoBehaviour)this).StartCoroutine(Fade()); } } private IEnumerator Fade() { Wizardscreen.gameObject.SetActive(true); Whitescreen.gameObject.SetActive(true); alpha = 0.4f; FlashAlpha(alpha); while (alpha >= 0f) { yield return (object)new WaitForSeconds(0.04f); alpha -= 0.01f * (2f - alpha); FlashAlpha(alpha); } Wizardscreen.gameObject.SetActive(false); Whitescreen.gameObject.SetActive(false); } private void BestVoidHook(ILContext il) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) Action<DamageDealtMessage> action = delegate(DamageDealtMessage damageDealtMessage) { //IL_007c: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) if (damageDealtMessage != null && Object.op_Implicit((Object)(object)damageDealtMessage.attacker)) { object obj; if (damageDealtMessage == null) { obj = null; } else { GameObject attacker = damageDealtMessage.attacker; obj = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null); } CharacterBody val2 = (CharacterBody)obj; if ((Object)(object)val2 != (Object)null) { NetworkInstanceId? obj2; if (val2 == null) { obj2 = null; } else { CharacterMaster master = val2.master; if (master == null) { obj2 = null; } else { NetworkIdentity networkIdentity = master.networkIdentity; obj2 = ((networkIdentity != null) ? new NetworkInstanceId?(networkIdentity.netId) : null); } } NetworkInstanceId? val3 = obj2; int num; if (val3.HasValue) { NetworkInstanceId? val4 = val3; LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); NetworkInstanceId? obj3; if (firstLocalUser == null) { obj3 = null; } else { CharacterMaster cachedMaster = firstLocalUser.cachedMaster; if (cachedMaster == null) { obj3 = null; } else { NetworkIdentity networkIdentity2 = cachedMaster.networkIdentity; obj3 = ((networkIdentity2 != null) ? new NetworkInstanceId?(networkIdentity2.netId) : null); } } NetworkInstanceId? val5 = obj3; num = ((val4.HasValue == val5.HasValue && (!val4.HasValue || val4.GetValueOrDefault() == val5.GetValueOrDefault())) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; if (val2 != null && val2.isPlayerControlled && flag && DamageTypeCombo.op_Implicit(damageDealtMessage.damageType) == DamageTypeCombo.op_Implicit(DamageTypeCombo.op_Implicit((DamageType)65536))) { WizardbangPlayer(); } } } }; ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkMessage>(x, "ReadMessage") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0) })) { val.Emit(OpCodes.Ldloc_0); val.EmitDelegate<Action<DamageDealtMessage>>(action); } else { Log.Error("ILHook failed. Mod will not work as intended."); } } } }