Decompiled source of AcridPandemic v1.0.1

AcridPandemic.dll

Decompiled a month ago
using System;
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 EntityStates.Croco;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Orbs;
using UnityEngine;
using UnityEngine.AddressableAssets;
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("AcridPandemic")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AcridPandemic")]
[assembly: AssemblyTitle("AcridPandemic")]
[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 AcridPandemic
{
	[BepInPlugin("Jeffdev.AcridPandemic", "AcridPandemic", "1.0.1")]
	public class AcridPandemic : BaseUnityPlugin
	{
		public const string PluginGUID = "Jeffdev.AcridPandemic";

		public const string PluginAuthor = "Jeffdev";

		public const string PluginName = "AcridPandemic";

		public const string PluginVersion = "1.0.1";

		public static BuffDef diseaseCheckPoison;

		public static BuffDef diseaseCheckBlight;

		public void Awake()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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)
			Log.Init(((BaseUnityPlugin)this).Logger);
			GlobalEventManager.onCharacterDeathGlobal += ProcPoisonOnKill;
			GlobalEventManager.onServerDamageDealt += ProcDisease;
			diseaseCheckPoison = ScriptableObject.CreateInstance<BuffDef>();
			diseaseCheckPoison.buffColor = Color.yellow;
			diseaseCheckPoison.canStack = false;
			diseaseCheckPoison.isHidden = false;
			diseaseCheckPoison.isCooldown = false;
			diseaseCheckPoison.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Croco/bdPoisoned.asset").WaitForCompletion().iconSprite;
			((Object)diseaseCheckPoison).name = "DiseaseCheckPoison";
			ContentAddition.AddBuffDef(diseaseCheckPoison);
			diseaseCheckBlight = ScriptableObject.CreateInstance<BuffDef>();
			diseaseCheckBlight.buffColor = Color.yellow;
			diseaseCheckBlight.canStack = false;
			diseaseCheckBlight.isHidden = false;
			diseaseCheckBlight.isCooldown = false;
			diseaseCheckBlight.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Croco/bdPoisoned.asset").WaitForCompletion().iconSprite;
			((Object)diseaseCheckBlight).name = "DiseaseCheckBlight";
			ContentAddition.AddBuffDef(diseaseCheckBlight);
		}

		private void ProcDisease(DamageReport damageReport)
		{
			//IL_0033: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_010c: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Invalid comparison between Unknown and I4
			if (!((Object)(object)diseaseCheckBlight == (Object)null) && !((Object)(object)diseaseCheckPoison == (Object)null) && !((Object)(object)damageReport.victimBody == (Object)null) && !((Enum)damageReport.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)67108864) && (((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)2) || ((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)8)) && !((Enum)damageReport.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)131072) && !((Enum)damageReport.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)524288))
			{
				if ((int)DamageTypeCombo.op_Implicit(damageReport.damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)1048576)) == 1048576 && !damageReport.victimBody.HasBuff(diseaseCheckBlight))
				{
					damageReport.victimBody.AddBuff(diseaseCheckBlight);
				}
				if ((int)DamageTypeCombo.op_Implicit(damageReport.damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)4096)) == 4096 && !damageReport.victimBody.HasBuff(diseaseCheckPoison))
				{
					damageReport.victimBody.AddBuff(diseaseCheckPoison);
				}
			}
		}

		private void ProcPoisonOnKill(DamageReport damageReport)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && !((Object)(object)damageReport.victimBody == (Object)null) && !((Object)(object)damageReport.attackerBody == (Object)null) && !((Object)(object)diseaseCheckPoison == (Object)null) && !((Object)(object)diseaseCheckBlight == (Object)null) && (damageReport.victimBody.HasBuff(diseaseCheckPoison) || damageReport.victimBody.HasBuff(diseaseCheckBlight)))
			{
				CharacterBody attackerBody = damageReport.attackerBody;
				Vector3 corePosition = damageReport.victimBody.corePosition;
				DamageTypeCombo val = default(DamageTypeCombo);
				val.damageType = (DamageType)4096;
				val.damageSource = (DamageSource)8;
				DamageTypeCombo damageType = val;
				if (damageReport.victimBody.HasBuff(diseaseCheckBlight))
				{
					val = default(DamageTypeCombo);
					val.damageType = (DamageType)1048576;
					val.damageSource = (DamageSource)8;
					damageType = val;
				}
				LightningOrb val2 = new LightningOrb
				{
					attacker = ((Component)attackerBody).gameObject,
					bouncedObjects = new List<HealthComponent>(),
					lightningType = (LightningType)7,
					damageType = damageType,
					damageValue = attackerBody.damage * Disease.damageCoefficient,
					isCrit = attackerBody.RollCrit(),
					procCoefficient = Disease.procCoefficient,
					bouncesRemaining = Disease.maxBounces,
					origin = corePosition,
					teamIndex = attackerBody.teamComponent.teamIndex,
					range = Disease.bounceRange,
					procChainMask = default(ProcChainMask)
				};
				HurtBox val3 = val2.PickNextTarget(corePosition);
				if (Object.op_Implicit((Object)(object)val3))
				{
					((Orb)val2).target = val3;
					OrbManager.instance.AddOrb((Orb)(object)val2);
				}
			}
		}
	}
	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);
		}
	}
}