Decompiled source of ShootingshootingAway v1.0.2

plugins/ShootingshootingAway.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ShootingshootingAway")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+b35503d6a2cddb2a193d0731809a75e18384f9c9")]
[assembly: AssemblyProduct("ShootingshootingAway")]
[assembly: AssemblyTitle("ShootingshootingAway")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ShootingshootingAway
{
	[HarmonyPatch]
	internal static class DartImpactHostPatch
	{
		private static readonly HashSet<int> _neutralizing = new HashSet<int>();

		private static readonly Dictionary<int, float> _lastMasterApply = new Dictionary<int, float>();

		private const float NeutralizeInterval = 0.5f;

		private const float NeutralizeSubtract = -500f;

		private const float HardCapSeconds = 20f;

		private const float MasterApplyCooldown = 0.6f;

		internal static bool MasterApplyReady(int viewId)
		{
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			if (_lastMasterApply.TryGetValue(viewId, out var value) && realtimeSinceStartup - value < 0.6f)
			{
				return false;
			}
			_lastMasterApply[viewId] = realtimeSinceStartup;
			return true;
		}

		[HarmonyPatch(typeof(Action_RaycastDart), "RPC_DartImpact")]
		[HarmonyPrefix]
		private static bool OnDartImpact(Action_RaycastDart __instance, int characterID, Vector3 origin, Vector3 endpoint)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient)
			{
				return true;
			}
			bool flag = !Plugin.EffectEnabled || BlowDartService.IsVanilla(Plugin.EffectType);
			ManualLogSource log = Plugin.Log;
			if (log != null)
			{
				log.LogInfo((object)("[ShootingAway] RPC_DartImpact master=" + PhotonNetwork.IsMasterClient + " char=" + characterID + " enabled=" + Plugin.EffectEnabled + " type=" + Plugin.EffectType.ToString() + " vanilla=" + flag));
			}
			if (flag)
			{
				return true;
			}
			try
			{
				if ((Object)(object)__instance.dartVFX != (Object)null)
				{
					Object.Instantiate<GameObject>(__instance.dartVFX, endpoint, Quaternion.identity);
				}
				if ((Object)(object)GamefeelHandler.instance != (Object)null)
				{
					GamefeelHandler.instance.AddPerlinShakeProximity(endpoint, 5f, 0.2f, 15f, 10f);
				}
				if (characterID == -1)
				{
					return false;
				}
				if (!MasterApplyReady(characterID))
				{
					return false;
				}
				PhotonView photonView = PhotonNetwork.GetPhotonView(characterID);
				Character val = (((Object)(object)photonView != (Object)null) ? ((Component)photonView).GetComponent<Character>() : null);
				if ((Object)(object)val == (Object)null || val.refs == null)
				{
					return false;
				}
				if ((Object)(object)val.data != (Object)null && val.data.dead)
				{
					return false;
				}
				ApplyReplacement(val, Plugin.EffectType, Plugin.EffectAmount);
				return false;
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)ex);
				}
			}
			return true;
		}

		internal static void ApplyReplacement(Character target, BlowDartEffect effectType, float amount)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Invalid comparison between Unknown and I4
			//IL_0157: 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)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.EffectEnabled || (Object)(object)target == (Object)null || target.refs == null || ((Object)(object)target.refs.view == (Object)null && (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null) || ((Object)(object)target.data != (Object)null && target.data.dead))
			{
				return;
			}
			STATUSTYPE? val = BlowDartService.ResolveStatusType(effectType);
			if (!val.HasValue)
			{
				return;
			}
			PhotonView val2 = (((Object)(object)target.refs.view != (Object)null) ? target.refs.view : ((MonoBehaviourPun)target).photonView);
			if ((int)val.GetValueOrDefault() == 6)
			{
				float[] array = new float[CharacterAfflictions.NumStatusTypes];
				array[val.Value] = Mathf.Clamp(amount / 100f, 0f, 2f);
				SendStatusToOwner(val2, array);
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogInfo((object)("[ShootingAway] 施加困倦:目标 " + val2.ViewID + " 量 " + array[val.Value]));
				}
				return;
			}
			float num = Mathf.Clamp(amount / 100f, 0f, 2f);
			float[] array2 = new float[CharacterAfflictions.NumStatusTypes];
			array2[6] = -500f;
			SendStatusToOwner(val2, array2);
			float[] array3 = new float[CharacterAfflictions.NumStatusTypes];
			array3[val.Value] = num;
			SendStatusToOwner(val2, array3);
			ManualLogSource log2 = Plugin.Log;
			if (log2 != null)
			{
				log2.LogInfo((object)("[ShootingAway] 施加替换状态:目标 " + val2.ViewID + " 类型 " + ((object)val.Value/*cast due to .constrained prefix*/).ToString() + " 量 " + num + "(压制睡眠 + 替换)"));
			}
			StartNeutralize(target);
		}

		private static void SendStatusToOwner(PhotonView view, float[] data)
		{
			if ((Object)(object)view == (Object)null)
			{
				return;
			}
			try
			{
				if (view.Owner != null && !view.Owner.IsLocal)
				{
					view.RPC("RPC_ApplyStatusesFromFloatArray", view.Owner, new object[1] { data });
				}
				else
				{
					view.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { data });
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
		}

		private static void StartNeutralize(Character target)
		{
			if ((Object)(object)((MonoBehaviourPun)target).photonView == (Object)null)
			{
				return;
			}
			int viewID = ((MonoBehaviourPun)target).photonView.ViewID;
			if (_neutralizing.Add(viewID))
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogInfo((object)("[ShootingAway] 开始压制睡眠:目标 " + viewID));
				}
				PushDrowsyDown(target);
				((MonoBehaviour)Plugin.Instance).StartCoroutine(NeutralizeRoutine(target, viewID));
			}
		}

		private static IEnumerator NeutralizeRoutine(Character target, int viewId)
		{
			float startedAt = Time.time;
			int pushes = 0;
			try
			{
				while ((Object)(object)target != (Object)null && target.refs != null && (Object)(object)target.refs.afflictions != (Object)null && (Object)(object)((MonoBehaviourPun)target).photonView != (Object)null && Time.time - startedAt < 20f)
				{
					yield return (object)new WaitForSeconds(0.5f);
					if ((Object)(object)target == (Object)null || target.refs == null || (Object)(object)target.refs.afflictions == (Object)null || (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null)
					{
						break;
					}
					try
					{
						PushDrowsyDown(target);
						pushes++;
					}
					catch (Exception ex)
					{
						ManualLogSource log = Plugin.Log;
						if (log != null)
						{
							log.LogError((object)ex);
						}
					}
				}
				ManualLogSource log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogInfo((object)("[ShootingAway] 压制结束:目标 " + viewId + " 次数 " + pushes));
				}
			}
			finally
			{
				_neutralizing.Remove(viewId);
			}
		}

		private static void PushDrowsyDown(Character target)
		{
			if (!((Object)(object)target.refs.view == (Object)null) || !((Object)(object)((MonoBehaviourPun)target).photonView == (Object)null))
			{
				PhotonView view = (((Object)(object)target.refs.view != (Object)null) ? target.refs.view : ((MonoBehaviourPun)target).photonView);
				float[] array = new float[CharacterAfflictions.NumStatusTypes];
				array[6] = -500f;
				SendStatusToOwner(view, array);
			}
		}
	}
	[HarmonyPatch]
	internal static class InfiniteUsePatch
	{
		private const int BlowgunItemId = 70;

		[HarmonyPatch(typeof(Item), "Start")]
		[HarmonyPostfix]
		private static void OnItemStart(Item __instance)
		{
			EnsureInfinite(__instance);
		}

		[HarmonyPatch(typeof(Item), "SetItemInstanceDataRPC")]
		[HarmonyPostfix]
		private static void OnItemInstanceData(Item __instance)
		{
			EnsureInfinite(__instance);
		}

		private static void EnsureInfinite(Item item)
		{
			if (!PhotonNetwork.IsMasterClient || !Plugin.InfiniteDurability || (Object)(object)item == (Object)null || (item.itemID != 70 && !BlowDartService.IsBlowDart(item)))
			{
				return;
			}
			try
			{
				OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2);
				if (data != null)
				{
					data.HasData = true;
					data.Value = -1;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ConsumePatch
	{
		[HarmonyPatch(typeof(Action_Consume), "RunAction")]
		[HarmonyPrefix]
		private static bool OnConsume(Action_Consume __instance)
		{
			if (!PhotonNetwork.IsMasterClient)
			{
				return true;
			}
			if (!Plugin.InfiniteDurability)
			{
				return true;
			}
			Item item = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent<Item>() : null);
			return !BlowDartService.IsBlowDart(item);
		}
	}
	[HarmonyPatch]
	internal static class CursorPatcher
	{
		[HarmonyPatch(typeof(CursorHandler), "Update")]
		[HarmonyPrefix]
		private static bool Block()
		{
			return !Plugin.MenuVisible;
		}
	}
	[HarmonyPatch]
	internal static class FreezeLookPatch
	{
		[HarmonyPatch(typeof(CharacterInput), "Sample")]
		[HarmonyPostfix]
		private static void ZeroLook(CharacterInput __instance)
		{
			//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)
			if (Plugin.MenuVisible && !((Object)(object)__instance == (Object)null))
			{
				__instance.lookInput = Vector2.zero;
				__instance.usePrimaryIsPressed = false;
				__instance.usePrimaryWasPressed = false;
				__instance.usePrimaryWasReleased = false;
				__instance.useSecondaryIsPressed = false;
				__instance.useSecondaryWasPressed = false;
				__instance.useSecondaryWasReleased = false;
				__instance.interactIsPressed = false;
				__instance.interactWasPressed = false;
				__instance.interactWasReleased = false;
			}
		}
	}
	[HarmonyPatch]
	internal static class SelfHitTestPatch
	{
		[HarmonyPatch(typeof(Action_RaycastDart), "FireDart")]
		[HarmonyPrefix]
		private static bool OnFireDart(Action_RaycastDart __instance)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient)
			{
				return true;
			}
			if (!Plugin.AllowSelfHit)
			{
				return true;
			}
			if (!Plugin.EffectEnabled)
			{
				return true;
			}
			try
			{
				if (Object.op_Implicit((Object)(object)__instance.shotSFX))
				{
					__instance.shotSFX.Play(((Component)__instance).transform.position);
				}
				Vector3 position = ((Component)__instance).transform.position;
				Vector3 forward = ((Component)MainCamera.instance).transform.forward;
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter == (Object)null)
				{
					return false;
				}
				RaycastHit val = default(RaycastHit);
				if (!Physics.Raycast(position, forward, ref val, __instance.maxDistance, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1))
				{
					((RaycastHit)(ref val)).distance = __instance.maxDistance;
					((RaycastHit)(ref val)).point = position + forward * __instance.maxDistance;
				}
				Vector3 point = ((RaycastHit)(ref val)).point;
				RaycastHit[] array = Physics.SphereCastAll(position, __instance.dartCollisionSize, forward, ((RaycastHit)(ref val)).distance, LayerMask.GetMask(new string[1] { "Character" }), (QueryTriggerInteraction)1);
				RaycastHit[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					RaycastHit val2 = array2[i];
					if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider))
					{
						Character componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Character>();
						if (Object.op_Implicit((Object)(object)componentInParent) && !((Object)(object)componentInParent == (Object)(object)localCharacter))
						{
							point = ((RaycastHit)(ref val2)).point;
							break;
						}
					}
				}
				Character val3 = FindTestTarget(localCharacter, position);
				if ((Object)(object)__instance.dartVFX != (Object)null)
				{
					Object.Instantiate<GameObject>(__instance.dartVFX, point, Quaternion.identity);
				}
				BlowDartEffect blowDartEffect = Plugin.EffectType;
				if (blowDartEffect == BlowDartEffect.Original)
				{
					blowDartEffect = BlowDartEffect.Drowsy;
				}
				if ((Object)(object)((MonoBehaviourPun)localCharacter).photonView != (Object)null)
				{
					int num = (((Object)(object)val3 != (Object)null && (Object)(object)((MonoBehaviourPun)val3).photonView != (Object)null) ? ((MonoBehaviourPun)val3).photonView.ViewID : (-1));
					((MonoBehaviourPun)localCharacter).photonView.RPC("OnShootAwayHit", (RpcTarget)0, new object[5]
					{
						num,
						position,
						point,
						(int)blowDartEffect,
						Plugin.EffectAmount
					});
				}
				return false;
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
			return true;
		}

		private static Character FindTestTarget(Character self, Vector3 origin)
		{
			//IL_0060: 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)
			Character val = null;
			float num = float.MaxValue;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)self) && (!((Object)(object)allCharacter.data != (Object)null) || !allCharacter.data.dead) && !((Object)(object)((MonoBehaviourPun)allCharacter).photonView == (Object)null) && !allCharacter.isZombie)
				{
					float num2 = Vector3.Distance(origin, ((Component)allCharacter).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = allCharacter;
					}
				}
			}
			if (!((Object)(object)val != (Object)null))
			{
				return self;
			}
			return val;
		}
	}
	public class ShootAwayNet : MonoBehaviourPun
	{
		[PunRPC]
		public void OnShootAwayHit(int targetViewID, Vector3 origin, Vector3 endpoint, int effectType, float amount)
		{
			if (!PhotonNetwork.IsMasterClient || targetViewID == -1 || !DartImpactHostPatch.MasterApplyReady(targetViewID))
			{
				return;
			}
			try
			{
				PhotonView photonView = PhotonNetwork.GetPhotonView(targetViewID);
				Character val = (((Object)(object)photonView != (Object)null) ? ((Component)photonView).GetComponent<Character>() : null);
				if (!((Object)(object)val == (Object)null) && val.refs != null)
				{
					DartImpactHostPatch.ApplyReplacement(val, (BlowDartEffect)effectType, amount);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ShootAwayNetPatch
	{
		[HarmonyPatch(typeof(Character), "Start")]
		[HarmonyPostfix]
		private static void AttachNet(Character __instance)
		{
			try
			{
				if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).gameObject == (Object)null) && (Object)(object)((Component)__instance).gameObject.GetComponent<ShootAwayNet>() == (Object)null)
				{
					((Component)__instance).gameObject.AddComponent<ShootAwayNet>();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class BingBongGrenadePatch
	{
		[HarmonyPatch(typeof(Item), "Start")]
		[HarmonyPostfix]
		private static void AllowThrowing(Item __instance)
		{
			//IL_002c: 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)
			try
			{
				if (PhotonNetwork.IsMasterClient && Plugin.BingBongGrenadeEnabled && !((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).gameObject == (Object)null) && (__instance.itemTags & 0x10) != 0 && __instance.UIData != null)
				{
					__instance.UIData.canDrop = true;
					__instance.UIData.canThrow = true;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ExplodingBingBongPatch
	{
		private const float TriggerVelocity = 36f;

		private static readonly HashSet<int> _exploded = new HashSet<int>();

		[HarmonyPatch(typeof(ItemImpactSFX), "OnCollisionEnter")]
		[HarmonyPrefix]
		private static void OnItemImpact(ItemImpactSFX __instance, ref Item ___item)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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)
			try
			{
				if (!PhotonNetwork.IsMasterClient || !Plugin.BingBongGrenadeEnabled || (Object)(object)__instance == (Object)null || (Object)(object)___item == (Object)null || (Object)(object)((Component)___item).gameObject == (Object)null || (Object)(object)___item.holderCharacter != (Object)null || (Object)(object)((MonoBehaviourPun)___item).photonView == (Object)null)
				{
					return;
				}
				int viewID = ((MonoBehaviourPun)___item).photonView.ViewID;
				if (!_exploded.Add(viewID))
				{
					return;
				}
				if (!IsBingBong(___item) || __instance.vel <= 36f)
				{
					_exploded.Remove(viewID);
					return;
				}
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogInfo((object)("[ShootingAway] 宾邦手榴弹爆炸! vel=" + __instance.vel + " 位置 " + ((object)((Component)___item).transform.position/*cast due to .constrained prefix*/).ToString() + " view=" + viewID));
				}
				GameObject val = PhotonNetwork.Instantiate("0_Items/Dynamite", ((Component)___item).transform.position, ((Component)___item).transform.rotation, (byte)0, (object[])null);
				if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<PhotonView>() != (Object)null)
				{
					val.GetComponent<PhotonView>().RPC("RPC_Explode", (RpcTarget)0, Array.Empty<object>());
				}
				PhotonNetwork.Destroy(((Component)___item).gameObject);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)ex);
				}
			}
		}

		private static bool IsBingBong(Item item)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			if ((Object)(object)((Component)item).GetComponent<BingBong>() != (Object)null)
			{
				return true;
			}
			return (item.itemTags & 0x10) > 0;
		}
	}
	[HarmonyPatch]
	internal static class MushroomSmokeBombPatch
	{
		private const int HealingPuffShroomId = 90;

		private const int ExtraClouds = 2;

		private const float ExtraRadius = 1.5f;

		private static bool IsHealingPuffShroom(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			if (item.itemID == 90)
			{
				return true;
			}
			string text = ((Object)((Component)item).gameObject).name ?? string.Empty;
			return text.IndexOf("HealingPuffShroom", StringComparison.Ordinal) >= 0;
		}

		[HarmonyPatch(typeof(ShelfShroom), "Break")]
		[HarmonyPostfix]
		private unsafe static void OnShelfShroomBreak(ShelfShroom __instance)
		{
			//IL_0064: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!PhotonNetwork.IsMasterClient || !Plugin.MushroomSmokeBombEnabled || (Object)(object)__instance == (Object)null || (Object)(object)__instance.instantiateOnBreak == (Object)null)
				{
					return;
				}
				Item component = ((Component)__instance).GetComponent<Item>();
				if (IsHealingPuffShroom(component))
				{
					string text = "0_Items/" + ((Object)__instance.instantiateOnBreak).name;
					Vector3 position = ((Component)__instance).transform.position;
					for (int i = 0; i < 2; i++)
					{
						Vector2 insideUnitCircle = Random.insideUnitCircle;
						Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 1.5f;
						Vector3 val2 = position + new Vector3(val.x, 0.15f, val.y);
						Quaternion val3 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
						PhotonNetwork.Instantiate(text, val2, val3, (byte)0, (object[])null);
					}
					ManualLogSource log = Plugin.Log;
					if (log != null)
					{
						log.LogInfo((object)("[ShootingAway] 灵药菇烟雾弹: 额外引爆 " + 2 + " 个 " + text + " @ " + ((object)(*(Vector3*)(&position))/*cast due to .constrained prefix*/).ToString()));
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)ex);
				}
			}
		}
	}
	public enum BlowDartEffect
	{
		Original,
		Injury,
		Poison,
		Cold,
		Hot,
		Hunger,
		Drowsy,
		Curse
	}
	[BepInPlugin("com.peaks.shootingshootingaway", "ShootingshootingAway", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		internal static ManualLogSource Log;

		internal static bool EffectEnabled = true;

		internal static BlowDartEffect EffectType = BlowDartEffect.Curse;

		internal static float EffectAmount = 15f;

		internal static bool InfiniteDurability = true;

		internal static bool AllowSelfHit = false;

		internal static bool BingBongGrenadeEnabled = true;

		internal static bool MushroomSmokeBombEnabled = true;

		internal static bool MenuVisible;

		private Harmony _harmony;

		private Rect _menuRect = new Rect(200f, 140f, 380f, 380f);

		private GUIStyle _bgStyle;

		private GUIStyle _btnStyle;

		private GUIStyle _lblStyle;

		private GUIStyle _toggleStyle;

		private GUIStyle _titleStyle;

		private Texture2D _texBg;

		private Texture2D _texBtn;

		private Texture2D _texBtnHover;

		private bool _stylesReady;

		internal static bool IsHost => PhotonNetwork.IsMasterClient;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("com.peaks.shootingshootingaway");
			_harmony.PatchAll();
			foreach (MethodBase patchedMethod in _harmony.GetPatchedMethods())
			{
				Log.LogInfo((object)("[ShootingAway] patched: " + patchedMethod.DeclaringType?.FullName + "." + patchedMethod.Name));
			}
			Log.LogInfo((object)"[ShootingAway] loaded. F3 toggles menu.");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
			if (IsHost && Input.GetKeyDown((KeyCode)284))
			{
				MenuVisible = !MenuVisible;
			}
		}

		private void LateUpdate()
		{
			if (IsHost && MenuVisible)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
			}
		}

		private void OnGUI()
		{
			//IL_001c: 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_005d: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (IsHost && MenuVisible)
			{
				InitStyles();
				_menuRect = GUILayout.Window(123457, _menuRect, new WindowFunction(DrawMenu), "ShootingshootingAway", _bgStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(380f),
					GUILayout.Height(380f)
				});
			}
		}

		private void InitStyles()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0050: 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)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_00d9: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			if ((Object)(object)_texBg == (Object)null || (Object)(object)_texBtn == (Object)null)
			{
				_stylesReady = false;
			}
			if (!_stylesReady)
			{
				_stylesReady = true;
				Color c = H2C("223322");
				Color textColor = H2C("CCFFCC");
				_texBg = DDSafe(_texBg, c);
				_texBtn = DDSafe(_texBtn, Color.white);
				_texBtnHover = DDSafe(_texBtnHover, H2C("88FF88"));
				GUIStyle val = new GUIStyle(GUI.skin.box);
				val.normal.background = _texBg;
				val.normal.textColor = textColor;
				val.fontSize = 14;
				val.padding = new RectOffset(12, 12, 10, 10);
				_bgStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.button);
				val2.normal.background = _texBtn;
				val2.normal.textColor = H2C("223322");
				val2.hover.background = _texBtnHover;
				val2.hover.textColor = H2C("223322");
				val2.fontSize = 13;
				val2.fixedHeight = 26f;
				_btnStyle = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label);
				val3.normal.textColor = textColor;
				val3.fontSize = 13;
				val3.alignment = (TextAnchor)3;
				_lblStyle = val3;
				GUIStyle val4 = new GUIStyle(GUI.skin.button);
				val4.normal.textColor = textColor;
				val4.hover.textColor = textColor;
				val4.fontSize = 13;
				val4.fixedHeight = 26f;
				val4.fixedWidth = 64f;
				_toggleStyle = val4;
				GUIStyle val5 = new GUIStyle(GUI.skin.label);
				val5.normal.textColor = H2C("AAFFAA");
				val5.fontSize = 16;
				val5.fontStyle = (FontStyle)1;
				val5.alignment = (TextAnchor)1;
				_titleStyle = val5;
			}
		}

		private static Texture2D DDSafe(Texture2D old, Color c)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)old != (Object)null)
			{
				Object.Destroy((Object)(object)old);
			}
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, c);
			val.Apply();
			Object.DontDestroyOnLoad((Object)(object)val);
			return val;
		}

		private void DrawMenu(int id)
		{
			GUILayout.Space(3f);
			GUILayout.Label("吹箭效果替换", _titleStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("效果替换:", _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			bool flag = GUILayout.Toggle(EffectEnabled, EffectEnabled ? " 开" : " 关", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag != EffectEnabled)
			{
				EffectEnabled = flag;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.Label("效果类型:", _lblStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("<", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				SelectPreviousEffect();
			}
			GUILayout.Label(BlowDartService.DisplayName(EffectType), _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (GUILayout.Button(">", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				SelectNextEffect();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.Label("强度(百分比): " + Mathf.RoundToInt(EffectAmount), _lblStyle, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider(EffectAmount, 0f, 100f, Array.Empty<GUILayoutOption>());
			if (Mathf.Abs(num - EffectAmount) > 0.1f)
			{
				EffectAmount = Mathf.RoundToInt(num);
			}
			GUILayout.Label("诅咒默认 15(= 15% 诅咒)", _lblStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("吹箭无限耐久:", _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			bool flag2 = GUILayout.Toggle(InfiniteDurability, InfiniteDurability ? " 开" : " 关", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag2 != InfiniteDurability)
			{
				InfiniteDurability = flag2;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("宾邦手榴弹:", _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			bool flag3 = GUILayout.Toggle(BingBongGrenadeEnabled, BingBongGrenadeEnabled ? " 开" : " 关", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag3 != BingBongGrenadeEnabled)
			{
				BingBongGrenadeEnabled = flag3;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("灵药菇烟雾弹:", _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			bool flag4 = GUILayout.Toggle(MushroomSmokeBombEnabled, MushroomSmokeBombEnabled ? " 开" : " 关", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag4 != MushroomSmokeBombEnabled)
			{
				MushroomSmokeBombEnabled = flag4;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			if (GUILayout.Button("获取吹箭(测试用)", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
			{
				GiveBlowDart();
			}
			if (GUILayout.Button("获取宾邦(测试用)", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
			{
				GiveBingBong();
			}
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("测试:命中自己:", _lblStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			bool flag5 = GUILayout.Toggle(AllowSelfHit, AllowSelfHit ? " 开" : " 关", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag5 != AllowSelfHit)
			{
				AllowSelfHit = flag5;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("关闭 (F3)", _btnStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }))
			{
				MenuVisible = false;
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUI.DragWindow();
		}

		private static void SelectNextEffect()
		{
			BlowDartEffect[] array = (BlowDartEffect[])Enum.GetValues(typeof(BlowDartEffect));
			int num = Array.IndexOf(array, EffectType);
			EffectType = array[(num + 1) % array.Length];
		}

		private static void SelectPreviousEffect()
		{
			BlowDartEffect[] array = (BlowDartEffect[])Enum.GetValues(typeof(BlowDartEffect));
			int num = Array.IndexOf(array, EffectType);
			EffectType = array[(num - 1 + array.Length) % array.Length];
		}

		private static void GiveBlowDart()
		{
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || !localCharacter.IsLocal)
			{
				ManualLogSource log = Log;
				if (log != null)
				{
					log.LogWarning((object)"[ShootingAway] 未进入关卡,无法获取吹箭。");
				}
				return;
			}
			if ((Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead || localCharacter.IsGhost)
			{
				ManualLogSource log2 = Log;
				if (log2 != null)
				{
					log2.LogWarning((object)"[ShootingAway] 当前角色无法持有吹箭。");
				}
				return;
			}
			if ((Object)(object)GameUtils.instance == (Object)null)
			{
				ManualLogSource log3 = Log;
				if (log3 != null)
				{
					log3.LogWarning((object)"[ShootingAway] GameUtils 未初始化。");
				}
				return;
			}
			Item val = FindBlowDartItem();
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource log4 = Log;
				if (log4 != null)
				{
					log4.LogWarning((object)"[ShootingAway] 未在游戏资源中找到吹箭物品。");
				}
				return;
			}
			try
			{
				GameUtils.instance.InstantiateAndGrab(val, localCharacter, 0);
				ManualLogSource log5 = Log;
				if (log5 != null)
				{
					log5.LogInfo((object)"[ShootingAway] 已获取一支吹箭。");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log6 = Log;
				if (log6 != null)
				{
					log6.LogError((object)("[ShootingAway] 获取吹箭失败: " + ex));
				}
			}
		}

		private static Item FindBlowDartItem()
		{
			Item[] array = Resources.FindObjectsOfTypeAll<Item>();
			Item[] array2 = array;
			foreach (Item val in array2)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null))
				{
					if ((Object)(object)((Component)val).GetComponent<Action_RaycastDart>() != (Object)null)
					{
						return val;
					}
					if ((Object)(object)((Component)val).GetComponentInChildren<Action_RaycastDart>(true) != (Object)null)
					{
						return val;
					}
				}
			}
			Item[] array3 = array;
			foreach (Item val2 in array3)
			{
				if (!((Object)(object)val2 == (Object)null))
				{
					string v = ((Object)((Component)val2).gameObject).name ?? string.Empty;
					string v2 = string.Empty;
					try
					{
						v2 = val2.GetName() ?? string.Empty;
					}
					catch
					{
					}
					if (ContainsDartName(v) || ContainsDartName(v2))
					{
						return val2;
					}
				}
			}
			return null;
		}

		private static bool ContainsDartName(string v)
		{
			if (string.IsNullOrWhiteSpace(v))
			{
				return false;
			}
			string text = v.ToLowerInvariant();
			if (!text.Contains("blowgun") && !text.Contains("blowdart") && !text.Contains("dart") && !v.Contains("吹箭"))
			{
				return v.Contains("针筒");
			}
			return true;
		}

		private static void GiveBingBong()
		{
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || !localCharacter.IsLocal)
			{
				ManualLogSource log = Log;
				if (log != null)
				{
					log.LogWarning((object)"[ShootingAway] 未进入关卡,无法获取宾邦。");
				}
				return;
			}
			if ((Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead || localCharacter.IsGhost)
			{
				ManualLogSource log2 = Log;
				if (log2 != null)
				{
					log2.LogWarning((object)"[ShootingAway] 当前角色无法持有宾邦。");
				}
				return;
			}
			if ((Object)(object)GameUtils.instance == (Object)null)
			{
				ManualLogSource log3 = Log;
				if (log3 != null)
				{
					log3.LogWarning((object)"[ShootingAway] GameUtils 未初始化。");
				}
				return;
			}
			Item val = FindBingBongItem();
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource log4 = Log;
				if (log4 != null)
				{
					log4.LogWarning((object)"[ShootingAway] 未在游戏资源中找到宾邦物品。");
				}
				return;
			}
			try
			{
				GameUtils.instance.InstantiateAndGrab(val, localCharacter, 0);
				ManualLogSource log5 = Log;
				if (log5 != null)
				{
					log5.LogInfo((object)"[ShootingAway] 已获取一个宾邦。");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log6 = Log;
				if (log6 != null)
				{
					log6.LogError((object)("[ShootingAway] 获取宾邦失败: " + ex));
				}
			}
		}

		private static Item FindBingBongItem()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Item[] array = Resources.FindObjectsOfTypeAll<Item>();
			Item[] array2 = array;
			foreach (Item val in array2)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && (val.itemTags & 0x10) != 0)
				{
					return val;
				}
			}
			return null;
		}

		private static Color H2C(string h)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (h[0] == '#')
			{
				h = h.Substring(1);
			}
			return new Color((float)Convert.ToInt32(h.Substring(0, 2), 16) / 255f, (float)Convert.ToInt32(h.Substring(2, 2), 16) / 255f, (float)Convert.ToInt32(h.Substring(4, 2), 16) / 255f, 1f);
		}
	}
	internal static class BlowDartService
	{
		internal static bool IsVanilla(BlowDartEffect e)
		{
			if (e != BlowDartEffect.Original)
			{
				return e == BlowDartEffect.Drowsy;
			}
			return true;
		}

		internal static bool IsBlowDart(Item item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			if ((Object)(object)((Component)item).GetComponent<Action_RaycastDart>() != (Object)null)
			{
				return true;
			}
			return (Object)(object)((Component)item).GetComponentInChildren<Action_RaycastDart>(true) != (Object)null;
		}

		internal static STATUSTYPE? ResolveStatusType(BlowDartEffect effect)
		{
			return effect switch
			{
				BlowDartEffect.Injury => (STATUSTYPE)0, 
				BlowDartEffect.Hunger => (STATUSTYPE)1, 
				BlowDartEffect.Cold => (STATUSTYPE)2, 
				BlowDartEffect.Poison => (STATUSTYPE)3, 
				BlowDartEffect.Curse => (STATUSTYPE)5, 
				BlowDartEffect.Drowsy => (STATUSTYPE)6, 
				BlowDartEffect.Hot => (STATUSTYPE)8, 
				_ => null, 
			};
		}

		internal static string DisplayName(BlowDartEffect e)
		{
			return e switch
			{
				BlowDartEffect.Original => "原版睡眠", 
				BlowDartEffect.Injury => "受伤", 
				BlowDartEffect.Poison => "中毒", 
				BlowDartEffect.Cold => "寒冷", 
				BlowDartEffect.Hot => "炎热", 
				BlowDartEffect.Hunger => "饥饿", 
				BlowDartEffect.Drowsy => "困倦", 
				BlowDartEffect.Curse => "诅咒", 
				_ => e.ToString(), 
			};
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}