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 GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
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: AssemblyCompany("Typ0's Random Things")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f405ba0b69f31e84bc9e36be56d20c10fbc0a0f8")]
[assembly: AssemblyProduct("Typ0's Random Things")]
[assembly: AssemblyTitle("Typ0's Random Things")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class MoonshineItem : GrabbableObject
{
private PlayerControllerB previousPlayerHeldBy;
private Coroutine useTZPCoroutine;
private bool emittingGas;
public float fuel = 5f;
public AudioSource localHelmetSFX;
public AudioSource thisAudioSource;
public AudioClip twistCanSFX;
public AudioClip releaseGasSFX;
public AudioClip holdCanSFX;
public AudioClip removeCanSFX;
public AudioClip outOfGasSFX;
private bool triedUsingWithoutFuel;
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (buttonDown)
{
base.isBeingUsed = true;
if (fuel <= 0f)
{
if (!triedUsingWithoutFuel)
{
triedUsingWithoutFuel = true;
thisAudioSource.PlayOneShot(outOfGasSFX);
WalkieTalkie.TransmitOneShotAudio(thisAudioSource, outOfGasSFX, 1f);
previousPlayerHeldBy.playerBodyAnimator.SetTrigger("shakeItem");
}
return;
}
previousPlayerHeldBy = base.playerHeldBy;
useTZPCoroutine = ((MonoBehaviour)this).StartCoroutine(UseTZPAnimation());
}
else
{
base.isBeingUsed = false;
if (triedUsingWithoutFuel)
{
triedUsingWithoutFuel = false;
}
else if (useTZPCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(useTZPCoroutine);
emittingGas = false;
previousPlayerHeldBy.activatingItem = false;
thisAudioSource.Stop();
localHelmetSFX.Stop();
thisAudioSource.PlayOneShot(removeCanSFX);
}
}
if (((NetworkBehaviour)this).IsOwner)
{
previousPlayerHeldBy.activatingItem = buttonDown;
previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", buttonDown);
}
}
private IEnumerator UseTZPAnimation()
{
thisAudioSource.PlayOneShot(holdCanSFX);
WalkieTalkie.TransmitOneShotAudio(previousPlayerHeldBy.itemAudio, holdCanSFX, 1f);
yield return (object)new WaitForSeconds(0.75f);
emittingGas = true;
if (((NetworkBehaviour)this).IsOwner)
{
localHelmetSFX.Play();
localHelmetSFX.PlayOneShot(twistCanSFX);
}
else
{
thisAudioSource.clip = releaseGasSFX;
thisAudioSource.Play();
thisAudioSource.PlayOneShot(twistCanSFX);
}
WalkieTalkie.TransmitOneShotAudio(previousPlayerHeldBy.itemAudio, twistCanSFX, 1f);
}
public override void Update()
{
if (emittingGas)
{
if ((Object)(object)previousPlayerHeldBy == (Object)null || !base.isHeld || fuel <= 0f)
{
emittingGas = false;
thisAudioSource.Stop();
localHelmetSFX.Stop();
RunOutOfFuelServerRpc();
}
previousPlayerHeldBy.drunknessInertia = Mathf.Clamp(previousPlayerHeldBy.drunknessInertia + Time.deltaTime / 1.75f * previousPlayerHeldBy.drunknessSpeed, 0.1f, 3f);
previousPlayerHeldBy.increasingDrunknessThisFrame = true;
fuel -= Time.deltaTime / 22f;
}
((GrabbableObject)this).Update();
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
if ((Object)(object)base.playerHeldBy != (Object)null)
{
previousPlayerHeldBy = base.playerHeldBy;
}
}
[ServerRpc]
public void RunOutOfFuelServerRpc()
{
RunOutOfFuelClientRpc();
}
[ClientRpc]
public void RunOutOfFuelClientRpc()
{
base.itemUsedUp = true;
emittingGas = false;
fuel = 0f;
thisAudioSource.Stop();
localHelmetSFX.Stop();
}
public override void DiscardItem()
{
emittingGas = false;
thisAudioSource.Stop();
localHelmetSFX.Stop();
base.playerHeldBy.playerBodyAnimator.ResetTrigger("shakeItem");
previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false);
if ((Object)(object)previousPlayerHeldBy != (Object)null)
{
previousPlayerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
}
namespace Typ0sRandomThings
{
[BepInPlugin("SLDTyp0.Typ0sRandomThings", "Typ0's Random Things", "2.2.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "SLDTyp0.Typ0sRandomThings";
private const string NAME = "Typ0's Random Things";
private const string VERSION = "2.2.3";
public static Plugin instance;
private void Awake()
{
instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "typ0sassets");
AssetBundle val = AssetBundle.LoadFromFile(text);
Item val2 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Typ0's Random Things/Items/Wills Hat/Wills Hat.asset");
Item val3 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Typ0's Random Things/Items/Walkman/walkman.asset");
Item val4 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Typ0's Random Things/Items/water bottle/Waterbottle.asset");
Item val5 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Typ0's Random Things/Items/FireExtinguisher/firextinguisher.asset");
Item val6 = val.LoadAsset<Item>("Assets/LethalCompany/Mods/Typ0's Random Things/Items/Moonshine/Moonshine.asset");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Typ0's Random Things");
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
Items.RegisterScrap(val2, 15, (LevelTypes)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Will's Entire Personality Into The Game");
NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
Utilities.FixMixerGroups(val4.spawnPrefab);
Items.RegisterScrap(val4, 40, (LevelTypes)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Waterbottle");
NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
Utilities.FixMixerGroups(val5.spawnPrefab);
Items.RegisterScrap(val5, 35, (LevelTypes)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Fire extinguisher");
NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
Utilities.FixMixerGroups(val3.spawnPrefab);
Items.RegisterScrap(val3, 30, (LevelTypes)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded walkman");
NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
Utilities.FixMixerGroups(val6.spawnPrefab);
Items.RegisterScrap(val6, 30, (LevelTypes)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded moonshine");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded All Items!");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Finished Loading Typ0's Random Things");
}
}
public class WalkmanItem : GrabbableObject
{
public AudioSource walkmanAudio;
public AudioClip[] musicAudios;
public AudioClip[] stopAudios;
public Random musicRandomizer;
private StartOfRound playersManager;
private RoundManager roundManager;
public bool isPlayingMusic;
private float noiseInterval;
private int timesPlayedWithoutTurningOff;
public override void Start()
{
((GrabbableObject)this).Start();
playersManager = Object.FindObjectOfType<StartOfRound>();
roundManager = Object.FindObjectOfType<RoundManager>();
musicRandomizer = new Random(playersManager.randomMapSeed - 10);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
StartMusic(used);
}
private void StartMusic(bool startMusic, bool pitchDown = false)
{
if (startMusic)
{
walkmanAudio.clip = musicAudios[musicRandomizer.Next(0, musicAudios.Length)];
walkmanAudio.pitch = 1f;
walkmanAudio.Play();
}
else if (isPlayingMusic)
{
if (pitchDown)
{
((MonoBehaviour)this).StartCoroutine(musicPitchDown());
}
else
{
walkmanAudio.Stop();
walkmanAudio.PlayOneShot(stopAudios[Random.Range(0, stopAudios.Length)]);
}
timesPlayedWithoutTurningOff = 0;
}
base.isBeingUsed = startMusic;
isPlayingMusic = startMusic;
}
private IEnumerator musicPitchDown()
{
for (int i = 0; i < 30; i++)
{
yield return null;
AudioSource obj = walkmanAudio;
obj.pitch -= 0.033f;
if (walkmanAudio.pitch <= 0f)
{
break;
}
}
walkmanAudio.Stop();
walkmanAudio.PlayOneShot(stopAudios[Random.Range(0, stopAudios.Length)]);
}
public override void UseUpBatteries()
{
((GrabbableObject)this).UseUpBatteries();
StartMusic(startMusic: false, pitchDown: true);
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
walkmanAudio.volume = 0.55f;
}
public override void EquipItem()
{
walkmanAudio.volume = 1f;
((GrabbableObject)this).EquipItem();
}
public override void Update()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
if (isPlayingMusic)
{
if (noiseInterval <= 0f)
{
noiseInterval = 1f;
timesPlayedWithoutTurningOff++;
roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5);
}
else
{
noiseInterval -= Time.deltaTime;
}
if (base.insertedBattery.charge < 0.05f)
{
walkmanAudio.pitch = 1f - (0.05f - base.insertedBattery.charge) * 4f;
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Typ0's Random Things";
public const string PLUGIN_NAME = "Typ0's Random Things";
public const string PLUGIN_VERSION = "1.0.0";
}
}