using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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("ScannablePlayerItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a6d9df5fba9dbc11359b52099c6517c5b83d3bbf")]
[assembly: AssemblyProduct("ScannablePlayerItems")]
[assembly: AssemblyTitle("ScannablePlayerItems")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ScannablePlayerItems
{
public class HarmonyPatches
{
private static Harmony instance;
public const string InstanceId = "com.graze.scannableplayeritems";
public static bool IsPatched { get; private set; }
internal static void ApplyHarmonyPatches()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
if (!IsPatched)
{
if (instance == null)
{
instance = new Harmony("com.graze.scannableplayeritems");
}
instance.PatchAll(Assembly.GetExecutingAssembly());
IsPatched = true;
}
}
internal static void RemoveHarmonyPatches()
{
if (instance != null && IsPatched)
{
instance.UnpatchAll("com.graze.scannableplayeritems");
IsPatched = false;
}
}
}
[BepInPlugin("com.graze.scannableplayeritems", "ScannablePlayerItems", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
public static Plugin bugin;
private Plugin()
{
HarmonyPatches.ApplyHarmonyPatches();
bugin = this;
}
private void Init()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)ScanNodeSetUp.instance == (Object)null)
{
HarmonyPatches.ApplyHarmonyPatches();
ScanNodeSetUp.instance = new GameObject("CustomScanNodeScript").AddComponent<ScanNodeSetUp>();
Object.DontDestroyOnLoad((Object)(object)((Component)ScanNodeSetUp.instance).gameObject);
}
}
private void Start()
{
HarmonyPatches.ApplyHarmonyPatches();
Init();
}
}
internal class NodeHider : MonoBehaviour
{
private GrabbableObject obj;
public GameObject node;
private void Start()
{
obj = ((Component)this).gameObject.GetComponent<GrabbableObject>();
}
private void Update()
{
if (obj.isHeld || obj.isPocketed || obj.isHeldByEnemy || obj.isInShipRoom || obj.isInElevator)
{
node.SetActive(false);
}
else
{
node.SetActive(true);
}
}
}
public class ScanNodeSetUp : MonoBehaviour
{
public static volatile ScanNodeSetUp instance;
private static GameObject ScanNode;
public static bool hide;
private void Start()
{
HarmonyPatches.ApplyHarmonyPatches();
}
private void Update()
{
if ((Object)(object)Plugin.bugin == (Object)null)
{
Plugin.bugin = ((Component)this).gameObject.AddComponent<Plugin>();
}
}
public static void AddNode(GrabbableObject obj)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_00e3: 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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0587: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_0591: Unknown result type (might be due to invalid IL or missing references)
//IL_062a: Unknown result type (might be due to invalid IL or missing references)
//IL_062f: Unknown result type (might be due to invalid IL or missing references)
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)ScanNode == (Object)null)
{
ScanNode = ((Component)Object.FindObjectOfType<ScanNodeProperties>()).gameObject;
}
if (((object)obj).GetType() == typeof(Shovel))
{
GameObject val = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component = val.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val;
component.nodeType = 0;
component.headerText = "Shovel";
component.subText = "Hit Enemys";
component.scrapValue = 0;
component.minRange = 1;
component.maxRange = 13;
component.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(SprayPaintItem))
{
GameObject val2 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component2 = val2.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val2;
component2.nodeType = 0;
component2.headerText = "Spary Paint";
component2.subText = "Mark A Trail";
component2.scrapValue = 0;
component2.minRange = 1;
component2.maxRange = 13;
component2.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(FlashlightItem))
{
GameObject val3 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component3 = val3.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val3;
component3.nodeType = 0;
if (((Object)obj).name.Contains("BB"))
{
component3.headerText = "Flashlight";
component3.subText = "Make Sure to Charge me!";
}
else
{
component3.headerText = "Pro Flashlight";
component3.subText = "Flashlight But Better";
}
component3.scrapValue = 0;
component3.minRange = 1;
component3.maxRange = 13;
component3.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(BoomboxItem))
{
GameObject val4 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component4 = val4.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val4;
component4.nodeType = 0;
component4.headerText = "BoomBox";
component4.subText = "Boots'n-cats'n..";
component4.scrapValue = 0;
component4.minRange = 1;
component4.maxRange = 13;
component4.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(PatcherTool))
{
GameObject val5 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component5 = val5.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val5;
component5.nodeType = 0;
component5.headerText = "ZapGun";
component5.subText = "Stun Enemies";
component5.scrapValue = 0;
component5.minRange = 1;
component5.maxRange = 13;
component5.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(StunGrenadeItem))
{
GameObject val6 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component6 = val6.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val6;
component6.nodeType = 1;
component6.headerText = "Stun Grenade";
component6.subText = "KABOOM!";
component6.scrapValue = 0;
component6.minRange = 1;
component6.maxRange = 13;
component6.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(TetraChemicalItem))
{
GameObject val7 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component7 = val7.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val7;
component7.nodeType = 0;
component7.headerText = "TZP";
component7.subText = "Good for Headaches";
component7.scrapValue = 0;
component7.minRange = 1;
component7.maxRange = 13;
component7.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(ExtensionLadderItem))
{
GameObject val8 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component8 = val8.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val8;
component8.nodeType = 1;
component8.headerText = "Extendable Ladder";
component8.subText = "Deploy With Care";
component8.scrapValue = 0;
component8.minRange = 1;
component8.maxRange = 13;
component8.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(WalkieTalkie))
{
GameObject val9 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component9 = val9.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val9;
component9.nodeType = 0;
component9.headerText = "Walkie-Talkie";
component9.subText = "Communicate Easy";
component9.scrapValue = 0;
component9.minRange = 1;
component9.maxRange = 13;
component9.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(LockPicker))
{
GameObject val10 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component10 = val10.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val10;
component10.nodeType = 0;
component10.headerText = "Lock Pick";
component10.subText = "Who Needs Keys?";
component10.scrapValue = 0;
component10.minRange = 1;
component10.maxRange = 13;
component10.creatureScanID = -1;
}
if (((object)obj).GetType() == typeof(JetpackItem))
{
GameObject val11 = Object.Instantiate<GameObject>(ScanNode, ((Component)obj).transform.position, Quaternion.Euler(Vector3.zero), ((Component)obj).transform);
ScanNodeProperties component11 = val11.GetComponent<ScanNodeProperties>();
((Component)obj).gameObject.AddComponent<NodeHider>().node = val11;
component11.nodeType = 1;
component11.headerText = "JetPack";
component11.subText = "WEEEE!";
component11.scrapValue = 0;
component11.minRange = 1;
component11.maxRange = 13;
component11.creatureScanID = -1;
}
}
}
internal class PluginInfo
{
public const string GUID = "com.graze.scannableplayeritems";
public const string Name = "ScannablePlayerItems";
public const string Version = "1.0.3";
}
}
namespace ScannablePlayerItems.Patches
{
[HarmonyPatch(typeof(GrabbableObject))]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class ItemPatches
{
private static void Postfix(GrabbableObject __instance)
{
if ((Object)(object)((Component)__instance).GetComponentInChildren<ScanNodeProperties>() == (Object)null)
{
ScanNodeSetUp.AddNode(__instance);
}
}
}
}