Decompiled source of FreeShop v1.3.0

CW-FreeShop.dll

Decompiled 7 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 BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CW-FreeShop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("CW-FreeShop")]
[assembly: AssemblyTitle("CW-FreeShop")]
[assembly: AssemblyVersion("1.3.0.0")]
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;
		}
	}
}
namespace CW_FreeShop
{
	[ContentWarningPlugin("FreeShop", "1.3", false)]
	[BepInPlugin("FreeShop", "Free Shop", "1.3")]
	public class FreeShop : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("FreeShop").PatchAll(typeof(FreeShopPatch));
		}
	}
	internal class FreeShopPatch
	{
		[HarmonyPatch(typeof(ShopHandler), "OnAddToCartItemClicked")]
		[HarmonyPrefix]
		private static bool OnAddToCartItemClickedPrefix(byte itemID, Dictionary<byte, ShopItem> ___m_ItemsForSaleDictionary, PhotonView ___m_PhotonView, SFX_Instance ___addSFX, ShopHandler __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!___m_ItemsForSaleDictionary.ContainsKey(itemID))
			{
				return true;
			}
			___m_PhotonView.RPC("RPCA_AddItemToCart", (RpcTarget)0, new object[1] { itemID });
			___addSFX.Play(((Component)__instance).transform.position, false, 1f, (Transform)null);
			return false;
		}

		[HarmonyPatch(typeof(ShopHandler), "OnOrderCartClicked")]
		[HarmonyPrefix]
		private static bool OnOrderCartClickedPrefix(ShoppingCart ___m_ShoppingCart, PhotonView ___m_PhotonView, SFX_Instance ___purchaseSFX, ShopHandler __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (___m_ShoppingCart.IsEmpty)
			{
				return true;
			}
			___purchaseSFX.Play(((Component)__instance).transform.position, false, 1f, (Transform)null);
			byte[] array = ___m_ShoppingCart.Cart.Select(delegate(ShopItem item)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				ShopItem val = item;
				return ((ShopItem)(ref val)).ItemID;
			}).ToArray();
			___m_PhotonView.RPC("RPCA_SpawnDrone", (RpcTarget)0, new object[1] { array });
			__instance.OnClearCartClicked();
			return false;
		}
	}
}