Decompiled source of Watering Can v1.0.0

plugins/WateringCan.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using WateringCan;
using Zorro.Core;

[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("WateringCan")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WateringCan")]
[assembly: AssemblyTitle("Watering Can")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class WateringCanItem : ItemComponent
{
	public float initialPourCost = 0.25f;

	public float totalPourTime = 10f;

	public bool pouring;

	public float interactionRadius = 1f;

	public LayerMask interactionLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Map", "Terrain", "Character", "Default" }));

	public Transform overlapSphereDefault;

	public Transform overlapSphereUp;

	public Vector3 overlapSpherePosition;

	public bool isOverlapSphereVisible;

	public Dictionary<GameObject, Coroutine> activeWateringCoroutines = new Dictionary<GameObject, Coroutine>();

	public float selfWaterValue = 0.8f;

	public float seaLevel = 0.425f;

	public StormVisual rainVisual;

	public float rainRefillAmount = 0.05f;

	public GameObject[] heatZones;

	public float waterPoolsRadius = 4.5f;

	public float waterPoolsDepth = -0.9f;

	public float waterPoolsHeight = 0.9f;

	public Dictionary<GameObject, int> bushGrowthProgress = new Dictionary<GameObject, int>();

	public int fruitGrowTime = 27;

	public float vineGrowLength = 30f;

	public float vineGrowTick;

	public bool canVineGrow = true;

	public float coolOffPlayerAmount = 0.025f;

	public float coolOffPlayerCooldown = 0.25f;

	[SerializeField]
	public float water;

	public float generalTick;

	public override void Awake()
	{
		((ItemComponent)this).Awake();
		Item item = base.item;
		item.OnPrimaryStarted = (Action)Delegate.Combine(item.OnPrimaryStarted, new Action(StartPour));
		Item item2 = base.item;
		item2.OnPrimaryCancelled = (Action)Delegate.Combine(item2.OnPrimaryCancelled, new Action(CancelPour));
		overlapSphereDefault = ((Component)this).transform.Find("Overlap_Sphere_Default");
		overlapSphereUp = ((Component)this).transform.Find("Overlap_Sphere_Up");
		((Component)((Component)this).transform.Find("Sphere")).gameObject.SetActive(isOverlapSphereVisible);
		GameObject val = GameObject.FindGameObjectWithTag("Rain");
		if ((Object)(object)val != (Object)null)
		{
			rainVisual = val.GetComponent<StormVisual>();
		}
		heatZones = (from gameObject in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0)
			where ((Object)gameObject).name == "heat zone" && gameObject.activeInHierarchy
			select gameObject).ToArray();
		if (!LocalizedText.MAIN_TABLE.ContainsKey("NAME_WATERING CAN"))
		{
			LocalizedText.MAIN_TABLE.Add(LocalizedText.GetNameIndex("Watering Can").ToUpperInvariant(), new List<string>(15)
			{
				"WATERING CAN", "ARROSOIR", "ANNAFFIATOIO", "GIEẞKANNE", "REGADERA", "REGADERA", "REGADOR", "ЛЕЙКА", "ЛІЙКА", "喷壶",
				"噴壺", "じょうろ", "물뿌리개", "KONEWKA", "SULAMA KABI"
			});
		}
		if (!LocalizedText.MAIN_TABLE.ContainsKey("POUR WATER"))
		{
			LocalizedText.MAIN_TABLE.Add("pour water".ToUpperInvariant(), new List<string>(15)
			{
				"pour water", "verser de l'eau", "versare acqua", "wasser gießen", "verter agua", "verter agua", "despeje água", "налить воду", "налити воду", "倒水",
				"倒水", "水を注ぎ", "물을 붓다", "wlać wodę", "su dökmek"
			});
		}
	}

	public void OnDestroy()
	{
		Item item = base.item;
		item.OnPrimaryHeld = (Action)Delegate.Remove(item.OnPrimaryHeld, new Action(StartPour));
		Item item2 = base.item;
		item2.OnPrimaryCancelled = (Action)Delegate.Remove(item2.OnPrimaryCancelled, new Action(CancelPour));
	}

	public override void OnInstanceDataSet()
	{
		if (((ItemComponent)this).HasData((DataEntryKey)10))
		{
			water = ((ItemComponent)this).GetData<FloatItemData>((DataEntryKey)10).Value;
			base.item.SetUseRemainingPercentage(water / totalPourTime);
		}
		else if (base.photonView.IsMine)
		{
			water = totalPourTime;
			base.item.SetUseRemainingPercentage(1f);
		}
	}

	public void Update()
	{
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		generalTick -= Time.deltaTime;
		UpdatePour();
		if (generalTick <= 0f)
		{
			if (water != totalPourTime)
			{
				RefillWater();
			}
			generalTick = 0.1f;
		}
		if (Plugin.showWateringSphere.Value && Input.GetKeyDown((KeyCode)111))
		{
			isOverlapSphereVisible = !isOverlapSphereVisible;
			((Component)((Component)this).transform.Find("Sphere")).gameObject.SetActive(isOverlapSphereVisible);
			Plugin.Log.LogInfo((object)"Watering sphere toggled");
		}
		overlapSpherePosition = overlapSphereDefault.position;
		if (overlapSphereDefault.position.y - ((Component)this).transform.position.y > selfWaterValue)
		{
			overlapSpherePosition = overlapSphereUp.position;
		}
		if (isOverlapSphereVisible)
		{
			((Component)this).transform.Find("Sphere").position = overlapSpherePosition;
		}
	}

	public void UpdatePour()
	{
		//IL_0056: 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)
		if (!pouring || !base.photonView.IsMine)
		{
			return;
		}
		water -= Time.deltaTime;
		if (water <= 0f)
		{
			water = 0f;
			CancelPour();
		}
		else if (generalTick <= 0f)
		{
			Collider[] array = Physics.OverlapSphere(overlapSpherePosition, interactionRadius, LayerMask.op_Implicit(interactionLayers));
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if (!((Object)(object)((Component)val).transform == (Object)(object)((Component)this).transform) && !((Component)val).transform.IsChildOf(((Component)this).transform))
				{
					WaterInteraction(((Component)val).gameObject);
				}
			}
		}
		((ItemComponent)this).GetData<FloatItemData>((DataEntryKey)10).Value = water;
		base.item.SetUseRemainingPercentage(water / totalPourTime);
	}

	public void WaterInteraction(GameObject target)
	{
		if (((Object)target).name.Contains("berrybush ") && target.gameObject.layer == 21)
		{
			GrowFruitOnBush(target);
		}
		else if (((Object)target).name == "RigCollider" && target.gameObject.layer == 10)
		{
			GameObject gameObject = ((Component)target.transform.root).gameObject;
			if (!(gameObject.GetComponent<CharacterAfflictions>().GetCurrentStatus((STATUSTYPE)8) <= 0f) && !(gameObject.GetComponent<WateringCan_CustomMethods>().coolOffCooldown > 0f))
			{
				base.photonView.RPC("RPC_CoolOffPlayer", (RpcTarget)0, new object[1] { PunExtensions.GetPhotonView(gameObject) });
			}
		}
		else if (((Object)target.transform.root).name.Contains("Dynamite") && ((ItemComponent)((Component)target.transform.root).gameObject.GetComponent<Dynamite>()).GetData<BoolItemData>((DataEntryKey)3).Value)
		{
			base.photonView.RPC("RPC_AnRPCToAddAnRPCLol", (RpcTarget)0, new object[1] { PunExtensions.GetPhotonView(((Component)target.transform.root).gameObject) });
		}
	}

	public void GrowFruitOnBush(GameObject bush)
	{
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		if (!bushGrowthProgress.ContainsKey(bush))
		{
			bushGrowthProgress[bush] = 0;
		}
		if (bushGrowthProgress[bush] < fruitGrowTime)
		{
			bushGrowthProgress[bush]++;
		}
		if (bushGrowthProgress[bush] >= fruitGrowTime)
		{
			bushGrowthProgress.Remove(bush);
			Transform val = FindFreeSpawnSpot(((Spawner)bush.GetComponent<BerryBush>()).GetSpawnSpots());
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogInfo((object)"No free spawn spots");
				return;
			}
			((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPC_InstantiateFruit", (RpcTarget)2, new object[2]
			{
				bush.transform.position,
				val.position
			});
		}
	}

	public Transform FindFreeSpawnSpot(List<Transform> spawnSpots)
	{
		Transform[] array = spawnSpots.OrderBy((Transform x) => new Random().Next()).ToArray();
		Transform[] array2 = array;
		foreach (Transform val in array2)
		{
			if (IsSpawnSpotFree(val))
			{
				return val;
			}
		}
		return null;
	}

	public bool IsSpawnSpotFree(Transform spot)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		Collider[] array = Physics.OverlapSphere(spot.position, 0.3f);
		Collider[] array2 = array;
		foreach (Collider val in array2)
		{
			if (!((Component)val).transform.IsChildOf(spot.root) && !val.isTrigger)
			{
				return false;
			}
		}
		return true;
	}

	public void GrowMagicBean(GameObject stalk)
	{
		float maxLength = ((Component)stalk.transform.parent).GetComponentInParent<MagicBeanVine>().maxLength;
		if (maxLength < vineGrowLength)
		{
			vineGrowTick -= Time.deltaTime;
			if (vineGrowTick <= 0f)
			{
				MagicBeanVine componentInParent = ((Component)stalk.transform.parent).GetComponentInParent<MagicBeanVine>();
				componentInParent.maxLength += 1f;
				Plugin.Log.LogInfo((object)$"Vine growing to {maxLength}");
				vineGrowTick = 0.125f;
			}
		}
	}

	public void RemoveOtherVine(GameObject stalk)
	{
		//IL_0006: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		Collider[] array = Physics.OverlapSphere(stalk.transform.position, 0.1f);
		Collider[] array2 = array;
		foreach (Collider val in array2)
		{
			GameObject gameObject = ((Component)((Component)val).transform.parent.parent).gameObject;
			if (((Object)gameObject).name == "MagicBeanVine(Clone)" && ((Component)val).transform.position == stalk.transform.position && (Object)(object)gameObject != (Object)(object)((Component)stalk.transform.parent.parent).gameObject)
			{
				Plugin.Log.LogInfo((object)("Removing duplicated " + ((Object)gameObject).name));
				Object.Destroy((Object)(object)gameObject);
			}
		}
	}

	public void RefillWater()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)this).transform.position.y <= seaLevel || IsWaterPoolNear())
		{
			water = totalPourTime;
			((ItemComponent)this).GetData<FloatItemData>((DataEntryKey)10).Value = water;
			base.item.SetUseRemainingPercentage(1f);
			Plugin.Log.LogInfo((object)"Refilling Watering Can!");
		}
		else if (IsRaining() && water < totalPourTime)
		{
			water += rainRefillAmount;
			((ItemComponent)this).GetData<FloatItemData>((DataEntryKey)10).Value = water;
			base.item.SetUseRemainingPercentage(water / totalPourTime);
			Plugin.Log.LogInfo((object)$"Slowly refilling Watering Can! ({Math.Round(water * 10f)}%)");
		}
	}

	public bool IsWaterPoolNear()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Invalid comparison between Unknown and I4
		//IL_0031: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Singleton<MapHandler>.Instance == (Object)null || (int)Singleton<MapHandler>.Instance.GetCurrentSegment() != 2)
		{
			return false;
		}
		GameObject[] array = heatZones;
		foreach (GameObject val in array)
		{
			if (Vector3.Distance(((Component)this).transform.position, val.transform.position) <= waterPoolsRadius)
			{
				float num = ((Component)this).transform.position.y - val.transform.position.y;
				if (num >= waterPoolsDepth && num <= waterPoolsHeight)
				{
					return true;
				}
			}
		}
		return false;
	}

	public bool IsRaining()
	{
		if ((Object)(object)rainVisual == (Object)null)
		{
			return false;
		}
		if (rainVisual.playerInWindZone)
		{
			return true;
		}
		return false;
	}

	public void StartPour()
	{
		if (water >= initialPourCost)
		{
			water -= initialPourCost;
			pouring = true;
			base.item.SetUseRemainingPercentage(water / totalPourTime);
		}
		else
		{
			water = 0f;
			pouring = true;
			base.item.SetUseRemainingPercentage(water / totalPourTime);
		}
	}

	public void CancelPour()
	{
		pouring = false;
		foreach (Coroutine value in activeWateringCoroutines.Values)
		{
			if (value != null)
			{
				((MonoBehaviour)this).StopCoroutine(value);
			}
		}
		activeWateringCoroutines.Clear();
	}

	[PunRPC]
	public void RPC_CoolOffPlayer(PhotonView characterView)
	{
		Player owner = characterView.Owner;
		if (owner != null)
		{
			if (owner.IsLocal)
			{
				Character.localCharacter.refs.afflictions.SubtractStatus((STATUSTYPE)8, coolOffPlayerAmount, false);
			}
			((Component)((Component)characterView).transform.root).gameObject.GetComponent<WateringCan_CustomMethods>().coolOffCooldown = coolOffPlayerCooldown;
			Plugin.Log.LogInfo((object)("Cooling off " + owner.NickName));
		}
	}

	[PunRPC]
	public void RPC_AnRPCToAddAnRPCLol(PhotonView dynamiteView)
	{
		GameObject gameObject = ((Component)((Component)dynamiteView).transform.root).gameObject;
		if ((Object)(object)gameObject.GetComponent<WateringCan_SetFlareUnlitRPC>() == (Object)null)
		{
			gameObject.AddComponent<WateringCan_SetFlareUnlitRPC>();
		}
		dynamiteView.RPC("SetFlareUnlitRPC", (RpcTarget)0, Array.Empty<object>());
	}
}
public class WateringCanVFX : MonoBehaviourPun
{
	public Item item;

	public bool isPouring;

	public bool audioStarted;

	public AudioSource audioSource;

	public ParticleSystem particle;

	public GameObject waterLevel;

	public float minWaterLevelPosition = 0.000425f;

	public float maxWaterLevelPosition = 0.0056f;

	public float volume = 0.1f;

	public WateringCanItem wateringCanItem;

	public void Start()
	{
		item = ((Component)this).GetComponent<Item>();
		audioSource = ((Component)((Component)this).transform.Find("Audio_Source")).GetComponent<AudioSource>();
		particle = ((Component)((Component)this).transform.Find("Water_VFX")).GetComponent<ParticleSystem>();
		waterLevel = ((Component)((Component)this).transform.Find("watering_can_B").Find("Water_Level")).gameObject;
		wateringCanItem = ((Component)this).GetComponent<WateringCanItem>();
	}

	public void Update()
	{
		//IL_0045: 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_0065: Unknown result type (might be due to invalid IL or missing references)
		UpdatePouringWater();
		float num = Mathf.Lerp(minWaterLevelPosition, maxWaterLevelPosition, wateringCanItem.water / wateringCanItem.totalPourTime);
		waterLevel.transform.localPosition = new Vector3(waterLevel.transform.localPosition.x, num, waterLevel.transform.localPosition.z);
		if (isPouring && !audioStarted)
		{
			audioSource.Play();
			audioSource.volume = 0f;
			audioStarted = true;
		}
		if (isPouring)
		{
			audioSource.volume = Mathf.Lerp(audioSource.volume, volume, 10f * Time.deltaTime);
		}
		if (!isPouring)
		{
			audioSource.volume = Mathf.Lerp(audioSource.volume, 0f, 10f * Time.deltaTime);
			if (audioSource.volume <= 0.01f)
			{
				audioSource.Stop();
			}
		}
		if (!isPouring && audioStarted)
		{
			audioStarted = false;
		}
	}

	public void UpdatePouringWater()
	{
		if (!((MonoBehaviourPun)this).photonView.IsMine)
		{
			return;
		}
		bool flag = item.isUsingPrimary;
		if (Object.op_Implicit((Object)(object)wateringCanItem) && wateringCanItem.water <= 0f)
		{
			flag = false;
		}
		if (flag != isPouring)
		{
			if (flag)
			{
				((MonoBehaviourPun)this).photonView.RPC("RPC_StartPouringWater", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				((MonoBehaviourPun)this).photonView.RPC("RPC_EndPouringWater", (RpcTarget)0, Array.Empty<object>());
			}
			isPouring = flag;
		}
	}

	[PunRPC]
	public void RPC_StartPouringWater()
	{
		//IL_0032: 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)
		isPouring = true;
		if (Object.op_Implicit((Object)(object)particle))
		{
			if (!particle.isPlaying)
			{
				particle.Play();
			}
			EmissionModule emission = particle.emission;
			((EmissionModule)(ref emission)).enabled = true;
		}
	}

	[PunRPC]
	public void RPC_EndPouringWater()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		isPouring = false;
		if (Object.op_Implicit((Object)(object)particle))
		{
			EmissionModule emission = particle.emission;
			((EmissionModule)(ref emission)).enabled = false;
		}
	}
}
public class WateringCan_CustomMethods : MonoBehaviourPun
{
	public float coolOffCooldown;

	public void Update()
	{
		if (coolOffCooldown > 0f)
		{
			coolOffCooldown -= Time.deltaTime;
		}
	}

	[PunRPC]
	public void RPC_InstantiateFruit(Vector3 bushPosition, Vector3 spawnSpot)
	{
		//IL_0000: 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_0064: 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_0096: 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)
		Collider[] array = Physics.OverlapSphere(bushPosition, 0.3f);
		Collider[] array2 = array;
		foreach (Collider val in array2)
		{
			if (((Object)val).name.Contains("berrybush ") && ((Component)val).gameObject.layer == 21)
			{
				GameObject gameObject = ((Component)val).gameObject;
				GameObject randomItem = LootData.GetRandomItem(((Spawner)gameObject.GetComponent<BerryBush>()).GetSpawnPool());
				GameObject val2 = PhotonNetwork.InstantiateItemRoom(((Object)randomItem).name, spawnSpot, Quaternion.identity);
				val2.GetComponent<PhotonView>().RPC("SetKinematicRPC", (RpcTarget)3, new object[3]
				{
					true,
					val2.transform.position,
					val2.transform.rotation
				});
				Plugin.Log.LogInfo((object)(((Object)randomItem).name + " instantiated!"));
			}
		}
	}
}
public class WateringCan_SetFlareUnlitRPC : ItemComponent
{
	public override void OnInstanceDataSet()
	{
	}

	[PunRPC]
	public void SetFlareUnlitRPC()
	{
		Dynamite component = ((Component)this).GetComponent<Dynamite>();
		((ItemComponent)component).GetData<BoolItemData>((DataEntryKey)3).Value = false;
		((ItemComponent)component).GetData<FloatItemData>((DataEntryKey)10, (Func<FloatItemData>)component.SetupDefaultFuel).Value = component.startingFuseTime;
		component.lightFuseRadius = 0f;
		((Component)component.sparks).gameObject.SetActive(false);
		((Component)component.sparksPhotosensitive).gameObject.SetActive(false);
		GameObject[] array = (from gameObject in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0)
			where ((Object)gameObject).name.Contains("VFX_DynamiteSmoke")
			select gameObject).ToArray();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			TrackNetworkedObject component2 = val.GetComponent<TrackNetworkedObject>();
			if ((Object)(object)component2 != (Object)null && (Object)(object)component2.trackedObject != (Object)null && (Object)(object)component2.trackedObject == (Object)(object)component.trackable)
			{
				val.GetComponent<ParticleSystem>().Stop();
				val.GetComponent<AudioLoop>().volume = 0f;
				GameObject gameObject2 = ((Component)val.transform.Find("end")).gameObject;
				gameObject2.GetComponent<SFX_PlayOneShot>().afterPlayAction = DestroySmoke(val);
				gameObject2.SetActive(true);
			}
		}
		Plugin.Log.LogInfo((object)"Putting off dynamite!");
	}

	public Action DestroySmoke(GameObject smoke)
	{
		Object.Destroy((Object)(object)smoke);
		return null;
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace WateringCan
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("WateringCan", "Watering Can", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<bool> showWateringSphere;

		public const string Id = "WateringCan";

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "Watering Can";

		public static string Version => "1.0.0";

		private void Awake()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Plugin Watering Can is loaded!");
			showWateringSphere = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Show Watering Sphere", false, "If true, allows to toggle the visibility of the watering sphere.");
			BundleLoader.LoadBundleAndContentsWithName((BaseUnityPlugin)(object)this, "watering_can_bundle.peakbundle", (Action<PeakBundle>)delegate(PeakBundle bundle)
			{
				UnityItemContent val = bundle.LoadAsset<UnityItemContent>("Watering_Can");
				((Component)val.Item).gameObject.AddComponent<WateringCanVFX>();
				((Component)val.Item).gameObject.AddComponent<WateringCanItem>();
			});
			new Harmony("com.github.DaxxPurpura.WateringCan").PatchAll();
		}
	}
}
namespace WateringCan.Patches
{
	[HarmonyPatch(typeof(Character), "Awake")]
	public class CharacterAwakePatch
	{
		private static void Postfix(Character __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<WateringCan_CustomMethods>() == (Object)null)
			{
				Plugin.Log.LogInfo((object)("Adding custom methods to " + __instance.characterName + "'s character."));
				((Component)__instance).gameObject.AddComponent<WateringCan_CustomMethods>();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}