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 GameNetcodeStuff;
using LethalLib.Modules;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using ProjectApple.Logic;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("toombe.projectApple")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("ProjectApple")]
[assembly: AssemblyTitle("toombe.projectApple")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 ProjectApple
{
[BepInPlugin("toombe.projectApple", "ProjectApple", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin instance;
public static ManualLogSource logger;
private void Awake()
{
logger = ((BaseUnityPlugin)this).Logger;
instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "projectapple");
AssetBundle val = AssetBundle.LoadFromFile(text);
Item val2 = val.LoadAsset<Item>("Assets/apple.asset");
val2.spawnPrefab.GetComponentsInChildren<AudioSource>()[0].spatialize = false;
AppleLogic appleLogic = val2.spawnPrefab.AddComponent<AppleLogic>();
((GrabbableObject)appleLogic).grabbable = true;
((GrabbableObject)appleLogic).grabbableToEnemies = true;
((GrabbableObject)appleLogic).itemProperties = val2;
AudioSource component = val2.spawnPrefab.GetComponent<AudioSource>();
component.spatialize = false;
appleLogic.audioSource = component;
appleLogic.audioClip = component.clip;
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
val3.clearPreviousText = true;
val3.displayText = "This is an apple\n\n";
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 10);
((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectApple Loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "toombe.projectApple";
public const string PLUGIN_NAME = "ProjectApple";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace ProjectApple.Logic
{
internal class AppleLogic : GrabbableObject
{
public AudioSource audioSource;
public AudioClip audioClip;
private bool isActivated = false;
public override void Start()
{
((GrabbableObject)this).Start();
audioSource.spatialize = false;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!isActivated)
{
isActivated = true;
if ((Object)(object)audioSource != (Object)null)
{
audioSource.PlayOneShot(audioSource.clip);
}
WalkieTalkie.TransmitOneShotAudio(audioSource, audioSource.clip, 1.5f);
Plugin.logger.LogMessage((object)"info: ");
Plugin.logger.LogInfo((object)RoundManager.Instance);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 1f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (((NetworkBehaviour)this).IsOwner)
{
base.playerHeldBy.activatingItem = buttonDown;
base.playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", buttonDown);
}
((MonoBehaviour)this).StartCoroutine(undoAnimation(base.playerHeldBy));
}
}
public IEnumerator undoAnimation(PlayerControllerB playerHeldBy)
{
yield return (object)new WaitForSeconds(1.5f);
if (((NetworkBehaviour)this).IsOwner)
{
playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false);
playerHeldBy.activatingItem = false;
playerHeldBy.health = Mathf.Clamp(playerHeldBy.health + 10, 0, 100);
if (playerHeldBy.health != 100)
{
HUDManager.Instance.selfRedCanvasGroup.alpha = (float)(100 - playerHeldBy.health) / 100f;
}
else
{
HUDManager.Instance.selfRedCanvasGroup.alpha = 0f;
}
playerHeldBy.DespawnHeldObject();
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}