Decompiled source of ScarletDevilMansion v2.0.0
ScarletMansion.dll
Decompiled 2 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.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using DunGenPlus; using DunGenPlus.Collections; using DunGenPlus.Managers; using DunGenPlus.Patches; using FacilityMeltdown.API; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalConfig.Mods; using LethalConfig.MonoBehaviours; using LethalConfig.MonoBehaviours.Components; using LethalLevelLoader; using LethalLib.Modules; using OdinSerializer; using ReservedItemSlotCore.Data; using ScarletMansion.DunGenPatch; using ScarletMansion.GamePatch; using ScarletMansion.GamePatch.Components; using ScarletMansion.GamePatch.Components.TreasureRoom; using ScarletMansion.GamePatch.Enemies; using ScarletMansion.GamePatch.FixValues; using ScarletMansion.GamePatch.Items; using ScarletMansion.GamePatch.Managers; using ScarletMansion.GamePatch.Props; using ScarletMansion.Lights; using ScarletMansion.ModPatch; using ScarletMansion.NetcodePatcher; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; 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: AssemblyTitle("ScarletMansion")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScarletMansion")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d7e169df-3f43-44b0-a300-c23b9aa44d48")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace ScarletMansion { public static class Assets { public class Enemy { public GameObject enemy; public EnemyType enemyType; public Func<int> rarityFunc; public TerminalNode terminalNode; public TerminalKeyword terminalKeyword; public Enemy(GameObject enemy, TerminalNode node, TerminalKeyword keyword) { this.enemy = enemy; terminalNode = node; terminalKeyword = keyword; } public SpawnableEnemyWithRarity GetItemEntry(int rarity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown SpawnableEnemyWithRarity val = new SpawnableEnemyWithRarity(); val.enemyType = enemyType; val.rarity = rarity; return val; } } public class GlobalItem { public Item item; private int _itemId; public int itemId { get { if (_itemId == -1 && Object.op_Implicit((Object)(object)StartOfRound.Instance)) { string text = (Object.op_Implicit((Object)(object)item) ? item.itemName : "NULL"); _itemId = Utility.GetGlobalItemId(item); if (_itemId != -1) { Plugin.logger.LogWarning((object)$"Cached {_itemId} itemId for item {text}"); return _itemId; } Plugin.logger.LogWarning((object)("Tried to get itemId for item " + text + " but failed")); } return _itemId; } set { _itemId = value; } } public GlobalItem(Item item) { this.item = item; _itemId = -1; } } public class ScrapItem : GlobalItem { public Func<int> rarityFunc; public ScrapItem(Item item, Func<int> func) : base(item) { rarityFunc = func; } public SpawnableItemWithRarity GetItemRarity() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown SpawnableItemWithRarity val = new SpawnableItemWithRarity(); val.spawnableItem = item; val.rarity = rarityFunc(); return val; } } public class Flashlight : GlobalItem { public string assetName; public string displayName; public Item lethalVanillaItem; public int lethalHelmetIndex = -1; public int scarletHelmetIndex = -1; public Flashlight(string baseName, int lethalHelmetIndex) : base(null) { assetName = "Scarlet" + baseName; displayName = "D. " + baseName; this.lethalHelmetIndex = lethalHelmetIndex; } public bool ContainsItem(Item compareItem) { return (Object)(object)compareItem == (Object)(object)item || (Object)(object)compareItem == (Object)(object)lethalVanillaItem; } } public static ActionList onAssetsLoadEvent = new ActionList("onAssetsLoad"); public static ActionList<CoronerParameters> onPlayerDeath = new ActionList<CoronerParameters>("onPlayerDeath"); private const string mainAssetBundleName = "scarletmansion"; public static AssetBundle MainAssetBundle = null; public static DungeonFlow dungeon; public static DunGenExtender dunGenExtender; public static NetworkObjectListScriptableObject networkObjectList; public static AudioClip entranceAudioClip; public static ExtendedMod extendedMod; public static ExtendedDungeonFlow dungeonExtended; public static Enemy knight; public static Enemy maid; public static List<GlobalItem> globalItems; public static List<ScrapItem> scrapItems; public static Dictionary<string, Func<int>> itemRarityTable = new Dictionary<string, Func<int>> { { "Deco. crystal", () => SyncedInstance<PluginConfig>.Instance.crystalWeightValue }, { "Shattered deco. crystal", () => SyncedInstance<PluginConfig>.Instance.crystalBrokenWeightValue }, { "Demonic painting", () => 0 }, { "Maid's knife", () => 0 }, { "Doll Snow Globe", () => SyncedInstance<PluginConfig>.Instance.snowGlobeWeightValue } }; public static Flashlight flashlight; public static Flashlight flashlightBB; public static GlobalItem key; public static ItemGroup genericItemGroup; public static ItemGroup tabletopItemGroup; public static ItemGroup smallItemGroup; public static bool dungeonMapHazardFound; public static GameObject dungeonTurretMapHazard; public static GameObject dungeonMinesMapHazard; public static GameObject dungeonSpikeTrapMapHazard; public static Sprite hoverIcon; private static ManualLogSource logger => Plugin.logger; public static GlobalItem GetGlobalItem(Item item) { return globalItems.FirstOrDefault((GlobalItem x) => (Object)(object)x.item == (Object)(object)item); } public static Flashlight GetFlashlight(Item item) { if (flashlight.ContainsItem(item)) { return flashlight; } if (flashlightBB.ContainsItem(item)) { return flashlightBB; } return null; } public static void LoadAssetBundle() { if ((Object)(object)MainAssetBundle == (Object)null) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); if (manifestResourceNames.Length >= 1) { string text = manifestResourceNames[0]; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); Plugin.logger.LogDebug((object)("Loading resource " + text)); MainAssetBundle = AssetBundle.LoadFromStream(stream); } } dungeon = Assets.Load<DungeonFlow>("SDMLevel", onlyReportErrors: true); networkObjectList = Assets.Load<NetworkObjectListScriptableObject>("SDMList", onlyReportErrors: true); dunGenExtender = Assets.Load<DunGenExtender>("DunGenExtender", onlyReportErrors: true); entranceAudioClip = Assets.Load<AudioClip>("entrance_ogg", onlyReportErrors: true); knight = new Enemy(Assets.Load<GameObject>("NET_KnightEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("KnightNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("KnightKeyword", onlyReportErrors: true)); maid = new Enemy(Assets.Load<GameObject>("NET_MaidEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("MaidNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("MaidKeyword", onlyReportErrors: true)); RegisterNetworkPrefab(networkObjectList.networkDungeon); RegisterNetworkPrefab(networkObjectList.networkDoors); RegisterNetworkPrefab(networkObjectList.networkItems); RegisterNetworkPrefab(networkObjectList.networkFrames); RegisterNetworkPrefab(networkObjectList.networkOther); globalItems = new List<GlobalItem>(); scrapItems = new List<ScrapItem>(); foreach (Item item3 in networkObjectList.items) { GlobalItem item = new GlobalItem(item3); globalItems.Add(item); Items.RegisterItem(item3); Plugin.logger.LogDebug((object)("Global Item " + item3.itemName + " registered")); } foreach (Item scrapItem in networkObjectList.scrapItems) { ScrapItem item2 = new ScrapItem(scrapItem, GetItemRarityFunction(scrapItem)); scrapItems.Add(item2); globalItems.Add(item2); Items.RegisterScrap(scrapItem, 0, (LevelTypes)1); NetworkPrefabs.RegisterNetworkPrefab(scrapItem.spawnPrefab); Plugin.logger.LogDebug((object)("Scrap Item " + scrapItem.itemName + " registered")); } flashlight = new Flashlight("Pro Flashlight", 0); flashlightBB = new Flashlight("Flashlight", 1); key = new GlobalItem(networkObjectList.items[0]); globalItems.Add(flashlight); globalItems.Add(flashlightBB); foreach (EnemyType enemy in networkObjectList.enemies) { Enemies.RegisterEnemy(enemy, 0, (LevelTypes)1, (TerminalNode)null, (TerminalKeyword)null); NetworkPrefabs.RegisterNetworkPrefab(enemy.enemyPrefab); } onAssetsLoadEvent.Call(); } public static Func<int> GetItemRarityFunction(Item item) { string itemName = item.itemName; if (itemRarityTable.ContainsKey(itemName)) { return itemRarityTable[itemName]; } Plugin.logger.LogError((object)("Could not find rarity function for " + itemName + ". Setting to default value 10")); return () => 10; } private static void RegisterNetworkPrefab(List<GameObject> list) { foreach (GameObject item in list) { NetworkPrefabs.RegisterNetworkPrefab(item); } } public static T Load<T>(string name, bool onlyReportErrors = true) where T : Object { if ((Object)(object)MainAssetBundle == (Object)null) { logger.LogError((object)"Trying to load in asset but asset bundle is missing"); return default(T); } T val = MainAssetBundle.LoadAsset<T>(name); bool flag = (Object)(object)val == (Object)null; if (flag || onlyReportErrors) { logger.LogDebug((object)("Loading asset " + name)); } if (flag) { logger.LogError((object)"...but it was not found"); } return val; } } public class FloorCleanup : MonoBehaviour { [Serializable] public class State { public int value; public Material material; public float rotation; } [Header("References")] public MeshRenderer targetRenderer; public GameObject targerGameObject; public int bitValueCheck; [Header("Logic")] public GameObject[] neighbors; public int[] stateValues; public Material[] stateMaterials; public float[] stateRotations; public State[] states; private void Reset() { targetRenderer = ((Component)this).GetComponent<MeshRenderer>(); targerGameObject = ((Component)this).gameObject; } public bool UpdateRender() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = (1 << neighbors.Length) - 1; for (int i = 0; i < neighbors.Length; i++) { GameObject val = neighbors[i]; if ((Object)(object)val != (Object)null && neighbors[i].activeSelf) { num += 1 << i; } } if (num == num2) { return false; } for (int j = 0; j < stateValues.Length; j++) { if (stateValues[j] == num) { ((Renderer)targetRenderer).material = stateMaterials[j]; ((Component)targetRenderer).transform.localEulerAngles = new Vector3(0f, stateRotations[j], 0f); return false; } } bool activeSelf = targerGameObject.activeSelf; targerGameObject.SetActive(false); return activeSelf; } private void OnDrawGizmosSelected() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.green; for (int i = 0; i < neighbors.Length; i++) { if ((bitValueCheck & (1 << i)) > 0) { Gizmos.DrawCube(neighbors[i].transform.position, Vector3.one); } } } } public class FloorCleanUpParent : MonoBehaviour, IDungeonCompleteReceiver { public FloorCleanup[] children; private void Reset() { children = ((Component)this).GetComponentsInChildren<FloorCleanup>(); } public void OnDungeonComplete(Dungeon dungeon) { bool flag = true; while (flag) { flag = false; FloorCleanup[] array = children; foreach (FloorCleanup floorCleanup in array) { bool flag2 = floorCleanup.UpdateRender(); flag = flag || flag2; } } } } public class KnightSpawnPoint : MonoBehaviour { public int index; public const float minTime = 4f; public const float maxTime = 8f; public const float minSqrDistance = 36f; public void Start() { if (GameNetworkManager.Instance.isHostingGame) { ((MonoBehaviour)this).StartCoroutine(GetNearbyPlayers()); } } public IEnumerator GetNearbyPlayers() { while (true) { float randomWait = Random.Range(4f, 8f); yield return (object)new WaitForSeconds(randomWait); StartOfRound sround = StartOfRound.Instance; PlayerControllerB[] players = sround.allPlayerScripts; int playerCount = sround.connectedPlayersAmount + 1; int i = 0; while (i < playerCount) { PlayerControllerB player = players[i]; if (player.isPlayerControlled || !player.isPlayerDead) { float dist = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)player).transform.position); if (dist <= 36f) { KnightSpawnManager.Instance.lastKnightSeenPlayer = index; Plugin.logger.LogDebug((object)$"Knight {index} has noticed player {player.playerUsername}"); } } int num = i + 1; i = num; } } } } public class ScarletVent : MonoBehaviour { public AudioSource shakeAudioSource; public AudioSource summonAudioSource; public PlayAudioAnimationEvent audioEvent; [Header("Shake")] public ParticleSystem spawningPartciles; public ParticleSystem lightingParticles; public ParticleSystem emitParticles; public float volumeToRate = 1f; public static bool prewarm; private void Start() { if (!prewarm) { OpenVentClientRpc(); prewarm = true; Plugin.logger.LogDebug((object)"Prewarming particles by forcing it emit now lmao"); } } private void PlayParticleSystem(ParticleSystem ps) { if (!ps.isPlaying) { ps.Play(); } } private void StopParticleSystem(ParticleSystem ps) { if (ps.isPlaying) { ps.Stop(); } } public void OpenVentClientRpc() { emitParticles.Play(); audioEvent.PlayAudio1Oneshot(); } private void Update() { if (shakeAudioSource.isPlaying) { PlayParticleSystem(spawningPartciles); SetEmissionRate(spawningPartciles, shakeAudioSource.volume * volumeToRate); if (shakeAudioSource.volume >= 0.8f) { PlayParticleSystem(lightingParticles); } else { StopParticleSystem(lightingParticles); } } else { StopParticleSystem(spawningPartciles); StopParticleSystem(lightingParticles); } } private void SetEmissionRate(ParticleSystem ps, float mult) { //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) EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = mult; } } public class KnightGhostVariant : EnemyAI { public float maxChaseSpeed = 14.5f; public float slowChaseSpeed = 6f; private float currentAnimSpeed = 1f; public Collider mainCollider; public MeshRenderer[] knightMeshRenderers; public AudioClip[] ramAudioClips; private bool calledDisappear = false; public override void Start() { ((EnemyAI)this).Start(); if (((NetworkBehaviour)this).IsOwner && Object.op_Implicit((Object)(object)KnightSpawnManager.Instance)) { int spawnPointIndex = KnightSpawnManager.Instance.GetSpawnPointIndex(); if (spawnPointIndex != -1) { SyncKnightReplacementClientRpc(spawnPointIndex); } } } public override void DoAIInterval() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); base.movingTowardsTargetPlayer = true; if ((Object)(object)base.targetPlayer == (Object)null || !((NetworkBehaviour)base.targetPlayer).IsOwner || base.isEnemyDead) { return; } if (!((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) { CallDisappear(); return; } bool flag = !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)base.targetPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 30f; int num = (flag ? 1 : 0); if (flag) { base.targetPlayer.JumpToFearLevel(0.75f, true); } if (num != base.currentBehaviourStateIndex) { ((EnemyAI)this).SwitchToBehaviourState(num); } } public override void Update() { ((EnemyAI)this).Update(); if (!base.isEnemyDead) { float num = ((base.currentBehaviourStateIndex == 0) ? maxChaseSpeed : slowChaseSpeed); if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = Mathf.MoveTowards(base.agent.speed, num, 4.5f * Time.deltaTime); } currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, num * 0.4597f, 4f * Time.deltaTime); base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed); } } public override void OnCollideWithPlayer(Collider other) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner && (Object)(object)val == (Object)(object)base.targetPlayer) { int criticalDamageToPlayer = ScarletNetworkManagerUtility.GetCriticalDamageToPlayer(val, forceKill: false); val.DamagePlayer(criticalDamageToPlayer, true, true, (CauseOfDeath)6, 1, false, default(Vector3)); val.JumpToFearLevel(1f, true); if (val.isPlayerDead) { Assets.onPlayerDeath.Call(new CoronerParameters(val, CoronerDeathEnum.GhostKnight)); } RoundManager.PlayRandomClip(base.creatureVoice, ramAudioClips, false, 1f, 0, 1000); CallDisappear(); } } [ClientRpc] public void SyncKnightReplacementClientRpc(int index) { //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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2391938005u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2391938005u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Plugin.logger.LogDebug((object)$"Spawning ghost knight at {index}"); try { Transform spawnPointTransform = KnightSpawnManager.Instance.GetSpawnPointTransform(index); ((Component)spawnPointTransform).gameObject.SetActive(false); ((Component)this).transform.position = spawnPointTransform.position; ((Component)this).transform.rotation = spawnPointTransform.rotation; base.serverPosition = spawnPointTransform.position; if ((Object)(object)base.agent == (Object)null) { base.agent = ((Component)this).GetComponentInChildren<NavMeshAgent>(); } base.agent.Warp(spawnPointTransform.position); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } } catch (Exception ex) { Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {index}, but completely failed"); Plugin.logger.LogError((object)ex); } } public void FindAndTunnelPlayer(Vector3 searchPosition) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) IEnumerable<PlayerControllerB> source = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && ((EnemyAI)this).PlayerIsTargetable(p, false, false)); if (source.Count() == 0) { Plugin.logger.LogWarning((object)"Could not find valid target to tunnel"); return; } PlayerControllerB val = source.OrderBy((PlayerControllerB p) => Vector3.SqrMagnitude(((Component)p).transform.position - searchPosition)).FirstOrDefault(); if ((Object)(object)val != (Object)null) { ((EnemyAI)this).ChangeOwnershipOfEnemy(val.actualClientId); TunnelPlayerClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val)); } } [ClientRpc] public void TunnelPlayerClientRpc(NetworkBehaviourReference playerRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2549444772u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2549444772u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB val3 = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null)) { base.targetPlayer = val3; Plugin.logger.LogDebug((object)("Targeting " + val3.playerUsername + " for death")); if (!((NetworkBehaviour)base.targetPlayer).IsOwner) { MeshRenderer[] array = knightMeshRenderers; foreach (MeshRenderer val4 in array) { ((Renderer)val4).enabled = false; } } } else { Plugin.logger.LogWarning((object)"Could not find target player through reference"); } } public void CallDisappear() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!calledDisappear) { Plugin.logger.LogDebug((object)"Killing ghost knight"); calledDisappear = true; mainCollider.enabled = false; ((Component)mainCollider).gameObject.SetActive(false); ScarletNetworkManager.Instance.CreateSpawnAudioPrefab(((Component)this).transform.position, base.targetPlayer.actualClientId); DisappearServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void DisappearServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(722636660u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 722636660u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((EnemyAI)this).KillEnemy(true); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_KnightGhostVariant() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2391938005u, new RpcReceiveHandler(__rpc_handler_2391938005)); NetworkManager.__rpc_func_table.Add(2549444772u, new RpcReceiveHandler(__rpc_handler_2549444772)); NetworkManager.__rpc_func_table.Add(722636660u, new RpcReceiveHandler(__rpc_handler_722636660)); } private static void __rpc_handler_2391938005(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((KnightGhostVariant)(object)target).SyncKnightReplacementClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2549444772(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((KnightGhostVariant)(object)target).TunnelPlayerClientRpc(playerRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_722636660(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightGhostVariant)(object)target).DisappearServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "KnightGhostVariant"; } } public class KnightVariant : EnemyAI { public AISearchRoutine searchForPlayers; private bool stoppingMovement; private bool hasStopped; public AnimationStopPoints animStopPoints; private float currentChaseSpeed = 10.875f; private float currentAnimSpeed = 1f; private PlayerControllerB previousTarget; private bool wasOwnerLastFrame; private float stopAndGoMinimumInterval; private float timeSinceHittingPlayer; public AudioClip[] springNoises; public Collider mainCollider; public override void Start() { ((EnemyAI)this).Start(); if (((NetworkBehaviour)this).IsOwner && Object.op_Implicit((Object)(object)KnightSpawnManager.Instance)) { int spawnPointIndex = KnightSpawnManager.Instance.GetSpawnPointIndex(); if (spawnPointIndex != -1) { SyncKnightReplacementClientRpc(spawnPointIndex); } } } public override void DoAIInterval() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); StartOfRound instance = StartOfRound.Instance; if (instance.allPlayersDead || base.isEnemyDead) { return; } switch (base.currentBehaviourStateIndex) { case 1: if (searchForPlayers.inProgress) { ((EnemyAI)this).StopSearch(searchForPlayers, true); } if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f)) { if ((Object)(object)previousTarget != (Object)(object)base.targetPlayer) { previousTarget = base.targetPlayer; ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } base.movingTowardsTargetPlayer = true; } else { ((EnemyAI)this).SwitchToBehaviourState(0); ((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId); } break; case 0: { if (!((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId); break; } for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if (((EnemyAI)this).PlayerIsTargetable(val, false, false)) { bool flag = !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)val.gameplayCamera).transform.position, instance.collidersAndRoomMaskAndDefault); bool flag2 = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)val).transform.position) < 900f; if (flag && flag2) { ((EnemyAI)this).SwitchToBehaviourState(1); return; } } } base.agent.speed = 6f; if (!searchForPlayers.inProgress) { base.movingTowardsTargetPlayer = false; ((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers); } break; } } } public override void Update() { //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_012b: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { return; } if (timeSinceHittingPlayer >= 0f) { timeSinceHittingPlayer -= Time.deltaTime; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; StartOfRound instance = StartOfRound.Instance; if (currentBehaviourStateIndex == 0 || currentBehaviourStateIndex != 1) { return; } if (((NetworkBehaviour)this).IsOwner) { if (stopAndGoMinimumInterval > 0f) { stopAndGoMinimumInterval -= Time.deltaTime; } if (!wasOwnerLastFrame) { wasOwnerLastFrame = true; if (!stoppingMovement && timeSinceHittingPlayer < 0.12f) { base.agent.speed = currentChaseSpeed; } else { base.agent.speed = 0f; } } bool flag = false; for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if (((EnemyAI)this).PlayerIsTargetable(val, false, false)) { bool flag2 = val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f); bool flag3 = Vector3.SqrMagnitude(((Component)val.gameplayCamera).transform.position - base.eye.position) > 0.09f; if (flag2 && flag3) { flag = true; } } } if (base.stunNormalizedTimer > 0f) { flag = true; } if (flag != stoppingMovement && stopAndGoMinimumInterval <= 0f) { stopAndGoMinimumInterval = 0.15f; if (flag) { SetAnimationStopServerRpc(); } else { SetAnimationGoServerRpc(); } stoppingMovement = flag; } } if (stoppingMovement) { if (!animStopPoints.canAnimationStop) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!hasStopped) { hasStopped = true; if (localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 70f, 25, -1f)) { float num = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)localPlayerController).transform.position); if (num < 16f) { localPlayerController.JumpToFearLevel(0.9f, true); } else if (num < 81f) { localPlayerController.JumpToFearLevel(0.4f, true); } } if (currentAnimSpeed > 2f) { RoundManager.PlayRandomClip(base.creatureVoice, springNoises, false, 1f, 0, 1000); if (animStopPoints.animationPosition == 1) { base.creatureAnimator.SetTrigger("springBoing"); } else { base.creatureAnimator.SetTrigger("springBoingPosition2"); } } } bool flag4 = Vector3.SqrMagnitude(((Component)localPlayerController).transform.position - ((Component)this).transform.position) > 0.0625f; if (mainCollider.isTrigger && flag4) { mainCollider.isTrigger = false; } base.creatureAnimator.SetFloat("walkSpeed", 0f); currentAnimSpeed = 0f; if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = 0f; } } else { if (hasStopped) { hasStopped = false; mainCollider.isTrigger = true; } currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, 5f, 3f * Time.deltaTime); base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed); if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = Mathf.Lerp(base.agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime); } } } [ServerRpc] public void SetAnimationStopServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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(3882357060u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3882357060u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetAnimationStopClientRpc(); } } [ClientRpc] public void SetAnimationStopClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1023489990u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1023489990u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { stoppingMovement = true; } } } [ServerRpc] public void SetAnimationGoServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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(1320084365u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1320084365u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetAnimationGoClientRpc(); } } [ClientRpc] public void SetAnimationGoClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3930434877u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3930434877u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { stoppingMovement = false; } } } public override void OnCollideWithPlayer(Collider other) { //IL_006a: 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) ((EnemyAI)this).OnCollideWithPlayer(other); if (!stoppingMovement && base.currentBehaviourStateIndex == 1 && !(timeSinceHittingPlayer >= 0f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { timeSinceHittingPlayer = 0.2f; val.DamagePlayer(90, true, true, (CauseOfDeath)6, 1, false, default(Vector3)); val.JumpToFearLevel(1f, true); } } } [ClientRpc] public void SyncKnightReplacementClientRpc(int index) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3956096293u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3956096293u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SyncKnightReplacement(index); } } } public void SyncKnightReplacement(int index) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) Plugin.logger.LogDebug((object)$"Spawning knight at {index}"); try { Transform spawnPointTransform = KnightSpawnManager.Instance.GetSpawnPointTransform(index); ((Component)spawnPointTransform).gameObject.SetActive(false); ((Component)this).transform.position = spawnPointTransform.position; ((Component)this).transform.rotation = spawnPointTransform.rotation; base.serverPosition = spawnPointTransform.position; if ((Object)(object)base.agent == (Object)null) { base.agent = ((Component)this).GetComponentInChildren<NavMeshAgent>(); } base.agent.Warp(spawnPointTransform.position); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } } catch (Exception ex) { Plugin.logger.LogError((object)$"Tried to knight spawn at {index}, but completely failed"); Plugin.logger.LogError((object)ex); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_KnightVariant() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3882357060u, new RpcReceiveHandler(__rpc_handler_3882357060)); NetworkManager.__rpc_func_table.Add(1023489990u, new RpcReceiveHandler(__rpc_handler_1023489990)); NetworkManager.__rpc_func_table.Add(1320084365u, new RpcReceiveHandler(__rpc_handler_1320084365)); NetworkManager.__rpc_func_table.Add(3930434877u, new RpcReceiveHandler(__rpc_handler_3930434877)); NetworkManager.__rpc_func_table.Add(3956096293u, new RpcReceiveHandler(__rpc_handler_3956096293)); } private static void __rpc_handler_3882357060(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_0076: 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_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 { target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightVariant)(object)target).SetAnimationStopServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1023489990(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((KnightVariant)(object)target).SetAnimationStopClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1320084365(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_0076: 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_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 { target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightVariant)(object)target).SetAnimationGoServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3930434877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((KnightVariant)(object)target).SetAnimationGoClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3956096293(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((KnightVariant)(object)target).SyncKnightReplacementClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "KnightVariant"; } } public class KnightSpawnManager : MonoBehaviour, IDungeonCompleteReceiver { public List<KnightSpawnPoint> spawnPoints; public List<KnightSpawnPoint> unusedSpawnPoints; public int lastKnightSeenPlayer = -1; public bool disableNextKnightSpecialSpawn; public static KnightSpawnManager Instance { get; private set; } private void Awake() { Instance = this; } public void OnDungeonComplete(Dungeon dungeon) { KnightSpawnPoint[] componentsInChildren = ((Component)dungeon).GetComponentsInChildren<KnightSpawnPoint>(); spawnPoints = componentsInChildren.ToList(); for (int i = 0; i < spawnPoints.Count; i++) { spawnPoints[i].index = i; } unusedSpawnPoints = componentsInChildren.ToList(); Plugin.logger.LogDebug((object)$"Found {spawnPoints.Count} spawn points for the knight"); } public int GetSpawnPointIndex() { if (disableNextKnightSpecialSpawn) { disableNextKnightSpecialSpawn = true; return -1; } if (unusedSpawnPoints.Count == 0) { return -1; } if (lastKnightSeenPlayer >= 0) { KnightSpawnPoint knightSpawnPoint = spawnPoints[lastKnightSeenPlayer]; if (((Component)knightSpawnPoint).gameObject.activeInHierarchy) { Plugin.logger.LogDebug((object)$"Using the last knight {knightSpawnPoint.index} that saw a player"); unusedSpawnPoints.Remove(knightSpawnPoint); lastKnightSeenPlayer = -1; return knightSpawnPoint.index; } } int index = Random.Range(0, unusedSpawnPoints.Count); KnightSpawnPoint knightSpawnPoint2 = unusedSpawnPoints[index]; unusedSpawnPoints.RemoveAt(index); return knightSpawnPoint2.index; } public Transform GetSpawnPointTransform(int index) { return ((Component)spawnPoints[index]).transform; } } public struct ScarletNetworkParams : INetworkSerializeByMemcpy { public int scrapValue; public int specialValue; } public class ItemReference { public Item item; public int itemId; public int value; public ItemReference(Item item, int itemId, int value) { this.item = item; this.itemId = itemId; this.value = value; } public override string ToString() { string arg = (Object.op_Implicit((Object)(object)item) ? ((Object)item).name : "NULL"); return $"{arg}:{itemId} ({value})"; } } public class EnemyReference { public EnemyType enemy; public int index; public EnemyReference(EnemyType enemy, int index) { this.enemy = enemy; this.index = index; } public override string ToString() { string arg = (Object.op_Implicit((Object)(object)enemy) ? ((Object)enemy).name : "NULL"); return $"{arg}:{index}"; } } public class EnemyReferenceSpawnLogic : EnemyReference { public enum SpawnLogic { None, Special } public SpawnLogic logic; public EnemyReferenceSpawnLogic(EnemyType enemy, int index, SpawnLogic logic) : base(enemy, index) { this.logic = logic; } public void ApplySpawnLogic() { if (logic != 0) { string text = ((Object)enemy).name.ToLowerInvariant(); if (text == "knight") { KnightSpawnManager.Instance.disableNextKnightSpecialSpawn = true; } else if (text == "jester") { JesterAIPatch.active = true; } } } public override string ToString() { string text = base.ToString(); return text + " [" + logic.ToString() + "]"; } } public class ScarletNetworkManager : NetworkBehaviour { public static ScarletNetworkManager Instance { get; private set; } private void Awake() { Instance = this; } [ServerRpc(RequireOwnership = false)] public void DestroyPlayerItemInSlotServerRpc(NetworkBehaviourReference playerRef, int itemSlot, ServerRpcParams callParams = 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0108: 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_0124: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3412664016u, callParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, itemSlot); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3412664016u, callParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB val2 = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val2, (NetworkManager)null)) { Plugin.logger.LogDebug((object)$"P{((NetworkBehaviour)val2).OwnerClientId}, S{callParams.Receive.SenderClientId}"); DestroyPlayerItemInSlotClientRpc(playerRef, itemSlot); } else { Plugin.logger.LogError((object)"Error trying to get player script (SERVERRPC)"); } } } [ClientRpc] public void DestroyPlayerItemInSlotClientRpc(NetworkBehaviourReference playerRef, int itemSlot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(345840887u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, itemSlot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 345840887u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = default(PlayerControllerB); if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null) && !((NetworkBehaviour)val3).IsOwner) { val3.DestroyPlayerItemInSlot_SDM(itemSlot); } else if ((Object)(object)val3 == (Object)null) { Plugin.logger.LogError((object)"Error trying to get player script (CLIENTRPC)"); } } } [ServerRpc(RequireOwnership = false)] public void CreateItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4119288164u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4119288164u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { CreateItem(itemId, fromScrapArray: false, position, null, callParams); } } } [ServerRpc(RequireOwnership = false)] public void CreateItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1939319057u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1939319057u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB player = default(PlayerControllerB); ((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null); CreateItem(itemId, fromScrapArray: false, position, player, callParams); } } } [ServerRpc(RequireOwnership = false)] public void CreateScrapItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1250011204u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1250011204u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { CreateItem(itemId, fromScrapArray: true, position, null, callParams); } } } [ServerRpc(RequireOwnership = false)] public void CreateScrapItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3991430686u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3991430686u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB player = default(PlayerControllerB); ((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null); CreateItem(itemId, fromScrapArray: true, position, player, callParams); } } } private void CreateItem(int itemId, bool fromScrapArray, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ((!fromScrapArray) ? StartOfRound.Instance.allItemsList.itemsList[itemId].spawnPrefab : Utility.GetDungeonItems()[itemId].spawnableItem.spawnPrefab); GrabbableObject val = CreateGrabbableObject(prefab, player, position); ((MonoBehaviour)this).StartCoroutine(WaitForEndOfFrameToUpdateItemInitialProperities(val)); UpdateItemFallingProperites(val, position); UpdateItemElevator(val, player); if (val is IScarletItem scarletItem) { scarletItem.UpdateSpecialProperties(callParams.specialValue); } int scrapValue = callParams.scrapValue; if (scrapValue > 0) { UpdateItemValueProperties(val, scrapValue); } ((NetworkBehaviour)val).NetworkObject.Spawn(false); if ((Object)(object)player == (Object)null) { CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, callParams); } else { CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)player), callParams); } } [ClientRpc] public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3004287685u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3004287685u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Vector3 position2 = position; ScarletNetworkParams callParams2 = callParams; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForItem(itemRef, delegate(GrabbableObject c) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) CreateItem(c, position2, null, callParams2); })); } } [ClientRpc] public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2816052745u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2816052745u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Vector3 position2 = position; ScarletNetworkParams callParams2 = callParams; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForItemAndPlayer(itemRef, playerRef, delegate(GrabbableObject c, PlayerControllerB p) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) CreateItem(c, position2, p, callParams2); })); } } private IEnumerator WaitForItem(NetworkBehaviourReference itemRef, Action<GrabbableObject> action) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float t = Time.realtimeSinceStartup + 8f; GrabbableObject comp = default(GrabbableObject); while (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref comp, (NetworkManager)null)) { yield return null; if (Time.realtimeSinceStartup > t) { Plugin.logger.LogError((object)"Failed to find network object (ITEM)"); yield break; } } yield return (object)new WaitForEndOfFrame(); action(comp); } private IEnumerator WaitForItemAndPlayer(NetworkBehaviourReference itemRef, NetworkBehaviourReference playerRef, Action<GrabbableObject, PlayerControllerB> action) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float t = Time.realtimeSinceStartup + 8f; GrabbableObject comp = default(GrabbableObject); while (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref comp, (NetworkManager)null)) { yield return null; if (Time.realtimeSinceStartup > t) { Plugin.logger.LogError((object)"Failed to find network object (ITEM)"); yield break; } } PlayerControllerB player = default(PlayerControllerB); while (!((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null)) { yield return null; if (Time.realtimeSinceStartup > t) { Plugin.logger.LogError((object)"Failed to find network object (PLAYER)"); yield break; } } yield return (object)new WaitForEndOfFrame(); action(comp, player); } private void CreateItem(GrabbableObject item, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams)) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) UpdateItemFallingProperites(item, position); UpdateItemElevator(item, player); if (item is IScarletItem scarletItem) { scarletItem.UpdateSpecialProperties(callParams.specialValue); } int scrapValue = callParams.scrapValue; if (scrapValue > 0) { UpdateItemValueProperties(item, scrapValue); } } private GrabbableObject CreateGrabbableObject(GameObject prefab, PlayerControllerB player, Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Transform itemSpawnTransform = GetItemSpawnTransform(player); GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity, itemSpawnTransform); return val.GetComponent<GrabbableObject>(); } private Transform GetItemSpawnTransform(PlayerControllerB player) { if ((((Object)(object)player != (Object)null && player.isInElevator) || StartOfRound.Instance.inShipPhase) && (Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null) { return RoundManager.Instance.spawnedScrapContainer; } return StartOfRound.Instance.elevatorTransform; } private IEnumerator WaitForEndOfFrameToUpdateItemInitialProperities(GrabbableObject comp) { yield return (object)new WaitForEndOfFrame(); UpdateItemInitialProperites(comp); } private void UpdateItemInitialProperites(GrabbableObject comp) { comp.reachedFloorTarget = false; comp.hasHitGround = false; comp.fallTime = 0f; } private void UpdateItemFallingProperites(GrabbableObject comp, Vector3 position) { //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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) comp.startFallingPosition = position; comp.targetFloorPosition = comp.GetItemFloorPosition(position); } private void UpdateItemValueProperties(GrabbableObject comp, int value) { comp.SetScrapValue(value); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)value; } private void UpdateItemElevator(GrabbableObject comp, PlayerControllerB player) { if ((Object)(object)player != (Object)null && player.isInHangarShipRoom) { player.SetItemInElevator(true, true, comp); } } public void RequestEvilSkinApply(NetworkObjectReference reference, string enemyName) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (SyncedInstance<PluginConfig>.Instance.paintingEnemyEvilSkinValue && ScarletBedroom.ENEMY_EVIL_LIST.Contains(enemyName)) { RequestEvilSkinApplyClientRpc(reference); } } [ClientRpc] public void RequestEvilSkinApplyClientRpc(NetworkObjectReference reference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(112037380u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 112037380u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref reference)).TryGet(ref val3, (NetworkManager)null)) { return; } EnemyAI componentInParent = ((Component)val3).GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent == (Object)null) { return; } string name = ((Object)componentInParent).name; try { Plugin.logger.LogDebug((object)("Applying evil material to " + name)); ApplyMaterialToRenderers<SkinnedMeshRenderer>(((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>()); ApplyMaterialToRenderers<MeshRenderer>(((Component)componentInParent).GetComponentsInChildren<MeshRenderer>()); } catch (Exception ex) { Plugin.logger.LogWarning((object)("Failed to apply evil material to " + name)); Plugin.logger.LogWarning((object)ex.ToString()); } static void ApplyMaterialToRenderers<T>(T[] renderers) where T : Renderer { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown foreach (T val4 in renderers) { Material[] materials = ((Renderer)val4).materials; for (int j = 0; j < materials.Length; j++) { Material val5 = new Material(Assets.networkObjectList.ghostMaterial); val5.mainTexture = materials[j].mainTexture; materials[j] = val5; } ((Renderer)val4).materials = materials; } } } public void CreateSpawnAudioPrefab(Vector3 positon, ulong playerId) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) CreateSpawnAudioPrefabServerRpc(positon, playerId); CreateSpawnAudioPrefab(positon); } [ServerRpc(RequireOwnership = false)] public void CreateSpawnAudioPrefabServerRpc(Vector3 position, ulong playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1476417038u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1476417038u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { CreateSpawnAudioPrefabClientRpc(position, playerId); } } } [ClientRpc] public void CreateSpawnAudioPrefabClientRpc(Vector3 position, ulong playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1753138479u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1753138479u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && StartOfRound.Instance.localPlayerController.actualClientId != playerId) { CreateSpawnAudioPrefab(position); } } } private void CreateSpawnAudioPrefab(Vector3 position) { //IL_000b: 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) GameObject val = Object.Instantiate<GameObject>(Assets.networkObjectList.yukariSpawnPrefab, position, Quaternion.identity); AudioSource componentInChildren = val.GetComponentInChildren<AudioSource>(); componentInChildren.time = 0.5f; Object.Destroy((Object)(object)val, 5f); } [ClientRpc] public void SetupBookPathsClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2713883165u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2713883165u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)ScarletGenericManager.Instance == (Object)null)) { ScarletBookPath[] bookPaths = ScarletGenericManager.Instance.bookPaths; ScarletBookPath[] array = bookPaths; foreach (ScarletBookPath scarletBookPath in array) { scarletBookPath.ResetPath(); } } } [ClientRpc] public void CallSelfDestroyTargetClientRpc(int index) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3435869490u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3435869490u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)ScarletGenericManager.Instance == (Object)null)) { ScarletGenericManager.Instance.selfDestroyTargets[index].Destroy(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ScarletNetworkManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3412664016u, new RpcReceiveHandler(__rpc_handler_3412664016)); NetworkManager.__rpc_func_table.Add(345840887u, new RpcReceiveHandler(__rpc_handler_345840887)); NetworkManager.__rpc_func_table.Add(4119288164u, new RpcReceiveHandler(__rpc_handler_4119288164)); NetworkManager.__rpc_func_table.Add(1939319057u, new RpcReceiveHandler(__rpc_handler_1939319057)); NetworkManager.__rpc_func_table.Add(1250011204u, new RpcReceiveHandler(__rpc_handler_1250011204)); NetworkManager.__rpc_func_table.Add(3991430686u, new RpcReceiveHandler(__rpc_handler_3991430686)); NetworkManager.__rpc_func_table.Add(3004287685u, new RpcReceiveHandler(__rpc_handler_3004287685)); NetworkManager.__rpc_func_table.Add(2816052745u, new RpcReceiveHandler(__rpc_handler_2816052745)); NetworkManager.__rpc_func_table.Add(112037380u, new RpcReceiveHandler(__rpc_handler_112037380)); NetworkManager.__rpc_func_table.Add(1476417038u, new RpcReceiveHandler(__rpc_handler_1476417038)); NetworkManager.__rpc_func_table.Add(1753138479u, new RpcReceiveHandler(__rpc_handler_1753138479)); NetworkManager.__rpc_func_table.Add(2713883165u, new RpcReceiveHandler(__rpc_handler_2713883165)); NetworkManager.__rpc_func_table.Add(3435869490u, new RpcReceiveHandler(__rpc_handler_3435869490)); } private static void __rpc_handler_3412664016(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); int itemSlot = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemSlot); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((ScarletNetworkManager)(object)target).DestroyP
ScarletMansionCoronerPatch.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Coroner; using HarmonyLib; using ScarletMansion; using ScarletMansion.ModPatch; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ScarletMansionCoronerPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScarletMansionCoronerPatch")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cb30b9c8-2679-4c65-86a3-b4680b73da4f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScarletMansionCoronerPatch; public class Patch { public static Dictionary<CoronerDeathEnum, object> causesOfDeath; public static void Activate() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) causesOfDeath = new Dictionary<CoronerDeathEnum, object>(); causesOfDeath.Add((CoronerDeathEnum)0, AdvancedCauseOfDeath.Build("DeathEnemyKnight")); causesOfDeath.Add((CoronerDeathEnum)1, AdvancedCauseOfDeath.Build("DeathEnemyMaid")); causesOfDeath.Add((CoronerDeathEnum)2, AdvancedCauseOfDeath.Build("DeathPitVoid")); causesOfDeath.Add((CoronerDeathEnum)3, AdvancedCauseOfDeath.Build("DeathEnemyGhostKnight")); causesOfDeath.Add((CoronerDeathEnum)4, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnife")); causesOfDeath.Add((CoronerDeathEnum)5, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFeed")); causesOfDeath.Add((CoronerDeathEnum)6, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFriendlyFire")); Assets.onPlayerDeath.AddEvent("CoronerPatch", (Action<CoronerParameters>)ProcessCauseOfDeath); } public static void ProcessCauseOfDeath(CoronerParameters parameters) { //IL_0006: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (causesOfDeath.TryGetValue(parameters.death, out var value)) { API.SetCauseOfDeath(parameters.player, (AdvancedCauseOfDeath?)(AdvancedCauseOfDeath)value); Plugin.logger.LogInfo((object)parameters.death); } } } [BepInPlugin("dev.ladyalice.scarletmansion.coronerpatch", "Scarlet Mansion Coroner Patch", "1.0.0")] [BepInDependency("dev.ladyalice.scarletmansion", "1.3.27")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.ladyalice.scarletmansion.coronerpatch"; private const string modName = "Scarlet Mansion Coroner Patch"; private const string modVersion = "1.0.0"; public const string targetModGUID = "com.elitemastereric.coroner"; public const string targetModVersion = "2.1.0"; public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.coronerpatch"); public static Plugin Instance { get; private set; } public static ManualLogSource logger { get; internal set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.coronerpatch"); if (Chainloader.PluginInfos.ContainsKey("com.elitemastereric.coroner")) { PluginInfo val = Chainloader.PluginInfos["com.elitemastereric.coroner"]; Version version = val.Metadata.Version; bool flag; if (string.IsNullOrWhiteSpace("2.1.0")) { flag = true; } else { Version version2 = new Version("2.1.0"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Plugin Scarlet Mansion Coroner Patch has been added!"); Patch.Activate(); } } } }
ScarletMansionMimicsPatch.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using DunGen; using DunGenPlus.Components; using GameNetcodeStuff; using HarmonyLib; using Mimics; using Mimics.API; using ScarletMansion; using ScarletMansion.DunGenPatch; using ScarletMansion.GamePatch.Components; using ScarletMansion.GamePatch.FixValues; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ScarletMansionMimicsPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScarletMansionMimicsPatch")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6aab73ec-489e-4baa-8bd1-7ca944359cec")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScarletMansionMimicsPatch; public class Patch { public class SDMMimicEventHandler : MimicEventHandler { public override string ModGUID => "dev.ladyalice.scarletmansion.mimicspatch"; public override bool IsMyInteriorLoaded => Patch.active; public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) { DoorwayCleanup componentInChildren = ((Component)((Component)doorway).transform.parent).GetComponentInChildren<DoorwayCleanup>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.overrideConnector = true; componentInChildren.overrideNoDoorway = true; } FixFireExit componentInChildren2 = ((Component)doorway).GetComponentInChildren<FixFireExit>(true); componentInChildren2.ForcefullyEnableDoorway(); Transform mimicDoorMesh = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "DoorMesh"); Transform mimicFrame = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "Frame"); Transform mimicLight = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "Light"); if (componentInChildren2.EnableVanillaFireExit) { FixDoorwayForVanillaFireExit(componentInChildren2, mimicDoorMesh, mimicFrame, mimicLight); } else { FixDoorwayForSDMFireExit(componentInChildren2, mimicDoorMesh, mimicFrame, mimicLight); } Plugin.logger.LogDebug((object)"Fixed a doorway for a mimic"); } public override void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack) { Doorway componentInParent = ((Component)mimicDoor).GetComponentInParent<Doorway>(); ScarletFireExit componentInChildren = ((Component)componentInParent).GetComponentInChildren<ScarletFireExit>(); if (componentInChildren != null) { componentInChildren.DisableEnablePortal(); } } } private static bool colorBlindModeLastValue; public static void Activate() { MimicsAPI.GetAPI().RegisterMimicEventHandler((MimicEventHandler)(object)new SDMMimicEventHandler()); Plugin.Instance.harmony.PatchAll(typeof(Patch)); } [HarmonyPrefix] [HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")] public static void SetExitIDsPatchPrefix() { colorBlindModeLastValue = Mimics.ColorBlindMode; } [HarmonyPostfix] [HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")] public static void SetExitIDsPatchPostfix() { Mimics.ColorBlindMode = colorBlindModeLastValue; } private static void FixDoorwayForVanillaFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight) { //IL_001d: 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_002e: 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_0080: 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) if ((Object)(object)mimicDoorMesh != (Object)null) { mimicDoorMesh.localPosition = new Vector3(-0.07f, 0f, 0.06f); Vector3 localScale = mimicDoorMesh.localScale; localScale.y = -0.0002f; localScale.z = -0.000161f; mimicDoorMesh.localScale = localScale; } else { Plugin.logger.LogWarning((object)"Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break"); } if ((Object)(object)mimicFrame != (Object)null) { mimicFrame.localPosition = new Vector3(0f, -0.02f, 0.07f); mimicFrame.localScale = new Vector3(1.08f, 1.008f, 1.02f); } else { Plugin.logger.LogWarning((object)"Could not find Frame in mimic gameobject. It will look weird but nothing should break"); } } private static void FixDoorwayForSDMFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight) { Mimics.ColorBlindMode = true; fixFireExit.ForcefullyEnableSDMRender(); fixFireExit.sdmFireExit.enablePortalAnimation = true; if ((Object)(object)mimicDoorMesh != (Object)null) { ((Component)mimicDoorMesh).gameObject.SetActive(false); } else { Plugin.logger.LogWarning((object)"Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break"); } if ((Object)(object)mimicFrame != (Object)null) { ((Component)mimicFrame).gameObject.SetActive(false); } else { Plugin.logger.LogWarning((object)"Could not find Frame in mimic gameobject. It will look weird but nothing should break"); } if ((Object)(object)mimicLight != (Object)null) { ((Component)mimicLight).gameObject.SetActive(false); } else { Plugin.logger.LogWarning((object)"Could not find Light in mimic gameobject. It will look weird but nothing should break"); } } } [BepInPlugin("dev.ladyalice.scarletmansion.mimicspatch", "Scarlet Mansion Mimics Patch", "1.0.0")] [BepInDependency("dev.ladyalice.scarletmansion", "1.3.22")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.ladyalice.scarletmansion.mimicspatch"; private const string modName = "Scarlet Mansion Mimics Patch"; private const string modVersion = "1.0.0"; public const string targetModGUID = "x753.Mimics"; public const string targetModVersion = "2.6.0"; public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.mimicspatch"); public static Plugin Instance { get; private set; } public static ManualLogSource logger { get; internal set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.mimicspatch"); if (Chainloader.PluginInfos.ContainsKey("x753.Mimics")) { PluginInfo val = Chainloader.PluginInfos["x753.Mimics"]; Version version = val.Metadata.Version; bool flag; if (string.IsNullOrWhiteSpace("2.6.0")) { flag = true; } else { Version version2 = new Version("2.6.0"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Plugin Scarlet Mansion Mimics Patch has been added!"); Patch.Activate(); } } } }