using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 FishNet.Object;
using FishUtilities.Attributes;
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("MartialLaw")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a3a806895192ea7eea981a5651113aa31fd5f5d1")]
[assembly: AssemblyProduct("MartialLaw")]
[assembly: AssemblyTitle("MartialLaw")]
[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.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MartialLawSpell
{
internal class MartialLawSpellData : SpellData
{
public override SpellType SpellType => (SpellType)0;
public override string Name => "Martial Law";
public override float Cooldown => 120f;
public override Color GlowColor => Color.red;
public override string[] SubNames => new string[3] { "Martial Law", "Bee Two Bomber", "Save me Donald Trump" };
}
internal class MartialLawSpellLogic : SpellLogic
{
[CompilerGenerated]
private sealed class <CoHellfire>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GameObject caster;
public Vector3 viewDirectionVector;
private float <endTime>5__2;
private Vector3 <centerPoint>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CoHellfire>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0037: 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)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<endTime>5__2 = Time.time + duration;
<centerPoint>5__3 = caster.transform.position + ((Vector3)(ref viewDirectionVector)).normalized * (rangeDistance / 2f);
<centerPoint>5__3.y = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (Time.time < <endTime>5__2)
{
float num = Random.Range(0f, 360f);
float num2 = Random.Range(0f, rangeWidth / 2f);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(Mathf.Cos(num * (MathF.PI / 180f)) * num2, 0f, Mathf.Sin(num * (MathF.PI / 180f)) * num2);
Vector3 val2 = <centerPoint>5__3 + val;
Vector3 val3 = val2 + new Vector3(0f, 125f, 0f);
Vector3 val4 = val2 - val3;
Vector3 normalized = ((Vector3)(ref val4)).normalized;
RpcSpawnFireball(caster, val3, normalized);
<>2__current = (object)new WaitForSeconds(Random.Range(0.4f, 0.55f));
<>1__state = 1;
return true;
}
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();
}
}
[CompilerGenerated]
private sealed class <CoWaitDisposeSpell>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MartialLawSpellLogic <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CoWaitDisposeSpell>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
int num = <>1__state;
MartialLawSpellLogic martialLawSpellLogic = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(duration + 5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((SpellLogic)martialLawSpellLogic).DisposeSpell();
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 AudioClip? clip;
private static readonly float duration = 20f;
private static readonly float rangeWidth = 50f;
private static readonly float rangeDistance = 35f;
private static FireballController? firePrefab;
public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
PlayClip();
if (((NetworkBehaviour)caster).IsOwner)
{
CmdHellfireRoutine(((Component)caster).gameObject, viewDirectionVector);
((MonoBehaviour)this).StartCoroutine(CoWaitDisposeSpell());
}
return true;
}
private void PlayClip()
{
AudioSource obj = ((Component)this).gameObject.AddComponent<AudioSource>();
clip = Utils.LoadWavFromResources(Assembly.GetExecutingAssembly(), "MartialLawSpell.Resources.Sounds.MartialLaw.wav");
obj.clip = clip;
obj.spatialBlend = 0.4f;
obj.volume = 0.8f;
obj.playOnAwake = false;
obj.loop = false;
obj.minDistance = 0.01f;
obj.maxDistance = 1000f;
obj.rolloffMode = (AudioRolloffMode)1;
obj.pitch = 1f;
obj.Play();
}
[IteratorStateMachine(typeof(<CoWaitDisposeSpell>d__7))]
private IEnumerator CoWaitDisposeSpell()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CoWaitDisposeSpell>d__7(0)
{
<>4__this = this
};
}
[FishCmd]
private static void CmdHellfireRoutine(GameObject caster, Vector3 viewDirectionVector)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)caster.GetComponent<PlayerMovement>()).StartCoroutine(CoHellfire(caster, viewDirectionVector * 50f));
}
[IteratorStateMachine(typeof(<CoHellfire>d__9))]
private static IEnumerator CoHellfire(GameObject caster, Vector3 viewDirectionVector)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CoHellfire>d__9(0)
{
caster = caster,
viewDirectionVector = viewDirectionVector
};
}
[FishRpc]
private static void RpcSpawnFireball(GameObject caster, Vector3 spawnPos, Vector3 direction)
{
//IL_001a: 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_0033: Unknown result type (might be due to invalid IL or missing references)
FireballController val = Object.Instantiate<FireballController>(firePrefab);
if ((Object)(object)val != (Object)null)
{
((Component)val).transform.position = spawnPos;
val.playerOwner = caster;
val.rb.AddForce(direction * 75f, (ForceMode)2);
((MonoBehaviour)val).StartCoroutine("Shoott");
}
}
public override void OnPrefabCreatedAutomatically(GameObject prefab)
{
firePrefab = Resources.FindObjectsOfTypeAll<FireballController>()[1];
}
}
[BepInPlugin("com.boxlegs.MartialLawSpell", "Martial Law Spell", "1.0.0")]
[BepInProcess("MageArena")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MartialLawSpell : BaseUnityPlugin
{
private const string VersionString = "1.0.2";
private static Harmony? Harmony;
public static string modsync = "all";
internal static MartialLawSpell Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Harmony = new Harmony("com.boxlegs.MartialLawSpell");
Harmony.PatchAll();
Logger.LogInfo((object)"Plugin Martial Law Spell (com.boxlegs.MartialLawSpell) is loading...");
BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(MartialLawSpellData), typeof(MartialLawSpellLogic));
Logger.LogInfo((object)"Plugin Martial Law Spell (com.boxlegs.MartialLawSpell) loaded successfully.");
}
}
internal class PluginInfo
{
public const string PLUGIN_GUID = "com.boxlegs.MartialLawSpell";
public const string PLUGIN_NAME = "Martial Law Spell";
public const string PLUGIN_VERSION = "1.0.0";
}
}