using System;
using System.Collections;
using System.Collections.Generic;
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 BlackMagicAPI.Enums;
using BlackMagicAPI.Helpers;
using BlackMagicAPI.Managers;
using BlackMagicAPI.Modules.Spells;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.YourAccount.ModName")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.github.YourAccount.ModName")]
[assembly: AssemblyTitle("ModName")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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;
}
}
}
[HarmonyPatch(typeof(PlayerMovement))]
public class EvilPatch
{
internal static ManualLogSource Logger;
internal static string bundleName = "bundle";
internal static string assetName = "amogus";
internal static AssetBundle localBundle;
internal static GameObject amogus;
internal static Shader shader;
internal static Material mat0;
internal static Material mat1;
internal static AudioClip? audioClip;
internal static GameObject explosion;
public static void Initialize(ManualLogSource logger)
{
Logger = logger;
logger.LogInfo((object)"Imposter patch loaded");
localBundle = AssetBundle.LoadFromFile(Path.Join((ReadOnlySpan<char>)Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), (ReadOnlySpan<char>)bundleName));
amogus = localBundle.LoadAsset<GameObject>(assetName);
mat0 = localBundle.LoadAsset<Material>("Mat");
mat1 = localBundle.LoadAsset<Material>("Mat.1");
explosion = localBundle.LoadAsset<GameObject>("boom");
audioClip = localBundle.LoadAsset<AudioClip>("music");
shader = Shader.Find("HDRP/Lit");
Renderer component = (Renderer)(object)((Component)amogus.transform.GetChild(0)).GetComponent<MeshRenderer>();
component.materials[0] = mat1;
component.materials[1] = mat0;
Material[] materials = component.materials;
foreach (Material val in materials)
{
val.shader = shader;
}
}
}
internal class ImposterSpellData : SpellData
{
public override SpellType SpellType => (SpellType)0;
public override string Name => "Amogus";
public override float Cooldown => 5f;
public override Color GlowColor => Color.white;
public override string[] SubNames => new string[6] { "imposter", "amogus", "among us", "gus", "bogus", "a mo" };
public override Texture2D GetMainTexture()
{
string text = Path.Join((ReadOnlySpan<char>)Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), (ReadOnlySpan<char>)"imposter_main.png");
return Utils.LoadTextureFromDisk(text);
}
public override Texture2D GetEmissionTexture()
{
string text = Path.Join((ReadOnlySpan<char>)Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), (ReadOnlySpan<char>)"imposter_emission.png");
return Utils.LoadTextureFromDisk(text);
}
}
internal class ImposterSpellLogic : SpellLogic
{
[CompilerGenerated]
private sealed class <waitForBoom>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ImposterSpellLogic <>4__this;
private GameObject <explosion>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <waitForBoom>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<explosion>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Expected O, but got Unknown
//IL_00c3: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
int num = <>1__state;
ImposterSpellLogic imposterSpellLogic = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
<explosion>5__2 = Object.Instantiate<GameObject>(EvilPatch.explosion);
Transform child = imposterSpellLogic.sussyAmogus.transform.GetChild(0);
<explosion>5__2.transform.position = child.position;
<explosion>5__2.transform.rotation = child.rotation;
Object.Destroy((Object)(object)imposterSpellLogic.sussyAmogus);
PlayerMovement[] array = Object.FindObjectsByType<PlayerMovement>((FindObjectsSortMode)0);
PlayerMovement[] array2 = array;
foreach (PlayerMovement val in array2)
{
if (Vector3.Distance(((Component)val).transform.position, <explosion>5__2.transform.position) < minExplosionDist)
{
val.NonRpcDamagePlayer(50f + (float)(10 * powerLevel), (GameObject)null, "amogus");
}
}
<>2__current = (object)new WaitForSeconds(1.25f);
<>1__state = 2;
return true;
}
case 2:
<>1__state = -1;
((Renderer)<explosion>5__2.GetComponent<SpriteRenderer>()).enabled = false;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
Object.Destroy((Object)(object)<explosion>5__2);
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();
}
}
private GameObject sussyAmogus;
internal static float minExplosionDist = 14f;
internal static int powerLevel;
public override void CastSpell(GameObject playerObj, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_007f: Unknown result type (might be due to invalid IL or missing references)
powerLevel = castingLevel;
sussyAmogus = Object.Instantiate<GameObject>(EvilPatch.amogus);
sussyAmogus.transform.position = playerObj.transform.position + viewDirectionVector * 10f;
sussyAmogus.transform.rotation = Quaternion.LookRotation(viewDirectionVector);
Rigidbody component = sussyAmogus.GetComponent<Rigidbody>();
component.isKinematic = false;
component.velocity = (20f + 2f * (float)castingLevel) * viewDirectionVector;
component.mass = 25f;
component.useGravity = true;
((MonoBehaviour)this).StartCoroutine(waitForBoom());
}
[IteratorStateMachine(typeof(<waitForBoom>d__4))]
private IEnumerator waitForBoom()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <waitForBoom>d__4(0)
{
<>4__this = this
};
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Imposter
{
[BepInPlugin("climbingwolf.amogusspell", "AmogusSpell", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ImposterSpell : BaseUnityPlugin
{
public static string modsync = "all";
private readonly Harmony harmony = new Harmony("imposter");
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Amogus assetbundle loaded");
Logger.LogInfo((object)"Initializing Amogus Spell");
EvilPatch.Initialize(Logger);
harmony.PatchAll(typeof(EvilPatch));
BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(ImposterSpellData), typeof(ImposterSpellLogic));
BlackMagicManager.RegisterDeathIcon((BaseUnityPlugin)(object)this, "amogus", "amogusDeath.png");
Logger.LogInfo((object)"Plugin Amogus Spell is loaded!");
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}