Decompiled source of AK Gun v0.1.0

plugins/com.github.TheCodinPro.AK_Gun.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Peak.Afflictions;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("com.github.TheCodinPro.AK_Gun")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+8c724acd8f530c71c44320569f1b54194c88dcc6")]
[assembly: AssemblyProduct("com.github.TheCodinPro.AK_Gun")]
[assembly: AssemblyTitle("AK_Gun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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;
		}
	}
}
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 AK_Gun
{
	public class Action_Ammo : ItemAction
	{
		public bool consumeOnFullyUsed;

		[PunRPC]
		public void ReduceUsesRPC()
		{
			OptionableIntItemData data = ((ItemActionBase)this).item.GetData<OptionableIntItemData>((DataEntryKey)2);
			if (data.HasData && data.Value > 0)
			{
				data.Value--;
				if (((ItemActionBase)this).item.totalUses > 0)
				{
					((ItemActionBase)this).item.SetUseRemainingPercentage((float)data.Value / (float)((ItemActionBase)this).item.totalUses);
				}
				if (data.Value == 0 && consumeOnFullyUsed && Object.op_Implicit((Object)(object)((ItemActionBase)this).character) && ((ItemActionBase)this).character.IsLocal && (Object)(object)((ItemActionBase)this).character.data.currentItem == (Object)(object)((ItemActionBase)this).item)
				{
					((MonoBehaviour)((ItemActionBase)this).item).StartCoroutine(((ItemActionBase)this).item.ConsumeDelayed(false));
				}
			}
		}
	}
	public class Action_Gun : ItemAction
	{
		public float maxDistance;

		public float dartCollisionSize;

		[SerializeReference]
		public Affliction[] afflictionsOnHit;

		public Transform spawnTransform;

		public GameObject dartVFX;

		private LayerType layerMaskType;

		private RaycastHit lineHit;

		private RaycastHit[] sphereHits;

		private RaycastHit[] itemSphereHits;

		private float lastShootTime;

		public float fireRate = 0.5f;

		private bool isFiring;

		public SFX_Instance shotSFX;

		private Item lastHitItem;

		public Action OnShoot;

		private Vector3 originalDefaultPos;

		public override void RunAction()
		{
			if (Time.time > lastShootTime + fireRate)
			{
				Debug.Log((object)("Shot, firerate:" + fireRate + ". lastShootTime:" + lastShootTime));
				lastShootTime = Time.time;
				FireGun();
			}
		}

		public override void Start()
		{
			//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)
			originalDefaultPos = ((ItemActionBase)this).item.defaultPos;
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.color = Color.red;
			Gizmos.DrawWireSphere(spawnTransform.position, dartCollisionSize);
		}

		private void FireGun()
		{
			//IL_0057: 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_0077: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviourPun)((ItemActionBase)this).item).photonView.RPC("ReduceUsesRPC", (RpcTarget)0, Array.Empty<object>());
			if (OnShoot != null)
			{
				OnShoot();
			}
			if (Object.op_Implicit((Object)(object)shotSFX))
			{
				shotSFX.Play(((Component)this).transform.position);
			}
			Physics.Raycast(spawnTransform.position, ((Component)MainCamera.instance).transform.forward, ref lineHit, maxDistance, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1);
			if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref lineHit)).collider))
			{
				((RaycastHit)(ref lineHit)).distance = maxDistance;
				((RaycastHit)(ref lineHit)).point = spawnTransform.position + ((Component)MainCamera.instance).transform.forward * maxDistance;
			}
			sphereHits = Physics.SphereCastAll(spawnTransform.position, dartCollisionSize, ((Component)MainCamera.instance).transform.forward, ((RaycastHit)(ref lineHit)).distance, LayerMask.GetMask(new string[1] { "Character" }), (QueryTriggerInteraction)1);
			RaycastHit[] array = sphereHits;
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit val = array[i];
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
				{
					continue;
				}
				Character componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Character>();
				Debug.Log((object)("Character: " + (object)componentInParent));
				if (Object.op_Implicit((Object)(object)componentInParent))
				{
					Debug.Log((object)"HIT");
					if ((Object)(object)componentInParent != (Object)(object)((ItemActionBase)this).character)
					{
						GunImpact(componentInParent, spawnTransform.position, ((RaycastHit)(ref val)).point);
						return;
					}
				}
			}
			GunImpact(null, spawnTransform.position, ((RaycastHit)(ref lineHit)).point);
			itemSphereHits = Physics.SphereCastAll(spawnTransform.position, dartCollisionSize, ((Component)MainCamera.instance).transform.forward, ((RaycastHit)(ref lineHit)).distance, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1);
			RaycastHit[] array2 = itemSphereHits;
			for (int j = 0; j < array2.Length; j++)
			{
				RaycastHit val2 = array2[j];
				if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider))
				{
					Item componentInParent2 = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<Item>();
					Debug.Log((object)("Item: " + (object)componentInParent2));
					if (Object.op_Implicit((Object)(object)componentInParent2) && (Object)(object)componentInParent2 != (Object)(object)((Component)this).GetComponentInParent<Item>())
					{
						Debug.Log((object)"Item was hit!");
						GunItemImpact(componentInParent2, spawnTransform.position, ((RaycastHit)(ref val2)).point);
						return;
					}
				}
			}
			int num = 2;
		}

		public void Update()
		{
		}

		private void GunImpact(Character hitCharacter, Vector3 origin, Vector3 endpoint)
		{
			//IL_00e0: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_005f: 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.op_Implicit((Object)(object)hitCharacter) && ((Component)hitCharacter).GetComponent<Character>().isZombie)
			{
				Vector3 forward = ((Component)MainCamera.instance).transform.forward;
				((MonoBehaviourPun)hitCharacter).photonView.RPC("RPC_ShootSelfT", (RpcTarget)0, new object[3]
				{
					0.25f,
					((MonoBehaviourPun)hitCharacter).photonView.ViewID,
					-(forward * 2f)
				});
			}
			else if (Object.op_Implicit((Object)(object)hitCharacter))
			{
				((MonoBehaviourPun)this).photonView.RPC("RPC_GunImpact", (RpcTarget)0, new object[4]
				{
					((MonoBehaviourPun)hitCharacter).photonView.Owner,
					origin,
					endpoint,
					((Component)MainCamera.instance).transform.forward
				});
			}
			else
			{
				((MonoBehaviourPun)this).photonView.RPC("RPC_GunImpact", (RpcTarget)0, new object[4]
				{
					null,
					origin,
					endpoint,
					((Component)MainCamera.instance).transform.forward
				});
			}
		}

		private void GunItemImpact(Item hitItem, Vector3 origin, Vector3 endpoint)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			lastHitItem = hitItem;
			((MonoBehaviourPun)this).photonView.RPC("RPC_GunItemImpact", (RpcTarget)0, new object[3]
			{
				origin,
				endpoint,
				((Component)MainCamera.instance).transform.forward
			});
		}

		[PunRPC]
		private void RPC_GunImpact(Player hitPlayer, Vector3 origin, Vector3 endpoint, Vector3 direction)
		{
			//IL_0076: 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_0087: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			if (hitPlayer != null && hitPlayer.IsLocal)
			{
				Debug.Log((object)"I'M HIT");
				((Component)Character.localCharacter).GetComponent<GunCharacterLaunch>().ShootSelfT(0.25f, Character.localCharacter, -(direction * 2f));
				Affliction[] array = afflictionsOnHit;
				Affliction[] array2 = array;
				foreach (Affliction val in array2)
				{
					Character.localCharacter.refs.afflictions.AddAffliction(val, false);
				}
			}
			Object.Instantiate<GameObject>(dartVFX, endpoint, Quaternion.identity);
			GamefeelHandler.instance.AddPerlinShakeProximity(endpoint, 5f, 0.2f, 15f, 10f);
		}

		[PunRPC]
		private void RPC_GunItemImpact(Vector3 origin, Vector3 endpoint, Vector3 direction)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)lastHitItem))
			{
				Vector3 val = direction * 25f;
				((MonoBehaviourPun)lastHitItem).photonView.RPC("RPC_ShootSelfT", (RpcTarget)0, new object[2] { 0.5f, direction });
				Debug.Log((object)"Item launched");
			}
			Object.Instantiate<GameObject>(dartVFX, endpoint, Quaternion.identity);
			Debug.Log((object)"Spawning DartVFX");
			GamefeelHandler.instance.AddPerlinShakeProximity(endpoint, 5f, 0.2f, 15f, 10f);
			Debug.Log((object)"Playing PerlinShake.");
		}
	}
	public class AKVFX : ItemVFX
	{
		public ParticleSystem akParticles;

		public override void Start()
		{
			((ItemVFX)this).Start();
			OnEnable();
		}

		public void OnEnable()
		{
			Subscribe();
		}

		public void OnDisable()
		{
			Unsubscribe();
		}

		public void Subscribe()
		{
			Action_Gun component = ((Component)base.item).GetComponent<Action_Gun>();
			component.OnShoot = (Action)Delegate.Combine(component.OnShoot, new Action(RunAction));
		}

		public void RunAction()
		{
			akParticles.Play();
		}

		public void Unsubscribe()
		{
			Action_Gun component = ((Component)base.item).GetComponent<Action_Gun>();
			component.OnShoot = (Action)Delegate.Remove(component.OnShoot, new Action(RunAction));
		}
	}
	public class GunCharacterLaunch : MonoBehaviour
	{
		public float shotTime;

		private Character characterGettingShot;

		private Vector3 shotDirection;

		internal static ManualLogSource Logger { get; private set; }

		public void Start()
		{
			characterGettingShot = Character.localCharacter;
		}

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

		public void ShootSelfT(float howLongToFly, Character whoIsGettingShot, Vector3 whichDirectionShooting)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			shotTime = howLongToFly;
			characterGettingShot = whoIsGettingShot;
			shotDirection = whichDirectionShooting;
		}

		[PunRPC]
		public void RPC_ShootSelfT(float howLongToFly, int CharacterViewID, Vector3 whichDirectionShooting)
		{
			//IL_0073: 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)
			PhotonView val = PhotonView.Find(CharacterViewID);
			if ((Object)(object)val != (Object)null)
			{
				Character component = ((Component)val).GetComponent<Character>();
				if ((Object)(object)component != (Object)null)
				{
					characterGettingShot = component;
				}
				else
				{
					Debug.LogError((object)$"Character {CharacterViewID} not found");
					characterGettingShot = Character.localCharacter;
				}
			}
			else
			{
				Debug.LogError((object)$"PhotonView {CharacterViewID} not found");
				characterGettingShot = Character.localCharacter;
			}
			shotTime = howLongToFly;
			shotDirection = whichDirectionShooting;
		}

		public void UpdateShotPhysicsT()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = shotDirection * 25f * -1f;
			characterGettingShot.Fall(0.5f, 0f);
			characterGettingShot.AddForce(val, 1f, 1f);
		}
	}
	public static class CharacterExtensions
	{
		public static void AddForce(this Character input, Vector3 move, float minRandomMultiplier, float maxRandomMultiplier, ForceMode forceMode = 5)
		{
			//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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"is running add force");
			foreach (Bodypart part in input.refs.ragdoll.partList)
			{
				Vector3 val = move;
				if ((double)minRandomMultiplier != (double)maxRandomMultiplier)
				{
					val *= Random.Range(minRandomMultiplier, maxRandomMultiplier);
				}
				Vector3 val2 = val;
				part.AddForce(val2, forceMode);
			}
		}
	}
	public class GunItemLaunch : MonoBehaviour
	{
		public float shotTime;

		private Item itemGettingShot;

		private Vector3 shotDirection;

		internal static ManualLogSource Logger { get; private set; }

		public void Start()
		{
		}

		public void Update()
		{
			if (shotTime > 0f)
			{
				shotTime -= Time.deltaTime;
				((Component)this).GetComponent<PhotonView>().RPC("UpdateShotPhysicsT", (RpcTarget)0, Array.Empty<object>());
			}
		}

		public void ShootSelfT(float howLongToFly, Item whoIsGettingShot, Vector3 whichDirectionShooting)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			shotTime = howLongToFly;
			itemGettingShot = whoIsGettingShot;
			shotDirection = whichDirectionShooting;
		}

		[PunRPC]
		public void RPC_ShootSelfT(float howLongToFly, Vector3 whichDirectionShooting)
		{
			//IL_0014: 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)
			itemGettingShot = ((Component)this).GetComponent<Item>();
			shotTime = howLongToFly;
			shotDirection = whichDirectionShooting;
		}

		[PunRPC]
		public void UpdateShotPhysicsT()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			Vector3 val = shotDirection * 25f;
			((Component)itemGettingShot).GetComponent<Rigidbody>().AddForce(val, (ForceMode)1);
		}
	}
	[HarmonyPatch(typeof(Character))]
	internal class GunPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AddGunCharacterLaunch(Character __instance)
		{
			((Component)__instance).gameObject.AddComponent<GunCharacterLaunch>();
		}
	}
	[HarmonyPatch(typeof(Item))]
	internal class GunPatchItem
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AddGunCharacterLaunch(Character __instance)
		{
			((Component)__instance).gameObject.AddComponent<GunItemLaunch>();
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.github.TheCodinPro.AK_Gun", "AK_Gun", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass13_0
		{
			public Scene scene;
		}

		private static readonly DateTime December1St = new DateTime((DateTime.Now.Month == 1) ? (DateTime.Now.Year - 1) : DateTime.Now.Year, 12, 1);

		private static readonly DateTime January6St = new DateTime(((DateTime.Now.Month == 1) ? (DateTime.Now.Year - 1) : DateTime.Now.Year) + 1, 1, 6);

		private Coroutine? LevelLoadCompleteCoroutine;

		private static GameObject AK;

		public const string Id = "com.github.TheCodinPro.AK_Gun";

		public static bool IsHoliday { get; private set; } = false;


		internal static ManualLogSource Log { get; private set; } = null;


		public static string Name => "AK_Gun";

		public static string Version => "0.1.0";

		private void Awake()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			DateTime now = DateTime.Now;
			if (now > December1St && now < January6St)
			{
				IsHoliday = true;
				Log.LogInfo((object)$"Happy Holidays! The holiday season will end in {January6St - now:%d} days");
			}
			else
			{
				IsHoliday = false;
				Log.LogInfo((object)$"Next holiday season will start in {December1St - now:%d} days.");
			}
			Log.LogInfo((object)"Patching sceneLoaded...");
			SceneManager.sceneLoaded += OnSceneLoaded;
			LocalizationFix();
			BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "ak.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
			{
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Expected O, but got Unknown
				UnityItemContent val2 = peakBundle.LoadAsset<UnityItemContent>("IC_AK");
				SFX_Instance shotSFX = peakBundle.LoadAsset<SFX_Instance>("SFX_AK");
				GameObject dartVFX = peakBundle.LoadAsset<GameObject>("VFX_AK");
				AK = val2.ItemPrefab;
				AK.AddComponent<Action_Ammo>();
				Action_Gun action_Gun = AK.AddComponent<Action_Gun>();
				action_Gun.maxDistance = 500f;
				action_Gun.dartCollisionSize = 0.3f;
				action_Gun.fireRate = 0.15f;
				((ItemAction)action_Gun).OnHeld = true;
				action_Gun.spawnTransform = ((Component)AK.transform.FindChild("SpawnPos")).transform;
				action_Gun.shotSFX = shotSFX;
				action_Gun.dartVFX = dartVFX;
				action_Gun.afflictionsOnHit = (Affliction[])(object)new Affliction[1];
				action_Gun.afflictionsOnHit[0] = (Affliction)new Affliction_AdjustStatus((STATUSTYPE)0, 0.1f, 1f);
				Log.LogInfo((object)((object)action_Gun.afflictionsOnHit[0]).ToString());
				AKVFX aKVFX = AK.AddComponent<AKVFX>();
				aKVFX.akParticles = ((Component)AK.transform.FindChild("VFX_Gunshot")).gameObject.GetComponent<ParticleSystem>();
				peakBundle.Mod.RegisterContent();
			});
			Harmony val = new Harmony(Name ?? "");
			val.PatchAll();
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass13_0 CS$<>8__locals0 = new <>c__DisplayClass13_0();
			CS$<>8__locals0.scene = scene;
			Log.LogInfo((object)("Loaded scene: " + ((Scene)(ref CS$<>8__locals0.scene)).path));
			if (((Scene)(ref CS$<>8__locals0.scene)).path.StartsWith("Assets/8_SCENES/Generated/"))
			{
				Log.LogInfo((object)"started loading level scenes...");
				if (LevelLoadCompleteCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(LevelLoadCompleteCoroutine);
					LevelLoadCompleteCoroutine = null;
				}
				LevelLoadCompleteCoroutine = ((MonoBehaviour)this).StartCoroutine(PatchAfterLoadFinished());
			}
			[IteratorStateMachine(typeof(<>c__DisplayClass13_0.<<OnSceneLoaded>g__PatchAfterLoadFinished|0>d))]
			IEnumerator PatchAfterLoadFinished()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass13_0.<<OnSceneLoaded>g__PatchAfterLoadFinished|0>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
		}

		private static void createItemSpawners()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("BingBong_Spawner");
			GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.parent);
			val2.SetActive(false);
			((Object)val2).name = "AK_Spawner";
			val2.transform.localPosition = new Vector3(-10.862f, 0.7437f, -4.13f);
			Log.LogInfo((object)("Spawning " + ((Object)val2).name));
			try
			{
				val2.GetComponent<SingleItemSpawner>().prefab = AK;
				Log.LogInfo((object)("Setting " + ((Object)val2).name + "'s prefab to " + ((Object)val2.GetComponent<SingleItemSpawner>().prefab).name));
				val2.SetActive(true);
				val2.GetComponent<SingleItemSpawner>().TrySpawnItems();
			}
			catch (Exception ex)
			{
				Log.LogInfo((object)("Failed to spawn " + ((Object)val2).name + ": " + ex.Message));
			}
		}

		private static void LocalizationFix()
		{
			LocalizedText.mainTable["NAME_AK"] = new List<string>(15)
			{
				"AK-47", "AK-47", "AK-47", "AK-47", "AK-47", "AK-47", "AK-47", "AK-47", "AK-47", "AK-47",
				"AK-47", "AK-47", "AK-47", "AK-47", "AK-47"
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}