Decompiled source of GYARMOD v1.0.0

plugins/GYARMOD/ExamplePlugin.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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;
using ExamplePlugin.Items;
using ExamplePlugin.Networking;
using ExamplePlugin.SkillStates;
using ExamplePlugin.Skills;
using HG.BlendableTypes;
using HG.Reflection;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2.Items;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a33a7e4d834d01f7a781f5f54630db30d885d55f")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[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 ExamplePlugin
{
	public static class Assets
	{
		public static AssetBundle mainBundle;

		public const string bundleName = "mainbundle";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(ExamplePlugin.PInfo.Location), "assetbundles", "mainbundle");

		public static void Init()
		{
			mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("gebwe.GYARMOD", "GYARMOD", "1.0.0")]
	public class ExamplePlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "gebwe.GYARMOD";

		public const string PluginAuthor = "gebwe";

		public const string PluginName = "GYARMOD";

		public const string PluginVersion = "1.0.0";

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Init();
			Language.Init();
			Cackadeus.Init();
			ColdBlood.Init();
			DevilEyes.Init();
			Judgement.Init();
		}
	}
	public static class ItemHelper
	{
		public static ItemDef CreateItem(string itemName, string nameToken, string pickupToken, string descriptionToken, string loreToken, string spritePath, string prefabPath, ItemTier itemTier)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
			((Object)val).name = itemName;
			val.nameToken = itemName;
			val.pickupToken = pickupToken;
			val.descriptionToken = descriptionToken;
			val.loreToken = loreToken;
			val.deprecatedTier = itemTier;
			if (!string.IsNullOrEmpty(spritePath))
			{
				Sprite val2 = Assets.mainBundle.LoadAsset<Sprite>(spritePath);
				if ((Object)(object)val2 == (Object)null)
				{
					Log.Error("Failed to load default sprite at path: " + spritePath);
				}
				val.pickupIconSprite = val2;
			}
			if (!string.IsNullOrEmpty(prefabPath))
			{
				GameObject val3 = Assets.mainBundle.LoadAsset<GameObject>(prefabPath);
				if ((Object)(object)val3 == (Object)null)
				{
					Log.Error("Failed to load default prefab at path: " + prefabPath);
				}
				val.pickupModelPrefab = Assets.mainBundle.LoadAsset<GameObject>(prefabPath);
			}
			val.canRemove = true;
			val.hidden = false;
			return val;
		}

		public static void SetupLogbookDisplay(GameObject itemPrefab, float minDistance = 0.5f, float maxDistance = 2f)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			ModelPanelParameters val = itemPrefab.GetComponent<ModelPanelParameters>();
			if ((Object)(object)val == (Object)null)
			{
				val = itemPrefab.AddComponent<ModelPanelParameters>();
			}
			GameObject val2 = new GameObject("FocusPoint");
			val2.transform.SetParent(itemPrefab.transform);
			val2.transform.localPosition = new Vector3(0f, 0f, 0f);
			val.focusPointTransform = val2.transform;
			GameObject val3 = new GameObject("CameraPosition");
			val3.transform.SetParent(itemPrefab.transform);
			val3.transform.localPosition = new Vector3(0f, 0f, 2f);
			val3.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
			val.cameraPositionTransform = val3.transform;
			val.minDistance = minDistance;
			val.maxDistance = maxDistance;
		}
	}
	public static class Language
	{
		public const string LanguageFolder = "Languages";

		public static void Init()
		{
			string path = Path.Combine(Path.GetDirectoryName(ExamplePlugin.PInfo.Location), "Languages");
			if (Directory.Exists(path))
			{
				Language.collectLanguageRootFolders += AddLanguageFolder;
			}
			else
			{
				Log.Error("Language fucked");
			}
		}

		private static void AddLanguageFolder(List<string> folders)
		{
			string item = Path.Combine(Path.GetDirectoryName(ExamplePlugin.PInfo.Location), "Languages");
			folders.Add(item);
		}
	}
	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);
		}
	}
}
namespace ExamplePlugin.Skills
{
	public class Judgement
	{
		public static SkillDef judgementSkillDef;

		public static GameObject judgementCutVFXPrefab;

		public static GameObject judgementCutAirVFXPrefab;

		public static void Init()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0032: 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_0138: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();
			judgementSkillDef = ScriptableObject.CreateInstance<SkillDef>();
			judgementSkillDef.activationState = new SerializableEntityStateType(typeof(JudgementSkillState));
			judgementSkillDef.activationStateMachineName = "Body";
			judgementSkillDef.baseMaxStock = 3;
			judgementSkillDef.baseRechargeInterval = 12f;
			judgementSkillDef.beginSkillCooldownOnSkillEnd = true;
			judgementSkillDef.fullRestockOnAssign = true;
			judgementSkillDef.interruptPriority = (InterruptPriority)0;
			judgementSkillDef.isCombatSkill = true;
			judgementSkillDef.mustKeyPress = true;
			judgementSkillDef.rechargeStock = 1;
			judgementSkillDef.requiredStock = 3;
			judgementSkillDef.stockToConsume = 3;
			judgementSkillDef.cancelSprintingOnActivation = true;
			judgementSkillDef.icon = Assets.mainBundle.LoadAsset<Sprite>("JudgementCutIcon");
			judgementSkillDef.skillName = "MERCENARY_JUDGEMENT_SKILL_NAME";
			judgementSkillDef.skillNameToken = "MERCENARY_JUDGEMENT_SKILL_NAME_TOKEN";
			judgementSkillDef.skillDescriptionToken = "MERCENARY_JUDGEMENT_SKILL_DESCRIPTION_TOKEN";
			judgementSkillDef.keywordTokens = new string[1] { "KEYWORD_EXPOSE" };
			ContentAddition.AddSkillDef(judgementSkillDef);
			bool flag = default(bool);
			ContentAddition.AddEntityState(typeof(JudgementSkillState), ref flag);
			ContentAddition.AddEntityState(typeof(FreezeState), ref flag);
			judgementCutVFXPrefab = Assets.mainBundle.LoadAsset<GameObject>("JudgementCutShort");
			judgementCutAirVFXPrefab = Assets.mainBundle.LoadAsset<GameObject>("JudgementCutShortAir");
			NetworkingAPI.RegisterMessageType<SetFreezeOnBodyRequest>();
			SkillLocator component = val.GetComponent<SkillLocator>();
			SkillFamily skillFamily = component.special.skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val2 = new Variant
			{
				skillDef = judgementSkillDef
			};
			((Variant)(ref val2)).viewableNode = new Node(judgementSkillDef.skillNameToken, false, (Node)null);
			variants[num] = val2;
		}
	}
	public class JudgementSkillState : BaseSkillState
	{
		private class ProjectileData
		{
			public float originalSpeed;

			public float timeInRadius;
		}

		public static float baseDamageCoefficient = 30f;

		public static float procCoefficient = 1f;

		public static float baseDuration = 6.3f;

		public static float baseRadius = 20f;

		private const float scanInterval = 0.1f;

		private float nextScanTime;

		private float duration;

		private float fireTime;

		private float freezeTime;

		private bool hasFired = false;

		private bool hasShook = false;

		private CameraParamsOverrideHandle camOverrideHandle;

		private Dictionary<ProjectileSimple, ProjectileData> trackedProjectiles = new Dictionary<ProjectileSimple, ProjectileData>();

		private CharacterCameraParamsData limitCameraParams = new CharacterCameraParamsData
		{
			maxPitch = BlendableFloat.op_Implicit(70f),
			minPitch = BlendableFloat.op_Implicit(-70f),
			pivotVerticalOffset = BlendableFloat.op_Implicit(4f),
			idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, -35f)),
			wallCushion = BlendableFloat.op_Implicit(0.1f)
		};

		private HashSet<HealthComponent> frozenEnemies = new HashSet<HealthComponent>();

		public override void OnEnter()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration;
			fireTime = baseDuration;
			hasShook = false;
			freezeTime = 1f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			CameraParamsOverrideRequest val = default(CameraParamsOverrideRequest);
			val.cameraParamsData = limitCameraParams;
			val.priority = 0f;
			CameraParamsOverrideRequest val2 = val;
			camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(val2, 0.5f);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.Entangle, duration);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, duration + 1f);
			}
			if (((EntityState)this).characterMotor.isGrounded)
			{
				GameObject val3 = Object.Instantiate<GameObject>(Judgement.judgementCutVFXPrefab, ((EntityState)this).characterBody.footPosition, Quaternion.identity);
				val3.transform.parent = ((EntityState)this).transform;
				if (!((EntityState)this).isAuthority)
				{
					DisableShaderEffects(val3);
				}
				Util.PlaySound("Play_JudgementCut", ((EntityState)this).gameObject);
				Object.Destroy((Object)(object)val3, 10f);
			}
			else if (!((EntityState)this).characterMotor.isGrounded)
			{
				GameObject val4 = Object.Instantiate<GameObject>(Judgement.judgementCutAirVFXPrefab, ((EntityState)this).characterBody.footPosition, Quaternion.identity);
				val4.transform.parent = ((EntityState)this).transform;
				if (!((EntityState)this).isAuthority)
				{
					DisableShaderEffects(val4);
				}
				Util.PlaySound("Play_JudgementCutAir", ((EntityState)this).gameObject);
				Object.Destroy((Object)(object)val4, 10f);
			}
			StartCameraShake(((EntityState)this).characterBody.corePosition, 1.2f, 15f, 0.75f, 30f);
		}

		public override void FixedUpdate()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= nextScanTime && ((EntityState)this).fixedAge >= freezeTime)
			{
				nextScanTime = ((EntityState)this).fixedAge + 0.1f;
				Freeze();
				SlowProjectiles();
			}
			if (((EntityState)this).fixedAge >= fireTime && !hasFired && ((EntityState)this).isAuthority)
			{
				Fire();
				hasFired = true;
			}
			if (((EntityState)this).fixedAge >= 1f && !hasShook)
			{
				StartCameraShake(((EntityState)this).characterBody.corePosition, 2f, 12f, 1f, 35f);
				hasShook = true;
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnExit();
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 1f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = true;
			}
			foreach (KeyValuePair<ProjectileSimple, ProjectileData> trackedProjectile in trackedProjectiles)
			{
				if ((Object)(object)trackedProjectile.Key != (Object)null && (Object)(object)((Component)trackedProjectile.Key).gameObject != (Object)null)
				{
					Rigidbody component = ((Component)trackedProjectile.Key).GetComponent<Rigidbody>();
					if ((Object)(object)component != (Object)null)
					{
						component.isKinematic = true;
						component.rotation = Random.rotation;
						component.isKinematic = false;
						((MonoBehaviour)trackedProjectile.Key).StartCoroutine(ResetRigidbodyAfterRotation(component, trackedProjectile));
					}
					else
					{
						trackedProjectile.Key.transform.rotation = Random.rotation;
					}
					trackedProjectile.Key.SetForwardSpeed(trackedProjectile.Value.originalSpeed);
					trackedProjectile.Key.desiredForwardSpeed = trackedProjectile.Value.originalSpeed;
				}
			}
			trackedProjectiles.Clear();
			frozenEnemies.Clear();
		}

		private void Freeze()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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)
			//IL_0012: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//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_0033: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			SphereSearch val = new SphereSearch
			{
				origin = ((EntityState)this).characterBody.corePosition,
				radius = baseRadius,
				mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask
			};
			List<HurtBox> list = new List<HurtBox>();
			val.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(((EntityState)this).teamComponent.teamIndex)).FilterCandidatesByDistinctHurtBoxEntities()
				.GetHurtBoxes(list);
			foreach (HurtBox item in list)
			{
				if (!((Object)(object)item.healthComponent?.body != (Object)null))
				{
					continue;
				}
				HealthComponent healthComponent = item.healthComponent;
				if (frozenEnemies.Contains(healthComponent))
				{
					continue;
				}
				EntityStateMachine[] components = ((Component)healthComponent.body).GetComponents<EntityStateMachine>();
				EntityStateMachine[] array = components;
				foreach (EntityStateMachine val2 in array)
				{
					if (((object)val2.state).GetType() != typeof(Idle))
					{
						val2.SetNextState((EntityState)new Idle());
					}
				}
				NetMessageExtensions.Send((INetMessage)(object)new SetFreezeOnBodyRequest(healthComponent.body.masterObjectId, duration - ((EntityState)this).fixedAge), (NetworkDestination)2);
				frozenEnemies.Add(healthComponent);
			}
		}

		private void SlowProjectiles()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			ProjectileSimple[] array = Object.FindObjectsOfType<ProjectileSimple>();
			ProjectileSimple[] array2 = array;
			foreach (ProjectileSimple val in array2)
			{
				if ((Object)(object)val == (Object)null || !Object.op_Implicit((Object)(object)((Component)val).gameObject))
				{
					continue;
				}
				float num = Vector3.Distance(val.transform.position, ((EntityState)this).characterBody.corePosition);
				if (num <= baseRadius)
				{
					if (!trackedProjectiles.ContainsKey(val))
					{
						trackedProjectiles[val] = new ProjectileData
						{
							originalSpeed = val.desiredForwardSpeed,
							timeInRadius = 0f
						};
					}
					trackedProjectiles[val].timeInRadius += Time.fixedDeltaTime;
					float num2 = 0.05f;
					float num3 = Mathf.Clamp01(trackedProjectiles[val].timeInRadius / num2);
					float num4 = Mathf.Lerp(trackedProjectiles[val].originalSpeed, 0f, num3);
					ProjectileImpactExplosion component = ((Component)val).GetComponent<ProjectileImpactExplosion>();
					if ((Object)(object)component != (Object)null)
					{
						component.lifetime = val.lifetime;
					}
					val.SetLifetime(val.lifetime);
					val.desiredForwardSpeed = num4;
					val.SetForwardSpeed(num4);
				}
			}
			List<ProjectileSimple> list = new List<ProjectileSimple>();
			foreach (KeyValuePair<ProjectileSimple, ProjectileData> trackedProjectile in trackedProjectiles)
			{
				if ((Object)(object)trackedProjectile.Key == (Object)null || !Object.op_Implicit((Object)(object)((Component)trackedProjectile.Key).gameObject))
				{
					list.Add(trackedProjectile.Key);
					continue;
				}
				float num5 = Vector3.Distance(trackedProjectile.Key.transform.position, ((EntityState)this).characterBody.corePosition);
				if (num5 > baseRadius)
				{
					trackedProjectile.Key.SetForwardSpeed(trackedProjectile.Value.originalSpeed);
					list.Add(trackedProjectile.Key);
				}
			}
			foreach (ProjectileSimple item in list)
			{
				trackedProjectiles.Remove(item);
			}
		}

		private void Fire()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_005b: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			BlastAttack val = new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				baseDamage = ((BaseState)this).damageStat * baseDamageCoefficient * (1f + (((BaseState)this).attackSpeedStat - 1f) / 3f),
				crit = ((BaseState)this).RollCrit(),
				falloffModel = (FalloffModel)0,
				radius = baseRadius,
				procCoefficient = 1f,
				teamIndex = ((BaseState)this).GetTeam(),
				position = ((EntityState)this).transform.position,
				damageType = DamageTypeCombo.op_Implicit((DamageType)8388608)
			};
			StartCameraShake(((EntityState)this).characterBody.corePosition, 2f, 5f, 1f, 40f);
			val.Fire();
		}

		private void StartCameraShake(Vector3 position, float amplitude, float frequency, float duration, float radius)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			Wave val = default(Wave);
			val.amplitude = amplitude;
			val.frequency = frequency;
			Wave val2 = val;
			ShakeEmitter.CreateSimpleShakeEmitter(position, val2, duration, radius, true);
		}

		private void DisableShaderEffects(GameObject vfxInstance)
		{
			Transform val = vfxInstance.transform.Find("Blur");
			Transform val2 = vfxInstance.transform.Find("ON");
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.SetActive(false);
			}
			if ((Object)(object)val2 != (Object)null)
			{
				((Component)val2).gameObject.SetActive(false);
			}
		}

		private IEnumerator ResetRigidbodyAfterRotation(Rigidbody rb, KeyValuePair<ProjectileSimple, ProjectileData> trackedProjectile)
		{
			yield return (object)new WaitForFixedUpdate();
			rb.velocity = trackedProjectile.Key.transform.forward * trackedProjectile.Value.originalSpeed;
		}
	}
}
namespace ExamplePlugin.Networking
{
	internal class SetFreezeOnBodyRequest : INetMessage, ISerializableObject
	{
		private NetworkInstanceId netID;

		private float duration;

		public SetFreezeOnBodyRequest()
		{
		}

		public SetFreezeOnBodyRequest(NetworkInstanceId netID, float duration)
		{
			//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.netID = netID;
			this.duration = duration;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(netID);
			writer.Write(duration);
		}

		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)
			netID = reader.ReadNetworkId();
			duration = reader.ReadSingle();
		}

		public void OnReceived()
		{
			ForceFreezeState();
		}

		public void ForceFreezeState()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			GameObject val = Util.FindNetworkObject(netID);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Debug.Log((object)"Specified GameObject not found!");
				return;
			}
			CharacterMaster component = val.GetComponent<CharacterMaster>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Debug.Log((object)"CharacterMaster not found!");
				return;
			}
			GameObject bodyObject = component.GetBodyObject();
			if (!Object.op_Implicit((Object)(object)bodyObject))
			{
				return;
			}
			HealthComponent component2 = bodyObject.GetComponent<HealthComponent>();
			if (!((Object)(object)component2 == (Object)null) && !(component2.health <= 0f))
			{
				EntityStateMachine val2 = EntityStateMachine.FindByCustomName(bodyObject, "Body");
				if ((Object)(object)val2 != (Object)null)
				{
					val2.SetInterruptState((EntityState)(object)new FreezeState
					{
						duration = duration
					}, (InterruptPriority)5);
				}
			}
		}
	}
}
namespace ExamplePlugin.SkillStates
{
	public class FreezeState : BaseSkillState
	{
		internal float duration;

		private Animator modelAnimator;

		public override void OnEnter()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			modelAnimator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((Behaviour)modelAnimator).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbody) && !((EntityState)this).rigidbody.isKinematic)
			{
				((EntityState)this).rigidbody.velocity = Vector3.zero;
				if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
				{
					((EntityState)this).rigidbodyMotor.moveVector = Vector3.zero;
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((Behaviour)modelAnimator).enabled = true;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				((Behaviour)((EntityState)this).characterMotor).enabled = true;
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			//IL_002f: 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)
			((EntityState)this).FixedUpdate();
			((BaseState)this).attackSpeedStat = 0f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)5;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(duration);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			duration = reader.ReadSingle();
		}
	}
}
namespace ExamplePlugin.Items
{
	public static class Cackadeus
	{
		public class CackadeusBehavior : BaseItemBodyBehavior
		{
			[ItemDefAssociation(useOnServer = true, useOnClient = false)]
			public static ItemDef GetItemDef()
			{
				return cackadeusItemDef;
			}

			private void OnEnable()
			{
				GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeathGlobal;
			}

			private void OnDisable()
			{
				GlobalEventManager.onCharacterDeathGlobal -= OnCharacterDeathGlobal;
			}

			private void OnCharacterDeathGlobal(DamageReport report)
			{
				if ((Object)(object)report.attackerBody == (Object)(object)((BaseItemBodyBehavior)this).body && Object.op_Implicit((Object)(object)report.attackerBody.inventory) && Util.CheckRoll(50f, ((BaseItemBodyBehavior)this).body.master))
				{
					float num = 3f + 1f * (float)base.stack;
					((BaseItemBodyBehavior)this).body.AddTimedBuff(Buffs.Cloak, num);
				}
			}
		}

		public static ItemDef cackadeusItemDef;

		public const float CackadeusChance = 50f;

		public const float CackadeusBaseDuration = 3f;

		public const float CackadeusStackDuration = 1f;

		public static void Init()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			cackadeusItemDef = ItemHelper.CreateItem("ITEM_CACKADEUS_NAME", "ITEM_CACKADEUS_NAME_TOKEN", "ITEM_CACKADEUS_PICKUP_TOKEN", "ITEM_CACKADEUS_DESC_TOKEN", "ITEM_CACKADEUS_LORE_TOKEN", "CackadeusIcon", "MaxwellPrefab", (ItemTier)5);
			ItemAPI.Add(new CustomItem(cackadeusItemDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
			ItemHelper.SetupLogbookDisplay(cackadeusItemDef.pickupModelPrefab, 3f, 5f);
			cackadeusItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)9 };
		}
	}
	public static class ColdBlood
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients;
		}

		public static ItemDef coldBloodItemDef;

		public static GameObject coldBloodIndicatorPrefab;

		public static void Init()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_00a5: 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_00f0: Expected O, but got Unknown
			coldBloodItemDef = ItemHelper.CreateItem("ITEM_COLD_BLOOD_NAME", "ITEM_COLD_BLOOD_NAME_TOKEN", "ITEM_COLD_BLOOD_PICKUP_TOKEN", "ITEM_COLD_BLOOD_DESC_TOKEN", "ITEM_COLD_BLOOD_LORE_TOKEN", "ColdBloodIcon", "ColdBloodPrefab", (ItemTier)0);
			ItemAPI.Add(new CustomItem(coldBloodItemDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
			coldBloodItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 };
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/NearbyDamageBonusIndicator");
			coldBloodIndicatorPrefab = PrefabAPI.InstantiateClone(val, "ColdBloodIndicatorPrefab", true);
			Transform child = coldBloodIndicatorPrefab.transform.GetChild(1);
			((Renderer)((Component)child).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", new Color(0.05f, 0.05f, 0.05f));
			PrefabAPI.RegisterNetworkPrefab(coldBloodIndicatorPrefab);
			ItemHelper.SetupLogbookDisplay(coldBloodItemDef.pickupModelPrefab, 1.5f, 3f);
			object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val2 = RecalculateStatsAPI_GetStatCoefficients;
				<>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val2;
				obj = (object)val2;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			ColdBloodBehavior coldBloodBehavior = default(ColdBloodBehavior);
			if (((Component)sender).TryGetComponent<ColdBloodBehavior>(ref coldBloodBehavior))
			{
				args.critAdd += coldBloodBehavior.cachedBonusCrit;
			}
		}
	}
	public class ColdBloodBehavior : BaseItemBodyBehavior
	{
		internal float cachedBonusCrit;

		private const float scanInterval = 0.25f;

		private float nextScanTime;

		private const float coldBloodBaseCritChance = 4f;

		private const float coldBloodStackCritBonus = 3f;

		private const float coldBloodRange = 13f;

		private GameObject coldBloodIndicator;

		[ItemDefAssociation]
		public static ItemDef GetItemDef()
		{
			return ColdBlood.coldBloodItemDef;
		}

		public void OnEnable()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			nextScanTime = Time.time;
			if (NetworkServer.active && (Object)(object)coldBloodIndicator == (Object)null)
			{
				coldBloodIndicator = Object.Instantiate<GameObject>(ColdBlood.coldBloodIndicatorPrefab, ((BaseItemBodyBehavior)this).body.corePosition, Quaternion.identity);
				coldBloodIndicator.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
			}
		}

		private void OnDisable()
		{
			if ((Object)(object)coldBloodIndicator != (Object)null)
			{
				Object.Destroy((Object)(object)coldBloodIndicator);
				coldBloodIndicator = null;
			}
		}

		public void FixedUpdate()
		{
			if (Time.time >= nextScanTime)
			{
				nextScanTime = Time.time + 0.25f;
				UpdateCritBonus();
			}
		}

		internal void UpdateCritBonus()
		{
			int num = CountNearbyEnemies(((BaseItemBodyBehavior)this).body);
			int itemCount = ((BaseItemBodyBehavior)this).body.inventory.GetItemCount(ColdBlood.coldBloodItemDef);
			cachedBonusCrit = (4f + 3f * (float)(itemCount - 1)) * (float)num;
			((BaseItemBodyBehavior)this).body.RecalculateStats();
		}

		public static int CountNearbyEnemies(CharacterBody body)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			SphereSearch val = new SphereSearch
			{
				origin = body.corePosition,
				radius = 13f,
				mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask
			};
			List<HurtBox> list = new List<HurtBox>();
			val.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(body.teamComponent.teamIndex)).FilterCandidatesByDistinctHurtBoxEntities()
				.GetHurtBoxes(list);
			int num = 0;
			foreach (HurtBox item in list)
			{
				if (Object.op_Implicit((Object)(object)item.healthComponent) && item.healthComponent.alive)
				{
					num++;
				}
			}
			return num;
		}
	}
	public static class DevilEyes
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Init <0>__AddVoidTransformation;
		}

		public static ItemDef DevilEyesItemDef;

		public static BuffDef devilEyesBuff;

		public static void Init()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			DevilEyesItemDef = ItemHelper.CreateItem("ITEM_DEVIL_EYES_NAME", "ITEM_DEVIL_EYES_NAME_TOKEN", "ITEM_DEVIL_EYES_PICKUP_TOKEN", "ITEM_DEVIL_EYES_DESC_TOKEN", "ITEM_DEVIL_EYES_LORE_TOKEN", "DevilEyesIcon", "DevilEyesPrefab", (ItemTier)8);
			DevilEyesItemDef.requiredExpansion = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef def) => def.nameToken == "DLC1_NAME"));
			CreateBuff();
			ItemAPI.Add(new CustomItem(DevilEyesItemDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
			ItemHelper.SetupLogbookDisplay(DevilEyesItemDef.pickupModelPrefab, 0.5f, 1f);
			object obj = <>O.<0>__AddVoidTransformation;
			if (obj == null)
			{
				hook_Init val = AddVoidTransformation;
				<>O.<0>__AddVoidTransformation = val;
				obj = (object)val;
			}
			ContagiousItemManager.Init += (hook_Init)obj;
		}

		public static void CreateBuff()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			devilEyesBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)devilEyesBuff).name = "DevilEyesBuff";
			devilEyesBuff.buffColor = Color.white;
			devilEyesBuff.isDebuff = false;
			devilEyesBuff.canStack = true;
			devilEyesBuff.isHidden = false;
			devilEyesBuff.iconSprite = Assets.mainBundle.LoadAsset<Sprite>("DevilEyesBuffIcon");
			ContentAddition.AddBuffDef(devilEyesBuff);
		}

		private static void AddVoidTransformation(orig_Init orig)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Pair val = default(Pair);
			val.itemDef1 = Items.CritDamage;
			val.itemDef2 = DevilEyesItemDef;
			Pair val2 = val;
			ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = CollectionExtensions.AddToArray<Pair>(ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem], val2);
			orig.Invoke();
		}
	}
	public class DevilEyesBehavior : BaseItemBodyBehavior
	{
		[ItemDefAssociation]
		public static ItemDef GetItemDef()
		{
			return DevilEyes.DevilEyesItemDef;
		}

		private void OnEnable()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeathGlobal;
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HandleStatCoefficients);
		}

		private void OnDisable()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			GlobalEventManager.onCharacterDeathGlobal -= OnCharacterDeathGlobal;
			RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(HandleStatCoefficients);
			((BaseItemBodyBehavior)this).body.SetBuffCount(BuffCatalog.FindBuffIndex(((Object)DevilEyes.devilEyesBuff).name), 0);
		}

		private void HandleStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if ((Object)(object)sender == (Object)(object)((BaseItemBodyBehavior)this).body)
			{
				args.critAdd += 1f * (float)((BaseItemBodyBehavior)this).body.GetBuffCount(DevilEyes.devilEyesBuff);
			}
		}

		public void OnCharacterDeathGlobal(DamageReport report)
		{
			if ((Object)(object)report.attackerBody == (Object)(object)((BaseItemBodyBehavior)this).body && Object.op_Implicit((Object)(object)report.attackerBody.inventory))
			{
				for (int i = 0; i < ((BaseItemBodyBehavior)this).body.inventory.GetItemCount(DevilEyes.DevilEyesItemDef); i++)
				{
					((BaseItemBodyBehavior)this).body.AddBuff(DevilEyes.devilEyesBuff);
				}
			}
		}
	}
}