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 HarmonyLib;
using LethalLevelLoader;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Pickies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Pickies")]
[assembly: AssemblyTitle("Pickies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace Pickies
{
[BepInPlugin("JacobG5.Pickies", "Pickies", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GlowPickies : BaseUnityPlugin
{
private const string modGUID = "JacobG5.Pickies";
private const string modName = "Pickies";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("JacobG5.Pickies");
public static GlowPickies Instance;
internal ManualLogSource mls;
public ExtendedMod PickieMod;
public ExtendedItem pickieJar;
public ExtendedItem pickie;
public ExtendedEnemyType pickler;
public ExtendedEnemyType pickleSwarm;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("JacobG5.Pickies");
mls.LogInfo((object)"Pickies.");
PickieMod = ExtendedMod.Create("Glow Pickies", "JacobG5");
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "glowpickies"));
pickieJar = val.LoadAsset<ExtendedItem>("Assets/LethalCompany/Mods/Projects/GlowPickies/PickieJarExtended.asset");
pickie = val.LoadAsset<ExtendedItem>("Assets/LethalCompany/Mods/Projects/GlowPickies/PickieExtended.asset");
pickler = val.LoadAsset<ExtendedEnemyType>("Assets/LethalCompany/Mods/Projects/GlowPickies/PicklerExtended.asset");
pickleSwarm = val.LoadAsset<ExtendedEnemyType>("Assets/LethalCompany/Mods/Projects/GlowPickies/PickleSwarmExtended.asset");
PickieMod.ExtendedItems.Add(pickie);
PickieMod.ExtendedItems.Add(pickieJar);
PickieMod.ExtendedEnemyTypes.Add(pickler);
PickieMod.ExtendedEnemyTypes.Add(pickleSwarm);
PatchedContent.RegisterExtendedMod(PickieMod);
}
}
}
namespace Pickies.Components
{
public class Pickie : GrabbableObject
{
[Header("Pickie")]
public Light glow;
public float activeIntensity = 100f;
private float startIntensity = 0f;
public float activateTime = 1.6f;
private float activeProgress = 0f;
public bool crackedGlowstick = false;
public bool inCrackingAnimation = false;
private Coroutine crackingCoroutine;
public string throwString = "Toss Pickie: [RMB]";
public string crackString = "Crack Pickie: [RMB]";
public string playerAnimation = "PullGrenadePin";
public AudioSource itemAudio;
public AudioClip crackSFX;
public AudioClip shatterSFX;
public AnimationCurve grenadeFallCurve;
public AnimationCurve grenadeVerticalFallCurve;
public AnimationCurve grenadeVerticalFallCurveNoBounce;
public bool hasExploded;
public GameObject breakFX;
private PlayerControllerB playerThrownBy;
private bool wasThrown = false;
private RaycastHit pickieHit;
private Ray pickieThrowRay;
private int throwMask = 268437761;
[Header("Jar")]
public bool isJar = false;
public Item pickie;
public float spawnHeight = 3f;
public float spawnDistance = 0.3f;
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (inCrackingAnimation)
{
return;
}
if (!isJar && !crackedGlowstick)
{
if (crackingCoroutine == null)
{
base.playerHeldBy.activatingItem = true;
crackingCoroutine = ((MonoBehaviour)this).StartCoroutine(crackAnimation());
}
}
else if (((NetworkBehaviour)this).IsOwner)
{
base.playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetThrowDestination(), true);
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (!isJar && crackedGlowstick && activeProgress < activateTime)
{
activeProgress += Time.deltaTime;
glow.intensity = Mathf.Lerp(startIntensity, activeIntensity, activeProgress / activateTime);
}
}
public override void DiscardItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
public override void EquipItem()
{
SetControlTipForPickie();
((GrabbableObject)this).EnableItemMeshes(true);
base.isPocketed = false;
if (!base.hasBeenHeld)
{
base.hasBeenHeld = true;
if (!base.isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
RoundManager instance = RoundManager.Instance;
instance.valueOfFoundScrapItems += base.scrapValue;
}
}
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
if (isJar && wasThrown)
{
ShatterJar();
}
}
public void ShatterJar()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
if (!hasExploded)
{
GlowPickies.Instance.mls.LogInfo((object)"Shattering Jar");
hasExploded = true;
Transform val = ((!base.isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.2f, false, 0.5f, 2.6f, 40, 25f, (GameObject)null, false);
GlowPickies.Instance.mls.LogInfo((object)((Object)Object.Instantiate<GameObject>(breakFX, ((Component)this).transform.position + Vector3.up, Quaternion.identity, val)).name);
itemAudio.PlayOneShot(shatterSFX);
WalkieTalkie.TransmitOneShotAudio(itemAudio, shatterSFX, 1f);
((Behaviour)glow).enabled = false;
((GrabbableObject)this).DestroyObjectInHand(playerThrownBy);
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
new Vector3(spawnDistance, spawnHeight, 0f),
new Vector3(0f - spawnDistance, spawnHeight, 0f),
new Vector3(0f, spawnHeight, spawnDistance),
new Vector3(0f, spawnHeight, 0f - spawnDistance)
};
int scrapValue = base.scrapValue / array.Length;
for (int i = 0; i < array.Length; i++)
{
GrabbableObject component = Object.Instantiate<GameObject>(pickie.spawnPrefab, array[i] + ((Component)this).transform.position, ((Component)this).transform.rotation).GetComponent<GrabbableObject>();
component.fallTime = 0f;
component.SetScrapValue(scrapValue);
((Component)component).GetComponent<NetworkObject>().Spawn(false);
}
}
}
private void SetControlTipForPickie()
{
string[] array = (crackedGlowstick ? new string[1] { throwString } : new string[1] { crackString });
if (((NetworkBehaviour)this).IsOwner)
{
HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties);
}
}
private IEnumerator crackAnimation()
{
inCrackingAnimation = true;
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.doingUpperBodyEmote = 1.16f;
base.playerHeldBy.playerBodyAnimator.SetTrigger(playerAnimation);
itemAudio.PlayOneShot(crackSFX);
WalkieTalkie.TransmitOneShotAudio(itemAudio, crackSFX, 0.8f);
yield return (object)new WaitForSeconds(1f);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
if (!isJar)
{
base.playerHeldBy.activatingItem = false;
}
playerThrownBy = base.playerHeldBy;
}
inCrackingAnimation = false;
crackedGlowstick = true;
base.itemUsedUp = true;
if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null)
{
SetControlTipForPickie();
}
}
public Vector3 GetThrowDestination()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
playerThrownBy = base.playerHeldBy;
wasThrown = true;
Debug.DrawRay(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, Color.yellow, 15f);
pickieThrowRay = new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward);
Vector3 val = ((!Physics.Raycast(pickieThrowRay, ref pickieHit, 12f, throwMask, (QueryTriggerInteraction)1)) ? ((Ray)(ref pickieThrowRay)).GetPoint(10f) : ((Ray)(ref pickieThrowRay)).GetPoint(((RaycastHit)(ref pickieHit)).distance - 0.05f));
Debug.DrawRay(val, Vector3.down, Color.blue, 15f);
pickieThrowRay = new Ray(val, Vector3.down);
if (Physics.Raycast(pickieThrowRay, ref pickieHit, 30f, throwMask, (QueryTriggerInteraction)1))
{
return ((RaycastHit)(ref pickieHit)).point + Vector3.up * 0.05f;
}
return ((Ray)(ref pickieThrowRay)).GetPoint(30f);
}
public override void FallWithCurve()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = base.startFallingPosition - base.targetFloorPosition;
float magnitude = ((Vector3)(ref val)).magnitude;
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(base.itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, base.itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude);
((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, grenadeFallCurve.Evaluate(base.fallTime));
if (magnitude > 5f)
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, base.startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, base.targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurveNoBounce.Evaluate(base.fallTime));
}
else
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, base.startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, base.targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurve.Evaluate(base.fallTime));
}
base.fallTime += Mathf.Abs(Time.deltaTime * 12f / magnitude);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}