using System;
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 Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using On.RoR2;
using On.Unity;
using R2API.AutoVersionGen;
using R2API.Utils;
using RoR2;
using RoR2.Orbs;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.Networking;
[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("R2API.DamageType")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion("1.1.4+fb0da72a906c0cd385f3e95d35ffaabdaa77e1a7")]
[assembly: AssemblyProduct("R2API.DamageType")]
[assembly: AssemblyTitle("R2API.DamageType")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.4.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;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace R2API
{
[AutoVersion]
public static class DamageAPI
{
public enum ModdedDamageType
{
}
[Obsolete("Use ProjectileDamage component damageType field directly to work with ModdedDamageTypes")]
public sealed class ModdedDamageTypeHolderComponent : MonoBehaviour
{
[HideInInspector]
[SerializeField]
internal byte[] values = Array.Empty<byte>();
[SerializeField]
private ProjectileDamage projectileDamage;
private void Awake()
{
SetHooks();
if (!Object.op_Implicit((Object)(object)projectileDamage))
{
projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
if (Object.op_Implicit((Object)(object)projectileDamage) && values.Length != 0)
{
DamageTypeComboInterop.SetModdedDamageTypes(ref projectileDamage.damageType, new ReadOnlySpan<byte>(values).ToArray());
}
}
}
[Obsolete("Add your ModdedDamageType directly to ProjectileDamage component damageType field")]
public void Add(ModdedDamageType moddedDamageType)
{
SetHooks();
if (!Object.op_Implicit((Object)(object)projectileDamage))
{
projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
}
if (Object.op_Implicit((Object)(object)projectileDamage))
{
projectileDamage.damageType.AddModdedDamageType(moddedDamageType);
}
CompressedFlagArrayUtilities.AddImmutable(ref values, (int)moddedDamageType);
}
[Obsolete("Remove your ModdedDamageType directly from ProjectileDamage component damageType field")]
public bool Remove(ModdedDamageType moddedDamageType)
{
SetHooks();
if (!Object.op_Implicit((Object)(object)projectileDamage))
{
projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
}
if (Object.op_Implicit((Object)(object)projectileDamage))
{
return projectileDamage.damageType.RemoveModdedDamageType(moddedDamageType);
}
return CompressedFlagArrayUtilities.RemoveImmutable(ref values, (int)moddedDamageType);
}
[Obsolete("Check your ModdedDamageType directly on ProjectileDamage component damageType field")]
public bool Has(ModdedDamageType moddedDamageType)
{
SetHooks();
if (!Object.op_Implicit((Object)(object)projectileDamage))
{
projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
}
if (Object.op_Implicit((Object)(object)projectileDamage))
{
return projectileDamage.damageType.HasModdedDamageType(moddedDamageType);
}
return CompressedFlagArrayUtilities.Has(values, (int)moddedDamageType);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(DamageInfo damageInfo)
{
CopyToInternal(ref damageInfo.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(BulletAttack bulletAttack)
{
CopyToInternal(ref bulletAttack.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(DamageOrb damageOrb)
{
CopyToInternal(ref damageOrb.orbDamageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(GenericDamageOrb genericDamageOrb)
{
CopyToInternal(ref genericDamageOrb.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(LightningOrb lightningOrb)
{
CopyToInternal(ref lightningOrb.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(BlastAttack blastAttack)
{
CopyToInternal(ref blastAttack.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(OverlapAttack overlapAttack)
{
CopyToInternal(ref overlapAttack.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(DotStack dotStack)
{
CopyToInternal(ref dotStack.damageType, values);
}
[Obsolete("Apply ModdedDamageType directly to ProjectileDamage component when creating a prefab then copy damageType from that component")]
public void CopyTo(CrocoDamageTypeController croco)
{
SetHooks();
CrocoDamageTypeControllerInterop.SetModdedDamageTypes(croco, values);
}
private void CopyToInternal(ref DamageTypeCombo damageType, byte[] values)
{
SetHooks();
DamageTypeComboInterop.SetModdedDamageTypes(ref damageType, values);
}
}
[CompilerGenerated]
private static class <>O
{
public static hook_Write_NetworkWriter_DamageInfo <0>__WriteDamageInfo;
public static hook_ReadDamageInfo <1>__ReadDamageInfo;
public static hook_WriteDamageType <2>__WriteDamageType;
public static hook_ReadDamageType <3>__ReadDamageType;
public static hook__ReadDamageTypeCombo_None <4>__ReadDamageTypeCombo;
public static hook__WriteDamageTypeCombo_None <5>__WriteDamageTypeCombo;
public static hook_GetDamageType <6>__CrocoDamageTypeControllerGetDamageType;
public static Func<Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>, DamageTypeCombo, DamageTypeCombo, DamageTypeCombo> <7>__DamageTypeComboOpBitwiseOr;
}
public const string PluginGUID = "com.bepis.r2api.damagetype";
public const string PluginName = "R2API.DamageType";
private static bool _hooksEnabled;
public const string PluginVersion = "1.1.4";
[Obsolete("All submodules are automatically loaded and this property is now unused")]
public static bool Loaded => true;
public static int ModdedDamageTypeCount { get; private set; }
internal static void SetHooks()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0058: 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_0063: Expected O, but got Unknown
//IL_0078: 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_0083: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
if (!_hooksEnabled)
{
object obj = <>O.<0>__WriteDamageInfo;
if (obj == null)
{
hook_Write_NetworkWriter_DamageInfo val = WriteDamageInfo;
<>O.<0>__WriteDamageInfo = val;
obj = (object)val;
}
NetworkExtensions.Write_NetworkWriter_DamageInfo += (hook_Write_NetworkWriter_DamageInfo)obj;
object obj2 = <>O.<1>__ReadDamageInfo;
if (obj2 == null)
{
hook_ReadDamageInfo val2 = ReadDamageInfo;
<>O.<1>__ReadDamageInfo = val2;
obj2 = (object)val2;
}
NetworkExtensions.ReadDamageInfo += (hook_ReadDamageInfo)obj2;
object obj3 = <>O.<2>__WriteDamageType;
if (obj3 == null)
{
hook_WriteDamageType val3 = WriteDamageType;
<>O.<2>__WriteDamageType = val3;
obj3 = (object)val3;
}
NetworkExtensions.WriteDamageType += (hook_WriteDamageType)obj3;
object obj4 = <>O.<3>__ReadDamageType;
if (obj4 == null)
{
hook_ReadDamageType val4 = ReadDamageType;
<>O.<3>__ReadDamageType = val4;
obj4 = (object)val4;
}
NetworkExtensions.ReadDamageType += (hook_ReadDamageType)obj4;
object obj5 = <>O.<4>__ReadDamageTypeCombo;
if (obj5 == null)
{
hook__ReadDamageTypeCombo_None val5 = ReadDamageTypeCombo;
<>O.<4>__ReadDamageTypeCombo = val5;
obj5 = (object)val5;
}
GeneratedNetworkCode._ReadDamageTypeCombo_None += (hook__ReadDamageTypeCombo_None)obj5;
object obj6 = <>O.<5>__WriteDamageTypeCombo;
if (obj6 == null)
{
hook__WriteDamageTypeCombo_None val6 = WriteDamageTypeCombo;
<>O.<5>__WriteDamageTypeCombo = val6;
obj6 = (object)val6;
}
GeneratedNetworkCode._WriteDamageTypeCombo_None += (hook__WriteDamageTypeCombo_None)obj6;
object obj7 = <>O.<6>__CrocoDamageTypeControllerGetDamageType;
if (obj7 == null)
{
hook_GetDamageType val7 = CrocoDamageTypeControllerGetDamageType;
<>O.<6>__CrocoDamageTypeControllerGetDamageType = val7;
obj7 = (object)val7;
}
CrocoDamageTypeController.GetDamageType += (hook_GetDamageType)obj7;
HookEndpointManager.Add((MethodBase)Reflection.GetMethodCached(typeof(DamageTypeCombo), "op_BitwiseAnd"), (Delegate)new Func<Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>, DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>(DamageTypeComboOpBitwiseOr));
HookEndpointManager.Add((MethodBase)Reflection.GetMethodCached(typeof(DamageTypeCombo), "op_BitwiseOr"), (Delegate)new Func<Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>, DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>(DamageTypeComboOpBitwiseOr));
_hooksEnabled = true;
}
}
internal static void UnsetHooks()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//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)
//IL_009b: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00d0: 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_00db: Expected O, but got Unknown
object obj = <>O.<0>__WriteDamageInfo;
if (obj == null)
{
hook_Write_NetworkWriter_DamageInfo val = WriteDamageInfo;
<>O.<0>__WriteDamageInfo = val;
obj = (object)val;
}
NetworkExtensions.Write_NetworkWriter_DamageInfo -= (hook_Write_NetworkWriter_DamageInfo)obj;
object obj2 = <>O.<1>__ReadDamageInfo;
if (obj2 == null)
{
hook_ReadDamageInfo val2 = ReadDamageInfo;
<>O.<1>__ReadDamageInfo = val2;
obj2 = (object)val2;
}
NetworkExtensions.ReadDamageInfo -= (hook_ReadDamageInfo)obj2;
object obj3 = <>O.<2>__WriteDamageType;
if (obj3 == null)
{
hook_WriteDamageType val3 = WriteDamageType;
<>O.<2>__WriteDamageType = val3;
obj3 = (object)val3;
}
NetworkExtensions.WriteDamageType -= (hook_WriteDamageType)obj3;
object obj4 = <>O.<3>__ReadDamageType;
if (obj4 == null)
{
hook_ReadDamageType val4 = ReadDamageType;
<>O.<3>__ReadDamageType = val4;
obj4 = (object)val4;
}
NetworkExtensions.ReadDamageType -= (hook_ReadDamageType)obj4;
object obj5 = <>O.<4>__ReadDamageTypeCombo;
if (obj5 == null)
{
hook__ReadDamageTypeCombo_None val5 = ReadDamageTypeCombo;
<>O.<4>__ReadDamageTypeCombo = val5;
obj5 = (object)val5;
}
GeneratedNetworkCode._ReadDamageTypeCombo_None -= (hook__ReadDamageTypeCombo_None)obj5;
object obj6 = <>O.<5>__WriteDamageTypeCombo;
if (obj6 == null)
{
hook__WriteDamageTypeCombo_None val6 = WriteDamageTypeCombo;
<>O.<5>__WriteDamageTypeCombo = val6;
obj6 = (object)val6;
}
GeneratedNetworkCode._WriteDamageTypeCombo_None -= (hook__WriteDamageTypeCombo_None)obj6;
object obj7 = <>O.<6>__CrocoDamageTypeControllerGetDamageType;
if (obj7 == null)
{
hook_GetDamageType val7 = CrocoDamageTypeControllerGetDamageType;
<>O.<6>__CrocoDamageTypeControllerGetDamageType = val7;
obj7 = (object)val7;
}
CrocoDamageTypeController.GetDamageType -= (hook_GetDamageType)obj7;
HookEndpointManager.Remove((MethodBase)Reflection.GetMethodCached(typeof(DamageTypeCombo), "op_BitwiseAnd"), (Delegate)new Func<Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>, DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>(DamageTypeComboOpBitwiseOr));
HookEndpointManager.Remove((MethodBase)Reflection.GetMethodCached(typeof(DamageTypeCombo), "op_BitwiseOr"), (Delegate)new Func<Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>, DamageTypeCombo, DamageTypeCombo, DamageTypeCombo>(DamageTypeComboOpBitwiseOr));
_hooksEnabled = false;
}
private static DamageInfo ReadDamageInfo(orig_ReadDamageInfo orig, NetworkReader reader)
{
DamageInfo obj = orig.Invoke(reader);
byte[] array = CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, ModdedDamageTypeCount);
DamageTypeComboInterop.SetModdedDamageTypes(ref obj.damageType, array);
return obj;
}
private static void WriteDamageInfo(orig_Write_NetworkWriter_DamageInfo orig, NetworkWriter writer, DamageInfo damageInfo)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(writer, damageInfo);
CompressedFlagArrayUtilities.WriteToNetworkWriter(DamageTypeComboInterop.GetModdedDamageTypes(damageInfo.damageType) ?? Array.Empty<byte>(), writer, ModdedDamageTypeCount);
}
private static DamageTypeCombo ReadDamageTypeCombo(orig__ReadDamageTypeCombo_None orig, NetworkReader reader)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
DamageTypeCombo result = orig.Invoke(reader);
byte[] array = CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, ModdedDamageTypeCount);
DamageTypeComboInterop.SetModdedDamageTypes(ref result, array);
return result;
}
private static void WriteDamageTypeCombo(orig__WriteDamageTypeCombo_None orig, NetworkWriter writer, DamageTypeCombo value)
{
//IL_0002: 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)
orig.Invoke(writer, value);
CompressedFlagArrayUtilities.WriteToNetworkWriter(DamageTypeComboInterop.GetModdedDamageTypes(value) ?? Array.Empty<byte>(), writer, ModdedDamageTypeCount);
}
private static DamageTypeCombo ReadDamageType(orig_ReadDamageType orig, NetworkReader reader)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
DamageTypeCombo result = orig.Invoke(reader);
byte[] array = CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, ModdedDamageTypeCount);
DamageTypeComboInterop.SetModdedDamageTypes(ref result, array);
return result;
}
private static void WriteDamageType(orig_WriteDamageType orig, NetworkWriter writer, DamageTypeCombo damageType)
{
//IL_0002: 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)
orig.Invoke(writer, damageType);
CompressedFlagArrayUtilities.WriteToNetworkWriter(DamageTypeComboInterop.GetModdedDamageTypes(damageType) ?? Array.Empty<byte>(), writer, ModdedDamageTypeCount);
}
private static DamageTypeCombo CrocoDamageTypeControllerGetDamageType(orig_GetDamageType orig, CrocoDamageTypeController self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
DamageTypeCombo result = orig.Invoke(self);
byte[] moddedDamageTypes = CrocoDamageTypeControllerInterop.GetModdedDamageTypes(self);
DamageTypeComboInterop.SetModdedDamageTypes(ref result, moddedDamageTypes);
return result;
}
private static DamageTypeCombo DamageTypeComboOpBitwiseOr(Func<DamageTypeCombo, DamageTypeCombo, DamageTypeCombo> orig, DamageTypeCombo operand1, DamageTypeCombo operand2)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
DamageTypeCombo result = orig(operand1, operand2);
byte[] moddedDamageTypes = DamageTypeComboInterop.GetModdedDamageTypes(operand1);
byte[] moddedDamageTypes2 = DamageTypeComboInterop.GetModdedDamageTypes(operand2);
if (moddedDamageTypes == null && moddedDamageTypes2 == null)
{
return result;
}
if (moddedDamageTypes == null)
{
DamageTypeComboInterop.SetModdedDamageTypes(ref result, moddedDamageTypes2);
return result;
}
if (moddedDamageTypes2 == null)
{
DamageTypeComboInterop.SetModdedDamageTypes(ref result, moddedDamageTypes);
return result;
}
byte[] array;
byte[] array2;
if (moddedDamageTypes.Length < moddedDamageTypes2.Length)
{
array = moddedDamageTypes;
array2 = moddedDamageTypes2;
}
else
{
array = moddedDamageTypes2;
array2 = moddedDamageTypes;
}
byte[] array3 = new byte[array2.Length];
for (int i = 0; i < array.Length; i++)
{
array3[i] = (byte)(array[i] | array2[i]);
}
for (int j = array.Length; j < array2.Length; j++)
{
array3[j] = array2[j];
}
DamageTypeComboInterop.SetModdedDamageTypes(ref result, array3);
return result;
}
public static ModdedDamageType ReserveDamageType()
{
SetHooks();
if (ModdedDamageTypeCount >= 1152)
{
throw new IndexOutOfRangeException($"Reached the limit of {1152} ModdedDamageTypes. Please contact R2API developers to increase the limit");
}
return (ModdedDamageType)(ModdedDamageTypeCount++);
}
public static void AddModdedDamageType(this ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref damageType, moddedDamageType);
}
public static void AddModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref damageInfo.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref bulletAttack.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref damageOrb.orbDamageType, moddedDamageType);
}
public static void AddModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref genericDamageOrb.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref lightningOrb.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref blastAttack.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref overlapAttack.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType)
{
AddModdedDamageTypeInternal(ref dotStack.damageType, moddedDamageType);
}
public static void AddModdedDamageType(this CrocoDamageTypeController croco, ModdedDamageType moddedDamageType)
{
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
byte[] moddedDamageTypes = CrocoDamageTypeControllerInterop.GetModdedDamageTypes(croco);
CompressedFlagArrayUtilities.AddImmutable(ref moddedDamageTypes, (int)moddedDamageType);
CrocoDamageTypeControllerInterop.SetModdedDamageTypes(croco, moddedDamageTypes);
}
private static void AddModdedDamageTypeInternal(ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
byte[] moddedDamageTypes = DamageTypeComboInterop.GetModdedDamageTypes(damageType);
CompressedFlagArrayUtilities.AddImmutable(ref moddedDamageTypes, (int)moddedDamageType);
DamageTypeComboInterop.SetModdedDamageTypes(ref damageType, moddedDamageTypes);
}
public static bool RemoveModdedDamageType(this ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref damageInfo.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref bulletAttack.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref damageOrb.orbDamageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref genericDamageOrb.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref lightningOrb.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref blastAttack.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref overlapAttack.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType)
{
return RemoveModdedDamageTypeInternal(ref dotStack.damageType, moddedDamageType);
}
public static bool RemoveModdedDamageType(this CrocoDamageTypeController croco, ModdedDamageType moddedDamageType)
{
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
byte[] moddedDamageTypes = CrocoDamageTypeControllerInterop.GetModdedDamageTypes(croco);
bool result = CompressedFlagArrayUtilities.RemoveImmutable(ref moddedDamageTypes, (int)moddedDamageType);
CrocoDamageTypeControllerInterop.SetModdedDamageTypes(croco, moddedDamageTypes);
return result;
}
private static bool RemoveModdedDamageTypeInternal(ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
byte[] moddedDamageTypes = DamageTypeComboInterop.GetModdedDamageTypes(damageType);
bool result = CompressedFlagArrayUtilities.RemoveImmutable(ref moddedDamageTypes, (int)moddedDamageType);
DamageTypeComboInterop.SetModdedDamageTypes(ref damageType, moddedDamageTypes);
return result;
}
public static bool HasModdedDamageType(this ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref damageInfo.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref bulletAttack.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref damageOrb.orbDamageType, moddedDamageType);
}
public static bool HasModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref genericDamageOrb.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref lightningOrb.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref blastAttack.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref overlapAttack.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType)
{
return HasModdedDamageTypeInternal(ref dotStack.damageType, moddedDamageType);
}
public static bool HasModdedDamageType(this CrocoDamageTypeController croco, ModdedDamageType moddedDamageType)
{
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
return CompressedFlagArrayUtilities.Has(CrocoDamageTypeControllerInterop.GetModdedDamageTypes(croco), (int)moddedDamageType);
}
private static bool HasModdedDamageTypeInternal(ref DamageTypeCombo damageType, ModdedDamageType moddedDamageType)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
SetHooks();
if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0)
{
throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1));
}
return CompressedFlagArrayUtilities.Has(DamageTypeComboInterop.GetModdedDamageTypes(damageType), (int)moddedDamageType);
}
}
[BepInPlugin("com.bepis.r2api.damagetype", "R2API.DamageType", "1.1.4")]
public sealed class DamageTypePlugin : BaseUnityPlugin
{
internal static ManualLogSource Logger { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
}
private void OnDestroy()
{
DamageAPI.UnsetHooks();
}
}
}
namespace R2API.AutoVersionGen
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal class AutoVersionAttribute : Attribute
{
}
}