using 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.Networking;
using R2API.Networking.Interfaces;
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.*/)]
[BepInPlugin("Miyowi.Orbliteration", "Orbliteration", "1.0.0")]
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.0.0";
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.TakeDamageProcess += new Manipulator(VoidHook);
NetworkingAPI.RegisterMessageType<Sink>();
}
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.TakeDamageProcess -= new Manipulator(VoidHook);
}
public Sprite LoadRandomWizard()
{
int num = rnd.Next(1, 8);
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);
}
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()
{
alpha = 0.4f;
FlashAlpha(alpha);
while (alpha >= 0f)
{
yield return (object)new WaitForSeconds(0.04f);
alpha -= 0.01f * (2f - alpha);
FlashAlpha(alpha);
}
}
private void VoidHook(ILContext il)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
Action<DamageInfo> action = delegate(DamageInfo damageInfo)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
if (component != null && component.isPlayerControlled)
{
try
{
NetMessageExtensions.Send((INetMessage)(object)new Sink(component.master.networkIdentity.netId), (NetworkDestination)1);
}
catch (Exception data)
{
Log.Error(data);
}
}
};
ILCursor val = new ILCursor(il);
ILLabel val4 = default(ILLabel);
ILLabel val3 = default(ILLabel);
ILLabel val2 = default(ILLabel);
val.GotoNext(new Func<Instruction, bool>[22]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_isBoss"),
(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_inventory"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val3),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_inventory"),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "CritGlassesVoid"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount"),
(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f),
(Instruction x) => ILPatternMatchingExt.MatchMul(x),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient"),
(Instruction x) => ILPatternMatchingExt.MatchMul(x),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_master"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Util), "CheckRoll"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
});
val.Index += 22;
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Action<DamageInfo>>(action);
}
}
public class Sink : INetMessage, ISerializableObject
{
private NetworkInstanceId playerId;
public Sink()
{
}
public Sink(NetworkInstanceId playerId)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
this.playerId = playerId;
}
public void Serialize(NetworkWriter writer)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
writer.Write(playerId);
}
public void Deserialize(NetworkReader reader)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
playerId = reader.ReadNetworkId();
}
public void OnReceived()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (playerId == LocalUserManager.GetFirstLocalUser().cachedMaster.networkIdentity.netId)
{
WizardObliterate.instance.WizardbangPlayer();
}
}
}
}