using System;
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.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;
using hand.Patches;
[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("hand")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("hand")]
[assembly: AssemblyTitle("hand")]
[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;
}
}
}
namespace hand
{
[BepInPlugin("OniHazza.PlasticHand", "Plastic Hand", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
public static AudioClip[] Clip;
private readonly Harmony harmony = new Harmony("OniHazza.PlasticHand");
public static Random HandRandom = new Random();
public static long LastUsed = 0L;
private ConfigEntry<int> HandRarity;
private void Awake()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
Instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "plastichandmod");
AssetBundle val = AssetBundle.LoadFromFile(text);
AudioClip val2 = val.LoadAsset<AudioClip>("Assets/hand/sounds/nowork.mp3");
AudioClip val3 = val.LoadAsset<AudioClip>("Assets/hand/sounds/worthy.mp3");
Clip = (AudioClip[])(object)new AudioClip[2] { val2, val3 };
Item val4 = val.LoadAsset<Item>("Assets/hand/prefab/PlasticHandItem.asset");
HandRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "HandRarity", 10, new ConfigDescription("Frequency of plastic hand spawning. Higher values are more common. Set to 0 to disable spawns.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>()));
NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
Utilities.FixMixerGroups(val4.spawnPrefab);
Items.RegisterScrap(val4, HandRarity.Value, (LevelTypes)(-1));
harmony.PatchAll(typeof(PlasticHandPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "hand";
public const string PLUGIN_NAME = "hand";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace hand.Patches
{
[HarmonyPatch(typeof(GrabbableObject))]
internal class PlasticHandPatch
{
[HarmonyPatch("ItemActivate")]
[HarmonyPrefix]
private static void Prefix(GrabbableObject __instance, bool used, bool buttonDown = true)
{
if (((Object)__instance).name == "PlasticHand" || ((Object)__instance).name == "PlasticHand(Clone)")
{
AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
if (Plugin.HandRandom.Next(0, 2) == 0)
{
component.PlayOneShot(Plugin.Clip[0]);
WalkieTalkie.TransmitOneShotAudio(component, Plugin.Clip[0], 1f);
}
else
{
component.PlayOneShot(Plugin.Clip[1]);
WalkieTalkie.TransmitOneShotAudio(component, Plugin.Clip[1], 1f);
}
}
}
}
}
namespace hand.Behaviours
{
internal class PlasticHandItemBehaviours : PhysicsProp
{
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0030: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
Debug.Log((object)"[PLASTIC HAND]ItemActivate works kinda");
if (buttonDown)
{
PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
if (playerHeldBy != null)
{
playerHeldBy.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
else
{
Debug.Log((object)"[PLASTIC HAND]I have aids");
}
}
}
}