using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
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 LethalLib.Modules;
using Lethal_Monkes_Scrap_Pack.Behaviours;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[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")]
[assembly: AssemblyCompany("Yonnage.LethalMonkesScrapPack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f7e5ece629ded1a39c65f24a8bf6ca6391559187")]
[assembly: AssemblyProduct("Lethal Monkes Scrap Pack")]
[assembly: AssemblyTitle("Yonnage.LethalMonkesScrapPack")]
[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;
}
}
}
namespace Lethal_Monkes_Scrap_Pack
{
[BepInPlugin("Yonnage.LethalMonkesScrapPack", "Lethal Monkes Scrap Pack", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
public class Lethal_Monkes_Scrap_Pack : BaseUnityPlugin
{
public static Lethal_Monkes_Scrap_Pack Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod");
AssetBundle val = AssetBundle.LoadFromFile(text);
Item val2 = val.LoadAsset<Item>("Assets/Alez's Inhaler.asset");
UseInhaler useInhaler = val2.spawnPrefab.AddComponent<UseInhaler>();
useInhaler.inhalerShakeSound = val.LoadAsset<AudioClip>("Assets/inhalerShakeWeeeee.ogg");
useInhaler.spawnSound = val.LoadAsset<AudioClip>("Assets/spawnMahNamesAlez.ogg");
useInhaler.useInhalerSound = val.LoadAsset<AudioClip>("Assets/useInhaler.ogg");
((GrabbableObject)useInhaler).grabbable = true;
((GrabbableObject)useInhaler).grabbableToEnemies = true;
((GrabbableObject)useInhaler).itemProperties = val2;
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
Items.RegisterScrap(val2, 30, (LevelTypes)(-1));
TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 0);
Patch();
Logger.LogInfo((object)"Yonnage.LethalMonkesScrapPack v1.0.0 has loaded!");
}
internal static void Patch()
{
//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_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("Yonnage.LethalMonkesScrapPack");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Yonnage.LethalMonkesScrapPack";
public const string PLUGIN_NAME = "Lethal Monkes Scrap Pack";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Lethal_Monkes_Scrap_Pack.Behaviours
{
internal class UseInhaler : GrabbableObject
{
private Coroutine? staminaRestoreRoutine = null;
private Coroutine? staminaShakeRoutine = null;
public AudioClip spawnSound;
public AudioClip inhalerShakeSound;
public AudioClip useInhalerSound;
private AudioSource audioSource;
private bool isHeldLocally = false;
public override void Start()
{
((GrabbableObject)this).Start();
audioSource = ((Component)this).GetComponent<AudioSource>();
PlayAudioClip(spawnSound);
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
if (((NetworkBehaviour)this).IsOwner)
{
isHeldLocally = true;
}
}
public override void Update()
{
if (!isHeldLocally || (Object)(object)base.playerHeldBy == (Object)null || !((NetworkBehaviour)this).IsOwner || base.isPocketed)
{
((GrabbableObject)this).Update();
return;
}
if (Mouse.current.leftButton.wasPressedThisFrame)
{
StartInhaling();
}
else if (Mouse.current.leftButton.wasReleasedThisFrame)
{
StopInhaling();
}
if (Mouse.current.rightButton.wasPressedThisFrame && !Mouse.current.leftButton.isPressed)
{
StartShaking();
}
((GrabbableObject)this).Update();
}
private void PlayAudioClip(AudioClip clip)
{
audioSource.PlayOneShot(clip);
}
private void StartInhaling()
{
if ((Object)(object)base.playerHeldBy?.playerBodyAnimator == (Object)null)
{
return;
}
float charge = base.insertedBattery.charge;
if (!((double)charge < 0.5))
{
base.playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", true);
if (staminaRestoreRoutine != null)
{
((MonoBehaviour)this).StopCoroutine(staminaRestoreRoutine);
}
staminaRestoreRoutine = ((MonoBehaviour)this).StartCoroutine(DelayedStaminaRestore(1.5f));
}
}
private void StopInhaling()
{
if (!((Object)(object)base.playerHeldBy?.playerBodyAnimator == (Object)null))
{
base.playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false);
if (staminaRestoreRoutine != null)
{
((MonoBehaviour)this).StopCoroutine(staminaRestoreRoutine);
staminaRestoreRoutine = null;
}
}
}
private void StartShaking()
{
if (!((Object)(object)base.playerHeldBy?.playerBodyAnimator == (Object)null) && staminaShakeRoutine == null)
{
base.playerHeldBy.playerBodyAnimator.SetTrigger("shakeItem");
staminaShakeRoutine = ((MonoBehaviour)this).StartCoroutine(DelayedRecharge(1f));
}
}
private IEnumerator DelayedStaminaRestore(float delay)
{
yield return (object)new WaitForSeconds(delay / 2f);
PlayAudioClip(useInhalerSound);
yield return (object)new WaitForSeconds(delay / 2f);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.sprintMeter = 1f;
base.playerHeldBy.isExhausted = false;
((GrabbableObject)this).SyncBatteryServerRpc((!((double)base.insertedBattery.charge <= 0.5)) ? 50 : 0);
}
staminaRestoreRoutine = null;
}
private IEnumerator DelayedRecharge(float delay)
{
PlayAudioClip(inhalerShakeSound);
yield return (object)new WaitForSeconds(delay);
((GrabbableObject)this).SyncBatteryServerRpc(((double)base.insertedBattery.charge < 0.5) ? 50 : 100);
staminaShakeRoutine = null;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}