Decompiled source of LethalSnap v1.5.7
LethalSnap/LethalSnapProject.dll
Decompiled 7 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib; using LethalLib.Modules; using LethalSnapProject; using LethalSnapProject.Behaviour; using LethalSnapProject.NetcodePatcher; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [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 = "")] [assembly: AssemblyCompany("LethalSnapProject")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Add a polaroid in the game")] [assembly: AssemblyFileVersion("1.5.7.0")] [assembly: AssemblyInformationalVersion("1.5.7")] [assembly: AssemblyProduct("LethalSnapProject")] [assembly: AssemblyTitle("LethalSnapProject")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.7.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } [Serializable] public struct VisibleEntity { public bool isPlayer; public string name; public bool isOutside; public ulong networkID; public static string ToMetadataString(List<VisibleEntity> entities) { BinaryFormatter binaryFormatter = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, entities); return Convert.ToBase64String(memoryStream.GetBuffer()); } public static string GetVisibleEntitiesToString(List<VisibleEntity> entities) { string text = ""; foreach (VisibleEntity entity in entities) { text += entity.name; } return text; } } [Serializable] public class CustomConfig : SyncedInstance<CustomConfig> { public static ConfigEntry<bool> debugMode; public static ConfigEntry<string> monsterValues; public static ConfigEntry<int> defaultMonsterValue; public static ConfigEntry<int> monsterValueMultiplier; public static ConfigEntry<float> pictureScaleMultiplier; public static ConfigEntry<bool> monsterReactToFlash; public static ConfigEntry<int> polaroidMaxPictureFromFullBattery; public static ConfigEntry<int> polaroidLootRarity; public static ConfigEntry<bool> polaroidCanBeBuy; public static ConfigEntry<int> polaroidCost; public static ConfigEntry<bool> canPinPictureToPlayers; public static ConfigEntry<float> cameraFov; public static ConfigEntry<float> flashAngle; public static ConfigEntry<float> flashIntensity; public static ConfigEntry<float> flashRange; public static ConfigEntry<float> flashDuration; public static ConfigEntry<float> pictureTakenAtFlashPercentage; public static ConfigEntry<int> pictureResolution; public static ConfigEntry<int> screenResolution; public static ConfigEntry<bool> polaroidCanUpdateScreen; public static ConfigEntry<float> polaroidScreenUpdateRate; public static ConfigEntry<float> polaroidCameraFarClipping; public static ConfigEntry<float> polaroidUseCooldown; public CustomConfig(ConfigFile cfg) { InitInstance(this); debugMode = cfg.Bind<bool>("Debug", "debugMode", false, "More log"); monsterValues = cfg.Bind<string>("Gameplay", "Monsters value", MakeMonsterString() ?? "", "Assign a monster name to a value monsterName1:scrapValue1,monsterName2:scrapValue2,... (Can be used to overide base monster values too)"); defaultMonsterValue = cfg.Bind<int>("Gameplay", "Default monster value", 10, "Change default value for monster not listed above (MonsterValues)"); monsterValueMultiplier = cfg.Bind<int>("Gameplay", "Monster value multiplier", 1, "Change this value to multiply the value of all pictures"); monsterReactToFlash = cfg.Bind<bool>("Gameplay", "Monster React to flash", true, "Does monster have special reaction when takken in picture"); pictureScaleMultiplier = cfg.Bind<float>("Gameplay", "PictureScaleMultiplier", 1f, "Make the picture bigger"); polaroidMaxPictureFromFullBattery = cfg.Bind<int>("Gameplay", "PolaroidMaxPictureFromFullBattery", 5, "The number of picture which can be taken before running out of battery"); polaroidLootRarity = cfg.Bind<int>("Gameplay", "PolaroidLootRarity", 5, "Chance of looting a polaroid (1 very rare, 100 very common)"); polaroidCanBeBuy = cfg.Bind<bool>("Gameplay", "PolaroidCanBeBuy", true, "Does the polaroid appear in the store ?"); polaroidCost = cfg.Bind<int>("Gameplay", "PolaroidCost", 150, "The cost of the polaroid in the store"); canPinPictureToPlayers = cfg.Bind<bool>("Gameplay", "canPinPictureToPlayers", true, "Does the picture can be pin directly to another players ? "); cameraFov = cfg.Bind<float>("Flash", "CameraFov", 75f, "The Field of view of the polaroid"); flashAngle = cfg.Bind<float>("Flash", "FlashAngle", 160f, "The wideness of the flash (in degree)"); flashIntensity = cfg.Bind<float>("Flash", "FlashIntensity", 250f, "The intensity of the flash"); flashRange = cfg.Bind<float>("Flash", "FlashRange", 50f, "The range of the flash in meter"); flashDuration = cfg.Bind<float>("Flash", "FlashDuration", 0.8f, "The duration of the flash in seconds (How long the intensity goes back to 0)"); pictureTakenAtFlashPercentage = cfg.Bind<float>("Flash", "PictureTakenAtFlashPercentage", 0.5f, "At which percentage of the flash duration the picture is actually taken (the intensity when the picture is taken is : flashIntensity / (1-pictureTakenAtFlashPercentage) )"); pictureResolution = cfg.Bind<int>("Polaroid", "PictureResolution", 512, "The resolution of the pic 128,256,512,1024... (careful can heavily impact performance when taking picture)"); screenResolution = cfg.Bind<int>("Polaroid", "ScreenResolution", 64, "The resolution of the polaroid screen 128,256,512,1024... (careful can heavily impact performance when the polaroid is held)"); polaroidCanUpdateScreen = cfg.Bind<bool>("Polaroid", "PolaroidCanUpdateScreen", true, "Does the polaroid preview the picture in its screen ? (disable it to improve performance)"); polaroidScreenUpdateRate = cfg.Bind<float>("Polaroid", "PolaroidScreenUpdateRate", 0f, "The delay betway polaroid screen update in seconds (increase this if you have performance issue)"); polaroidCameraFarClipping = cfg.Bind<float>("Polaroid", "PolaroidCameraFarClipping", 100f, "How far the polaroid camera can render (reduce this if you have performance issue)"); polaroidUseCooldown = cfg.Bind<float>("Polaroid", "PolaroidUseCooldown", 1f, "The required cooldown between 2 pictures"); } private string MakeMonsterString() { string text = ""; text += "flowerman:180,"; text += "crawler:90,"; text += "hoarding bug:2,"; text += "centipede:10,"; text += "bunker spider:50,"; text += "puffer:10,"; text += "jester:250,"; text += "blob:2,"; text += "girl:180,"; text += "spring:30,"; text += "nutcracker:80,"; text += "masked:60,"; text += "mouthdog:40,"; text += "earth leviathan:120,"; text += "forestgiant:40,"; text += "baboon hawk:10,"; text += "red locust bees:2,"; text += "docile locust bees:0,"; text += "manticoil:0,"; text += "peeper:2,"; text += "locker:60,"; return text + "fiend:80"; } public static void RequestSync() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<CustomConfig>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<CustomConfig>.IntSize, (Allocator)2, -1); try { SyncedInstance<CustomConfig>.MessageManager.SendNamedMessage("LethalSnap_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<CustomConfig>.IsHost) { return; } Plugin.MyLogger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<CustomConfig>.SerializeToBytes(SyncedInstance<CustomConfig>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<CustomConfig>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<CustomConfig>.MessageManager.SendNamedMessage("LethalSnap_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.MyLogger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<CustomConfig>.IntSize)) { Plugin.MyLogger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.MyLogger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<CustomConfig>.SyncInstance(data); Plugin.MyLogger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyMemberJoined")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown Plugin.MyLogger.LogInfo((object)"Trying to sync config files"); if (SyncedInstance<CustomConfig>.IsHost) { SyncedInstance<CustomConfig>.MessageManager.RegisterNamedMessageHandler("LethalSnap_OnRequestConfigSync", new HandleNamedMessageDelegate(OnRequestSync)); SyncedInstance<CustomConfig>.Synced = true; } else { SyncedInstance<CustomConfig>.Synced = false; SyncedInstance<CustomConfig>.MessageManager.RegisterNamedMessageHandler("LethalSnap_OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveSync)); RequestSync(); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { Plugin.MyLogger.LogInfo((object)"Trying to reset config file"); SyncedInstance<CustomConfig>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.MyLogger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.MyLogger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } public static class Helper { public static void PlayOneShot(this AudioSource source, AudioClip[] array, float volume = 1f) { int num = Random.Range(0, array.Length); source.PlayOneShot(array[num], volume); } public static string GetMountPath(Transform t) { string text = ""; Transform parent = t.parent; if ((Object)(object)parent == (Object)null) { return ""; } while ((Object)(object)parent.parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text.Trim("/".ToCharArray()); } public static string FindFirstTransformFromMountPath(string mountPath) { if (mountPath == "") { return ""; } return mountPath.Split("/")[0]; } public static Transform FindTransformFromMountPath(string mountPath) { if (mountPath == "") { return null; } string[] array = mountPath.Split("/"); Transform transform = GameObject.Find(array[0]).transform; Transform val = transform; for (int i = 1; i < array.Length; i++) { val = val.Find(array[i]); } return val; } public static void PrintLayerMask(LayerMask layerMask, string layerMaskName) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogInfo((object)("||||| printing layers of layermask " + layerMaskName)); for (int i = 0; i < 31; i++) { if (IsInLayerMask(i, layerMask)) { Plugin.logger.LogInfo((object)("-> " + i + " " + LayerMask.LayerToName(i))); } } Plugin.logger.LogInfo((object)("||||| End of : " + layerMaskName)); } public static bool IsInLayerMask(int layer, LayerMask layermask) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return LayerMask.op_Implicit(layermask) == (LayerMask.op_Implicit(layermask) | (1 << layer)); } public static GameObject SpawnDebugVisual(Vector3 pos, Color c) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)Object.FindObjectOfType<UnlockableSuit>()).gameObject; GameObject gameObject2 = ((Component)gameObject.transform.Find("SuitHook")).gameObject; GameObject val = Object.Instantiate<GameObject>(gameObject2, pos, Quaternion.identity, (Transform)null); Material material = ((Renderer)val.GetComponent<MeshRenderer>()).material; material.color = c; material.SetColor("_EmissiveColor", c); material.mainTexture = null; material.SetTexture("_EmissiveColorMap", (Texture)null); return val; } } [HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")] internal class PlayerPatch { private static void Postfix(ref PlayerControllerB __instance) { //IL_0003: 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_001c: Expected O, but got Unknown //IL_001c: Expected O, but got Unknown if ((Object)__instance == (Object)GameNetworkManager.Instance.localPlayerController) { PlayerControllerB val = __instance; ((Component)__instance).GetComponentInChildren<LODGroup>().enabled = false; ((Renderer)val.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; ((Component)val.localVisor).GetComponentInChildren<Renderer>().shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val.thisPlayerModelLOD1).shadowCastingMode = (ShadowCastingMode)3; ((Renderer)val.thisPlayerModelLOD2).enabled = false; ((Component)val.thisPlayerModel).gameObject.layer = 23; ((Component)val.thisPlayerModelArms).gameObject.layer = 5; } } } namespace LethalSnapProject { [BepInPlugin("LethalSnapProject", "LethalSnapProject", "1.5.7")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalSnapProject"); public static Plugin Instance; public Item picture; public GameObject polaroidPrefab; public GameObject picturePrefab; public static AudioClip[] AudioPolaroidDrop; public static AudioClip[] AudioPolaroidEquip; public static AudioClip[] AudioPolaroidGrab; public static AudioClip[] AudioPictureGrab; public static AudioClip[] AudioPictureEquip; public static AudioClip[] AudioPictureDrop; public static AudioClip[] AudioPolaroidShootEmpty; public static AudioClip[] AudioPolaroidShootFlashOff; public static AudioClip[] AudioPolaroidShootFlashOn; public static AudioClip[] AudioPolaroidSwitchFlashOff; public static AudioClip[] AudioPolaroidSwitchFlashOn; public static bool DebugMode; public static ManualLogSource MyLogger { get; internal set; } public static CustomConfig MyConfig { get; internal set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } MyConfig = new CustomConfig(((BaseUnityPlugin)this).Config); DebugMode = CustomConfig.debugMode.Value; MyLogger = Logger.CreateLogSource("LethalSnapProject"); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "polaroiditemmod"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/PolaroidMod/PolaroidItem.asset"); val2.requiresBattery = true; PolaroidItem polaroidItem = val2.spawnPrefab.AddComponent<PolaroidItem>(); ((GrabbableObject)polaroidItem).grabbable = true; ((GrabbableObject)polaroidItem).grabbableToEnemies = true; ((GrabbableObject)polaroidItem).itemProperties = val2; polaroidPrefab = val2.spawnPrefab; Items.RegisterScrap(val2, CustomConfig.polaroidLootRarity.Value, (LevelTypes)(-1)); Utilities.FixMixerGroups(val2.spawnPrefab); if (CustomConfig.polaroidCanBeBuy.Value) { TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>(); val3.clearPreviousText = true; val3.displayText = "Take picture of monsters.\nSell them to the Company.\nLive for another day of work\n\nEach monster give different value to the pictures (based on their dangerosity)\nFriend in the picture with monsters bring more value to it\nYou can take " + CustomConfig.polaroidMaxPictureFromFullBattery.Value + " pictures before running out of battery (can be charge in the ship)\n"; Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, CustomConfig.polaroidCost.Value); } picture = val.LoadAsset<Item>("Assets/PolaroidMod/PictureItem.asset"); PictureItem pictureItem = picture.spawnPrefab.AddComponent<PictureItem>(); ((GrabbableObject)pictureItem).grabbable = true; ((GrabbableObject)pictureItem).grabbableToEnemies = true; ((GrabbableObject)pictureItem).itemProperties = picture; picturePrefab = picture.spawnPrefab; Items.RegisterItem(picture); Utilities.FixMixerGroups(picture.spawnPrefab); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } AudioPolaroidDrop = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Drop/FOLEY_LS_POL_Drop_", 8); AudioPolaroidEquip = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Equip/FOLEY_LS_POL_Equip_", 8); AudioPolaroidGrab = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Grab/FOLEY_LS_POL_Grab_", 8); AudioPictureGrab = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Picture_Grab/FOLEY_LS_POL_Picture_Grab_", 10); AudioPictureEquip = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Picture_Equip/FOLEY_LS_POL_Picture_Equip_", 10); AudioPictureDrop = LoadAudio(val, "Assets/PolaroidMod/Audio/FOLEY_LS_POL_Picture_Drop/FOLEY_LS_POL_Picture_Drop_", 10); AudioPolaroidShootEmpty = LoadAudio(val, "Assets/PolaroidMod/Audio/SFX_LS_POL_Shoot_Empty/SFX_LS_POL_Shoot_Empty_", 6); AudioPolaroidShootFlashOff = LoadAudio(val, "Assets/PolaroidMod/Audio/SFX_LS_POL_Shoot_Flash_Off/SFX_LS_POL_Shoot_Flash_Off_", 6); AudioPolaroidShootFlashOn = LoadAudio(val, "Assets/PolaroidMod/Audio/SFX_LS_POL_Shoot_Flash_On/SFX_LS_POL_Shoot_Flash_On_", 6); AudioPolaroidSwitchFlashOff = LoadAudio(val, "Assets/PolaroidMod/Audio/SFX_LS_POL_Switch_Flash_Off/SFX_LS_POL_Switch_Flash_Off_", 8); AudioPolaroidSwitchFlashOn = LoadAudio(val, "Assets/PolaroidMod/Audio/SFX_LS_POL_Switch_Flash_On/SFX_LS_POL_Switch_Flash_On_", 8); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalSnapProject is loaded!"); harmony.PatchAll(); string value = CustomConfig.monsterValues.Value; string[] array3 = value.Split(","); MyLogger.LogInfo((object)"Display monsters and there values : "); string[] array4 = array3; foreach (string text2 in array4) { string[] array5 = text2.Split(":"); if (array5.Length == 2) { try { int v = int.Parse(array5[1]); PictureHelper.MonsterNameValue item = new PictureHelper.MonsterNameValue(array5[0].ToLower(), v); PictureHelper.additionalMonsterValues.Add(item); MyLogger.LogInfo((object)("--> " + item.Name + " " + item.Value)); } catch (FormatException) { MyLogger.LogError((object)"Add monster config error! Scrap value isn't a number! "); } } else { MyLogger.LogError((object)("Error in config files ! Can't read entry: " + text2 + " (don't add '|' at the end)")); } } } public AudioClip[] LoadAudio(AssetBundle bundle, string assetPath, int count) { AudioClip[] array = (AudioClip[])(object)new AudioClip[count]; for (int i = 1; i <= count; i++) { string text = assetPath; text = ((i < 10) ? (text + "0" + i + ".wav") : (text + i + ".wav")); array[i - 1] = bundle.LoadAsset<AudioClip>(text); if ((Object)(object)array[i - 1] == (Object)null) { MyLogger.LogError((object)("Can't load :" + assetPath)); } } MyLogger.LogInfo((object)("Finish Loading : " + assetPath)); return array; } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalSnapProject"; public const string PLUGIN_NAME = "LethalSnapProject"; public const string PLUGIN_VERSION = "1.5.7"; } } namespace LethalSnapProject.Patcher { [HarmonyPatch(typeof(GrabbableObject), "UseItemOnClient")] internal class GrabbablePatcher { private static void Postfix(ref GrabbableObject __instance) { GrabbableObject val = __instance; PolaroidItem polaroidItem = val as PolaroidItem; if (Object.op_Implicit((Object)(object)polaroidItem) && ((GrabbableObject)polaroidItem).insertedBattery.charge == 0f) { polaroidItem.source.PlayOneShot(Plugin.AudioPolaroidShootEmpty); } } } [HarmonyPatch] internal class NetworkObjectManager { private static GameObject polaroidNetworkPrefab; private static GameObject pictureNetworkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { if ((Object)(object)polaroidNetworkPrefab == (Object)null) { polaroidNetworkPrefab = Plugin.Instance.polaroidPrefab; NetworkManager.Singleton.AddNetworkPrefab(Plugin.Instance.polaroidPrefab); } if ((Object)(object)pictureNetworkPrefab == (Object)null) { pictureNetworkPrefab = Plugin.Instance.picturePrefab; NetworkManager.Singleton.AddNetworkPrefab(Plugin.Instance.picturePrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(polaroidNetworkPrefab, new Vector3(0f, -1500f, 0f), Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); val.SetActive(false); GameObject val2 = Object.Instantiate<GameObject>(pictureNetworkPrefab, new Vector3(0f, -1500f, 0f), Quaternion.identity); val2.GetComponent<NetworkObject>().Spawn(false); val2.SetActive(false); } } } } namespace LethalSnapProject.Behaviour { internal class DetectionSystem { private LayerMask _layerMask; private Camera _camera; public float detectionDistance = 50f; public DetectionSystem(LayerMask layerMask, Camera camera) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) _layerMask = layerMask; _camera = camera; } public List<VisibleEntity> GetVisibleEntities(PlayerControllerB owner) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00d9: 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_00f4: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) List<VisibleEntity> list = new List<VisibleEntity>(); Helper.PrintLayerMask(_layerMask, "Raycast layer"); PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>(false); Vector3[] array2 = (Vector3[])(object)new Vector3[10] { new Vector3(0f, 2.25f, 0f), new Vector3(0f, 2f, 0f), new Vector3(0f, 1.75f, 0f), new Vector3(0f, 1.5f, 0f), new Vector3(0f, 1.25f, 0f), new Vector3(0f, 1f, 0f), new Vector3(0f, 0.75f, 0f), new Vector3(0f, 0.5f, 0f), new Vector3(0f, 0.25f, 0f), new Vector3(0f, 0f, 0f) }; PlayerControllerB[] array3 = array; foreach (PlayerControllerB val in array3) { if (val.isFreeCamera || !val.isPlayerControlled) { continue; } Vector3[] array4 = array2; foreach (Vector3 val2 in array4) { Vector3 val3 = ((Component)val).transform.position + val2; if (!IsInViewPort(val3)) { continue; } float distance = Vector3.Distance(val3, ((Component)_camera).transform.position); if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)"Is in viewPort"); } if (IsInRange(val3, distance)) { if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)"Is in range"); } if (IsRayCastVisible(val3, ((Component)val).gameObject)) { VisibleEntity visibleEntity = default(VisibleEntity); visibleEntity.name = val.playerUsername; visibleEntity.isPlayer = true; visibleEntity.networkID = ((NetworkBehaviour)val).NetworkObjectId; VisibleEntity item = visibleEntity; list.Add(item); break; } } } } EnemyAI[] array5 = Object.FindObjectsOfType<EnemyAI>(false); EnemyAI[] array6 = array5; foreach (EnemyAI val4 in array6) { Vector3[] array7 = array2; foreach (Vector3 val5 in array7) { Vector3 val6 = ((Component)val4).transform.position + val5; if (!IsInViewPort(val6)) { continue; } float distance2 = Vector3.Distance(val6, ((Component)_camera).transform.position); if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)"Is in viewPort"); } if (!IsInRange(val6, distance2)) { continue; } if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)"Is in range"); } if (!IsRayCastVisible(val6, ((Component)val4).gameObject)) { continue; } SandWormAI val7 = (SandWormAI)(object)((val4 is SandWormAI) ? val4 : null); if (!Object.op_Implicit((Object)(object)val7) || val7.emerged) { VisibleEntity visibleEntity = default(VisibleEntity); visibleEntity.name = val4.enemyType.enemyName; visibleEntity.isPlayer = false; visibleEntity.isOutside = val4.isOutside; visibleEntity.networkID = ((NetworkBehaviour)val4).NetworkObjectId; VisibleEntity item2 = visibleEntity; list.Add(item2); if (CustomConfig.monsterReactToFlash.Value && Object.op_Implicit((Object)(object)owner)) { MonsterReact.ReactToFlash(owner, val4, distance2, isInPicture: true); } } break; } } return list; } private bool IsInRange(Vector3 p, float distance) { if (distance > detectionDistance) { return false; } return true; } private bool IsInViewPort(Vector3 p) { //IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) Vector3 val = _camera.WorldToViewportPoint(p); if (val.z > 0f && val.x > 0f && val.x < 1f && val.y > 0f && val.y < 1f) { return true; } return false; } private bool IsRayCastVisible(Vector3 p, GameObject target) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)_camera).transform.position, p); RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)_camera).transform.position, p - ((Component)_camera).transform.position, ref val, num, LayerMask.op_Implicit(_layerMask))) { if ((Object)(object)((Component)((RaycastHit)(ref val)).transform).gameObject == (Object)(object)target) { if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)"Hit target"); Helper.SpawnDebugVisual(((RaycastHit)(ref val)).point, Color.green); } return true; } if (Plugin.DebugMode) { Plugin.MyLogger.LogWarning((object)("SOMETHING IS BLOCKING : " + ((Object)((RaycastHit)(ref val)).transform).name + " " + LayerMask.LayerToName(((Component)((RaycastHit)(ref val)).transform).gameObject.layer))); Helper.SpawnDebugVisual(((RaycastHit)(ref val)).point, Color.red); } return false; } if (Plugin.DebugMode) { Helper.SpawnDebugVisual(p, Color.green); } return true; } } internal static class MonsterReact { private static void StunMonster(EnemyAI enemy, PlayerControllerB owner, float stunDuration) { Plugin.MyLogger.LogInfo((object)(((Object)enemy.enemyType).name + " is stunned by " + owner.playerUsername)); enemy.SetEnemyStunned(true, stunDuration, owner); } private static void TargetOwner(EnemyAI enemy, PlayerControllerB owner) { Plugin.MyLogger.LogInfo((object)(((Object)enemy.enemyType).name + " target " + owner.playerUsername)); enemy.SetMovingTowardsTargetPlayer(owner); } private static void AngryJester(EnemyAI enemy, PlayerControllerB owner) { JesterAI val = (JesterAI)(object)((enemy is JesterAI) ? enemy : null); if (!((Object)(object)val == (Object)null)) { Plugin.MyLogger.LogInfo((object)"Jester pop !"); val.beginCrankingTimer = 0f; val.popUpTimer = 0f; } } private static void AngryFlowerman(EnemyAI enemy, PlayerControllerB owner) { FlowermanAI val = (FlowermanAI)(object)((enemy is FlowermanAI) ? enemy : null); if (!((Object)(object)val == (Object)null)) { ((EnemyAI)val).SwitchToBehaviourStateOnLocalClient(2); val.EnterAngerModeServerRpc(100f); } } public static bool ChanceOfTrigger(float chance) { if (Random.value <= chance) { return true; } Plugin.MyLogger.LogWarning((object)"Lucky! the monster didn't react to the flash (this time)"); return false; } public static void ReactToFlash(PlayerControllerB owner, EnemyAI enemy, float distance, bool isInPicture) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)enemy)) { Plugin.MyLogger.LogError((object)"No owner or enemy ! Enemy can't react"); return; } enemy.DetectNoise(((Component)owner).transform.position, 1.5f, 1, 0); string text = enemy.enemyType.enemyName.ToLower(); switch (text) { case "flowerman": if (ChanceOfTrigger(0.5f)) { AngryFlowerman(enemy, owner); } break; case "crawler": TargetOwner(enemy, owner); break; case "hoarding bug": StunMonster(enemy, owner, 10f); break; case "centipede": TargetOwner(enemy, owner); break; case "bunker spider": TargetOwner(enemy, owner); break; case "puffer": TargetOwner(enemy, owner); break; case "jester": if (ChanceOfTrigger(0.33f)) { AngryJester(enemy, owner); } break; case "blob": TargetOwner(enemy, owner); break; case "girl": TargetOwner(enemy, owner); break; case "spring": TargetOwner(enemy, owner); break; case "nutcracker": TargetOwner(enemy, owner); break; case "masked": TargetOwner(enemy, owner); break; case "mouthdog": TargetOwner(enemy, owner); break; case "earth leviathan": TargetOwner(enemy, owner); break; case "forestgiant": TargetOwner(enemy, owner); break; case "baboon hawk": TargetOwner(enemy, owner); break; case "red locust bees": TargetOwner(enemy, owner); break; case "docile locust bees": TargetOwner(enemy, owner); break; case "manticoil": TargetOwner(enemy, owner); break; default: Plugin.MyLogger.LogError((object)("No special behaviour for " + text)); break; } } } internal static class PictureHelper { public struct MonsterNameValue { public string Name; public int Value; public MonsterNameValue(string n, int v) { Name = n; Value = v; } } public static List<MonsterNameValue> additionalMonsterValues = new List<MonsterNameValue>(); public static string MakePictureDescription(List<VisibleEntity> entities, bool isUnique) { string text = ""; if (entities.Count == 0) { return "A boring picture with nothing in it"; } text = ((!isUnique) ? "[Copy] A beautiful picture of " : "A beautiful picture of "); for (int i = 0; i < entities.Count; i++) { if (!entities[i].isPlayer) { text += "a "; } text = ((i != entities.Count - 1) ? ((i != entities.Count - 2) ? (text + entities[i].name + ", ") : (text + entities[i].name + " and ")) : (text + entities[i].name + ".")); } return text; } public static int ComputePictureValue(List<VisibleEntity> entities, bool isUnique) { int num = 0; int num2 = 0; float num3 = 0f; int num4 = 0; for (int i = 0; i < entities.Count; i++) { if (entities[i].isPlayer) { num++; continue; } num2++; num3 += GetMonsterScore(entities[i].name); } if (!isUnique) { Plugin.MyLogger.LogInfo((object)"This picture already exists ! Set scrap value to 0"); num4 = 0; } else { num4 = (int)num3; Plugin.MyLogger.LogInfo((object)("Picture has " + num4 + " value")); } return num4; } private static float GetMonsterScore(string monsterName) { string monsterName2 = monsterName.ToLower(); float? num = GetScrapFromAdditionalMonster(monsterName2); if (!num.HasValue) { num = CustomConfig.defaultMonsterValue.Value; Plugin.MyLogger.LogError((object)("UNKNOWN MONSTER! Add " + monsterName + "to the config files to add a specific value! The default value is currently applied")); } ManualLogSource myLogger = Plugin.MyLogger; float? num2 = num; myLogger.LogInfo((object)("You catch: " + monsterName + " with a value of " + num2)); return num.Value * (float)CustomConfig.monsterValueMultiplier.Value; } private static float? GetScrapFromAdditionalMonster(string monsterName) { float? result = null; foreach (MonsterNameValue additionalMonsterValue in additionalMonsterValues) { if (monsterName == additionalMonsterValue.Name) { result = additionalMonsterValue.Value; } } return result; } } internal class PictureItem : GrabbableObject { public int pictureID = 0; public bool isPin = false; public Vector3 pinPosition; public Quaternion pinRotation; public string description; public LayerMask layer; public bool spawnFromSaved = false; public Texture2D pictureTex = null; public string pictureMetadataID = ""; private ScanNodeProperties scanNodeProperties; private NetworkVariable<int> _PictureID = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<bool> _SpawnFromSaved = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private AudioSource source; public static List<string> picturesMetaDataId = new List<string>(); private Transform pictureMesh; private Vector3 pictureMeshStartScale; private BoxCollider collider; private Vector3 boxColliderStartSize; public string[] layers = new string[10] { "Default", "Room", "InteractableObject", "Colliders", "PhysicsObjects", "MiscLevelGeometry", "Terrain", "PlacementBlocker", "Railing", "DecalStickableSurface" }; public string[] banParents = new string[4] { "SteelDoor (1)", "LevelGeneration", "EntranceTeleportA(Clone)", "VolumeMain (1)" }; private bool canPinPicture = false; public int PictureID => _PictureID.Value; private void CustomStart() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) base.propColliders = ((Component)this).gameObject.GetComponentsInChildren<Collider>(); base.originalScale = ((Component)this).transform.localScale; if (base.itemProperties.isScrap && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) { base.radarIcon = Object.Instantiate<GameObject>(StartOfRound.Instance.itemRadarIconPrefab, RoundManager.Instance.mapPropsContainer.transform).transform; } if (!base.itemProperties.isScrap) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)this).gameObject); } MeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).renderingLayerMask = 1u; } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Renderer)componentsInChildren2[j]).renderingLayerMask = 1u; } } public override void Start() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) source = ((Component)this).GetComponent<AudioSource>(); layer = LayerMask.op_Implicit(LayerMask.GetMask(layers)); pictureMesh = ((Component)this).transform.Find("Mesh"); pictureMeshStartScale = pictureMesh.localScale * CustomConfig.pictureScaleMultiplier.Value; collider = ((Component)this).GetComponent<BoxCollider>(); boxColliderStartSize = collider.size; if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { _PictureID.Value = pictureID; _SpawnFromSaved.Value = spawnFromSaved; } else { spawnFromSaved = _SpawnFromSaved.Value; } if (spawnFromSaved) { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { UpdatePinClientRpc(isPin, pinPosition, pinRotation, Helper.GetMountPath(((Component)this).transform)); SyncPictureDataClientRpc(description, base.scrapValue, "OLD" + pictureID); } else { SyncSaveStartServerRpc(); } } else if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { Plugin.MyLogger.LogInfo((object)("Sync picture data : " + scanNodeProperties.headerText)); SyncPictureDataClientRpc(scanNodeProperties.headerText, base.scrapValue, pictureMetadataID); } if (isPin) { CustomStart(); } else { ((GrabbableObject)this).Start(); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if ((Object)(object)base.playerHeldBy != (Object)null && ((NetworkBehaviour)this).IsOwner) { canPinPicture = true; } } public override void LateUpdate() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); if ((Object)(object)base.playerHeldBy != (Object)null && base.isHeld) { RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref val, 2f, LayerMask.op_Implicit(layer))) { if (!((Object)(object)((RaycastHit)(ref val)).transform == (Object)null)) { if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)base.playerHeldBy).transform || (!CustomConfig.canPinPictureToPlayers.Value && (Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null)) { return; } if (canPinPicture) { Plugin.MyLogger.LogInfo((object)("Trying to pin picture to: " + ((Object)((RaycastHit)(ref val)).transform).name + " On layer: " + LayerMask.LayerToName(((Component)((RaycastHit)(ref val)).transform).gameObject.layer))); if (Plugin.DebugMode) { Helper.PrintLayerMask(layer, "Picture pin layerMask"); } canPinPicture = false; Vector3 val2 = ((RaycastHit)(ref val)).point; Quaternion val3 = Quaternion.identity; float num = Mathf.Abs(Vector3.Dot(((RaycastHit)(ref val)).normal, Vector3.up)); ((Quaternion)(ref val3)).SetLookRotation(-Vector3.up, ((RaycastHit)(ref val)).normal); base.playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, ((RaycastHit)(ref val)).point, true); string text = Helper.FindFirstTransformFromMountPath(Helper.GetMountPath(((RaycastHit)(ref val)).transform)); if (IsBanParent(text) || IsBanParent(((Object)((RaycastHit)(ref val)).transform).name)) { ((Component)this).transform.parent = null; Plugin.MyLogger.LogInfo((object)("Pin target root: " + text + " or pin target parent: " + ((Object)((RaycastHit)(ref val)).transform).name + " are banned ! Pinning picture in world position")); } else { ((Component)this).transform.parent = ((RaycastHit)(ref val)).transform; } if (Object.op_Implicit((Object)(object)((Component)this).transform.parent)) { Plugin.MyLogger.LogInfo((object)("Pin target to: " + ((Object)((Component)this).transform.parent).name)); val2 = ((Component)this).transform.parent.InverseTransformPoint(val2); val3 = Quaternion.Inverse(val3) * ((Component)this).transform.parent.rotation; } if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { UpdatePinClientRpc(setPin: true, val2, val3, Helper.GetMountPath(((Component)this).transform)); } else { UpdatePinServerRpc(setPin: true, val2, val3, Helper.GetMountPath(((Component)this).transform)); } } } } else { canPinPicture = false; } } if (isPin) { ((Component)this).transform.localPosition = pinPosition; ((Component)this).transform.localRotation = pinRotation; } ((Component)this).transform.localScale = Vector3.one; UpdateScale(); } private void UpdateScale() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f2: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(1f, 1f, 1f); Transform parent = pictureMesh.parent; pictureMesh.parent = null; pictureMesh.localScale = pictureMeshStartScale; Vector3 localScale = pictureMesh.localScale; pictureMesh.parent = parent; ((Vector3)(ref val))..ctor(pictureMesh.localScale.x / localScale.x, pictureMesh.localScale.y / localScale.y, pictureMesh.localScale.z / localScale.z); collider.size = new Vector3(boxColliderStartSize.x * val.x, boxColliderStartSize.y * val.y, boxColliderStartSize.z * val.z) * CustomConfig.pictureScaleMultiplier.Value; } private bool IsBanParent(string str) { for (int i = 0; i < banParents.Length; i++) { if (str == banParents[i]) { return true; } } return false; } private void UnPin() { //IL_0034: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { UpdatePinClientRpc(setPin: false, Vector3.zero, Quaternion.identity, ""); } else { UpdatePinServerRpc(setPin: false, Vector3.zero, Quaternion.identity, ""); } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); UnPin(); } [ServerRpc] public void UpdatePinServerRpc(bool setPin, Vector3 pinPos, Quaternion pinRot, string mountPath) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Invalid comparison between Unknown and I4 //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0135: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2195067630u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setPin, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pinPos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pinRot); bool flag = mountPath != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(mountPath, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2195067630u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UpdatePinClientRpc(setPin, pinPos, pinRot, mountPath); } } [ClientRpc] public void UpdatePinClientRpc(bool setPin, Vector3 pinPos, Quaternion pinRot, string mountPath) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1267963704u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setPin, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pinPos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pinRot); bool flag = mountPath != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(mountPath, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1267963704u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (isPin && !setPin) { ((Component)this).transform.parent = null; } if (setPin) { ((Component)this).transform.parent = Helper.FindTransformFromMountPath(mountPath); } isPin = setPin; pinPosition = pinPos; pinRotation = pinRot; ManualLogSource myLogger = Plugin.MyLogger; string text = setPin.ToString(); Vector3 val3 = pinPos; myLogger.LogInfo((object)("Client RPC pin : " + text + " " + ((object)(Vector3)(ref val3)).ToString())); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); UnPin(); source.PlayOneShot(Plugin.AudioPictureGrab); } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); source.PlayOneShot(Plugin.AudioPictureDrop); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); source.PlayOneShot(Plugin.AudioPictureEquip); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); NetworkVariable<int> obj = _PictureID; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnPictureIDChange)); if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) { InitPicture(); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); NetworkVariable<int> obj = _PictureID; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnPictureIDChange)); } public void RegisterPictureMetadata() { picturesMetaDataId.Add(pictureMetadataID); } public bool IsPictureUnique() { return !picturesMetaDataId.Contains(pictureMetadataID); } private void InitPicture() { PictureItem component = ((Component)this).GetComponent<PictureItem>(); component.pictureID = PictureID; component.UpdatePicture(); } private void OnPictureIDChange(int prevValue, int newValue) { PictureItem component = ((Component)this).GetComponent<PictureItem>(); component.pictureID = newValue; component.UpdatePicture(); } public bool UpdatePicture() { if (pictureID == 0) { return false; } pictureTex = GetSavedImage(); if ((Object)(object)pictureTex != (Object)null) { MeshRenderer componentInChildren = ((Component)this).GetComponentInChildren<MeshRenderer>(); Material material = ((Renderer)componentInChildren).material; material.mainTexture = (Texture)(object)pictureTex; material.SetTexture("_EmissiveColorMap", (Texture)(object)pictureTex); return true; } return false; } public Texture2D GetSavedImage() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown string text = PolaroidItem.GetDirPath() + pictureID + ".png"; if (!File.Exists(text)) { Plugin.MyLogger.LogWarning((object)("No File found for " + text)); return null; } Plugin.MyLogger.LogInfo((object)("Found file at : " + text)); byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, array); return val; } public override void LoadItemSaveData(int saveData) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LoadItemSaveData(saveData); if (!((NetworkBehaviour)this).IsClient) { pictureID = saveData; SaveSystem.LoadAndUpdatePicture(this); pinPosition = ((Component)this).transform.localPosition; pinRotation = ((Component)this).transform.localRotation; if (Plugin.DebugMode) { Helper.SpawnDebugVisual(((Component)this).transform.position, Color.white); } spawnFromSaved = true; } } public override void OnDestroy() { if (RoundManager.Instance.playersManager.firingPlayersCutsceneRunning || RoundManager.Instance.playersManager.allPlayersDead) { SaveSystem.RemoveImageFile(PictureID); } else if (!base.isInShipRoom) { SaveSystem.RemoveImageFile(PictureID); } ((NetworkBehaviour)this).OnDestroy(); } public override int GetItemDataToSave() { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { SaveSystem.Save(Object.FindObjectsOfType<PictureItem>().ToList()); } picturesMetaDataId.Clear(); return pictureID; } [ServerRpc(RequireOwnership = false)] private void SyncSaveStartServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3344191779u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3344191779u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UpdatePinClientRpc(isPin, pinPosition, pinRotation, Helper.GetMountPath(((Component)this).transform)); SyncPictureDataClientRpc(description, base.scrapValue, "OLD" + pictureID); } } } [ClientRpc] private void SyncPictureDataClientRpc(string header, int scrap, string metadata) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2935663508u, val, (RpcDelivery)0); bool flag = header != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(header, false); } BytePacker.WriteValueBitPacked(val2, scrap); bool flag2 = metadata != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(metadata, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2935663508u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { description = header; base.scrapValue = scrap; scanNodeProperties.headerText = description; ((GrabbableObject)this).SetScrapValue(base.scrapValue); base.itemProperties.creditsWorth = base.scrapValue; pictureMetadataID = metadata; MeshRenderer component = ((Component)((Component)this).transform.Find("Mesh").Find("Border")).GetComponent<MeshRenderer>(); if (base.scrapValue <= 0) { ((Renderer)component).material.color = Color.white; ((Renderer)component).material.SetColor("_EmissiveColor", Color.grey); } else { ((Renderer)component).material.color = Color.yellow; ((Renderer)component).material.SetColor("_EmissiveColor", Color.yellow); } Plugin.MyLogger.LogInfo((object)("CLIENT sync picture node to: " + scanNodeProperties.subText + " " + base.scrapValue)); } } protected override void __initializeVariables() { if (_PictureID == null) { throw new Exception("PictureItem._PictureID cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_PictureID).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_PictureID, "_PictureID"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_PictureID); if (_SpawnFromSaved == null) { throw new Exception("PictureItem._SpawnFromSaved cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_SpawnFromSaved).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_SpawnFromSaved, "_SpawnFromSaved"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_SpawnFromSaved); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PictureItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2195067630u, new RpcReceiveHandler(__rpc_handler_2195067630)); NetworkManager.__rpc_func_table.Add(1267963704u, new RpcReceiveHandler(__rpc_handler_1267963704)); NetworkManager.__rpc_func_table.Add(3344191779u, new RpcReceiveHandler(__rpc_handler_3344191779)); NetworkManager.__rpc_func_table.Add(2935663508u, new RpcReceiveHandler(__rpc_handler_2935663508)); } private static void __rpc_handler_2195067630(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_0055: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } bool setPin = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setPin, default(ForPrimitives)); Vector3 pinPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pinPos); Quaternion pinRot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pinRot); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string mountPath = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref mountPath, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((PictureItem)(object)target).UpdatePinServerRpc(setPin, pinPos, pinRot, mountPath); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_1267963704(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool setPin = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setPin, default(ForPrimitives)); Vector3 pinPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pinPos); Quaternion pinRot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pinRot); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string mountPath = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref mountPath, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PictureItem)(object)target).UpdatePinClientRpc(setPin, pinPos, pinRot, mountPath); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3344191779(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PictureItem)(object)target).SyncSaveStartServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2935663508(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string header = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref header, false); } int scrap = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrap); bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string metadata = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref metadata, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PictureItem)(object)target).SyncPictureDataClientRpc(header, scrap, metadata); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PictureItem"; } } internal class PolaroidItem : GrabbableObject { private IEnumerator pictureCoroutine; private Camera cam; private MeshRenderer screen; private MeshRenderer noBatteryRend; private Material screenMat; private Material flashMat; private Light flash; private HDAdditionalLightData lightData; private DetectionSystem detectionSystem; private bool isTakingPicture = false; private float flashIntensity; private float flashDuration; private float pictureTakenAtFlashPercentage; private int pictureResolution; private int screenResolution; private bool flashIsActive = true; private float renderDelay = 0.2f; private float nextRender = 0f; private float customCooldown; private float currentCustomCooldown; public Vector3 pictureSpawnOffset = new Vector3(-1f, 0f, 0f); private Vector3 camLocalPos; private Quaternion camLocalRot; public AudioSource source; private bool isOnTheFloor = true; public const string pictureFolder = "PolaroidPictures"; public string[] layermaskRaycast = new string[7] { "Default", "Terrain", "Room", "PlaceabkeShipObjects", "DecalStickableSurface", "Monster", "Player" }; private LayerMask rayCastLayerMask; private Texture2D polaroidScreenTex = null; private bool isScreenStarting = false; private bool isScreenUpdating = false; public bool HasBattery => base.insertedBattery.charge > 0.01f; public override void Start() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_011e: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); source = ((Component)this).GetComponent<AudioSource>(); flash = ((Component)this).GetComponentInChildren<Light>(true); lightData = ((Component)flash).gameObject.GetComponent<HDAdditionalLightData>(); ((Behaviour)flash).enabled = false; cam = ((Component)this).GetComponentInChildren<Camera>(true); cam.depth = -10f; ((Behaviour)cam).enabled = false; cam.cullingMask |= LayerMask.GetMask(new string[1] { "DecalStickableSurface" }); rayCastLayerMask = LayerMask.op_Implicit(LayerMask.GetMask(layermaskRaycast)); detectionSystem = new DetectionSystem(rayCastLayerMask, cam); foreach (Transform item in ((Component)this).transform) { Transform val = item; if (((Object)val).name == "PolaroidScreenPlane") { screen = ((Component)val).gameObject.GetComponent<MeshRenderer>(); screenMat = ((Renderer)screen).material; SetScreenColor(Color.black); } if (((Object)val).name == "Mesh") { MeshRenderer component = ((Component)val).gameObject.GetComponent<MeshRenderer>(); flashMat = ((Renderer)component).materials[2]; flashMat.color = Color.green; flashMat.SetColor("_EmissiveColor", Color.green); } if (((Object)val).name == "PolaroidNoBatteryPlane") { noBatteryRend = ((Component)val).gameObject.GetComponent<MeshRenderer>(); } } if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { base.insertedBattery.charge = 1f; ((GrabbableObject)this).SyncBatteryServerRpc(100); } UpdateConfigValue(); polaroidScreenTex = new Texture2D(((Texture)cam.targetTexture).width, ((Texture)cam.targetTexture).height); camLocalPos = ((Component)cam).transform.localPosition; camLocalRot = ((Component)cam).transform.localRotation; } private void SetScreenColor(Color col) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) screenMat.color = col; screenMat.SetColor("_EmissiveColor", col); screenMat.mainTexture = null; screenMat.SetTexture("_EmissiveColorMap", (Texture)null); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if (HasBattery) { source.PlayOneShot(Plugin.AudioPolaroidGrab); } ((MonoBehaviour)this).StartCoroutine(StartScreenRoutine()); isOnTheFloor = false; } private IEnumerator StartScreenRoutine() { isScreenStarting = true; SetScreenColor(Color.black); yield return (object)new WaitForSeconds(0.1f); SetScreenColor(Color.grey); yield return (object)new WaitForSeconds(0.1f); SetScreenColor(Color.black); yield return (object)new WaitForSeconds(0.2f); float t = 0f; while (t < 0.2f) { SetScreenColor(Color.Lerp(Color.white, Color.black, t / 0.2f)); t += Time.deltaTime; yield return null; } isScreenStarting = false; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.equippedUsableItemQE = true; if (HasBattery && !isOnTheFloor) { source.PlayOneShot(Plugin.AudioPolaroidEquip); } } public override void PocketItem() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; base.isBeingUsed = false; SetScreenColor(Color.black); } ((GrabbableObject)this).PocketItem(); ((Renderer)noBatteryRend).enabled = false; } public override void DiscardItem() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } base.isBeingUsed = false; SetScreenColor(Color.black); ((GrabbableObject)this).DiscardItem(); isOnTheFloor = true; } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); source.PlayOneShot(Plugin.AudioPolaroidDrop); } private void UpdateConfigValue() { Plugin.MyLogger.LogInfo((object)"Apply config values to polaroid"); cam.fieldOfView = CustomConfig.cameraFov.Value; lightData.lightAngle = CustomConfig.flashAngle.Value; lightData.range = CustomConfig.flashRange.Value; flashIntensity = CustomConfig.flashIntensity.Value; flashDuration = CustomConfig.flashDuration.Value; pictureTakenAtFlashPercentage = CustomConfig.pictureTakenAtFlashPercentage.Value; pictureResolution = CustomConfig.pictureResolution.Value; screenResolution = CustomConfig.screenResolution.Value; SetRenderQuality(highQuality: false); cam.farClipPlane = CustomConfig.polaroidCameraFarClipping.Value; customCooldown = CustomConfig.polaroidUseCooldown.Value; base.itemProperties.batteryUsage = 1f / (float)CustomConfig.polaroidMaxPictureFromFullBattery.Value; renderDelay = CustomConfig.polaroidScreenUpdateRate.Value; if (!CustomConfig.polaroidCanUpdateScreen.Value) { renderDelay = float.PositiveInfinity; } } private void SetRenderQuality(bool highQuality) { if (highQuality) { cam.targetTexture.Release(); pictureResolution = CustomConfig.pictureResolution.Value; ((Texture)cam.targetTexture).width = pictureResolution; ((Texture)cam.targetTexture).height = pictureResolution; } else { cam.targetTexture.Release(); pictureResolution = CustomConfig.pictureResolution.Value; ((Texture)cam.targetTexture).width = screenResolution; ((Texture)cam.targetTexture).height = screenResolution; } } private bool CanTakePicture() { if (base.itemProperties.requiresBattery && (base.insertedBattery == null || base.insertedBattery.empty) && !((GrabbableObject)this).RequireCooldown()) { return false; } if (base.insertedBattery.charge <= 0.01f) { return false; } return true; } private int MakePictureID() { return Random.Range(1, 99999999); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right) { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { SetFlashClientRpc(!flashIsActive); } else { SetFlashServerRpc(!flashIsActive); } } } [ServerRpc] public void SetFlashServerRpc(bool b) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(933282373u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref b, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 933282373u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetFlashClientRpc(b); } } [ClientRpc] public void SetFlashClientRpc(bool b) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(440236375u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref b, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 440236375u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetFlashLocal(b); } } } public void SetFlashLocal(bool b) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0023: Unknown result type (might be due to invalid IL or missing references) if (b) { flashMat.color = Color.green; flashMat.SetColor("_EmissiveColor", Color.green); source.PlayOneShot(Plugin.AudioPolaroidSwitchFlashOn); } else { flashMat.color = Color.black; flashMat.SetColor("_EmissiveColor", Color.black); source.PlayOneShot(Plugin.AudioPolaroidSwitchFlashOff); } flashIsActive = b; Plugin.MyLogger.LogInfo((object)("Set Flash to : " + b)); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (currentCustomCooldown > 0f || !buttonDown || !((Object)(object)base.playerHeldBy != (Object)null)) { return; } int totalScrapScanned = HUDManager.Instance.totalScrapScanned; if (CanTakePicture()) { currentCustomCooldown = customCooldown; base.insertedBattery.charge = Mathf.Clamp(base.insertedBattery.charge - base.itemProperties.batteryUsage, 0f, 1f); Plugin.MyLogger.LogInfo((object)("Polaroid charge updated to " + base.insertedBattery.charge * 100f + "%")); int id = MakePictureID(); int cullingMask = base.playerHeldBy.gameplayCamera.cullingMask; if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { TakePictureClientRpc(id, cullingMask); ((GrabbableObject)this).SyncBatteryClientRpc((int)(base.insertedBattery.charge * 100f)); } else { TakePictureServerRpc(id, cullingMask); ((GrabbableObject)this).SyncBatteryServerRpc((int)(base.insertedBattery.charge * 100f)); } } else { Plugin.MyLogger.LogInfo((object)"no battery"); } } [ServerRpc] public void TakePictureServerRpc(int id, int cullingMask) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3440970851u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); BytePacker.WriteValueBitPacked(val2, cullingMask); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3440970851u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TakePictureClientRpc(id, cullingMask); } } [ClientRpc] public void TakePictureClientRpc(int id, int cullingMask) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4078080974u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); BytePacker.WriteValueBitPacked(val2, cullingMask); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4078080974u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { UpdateConfigValue(); PolaroidItem component = ((Component)this).GetComponent<PolaroidItem>(); pictureCoroutine = DoPictureSequence(id); ((MonoBehaviour)this).StopCoroutine(pictureCoroutine); ((MonoBehaviour)this).StartCoroutine(pictureCoroutine); } } } private IEnumerator DoPictureSequence(int pictureID) { float t = 0f; ((Behaviour)flash).enabled = true; bool pictureTaken = false; isTakingPicture = true; screenMat.color = Color.black; screenMat.SetColor("_EmissiveColor", Color.black); screenMat.mainTexture = null; screenMat.SetTexture("_EmissiveColorMap", (Texture)null); lightData.SetIntensity(0f); if (flashIsActive) { source.PlayOneShot(Plugin.AudioPolaroidShootFlashOn); } else { source.PlayOneShot(Plugin.AudioPolaroidShootFlashOff); } while (t < 1f) { if (flashIsActive) { lightData.SetIntensity(flashIntensity * (1f - t), (LightUnit)2); } if (t > pictureTakenAtFlashPercentage && !pictureTaken) { ((Behaviour)cam).enabled = true; SetRenderQuality(highQuality: true); yield return null; Texture2D tex = new Texture2D(((Texture)cam.targetTexture).width, ((Texture)cam.targetTexture).height); RenderTexture(cam, ref tex); SpawnPicture(tex, pictureID); pictureTaken = true; SetRenderQuality(highQuality: false); ((Behaviour)cam).enabled = false; } t += Time.deltaTime / flashDuration; yield return null; } ((Behaviour)flash).enabled = false; isTakingPicture = false; yield return null; } private async void SpawnPicture(Texture2D tex, int pictureID) { GameObject g = Plugin.Instance.picture.spawnPrefab; if (!Object.op_Implicit((Object)(object)g)) { return; } Plugin.MyLogger.LogInfo((object)("saving picture to disk with id : " + pictureID)); await SaveTextureToDisk(tex, pictureID.ToString() ?? ""); if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { List<VisibleEntity> visEntities = detectionSystem.GetVisibleEntities(base.playerHeldBy); Vector3 pos = ((Component)this).transform.position + ((Component)this).transform.rotation * pictureSpawnOffset; if (Object.op_Implicit((Object)(object)base.playerHeldBy)) { pos = ((Component)base.playerHeldBy).transform.position; } GameObject obj = Object.Instantiate<GameObject>(g, pos, Quaternion.identity, (Transform)null); ((Renderer)obj.GetComponentInChildren<MeshRenderer>()).material.mainTexture = (Texture)(object)tex; PictureItem picture = obj.GetComponent<PictureItem>(); picture.pictureID = pictureID; picture.pictureMetadataID = VisibleEntity.GetVisibleEntitiesToString(visEntities); bool isUnique = picture.IsPictureUnique(); string pictureName = PictureHelper.MakePictureDescription(visEntities, isUnique); int pictureValue = PictureHelper.ComputePictureValue(visEntities, isUnique); picture.RegisterPictureMetadata(); ScanNodeProperties scanNode = obj.GetComponentInChildren<ScanNodeProperties>(); scanNode.headerText = pictureName; ((GrabbableObject)picture).SetScrapValue(pictureValue); Plugin.MyLogger.LogInfo((object)("Spawning picture prefab :\nwith picture ID: " + pictureID + "\nWith name: " + pictureName + "\nWith value: " + ((GrabbableObject)picture).scrapV