using System;
using System.Collections;
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 Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Settings;
[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("net.catcraze777.plugins.toolgunItem")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("net.catcraze777.plugins.toolgunItem")]
[assembly: AssemblyTitle("ToolgunItem")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 ToolgunItem
{
public class Action_ToolgunFireOnImpact : MonoBehaviour
{
public float triggerVelocity = 20f;
public float triggerChance = 0.2f;
public float triggerCooldown = 5f;
private float lastFireTime = -5f;
private void Awake()
{
lastFireTime = 0f - triggerCooldown;
}
private void OnCollisionEnter(Collision collision)
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
Action_ToolgunReduceUses component = ((Component)this).GetComponent<Action_ToolgunReduceUses>();
int num;
if (component == null || !(component.RemainingUses >= 2))
{
Action_ToolgunReduceUses component2 = ((Component)this).GetComponent<Action_ToolgunReduceUses>();
num = ((component2 != null && component2.RemainingUses < 0) ? 1 : 0);
}
else
{
num = 1;
}
bool flag = (byte)num != 0;
if (flag && !(Time.time - lastFireTime < triggerCooldown))
{
int num2;
if ((Object)(object)((Component)this).GetComponent<Item>().holderCharacter == (Object)null)
{
Vector3 relativeVelocity = collision.relativeVelocity;
num2 = ((((Vector3)(ref relativeVelocity)).magnitude > triggerVelocity) ? 1 : 0);
}
else
{
num2 = 0;
}
if (((uint)num2 & (flag ? 1u : 0u)) != 0 && Random.value < triggerChance)
{
lastFireTime = Time.time;
((Component)this).GetComponent<Action_ToolgunSelectItem>().SpawnItem(impactSpawn: true);
}
}
}
}
public class Action_ToolgunInspectScreen : ItemActionBase
{
[CompilerGenerated]
private sealed class <EnableCameraOverrideWithDelay>d__17 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public Action_ToolgunInspectScreen <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EnableCameraOverrideWithDelay>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
int num = <>1__state;
Action_ToolgunInspectScreen action_ToolgunInspectScreen = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)action_ToolgunInspectScreen.cameraOverride != (Object)null)
{
MainCamera.instance.SetCameraOverride(action_ToolgunInspectScreen.cameraOverride);
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Vector3 inspectItemPosition;
public Vector3 inspectItemForwardVector;
public float cameraZoom = 0.7f;
private Vector3 originalItemPosition;
private Vector3 originalItemForwardVector;
private float originalUsingTime;
private GameObject reticlesObject;
private CameraOverride cameraOverride;
private FovSetting fovSetting;
private Coroutine enableCameraCoroutine;
public override void OnEnable()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((ItemActionBase)this).OnEnable();
originalItemPosition = base.item.defaultPos;
originalItemForwardVector = base.item.defaultForward;
originalUsingTime = base.item.usingTimePrimary;
cameraOverride = ((Component)this).GetComponentInChildren<CameraOverride>();
UpdateCameraOverrideFOV();
if (!((Object)(object)GUIManager.instance != (Object)null))
{
return;
}
Transform[] componentsInChildren = ((Component)GUIManager.instance).GetComponentsInChildren<Transform>();
foreach (Transform val in componentsInChildren)
{
if (((Object)val).name == "Reticles")
{
reticlesObject = ((Component)val).gameObject;
break;
}
}
}
public override void Subscribe()
{
base.item.OnSecondaryStarted = (Action)Delegate.Combine(base.item.OnSecondaryStarted, new Action(StartInspectingScreen));
base.item.OnSecondaryCancelled = (Action)Delegate.Combine(base.item.OnSecondaryCancelled, new Action(StopInspectingScreen));
}
public override void Unsubscribe()
{
base.item.OnSecondaryStarted = (Action)Delegate.Remove(base.item.OnSecondaryStarted, new Action(StartInspectingScreen));
base.item.OnSecondaryCancelled = (Action)Delegate.Remove(base.item.OnSecondaryCancelled, new Action(StopInspectingScreen));
}
private void StartInspectingScreen()
{
enableCameraCoroutine = ((MonoBehaviour)this).StartCoroutine(EnableCameraOverrideWithDelay(0.1f));
UpdateCameraOverrideFOV();
((MonoBehaviourPun)this).photonView.RPC("RPCStartInspectingScreen", (RpcTarget)0, Array.Empty<object>());
GameObject obj = reticlesObject;
if (obj != null)
{
obj.SetActive(false);
}
}
[PunRPC]
private void RPCStartInspectingScreen()
{
//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)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
base.item.defaultPos = inspectItemPosition;
base.item.defaultForward = inspectItemForwardVector;
base.item.usingTimePrimary = -1f;
}
private void StopInspectingScreen()
{
((MonoBehaviourPun)this).photonView.RPC("RPCStopInspectingScreen", (RpcTarget)0, Array.Empty<object>());
if (enableCameraCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(enableCameraCoroutine);
}
if ((Object)(object)cameraOverride != (Object)null)
{
MainCamera.instance.SetCameraOverride((CameraOverride)null);
}
GameObject obj = reticlesObject;
if (obj != null)
{
obj.SetActive(true);
}
}
[PunRPC]
private void RPCStopInspectingScreen()
{
//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)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
base.item.defaultPos = originalItemPosition;
base.item.defaultForward = originalItemForwardVector;
base.item.usingTimePrimary = originalUsingTime;
}
[IteratorStateMachine(typeof(<EnableCameraOverrideWithDelay>d__17))]
private IEnumerator EnableCameraOverrideWithDelay(float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EnableCameraOverrideWithDelay>d__17(0)
{
<>4__this = this,
delay = delay
};
}
private void UpdateCameraOverrideFOV()
{
if ((Object)(object)cameraOverride != (Object)null && SettingsHandler.Instance != null)
{
if (fovSetting == null)
{
fovSetting = SettingsHandler.Instance.GetSetting<FovSetting>();
}
FovSetting obj = fovSetting;
float num = ((obj != null) ? ((FloatSetting)obj).Value : 90f);
cameraOverride.fov = num * cameraZoom;
}
}
}
public class Action_ToolgunParticles : ItemActionBase
{
public float particleWidth = 0.8f;
public float flattestAngle = 15f;
public float sharpestAngle = 70f;
public float recoilStrength = 500f;
public List<float> particleLineWidths = new List<float>(7) { 0.2f, 0.17f, 0.13f, 0.05f, 0.05f, 0.04f, 0.03f };
private Transform barrelForwardTransform;
private Transform shootTrailParticlesTransform;
private Transform spawnSpotParticlesTransform;
private Transform muzzleFlashParticlesTransform;
private AudioSource shootAudio;
public override void OnEnable()
{
((ItemActionBase)this).OnEnable();
Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>();
foreach (Transform val in componentsInChildren)
{
switch (((Object)val).name)
{
case "BarrelForwardTransform":
barrelForwardTransform = val;
break;
case "VFX_ShootPath":
shootTrailParticlesTransform = val;
break;
case "VFX_ItemSpawn":
spawnSpotParticlesTransform = val;
break;
case "VFX_MuzzleFlash":
muzzleFlashParticlesTransform = val;
break;
}
}
AudioSource[] components = ((Component)this).GetComponents<AudioSource>();
foreach (AudioSource val2 in components)
{
if (((Object)val2.resource).name == "toolgunShot")
{
shootAudio = val2;
}
}
}
public void SpawnParticles()
{
//IL_0006: 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_000c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = barrelForwardTransform.position;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(position, barrelForwardTransform.forward, ref val))
{
SpawnParticles(position, ((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal);
}
}
public void SpawnParticles(Vector3 origin, Vector3 destination, Vector3 surfaceNormal)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviourPun)this).photonView.RPC("RPCSpawnParticles", (RpcTarget)0, new object[3] { origin, destination, surfaceNormal });
}
[PunRPC]
public void RPCSpawnParticles(Vector3 origin, Vector3 destination, Vector3 surfaceNormal)
{
//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)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: 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)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)shootTrailParticlesTransform == (Object)null))
{
Vector3 val = destination - origin;
float magnitude = ((Vector3)(ref val)).magnitude;
GameObject val2 = Object.Instantiate<GameObject>(((Component)shootTrailParticlesTransform).gameObject);
val2.transform.position = origin;
val2.transform.LookAt(destination);
val2.AddComponent<DestroyAfterTime>();
ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem val3 in componentsInChildren)
{
ShapeModule shape = val3.shape;
((ShapeModule)(ref shape)).radius = magnitude / 2f;
((ShapeModule)(ref shape)).position = new Vector3(0f, 0f, magnitude / 2f);
EmissionModule emission = val3.emission;
Burst burst = ((EmissionModule)(ref emission)).GetBurst(0);
((Burst)(ref burst)).count = new MinMaxCurve(magnitude * 2f);
((EmissionModule)(ref emission)).SetBurst(0, burst);
val3.Play();
}
val2 = Object.Instantiate<GameObject>(((Component)spawnSpotParticlesTransform).gameObject);
val2.transform.position = destination + surfaceNormal * 0.05f;
val2.transform.LookAt(destination + surfaceNormal);
val2.AddComponent<DestroyAfterTime>();
ParticleSystem[] componentsInChildren2 = val2.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem val4 in componentsInChildren2)
{
val4.Play();
}
val2 = Object.Instantiate<GameObject>(((Component)muzzleFlashParticlesTransform).gameObject);
val2.transform.position = origin;
val2.transform.LookAt(destination);
val2.AddComponent<DestroyAfterTime>();
ParticleSystem[] componentsInChildren3 = val2.GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem val5 in componentsInChildren3)
{
val5.Play();
}
Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
if (component != null)
{
component.AddForceAtPosition(-1f * recoilStrength * val2.transform.forward, val2.transform.position, (ForceMode)1);
}
AudioSource obj = shootAudio;
if (obj != null)
{
obj.Play();
}
}
}
public override void Subscribe()
{
}
public override void Unsubscribe()
{
}
}
internal class Destroy : MonoBehaviour
{
public void Update()
{
if (((Component)this).transform.childCount <= 0)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public class Action_ToolgunReduceUses : Action_ReduceUses
{
public int? RemainingUses => GetRemainingUses();
public override void RunAction()
{
}
public void ReduceUse()
{
((Action_ReduceUses)this).RunAction();
UpdatePercentage();
}
public void UpdatePercentage()
{
int? remainingUses = RemainingUses;
if (remainingUses.HasValue)
{
((ItemActionBase)this).item.SetUseRemainingPercentage(((float)remainingUses.Value - 1f) / ((float)((ItemActionBase)this).item.totalUses - 1f));
}
}
public int? GetRemainingUses()
{
OptionableIntItemData data = ((ItemActionBase)this).item.GetData<OptionableIntItemData>((DataEntryKey)2);
if (!data.HasData)
{
return null;
}
return data.Value;
}
}
public class Action_ToolgunSelectItem : ItemActionBase
{
[CompilerGenerated]
private sealed class <TryAndUpdateIcon>d__16 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Action_ToolgunSelectItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TryAndUpdateIcon>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
Action_ToolgunSelectItem action_ToolgunSelectItem = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)action_ToolgunSelectItem.itemSpawner?.SelectedItem == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
action_ToolgunSelectItem.UpdateIcon();
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public float maxRange = 30f;
public float itemSpawnHeightMultiplier = 0.6f;
public float itemSpawnHeightSpacing = 0.3f;
public GameObject errorMessagePrefab;
private Image itemIconDisplay;
private Sprite errorSprite;
private ToolgunItemSpawner itemSpawner;
private Transform barrelForwardTransform;
private Collider collider;
private AudioSource errorAudio;
private DestroyAfterTimeRestartable errorDestroyTimer;
public bool isErrored;
private Animation errorAnimation;
private T GetComponentByObjectName<T>(string objectName) where T : Component
{
T[] componentsInChildren = ((Component)this).GetComponentsInChildren<T>();
foreach (T val in componentsInChildren)
{
if (((Object)(object)val).name == objectName)
{
return val;
}
}
return default(T);
}
private void Awake()
{
itemIconDisplay = GetComponentByObjectName<Image>("IconImage");
errorSprite = itemIconDisplay.sprite;
barrelForwardTransform = GetComponentByObjectName<Transform>("BarrelForwardTransform");
itemSpawner = ((Component)this).GetComponent<ToolgunItemSpawner>();
collider = ((Component)this).GetComponentInChildren<Collider>();
AudioSource[] components = ((Component)this).GetComponents<AudioSource>();
foreach (AudioSource val in components)
{
if (((Object)val.resource).name == "toolgunError")
{
errorAudio = val;
}
}
}
public override void OnEnable()
{
((ItemActionBase)this).OnEnable();
}
[IteratorStateMachine(typeof(<TryAndUpdateIcon>d__16))]
private IEnumerator TryAndUpdateIcon()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TryAndUpdateIcon>d__16(0)
{
<>4__this = this
};
}
public void UpdateIcon()
{
if ((Object)(object)itemSpawner?.SelectedItem != (Object)null)
{
((MonoBehaviourPun)this).photonView.RPC("RPCUpdateIcon", (RpcTarget)0, new object[1] { isErrored ? (-1) : itemSpawner.currItemIndex });
}
}
public void UpdateIconLocal()
{
RPCUpdateIcon(isErrored ? (-1) : itemSpawner.currItemIndex);
}
[PunRPC]
private void RPCUpdateIcon()
{
RPCUpdateIcon(null);
}
[PunRPC]
private void RPCUpdateIcon(int? selectedItemIndexNullable = null)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
int num = (selectedItemIndexNullable.HasValue ? (selectedItemIndexNullable.Value % itemSpawner.currItemList.Count) : itemSpawner.currItemIndex);
if (num < 0)
{
itemIconDisplay.sprite = errorSprite;
return;
}
Texture2D val = itemSpawner.currItemList[num]?.UIData.icon;
if (!((Object)(object)val == (Object)null))
{
Rect val2 = default(Rect);
((Rect)(ref val2))..ctor(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height);
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(0.5f, 0.5f);
itemIconDisplay.sprite = Sprite.Create(val, val2, val3);
}
}
public void DoErrorEffects(string errorMessage = "", bool setErrorState = true)
{
((MonoBehaviourPun)this).photonView.RPC("RPCDoErrorEffects", (RpcTarget)0, new object[2] { errorMessage, setErrorState });
}
[PunRPC]
private void RPCDoErrorEffects(string errorMessage = "", bool setErrorState = true)
{
AudioSource obj = errorAudio;
if (obj != null)
{
obj.Play();
}
if ((Object)(object)errorMessagePrefab == (Object)null)
{
return;
}
if (SettingsManager.displayFakeErrors)
{
if ((Object)(object)errorAnimation == (Object)null)
{
if ((Object)(object)GUIManager.instance == (Object)null)
{
return;
}
GameObject val = Object.Instantiate<GameObject>(errorMessagePrefab);
errorDestroyTimer = val.AddComponent<DestroyAfterTimeRestartable>();
GUIManager instance = GUIManager.instance;
Transform[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Transform>();
foreach (Transform val2 in componentsInChildren)
{
if (((Object)val2).name == "Canvas_HUD")
{
val.transform.SetParent(val2, false);
break;
}
}
errorAnimation = val.GetComponentInChildren<Animation>();
}
if (errorAnimation.isPlaying)
{
errorAnimation.Stop();
}
errorAnimation.Play();
errorDestroyTimer.RestartTimer();
if (errorMessage != "")
{
ToolgunPlugin.Log.LogError((object)errorMessage);
}
}
if (setErrorState)
{
isErrored = true;
itemIconDisplay.sprite = errorSprite;
}
}
public override void Subscribe()
{
base.item.OnScrolledMouseOnly = (Action<float>)Delegate.Combine(base.item.OnScrolledMouseOnly, new Action<float>(Scrolled));
base.item.OnScrollBackwardPressed = (Action)Delegate.Combine(base.item.OnScrollBackwardPressed, new Action(ScrollLeft));
base.item.OnScrollForwardPressed = (Action)Delegate.Combine(base.item.OnScrollForwardPressed, new Action(ScrollRight));
base.item.OnPrimaryFinishedCast = (Action)Delegate.Combine(base.item.OnPrimaryFinishedCast, new Action(TrySpawnItem));
}
public override void Unsubscribe()
{
base.item.OnScrolledMouseOnly = (Action<float>)Delegate.Remove(base.item.OnScrolledMouseOnly, new Action<float>(Scrolled));
base.item.OnScrollBackwardPressed = (Action)Delegate.Remove(base.item.OnScrollBackwardPressed, new Action(ScrollLeft));
base.item.OnScrollForwardPressed = (Action)Delegate.Remove(base.item.OnScrollForwardPressed, new Action(ScrollRight));
base.item.OnPrimaryFinishedCast = (Action)Delegate.Remove(base.item.OnPrimaryFinishedCast, new Action(TrySpawnItem));
}
private void ScrollLeft()
{
Scrolled(-1f);
}
private void ScrollRight()
{
Scrolled(1f);
}
private void Scrolled(float value)
{
if (!isErrored)
{
if (value < 0f)
{
itemSpawner?.ShiftIndexLeft();
}
else if (value > 0f)
{
itemSpawner?.ShiftIndexRight();
}
UpdateIcon();
}
}
public void TrySpawnItem()
{
TrySpawnItem(impactSpawn: false);
}
public void TrySpawnItem(bool impactSpawn = false)
{
Action_ToolgunReduceUses component = ((Component)this).GetComponent<Action_ToolgunReduceUses>();
if (component != null && component.RemainingUses <= 2)
{
Action_ToolgunReduceUses component2 = ((Component)this).GetComponent<Action_ToolgunReduceUses>();
if (component2 != null && component2.RemainingUses >= 0)
{
DoErrorEffects("Unable to use item more than " + ((SettingsManager.toolgunUses == 2) ? "twice" : $"{SettingsManager.toolgunUses} time(s)") + " due to numerical limitations!");
return;
}
}
SpawnItem(impactSpawn);
}
public void SpawnItem(bool impactSpawn = false)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_0052: 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_005c: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_009b: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_00f6: 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)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
bool flag = (Object)(object)base.item.holderCharacter != (Object)null;
Vector3 val = (flag ? ((Component)MainCamera.instance).transform.position : barrelForwardTransform.position);
Vector3 val2 = (flag ? ((Component)MainCamera.instance).transform.forward : barrelForwardTransform.forward);
RaycastHit val3 = default(RaycastHit);
bool flag2 = Physics.Raycast(val, val2, ref val3, maxRange, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1);
if (flag2)
{
Vector3 point = ((RaycastHit)(ref val3)).point;
Vector3 val4 = ((RaycastHit)(ref val3)).normal;
Vector3 normalized = ((Vector3)(ref val4)).normalized;
Bounds bounds = collider.bounds;
val4 = ((Bounds)(ref bounds)).size;
float magnitude = ((Vector3)(ref val4)).magnitude;
Vector3 position = point + (itemSpawnHeightMultiplier * magnitude + itemSpawnHeightSpacing) * normalized;
Quaternion rotation = ((Component)MainCamera.instance).transform.rotation;
Quaternion rotation2 = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
itemSpawner?.SpawnItem(position, rotation2);
}
else
{
AudioSource obj = errorAudio;
if (obj != null)
{
obj.Play();
}
}
if (!impactSpawn)
{
return;
}
Action_ToolgunReduceUses component = ((Component)this).GetComponent<Action_ToolgunReduceUses>();
DoErrorEffects("Toolgun hit a wall too hard!", component != null && component.RemainingUses.GetValueOrDefault() == 1);
if (flag2)
{
AudioSource obj2 = errorAudio;
if (obj2 != null)
{
obj2.Stop();
}
}
}
}
public class DestroyAfterTimeRestartable : MonoBehaviour
{
[CompilerGenerated]
private sealed class <StartTimer>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public DestroyAfterTimeRestartable <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StartTimer>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
int num = <>1__state;
DestroyAfterTimeRestartable destroyAfterTimeRestartable = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(destroyAfterTimeRestartable.time);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Object.Destroy((Object)(object)((Component)destroyAfterTimeRestartable).gameObject);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public float time = 3f;
private Coroutine _myCoroutine;
private void Start()
{
_myCoroutine = ((MonoBehaviour)this).StartCoroutine(StartTimer());
}
[IteratorStateMachine(typeof(<StartTimer>d__3))]
private IEnumerator StartTimer()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StartTimer>d__3(0)
{
<>4__this = this
};
}
public void RestartTimer()
{
((MonoBehaviour)this).StopAllCoroutines();
_myCoroutine = ((MonoBehaviour)this).StartCoroutine(StartTimer());
}
}
[BepInPlugin("net.catcraze777.plugins.toolgunItem", "ToolgunItem", "1.1.0")]
public class ToolgunPlugin : BaseUnityPlugin
{
private GameObject uiErrorAsset;
public const string Id = "net.catcraze777.plugins.toolgunItem";
internal static ManualLogSource Log { get; private set; }
public static string Name => "ToolgunItem";
public static string Version => "1.1.0";
public void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
SettingsManager.InitSettingsManager(((BaseUnityPlugin)this).Config);
SettingsManager.LoadConfigBindings();
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "toolgunitem.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
//IL_0039: 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)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references)
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("ToolgunContent");
GameObject itemPrefab = val.ItemPrefab;
UnityItemContent val2 = peakBundle.LoadAsset<UnityItemContent>("ToolgunAdminContent");
GameObject itemPrefab2 = val2.ItemPrefab;
uiErrorAsset = peakBundle.LoadAsset<GameObject>("UI_GModError");
AddScriptsToToolgun(itemPrefab, SettingsManager.itemSpawnPool, isAdminSpawner: false, SettingsManager.itemRarity, SettingsManager.toolgunUses);
LootData component = itemPrefab.GetComponent<LootData>();
component.Rarity = SettingsManager.toolgunRarity;
component.spawnLocations = SettingsManager.toolgunSpawnPool;
AddScriptsToToolgun(itemPrefab2, (SpawnPool)0, isAdminSpawner: true, (Rarity)4);
itemPrefab2.GetComponent<Action_ToolgunSelectItem>().maxRange = 999999f;
peakBundle.Mod.RegisterContent();
});
Log.LogInfo((object)"Toolgun item is loaded!");
AddLocalizedText("NAME_TOOLGUN", "TOOLGUN");
AddLocalizedText("NAME_TOOLGUNADMIN", "ADMIN'S TOOLGUN");
AddLocalizedText("SELECT ITEM", "select item");
AddLocalizedText("VIEW SCREEN", "view screen");
AddLocalizedText("SPAWN ITEM", "spawn item");
Log.LogInfo((object)"Plugin net.catcraze777.plugins.toolgunItem is loaded!");
}
private void AddScriptsToToolgun(GameObject toolgunPrefab, SpawnPool itemPool, bool isAdminSpawner = false, Rarity rarityLimit = 4, uint itemUses = 2u)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
toolgunPrefab.AddComponent<Action_ToolgunParticles>();
toolgunPrefab.AddComponent<Action_ToolgunFireOnImpact>();
Action_ToolgunSelectItem action_ToolgunSelectItem = toolgunPrefab.AddComponent<Action_ToolgunSelectItem>();
action_ToolgunSelectItem.errorMessagePrefab = uiErrorAsset;
Action_ToolgunReduceUses action_ToolgunReduceUses = toolgunPrefab.AddComponent<Action_ToolgunReduceUses>();
((ItemAction)action_ToolgunReduceUses).OnCastFinished = true;
Action_ToolgunInspectScreen action_ToolgunInspectScreen = toolgunPrefab.AddComponent<Action_ToolgunInspectScreen>();
action_ToolgunInspectScreen.inspectItemPosition = new Vector3(0f, 0.25f, 0.7f);
Vector3 val = new Vector3(0f, 1f, 1f);
action_ToolgunInspectScreen.inspectItemForwardVector = ((Vector3)(ref val)).normalized;
ToolgunItemSpawner toolgunItemSpawner = toolgunPrefab.AddComponent<ToolgunItemSpawner>();
toolgunItemSpawner.itemPool = itemPool;
toolgunItemSpawner.isAdminSpawner = isAdminSpawner;
toolgunItemSpawner.rarityLimit = (Rarity)(isAdminSpawner ? 6 : ((int)rarityLimit));
toolgunPrefab.GetComponent<Item>().totalUses = (isAdminSpawner ? (-1) : ((int)(itemUses + 2)));
}
public static void AddLocalizedText(string entryName, string entryText)
{
LocalizedText.mainTable[entryName] = new List<string>(15)
{
entryText, entryText, entryText, entryText, entryText, entryText, entryText, entryText, entryText, entryText,
entryText, entryText, entryText, entryText, entryText
};
}
}
public class SettingsManager
{
public static ConfigFile config;
public static ConfigEntry<Rarity> toolgunRarityConfig;
public static ConfigEntry<SpawnPool> toolgunSpawnPoolConfig;
public static ConfigEntry<uint> toolgunUsesConfig;
public static ConfigEntry<SpawnPool> itemSpawnPoolConfig;
public static ConfigEntry<Rarity> itemRarityConfig;
public static ConfigEntry<bool> displayFakeErrorsConfig;
public static Rarity toolgunRarity
{
get
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return (Rarity)(((??)toolgunRarityConfig?.Value) ?? 4);
}
private set
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (toolgunRarityConfig != null)
{
toolgunRarityConfig.Value = value;
}
}
}
public static SpawnPool toolgunSpawnPool
{
get
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
return (SpawnPool)(((??)toolgunSpawnPoolConfig?.Value) ?? 16384);
}
private set
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (toolgunSpawnPoolConfig != null)
{
toolgunSpawnPoolConfig.Value = value;
}
}
}
public static uint toolgunUses
{
get
{
return toolgunUsesConfig?.Value ?? 2;
}
private set
{
if (toolgunUsesConfig != null)
{
toolgunUsesConfig.Value = value;
}
}
}
public static SpawnPool itemSpawnPool
{
get
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
return (SpawnPool)(((??)itemSpawnPoolConfig?.Value) ?? 1024);
}
private set
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (itemSpawnPoolConfig != null)
{
itemSpawnPoolConfig.Value = value;
}
}
}
public static Rarity itemRarity
{
get
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return (Rarity)(((??)itemRarityConfig?.Value) ?? 4);
}
private set
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (itemRarityConfig != null)
{
itemRarityConfig.Value = value;
}
}
}
public static bool displayFakeErrors
{
get
{
return displayFakeErrorsConfig?.Value ?? true;
}
private set
{
if (displayFakeErrorsConfig != null)
{
displayFakeErrorsConfig.Value = value;
}
}
}
public static void InitSettingsManager(ConfigFile inputConfig)
{
config = inputConfig;
}
public static void LoadConfigBindings()
{
//IL_0017: 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_0080: 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)
if (config != null)
{
toolgunRarityConfig = config.Bind<Rarity>("General", "Toolgun Rarity", toolgunRarity, "The rarity of the toolgun. Rarities are assigned a weight used to influence rng pulls, with lower being rarer. Common: 100, Uncommon: 50, Rare: 30, Epic: 20, Legendary: 15, Mythic: 5, RidiculouslyRare: 1");
toolgunSpawnPoolConfig = config.Bind<SpawnPool>("General", "Toolgun Spawn Pool", toolgunSpawnPool, "The spawn/loot pool the toolgun will be added to.");
toolgunUsesConfig = config.Bind<uint>("General", "Toolgun Uses", toolgunUses, "How many items the toolgun can spawn before breaking.");
itemSpawnPoolConfig = config.Bind<SpawnPool>("General", "Toolgun Item Spawn Pool", itemSpawnPool, "The spawn/loot pool the toolgun can spawn items from.");
itemRarityConfig = config.Bind<Rarity>("General", "Toolgun Item Rarity Limit", itemRarity, "Maximum rarity items the toolgun can spawn. If an item is rarer than what's specified here, it will not appear in the toolgun spawn menu.");
displayFakeErrorsConfig = config.Bind<bool>("General", "Display Fake Errors", displayFakeErrors, "Display the error textbox joke or not.");
}
}
}
public class ToolgunItemSpawner : MonoBehaviour
{
public SpawnPool itemPool;
public Rarity rarityLimit = (Rarity)6;
public List<Item> currItemList;
public bool isAdminSpawner;
public Item? SelectedItem
{
get
{
if (currItemList == null || currItemList.Count <= 0)
{
return null;
}
return currItemList[currItemIndex];
}
}
public int currItemIndex { get; private set; }
private void Awake()
{
if (!PhotonNetwork.IsMasterClient)
{
((Component)this).GetComponent<PhotonView>().RPC("RPCRequestSpawnSettings", (RpcTarget)2, Array.Empty<object>());
}
else
{
UpdateItemPool();
}
}
[PunRPC]
internal void RPCRequestSpawnSettings(PhotonMessageInfo info)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
Player sender = info.Sender;
((Component)this).GetComponent<PhotonView>().RPC("RPCSetSpawnSettings", sender, new object[3]
{
SettingsManager.itemSpawnPool,
SettingsManager.itemRarity,
((Component)this).GetComponent<Item>().totalUses
});
}
[PunRPC]
internal void RPCSetSpawnSettings(SpawnPool itemPool, Rarity rarityLimit, int originalUses)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
this.itemPool = itemPool;
this.rarityLimit = rarityLimit;
Item component = ((Component)this).GetComponent<Item>();
component.totalUses = originalUses;
UpdateItemPool();
}
public void UpdateItemPool()
{
//IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
currItemList = new List<Item>();
if (isAdminSpawner)
{
List<Item> objects = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects;
currItemList.AddRange(objects);
}
else
{
foreach (SpawnPool value in Enum.GetValues(typeof(SpawnPool)))
{
if ((itemPool & value) == 0)
{
continue;
}
foreach (Item item in LootData.GetAllItemsInPool(value))
{
if (((Component)item).GetComponent<LootData>().Rarity <= rarityLimit)
{
currItemList.Add(item);
}
}
}
}
currItemList = currItemList.Distinct().ToList();
currItemList.Sort((Item x, Item y) => x.UIData.itemName.CompareTo(y.UIData.itemName));
if (currItemList.Count > 0)
{
currItemIndex = Random.Range(0, currItemList.Count);
}
((Component)this).GetComponent<Action_ToolgunSelectItem>()?.UpdateIconLocal();
}
public void ShiftItemIndex(int offset)
{
if (currItemList.Count > 0)
{
currItemIndex += offset;
currItemIndex %= currItemList.Count;
while (currItemIndex < 0)
{
currItemIndex += currItemList.Count;
}
}
}
public void ShiftIndexLeft()
{
ShiftItemIndex(-1);
}
public void ShiftIndexRight()
{
ShiftItemIndex(1);
}
public void SpawnItem()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
SpawnItem(((Component)this).transform.position, ((Component)this).transform.rotation);
}
public void SpawnItem(Vector3 position, Quaternion rotation)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
SpawnItem(null, position, rotation);
}
public void SpawnItem(string? itemName, Vector3 position, Quaternion rotation)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (itemName == null)
{
Item? selectedItem = SelectedItem;
itemName = ((selectedItem != null) ? ((Object)((Component)selectedItem).gameObject).name : null);
}
if (!((Object)(object)SelectedItem == (Object)null))
{
((Component)this).GetComponent<PhotonView>().RPC("RPCSpawnItemMaster", (RpcTarget)2, new object[3] { itemName, position, rotation });
((Component)this).GetComponent<Action_ToolgunParticles>()?.SpawnParticles();
((Component)this).GetComponent<Action_ToolgunReduceUses>().ReduceUse();
}
}
[PunRPC]
private void RPCSpawnItemMaster(string itemName, Vector3 position, Quaternion rotation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PhotonNetwork.InstantiateItemRoom(itemName, position, rotation);
val.GetComponent<Item>().SetKinematicNetworked(false);
ItemCooking component = ((Component)this).GetComponent<ItemCooking>();
if (!((Object)(object)component != (Object)null))
{
return;
}
for (int i = 0; i < component.timesCookedLocal; i++)
{
ItemCooking component2 = val.GetComponent<ItemCooking>();
if (component2 != null)
{
component2.FinishCooking();
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}