Decompiled source of Enforcer v3.11.2

plugins/Enforcer.dll

Decompiled 2 months 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUI;
using Enforcer;
using Enforcer.Emotes;
using Enforcer.Modules.Compat;
using Enforcer.Nemesis;
using EnforcerPlugin;
using EntityStates;
using EntityStates.BeetleGuardMonster;
using EntityStates.Bison;
using EntityStates.ClayBruiser.Weapon;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Croco;
using EntityStates.Enforcer;
using EntityStates.Enforcer.NeutralSpecial;
using EntityStates.GlobalSkills.LunarNeedle;
using EntityStates.GolemMonster;
using EntityStates.Huntress;
using EntityStates.LemurianBruiserMonster;
using EntityStates.Loader;
using EntityStates.Mage;
using EntityStates.Merc;
using EntityStates.Nemforcer;
using EntityStates.Nemforcer.Emotes;
using EntityStates.NullifierMonster;
using EntityStates.Toolbot;
using HG;
using HG.BlendableTypes;
using KinematicCharacterController;
using Modules;
using Modules.Characters;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.GlobalSkills.LunarNeedle;
using On.EntityStates.GolemMonster;
using On.RoR2;
using On.RoR2.ContentManagement;
using On.RoR2.UI.MainMenu;
using R2API;
using R2API.Utils;
using Risky_Artifacts.Artifacts;
using RoR2;
using RoR2.Achievements;
using RoR2.CameraModes;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.MainMenu;
using SkillsPlusPlus;
using SkillsPlusPlus.Modifiers;
using SupplyDrop.Items;
using Survariants;
using TILER2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
using UnityEngine.UI;
using VRAPI;

[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("Enforcer")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyTitle("Enforcer")]
[assembly: AssemblyInformationalVersion("1.0.0+3ce56c90e7c470669499065555b53a1030222e89")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyProduct("Enforcer")]
[assembly: CompilationRelaxations(8)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class ArmStrapRagdollHandler : MonoBehaviour
{
	[SerializeField]
	private Transform ShieldBone;

	private void OnDisable()
	{
		((Component)this).transform.SetParent(ShieldBone);
	}
}
public class EnergyShieldControler : MonoBehaviour
{
	public Vector3 shieldAimRayDirection = new Vector3(0f, 0f, 0f);

	private float angle;

	public HealthComponent healthComponent;

	private bool isSet;

	private void Start()
	{
		SetCharacterbody();
	}

	private void SetCharacterbody()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		if (!isSet)
		{
			isSet = true;
			CharacterBody val = ((Component)this).gameObject.AddComponent<CharacterBody>();
			((Object)val).name = "EnergyShield";
			val.baseNameToken = "";
			val.subtitleNameToken = "";
			val.bodyFlags = (BodyFlags)16;
			val.rootMotionInMainState = false;
			val.mainRootSpeed = 0f;
			val.baseMaxHealth = 15f;
			val.levelMaxHealth = 0f;
			val.baseRegen = 0f;
			val.levelRegen = 0f;
			val.baseMaxShield = 0f;
			val.levelMaxShield = 0f;
			val.baseMoveSpeed = 0f;
			val.levelMoveSpeed = 0f;
			val.baseAcceleration = 0f;
			val.baseJumpPower = 0f;
			val.levelJumpPower = 0f;
			val.baseDamage = 0f;
			val.levelDamage = 0f;
			val.baseAttackSpeed = 0f;
			val.levelAttackSpeed = 0f;
			val.baseCrit = 0f;
			val.levelCrit = 0f;
			val.baseArmor = 0f;
			val.levelArmor = 0f;
			val.baseJumpCount = 0;
			val.sprintingSpeedMultiplier = 0f;
			val.wasLucky = false;
			val.hideCrosshair = true;
			val._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/SMGCrosshair");
			val.aimOriginTransform = ((Component)this).transform;
			val.hullClassification = (HullClassification)0;
			val.portraitIcon = null;
			val.isChampion = false;
			val.currentVehicle = null;
			val.skinIndex = 0u;
			healthComponent = ((Component)this).gameObject.AddComponent<HealthComponent>();
			healthComponent.health = 15f;
			healthComponent.shield = 0f;
			healthComponent.barrier = 0f;
			healthComponent.magnetiCharge = 0f;
			healthComponent.body = val;
			healthComponent.dontShowHealthbar = false;
			healthComponent.globalDeathEventChanceCoefficient = 1f;
			HurtBoxGroup val2 = ((Component)this).gameObject.AddComponent<HurtBoxGroup>();
			HurtBox val3 = ((Component)((Component)this).gameObject.GetComponentInChildren<MeshCollider>()).gameObject.AddComponent<HurtBox>();
			((Component)val3).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val3.healthComponent = healthComponent;
			val3.isBullseye = true;
			val3.damageModifier = (DamageModifier)0;
			val3.hurtBoxGroup = val2;
			val3.indexInGroup = 0;
			val2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val3 };
		}
	}

	private void Update()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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)
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(shieldAimRayDirection.x, 0f, shieldAimRayDirection.z);
		float num = -1f * (shieldAimRayDirection.y / Mathf.Abs(shieldAimRayDirection.y));
		float num2 = num * Vector3.Angle(shieldAimRayDirection, val);
		((Component)this).transform.Rotate(new Vector3(num2 - angle, 0f, 0f));
		angle = num2;
	}

	public void Toggle()
	{
		healthComponent.health = healthComponent.fullHealth;
	}

	private void OnEnable()
	{
		if (!isSet)
		{
			SetCharacterbody();
		}
		healthComponent.health = healthComponent.fullHealth;
	}
}
public class EngiShieldTex : MonoBehaviour
{
	[SerializeField]
	private float offsetRate = 0.1f;

	private float offsetRateVSOverride = -1f;

	private Renderer _rend;

	private float _offset;

	private MaterialPropertyBlock matProperties;

	private Vector2 tiling;

	private bool col = false;

	private void Start()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		offsetRate = ((offsetRateVSOverride == -1f) ? offsetRate : offsetRateVSOverride);
		_rend = ((Component)this).GetComponent<Renderer>();
		matProperties = new MaterialPropertyBlock();
		tiling = _rend.material.GetTextureScale("_MainTex");
	}

	private void Update()
	{
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		_offset += offsetRate * Time.deltaTime;
		if (_offset > 1f)
		{
			_offset -= 1f;
		}
		_rend.GetPropertyBlock(matProperties);
		matProperties.SetVector("_MainTex_ST", new Vector4(tiling.x, tiling.y, _offset, _offset));
		_rend.SetPropertyBlock(matProperties);
	}
}
public class ItemDisplayBones : MonoBehaviour
{
	[SerializeField]
	private GameObject[] itemBones;

	private void Awake()
	{
		OnEnable();
	}

	private void OnEnable()
	{
		for (int i = 0; i < itemBones.Length; i++)
		{
			itemBones[i].SetActive(true);
		}
	}

	private void OnDisable()
	{
		for (int i = 0; i < itemBones.Length; i++)
		{
			itemBones[i].SetActive(false);
		}
	}
}
public class MemeBoneController : MonoBehaviour
{
	[SerializeField]
	private Transform origBone;

	[SerializeField]
	[FormerlySerializedAs("position")]
	private bool positionAndRotation = true;

	[Header("LateUpdate")]
	[SerializeField]
	private bool localPosition = false;

	[FormerlySerializedAs("scale")]
	[SerializeField]
	private bool localScale = false;

	private void Update()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)origBone) && positionAndRotation)
		{
			((Component)origBone).transform.rotation = ((Component)this).transform.rotation;
			((Component)origBone).transform.position = ((Component)this).transform.position;
		}
	}

	private void LateUpdate()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)origBone))
		{
			if (localPosition)
			{
				((Component)origBone).transform.localPosition = ((Component)this).transform.localPosition;
			}
			if (localScale)
			{
				((Component)origBone).transform.localScale = ((Component)this).transform.localScale;
			}
		}
	}
}
public class MemeRigController : MonoBehaviour
{
	[SerializeField]
	private Animator memeAnimator;

	[SerializeField]
	private GameObject memeScaler;

	[SerializeField]
	private Animator origAnimator;

	public bool isPlaying;

	public Animator MemeAnimator => memeAnimator;

	private void Awake()
	{
		((Component)memeAnimator).gameObject.SetActive(false);
	}

	public void playMemeAnim(bool scale = false)
	{
		((Behaviour)origAnimator).enabled = false;
		memeAnimator.Rebind();
		((Component)memeAnimator).gameObject.SetActive(true);
		isPlaying = true;
	}

	public void stopAnim()
	{
		memeAnimator.Play("Empty");
		((Component)memeAnimator).gameObject.SetActive(false);
		((Behaviour)origAnimator).enabled = true;
		isPlaying = false;
	}
}
public class shieldToggler : MonoBehaviour
{
	[SerializeField]
	private GameObject[] thing1;

	[SerializeField]
	private GameObject[] thing2;

	private bool tog;

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)104))
		{
			tog = !tog;
			GameObject[] array = thing1;
			foreach (GameObject val in array)
			{
				Debug.Log((object)("thing1 " + tog));
				val.SetActive(tog);
			}
			GameObject[] array2 = thing2;
			foreach (GameObject val2 in array2)
			{
				Debug.Log((object)("thing2 " + !tog));
				val2.SetActive(!tog);
			}
		}
	}
}
public class EnforcerComponent : MonoBehaviour
{
	protected CharacterCameraParamsData shieldCameraParams = new CharacterCameraParamsData
	{
		maxPitch = BlendableFloat.op_Implicit(70f),
		minPitch = BlendableFloat.op_Implicit(-70f),
		pivotVerticalOffset = BlendableFloat.op_Implicit(CharacterBase.instance.bodyInfo.cameraParamsVerticalOffset),
		idealLocalCameraPos = BlendableVector3.op_Implicit(shieldCameraPosition),
		wallCushion = BlendableFloat.op_Implicit(0.1f)
	};

	public static CameraParamsOverrideHandle camOverrideHandle;

	public static Vector3 shieldCameraPosition = new Vector3(2.3f, -1f, -6.5f);

	private static float maxSpeed = 0.1f;

	private static float coef = 1f;

	public EnforcerWeaponComponent weaponComponent;

	private bool _isShielding;

	public Ray aimRay;

	public Vector3 shieldDirection = new Vector3(1f, 0f, 0f);

	public bool beefStop;

	private float initialTime = 0f;

	public ChildLocator childLocator;

	public CameraTargetParams cameraShit2;

	private GameObject energyShield;

	public EnergyShieldControler energyShieldControler;

	private Transform _shieldPreview;

	private Transform _shieldParent;

	private float _shieldSize;

	private float _shieldSizeMultiplier = 1.2f;

	private MeshRenderer shieldMeshVR;

	private GameObject dummy;

	private GameObject boyPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/LemurianBody");

	public static bool skateJump;

	private Transform head;

	private CharacterBody enforcerBody;

	public EntityStateMachine drOctagonapus { get; set; }

	public bool isDeflecting { get; set; }

	public Transform origOrigin { get; set; }

	public bool isShielding
	{
		get
		{
			return _isShielding;
		}
		set
		{
			_isShielding = value;
			toggleShieldCamera(value);
		}
	}

	public float shieldHealth => energyShieldControler.healthComponent.health;

	public event Action onLaserHit = delegate
	{
	};

	public static event Action<GameObject> BlockedGet;

	public void Init()
	{
		childLocator = ((Component)this).GetComponentInChildren<ChildLocator>();
		head = childLocator.FindChild("Head");
		cameraShit2 = ((Component)this).GetComponentInChildren<CameraTargetParams>();
	}

	private void Start()
	{
		if ((Object)(object)drOctagonapus == (Object)null)
		{
			drOctagonapus = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "EnforcerParry");
		}
		if ((Object)(object)enforcerBody == (Object)null)
		{
			enforcerBody = ((Component)this).GetComponent<CharacterBody>();
		}
		weaponComponent = ((Component)this).GetComponent<EnforcerWeaponComponent>();
	}

	private void FixedUpdate()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_002a: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((!VRAPICompat.IsLocalVRPlayer(enforcerBody)) ? ((Ray)(ref aimRay)).direction : GetVRShieldDirection());
		aimShield(val);
		if (Object.op_Implicit((Object)(object)energyShieldControler))
		{
			energyShieldControler.shieldAimRayDirection = val;
		}
	}

	private void LateUpdate()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		if (Config.headSize.Value > 2f)
		{
			((Component)head).transform.localScale = Vector3.one * Config.headSize.Value;
			((Component)head).transform.localPosition = new Vector3(0f, 0.0535f + 0.045f * Config.headSize.Value, 0f);
		}
		if (VRAPICompat.IsLocalVRPlayer(enforcerBody) && Config.translucentVRShield.Value)
		{
			UpdateVRShieldTransparency();
		}
	}

	private void UpdateVRShieldTransparency()
	{
		HandController nonDominantHand = MotionControls.nonDominantHand;
		if (nonDominantHand != null)
		{
			nonDominantHand.rendererInfos[0].defaultMaterial.SetFloat(CommonShaderProperties._Fade, enforcerBody.HasBuff(Buffs.protectAndServeBuff) ? 0.6f : 0.3f);
		}
	}

	public void ResetAimOrigin(CharacterBody characterBody)
	{
		characterBody.aimOriginTransform = origOrigin;
	}

	private void toggleShieldCamera(bool shieldIsUp)
	{
		//IL_0009: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		if (shieldIsUp)
		{
			CameraParamsOverrideRequest val = default(CameraParamsOverrideRequest);
			val.cameraParamsData = shieldCameraParams;
			val.priority = 0f;
			CameraParamsOverrideRequest val2 = val;
			camOverrideHandle = cameraShit2.AddParamsOverride(val2, 0.6f);
		}
		else
		{
			for (int num = cameraShit2.cameraParamsOverrides.Count - 1; num >= 0; num--)
			{
				camOverrideHandle.target = cameraShit2.cameraParamsOverrides[num];
				cameraShit2.RemoveParamsOverride(camOverrideHandle, 0.3f);
			}
		}
	}

	private void aimShield(Vector3 aimDirection)
	{
		//IL_001a: 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)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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_002e: 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)
		//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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_00b3: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		bool flag = VRAPICompat.IsLocalVRPlayer(enforcerBody);
		float num = Time.fixedTime - initialTime;
		Vector3 val = Vector3.Cross(aimDirection, shieldDirection);
		Vector3 val2 = Vector3.Cross(shieldDirection, val);
		float num2 = (flag ? 1f : (maxSpeed * (1f - Mathf.Exp(-1f * coef * num))));
		shieldDirection += num2 * ((Vector3)(ref val2)).normalized;
		shieldDirection = ((Vector3)(ref shieldDirection)).normalized;
		if (flag && enforcerBody.HasBuff(Buffs.protectAndServeBuff))
		{
			FaceTowardsVRShield();
		}
		Vector3 val3 = aimDirection - shieldDirection;
		if ((double)((Vector3)(ref val3)).magnitude < 0.05)
		{
			initialTime = Time.fixedTime;
		}
	}

	private void FaceTowardsVRShield()
	{
		//IL_0014: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)enforcerBody == (Object)null))
		{
			Vector3 forward = shieldDirection;
			forward.y = 0f;
			((Vector3)(ref forward)).Normalize();
			enforcerBody.characterDirection.forward = forward;
		}
	}

	private Vector3 GetVRShieldDirection()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		return MotionControls.nonDominantHand.GetMuzzleByIndex(1u).forward;
	}

	public void ToggleEnergyShield(bool shieldToggle)
	{
		if (Object.op_Implicit((Object)(object)energyShield))
		{
			energyShield.SetActive(shieldToggle);
		}
	}

	public void invokeOnLaserHitEvent()
	{
		this.onLaserHit?.Invoke();
	}

	public void OnTriggerStay(Collider other)
	{
		if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<JumpVolume>()))
		{
			skateJump = false;
		}
	}

	public void OnAttackBlocked(GameObject gameObject)
	{
		EnforcerComponent.BlockedGet(gameObject);
	}

	public bool GetShieldBlock(Vector3 attackerPosition, float blockAngle)
	{
		//IL_0004: 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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		bool result = false;
		Vector3 val = shieldDirection;
		Vector3 val2 = attackerPosition - enforcerBody.corePosition;
		float num = Vector3.Angle(val, val2);
		if (num <= blockAngle)
		{
			result = true;
		}
		return result;
	}

	static EnforcerComponent()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		EnforcerComponent.BlockedGet = delegate
		{
		};
	}
}
public class EnforcerItemDisplayEditorComponent : MonoBehaviour
{
	public enum EquippedGun
	{
		GUN,
		SUPER,
		HMG,
		HAMMER,
		NEEDLER
	}

	public enum EquippedShield
	{
		SHIELD,
		SHIELD2,
		BOARD
	}

	private ChildLocator childLocator;

	private GameObject shotgunObject => ((Component)childLocator.FindChild("GunModel")).gameObject;

	private GameObject ssgobject => ((Component)childLocator.FindChild("SuperGunModel")).gameObject;

	private GameObject hmgObject => ((Component)childLocator.FindChild("HMGModel")).gameObject;

	private GameObject hammerObject => ((Component)childLocator.FindChild("HammerModel")).gameObject;

	private GameObject needlerObject => ((Component)childLocator.FindChild("NeedlerModel")).gameObject;

	private GameObject shieldObject => ((Component)childLocator.FindChild("ShieldModel")).gameObject;

	private GameObject skateBoardObject => ((Component)childLocator.FindChild("SkamteBordModel")).gameObject;

	private void Start()
	{
		//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)
		Scene activeScene = SceneManager.GetActiveScene();
		if (((Scene)(ref activeScene)).name == "KingEnderBrine_IDRS_Editor")
		{
			childLocator = ((Component)this).GetComponentInChildren<ChildLocator>();
			HideWeapons();
			EquipWeapon(EquippedGun.GUN);
		}
	}

	public void HideWeapons()
	{
		shotgunObject.SetActive(true);
		ssgobject.gameObject.SetActive(true);
		hmgObject.SetActive(true);
		hammerObject.SetActive(true);
		needlerObject.SetActive(true);
		shotgunObject.SetActive(false);
		ssgobject.gameObject.SetActive(false);
		hmgObject.SetActive(false);
		hammerObject.SetActive(false);
		needlerObject.SetActive(false);
	}

	private void Update()
	{
		//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)
		Scene activeScene = SceneManager.GetActiveScene();
		if (((Scene)(ref activeScene)).name == "KingEnderBrine_IDRS_Editor" && Input.anyKeyDown)
		{
			EquippedGun? equippedGun = null;
			if (Input.GetKeyDown((KeyCode)49))
			{
				equippedGun = EquippedGun.GUN;
			}
			if (Input.GetKeyDown((KeyCode)50))
			{
				equippedGun = EquippedGun.SUPER;
			}
			if (Input.GetKeyDown((KeyCode)51))
			{
				equippedGun = EquippedGun.HMG;
			}
			if (Input.GetKeyDown((KeyCode)52))
			{
				equippedGun = EquippedGun.HAMMER;
			}
			if (Input.GetKeyDown((KeyCode)53))
			{
				equippedGun = EquippedGun.NEEDLER;
			}
			if (equippedGun.HasValue)
			{
				HideWeapons();
				EquipWeapon(equippedGun.Value);
			}
		}
	}

	private void EquipWeapon(EquippedGun weapon)
	{
		switch (weapon)
		{
		default:
			shotgunObject.SetActive(true);
			break;
		case EquippedGun.SUPER:
			ssgobject.SetActive(true);
			break;
		case EquippedGun.HMG:
			hmgObject.SetActive(true);
			break;
		case EquippedGun.HAMMER:
			hammerObject.SetActive(true);
			break;
		case EquippedGun.NEEDLER:
			needlerObject.SetActive(true);
			break;
		}
	}
}
internal class EnforcerLightController : MonoBehaviour
{
	public uint playID;

	public bool sirenToggle;

	public float lightFlashInterval = 0.5f;

	private float flashDuration;

	private Light[] lights;

	private float lightStopwatch;

	private int lightFlashes;

	private CharacterBody characterBody;

	private ChildLocator childLocator;

	private float flashStopwatch;

	private bool sex;

	private void Start()
	{
		if (!sex)
		{
			InitLights();
		}
	}

	private void InitLights()
	{
		sex = true;
		sirenToggle = false;
		characterBody = ((Component)this).gameObject.GetComponent<CharacterBody>();
		childLocator = ((Component)this).gameObject.GetComponentInChildren<ChildLocator>();
		flashDuration = 0.5f;
	}

	private void FixedUpdate()
	{
		HandleShoulderLights();
	}

	private void HandleShoulderLights()
	{
		if (sirenToggle)
		{
			flashStopwatch -= Time.fixedDeltaTime;
			if (flashStopwatch <= 0f)
			{
				flashStopwatch = lightFlashInterval;
				FlashLights(1);
			}
		}
		lightStopwatch -= Time.fixedDeltaTime;
		if (lightStopwatch <= 0.5f * flashDuration && lightStopwatch <= 0f && lightFlashes > 0)
		{
			lightFlashes--;
			FlashLights(0);
		}
	}

	private void EnableLights()
	{
		if (!sex)
		{
			InitLights();
		}
	}

	public void FlashLights(int flashCount)
	{
		lightFlashes += flashCount;
		lightStopwatch = flashDuration;
		EnableLights();
	}

	public void ToggleSiren()
	{
		sirenToggle = !sirenToggle;
		if (sirenToggle)
		{
			string text = Sounds.SirenButton;
			if (Object.op_Implicit((Object)(object)characterBody) && Config.cursed.Value && Skins.isEnforcerCurrentSkin(characterBody, Skins.EnforcerSkin.FUCKINGFROG))
			{
				text = Sounds.Croak;
			}
			playID = Util.PlaySound(text, ((Component)this).gameObject);
			flashStopwatch = 0f;
		}
		else if (playID != 0)
		{
			AkSoundEngine.StopPlayingID(playID);
		}
	}

	private void OnDestroy()
	{
		if (playID != 0)
		{
			AkSoundEngine.StopPlayingID(playID);
		}
	}
}
internal class EnforcerLightControllerAlt : MonoBehaviour
{
	public bool sirenToggle;

	public float lightFlashInterval = 0.5f;

	public float maxEmission = 35f;

	public float minEmission = 1f;

	public float emUp = 200f;

	public float emDown = 200f;

	public float flashDuration = 0.25f;

	private float em;

	private Material[] lights;

	private bool lightsOn;

	private float lightStopwatch;

	private int lightFlashes;

	private CharacterBody characterBody;

	private ChildLocator childLocator;

	private CharacterModel characterModel;

	private float flashStopwatch;

	private bool sex;

	private void Awake()
	{
		childLocator = ((Component)this).gameObject.GetComponentInChildren<ChildLocator>();
		characterModel = ((Component)this).gameObject.GetComponentInChildren<CharacterModel>();
		((MonoBehaviour)this).Invoke("InitLights", 0.25f);
	}

	private void InitLights()
	{
		em = minEmission;
		sex = true;
		sirenToggle = false;
		characterBody = ((Component)this).gameObject.GetComponent<CharacterBody>();
		if (Object.op_Implicit((Object)(object)characterBody))
		{
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				int num = Mathf.Max(0, 2 - characterModel.baseRendererInfos.Length);
				lights = (Material[])(object)new Material[1] { characterModel.baseRendererInfos[7].defaultMaterial };
			}
		}
		else
		{
			List<Material> list = new List<Material>();
			CharacterModel component = ((Component)this).GetComponent<CharacterModel>();
			int num2 = Mathf.Max(0, 2 - component.baseRendererInfos.Length);
			list.Add(component.baseRendererInfos[7].defaultMaterial);
			lights = list.ToArray();
		}
	}

	private void FixedUpdate()
	{
		HandleShoulderLights();
	}

	private void HandleShoulderLights()
	{
		flashStopwatch -= Time.fixedDeltaTime;
		if (sirenToggle && flashStopwatch <= 0f)
		{
			flashStopwatch = lightFlashInterval;
			FlashLights(1);
		}
		lightStopwatch -= Time.fixedDeltaTime;
		if (lightStopwatch <= 0.5f * flashDuration)
		{
			lightsOn = false;
			if (lightStopwatch <= 0f && lightFlashes > 0)
			{
				lightFlashes--;
				FlashLights(0);
			}
		}
		if (lightsOn)
		{
			em += emUp * Time.fixedDeltaTime;
		}
		else
		{
			em -= emDown * Time.fixedDeltaTime;
		}
		em = Mathf.Clamp(em, minEmission, maxEmission);
		if (lights != null && lights.Length != 0)
		{
			Material[] array = lights;
			foreach (Material val in array)
			{
				val.SetFloat("_EmPower", em);
			}
		}
	}

	private void EnableLights()
	{
		if (!sex)
		{
			InitLights();
		}
		lightsOn = true;
	}

	public void FlashLights(int flashCount)
	{
		lightFlashes += flashCount;
		lightStopwatch = flashDuration;
		EnableLights();
	}

	public void ToggleSiren()
	{
		sirenToggle = !sirenToggle;
		if (sirenToggle)
		{
			string sirenButton = Sounds.SirenButton;
			if (Object.op_Implicit((Object)(object)characterBody) && Config.cursed.Value && Skins.isEnforcerCurrentSkin(characterBody, Skins.EnforcerSkin.FUCKINGFROG))
			{
				sirenButton = Sounds.Croak;
			}
			flashStopwatch = 0f;
		}
	}
}
public class EnforcerNetworkComponent : NetworkBehaviour
{
	[SyncVar]
	public int parries;

	private int skin;

	private static int kCmdCmdApplySkin;

	private static int kRpcRpcApplySkin;

	private static int kCmdCmdApplyBungus;

	private static int kRpcRpcApplyBungus;

	private static int kCmdCmdApplyDoor;

	private static int kRpcRpcApplyDoor;

	public int Networkparries
	{
		get
		{
			return parries;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<int>(value, ref parries, 1u);
		}
	}

	public void Uhh(int skin)
	{
		if (skin != -1)
		{
			if (NetworkServer.active)
			{
				CallRpcApplySkin(skin);
			}
			else
			{
				CallCmdApplySkin(skin);
			}
		}
	}

	[Command]
	public void CmdApplySkin(int skin)
	{
		CallRpcApplySkin(skin);
	}

	[ClientRpc]
	public void RpcApplySkin(int skin)
	{
		ApplySkin(skin);
	}

	private void ApplySkin(int skin)
	{
		((Component)((Component)this).GetComponent<CharacterBody>().modelLocator.modelTransform).GetComponent<ModelSkinController>().ApplySkin(skin);
		((MonoBehaviour)this).StartCoroutine(fuckthis(skin));
	}

	public IEnumerator fuckthis(int skin)
	{
		yield return (object)new WaitForSeconds(1f);
		((Component)((Component)this).GetComponent<CharacterBody>().modelLocator.modelTransform).GetComponent<ModelSkinController>().ApplySkin(skin);
	}

	public void UhhBungus(bool shouldApply)
	{
		if (NetworkServer.active)
		{
			CallRpcApplyBungus(shouldApply);
		}
		else
		{
			CallCmdApplyBungus(shouldApply);
		}
	}

	[Command]
	private void CmdApplyBungus(bool shouldApply)
	{
		CallRpcApplyBungus(shouldApply);
	}

	[ClientRpc]
	private void RpcApplyBungus(bool shouldApply)
	{
		ApplyBungus(shouldApply);
	}

	private void ApplyBungus(bool shouldApply)
	{
		SkinDef val = (shouldApply ? Skins.engiBungusSkin : Skins.engiNormalSkin);
		val.Apply(((Component)((Component)this).GetComponent<CharacterBody>().modelLocator.modelTransform).gameObject);
	}

	public void UhhDoor()
	{
		if (NetworkServer.active)
		{
			CallRpcApplyDoor();
		}
		else
		{
			CallCmdApplyDoor();
		}
	}

	[Command]
	private void CmdApplyDoor()
	{
		CallRpcApplyDoor();
	}

	[ClientRpc]
	private void RpcApplyDoor()
	{
		ApplyDoor();
	}

	private void ApplyDoor()
	{
		Skins.podDoorSkin.Apply(((Component)((Component)this).GetComponent<CharacterBody>().modelLocator.modelTransform).gameObject);
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeCmdCmdApplySkin(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"Command CmdApplySkin called on client.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).CmdApplySkin((int)reader.ReadPackedUInt32());
		}
	}

	protected static void InvokeCmdCmdApplyBungus(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"Command CmdApplyBungus called on client.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).CmdApplyBungus(reader.ReadBoolean());
		}
	}

	protected static void InvokeCmdCmdApplyDoor(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"Command CmdApplyDoor called on client.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).CmdApplyDoor();
		}
	}

	public void CallCmdApplySkin(int skin)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"Command function CmdApplySkin called on server.");
			return;
		}
		if (((NetworkBehaviour)this).isServer)
		{
			CmdApplySkin(skin);
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)5);
		val.WritePackedUInt32((uint)kCmdCmdApplySkin);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.WritePackedUInt32((uint)skin);
		((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdApplySkin");
	}

	public void CallCmdApplyBungus(bool shouldApply)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"Command function CmdApplyBungus called on server.");
			return;
		}
		if (((NetworkBehaviour)this).isServer)
		{
			CmdApplyBungus(shouldApply);
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)5);
		val.WritePackedUInt32((uint)kCmdCmdApplyBungus);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(shouldApply);
		((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdApplyBungus");
	}

	public void CallCmdApplyDoor()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"Command function CmdApplyDoor called on server.");
			return;
		}
		if (((NetworkBehaviour)this).isServer)
		{
			CmdApplyDoor();
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)5);
		val.WritePackedUInt32((uint)kCmdCmdApplyDoor);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdApplyDoor");
	}

	protected static void InvokeRpcRpcApplySkin(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcApplySkin called on server.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).RpcApplySkin((int)reader.ReadPackedUInt32());
		}
	}

	protected static void InvokeRpcRpcApplyBungus(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcApplyBungus called on server.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).RpcApplyBungus(reader.ReadBoolean());
		}
	}

	protected static void InvokeRpcRpcApplyDoor(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcApplyDoor called on server.");
		}
		else
		{
			((EnforcerNetworkComponent)(object)obj).RpcApplyDoor();
		}
	}

	public void CallRpcApplySkin(int skin)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcApplySkin called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcApplySkin);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.WritePackedUInt32((uint)skin);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcApplySkin");
	}

	public void CallRpcApplyBungus(bool shouldApply)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcApplyBungus called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcApplyBungus);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(shouldApply);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcApplyBungus");
	}

	public void CallRpcApplyDoor()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcApplyDoor called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcApplyDoor);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcApplyDoor");
	}

	static EnforcerNetworkComponent()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Expected O, but got Unknown
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Expected O, but got Unknown
		kCmdCmdApplySkin = -520989940;
		NetworkBehaviour.RegisterCommandDelegate(typeof(EnforcerNetworkComponent), kCmdCmdApplySkin, new CmdDelegate(InvokeCmdCmdApplySkin));
		kCmdCmdApplyBungus = 1362526905;
		NetworkBehaviour.RegisterCommandDelegate(typeof(EnforcerNetworkComponent), kCmdCmdApplyBungus, new CmdDelegate(InvokeCmdCmdApplyBungus));
		kCmdCmdApplyDoor = -521432771;
		NetworkBehaviour.RegisterCommandDelegate(typeof(EnforcerNetworkComponent), kCmdCmdApplyDoor, new CmdDelegate(InvokeCmdCmdApplyDoor));
		kRpcRpcApplySkin = -2113921034;
		NetworkBehaviour.RegisterRpcDelegate(typeof(EnforcerNetworkComponent), kRpcRpcApplySkin, new CmdDelegate(InvokeRpcRpcApplySkin));
		kRpcRpcApplyBungus = -435897053;
		NetworkBehaviour.RegisterRpcDelegate(typeof(EnforcerNetworkComponent), kRpcRpcApplyBungus, new CmdDelegate(InvokeRpcRpcApplyBungus));
		kRpcRpcApplyDoor = -2114363865;
		NetworkBehaviour.RegisterRpcDelegate(typeof(EnforcerNetworkComponent), kRpcRpcApplyDoor, new CmdDelegate(InvokeRpcRpcApplyDoor));
		NetworkCRC.RegisterBehaviour("EnforcerNetworkComponent", 0);
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.WritePackedUInt32((uint)parries);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.WritePackedUInt32((uint)parries);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		if (initialState)
		{
			parries = (int)reader.ReadPackedUInt32();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			parries = (int)reader.ReadPackedUInt32();
		}
	}
}
public class EnforcerVRComponent : MonoBehaviour
{
	private Transform skateboardBase;

	private GameObject VRSkateboard;

	private Transform VRSkateboardHandBase;

	private bool isSkating;

	private EnforcerComponent enforcerComponent;

	private EnforcerWeaponComponent enforcerWeaponComponent;

	public CharacterBody charBody;

	public void InitSkateBoardBase(Transform skateboardBase)
	{
		this.skateboardBase = skateboardBase;
	}

	private void OnEnable()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		if (EnforcerModPlugin.VREnabled)
		{
			SubscribeToHandPairEvent();
			BaseState.GetAimRay += new hook_GetAimRay(EditAimRay);
		}
	}

	private void OnDisable()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		if (EnforcerModPlugin.VREnabled)
		{
			UnsubscribeToHandPairEvent();
			BaseState.GetAimRay -= new hook_GetAimRay(EditAimRay);
		}
	}

	private Ray EditAimRay(orig_GetAimRay orig, BaseState self)
	{
		//IL_0061: 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_0069: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: 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)
		if (VRAPICompat.IsLocalVRPlayer(charBody) && ((Object)((EntityState)self).characterBody).name.Contains("EnforcerBody") && self is ShieldBash)
		{
			return new Ray(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward);
		}
		return orig.Invoke(self);
	}

	private void SubscribeToHandPairEvent()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Combine((Delegate?)(object)MotionControls.onHandPairSet, (Delegate?)new SetHandPairEventHandler(OnHandPairSet));
	}

	private void UnsubscribeToHandPairEvent()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Remove((Delegate?)(object)MotionControls.onHandPairSet, (Delegate?)new SetHandPairEventHandler(OnHandPairSet));
	}

	private void OnHandPairSet(CharacterBody body)
	{
		if (((Object)body).name.Contains("EnforcerBody") && !((Object)(object)((Component)this).GetComponent<CharacterBody>() != (Object)(object)body))
		{
			charBody = body;
			((MonoBehaviour)this).StartCoroutine((IEnumerator)SetVRWeaponAndShield(body));
		}
	}

	private IEnumerator<WaitForSeconds> SetVRWeaponAndShield(CharacterBody body)
	{
		yield return new WaitForSeconds(0.5f);
		enforcerComponent = ((Component)this).GetComponent<EnforcerComponent>();
		enforcerWeaponComponent = ((Component)this).GetComponent<EnforcerWeaponComponent>();
		if (Object.op_Implicit((Object)(object)enforcerComponent))
		{
			enforcerComponent.origOrigin = MotionControls.dominantHand.muzzle;
		}
		ChildLocator vrWeaponChildLocator = ((Component)MotionControls.dominantHand.transform).GetComponentInChildren<ChildLocator>();
		ChildLocator vrShieldChildLocator = ((Component)MotionControls.nonDominantHand.transform).GetComponentInChildren<ChildLocator>();
		if (!Object.op_Implicit((Object)(object)vrWeaponChildLocator) || !Object.op_Implicit((Object)(object)vrShieldChildLocator))
		{
			yield break;
		}
		GameObject donminHandObj = ((Component)vrWeaponChildLocator.FindChild("HandModel")).gameObject;
		List<GameObject> allVRWeapons = new List<GameObject>
		{
			((Component)vrWeaponChildLocator.FindChild("GunModel")).gameObject,
			((Component)vrWeaponChildLocator.FindChild("SuperGunModel")).gameObject,
			((Component)vrWeaponChildLocator.FindChild("HMGModel")).gameObject,
			((Component)vrWeaponChildLocator.FindChild("RobotArmModel")).gameObject,
			((Component)vrWeaponChildLocator.FindChild("HammerModel")).gameObject,
			((Component)vrWeaponChildLocator.FindChild("NemHammerModel")).gameObject
		};
		foreach (GameObject weaponObject in allVRWeapons)
		{
			weaponObject.SetActive(true);
			weaponObject.SetActive(false);
		}
		EnforcerWeaponComponent.EquippedGun weapon = enforcerWeaponComponent.GetWeapon();
		Transform muzzle = MotionControls.dominantHand.muzzle;
		if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.ROBIT))
		{
			EnforcerWeaponComponent.EquippedGun equippedGun = weapon;
			EnforcerWeaponComponent.EquippedGun equippedGun2 = equippedGun;
			if ((uint)equippedGun2 <= 2u || equippedGun2 != EnforcerWeaponComponent.EquippedGun.HAMMER)
			{
				donminHandObj.SetActive(false);
				allVRWeapons[3].SetActive(true);
				muzzle.localPosition = new Vector3(0.0128f, -0.0911f, 0.2719f);
			}
			else
			{
				if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.RECOLORNEMESIS))
				{
					allVRWeapons[5].SetActive(true);
				}
				else
				{
					allVRWeapons[4].SetActive(true);
				}
				muzzle.localPosition = new Vector3(0.01657f, -0.21657f, 0.81805f);
			}
		}
		else
		{
			switch (weapon)
			{
			default:
				allVRWeapons[1].SetActive(true);
				muzzle.localPosition = new Vector3(0.01297f, -0.2533f, 0.8785f);
				break;
			case EnforcerWeaponComponent.EquippedGun.HMG:
				allVRWeapons[2].SetActive(true);
				muzzle.localPosition = new Vector3(0.01657f, -0.21657f, 0.81805f);
				break;
			case EnforcerWeaponComponent.EquippedGun.HAMMER:
				allVRWeapons[4].SetActive(true);
				muzzle.localPosition = new Vector3(0.0156f, -0.025f, 0.0853f);
				break;
			case EnforcerWeaponComponent.EquippedGun.GUN:
			{
				allVRWeapons[0].SetActive(true);
				Skins.EnforcerSkin[] sameShotgunSkins = new Skins.EnforcerSkin[5]
				{
					Skins.EnforcerSkin.GRANDMASTERY,
					Skins.EnforcerSkin.RECOLORNEMESIS,
					Skins.EnforcerSkin.RECOLORDESPERADO,
					Skins.EnforcerSkin.RECOLORENGI,
					Skins.EnforcerSkin.RECOLORDOOM
				};
				for (int i = 0; i < sameShotgunSkins.Length; i++)
				{
					if (Skins.isEnforcerCurrentSkin(charBody, sameShotgunSkins[i]))
					{
						MotionControls.dominantHand.rendererInfos[0].defaultMaterial = Skins.skinDefs[(int)body.skinIndex].rendererInfos[3].defaultMaterial;
					}
				}
				break;
			}
			}
		}
		VRSkateboardHandBase = vrShieldChildLocator.FindChild("SkateboardHandBase");
		List<GameObject> allVRShields = new List<GameObject>
		{
			((Component)vrShieldChildLocator.FindChild("ShieldModel")).gameObject,
			((Component)vrShieldChildLocator.FindChild("GlassShieldModel")).gameObject,
			((Component)vrShieldChildLocator.FindChild("FemShieldModel")).gameObject,
			((Component)vrShieldChildLocator.FindChild("SteveShieldModel")).gameObject,
			((Component)vrShieldChildLocator.FindChild("N4CRShieldModel")).gameObject,
			((Component)vrShieldChildLocator.FindChild("Skateboard")).gameObject,
			((Component)vrShieldChildLocator.FindChild("FemSkateboard")).gameObject
		};
		foreach (GameObject shieldObject in allVRShields)
		{
			shieldObject.SetActive(true);
			shieldObject.SetActive(false);
		}
		EnforcerWeaponComponent.EquippedShield shield = enforcerWeaponComponent.GetShield();
		EnforcerWeaponComponent.EquippedShield equippedShield = shield;
		EnforcerWeaponComponent.EquippedShield equippedShield2 = equippedShield;
		if (equippedShield2 == EnforcerWeaponComponent.EquippedShield.SHIELD || equippedShield2 != EnforcerWeaponComponent.EquippedShield.BOARD)
		{
			if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.MASTERY))
			{
				allVRShields[1].SetActive(true);
			}
			else if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.FEMFORCER))
			{
				allVRShields[2].SetActive(true);
			}
			else if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.FUCKINGSTEVE))
			{
				allVRShields[3].SetActive(true);
			}
			else if (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.ROBIT))
			{
				allVRShields[4].SetActive(true);
			}
			else
			{
				allVRShields[0].SetActive(true);
			}
			MotionControls.nonDominantHand.rendererInfos[0].defaultMaterial = Skins.skinDefs[(int)body.skinIndex].rendererInfos[0].defaultMaterial;
		}
		else
		{
			GameObject skateboard = (Skins.isEnforcerCurrentSkin(body, Skins.EnforcerSkin.FEMFORCER) ? allVRShields[6] : allVRShields[5]);
			skateboard.SetActive(true);
			VRSkateboard = skateboard.gameObject;
		}
	}

	public void ReparentSkateboard(EnforcerWeaponComponent.SkateBoardParent newParent)
	{
		//IL_0072: 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)
		switch (newParent)
		{
		case EnforcerWeaponComponent.SkateBoardParent.BASE:
			isSkating = true;
			break;
		case EnforcerWeaponComponent.SkateBoardParent.HAND:
			isSkating = false;
			if (VRAPICompat.IsLocalVRPlayer(charBody) && Object.op_Implicit((Object)(object)VRSkateboard) && Object.op_Implicit((Object)(object)VRSkateboardHandBase))
			{
				VRSkateboard.transform.SetParent(VRSkateboardHandBase);
				VRSkateboard.transform.localPosition = Vector3.zero;
				VRSkateboard.transform.localRotation = Quaternion.identity;
			}
			break;
		}
	}

	private void LateUpdate()
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		if (!VRAPICompat.IsLocalVRPlayer(charBody))
		{
			return;
		}
		if (isSkating && Object.op_Implicit((Object)(object)VRSkateboard) && Object.op_Implicit((Object)(object)VRSkateboardHandBase))
		{
			VRSkateboard.transform.SetParent(skateboardBase);
			VRSkateboard.transform.localPosition = Vector3.zero;
			VRSkateboard.transform.localRotation = Quaternion.identity;
			VRSkateboard.transform.SetParent(VRSkateboardHandBase);
		}
		if ((!Config.physicalVRShieldUp.Value && !Config.physicalVRShieldDown.Value) || !Object.op_Implicit((Object)(object)enforcerWeaponComponent) || enforcerWeaponComponent.GetShield() != 0 || !Object.op_Implicit((Object)(object)enforcerComponent))
		{
			return;
		}
		float num = -0.3f * ((MotionControls.dominantHand == MotionControls.rightHand) ? (-1f) : 1f);
		Vector3 val = MotionControls.nonDominantHand.muzzle.position + ((Component)Camera.main).transform.right * num - ((Component)Camera.main).transform.position;
		bool flag = Vector3.Dot(((Component)Camera.main).transform.forward, val) > 0f;
		bool flag2 = Vector3.Cross(((Component)Camera.main).transform.forward, val).y > 0f;
		bool flag3 = ((MotionControls.dominantHand == MotionControls.rightHand) ? flag2 : (!flag2));
		float num2 = Vector3.Angle(MotionControls.nonDominantHand.muzzle.forward, Vector3.down);
		bool flag4 = num2 < (float)(90 - Config.physicalVRShieldDownAngle.Value);
		if (Config.physicalVRShieldDown.Value && enforcerComponent.isShielding)
		{
			if (flag4)
			{
				charBody.skillLocator.special.ExecuteIfReady();
			}
		}
		else if (Config.physicalVRShieldUp.Value && !enforcerComponent.isShielding)
		{
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(((Component)Camera.main).transform.forward.x, 0f, ((Component)Camera.main).transform.forward.z);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(val.x, 0f, val.z);
			float num3 = Vector3.Angle(val2, val3);
			if (!flag4 && flag && flag3 && num3 > 20f)
			{
				charBody.skillLocator.special.ExecuteIfReady();
			}
		}
	}
}
public class EnforcerWeaponComponent : MonoBehaviour
{
	public enum EquippedGun
	{
		NONE = -1,
		GUN,
		SUPER,
		HMG,
		HAMMER,
		NEEDLER
	}

	public enum EquippedShield
	{
		NONE = -1,
		SHIELD,
		SHIELD2,
		BOARD,
		NOTHING
	}

	public enum SkateBoardParent
	{
		BASE,
		HAND
	}

	private List<GameObject> _allWeapons;

	public EquippedGun currentGun = EquippedGun.NONE;

	public EquippedShield currentShield = EquippedShield.NONE;

	public bool isMultiplayer;

	public static int maxShellCount = 12;

	private int currentShell;

	private GameObject[] shellObjects;

	public bool shieldUp;

	private GameObject skateboard;

	private Transform skateboardBase;

	private Transform skateboardHandBase;

	private string stepSoundString;

	private string landSoundString;

	public CharacterBody charBody;

	public CharacterMotor charMotor;

	public HealthComponent charHealth;

	public CameraTargetParams cameraShit;

	public ChildLocator childLocator;

	private EnforcerVRComponent enforcerVRComponent;

	private bool _transformationApplied;

	public FootstepHandler footStep;

	public SfxLocator sfx;

	private GameObject shotgunObject => ((Component)childLocator.FindChild("GunModel")).gameObject;

	private GameObject ssgobject => ((Component)childLocator.FindChild("SuperGunModel")).gameObject;

	private GameObject hmgObject => ((Component)childLocator.FindChild("HMGModel")).gameObject;

	private GameObject hammerObject => ((Component)childLocator.FindChild("HammerModel")).gameObject;

	private GameObject needlerObject => ((Component)childLocator.FindChild("NeedlerModel")).gameObject;

	private GameObject shieldModelObject => ((Component)childLocator.FindChild("ShieldModel")).gameObject;

	private Transform shieldBoneTransform => childLocator.FindChild("Shield");

	private GameObject skateBoardObject => ((Component)childLocator.FindChild("SkamteBordModel")).gameObject;

	private List<GameObject> allWeapons
	{
		get
		{
			if (_allWeapons != null)
			{
				return _allWeapons;
			}
			_allWeapons = new List<GameObject> { shotgunObject, ssgobject, hmgObject, hammerObject, needlerObject };
			_allWeapons.RemoveAll((GameObject gob) => (Object)(object)gob == (Object)null);
			return _allWeapons;
		}
	}

	public void Init()
	{
		charBody = ((Component)this).GetComponentInChildren<CharacterBody>();
		charMotor = ((Component)this).GetComponentInChildren<CharacterMotor>();
		charHealth = ((Component)this).GetComponentInChildren<HealthComponent>();
		cameraShit = ((Component)this).GetComponent<CameraTargetParams>();
		childLocator = ((Component)this).GetComponentInChildren<ChildLocator>();
		footStep = ((Component)this).GetComponentInChildren<FootstepHandler>();
		sfx = ((Component)this).GetComponentInChildren<SfxLocator>();
		if (Object.op_Implicit((Object)(object)footStep))
		{
			stepSoundString = footStep.baseFootstepString;
		}
		if (Object.op_Implicit((Object)(object)sfx))
		{
			landSoundString = sfx.landingSound;
		}
	}

	private void Awake()
	{
		if (EnforcerModPlugin.VREnabled)
		{
			enforcerVRComponent = ((Component)this).GetComponent<EnforcerVRComponent>();
		}
	}

	private void Start()
	{
		SetWeaponsAndShields();
		InitShells();
		InitSkateboard();
		((MonoBehaviour)this).Invoke("ModelCheck", 0.2f);
		charBody.onInventoryChanged += Inventory_onInventoryChanged;
	}

	private void OnDestroy()
	{
		if (shellObjects != null && shellObjects.Length != 0)
		{
			for (int i = 0; i < shellObjects.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)shellObjects[i]))
				{
					Object.Destroy((Object)(object)shellObjects[i]);
				}
			}
		}
		charBody.onInventoryChanged -= Inventory_onInventoryChanged;
	}

	public void SetWeaponsAndShields()
	{
		EquippedGun weapon = GetWeapon();
		if (weapon != currentGun)
		{
			currentGun = weapon;
			HideWeapons();
			EquipWeapon(weapon);
			SetCrosshair(weapon);
		}
		EquippedShield shield = GetShield();
		if (shield != currentShield)
		{
			currentShield = shield;
			HideSpecials();
			EquipShield(shield);
			SetShieldDisplayRules(shield);
		}
	}

	public void HideEquips()
	{
		HideWeapons();
		HideSpecials();
	}

	public void UnHideEquips()
	{
		EquipWeapon(currentGun);
		EquipShield(currentShield);
	}

	public void HideWeapons()
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			for (int i = 0; i < allWeapons.Count; i++)
			{
				allWeapons[i].SetActive(true);
				allWeapons[i].SetActive(false);
			}
		}
	}

	public void HideSpecials()
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			showShield(show: false);
			skateBoardObject.SetActive(false);
		}
	}

	public EquippedGun GetWeapon()
	{
		EquippedGun result = EquippedGun.GUN;
		if (Object.op_Implicit((Object)(object)charBody) && Object.op_Implicit((Object)(object)charBody.skillLocator))
		{
			result = charBody.skillLocator.primary.skillDef.skillNameToken switch
			{
				"ENFORCER_PRIMARY_SUPERSHOTGUN_NAME" => EquippedGun.SUPER, 
				"ENFORCER_PRIMARY_RIFLE_NAME" => EquippedGun.HMG, 
				"ENFORCER_PRIMARY_HAMMER_NAME" => EquippedGun.HAMMER, 
				"SKILL_LUNAR_PRIMARY_REPLACEMENT_NAME" => EquippedGun.NEEDLER, 
				_ => EquippedGun.GUN, 
			};
		}
		return result;
	}

	private void EquipWeapon(EquippedGun weapon)
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			switch (weapon)
			{
			default:
				shotgunObject.SetActive(true);
				break;
			case EquippedGun.SUPER:
				ssgobject.SetActive(true);
				break;
			case EquippedGun.HMG:
				hmgObject.SetActive(true);
				break;
			case EquippedGun.HAMMER:
				hammerObject.SetActive(true);
				break;
			case EquippedGun.NEEDLER:
				needlerObject.SetActive(true);
				break;
			}
		}
	}

	private void SetCrosshair(EquippedGun weapon)
	{
		if (Object.op_Implicit((Object)(object)charBody))
		{
			switch (weapon)
			{
			case EquippedGun.GUN:
			case EquippedGun.SUPER:
			case EquippedGun.HMG:
				charBody._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/SMGCrosshair");
				break;
			case EquippedGun.HAMMER:
				charBody._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/SimpleDotCrosshair");
				break;
			case EquippedGun.NEEDLER:
				charBody._defaultCrosshairPrefab = EnforcerModPlugin.needlerCrosshair;
				break;
			}
		}
	}

	public void DelayedResetWeaponsAndShields()
	{
		((MonoBehaviour)this).Invoke("ResetWeaponsAndShields", 0.1f);
	}

	public void ResetWeaponsAndShields()
	{
		SetWeaponsAndShields();
	}

	public EquippedShield GetShield()
	{
		EquippedShield result = EquippedShield.SHIELD;
		if (Object.op_Implicit((Object)(object)charBody) && Object.op_Implicit((Object)(object)charBody.skillLocator))
		{
			switch (charBody.skillLocator.special.skillDef.skillNameToken)
			{
			case "ENFORCER_SPECIAL_SHIELDUP_NAME":
			case "ENFORCER_SPECIAL_SHIELDDOWN_NAME":
				result = EquippedShield.SHIELD;
				break;
			case "ENFORCER_SPECIAL_SHIELDON_NAME":
			case "ENFORCER_SPECIAL_SHIELDOFF_NAME":
				result = EquippedShield.SHIELD2;
				break;
			case "ENFORCER_SPECIAL_BOARDUP_NAME":
			case "ENFORCER_SPECIAL_BOARDDOWN_NAME":
				result = EquippedShield.BOARD;
				break;
			default:
				result = EquippedShield.NOTHING;
				break;
			}
		}
		return result;
	}

	private void EquipShield(EquippedShield shield)
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			switch (shield)
			{
			default:
				showShield(show: true);
				break;
			case EquippedShield.SHIELD2:
				showShield(show: false);
				break;
			case EquippedShield.BOARD:
				skateBoardObject.SetActive(true);
				break;
			case EquippedShield.NOTHING:
				break;
			}
		}
	}

	private void showShield(bool show)
	{
		//IL_001e: 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)
		shieldModelObject.SetActive(show);
		shieldBoneTransform.localScale = (show ? Vector3.one : Vector3.zero);
	}

	private void SetShieldDisplayRules(EquippedShield shield)
	{
	}

	private void Inventory_onInventoryChanged()
	{
		DelayedResetWeaponsAndShields();
		ModelCheck();
	}

	public void ModelCheck()
	{
		if (Object.op_Implicit((Object)(object)charBody) && Object.op_Implicit((Object)(object)charBody.master) && Object.op_Implicit((Object)(object)charBody.master.inventory) && _transformationApplied != Skins.isEnforcerCurrentSkin(charBody, Skins.EnforcerSkin.RECOLORENGIBUNG))
		{
			_transformationApplied = Skins.isEnforcerCurrentSkin(charBody, Skins.EnforcerSkin.RECOLORENGIBUNG);
			((Component)this).GetComponent<EnforcerNetworkComponent>().UhhBungus(_transformationApplied);
		}
	}

	private void InitShells()
	{
		//IL_0076: 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)
		if (childLocator != null)
		{
			currentShell = 0;
			shellObjects = (GameObject[])(object)new GameObject[maxShellCount + 1];
			GameObject val = Asset.shotgunShell;
			if (GetWeapon() == EquippedGun.SUPER)
			{
				val = Asset.superShotgunShell;
			}
			for (int i = 0; i < maxShellCount; i++)
			{
				shellObjects[i] = Object.Instantiate<GameObject>(val, childLocator.FindChild("Gun"), false);
				shellObjects[i].transform.localScale = Vector3.one * 1.1f;
				shellObjects[i].SetActive(false);
				shellObjects[i].GetComponent<Rigidbody>().collisionDetectionMode = (CollisionDetectionMode)1;
			}
		}
	}

	public void DropShell(Vector3 force)
	{
		//IL_0067: 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)
		if (shellObjects != null && !((Object)(object)shellObjects[currentShell] == (Object)null))
		{
			Transform val = childLocator.FindChild("Muzzle");
			shellObjects[currentShell].SetActive(false);
			shellObjects[currentShell].transform.position = val.position;
			shellObjects[currentShell].transform.SetParent((Transform)null);
			shellObjects[currentShell].SetActive(true);
			Rigidbody component = shellObjects[currentShell].gameObject.GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.velocity = force;
			}
			currentShell++;
			if (currentShell >= maxShellCount)
			{
				currentShell = 0;
			}
		}
	}

	private void InitSkateboard()
	{
		skateboard = ((Component)childLocator.FindChild("Skateboard")).gameObject;
		skateboardBase = childLocator.FindChild("BoardBase");
		skateboardHandBase = childLocator.FindChild("BoardHandBase");
		enforcerVRComponent?.InitSkateBoardBase(skateboardBase);
		ReparentSkateboard(SkateBoardParent.HAND);
	}

	public void ReparentSkateboard(SkateBoardParent newParent)
	{
		//IL_004c: 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)
		//IL_0117: 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)
		if (!Object.op_Implicit((Object)(object)skateboard))
		{
			return;
		}
		switch (newParent)
		{
		case SkateBoardParent.BASE:
			skateboard.transform.SetParent(skateboardBase);
			skateboard.transform.localPosition = Vector3.zero;
			if (Object.op_Implicit((Object)(object)footStep))
			{
				footStep.baseFootstepString = "";
			}
			if (Object.op_Implicit((Object)(object)sfx))
			{
				sfx.landingSound = Sounds.SkateLand;
			}
			break;
		case SkateBoardParent.HAND:
			skateboard.transform.SetParent(skateboardHandBase);
			skateboard.transform.localPosition = Vector3.zero;
			if (Object.op_Implicit((Object)(object)footStep))
			{
				footStep.baseFootstepString = stepSoundString;
			}
			if (Object.op_Implicit((Object)(object)sfx))
			{
				sfx.landingSound = landSoundString;
			}
			break;
		}
		skateboard.transform.localPosition = Vector3.zero;
		skateboard.transform.localRotation = Quaternion.identity;
		enforcerVRComponent?.ReparentSkateboard(newParent);
	}
}
public class MenuSoundComponent : MonoBehaviour
{
	private uint playIDSiren = 0u;

	private float takeOutGunDelay;

	private uint playIDGun = 0u;

	private void OnEnable()
	{
		playIDSiren = Util.PlaySound(Sounds.SirenDeflect, ((Component)this).gameObject);
		takeOutGunDelay = 3.5f;
		((MonoBehaviour)this).StartCoroutine(delayedGunSound());
		EnforcerLightController componentInChildren = ((Component)this).GetComponentInChildren<EnforcerLightController>();
		if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			componentInChildren.FlashLights(3);
		}
		EnforcerLightControllerAlt componentInChildren2 = ((Component)this).GetComponentInChildren<EnforcerLightControllerAlt>();
		if (Object.op_Implicit((Object)(object)componentInChildren2))
		{
			componentInChildren2.ToggleSiren();
		}
	}

	private IEnumerator delayedGunSound()
	{
		yield return (object)new WaitForSeconds(takeOutGunDelay);
		playIDGun = Util.PlaySound(Sounds.ShieldDown, ((Component)this).gameObject);
	}

	private void OnDestroy()
	{
		if (playIDSiren != 0)
		{
			AkSoundEngine.StopPlayingID(playIDSiren);
		}
		if (playIDGun != 0)
		{
			AkSoundEngine.StopPlayingID(playIDGun);
		}
	}
}
public class GrenadeController : MonoBehaviour
{
	public BlastAttack blastAttack;

	private float initialTime;

	private bool never = true;

	private GameObject explodePrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/effects/omnieffect/OmniExplosionVFX");

	private void Start()
	{
		initialTime = Time.fixedTime;
	}

	private void OnTriggerEnter(Collider other)
	{
		HurtBox component = ((Component)other).GetComponent<HurtBox>();
		if (Object.op_Implicit((Object)(object)component) && never)
		{
			never = false;
			explode();
		}
	}

	private void Update()
	{
		if (Time.fixedTime - initialTime > 2f)
		{
			explode();
		}
	}

	private void explode()
	{
		//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_0029: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		blastAttack.position = ((Component)this).transform.position;
		blastAttack.Fire();
		EffectData val = new EffectData();
		val.origin = ((Component)this).transform.position;
		val.scale = 5f;
		EffectManager.SpawnEffect(explodePrefab, val, false);
		Rigidbody componentInParent = ((Component)this).GetComponentInParent<Rigidbody>();
		Object.Destroy((Object)(object)((Component)componentInParent).gameObject);
	}
}
public class NemforcerController : MonoBehaviour
{
	private CharacterCameraParamsData minigunCameraParams = new CharacterCameraParamsData
	{
		maxPitch = BlendableFloat.op_Implicit(70f),
		minPitch = BlendableFloat.op_Implicit(-70f),
		pivotVerticalOffset = BlendableFloat.op_Implicit(1.37f),
		idealLocalCameraPos = BlendableVector3.op_Implicit(minigunCameraPosition),
		wallCushion = BlendableFloat.op_Implicit(0.1f)
	};

	private static Vector3 minigunCameraPosition = new Vector3(-2.2f, 0f, -9f);

	public CameraParamsOverrideHandle camOverrideHandle;

	private bool _minigunUp;

	public bool isMultiplayer;

	public SkillDef primarySkillDef;

	public EntityStateMachine mainStateMachine;

	private float maxLightningIntensity = 64f;

	private float maxMoonIntensity = 16f;

	private ParticleSystem passiveLightning;

	private ParticleSystem passiveMoons;

	private EmissionModule passiveLightningEm;

	private EmissionModule passiveMoonsEm;

	public ParticleSystem hammerChargeSmall;

	public ParticleSystem hammerChargeLarge;

	public ParticleSystem hammerBurst;

	private CharacterBody charBody;

	private CharacterMotor charMotor;

	private HealthComponent charHealth;

	private CameraTargetParams cameraShit;

	private ChildLocator childLocator;

	private Vector3 previousDirection;

	private float previousAngle;

	private bool passiveIsPlaying;

	private NemforcerVRController nemforcerVRController;

	public bool minigunUp
	{
		get
		{
			return _minigunUp;
		}
		set
		{
			_minigunUp = value;
			toggleMinigunCamera(value);
			nemforcerVRController?.VRMinigunToggle(value);
		}
	}

	private void Start()
	{
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		charBody = ((Component)this).GetComponent<CharacterBody>();
		charMotor = ((Component)this).GetComponent<CharacterMotor>();
		charHealth = ((Component)this).GetComponent<HealthComponent>();
		cameraShit = ((Component)this).GetComponent<CameraTargetParams>();
		childLocator = ((Component)charBody.modelLocator.modelTransform).GetComponent<ChildLocator>();
		if (EnforcerModPlugin.VREnabled)
		{
			nemforcerVRController = ((Component)this).GetComponentInChildren<NemforcerVRController>();
		}
		primarySkillDef = charBody.skillLocator.primary.skillDef;
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			hammerChargeSmall = ((Component)childLocator.FindChild("HammerChargeSmall")).gameObject.GetComponentInChildren<ParticleSystem>();
			hammerChargeLarge = ((Component)childLocator.FindChild("HammerChargeLarge")).gameObject.GetComponentInChildren<ParticleSystem>();
			hammerBurst = ((Component)childLocator.FindChild("HammerBurst")).gameObject.GetComponentInChildren<ParticleSystem>();
			passiveLightning = ((Component)childLocator.FindChild("PassiveHealEffect").GetChild(0)).gameObject.GetComponent<ParticleSystem>();
			passiveMoons = ((Component)childLocator.FindChild("PassiveHealEffect").GetChild(1)).gameObject.GetComponent<ParticleSystem>();
			passiveLightningEm = passiveLightning.emission;
			passiveMoonsEm = passiveMoons.emission;
			UpdatePassiveEffect();
		}
		InitWeapon();
		((MonoBehaviour)this).Invoke("ModelCheck", 0.2f);
		charBody.onInventoryChanged += Inventory_onInventoryChanged;
	}

	private void OnDestroy()
	{
		charBody.onInventoryChanged -= Inventory_onInventoryChanged;
	}

	private void Inventory_onInventoryChanged()
	{
		DelayedResetWeapon();
		ModelCheck();
	}

	private void FixedUpdate()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)mainStateMachine))
		{
			previousDirection = mainStateMachine.commonComponents.characterDirection.forward;
		}
		UpdatePassiveEffect();
	}

	private void UpdatePassiveEffect()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		if (charBody.bodyIndex == EnforcerModPlugin.DededeBodyIndex || (Object)(object)passiveLightning == (Object)null || (Object)(object)passiveMoons == (Object)null)
		{
			return;
		}
		float num = charHealth.combinedHealth / charHealth.fullCombinedHealth;
		int buffCount = charBody.GetBuffCount(Buffs.nemforcerRegenBuff);
		bool flag = buffCount > 0;
		if ((!NemforcerPlugin.reworkPassive.Value) ? (num <= 0.5f) : flag)
		{
			if (!passiveIsPlaying)
			{
				passiveIsPlaying = true;
				passiveLightning.Play();
				passiveMoons.Play();
			}
			float num2 = Mathf.InverseLerp(0.2f, 0.6f, num);
			if (flag)
			{
				num2 = Mathf.Max(0f, 1f - 0.2f * (float)buffCount);
			}
			((EmissionModule)(ref passiveLightningEm)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.SmoothStep(maxLightningIntensity, 0f, num2));
			((EmissionModule)(ref passiveMoonsEm)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.SmoothStep(maxMoonIntensity, 0f, num2));
		}
		else if (passiveIsPlaying)
		{
			passiveIsPlaying = false;
			passiveLightning.Stop();
			passiveMoons.Stop();
		}
	}

	private void toggleMinigunCamera(bool minigunUp)
	{
		//IL_0009: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_003c: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		if (minigunUp)
		{
			CameraParamsOverrideRequest val = default(CameraParamsOverrideRequest);
			val.cameraParamsData = minigunCameraParams;
			val.priority = 0f;
			CameraParamsOverrideRequest val2 = val;
			camOverrideHandle = cameraShit.AddParamsOverride(val2, 0.5f);
		}
		else
		{
			for (int num = cameraShit.cameraParamsOverrides.Count - 1; num >= 0; num--)
			{
				camOverrideHandle.target = cameraShit.cameraParamsOverrides[num];
				cameraShit.RemoveParamsOverride(camOverrideHandle, 0.3f);
			}
		}
	}

	public void ModelCheck()
	{
		if (!Object.op_Implicit((Object)(object)charBody) || !Object.op_Implicit((Object)(object)charBody.master) || charBody.baseNameToken == "DEDEDE_NAME" || !Object.op_Implicit((Object)(object)charBody.master.inventory))
		{
			return;
		}
		ModelLocator modelLocator = charBody.modelLocator;
		CharacterModel val = ((modelLocator != null) ? ((Component)modelLocator.modelTransform).GetComponentInChildren<CharacterModel>() : null);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.baseRendererInfos[0].defaultMaterial = ((Component)val).gameObject.GetComponent<ModelSkinController>().skins[charBody.skinIndex].rendererInfos[0].defaultMaterial;
			if (charBody.master.inventory.GetItemCount(Items.ArmorReductionOnHit) > 0)
			{
				val.baseRendererInfos[0].defaultMaterial = null;
			}
		}
	}

	public int GetWeapon()
	{
		int result = 0;
		if (Object.op_Implicit((Object)(object)charBody) && Object.op_Implicit((Object)(object)charBody.skillLocator))
		{
			string skillNameToken = primarySkillDef.skillNameToken;
			string text = skillNameToken;
			string text2 = text;
			if (!(text2 == "NEMFORCER_PRIMARY_HAMMER_NAME"))
			{
				if (text2 == "NEMFORCER_PRIMARY_THROWHAMMER_NAME")
				{
					result = 1;
				}
			}
			else
			{
				result = 0;
			}
		}
		return result;
	}

	public void InitWeapon()
	{
		if (!(charBody.baseNameToken == "DEDEDE_NAME"))
		{
			int weapon = GetWeapon();
			EquipWeapon(weapon);
			SetCrosshair(weapon);
		}
	}

	public void HideWeapon()
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			((Component)childLocator.FindChild("HammerModel")).gameObject.SetActive(false);
			((Component)childLocator.FindChild("AltHammer")).gameObject.SetActive(false);
		}
	}

	public void DelayedResetWeapon()
	{
		((MonoBehaviour)this).Invoke("ResetWeapon", 0.1f);
	}

	public void ResetCrosshair()
	{
		int weapon = GetWeapon();
		SetCrosshair(weapon);
	}

	private void EquipWeapon(int weapon)
	{
		if (Object.op_Implicit((Object)(object)childLocator))
		{
			HideWeapon();
			switch (weapon)
			{
			case 0:
				((Component)childLocator.FindChild("HammerModel")).gameObject.SetActive(true);
				break;
			case 1:
				((Component)childLocator.FindChild("AltHammer")).gameObject.SetActive(true);
				break;
			}
		}
	}

	private void SetCrosshair(int weapon)
	{
		if (!Object.op_Implicit((Object)(object)charBody))
		{
			return;
		}
		if (minigunUp)
		{
			charBody._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/BanditCrosshair");
			return;
		}
		switch (weapon)
		{
		case 0:
			charBody._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/SimpleDotCrosshair");
			break;
		case 1:
			charBody._defaultCrosshairPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
			break;
		}
	}

	public void resetAimAngle()
	{
		previousAngle = 0f;
	}

	public void pseudoAimMode(float angle)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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)
		Vector3 aimDirection = mainStateMachine.commonComponents.inputBank.aimDirection;
		pseudoAimMode(angle, aimDirection);
	}

	public void pseudoAimMode(float angle, Vector3 aimDirection)
	{
		//IL_0017: 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)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)mainStateMachine))
		{
			aimDirection = ((Vector3)(ref aimDirection)).normalized;
			aimDirection.y = 0f;
			Vector3 val = Vector3.Cross(aimDirection, Vector3.up);
			Vector3 val2 = Vector3.RotateTowards(aimDirection, val, (0f - angle) * (MathF.PI / 180f), 1f);
			val2 = Vector3.Lerp(previousDirection, val2, 0.5f);
			pseudoAimMode(val2);
			previousAngle = angle;
		}
	}

	public void pseudoAimMode(Vector3 direction)
	{
		//IL_0011: 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_0029: Unknown result type (might be due to invalid IL or missing references)
		mainStateMachine.commonComponents.characterDirection.forward = direction;
		mainStateMachine.commonComponents.characterDirection.moveVector = direction;
		if (Object.op_Implicit((Object)(object)mainStateMachine.commonComponents.modelLocator))
		{
			Transform modelTransform = mainStateMachine.commonComponents.modelLocator.modelTransform;
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
				component.AimImmediate();
			}
		}
	}
}
public class NemforcerVRController : MonoBehaviour
{
	private CharacterBody charBody;

	private GameObject VROffHand;

	private Transform VRMuzzleOriginParent;

	private Vector3 VRMuzzleOriginPos;

	private Quaternion VRMuzzleOriginRot;

	private NemforcerController nemforcerController;

	private void OnEnable()
	{
		if (EnforcerModPlugin.VREnabled)
		{
			SubscribeToHandPairEvent();
		}
	}

	private void OnDisable()
	{
		if (EnforcerModPlugin.VREnabled)
		{
			UnsubscribeToHandPairEvent();
		}
	}

	private void SubscribeToHandPairEvent()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Combine((Delegate?)(object)MotionControls.onHandPairSet, (Delegate?)new SetHandPairEventHandler(OnHandPairSet));
		BaseState.GetAimRay += new hook_GetAimRay(EditAimRay);
	}

	private void UnsubscribeToHandPairEvent()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		MotionControls.onHandPairSet = (SetHandPairEventHandler)Delegate.Remove((Delegate?)(object)MotionControls.onHandPairSet, (Delegate?)new SetHandPairEventHandler(OnHandPairSet));
		BaseState.GetAimRay -= new hook_GetAimRay(EditAimRay);
	}

	private void OnHandPairSet(CharacterBody body)
	{
		if (((Object)body).name.Contains("NemesisEnforcerBody") && !((Object)(object)((Component)this).GetComponent<CharacterBody>() != (Object)(object)body))
		{
			((MonoBehaviour)this).StartCoroutine((IEnumerator)SetVRWeaponAndMinigun(body));
		}
	}

	private IEnumerator<WaitForSeconds> SetVRWeaponAndMinigun(CharacterBody body)
	{
		yield return new WaitForSeconds(0.5f);
		charBody = body;
		nemforcerController = ((Component)this).GetComponentInChildren<NemforcerController>();
		body.aimOriginTransform = MotionControls.dominantHand.muzzle;
		ChildLocator vrHammerChildLocator = ((Component)MotionControls.dominantHand.transform).GetComponentInChildren<ChildLocator>();
		ChildLocator vrMinigunChildLocator = ((Component)MotionControls.nonDominantHand.transform).GetComponentInChildren<ChildLocator>();
		if (!Object.op_Implicit((Object)(object)vrHammerChildLocator) || !Object.op_Implicit((Object)(object)vrMinigunChildLocator))
		{
			yield break;
		}
		List<GameObject> allVRHammers = new List<GameObject>
		{
			((Component)vrHammerChildLocator.FindChild("HammerModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("HammerClassicModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("HammerGMModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("HammerMCModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("HammerDededeModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("HammerEnforcerModel")).gameObject,
			((Component)vrHammerChildLocator.FindChild("ThrowHammerModel")).gameObject
		};
		List<GameObject> allVRMiniguns = new List<GameObject>
		{
			((Component)vrMinigunChildLocator.FindChild("MinigunModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunClassicModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunGMModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunMCModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunDededeModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunEnforcerModel")).gameObject,
			((Component)vrMinigunChildLocator.FindChild("MinigunDripModel")).gameObject
		};
		foreach (GameObject hammer in allVRHammers)
		{
			hammer.SetActive(true);
			hammer.SetActive(false);
		}
		foreach (GameObject minigun in allVRMiniguns)
		{
			minigun.SetActive(true);
			minigun.SetActive(false);
		}
		nemforcerController.hammerChargeSmall = ((Component)allVRHammers[0].transform.Find("HammerChargeSmall")).gameObject.GetComponentInChildren<ParticleSystem>();
		nemforcerController.hammerChargeLarge = ((Component)allVRHammers[0].transform.Find("HammerChargeLarge")).gameObject.GetComponentInChildren<ParticleSystem>();
		nemforcerController.hammerBurst = ((Component)allVRHammers[0].transform.Find("HammerBurst")).gameObject.GetComponentInChildren<ParticleSystem>();
		GameObject throwHammer = allVRHammers[5];
		GameObject bigHammer;
		GameObject VRMinigun;
		if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.CLASSIC))
		{
			bigHammer = allVRHammers[1];
			VRMinigun = allVRMiniguns[1];
		}
		else if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.TYPHOONSKIN))
		{
			bigHammer = allVRHammers[2];
			VRMinigun = allVRMiniguns[2];
		}
		else if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.MINECRAFT))
		{
			bigHammer = allVRHammers[3];
			VRMinigun = allVRMiniguns[3];
		}
		else if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.DEDEDE))
		{
			bigHammer = allVRHammers[4];
			VRMinigun = allVRMiniguns[4];
		}
		else if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.ENFORCER))
		{
			bigHammer = allVRHammers[5];
			VRMinigun = allVRMiniguns[5];
		}
		else if (NemforcerSkins.isNemforcerCurrentSkin(body, NemforcerSkins.NemforcerSkin.DRIP))
		{
			bigHammer = allVRHammers[0];
			VRMinigun = allVRMiniguns[6];
		}
		else
		{
			bigHammer = allVRHammers[0];
			VRMinigun = allVRMiniguns[0];
		}
		GameObject VRHammer;
		if (nemforcerController.GetWeapon() == 0)
		{
			VRHammer = bigHammer;
		}
		else
		{
			VRHammer = throwHammer;
			MotionControls.dominantHand.animator.SetBool("OneHandedHammer", true);
		}
		VRHammer.SetActive(true);
		VRMinigun.SetActive(true);
		((Component)nemforcerController.hammerBurst).transform.parent = VRHammer.transform.Find("HammerBurst");
		((Component)nemforcerController.hammerBurst).transform.localPosition = Vector3.zero;
		((Component)nemforcerController.hammerBurst).transform.localRotation = Quaternion.identity;
		((Component)nemforcerController.hammerChargeSmall).transform.parent = VRHammer.transform.Find("HammerChargeSmall");
		((Component)nemforcerController.hammerChargeSmall).transform.localPosition = Vector3.zero;
		((Component)nemforcerController.hammerChargeSmall).transform.localRotation = Quaternion.identity;
		((Component)nemforcerController.hammerChargeLarge).transform.parent = VRHammer.transform.Find("HammerChargeLarge");
		((Component)nemforcerController.hammerChargeLarge).transform.localPosition = Vector3.zero;
		((Component)nemforcerController.hammerChargeLarge).transform.localRotation = Quaternion.identity;
		VRMuzzleOriginParent = MotionControls.dominantHand.muzzle.parent;
		VRMuzzleOriginPos = MotionControls.dominantHand.muzzle.localPosition;
		VRMuzzleOriginRot = MotionControls.dominantHand.muzzle.localRotation;
		VROffHand = ((Component)vrMinigunChildLocator.FindChild("HandModel")).gameObject;
		VRMinigunToggle(minigun: false);
	}

	private Ray EditAimRay(orig_GetAimRay orig, BaseState self)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		if (VRAPICompat.IsLocalVRPlayer(charBody) && ((Object)((EntityState)self).characterBody).name.Contains("NemesisEnforcerBody") && (self is AimNemGas || self is StunGrenade))
		{
			return MotionControls.nonDominantHand.aimRay;
		}
		return orig.Invoke(self);
	}

	public void VRMinigunToggle(bool minigun)
	{
		//IL_0096: 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)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (minigun)
		{
			MotionControls.dominantHand.muzzle.SetParent(VRAPICompat.GetMinigunMuzzleObject().transform.parent);
			MotionControls.dominantHand.muzzle.localPosition = VRAPICompat.GetMinigunMuzzleObject().transform.localPosition;
			MotionControls.dominantHand.muzzle.localRotation = VRAPICompat.GetMinigunMuzzleObject().transform.localRotation;
			VROffHand.SetActive(false);
		}
		else
		{
			MotionControls.dominantHand.muzzle.SetParent(VRMuzzleOriginParent);
			MotionControls.dominantHand.muzzle.localPosition = VRMuzzleOriginPos;
			MotionControls.dominantHand.muzzle.localRotation = VRMuzzleOriginRot;
			VROffHand.SetActive(nemforcerController.GetWeapon() == 1);
		}
	}
}
public class ParticleFollowerController : MonoBehaviour
{
	private ParticleSystem main;

	private GameObject root;

	private bool destroying;

	private void Awake()
	{
		main = ((Component)this).GetComponent<ParticleSystem>();
		root = ((Component)((Component)this).transform.root).gameObject;
		((Component)this).transform.parent = null;
	}

	private void FixedUpdate()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)root))
		{
			((Component)this).transform.position = root.transform.position;
			((Component)this).transform.rotation = root.transform.rotation;
		}
		else if (!destroying)
		{
			destroying = true;
			Object.Destroy((Object)(object)((Component)this).gameObject, 8f);
			main.Stop();
		}
	}
}
public class TestValueManager : MonoBehaviour
{
	public static float testValue = 0.25f;

	private float tim;

	private float holdTime = 0.5f;

	public static bool testingEnabled = false;

	internal static Vector3 testVector = new Vector3(-2.2f, -0.5f, -9f);

	private void Update()
	{
		if (testingEnabled && Input.GetKey((KeyCode)308))
		{
			manageTestValue(ref testValue, "devl", (KeyCode)263, (KeyCode)260, 0.01f);
		}
	}

	private void manageTestVector(ref Vector3 vector, string vectorName, float incrementAmount = 0.1f, KeyCode xUp = 263, KeyCode xDown = 260, KeyCode yUp = 264, KeyCode yDown = 261, KeyCode zUp = 265, KeyCode zDown = 262)
	{
		//IL_0013: 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_0030: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		manageTestValue(ref vector.x, vectorName + "x", xUp, xDown, incrementAmount);
		manageTestValue(ref vector.y, vectorName + "y", yUp, yDown, incrementAmount);
		manageTestValue(ref vector.z, vectorName + "z", zUp, zDown, incrementAmount);
	}

	private void manageTestValue(ref float value, string valueName, KeyCode upKey, KeyCode downKey, float incrementAmount)
	{
		//IL_0001: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(upKey))
		{
			value = setTestValue(value + incrementAmount, valueName);
		}
		if (Input.GetKeyDown(downKey))
		{
			value = setTestValue(value - incrementAmount, valueName);
		}
		if (Input.GetKey(upKey) || Input.GetKey(downKey))
		{
			float num = incrementAmount * (float)(Input.GetKey(upKey) ? 1 : (-1));
			tim += Time.deltaTime;
			if (tim > holdTime)
			{
				value = setTestValue(value + num, valueName);
				tim = holdTime - 0.05f;
			}
		}
		if (Input.GetKeyUp(upKey) || Input.GetKeyUp(downKey))
		{
			tim = 0f;
		}
	}

	private float setTestValue(float value, string print)
	{
		Debug.LogWarning((object)$"{print}: {value}");
		return value;
	}
}
internal static class Log
{
	internal 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);
	}
}
public class SkillDefInfo
{
	public string skillName;

	public string skillNameToken;

	public string skillDescriptionToken;

	public string[] keywordTokens = new string[0];

	public Sprite skillIcon;

	public SerializableEntityStateType activationState;

	public InterruptPriority interruptPriority;

	public string activationStateMachineName;

	public float baseRechargeInterval;

	public int baseMaxStock = 1;

	public int rechargeStock = 1;

	public int requiredStock = 1;

	public int stockToConsume = 1;

	public bool isCombatSkill = true;

	public bool canceledFromSprinting;

	public bool forceSprintDuringState;

	public bool cancelSprintingOnActivation = true;

	public bool beginSkillCooldownOnSkillEnd;

	public bool fullRestockOnAssign = true;

	public bool resetCooldownTimerOnUse;

	public bool mustKeyPress;

	public SkillDefInfo()
	{
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: 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_0075: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		this.skillIcon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		this.interruptPriority = interruptPriority;
		this.isCombatSkill = isCombatSkill;
		this.baseRechargeInterval = baseRechargeInterval;
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		this.skillIcon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		interruptPriority = (InterruptPriority)0;
		isCombatSkill = true;
		baseRechargeInterval = 0f;
		requiredStock = 0;
		stockToConsume = 0;
		cancelSprintingOnActivation = !agile;
		if (agile)
		{
			keywordTokens = new string[1] { "KEYWORD_AGILE" };
		}
	}
}
namespace EntityStates.Nemforcer
{
	public class NemforcerMain : GenericCharacterMain
	{
		private float currentHealth;

		private Animator animator;

		private NemforcerController nemComponent;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			nemComponent = ((Component)((EntityState)this).characterBody).GetComponent<NemforcerController>();
			nemComponent.mainStateMachine = ((EntityState)this).outer;
			animator = ((EntityState)this).GetModelAnimator();
			((BaseCharacterMain)this).smoothingParameters.forwardSpeedSmoothDamp = 0.02f;
			((BaseCharacterMain)this).smoothingParameters.rightSpeedSmoothDamp = 0.02f;
		}

		public override void Update()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).Update();
			bool flag = ((BaseState)this).HasBuff(Buffs.minigunBuff);
			if (((EntityState)this).isAuthority && ((EntityState)this).characterMotor.isGrounded && !flag)
			{
				if (Input.GetKeyDown(Config.restKey.Value))
				{
					((EntityState)this).outer.SetInterruptState((EntityState)(object)new Rest(), (InterruptPriority)0);
				}
				else if (Input.GetKeyDown(Config.saluteKey.Value))
				{
					((EntityState)this).outer.SetInterruptState((EntityState)(object)new Salute(), (InterruptPriority)0);
				}
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (((BaseState)this).HasBuff(Buffs.minigunBuff))
			{
				((EntityState)this).characterBody.SetAimTimer(0.2f);
				((EntityState)this).characterBody.isSprinting = false;
			}
			if (currentHealth != ((EntityState)this).healthComponent.combinedHealth)
			{
				currentHealth = ((EntityState)this).healthComponent.combinedHealth;
				((EntityState)this).characterBody.RecalculateStats();
			}
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetBool("inCombat", !((EntityState)this).characterBody.outOfCombat || !((EntityState)this).characterBody.outOfDanger);
			}
		}
	}
	public class SpawnState : BaseState
	{
		public static float duration = 2.5f;

		private CameraRigController cameraController;

		private bool initCamera;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("Body", "Spawn");
			Util.PlaySound(SpawnState.spawnSoundString, ((EntityState)this).gameObject);
			((EntityState)this).GetModelAnimator().SetLayerWeight(((EntityState)this).GetModelAnimator().GetLayerIndex("Minigun"), 0f);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
			if (Object.op_Implicit((Object)(object)EnforcerModPlugin.nemesisSpawnEffect))
			{
				EffectManager.SimpleMuzzleFlash(SpawnState.spawnEffectPrefab, ((EntityState)this).gameObject, "SpawnOrigin", false);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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)
			((EntityState)this).FixedUpdate();
			if (!Object.op_Implicit((Object)(object)cameraController))
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.ma