Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SillyThings v1.0.4
Silly_Things.dll
Decompiled 3 weeks 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.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreCompany; using MoreCompany.Cosmetics; using Silly_Things.Codes.CameraItem; using Silly_Things.Codes.PortalGun; using Silly_Things.Codes.SailorMoonStick; using Silly_Things.NetcodePatcher; using Silly_Things.codes.BountyContract; using Silly_Things.codes.CameraItem; using Silly_Things.codes.Helper; using Silly_Things.codes.MorphingCase; using Silly_Things.codes.SnakeCardboardBox; using Steamworks; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Silly_Things")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e6d58e6e641e419cf1a8fda4683ee8717e8e9876")] [assembly: AssemblyProduct("Silly_Things")] [assembly: AssemblyTitle("Silly_Things")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Silly_Things { public class Config { public ConfigEntry<bool> debugMode; public ConfigEntry<int> MorphingCaseItemRarity; public ConfigEntry<int> SnakeCardboardBox; public ConfigEntry<int> BountyContract; public ConfigEntry<int> BountyChanceToFocusPlayer; public ConfigEntry<int> BountyRewardForKillingPlayer; public ConfigEntry<string> BountymonsterValues; public ConfigEntry<bool> DeletePictureOnLaunch; public ConfigEntry<float> cameraFov; public ConfigEntry<bool> cameraCanUpdateScreen; public ConfigEntry<float> cameraScreenUpdateRate; public ConfigEntry<float> cameraCameraFarClipping; public ConfigEntry<float> cameraUseCooldown; public ConfigEntry<int> cameraLootRarity; public ConfigEntry<bool> cameraCanBeBuy; public ConfigEntry<int> cameraCost; public ConfigEntry<bool> cameraHasBattery; public ConfigEntry<int> cameraBatteryNumberOfPickBeforeZero; public ConfigEntry<string> monsterValues; public ConfigEntry<int> defaultMonsterValue; public ConfigEntry<int> monsterValueMultiplier; public ConfigEntry<bool> monsterReactToFlash; public ConfigEntry<float> flashAngle; public ConfigEntry<float> flashIntensity; public ConfigEntry<float> flashRange; public ConfigEntry<int> pictureResolutionWidth; public ConfigEntry<int> pictureResolutionHeight; public ConfigEntry<int> pictureResolutionDepth; public ConfigEntry<int> screenResolutionHeight; public ConfigEntry<int> screenResolutionWidth; public ConfigEntry<int> screenResolutionDepth; public Config(ConfigFile configFile) { configFile.SaveOnConfigSet = false; debugMode = configFile.Bind<bool>("Debug", "debugMode", false, "More log"); MorphingCaseItemRarity = configFile.Bind<int>("Morphing Case", "MorphingCaseItemRarity", 18, "Rarity of the Morphing Case Item (higher = more common)."); SnakeCardboardBox = configFile.Bind<int>("Snake Cardboard Box", "SnakeCardboardBoxItemRarity", 10, "Rarity of the Snake Card Box Item (higher = more common)."); BountyContract = configFile.Bind<int>("Bounty Contract", "BountyContractItemRarity", 15, "Rarity of the Bounty Contract Item (higher = more common)."); BountyChanceToFocusPlayer = configFile.Bind<int>("Bounty Contract", "BountyChanceToFocusPlayer", 10, "Percentage of chance for a bounty contract to focus a player (higher = more chance)."); BountymonsterValues = configFile.Bind<string>("Bounty Contract", "Monsters Bounty value", MakeMonsterBountyString() ?? "", "Bounty by monster Assign a monster name to a value monsterName1:scrapValue1,monsterName2:scrapValue2,... (Can be used to overide base monster values too)"); BountyRewardForKillingPlayer = configFile.Bind<int>("Bounty Contract", "BountyRewardForKillingPlayer", 50, "Amount of Money earn when a player is killed in a bounty contract (higher = more money)."); DeletePictureOnLaunch = configFile.Bind<bool>("Camera", "DeletePictureOnLaunch", false, "Are all the picture getting deleted on every launch of lethal company"); monsterValues = configFile.Bind<string>("Camera", "Monsters value", MakeMonsterString() ?? "", "Assign a monster name to a value monsterName1:scrapValue1,monsterName2:scrapValue2,... (Can be used to overide base monster values too)"); defaultMonsterValue = configFile.Bind<int>("Camera", "Default monster value", 10, "Change default value for monster not listed above (MonsterValues)"); monsterValueMultiplier = configFile.Bind<int>("Camera", "Monster value multiplier", 1, "Change this value to multiply the value of all taken monster"); monsterReactToFlash = configFile.Bind<bool>("Camera", "Monster React to flash", true, "Does monster have special reaction when taken in picture"); cameraLootRarity = configFile.Bind<int>("Camera", "CameraLootRarity", 20, "Chance of looting a camera (1 very rare, 100 very common)"); cameraHasBattery = configFile.Bind<bool>("Camera", "CameraHasBattery", false, "Does the camera has a battery ?"); cameraBatteryNumberOfPickBeforeZero = configFile.Bind<int>("Camera", "cameraBatteryNumberOfPickBeforeZero", 10, "if the camera has battery, number of pics with a full charge"); cameraCanBeBuy = configFile.Bind<bool>("Camera", "CameraCanBeBuy", true, "Does the camera appear in the store ?"); cameraCost = configFile.Bind<int>("Camera", "CameraCost", 150, "The cost of the camera in the store"); cameraFov = configFile.Bind<float>("Camera", "CameraFov", 75f, "The Field of view of the camera"); flashAngle = configFile.Bind<float>("Camera", "FlashAngle", 160f, "The wideness of the flash (in degree)"); flashIntensity = configFile.Bind<float>("Camera", "FlashIntensity", 250f, "The intensity of the flash"); flashRange = configFile.Bind<float>("Camera", "FlashRange", 50f, "The range of the flash in meter"); pictureResolutionWidth = configFile.Bind<int>("Camera", "PictureResolutionWidth", 1920, "The width resolution of the picture taken in your pc (careful can heavily impact performance when the camera is held)"); pictureResolutionHeight = configFile.Bind<int>("Camera", "pictureResolutionHeight", 1080, "The height resolution of the picture taken in your pc (careful can heavily impact performance when the camera is held)"); pictureResolutionDepth = configFile.Bind<int>("Camera", "pictureResolutionDepth", 50, "The depth resolution of the picture taken in your pc"); screenResolutionWidth = configFile.Bind<int>("Camera", "screenResolutionWidth", 640, "The width resolution of the camera screen (careful can heavily impact performance when the camera is held)"); screenResolutionHeight = configFile.Bind<int>("Camera", "screenResolutionHeight", 360, "The height resolution of the camera screen (careful can heavily impact performance when the camera is held)"); screenResolutionDepth = configFile.Bind<int>("Camera", "screenResolutionDepth", 50, "The depth of the camera screen"); cameraCanUpdateScreen = configFile.Bind<bool>("Camera", "CameraCanUpdateScreen", true, "Does the camera preview the picture in its screen ? (disable it to improve performance)"); cameraScreenUpdateRate = configFile.Bind<float>("Camera", "CameraScreenUpdateRate", 0.5f, "The delay betway camera screen update in seconds (increase this if you have performance issue)"); cameraCameraFarClipping = configFile.Bind<float>("Camera", "CameraCameraFarClipping", 100f, "How far the camera camera can render (reduce this if you have performance issue)"); cameraUseCooldown = configFile.Bind<float>("Camera", "CameraUseCooldown", 1f, "The required cooldown between 2 pictures"); configFile.Save(); configFile.SaveOnConfigSet = true; } private string MakeMonsterString() { string text = ""; text += "flowerman:150,"; text += "crawler:30,"; text += "hoarding bug:10,"; text += "centipede:10,"; text += "radmech:150,"; text += "bunker spider:30,"; text += "puffer:10,"; text += "jester:300,"; text += "blob:10,"; text += "girl:30,"; text += "spring:30,"; text += "nutcracker:100,"; text += "masked:10,"; text += "mouthdog:150,"; text += "earth leviathan:120,"; text += "forestgiant:80,"; text += "baboon hawk:10,"; text += "red locust bees:2,"; text += "docile locust bees:0,"; text += "manticoil:0,"; text += "peeper:2,"; text += "maneater:200,"; text += "locker:30,"; text += "fiend:80,"; text += "butler:80,"; text += "kidnapper fox:150,"; return text + "lasso man:30"; } private string MakeMonsterBountyString() { string text = ""; text += "flowerman:300:5,"; text += "crawler:75:2,"; text += "hoarding bug:50:1,"; text += "centipede:75:2,"; text += "bunker spider:150:5,"; text += "butler:250:5,"; text += "maneater:500:10,"; text += "masked:50:1,"; text += "nutcracker:250:5,"; text += "baboon hawk:100:3,"; text += "mouthdog:300:6,"; text += "forestgiant:200:5,"; text += "kidnapper fox:250:6,"; return text + "lasso man:200:5"; } } [BepInPlugin("POUY.SILLY_THINGS", "Silly Things", "0.0.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "POUY.SILLY_THINGS"; private const string NAME = "Silly Things"; private const string VERSION = "0.0.2"; public readonly Harmony harmony = new Harmony("POUY.SILLY_THINGS"); public static bool DebugMode; public GameObject? UI_MorphingCase; public AudioClip SoundOpenUI = null; public AudioClip SoundCloseUI = null; public GameObject? UI_SnakeCardboardBox; public GameObject? BigCardboardBoxPrefab; public AudioClip SoundOpenCardboardBox = null; public AudioClip SoundCloseCardboardBox = null; public GameObject? FootprintPrefab; public AudioClip SoundSonar = null; public GameObject? UI_Bounty; public GameObject? PortalPrefabA; public GameObject? PortalPrefabB; public AudioClip SoundShutter = null; public AudioClip SoundGear = null; public AudioClip SoundSucess = null; public GameObject? PhotoItemPrefab; public GameObject? CameraVariantGold; public GameObject? CameraVariantBlue; public GameObject? CameraVariantBlack; public Shader? photoShader; public Shader? photoShaderBlack; public Shader? photoShaderBlue; public Shader? photoShaderGold; public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Config SillyThingsConfig { get; private set; } internal ManageCosmetics CosmeticsManager { get; private set; } = null; public void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; SillyThingsConfig = new Config(((BaseUnityPlugin)this).Config); CosmeticsManager = new ManageCosmetics(); if (PlayerPrefs.HasKey("MorphingCase_PreviousCosmetics")) { CosmeticsManager.RestorePreviousCosmetics(); PlayerPrefs.DeleteKey("MorphingCase_PreviousCosmetics"); PlayerPrefs.DeleteKey("MorphingCase_PreviousSuit"); } LoadAssetBundle(); Logger.LogMessage((object)"Silly things Loaded !"); harmony.PatchAll(); } private void LoadAssetBundle() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "sillythings"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Failed to load asset bundle"); return; } LoadMorphingCase(val); LoadCamera(val); } private T LoadItemTemplate<T>(AssetBundle bundle, string assetPath, string itemName, int rarity, bool addtoShop = false, int cost = 0, string displayText = "") where T : GrabbableObject { Item val = bundle.LoadAsset<Item>(assetPath); T val2 = val.spawnPrefab.AddComponent<T>(); ((Object)(object)val2).name = itemName; ((GrabbableObject)val2).grabbable = true; ((GrabbableObject)val2).grabbableToEnemies = true; ((GrabbableObject)val2).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, rarity, (LevelTypes)(-1)); if (addtoShop) { TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>(); val3.clearPreviousText = true; val3.displayText = displayText; Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val3, cost); } return val2; } public void OnApplicationQuit() { CosmeticsManager.RestorePreviousCosmetics(); } public void LoadMorphingCase(AssetBundle bundle) { UI_MorphingCase = bundle.LoadAsset<GameObject>("Assets/LethalModding/MorphingCase/UI/UICase.prefab"); SoundOpenUI = bundle.LoadAsset<AudioClip>("Assets/LethalModding/MorphingCase/Case/open.ogg"); SoundCloseUI = bundle.LoadAsset<AudioClip>("Assets/LethalModding/MorphingCase/Case/close.ogg"); LoadItemTemplate<MorphingCase>(bundle, "Assets/LethalModding/MorphingCase/Case/ShapeshiftCaseItem.asset", "Morphing Case", SillyThingsConfig.MorphingCaseItemRarity.Value, addtoShop: false, 0, ""); } public void LoadBountyContract(AssetBundle bundle) { FootprintPrefab = bundle.LoadAsset<GameObject>("Assets/LethalModding/BountyContract/FootPrintPrefab.prefab"); SoundSonar = bundle.LoadAsset<AudioClip>("Assets/LethalModding/BountyContract/sonar.ogg"); UI_Bounty = bundle.LoadAsset<GameObject>("Assets/LethalModding/BountyContract/UI/UIBounty.prefab"); LoadItemTemplate<BountyContract>(bundle, "Assets/LethalModding/BountyContract/BountyContract.asset", "Bounty Contract", SillyThingsConfig.BountyContract.Value, addtoShop: false, 0, ""); string value = SillyThingsConfig.BountymonsterValues.Value; string[] array = value.Split(","); string[] array2 = array; foreach (string text in array2) { if (!string.IsNullOrEmpty(text)) { string[] array3 = text.Split(':'); if (array3.Length == 3) { int v = int.Parse(array3[1]); int c = int.Parse(array3[2]); HelperBountyContract.MonsterValues.Add(new HelperBountyContract.MonsterNameBounty(array3[0].ToLower(), v, c)); } } } } public void LoadSailorMoonStick(AssetBundle bundle) { LoadItemTemplate<SailorMoonStick>(bundle, "Assets/LethalModding/SailorMoonStick/SailorMoonStick.asset", "Sailor Moon Stick", SillyThingsConfig.BountyContract.Value, addtoShop: false, 0, ""); } public void LoadCamera(AssetBundle bundle) { SoundShutter = bundle.LoadAsset<AudioClip>("Assets/LethalModding/Camera/cameraShutter.ogg"); SoundSucess = bundle.LoadAsset<AudioClip>("Assets/LethalModding/Camera/Sucess.ogg"); SoundGear = bundle.LoadAsset<AudioClip>("Assets/LethalModding/Camera/gearCamera.ogg"); CameraVariantGold = bundle.LoadAsset<GameObject>("Assets/LethalModding/Camera/CameraVariantGold/CameraItemGold.prefab"); CameraVariantBlue = bundle.LoadAsset<GameObject>("Assets/LethalModding/Camera/CameraVariantBlue/CameraItemBlue.prefab"); CameraVariantBlack = bundle.LoadAsset<GameObject>("Assets/LethalModding/Camera/CameraVariantBlack/CameraItemBlack.prefab"); string 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\n"; LoadItemTemplate<CameraItem>(bundle, "Assets/LethalModding/Camera/CameraItem.asset", "Camera", SillyThingsConfig.cameraLootRarity.Value, SillyThingsConfig.cameraCanBeBuy.Value, SillyThingsConfig.cameraCost.Value, displayText); PhotoItemPrefab = ((Component)LoadItemTemplate<PhotoItem>(bundle, "Assets/LethalModding/Camera/PhotoItem/PhotoItem.asset", "Picture", 0, addtoShop: false, 0, "")).gameObject; string value = SillyThingsConfig.monsterValues.Value; string[] array = value.Split(","); Helper.LogDebugMod("Display monsters and there values : ", ""); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(":"); if (array3.Length == 2) { try { int v = int.Parse(array3[1]); HelperCamera.MonsterNameValue item = new HelperCamera.MonsterNameValue(array3[0].ToLower(), v); HelperCamera.additionalMonsterValues.Add(item); Helper.LogDebugMod("--> " + item.Name + " " + item.Value, ""); } catch (FormatException) { Logger.LogError((object)"Add monster config error! Scrap value isn't a number! "); } } else { Logger.LogError((object)("Error in config files ! Can't read entry: " + text + " (don't add '|' at the end)")); } } photoShader = bundle.LoadAsset<Shader>("Assets/LethalModding/Camera/ShaderCamera.shader"); photoShaderBlack = bundle.LoadAsset<Shader>("Assets/LethalModding/Camera/CameraVariantBlack/ShaderCameraBlack.shader"); photoShaderGold = bundle.LoadAsset<Shader>("Assets/LethalModding/Camera/CameraVariantGold/ShaderCameraGold.shader"); photoShaderBlue = bundle.LoadAsset<Shader>("Assets/LethalModding/Camera/CameraVariantBlue/ShaderCameraBlue.shader"); if (SillyThingsConfig.DeletePictureOnLaunch.Value) { DeletePictures(); } } public void DeletePictures() { try { string path = Path.Combine(Paths.GameRootPath, "CameraPictures"); if (Directory.Exists(path)) { Directory.GetFiles(path).ToList().ForEach(File.Delete); } } catch (Exception ex) { Logger.LogError((object)("Failed to delete pictures" + ex)); } } public void LoadSnakeCardboardBox(AssetBundle bundle) { BigCardboardBoxPrefab = bundle.LoadAsset<GameObject>("Assets/LethalModding/SnakeCardboardBox/BoxOnPlayer/CardBoardModel.prefab"); UI_SnakeCardboardBox = bundle.LoadAsset<GameObject>("Assets/LethalModding/SnakeCardboardBox/UI/CardboardBox.prefab"); SoundOpenCardboardBox = bundle.LoadAsset<AudioClip>("Assets/LethalModding/SnakeCardboardBox/SnakeCardboardBox/open.ogg"); SoundCloseCardboardBox = bundle.LoadAsset<AudioClip>("Assets/LethalModding/SnakeCardboardBox/SnakeCardboardBox/close.ogg"); LoadItemTemplate<SnakeCardboardBox>(bundle, "Assets/LethalModding/SnakeCardboardBox/SnakeCardboardBox/CardBoardBoxItem.asset", "A simple cardboard", SillyThingsConfig.SnakeCardboardBox.Value, addtoShop: false, 0, ""); } public void LoadPortalGun(AssetBundle bundle) { LoadPortalPrefab(bundle); LoadItemTemplate<PortalGun>(bundle, "Assets/LethalModding/PortalGun/PortalGunItem.asset", "Portal Gun", SillyThingsConfig.SnakeCardboardBox.Value, addtoShop: false, 0, ""); } public void LoadPortalPrefab(AssetBundle bundle) { PortalPrefabA = bundle.LoadAsset<GameObject>("Assets/LethalModding/PortalGun/portal/PortalA.prefab"); if ((Object)(object)PortalPrefabA == (Object)null) { Logger.LogError((object)"Portal A prefab not found!"); return; } if ((Object)(object)PortalPrefabA.GetComponent<Portal>() == (Object)null) { PortalPrefabA.AddComponent<Portal>(); } Rigidbody val = PortalPrefabA.GetComponent<Rigidbody>(); if ((Object)(object)val == (Object)null) { val = PortalPrefabA.AddComponent<Rigidbody>(); } val.isKinematic = true; val.useGravity = false; Collider val2 = PortalPrefabA.GetComponent<Collider>(); if ((Object)(object)val2 == (Object)null) { val2 = (Collider)(object)PortalPrefabA.AddComponent<BoxCollider>(); } val2.isTrigger = true; NetworkPrefabs.RegisterNetworkPrefab(PortalPrefabA); PortalPrefabB = bundle.LoadAsset<GameObject>("Assets/LethalModding/PortalGun/portal/PortalB.prefab"); if ((Object)(object)PortalPrefabB == (Object)null) { Logger.LogError((object)"Portal B prefab not found!"); return; } if ((Object)(object)PortalPrefabB.GetComponent<Portal>() == (Object)null) { PortalPrefabB.AddComponent<Portal>(); } Rigidbody component = PortalPrefabB.GetComponent<Rigidbody>(); if ((Object)(object)val == (Object)null) { val = PortalPrefabB.AddComponent<Rigidbody>(); } val.isKinematic = true; val.useGravity = false; Collider component2 = PortalPrefabB.GetComponent<Collider>(); if ((Object)(object)val2 == (Object)null) { val2 = (Collider)(object)PortalPrefabB.AddComponent<BoxCollider>(); } val2.isTrigger = true; NetworkPrefabs.RegisterNetworkPrefab(PortalPrefabB); } } } namespace Silly_Things.Codes.SailorMoonStick { public class SailorMoonStick : PhysicsProp { private AudioSource? audio; private bool itemIsActive = false; private GameObject? currentAimFx; private ParticleSystem[]? magicParticles; private GameObject? localVolumeObject; private float movementSpeedBase; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Transform obj = ((Component)this).transform.Find("Volume"); localVolumeObject = ((obj != null) ? ((Component)obj).GetComponent<GameObject>() : null); Transform obj2 = ((Component)this).transform.Find("Audio"); audio = ((obj2 != null) ? ((Component)obj2).GetComponent<AudioSource>() : null); magicParticles = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner) { itemIsActive = !itemIsActive; Modifiers(itemIsActive); } } public override void Update() { ((GrabbableObject)this).Update(); if (((GrabbableObject)this).isHeld && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { ApplyMoonGravity(); } } private void ApplyMoonGravity() { if (!((GrabbableObject)this).playerHeldBy.isPlayerDead && !((GrabbableObject)this).playerHeldBy.thisController.isGrounded) { if (((GrabbableObject)this).playerHeldBy.fallValue > 0f) { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.fallValue -= 0.001f; } if (((GrabbableObject)this).playerHeldBy.fallValue < 0f) { PlayerControllerB playerHeldBy2 = ((GrabbableObject)this).playerHeldBy; playerHeldBy2.fallValue += 0.001f; } } } public void Modifiers(bool ModifyPlayer) { if (ModifyPlayer) { movementSpeedBase = ((GrabbableObject)this).playerHeldBy.movementSpeed; ((GrabbableObject)this).playerHeldBy.takingFallDamage = false; ((GrabbableObject)this).playerHeldBy.jumpForce = 30f; SyncSoundsClientRpc(0); } else { ((GrabbableObject)this).playerHeldBy.takingFallDamage = true; ((GrabbableObject)this).playerHeldBy.jumpForce = 5f; ((GrabbableObject)this).playerHeldBy.movementSpeed = movementSpeedBase; SyncSoundsClientRpc(1); } } [ClientRpc] public void SyncSoundsClientRpc(int idSound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3690841788u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, idSound); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3690841788u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; switch (idSound) { case 0: { AudioSource? obj2 = audio; if (obj2 != null) { obj2.PlayOneShot(Plugin.Instance.SoundOpenCardboardBox); } break; } case 1: { AudioSource? obj = audio; if (obj != null) { obj.PlayOneShot(Plugin.Instance.SoundCloseCardboardBox); } break; } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3690841788u, new RpcReceiveHandler(__rpc_handler_3690841788), "SyncSoundsClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_3690841788(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int idSound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref idSound); target.__rpc_exec_stage = (__RpcExecStage)1; ((SailorMoonStick)(object)target).SyncSoundsClientRpc(idSound); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string? __getTypeName() { return "SailorMoonStick"; } } } namespace Silly_Things.Codes.PortalGun { public class Portal : NetworkBehaviour { private ulong linkedPortalId; private HashSet<PlayerControllerB> teleportingPlayers = new HashSet<PlayerControllerB>(); private bool isPortalA; public Dictionary<PlayerControllerB, float> teleportTimers = new Dictionary<PlayerControllerB, float>(); public void Setup(bool portalType) { isPortalA = portalType; } public void SetLinkedPortal(ulong id) { linkedPortalId = id; } public void OnTriggerEnter(Collider other) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null || teleportingPlayers.Contains(component) || (teleportTimers.TryGetValue(component, out var value) && Time.time < value)) { return; } Vector3 val = ((Component)component).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (!(Vector3.Dot(((Component)this).transform.forward, normalized) > 0f) && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(linkedPortalId, out var value2)) { Portal component2 = ((Component)value2).GetComponent<Portal>(); if (!((Object)(object)component2 == (Object)null)) { Vector3 val2 = ((Component)this).transform.InverseTransformPoint(((Component)component).transform.position); Vector3 val3 = ((Component)component2).transform.TransformPoint(val2); val3 += ((Component)component2).transform.forward * 1f; val3 -= new Vector3(-1f, -1f, 0f); Vector3 val4 = ((Component)this).transform.InverseTransformDirection(component.thisController.velocity); Vector3 externalForces = ((Component)component2).transform.TransformDirection(val4); Quaternion val5 = Quaternion.Inverse(((Component)this).transform.rotation) * ((Component)component).transform.rotation; Quaternion rotation = ((Component)component2).transform.rotation * val5; component.TeleportPlayer(val3, false, 0f, false, true); ((Component)component).transform.rotation = rotation; component.externalForces = externalForces; component2.AddTeleportingPlayer(component); AddTeleportingPlayer(component); } } } public void AddTeleportingPlayer(PlayerControllerB player) { teleportingPlayers.Add(player); teleportTimers[player] = Time.time + 0.5f; } public void Update() { List<PlayerControllerB> list = new List<PlayerControllerB>(); foreach (KeyValuePair<PlayerControllerB, float> teleportTimer in teleportTimers) { if (Time.time >= teleportTimer.Value) { list.Add(teleportTimer.Key); } } foreach (PlayerControllerB item in list) { teleportTimers.Remove(item); teleportingPlayers.Remove(item); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "Portal"; } } public class PortalGun : PhysicsProp { private AudioSource? audio; private static NetworkObject? portalA; private static NetworkObject? portalB; private bool shootPortalA = true; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); audio = ((Component)((Component)this).transform.Find("Audio")).GetComponent<AudioSource>(); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (right && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && ((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { shootPortalA = !shootPortalA; SyncSoundsClientRpc(1); } } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); SetControlTips(); ((GrabbableObject)this).EnableItemMeshes(true); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; ((GrabbableObject)this).isPocketed = false; if (!((GrabbableObject)this).hasBeenHeld) { ((GrabbableObject)this).hasBeenHeld = true; if (!((GrabbableObject)this).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { RoundManager instance = RoundManager.Instance; instance.valueOfFoundScrapItems += ((GrabbableObject)this).scrapValue; } } } public override void SetControlTipsForItem() { SetControlTips(); } private void SetControlTips() { string[] array = new string[2] { "Place Portal : [LMB]", "Switch Portal (A/B) : [E]" }; if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0031: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner && buttonDown) { ShootPortalServerRpc(shootPortalA); } } [ServerRpc] private void ShootPortalServerRpc(bool isPortalA, ServerRpcParams rpcParams = default(ServerRpcParams)) { //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_0122: 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_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 //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) 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; } FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4200387258u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isPortalA, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4200387258u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { return; } PlayerControllerB playerFromClient = GetPlayerFromClient(rpcParams.Receive.SenderClientId); if (!((Object)(object)playerFromClient == (Object)null) && TryGetHitPoint(playerFromClient, out var _)) { NetworkObject val2 = SpawnPortal(isPortalA); if (!((Object)(object)val2 == (Object)null)) { RegisterPortal(val2, isPortalA); LinkPortalsIfReady(); SyncSoundsClientRpc(0); } } } private PlayerControllerB? GetPlayerFromClient(ulong clientId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).OwnerClientId == clientId) { return val; } } Plugin.Logger.LogError((object)("Player not found for clientId: " + clientId)); return null; } private bool TryGetHitPoint(PlayerControllerB player, out RaycastHit hit) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); if ((Object)(object)player.gameplayCamera == (Object)null) { Plugin.Logger.LogError((object)"Player camera is null"); return false; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward); return Physics.Raycast(val, ref hit, 50f); } private NetworkObject? SpawnPortal(bool isPortalA) { //IL_0042: 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_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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0077: 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_0081: 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_0085: Unknown result type (might be due to invalid IL or missing references) GameObject val = (isPortalA ? Plugin.Instance.PortalPrefabA : Plugin.Instance.PortalPrefabB); if ((Object)(object)val == (Object)null) { return null; } Transform transform = ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform; Vector3 position = transform.position + transform.forward * 2f - Vector3.up * 0.3f; Quaternion rotation = Quaternion.LookRotation(transform.forward, Vector3.up); GameObject val2 = CreatePortalObject(val, position, rotation); if ((Object)(object)val2 == (Object)null) { return null; } Portal portal = SetupPortalComponent(val2, isPortalA); PortalView portalView = SetupPortalView(val2, portal, isPortalA); portalView.playerCameraTransform = transform; portalView.portalScreenRenderer = val2.GetComponentInChildren<Renderer>(); portalView.playerCamMask = ((GrabbableObject)this).playerHeldBy.gameplayCamera.cullingMask; portalView.SetupPortalCamera(); return val2.GetComponent<NetworkObject>(); } private Quaternion CalculatePortalRotation(Vector3 normal) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) //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_0014: Unknown result type (might be due to invalid IL or missing references) return Quaternion.LookRotation(-normal, Vector3.up); } private GameObject CreatePortalObject(GameObject prefab, Vector3 position, Quaternion rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation); NetworkObject val2 = val.GetComponent<NetworkObject>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<NetworkObject>(); } val2.Spawn(false); return val; } private Portal SetupPortalComponent(GameObject obj, bool isPortalA) { Portal portal = obj.GetComponent<Portal>(); if ((Object)(object)portal == (Object)null) { portal = obj.AddComponent<Portal>(); } portal.Setup(isPortalA); return portal; } private PortalView SetupPortalView(GameObject obj, Portal portal, bool isPortalA) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown PortalView portalView = obj.GetComponent<PortalView>(); if ((Object)(object)portalView == (Object)null) { portalView = obj.AddComponent<PortalView>(); } portalView.linkedPortal = ((isPortalA && (Object)(object)portalB != (Object)null) ? ((Component)portalB).GetComponent<Portal>() : ((!isPortalA && (Object)(object)portalA != (Object)null) ? ((Component)portalA).GetComponent<Portal>() : null)); GameObject val = new GameObject("PortalCamera"); val.transform.SetParent(obj.transform); Camera val2 = val.AddComponent<Camera>(); val2.clearFlags = (CameraClearFlags)1; val2.fieldOfView = 60f; val2.targetTexture = new RenderTexture(512, 512, 16); portalView.portalCamera = val2; Renderer componentInChildren = obj.GetComponentInChildren<Renderer>(); portalView.portalScreenRenderer = componentInChildren; return portalView; } private void RegisterPortal(NetworkObject netObj, bool isPortalA) { if (isPortalA) { if ((Object)(object)portalA != (Object)null && portalA.IsSpawned) { portalA.Despawn(true); } portalA = netObj; } else { if ((Object)(object)portalB != (Object)null && portalB.IsSpawned) { portalB.Despawn(true); } portalB = netObj; } } private void LinkPortalsIfReady() { if (!((Object)(object)portalA == (Object)null) && !((Object)(object)portalB == (Object)null) && portalA.IsSpawned && portalB.IsSpawned) { Portal component = ((Component)portalA).GetComponent<Portal>(); Portal component2 = ((Component)portalB).GetComponent<Portal>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Plugin.Logger.LogError((object)"Portal component missing when linking"); return; } component.SetLinkedPortal(portalB.NetworkObjectId); component2.SetLinkedPortal(portalA.NetworkObjectId); } } [ClientRpc] private void SyncSoundsClientRpc(int idSound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1908711745u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, idSound); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1908711745u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; switch (idSound) { case 0: { AudioSource? obj2 = audio; if (obj2 != null) { obj2.PlayOneShot(Plugin.Instance.SoundOpenCardboardBox); } break; } case 1: { AudioSource? obj = audio; if (obj != null) { obj.PlayOneShot(Plugin.Instance.SoundCloseCardboardBox); } break; } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4200387258u, new RpcReceiveHandler(__rpc_handler_4200387258), "ShootPortalServerRpc"); ((NetworkBehaviour)this).__registerRpc(1908711745u, new RpcReceiveHandler(__rpc_handler_1908711745), "SyncSoundsClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_4200387258(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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 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!"); } } else { bool isPortalA = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isPortalA, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((PortalGun)(object)target).ShootPortalServerRpc(isPortalA, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1908711745(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int idSound = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref idSound); target.__rpc_exec_stage = (__RpcExecStage)1; ((PortalGun)(object)target).SyncSoundsClientRpc(idSound); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PortalGun"; } } public class PortalView : NetworkBehaviour { public Camera? portalCamera; public Renderer? portalScreenRenderer; public Portal? linkedPortal; public Transform? playerCameraTransform; public int playerCamMask; public void LateUpdate() { //IL_0104: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0155: 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) if ((Object)(object)linkedPortal == (Object)null || (Object)(object)portalCamera == (Object)null || (Object)(object)portalScreenRenderer == (Object)null) { return; } if ((Object)(object)playerCameraTransform == (Object)null) { Plugin.Logger.LogError((object)"PortalView: playerCameraTransform is null"); return; } PortalView component = ((Component)linkedPortal).GetComponent<PortalView>(); if ((Object)(object)component == (Object)null || (Object)(object)component.portalCamera == (Object)null) { Plugin.Logger.LogError((object)"PortalView: targetView or targetView.portalCamera is null"); return; } if ((Object)(object)portalCamera.targetTexture != (Object)null && (Object)(object)portalScreenRenderer.material != (Object)null) { portalScreenRenderer.material.mainTexture = (Texture)(object)portalCamera.targetTexture; } Transform transform = ((Component)this).transform; Transform transform2 = ((Component)linkedPortal).transform; Vector3 val = transform.InverseTransformPoint(playerCameraTransform.position); ((Component)portalCamera).transform.position = transform2.TransformPoint(val); Quaternion val2 = Quaternion.Inverse(transform.rotation) * playerCameraTransform.rotation; ((Component)portalCamera).transform.rotation = transform2.rotation * val2; if ((Object)(object)portalCamera.targetTexture != (Object)null && (Object)(object)portalScreenRenderer.material != (Object)null) { portalScreenRenderer.material.mainTexture = (Texture)(object)portalCamera.targetTexture; } portalCamera.cullingMask = 591075327; } public void SetupPortalCamera() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playerCameraTransform == (Object)null) && !((Object)(object)portalCamera == (Object)null)) { int num = LayerMask.NameToLayer("Portal"); portalCamera.nearClipPlane = 0.01f; portalCamera.cullingMask = 591075327; portalCamera.farClipPlane = 100f; portalCamera.clearFlags = (CameraClearFlags)2; portalCamera.backgroundColor = Color.black; } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string? __getTypeName() { return "PortalView"; } } } namespace Silly_Things.Codes.CameraItem { public class CameraItem : PhysicsProp { [CompilerGenerated] private sealed class <BigFlashRoutine>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CameraItem <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BigFlashRoutine>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: { <>1__state = -1; ParticleSystem? clickParticles = <>4__this.clickParticles; if (clickParticles != null) { clickParticles.Play(); } if ((Object)(object)<>4__this.flashLight == (Object)null) { return false; } <>4__this.flashLight.intensity = Plugin.SillyThingsConfig.flashIntensity.Value; <>4__this.flashLight.range = Plugin.SillyThingsConfig.flashRange.Value; <>4__this.flashLight.spotAngle = Plugin.SillyThingsConfig.flashAngle.Value; <>4__this.flashLight.color = Color.yellow; ((Behaviour)<>4__this.flashLight).enabled = true; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; } case 2: <>1__state = -1; ((Behaviour)<>4__this.flashLight).enabled = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ResetGearSoundFlag>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public CameraItem <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetGearSoundFlag>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Helper.LogDebugMod("ResetGearSoundFlag", duration.ToString()); <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.isGearSoundPlaying = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <Success>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public int valueToAdd; public CameraItem <>4__this; private Color <original>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Success>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) //IL_009d: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; Helper.LogDebugMod("Success", ""); if ((Object)(object)<>4__this.cubeSuccessRenderer == (Object)null) { return false; } <original>5__1 = <>4__this.cubeSuccessRenderer.material.color; <>4__this.cubeSuccessRenderer.material.color = Color.green; <>4__this.UpdateUI(); <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.cubeSuccessRenderer.material.color = <original>5__1; <>4__this.UpdateUI(); <>4__this.SyncScrapValueServerRpc(valueToAdd); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TakePhotoWithFlash>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CameraItem <>4__this; private List<PlayerControllerB> <players>5__1; private List<EnemyAI> <monsters>5__2; private (List<EnemyAI>, List<PlayerControllerB>) <result>5__3; private string <entitiesStr>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TakePhotoWithFlash>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <players>5__1 = null; <monsters>5__2 = null; <result>5__3 = default((List<EnemyAI>, List<PlayerControllerB>)); <entitiesStr>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_008f: 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_00fe: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.itemCamera == (Object)null || (Object)(object)<>4__this.flashLight == (Object)null) { return false; } <>4__this.itemCamera.cullingMask = ((GrabbableObject)<>4__this).playerHeldBy.gameplayCamera.cullingMask; <>4__this.flashLight.color = Color.white; <>4__this.flashLight.intensity = 65f; <>4__this.flashLight.range = 65f; <>4__this.flashLight.spotAngle = 125f; ((Behaviour)<>4__this.flashLight).enabled = true; <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 1; return true; case 1: <>1__state = -1; <players>5__1 = new List<PlayerControllerB>(); <monsters>5__2 = new List<EnemyAI>(); <result>5__3 = HelperCamera.GetVisibleEntities(((GrabbableObject)<>4__this).playerHeldBy, <monsters>5__2, <players>5__1, <>4__this.itemCamera); <entitiesStr>5__4 = HelperCamera.GetEntitiesNames(<result>5__3.Item1, <result>5__3.Item2); <>4__this.SpawnPhotoServerRpc(<entitiesStr>5__4, ((Component)<>4__this.itemCamera).transform.position, ((Component)<>4__this.itemCamera).transform.rotation, <>4__this.currentFov); <>4__this.PlayFxServerRpc(3); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.BigFlashRoutine()); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.flashLight.intensity = 0f; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private AudioSource? audio; private Camera? itemCamera; private ParticleSystem? clickParticles; private List<EnemyAI> photographedEnemies = new List<EnemyAI>(); private float lastPhotoTime = -999f; private Light? flashLight; private Material? photoMat; private static Camera photoCamera; private static RenderTexture photoRenderTexture; private float batteryUsagePerShot; private Renderer? screenRenderer; private Renderer? cubeSuccessRenderer; public TextMeshPro? valueText; private RenderTexture? screenTexture; private float lastScreenUpdate; private float zoomFov = 20f; private float zoomStep = 5f; private bool isGearSoundPlaying = false; private float currentFov; public bool HasBattery => !((GrabbableObject)this).itemProperties.requiresBattery || (((GrabbableObject)this).insertedBattery != null && ((GrabbableObject)this).insertedBattery.charge > 0.01f); public override void OnNetworkSpawn() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown ((NetworkBehaviour)this).OnNetworkSpawn(); photographedEnemies.Clear(); SyncScrapValueServerRpc(((GrabbableObject)this).scrapValue); flashLight = ((Component)this).GetComponentInChildren<Light>(true); itemCamera = ((Component)this).GetComponentInChildren<Camera>(true); clickParticles = ((Component)this).GetComponentInChildren<ParticleSystem>(true); Transform obj = ((Component)this).transform.Find("Audio"); audio = ((obj != null) ? ((Component)obj).GetComponent<AudioSource>() : null); Transform obj2 = ((Component)this).transform.Find("Price"); valueText = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshPro>() : null); Transform obj3 = ((Component)this).transform.Find("Quad"); screenRenderer = ((obj3 != null) ? ((Component)obj3).GetComponent<Renderer>() : null); Transform obj4 = ((Component)this).transform.Find("CubeSucess"); cubeSuccessRenderer = ((obj4 != null) ? ((Component)obj4).GetComponent<Renderer>() : null); if (((NetworkBehaviour)this).IsServer) { int variantIndex = Random.Range(0, 4); SyncVariantClientRpc(variantIndex); } if (Plugin.SillyThingsConfig.cameraCanUpdateScreen.Value && (Object)(object)itemCamera != (Object)null && (Object)(object)screenRenderer != (Object)null) { screenTexture = new RenderTexture(Plugin.SillyThingsConfig.screenResolutionWidth.Value, Plugin.SillyThingsConfig.screenResolutionHeight.Value, Plugin.SillyThingsConfig.screenResolutionDepth.Value); itemCamera.targetTexture = screenTexture; if ((Object)(object)photoMat != (Object)null) { screenRenderer.material = new Material(photoMat); screenRenderer.material.mainTexture = (Texture)(object)screenTexture; } else { screenRenderer.material = new Material(screenRenderer.material); screenRenderer.material.mainTexture = (Texture)(object)screenTexture; } } if ((Object)(object)itemCamera != (Object)null) { ((Behaviour)itemCamera).enabled = false; } if (Plugin.SillyThingsConfig.cameraHasBattery.Value) { ((GrabbableObject)this).itemProperties.requiresBattery = true; if (((GrabbableObject)this).insertedBattery == null) { ((GrabbableObject)this).insertedBattery = new Battery(false, 1f); } ((GrabbableObject)this).insertedBattery.charge = 1f; int num = Mathf.Max(1, Plugin.SillyThingsConfig.cameraBatteryNumberOfPickBeforeZero.Value); batteryUsagePerShot = 1f / (float)num; } else { ((GrabbableObject)this).itemProperties.requiresBattery = false; } UpdateUI(); } public override void LateUpdate() { ((GrabbableObject)this).LateUpdate(); if (Plugin.SillyThingsConfig.cameraCanUpdateScreen.Value && ((GrabbableObject)this).isHeld && !((Object)(object)itemCamera == (Object)null) && !(Time.time - lastScreenUpdate < Plugin.SillyThingsConfig.cameraScreenUpdateRate.Value)) { lastScreenUpdate = Time.time; itemCamera.Render(); } } public bool UseBatteryAndHasBattery() { if (Plugin.SillyThingsConfig.cameraHasBattery.Value) { if (HasBattery) { return true; } return false; } return true; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || (Object)(object)itemCamera == (Object)null || !UseBatteryAndHasBattery()) { return; } float num = currentFov; currentFov += (right ? (0f - zoomStep) : zoomStep); currentFov = Mathf.Clamp(currentFov, zoomFov, Plugin.SillyThingsConfig.cameraFov.Value); if (!Mathf.Approximately(num, currentFov)) { itemCamera.fieldOfView = currentFov; if (!isGearSoundPlaying) { isGearSoundPlaying = true; PlayFxServerRpc(1); ((MonoBehaviour)this).StartCoroutine(ResetGearSoundFlag(Plugin.Instance.SoundGear.length)); } } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((NetworkBehaviour)this).IsOwner || !UseBatteryAndHasBattery() || Time.time - lastPhotoTime < Plugin.SillyThingsConfig.cameraUseCooldown.Value) { return; } lastPhotoTime = Time.time; if (!buttonDown || (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || (Object)(object)itemCamera == (Object)null) { return; } PlayFxServerRpc(0); List<PlayerControllerB> playerIntoPicture = new List<PlayerControllerB>(); List<EnemyAI> monsterIntoPicture = new List<EnemyAI>(); monsterIntoPicture = HelperCamera.GetVisibleEntities(((GrabbableObject)this).playerHeldBy, monsterIntoPicture, playerIntoPicture, itemCamera).Item1; int num = (int)HelperCamera.GetMonstersScore(monsterIntoPicture, photographedEnemies); if (num > 0) { foreach (EnemyAI item in monsterIntoPicture) { if (!photographedEnemies.Contains(item)) { photographedEnemies.Add(item); } } PlayFxServerRpc(2); ((MonoBehaviour)this).StartCoroutine(Success(1f, num)); } ((MonoBehaviour)this).StartCoroutine(TakePhotoWithFlash()); if (((GrabbableObject)this).insertedBattery != null) { ((GrabbableObject)this).insertedBattery.charge = Mathf.Clamp01(((GrabbableObject)this).insertedBattery.charge - batteryUsagePerShot); } UpdateUI(); } public void UpdateUI() { if (Plugin.SillyThingsConfig.cameraHasBattery.Value) { if ((Object)(object)screenRenderer != (Object)null && (Object)(object)valueText != (Object)null) { if (!HasBattery && Plugin.SillyThingsConfig.cameraCanUpdateScreen.Value) { screenRenderer.enabled = false; } else if (HasBattery && Plugin.SillyThingsConfig.cameraCanUpdateScreen.Value) { screenRenderer.enabled = true; } int num = Mathf.CeilToInt(((GrabbableObject)this).insertedBattery.charge / batteryUsagePerShot); ((TMP_Text)valueText).text = ((GrabbableObject)this).scrapValue + "$ (" + num + ")"; } } else if ((Object)(object)valueText != (Object)null) { ((TMP_Text)valueText).text = ((GrabbableObject)this).scrapValue + "$"; } if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null && (Object)(object)screenRenderer != (Object)null && (Object)(object)itemCamera != (Object)null) { screenRenderer.enabled = false; ((Behaviour)itemCamera).enabled = false; } } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; ((GrabbableObject)this).isPocketed = false; currentFov = Plugin.SillyThingsConfig.cameraFov.Value; UpdateUI(); if ((Object)(object)itemCamera != (Object)null) { ((Behaviour)itemCamera).enabled = true; itemCamera.fieldOfView = currentFov; itemCamera.farClipPlane = Plugin.SillyThingsConfig.cameraCameraFarClipping.Value; itemCamera.cullingMask = ((GrabbableObject)this).playerHeldBy.gameplayCamera.cullingMask; } } public override void ChargeBatteries() { UpdateUI(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); UpdateUI(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)itemCamera != (Object)null) { ((Behaviour)itemCamera).enabled = false; } } public override void SetControlTipsForItem() { if (((NetworkBehaviour)this).IsOwner) { string[] array = new string[3] { "Pic of Mob = $$ : [LMB]", "Zoom : [A]", "Unzoom : [E]" }; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties); } } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); RenderTexture? obj = screenTexture; if (obj != null) { obj.Release(); } } [IteratorStateMachine(typeof(<BigFlashRoutine>d__33))] private IEnumerator BigFlashRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BigFlashRoutine>d__33(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<TakePhotoWithFlash>d__34))] private IEnumerator TakePhotoWithFlash() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TakePhotoWithFlash>d__34(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<ResetGearSoundFlag>d__35))] private IEnumerator ResetGearSoundFlag(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetGearSoundFlag>d__35(0) { <>4__this = this, duration = duration }; } [IteratorStateMachine(typeof(<Success>d__36))] private IEnumerator Success(float duration, int valueToAdd) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Success>d__36(0) { <>4__this = this, duration = duration, valueToAdd = valueToAdd }; } [ServerRpc] private void PlayFxServerRpc(int fxId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0114: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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(1420266272u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, fxId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1420266272u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayFxClientRpc(fxId); } } [ClientRpc] private void PlayFxClientRpc(int fxId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1269461923u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, fxId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1269461923u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; switch (fxId) { case 0: { AudioSource? obj3 = audio; if (obj3 != null) { obj3.PlayOneShot(Plugin.Instance.SoundShutter); } break; } case 1: { AudioSource? obj = audio; if (obj != null) { obj.PlayOneShot(Plugin.Instance.SoundGear, 0.4f); } break; } case 2: { AudioSource? obj2 = audio; if (obj2 != null) { obj2.PlayOneShot(Plugin.Instance.SoundSucess); } break; } case 3: if (!((NetworkBehaviour)this).IsOwner) { ((MonoBehaviour)this).StartCoroutine(BigFlashRoutine()); } break; } } [ClientRpc] private void SyncVariantClientRpc(int variantIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(10789800u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, variantIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 10789800u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ApplyVariant(variantIndex); } } } [ServerRpc] private void SyncScrapValueServerRpc(int valueToAdd) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0114: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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(1844946515u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, valueToAdd); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1844946515u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((GrabbableObject)this).scrapValue = ((GrabbableObject)this).scrapValue + valueToAdd; SyncScrapValueClientRpc(((GrabbableObject)this).scrapValue); } } [ClientRpc] private void SyncScrapValueClientRpc(int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(547225717u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 547225717u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((GrabbableObject)this).SetScrapValue(value); UpdateUI(); } } } private void ApplyVariant(int index) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown Transform val = ((Component)this).transform.Find("CameraGOLD"); Transform val2 = ((Component)this).transform.Find("CameraBlue"); Transform val3 = ((Component)this).transform.Find("CameraBlack"); Transform val4 = ((Component)this).transform.Find("CameraPink"); List<Transform> list = new List<Transform>(); if ((Object)(object)val != (Object)null) { list.Add(val); } if ((Object)(object)val2 != (Object)null) { list.Add(val2); } if ((Object)(object)val3 != (Object)null) { list.Add(val3); } if ((Object)(object)val4 != (Object)null) { list.Add(val4); } if (list.Count == 0) { return; } index = Mathf.Clamp(index, 0, list.Count - 1); for (int i = 0; i < list.Count; i++) { ((Component)list[i]).gameObject.SetActive(i == index); } if ((Object)(object)Plugin.Instance.photoShaderBlack != (Object)null && (Object)(object)Plugin.Instance.photoShaderBlue != (Object)null && (Object)(object)Plugin.Instance.photoShaderGold != (Object)null && (Object)(object)Plugin.Instance.photoShader != (Object)null) { Shader[] array = (Shader[])(object)new Shader[4] { Plugin.Instance.photoShaderGold, Plugin.Instance.photoShaderBlue, Plugin.Instance.photoShaderBlack, Plugin.Instance.photoShader }; if ((Object)(object)photoMat != (Object)null) { Object.Destroy((Object)(object)photoMat); } photoMat = new Material(array[index]); } Plugin.Logger.LogInfo((object)("Camera variant synced: " + ((Object)list[index]).name)); } private static void InitializePhotoCamera(int width, int height, int depth) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if (!((Object)(object)photoCamera != (Object)null)) { GameObject val = new GameObject("SillyThingsPhotoCamera"); Object.DontDestroyOnLoad((Object)(object)val); photoCamera = val.AddComponent<Camera>(); ((Behaviour)photoCamera).enabled = false; photoRenderTexture = new RenderTexture(width, height, depth); } } [ServerRpc(RequireOwnership = false)] private void SpawnPhotoServerRpc(string entitiesStr, Vector3 camPos, Quaternion camRot, float fov, ServerRpcParams rpc = default(ServerRpcParams)) { //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_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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1791950454u, rpc, (RpcDelivery)0); bool flag = entitiesStr != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(entitiesStr, false); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref camPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref camRot); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref fov, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1791950454u, rpc, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ServerRpcParams rpc2 = rpc; PlayerControllerB val2 = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => ((NetworkBehaviour)p).OwnerClientId == rpc2.Receive.SenderClientId)); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)Plugin.Instance.PhotoItemPrefab == (Object)null)) { Item itemProperties = Plugin.Instance.PhotoItemPrefab.GetComponent<GrabbableObject>().itemProperties; NetworkReference networkReference = Helper.SpawnScrap(itemProperties, ((Component)val2).transform.position + ((Component)val2).transform.forward * 0.5f, 0); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref networkReference.netObjectRef)).TryGet(ref val3, (NetworkManager)null)) { RequestPhotoClientRpc(val3.NetworkObjectId, camPos, camRot, fov, rpc2.Receive.SenderClientId, entitiesStr); } } } [ClientRpc] private void RequestPhotoClientRpc(ulong photoNetId, Vector3 camPos, Quaternion camRot, float fov, ulong photographerId, string entitiesStr) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(264176057u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, photoNetId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref camPos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref camRot); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref fov, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, photographerId); bool flag = entitiesStr != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(entitiesStr, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 264176057u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (NetworkManager.Singleton.LocalClientId == photographerId) { int value = Plugin.SillyThingsConfig.pictureResolutionWidth.Value; int value2 = Plugin.SillyThingsConfig.pictureResolutionHeight.Value; Texture2D val3 = CapturePhotoFromView(camPos, camRot, fov, value, value2); SavePhotoToDisk(val3); Texture2D val4 = DownscaleTexture(val3, 640, 360); byte[] array = ImageConversion.EncodeToJPG(val4, 50); if (array != null) { SendPhotoToServerServerRpc(photoNetId, array, entitiesStr); } Object.Destroy((Object)(object)val3); Object.Destroy((Object)(object)val4); } } [ServerRpc(RequireOwnership = false)] private void SendPhotoToServerServerRpc(ulong photoNetId, byte[] jpg, string entitiesStr) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0095: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1361503398u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, photoNetId); bool flag = jpg != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(jpg, default(ForPrimitives)); } bool flag2 = entitiesStr != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(entitiesStr, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1361503398u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SendPhotoToClientsClientRpc(photoNetId, jpg, entitiesStr); } } [ClientRpc] private void SendPhotoToClientsClientRpc(ulong photoNetId, byte[] jpg, string entitiesStr) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0095: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2717599787u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, photoNetId); bool flag = jpg != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(jpg, default(ForPrimitives)); } bool flag2 = entitiesStr != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(entitiesStr, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2717599787u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.ContainsKey(photoNetId)) { NetworkObject val3 = NetworkManager.Singleton.SpawnManager.SpawnedObjects[photoNetId]; PhotoItem component = ((Component)val3).GetComponent<PhotoItem>(); if (!((Object)(object)component == (Object)null)) { Texture2D val4 = new Texture2D(2, 2);