Decompiled source of CanUseValuable v0.9.0

plugins/yazirushi-CanUseValuable/CanUseValuable.dll

Decompiled 3 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CanUseValuable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CanUseValuable")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef7453df-f4ea-49c8-947f-b92fc32ec0f7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CanUseValuable;

[BepInPlugin("yazirushi.CanUseValuable", "CanUseValuable", "0.9.0")]
public class CanUseValuable : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("yazirushi.CanUseValuable");

	internal static ManualLogSource mls;

	public static ConfigEntry<bool> EnableLogging;

	public static ConfigEntry<bool> Enable_mod;

	public static ConfigEntry<bool> Enable_staff;

	public static ConfigEntry<int> UseLimit_staff;

	public static ConfigEntry<float> UseTime_staff;

	public static ConfigEntry<float> CoolTime_staff;

	public static ConfigEntry<bool> Enable_levitationPotion;

	public static ConfigEntry<int> UseLimit_levitationPotion;

	public static ConfigEntry<float> CoolTime_levitationPotion;

	public static ConfigEntry<bool> Enable_camera;

	public static ConfigEntry<int> UseLimit_camera;

	public static ConfigEntry<float> CoolTime_camera;

	public static ConfigEntry<KeyCode> ConvertKey;

	private void Awake()
	{
		Enable_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable", true, "---");
		Enable_staff = ((BaseUnityPlugin)this).Config.Bind<bool>("WizardStaff", "Enable", true, "---");
		UseLimit_staff = ((BaseUnityPlugin)this).Config.Bind<int>("WizardStaff", "UseLimit", 5, "---");
		UseTime_staff = ((BaseUnityPlugin)this).Config.Bind<float>("WizardStaff", "UseTime", 10f, "---");
		CoolTime_staff = ((BaseUnityPlugin)this).Config.Bind<float>("WizardStaff", "CoolTime", 20f, "---");
		Enable_levitationPotion = ((BaseUnityPlugin)this).Config.Bind<bool>("WizardLevitationPotion", "Enable", true, "---");
		UseLimit_levitationPotion = ((BaseUnityPlugin)this).Config.Bind<int>("WizardLevitationPotion", "UseLimit", 3, "---");
		CoolTime_levitationPotion = ((BaseUnityPlugin)this).Config.Bind<float>("WizardLevitationPotion", "CoolTime", 60f, "---");
		Enable_camera = ((BaseUnityPlugin)this).Config.Bind<bool>("Manor&ArcticCamera", "Enable", true, "---");
		UseLimit_camera = ((BaseUnityPlugin)this).Config.Bind<int>("Manor&ArcticCamera", "UseLimit", 30, "---");
		CoolTime_camera = ((BaseUnityPlugin)this).Config.Bind<float>("Manor&ArcticCamera", "CoolTime", 2.5f, "---");
		EnableLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("DebugLog", "EnableLogging", false, "Display debug logs");
		mls = ((BaseUnityPlugin)this).Logger;
		mls.LogInfo((object)"Starting CanUseValuable...");
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
public class Reset_Patch
{
	private static void Postfix(PlayerAvatar __instance)
	{
		if (!((Object)(object)__instance == (Object)null))
		{
			if ((Object)(object)((Component)__instance).GetComponent<Sync_Patch>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<Sync_Patch>();
			}
			Sync_Patch component = ((Component)__instance).GetComponent<Sync_Patch>();
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"Awake : init");
			}
			component.enable_mod = false;
			component.enable_staff = false;
			component.useLimit_staff = 0;
			component.useTime_staff = 0f;
			component.coolTime_staff = 0f;
			component.useCount_staff.Clear();
			component.currentCoolTime_staff.Clear();
			component.enable_levitationPotion = false;
			component.useLimit_levitationPotion = 0;
			component.coolTime_levitationPotion = 0f;
			component.useCount_levitationPotion.Clear();
			component.currentCoolTime_levitationPotion.Clear();
			component.enable_camera = false;
			component.useLimit_camera = 0;
			component.coolTime_camera = 0f;
			component.useCount_camera.Clear();
			component.currentCoolTime_camera.Clear();
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				component.Permission();
			}
		}
	}
}
[HarmonyPatch(typeof(PlayerController), "Update")]
public class Conversion_Patch
{
	private static readonly FieldInfo fieldLaserTimer = AccessTools.Field(typeof(ValuableWizardStaff), "laserTimer");

	private static void Postfix(PlayerController __instance)
	{
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0552: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_0751: Unknown result type (might be due to invalid IL or missing references)
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0674: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)null)
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"Postfix : __instance == null");
			}
			return;
		}
		if ((Object)(object)__instance.playerAvatarScript == (Object)null)
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"Postfix : playerAvatar = null");
			}
			return;
		}
		if (!__instance.playerAvatarScript.photonView.IsMine && SemiFunc.IsMultiplayer())
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"Postfix : this photonView is not mine");
			}
			return;
		}
		Sync_Patch component = ((Component)__instance.playerAvatarScript).GetComponent<Sync_Patch>();
		if (!component.enable_mod || !__instance.physGrabActive || (Object)(object)__instance.physGrabObject == (Object)null)
		{
			return;
		}
		string _playerId = SemiFunc.PlayerGetSteamID(__instance.playerAvatarScript);
		float value;
		if (component.enable_staff)
		{
			ValuableWizardStaff component2 = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(__instance.playerAvatarScript.physGrabber)).GetComponent<ValuableWizardStaff>();
			if ((Object)(object)component2 != (Object)null)
			{
				int instanceID = ((Object)component2).GetInstanceID();
				bool flag = false;
				if (component.currentCoolTime_staff.TryGetValue(instanceID, out value))
				{
					flag = true;
				}
				float num = (float)fieldLaserTimer.GetValue(component2);
				if (num > 0f)
				{
					if (CanUseValuable.EnableLogging.Value)
					{
						CanUseValuable.mls.LogInfo((object)"Postfix : This staff is currently in use");
					}
					ItemInfoExtraUI.instance.ItemInfoText($"This staff is currently in use. It will stop in {(int)num + 1} seconds", Color.cyan);
					return;
				}
				if (flag)
				{
					if (component.useCount_staff[instanceID] >= component.useLimit_staff && component.useLimit_staff > 0)
					{
						if (CanUseValuable.EnableLogging.Value)
						{
							CanUseValuable.mls.LogInfo((object)"Postfix : now this staff is reach uselimit");
						}
						ItemInfoExtraUI.instance.ItemInfoText("This staff can no longer be used.", Color.red);
						return;
					}
					if (component.currentCoolTime_staff[instanceID] > 0f)
					{
						if (CanUseValuable.EnableLogging.Value)
						{
							CanUseValuable.mls.LogInfo((object)"Postfix : now this staff is cooltime");
						}
						ItemInfoExtraUI.instance.ItemInfoText($"This staff is currently on cooldown. It will be available in {(int)component.currentCoolTime_staff[instanceID] + 1} seconds.", Color.yellow);
						return;
					}
				}
				int num2 = component.useLimit_staff;
				if (flag)
				{
					num2 -= component.useCount_staff[instanceID];
				}
				string text = InputManager.instance.InputDisplayGet((InputKey)2, (KeyType)0, (MovementDirection)0);
				if (component.useLimit_staff > 0)
				{
					ItemInfoExtraUI.instance.ItemInfoText($"Press [{text}] to use This staff. You have {num2} uses left.", Color.green);
				}
				else
				{
					ItemInfoExtraUI.instance.ItemInfoText("Press [" + text + "] to use This staff.", Color.green);
				}
				if (InputManager.instance.KeyDown((InputKey)2))
				{
					if (CanUseValuable.EnableLogging.Value)
					{
						CanUseValuable.mls.LogInfo((object)$"Postfix : UseStaff staffId={instanceID} inDictionary?{flag}");
					}
					component.UseStaff(_playerId);
				}
				return;
			}
		}
		if (component.enable_levitationPotion)
		{
			ValuableLevitationPotion component3 = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(__instance.playerAvatarScript.physGrabber)).GetComponent<ValuableLevitationPotion>();
			if ((Object)(object)component3 != (Object)null)
			{
				int instanceID2 = ((Object)component3).GetInstanceID();
				bool flag2 = false;
				if (component.currentCoolTime_levitationPotion.TryGetValue(instanceID2, out value))
				{
					flag2 = true;
				}
				if (flag2)
				{
					if (component.useCount_levitationPotion[instanceID2] >= component.useLimit_levitationPotion && component.useLimit_levitationPotion > 0)
					{
						if (CanUseValuable.EnableLogging.Value)
						{
							CanUseValuable.mls.LogInfo((object)"Postfix : now this levitationPotion is reach uselimit");
						}
						ItemInfoExtraUI.instance.ItemInfoText("This levitationPotion can no longer be used.", Color.red);
						return;
					}
					if (component.currentCoolTime_levitationPotion[instanceID2] > 0f)
					{
						if (CanUseValuable.EnableLogging.Value)
						{
							CanUseValuable.mls.LogInfo((object)"Postfix : now this levitationPotion is cooltime");
						}
						ItemInfoExtraUI.instance.ItemInfoText($"This levitationPotion is currently on cooldown. It will be available in {(int)component.currentCoolTime_levitationPotion[instanceID2] + 1} seconds.", Color.yellow);
						return;
					}
				}
				int num3 = component.useLimit_levitationPotion;
				if (flag2)
				{
					num3 -= component.useCount_levitationPotion[instanceID2];
				}
				string text2 = InputManager.instance.InputDisplayGet((InputKey)2, (KeyType)0, (MovementDirection)0);
				if (component.useLimit_levitationPotion > 0)
				{
					ItemInfoExtraUI.instance.ItemInfoText($"Press [{text2}] to use This levitationPotion. You have {num3} uses left.", Color.green);
				}
				else
				{
					ItemInfoExtraUI.instance.ItemInfoText("Press [" + text2 + "] to use This levitationPotion.", Color.green);
				}
				if (InputManager.instance.KeyDown((InputKey)2))
				{
					if (CanUseValuable.EnableLogging.Value)
					{
						CanUseValuable.mls.LogInfo((object)$"Postfix : UseLevitationPotion levitationPotionId={instanceID2} inDictionary?{flag2}");
					}
					component.UseLevitationPotion(_playerId);
				}
				return;
			}
		}
		if (!component.enable_camera)
		{
			return;
		}
		ValuableCamera component4 = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(__instance.playerAvatarScript.physGrabber)).GetComponent<ValuableCamera>();
		if (!((Object)(object)component4 != (Object)null))
		{
			return;
		}
		int instanceID3 = ((Object)component4).GetInstanceID();
		bool flag3 = false;
		if (component.currentCoolTime_camera.TryGetValue(instanceID3, out value))
		{
			flag3 = true;
		}
		if (flag3)
		{
			if (component.useCount_camera[instanceID3] >= component.useLimit_camera && component.useLimit_camera > 0)
			{
				if (CanUseValuable.EnableLogging.Value)
				{
					CanUseValuable.mls.LogInfo((object)"Postfix : now this camera is reach uselimit");
				}
				ItemInfoExtraUI.instance.ItemInfoText("This camera can no longer be used.", Color.red);
				return;
			}
			if (component.currentCoolTime_camera[instanceID3] > 0f)
			{
				if (CanUseValuable.EnableLogging.Value)
				{
					CanUseValuable.mls.LogInfo((object)"Postfix : now this camera is cooltime");
				}
				ItemInfoExtraUI.instance.ItemInfoText($"This camera is currently on cooldown. It will be available in {(int)component.currentCoolTime_camera[instanceID3] + 1} seconds.", Color.yellow);
				return;
			}
		}
		int num4 = component.useLimit_camera;
		if (flag3)
		{
			num4 -= component.useCount_camera[instanceID3];
		}
		string text3 = InputManager.instance.InputDisplayGet((InputKey)2, (KeyType)0, (MovementDirection)0);
		if (component.useLimit_camera > 0)
		{
			ItemInfoExtraUI.instance.ItemInfoText($"Press [{text3}] to use This camera. You have {num4} uses left.", Color.green);
		}
		else
		{
			ItemInfoExtraUI.instance.ItemInfoText("Press [" + text3 + "] to use This camera.", Color.green);
		}
		if (InputManager.instance.KeyDown((InputKey)2))
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)$"Postfix : UseCamera cameraId={instanceID3} inDictionary?{flag3}");
			}
			component.UseCamera(_playerId);
		}
	}
}
public class Sync_Patch : MonoBehaviourPun
{
	public bool enable_mod = false;

	public bool enable_staff = false;

	public int useLimit_staff = 0;

	public float useTime_staff = 0f;

	public float coolTime_staff = 0f;

	public Dictionary<int, float> currentCoolTime_staff = new Dictionary<int, float>();

	public Dictionary<int, int> useCount_staff = new Dictionary<int, int>();

	public bool enable_levitationPotion = false;

	public int useLimit_levitationPotion = 0;

	public float coolTime_levitationPotion = 0f;

	public Dictionary<int, float> currentCoolTime_levitationPotion = new Dictionary<int, float>();

	public Dictionary<int, int> useCount_levitationPotion = new Dictionary<int, int>();

	public bool enable_camera = false;

	public int useLimit_camera = 0;

	public float coolTime_camera = 0f;

	public Dictionary<int, float> currentCoolTime_camera = new Dictionary<int, float>();

	public Dictionary<int, int> useCount_camera = new Dictionary<int, int>();

	public void Update()
	{
		foreach (int item in new List<int>(currentCoolTime_staff.Keys))
		{
			if (currentCoolTime_staff[item] > 0f)
			{
				currentCoolTime_staff[item] -= Time.deltaTime;
			}
		}
		foreach (int item2 in new List<int>(currentCoolTime_levitationPotion.Keys))
		{
			if (currentCoolTime_levitationPotion[item2] > 0f)
			{
				currentCoolTime_levitationPotion[item2] -= Time.deltaTime;
			}
		}
		foreach (int item3 in new List<int>(currentCoolTime_camera.Keys))
		{
			if (currentCoolTime_camera[item3] > 0f)
			{
				currentCoolTime_camera[item3] -= Time.deltaTime;
			}
		}
	}

	public void Permission()
	{
		//IL_00a2: 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)
		if (!SemiFunc.IsMultiplayer())
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"Permission : now mode is single player");
			}
			PermissionRPC(CanUseValuable.Enable_mod.Value, CanUseValuable.Enable_staff.Value, CanUseValuable.UseLimit_staff.Value, CanUseValuable.UseTime_staff.Value, CanUseValuable.CoolTime_staff.Value, CanUseValuable.Enable_levitationPotion.Value, CanUseValuable.UseLimit_levitationPotion.Value, CanUseValuable.CoolTime_levitationPotion.Value, CanUseValuable.Enable_camera.Value, CanUseValuable.UseLimit_camera.Value, CanUseValuable.CoolTime_camera.Value);
			return;
		}
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"Permission : send RPC");
		}
		((MonoBehaviourPun)this).photonView.RPC("PermissionRPC", (RpcTarget)3, new object[11]
		{
			CanUseValuable.Enable_mod.Value,
			CanUseValuable.Enable_staff.Value,
			CanUseValuable.UseLimit_staff.Value,
			CanUseValuable.UseTime_staff.Value,
			CanUseValuable.CoolTime_staff.Value,
			CanUseValuable.Enable_levitationPotion.Value,
			CanUseValuable.UseLimit_levitationPotion.Value,
			CanUseValuable.CoolTime_levitationPotion.Value,
			CanUseValuable.Enable_camera.Value,
			CanUseValuable.UseLimit_camera.Value,
			CanUseValuable.CoolTime_camera.Value
		});
	}

	[PunRPC]
	public void PermissionRPC(bool __enable_mod, bool __enable_staff, int __useLimit_staff, float __useTime_staff, float __coolTime_staff, bool __enable_levitationPotion, int __useLimit_levitationPotion, float __coolTime_levitationPotion, bool __enable_camera, int __useLimit_camera, float __coolTime_camera, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"PermissionRPC : received");
		}
		enable_mod = __enable_mod;
		enable_staff = __enable_staff;
		useLimit_staff = __useLimit_staff;
		useTime_staff = __useTime_staff;
		coolTime_staff = __coolTime_staff;
		enable_levitationPotion = __enable_levitationPotion;
		useLimit_levitationPotion = __useLimit_levitationPotion;
		coolTime_levitationPotion = __coolTime_levitationPotion;
		enable_camera = __enable_camera;
		useLimit_camera = __useLimit_camera;
		coolTime_camera = __coolTime_camera;
	}

	public void UseStaff(string __playerId)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.IsMultiplayer())
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseStaff : now mode is single player");
			}
			UseStaffRPC(__playerId);
			return;
		}
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseStaff : send RPC");
		}
		((MonoBehaviourPun)this).photonView.RPC("UseStaffRPC", (RpcTarget)0, new object[1] { __playerId });
	}

	[PunRPC]
	public void UseStaffRPC(string __playerId, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseStaffRPC : received");
		}
		PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(__playerId);
		ValuableWizardStaff component = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(val.physGrabber)).GetComponent<ValuableWizardStaff>();
		int instanceID = ((Object)component).GetInstanceID();
		PlayerAvatar val2 = SemiFunc.PlayerAvatarLocal();
		Sync_Patch component2 = ((Component)val2).GetComponent<Sync_Patch>();
		if (!component2.currentCoolTime_staff.ContainsKey(instanceID))
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseStaffRPC : add dictionary");
			}
			component2.currentCoolTime_staff.Add(instanceID, 0f);
			component2.useCount_staff.Add(instanceID, 0);
		}
		else if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseStaffRPC : already add dictionary");
		}
		component.StaffLaserRPC(useTime_staff);
		component2.useCount_staff[instanceID]++;
		component2.currentCoolTime_staff[instanceID] = coolTime_staff + useTime_staff;
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseStaffRPC : finish processing");
		}
	}

	public void UseLevitationPotion(string __playerId)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.IsMultiplayer())
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseLevitationPotion : now mode is single player");
			}
			UseLevitationPotionRPC(__playerId);
			return;
		}
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseLevitationPotion : send RPC");
		}
		((MonoBehaviourPun)this).photonView.RPC("UseLevitationPotionRPC", (RpcTarget)0, new object[1] { __playerId });
	}

	[PunRPC]
	public void UseLevitationPotionRPC(string __playerId, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseLevitationPotionRPC : received");
		}
		PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(__playerId);
		ValuableLevitationPotion component = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(val.physGrabber)).GetComponent<ValuableLevitationPotion>();
		int instanceID = ((Object)component).GetInstanceID();
		PlayerAvatar val2 = SemiFunc.PlayerAvatarLocal();
		Sync_Patch component2 = ((Component)val2).GetComponent<Sync_Patch>();
		if (!component2.currentCoolTime_levitationPotion.ContainsKey(instanceID))
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseLevitationPotionRPC : add dictionary");
			}
			component2.currentCoolTime_levitationPotion.Add(instanceID, 0f);
			component2.useCount_levitationPotion.Add(instanceID, 0);
		}
		else if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseLevitationPotionRPC : already add dictionary");
		}
		component.ActivateSphere();
		component2.useCount_levitationPotion[instanceID]++;
		component2.currentCoolTime_levitationPotion[instanceID] = coolTime_levitationPotion;
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseLevitationPotionRPC : finish processing");
		}
	}

	public void UseCamera(string __playerId)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.IsMultiplayer())
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseCamera : now mode is single player");
			}
			UseCameraRPC(__playerId);
			return;
		}
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseCamera : send RPC");
		}
		((MonoBehaviourPun)this).photonView.RPC("UseCameraRPC", (RpcTarget)0, new object[1] { __playerId });
	}

	[PunRPC]
	public void UseCameraRPC(string __playerId, PhotonMessageInfo _info = default(PhotonMessageInfo))
	{
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseCameraRPC : received");
		}
		PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(__playerId);
		ValuableCamera component = ((Component)SemiFunc.PhysGrabberGetGrabbedPhysGrabObject(val.physGrabber)).GetComponent<ValuableCamera>();
		int instanceID = ((Object)component).GetInstanceID();
		PlayerAvatar val2 = SemiFunc.PlayerAvatarLocal();
		Sync_Patch component2 = ((Component)val2).GetComponent<Sync_Patch>();
		if (!component2.currentCoolTime_camera.ContainsKey(instanceID))
		{
			if (CanUseValuable.EnableLogging.Value)
			{
				CanUseValuable.mls.LogInfo((object)"UseCameraRPC : add dictionary");
			}
			component2.currentCoolTime_camera.Add(instanceID, 0f);
			component2.useCount_camera.Add(instanceID, 0);
		}
		else if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseCameraRPC : already add dictionary");
		}
		component.Explosion();
		component2.useCount_camera[instanceID]++;
		component2.currentCoolTime_camera[instanceID] = coolTime_camera;
		if (CanUseValuable.EnableLogging.Value)
		{
			CanUseValuable.mls.LogInfo((object)"UseCameraRPC : finish processing");
		}
	}
}