using System;
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 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Doodl0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExpiredMedication")]
[assembly: AssemblyTitle("ExpiredMedication")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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;
}
}
}
public class ItemExpiredMedication : MonoBehaviour
{
public int healAmount;
private ItemToggle itemToggle;
private ItemEquippable itemEquippable;
private ItemAttributes itemAttributes;
private PhotonView photonView;
private PhysGrabObject physGrabObject;
[Space]
public ParticleSystem[] particles;
public ParticleSystem[] rejectParticles;
[Space]
private float lightIntensityLerp;
public MeshRenderer mesh;
private Material material;
private Color materialEmissionOriginal;
private int materialPropertyEmission = Shader.PropertyToID("_EmissionColor");
[Space]
public Sound soundUse;
public Sound soundReject;
private bool used;
private Random rnd = new Random();
private int deathChance;
private void Start()
{
//IL_005b: 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)
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
photonView = ((Component)this).GetComponent<PhotonView>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
material = ((Renderer)mesh).material;
materialEmissionOriginal = material.GetColor(materialPropertyEmission);
deathChance = rnd.Next(1, 5);
}
private void Update()
{
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.RunIsShop() || !SemiFunc.IsMasterClientOrSingleplayer() || !itemToggle.toggleState || used)
{
return;
}
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID);
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
if (val.playerHealth.health >= val.playerHealth.maxHealth)
{
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("RejectRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
RejectRPC();
}
itemToggle.ToggleItem(false, -1);
physGrabObject.rb.AddForce(Vector3.up * 2f, (ForceMode)1);
physGrabObject.rb.AddTorque(-((Component)physGrabObject).transform.right * 0.05f, (ForceMode)1);
return;
}
if (deathChance == 1)
{
val.playerHealth.Hurt(1000, false, -1);
}
else
{
val.playerHealth.HealOther(healAmount, true);
}
_ = StatsManager.instance.itemsPurchased[itemAttributes.item.itemAssetName];
StatsManager.instance.ItemRemove(itemAttributes.instanceName);
physGrabObject.impactDetector.indestructibleBreakEffects = true;
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("UsedRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
UsedRPC();
}
}
[PunRPC]
private void UsedRPC()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f);
itemToggle.ToggleDisable(true);
itemAttributes.DisableUI(true);
Object.Destroy((Object)(object)itemEquippable);
ParticleSystem[] array = particles;
for (int i = 0; i < array.Length; i++)
{
array[i].Play();
}
soundUse.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
used = true;
}
[PunRPC]
private void RejectRPC()
{
//IL_0075: 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)
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID);
if (val.isLocal)
{
val.physGrabber.ReleaseObjectRPC(false, 1f);
}
ParticleSystem[] array = rejectParticles;
for (int i = 0; i < array.Length; i++)
{
array[i].Play();
}
GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f);
soundReject.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
public void OnDestroy()
{
//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)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
ParticleSystem[] array = particles;
ParticleSystem[] array2 = array;
foreach (ParticleSystem val in array2)
{
if (Object.op_Implicit((Object)(object)val) && val.isPlaying)
{
((Component)val).transform.SetParent((Transform)null);
MainModule main = val.main;
((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)2;
}
}
array = rejectParticles;
ParticleSystem[] array3 = array;
foreach (ParticleSystem val2 in array3)
{
if (Object.op_Implicit((Object)(object)val2) && val2.isPlaying)
{
((Component)val2).transform.SetParent((Transform)null);
MainModule main2 = val2.main;
((MainModule)(ref main2)).stopAction = (ParticleSystemStopAction)2;
}
}
}
}
namespace ExpiredMedication
{
[BepInPlugin("Doodl0.ExpiredMedication", "ExpiredMedication", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ExpiredMedication : BaseUnityPlugin
{
internal static ExpiredMedication Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: 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_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}