Decompiled source of MoreCameras v1.0.0

Freshpolakke_CameraInShop.dll

Decompiled an hour 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 BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Camera_in_shop(polbol)")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Camera_in_shop(polbol)")]
[assembly: AssemblyTitle("Camera_in_shop(polbol)")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
[BepInPlugin("Freshpolakke_CameraInShop", "More Cameras", "1.0.0")]
public class MoreCamerasPlugin : BaseUnityPlugin
{
	private ConfigEntry<int> cameraPrice;

	private void Awake()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		cameraPrice = ((BaseUnityPlugin)this).Config.Bind<int>("General", "CameraPrice", 0, new ConfigDescription("PriceOfCamera.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>()));
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		IEnumerable<Item> enumerable = from i in Resources.FindObjectsOfTypeAll<Item>()
			where (Object)(object)i != (Object)null && ((((Object)i).name != null && ((Object)i).name.ToLower().Contains("camera")) || (i.displayName != null && i.displayName.ToLower().Contains("camera")))
			select i;
		foreach (Item item in enumerable)
		{
			item.purchasable = true;
			item.price = cameraPrice.Value;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Camera is available in shop! " + ((Object)item).name + " (Price: " + cameraPrice.Value + ")"));
		}
	}
}