Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ScarletDevilMansion v2.3.3
DungeonBasement.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LethalConfig; 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("DungeonBasement")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DungeonBasement")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6224a905-0b6f-4435-9bcf-5428e5d05717")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DungeonBasement; public class Patch { public static void Activate() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) string location = Assembly.GetExecutingAssembly().Location; string filePath = Path.Combine(Path.GetDirectoryName(location), "basement.png"); Texture2D val = LoadTexture(filePath); Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); LethalConfigManager.SetModIcon(modIcon); LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Basement dungeon variant."); } private static Texture2D LoadTexture(string FilePath) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (File.Exists(FilePath)) { byte[] array = File.ReadAllBytes(FilePath); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return val; } return null; } } [BepInPlugin("dev.ladyalice.scarletmansion.basement", "Scarlet Basement", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.ladyalice.scarletmansion.basement"; private const string modName = "Scarlet Basement"; private const string modVersion = "1.0.0"; public const string targetModGUID = "ainavt.lc.lethalconfig"; public const string targetModVersion = "1.4.2"; public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.basement"); public static ManualLogSource logger { get; internal set; } private void Awake() { logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.basement"); logger.LogInfo((object)"Plugin Scarlet Basement has been added!"); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { PluginInfo val = Chainloader.PluginInfos["ainavt.lc.lethalconfig"]; Version version = val.Metadata.Version; bool flag; if (string.IsNullOrWhiteSpace("1.4.2")) { flag = true; } else { Version version2 = new Version("1.4.2"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Lethal config compability patch added!"); Patch.Activate(); } } } }
DungeonFoyer.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LethalConfig; 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("DungeonFoyer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DungeonFoyer")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a0e41aed-7c98-4a4d-b09b-1e59375420d9")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DungeonFoyer; public class Patch { public static void Activate() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) string location = Assembly.GetExecutingAssembly().Location; string filePath = Path.Combine(Path.GetDirectoryName(location), "foyer.png"); Texture2D val = LoadTexture(filePath); Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); LethalConfigManager.SetModIcon(modIcon); LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Foyer dungeon variant."); } private static Texture2D LoadTexture(string FilePath) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (File.Exists(FilePath)) { byte[] array = File.ReadAllBytes(FilePath); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return val; } return null; } } [BepInPlugin("dev.ladyalice.scarletmansion.foyer", "Scarlet Foyer", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.ladyalice.scarletmansion.foyer"; private const string modName = "Scarlet Foyer"; private const string modVersion = "1.0.0"; public const string targetModGUID = "ainavt.lc.lethalconfig"; public const string targetModVersion = "1.4.2"; public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.foyer"); public static ManualLogSource logger { get; internal set; } private void Awake() { logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.foyer"); logger.LogInfo((object)"Plugin Scarlet Foyer has been added!"); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { PluginInfo val = Chainloader.PluginInfos["ainavt.lc.lethalconfig"]; Version version = val.Metadata.Version; bool flag; if (string.IsNullOrWhiteSpace("1.4.2")) { flag = true; } else { Version version2 = new Version("1.4.2"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Lethal config compability patch added!"); Patch.Activate(); } } } }
ScarletMansion.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.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 DunGen.Tags; using DunGenPlus; using DunGenPlus.Collections; using DunGenPlus.Components.Scripting; using DunGenPlus.Managers; using DungeonBasement; using DungeonFoyer; using FacilityMeltdown.API; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalConfig.MonoBehaviours; using LethalLevelLoader; using LethalLib.Modules; using OdinSerializer; using ReservedItemSlotCore.Data; using ScarletMansion.Configs; 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; [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] namespace ScarletMansion { public static class Assets { public class Enemy { public bool initialized; 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 void CreateDummy(string name) { EnemyType val = ScriptableObject.CreateInstance<EnemyType>(); ((Object)val).name = name; val.enemyName = name; val.enemyPrefab = enemy; enemy.GetComponent<EnemyAI>().enemyType = val; } } public class GlobalItem { public Item item; private int _itemId; public Func<ConfigItem> configItemEntryFunc; 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, Func<ConfigItem> configItemEntryFunc) { this.item = item; _itemId = -1; this.configItemEntryFunc = configItemEntryFunc; } public ConfigItem GetConfigItemEntry() { return configItemEntryFunc(); } } public class ScrapItem : GlobalItem { public Func<ConfigScrapItem> configScrapItemEntryFunc; public bool SpawnsOnMap => configScrapItemEntryFunc != null; public ScrapItem(Item item, Func<ConfigScrapItem> configScrapItemEntryFunc) : base(item, configScrapItemEntryFunc) { this.configScrapItemEntryFunc = configScrapItemEntryFunc; } public void UpdateItemValue() { if (SpawnsOnMap) { ConfigScrapItem configScrapItemEntry = GetConfigScrapItemEntry(); item.minValue = configScrapItemEntry.valueRange.min; item.maxValue = configScrapItemEntry.valueRange.max; } } public SpawnableItemWithRarity GetItemRarity() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown ConfigScrapItem configScrapItemEntry = GetConfigScrapItemEntry(); SpawnableItemWithRarity val = new SpawnableItemWithRarity(); val.spawnableItem = item; val.rarity = configScrapItemEntry?.spawnWeight ?? 0; return val; } public ConfigScrapItem GetConfigScrapItemEntry() { return configScrapItemEntryFunc(); } } 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, Func<ConfigItem> configEntryFunc) : base(null, configEntryFunc) { assetName = "Scarlet" + baseName; displayName = "D. " + baseName; this.lethalHelmetIndex = lethalHelmetIndex; } public bool ContainsItemCheckConfig(Item compareItem) { if (!GetConfigItemEntry().enabled) { return false; } return ContainsItem(compareItem); } 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 ExtendedMod extendedMod; public static NetworkObjectListScriptableObject networkObjectList; public static AudioClip entranceAudioClip; public static Enemy knight; public static Enemy maid; public static List<GlobalItem> globalItems; public static List<ScrapItem> scrapItems; public static Dictionary<string, Func<ConfigScrapItem>> itemConfigTable = new Dictionary<string, Func<ConfigScrapItem>> { { "Deco. crystal", () => SyncedInstance<ConfigMain>.Instance.crystalValue }, { "Shattered deco. crystal", () => SyncedInstance<ConfigMain>.Instance.crystalBrokenValue }, { "Doll Snow Globe", () => SyncedInstance<ConfigMain>.Instance.snowGlobeValue }, { "Gohei", () => SyncedInstance<ConfigMain>.Instance.goheiValue } }; public static GlobalItem key; public static Flashlight flashlight; public static Flashlight flashlightBB; 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 Flashlight GetFlashlightCheckConfig(Item item) { if (flashlight.ContainsItemCheckConfig(item)) { return flashlight; } if (flashlightBB.ContainsItemCheckConfig(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); } } Plugin.ConfigFoyer.dungeon = Assets.Load<DungeonFlow>("sdmFoyer", onlyReportErrors: true); Plugin.ConfigFoyer.dunGenExtender = Assets.Load<DunGenExtender>("foyerExtender", onlyReportErrors: true); Plugin.ConfigBasement.dungeon = Assets.Load<DungeonFlow>("sdmBasement", onlyReportErrors: true); Plugin.ConfigBasement.dunGenExtender = Assets.Load<DunGenExtender>("basementExtender", onlyReportErrors: true); networkObjectList = Assets.Load<NetworkObjectListScriptableObject>("SDMList", 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)); knight.CreateDummy("Knight"); maid = new Enemy(Assets.Load<GameObject>("NET_MaidEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("MaidNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("MaidKeyword", onlyReportErrors: true)); maid.CreateDummy("Maid"); 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 scrapItem in networkObjectList.scrapItems) { Func<ConfigScrapItem> itemConfigFunction = GetItemConfigFunction(scrapItem); ScrapItem item = new ScrapItem(scrapItem, itemConfigFunction); scrapItems.Add(item); globalItems.Add(item); Items.RegisterScrap(scrapItem, 0, (LevelTypes)1); NetworkPrefabs.RegisterNetworkPrefab(scrapItem.spawnPrefab); Plugin.logger.LogDebug((object)("Scrap Item " + scrapItem.itemName + " registered")); } key = new GlobalItem(networkObjectList.items[0], () => SyncedInstance<ConfigMain>.Instance.scarletKeyValue); globalItems.Add(key); Items.RegisterItem(key.item); flashlight = new Flashlight("Pro Flashlight", 0, () => SyncedInstance<ConfigMain>.Instance.decoProFlashlightValue); flashlightBB = new Flashlight("Flashlight", 1, () => SyncedInstance<ConfigMain>.Instance.decoFlashlightValue); 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<ConfigScrapItem> GetItemConfigFunction(Item item) { string itemName = item.itemName; if (itemConfigTable.TryGetValue(itemName, out var value)) { return value; } return null; } 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; } } if ((Object)(object)targerGameObject == (Object)null) { Plugin.logger.LogError((object)"FloorCleanup null. dev fix plz"); 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; public string tileParentName; private void Reset() { children = ((Component)this).GetComponentsInChildren<FloorCleanup>(); } private void Awake() { tileParentName = ((Object)((Component)((Component)this).GetComponentInParent<Tile>()).gameObject).name ?? ""; } public void OnDungeonComplete(Dungeon dungeon) { DoorwayManager.AddActionHook((DunGenScriptingHook)1, (Action)UpdateChildren); } public void UpdateChildren() { bool flag = true; while (flag) { flag = false; FloorCleanup[] array = children; foreach (FloorCleanup floorCleanup in array) { if (!((Object)(object)floorCleanup == (Object)null)) { bool flag2 = floorCleanup.UpdateRender(); flag = flag || flag2; } } } } } public class KnightSpawnPoint : MonoBehaviour { public int index; public GameObject renderGameObject; 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 void OnStop() { renderGameObject.SetActive(false); ((MonoBehaviour)this).StopAllCoroutines(); } } public class ScarletVent : EnemyVent { [Header("References")] public ScarletVentVisuals visuals; public EnemyType ignoreEnemyType; private void Awake() { ignoreEnemyType = Assets.knight.enemyType; } public void ScarletUpdate() { if (base.occupied && (Object)(object)base.enemyType != (Object)(object)ignoreEnemyType) { float num = base.spawnTime - base.roundManager.timeScript.currentDayTime; if (base.isPlayingAudio) { float num2 = Mathf.Abs(num / base.enemyType.timeToPlayAudio - 1f); visuals.SetVolumeLazy(num2); base.lowPassFilter.lowpassResonanceQ = Math.Abs(num2 * 2f - 2f); } else if (num < base.enemyType.timeToPlayAudio) { base.isPlayingAudio = true; visuals.StartSpawnParticles(); } } else if (base.isPlayingAudio) { base.isPlayingAudio = false; visuals.StopSpawnParticles(); visuals.StopLightningParticles(); } } public void OpenVent() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ScarletNetworkManager.Instance.CreateSpawnAudioPrefabLocal(((Component)this).transform.position); } protected override void __initializeVariables() { ((EnemyVent)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyVent)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "ScarletVent"; } } 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; public KnightSpawnPoint spawnPoint; public bool activated; private bool calledDisappear = false; public override void Start() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); maxChaseSpeed = SyncedInstance<ConfigMain>.Instance.revEnemyValue.speed; if (StartOfRound.Instance.ClientPlayerList.TryGetValue(((NetworkBehaviour)this).NetworkObject.OwnerClientId, out var value)) { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[value]; Plugin.logger.LogInfo((object)("Targeting " + base.targetPlayer.playerUsername + " for death")); } if (!((NetworkBehaviour)this).IsOwner) { MeshRenderer[] array = knightMeshRenderers; foreach (MeshRenderer val in array) { ((Renderer)val).enabled = false; } } if (((NetworkBehaviour)this).IsServer) { int num = (Object.op_Implicit((Object)(object)KnightSpawnManager.Instance) ? KnightSpawnManager.Instance.GetSpawnPointIndex() : (-1)); if (num == -1) { EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents; EnemyVent val2 = allEnemyVents[Random.Range(0, allEnemyVents.Length)]; SyncKnightAtPositionClientRpc(val2.floorNode.position, Quaternion.Euler(0f, val2.floorNode.eulerAngles.y, 0f)); } else { SyncKnightReplacementClientRpc(num); } } } public override void DoAIInterval() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); base.movingTowardsTargetPlayer = true; if ((Object)(object)base.targetPlayer == (Object)null || !((NetworkBehaviour)base.targetPlayer).IsOwner || base.isEnemyDead || base.timeSinceSpawn < 1f) { return; } if (!((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) { CallDisappear(); return; } bool flag = base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f); 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 && !(base.timeSinceSpawn < 1f)) { if (!activated) { activated = true; base.creatureAnimator.SetBool("Activate", true); } float num = ((base.currentBehaviourStateIndex == 0) ? maxChaseSpeed : slowChaseSpeed); if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = Mathf.MoveTowards(base.agent.speed, num, (maxChaseSpeed - slowChaseSpeed) * 4f * Time.deltaTime); } currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, num * 0.4597f, 4f * Time.deltaTime); base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed); } } public override void OnCollideWithPlayer(Collider other) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (base.timeSinceSpawn < 1f) { return; } 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 markedDamageToPlayer = ScarletNetworkManagerUtility.GetMarkedDamageToPlayer(val); val.DamagePlayer(markedDamageToPlayer, true, true, (CauseOfDeath)6, 1, false, default(Vector3)); val.JumpToFearLevel(1f, true); ScarletNetworkManagerUtility.MarkPlayerForDeath(val); if (val.isPlayerDead) { Assets.onPlayerDeath.Call(new CoronerParameters(val, CoronerDeathEnum.GhostKnight)); } RoundManager.PlayRandomClip(base.creatureVoice, ramAudioClips, false, 1f, 1, 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_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2391938005u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2391938005u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Plugin.logger.LogDebug((object)$"Spawning ghost knight at {index}"); try { spawnPoint = KnightSpawnManager.Instance.GetSpawnPoint(index); KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, spawnPoint); } catch (Exception ex) { Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {index}, but completely failed"); Plugin.logger.LogError((object)ex); } } [ClientRpc] public void SyncKnightAtPositionClientRpc(Vector3 position, Quaternion rotation) { //IL_011a: 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_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_0096: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2455274832u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2455274832u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Plugin.logger.LogDebug((object)$"Spawning ghost knight at {position}"); try { KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, position, rotation); } catch (Exception ex) { Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {position}, but completely failed"); Plugin.logger.LogError((object)ex); } } 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) //IL_00c1: 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)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((EnemyAI)this).KillEnemy(true); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2391938005u, new RpcReceiveHandler(__rpc_handler_2391938005), "SyncKnightReplacementClientRpc"); ((NetworkBehaviour)this).__registerRpc(2455274832u, new RpcReceiveHandler(__rpc_handler_2455274832), "SyncKnightAtPositionClientRpc"); ((NetworkBehaviour)this).__registerRpc(722636660u, new RpcReceiveHandler(__rpc_handler_722636660), "DisappearServerRpc"); ((EnemyAI)this).__initializeRpcs(); } 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)1; ((KnightGhostVariant)(object)target).SyncKnightReplacementClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2455274832(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((KnightGhostVariant)(object)target).SyncKnightAtPositionClientRpc(position, rotation); 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1023489990u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1023489990u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3930434877u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3930434877u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3956096293u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3956096293u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncKnightReplacement(index); } } } public void SyncKnightReplacement(int index) { } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3882357060u, new RpcReceiveHandler(__rpc_handler_3882357060), "SetAnimationStopServerRpc"); ((NetworkBehaviour)this).__registerRpc(1023489990u, new RpcReceiveHandler(__rpc_handler_1023489990), "SetAnimationStopClientRpc"); ((NetworkBehaviour)this).__registerRpc(1320084365u, new RpcReceiveHandler(__rpc_handler_1320084365), "SetAnimationGoServerRpc"); ((NetworkBehaviour)this).__registerRpc(3930434877u, new RpcReceiveHandler(__rpc_handler_3930434877), "SetAnimationGoClientRpc"); ((NetworkBehaviour)this).__registerRpc(3956096293u, new RpcReceiveHandler(__rpc_handler_3956096293), "SyncKnightReplacementClientRpc"); ((EnemyAI)this).__initializeRpcs(); } 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)1; ((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)1; ((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)1; ((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 static bool WillSpawnOnSpawnPoint() { if (Object.op_Implicit((Object)(object)Instance)) { return !Instance.disableNextKnightSpecialSpawn && Instance.spawnPoints.Count > 0; } return false; } 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 KnightSpawnPoint GetSpawnPoint(int index) { return spawnPoints[index]; } public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, KnightSpawnPoint spawnPoint) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) SpawnEnemyOnSpawnPoint(enemyAI, ((Component)spawnPoint).transform.position, ((Component)spawnPoint).transform.rotation); spawnPoint.OnStop(); } public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0069: Unknown result type (might be due to invalid IL or missing references) ((Component)enemyAI).transform.position = position; ((Component)enemyAI).transform.rotation = rotation; enemyAI.serverPosition = position; if ((Object)(object)enemyAI.agent == (Object)null) { enemyAI.agent = ((Component)enemyAI).GetComponentInChildren<NavMeshAgent>(); } enemyAI.agent.Warp(position); if (((NetworkBehaviour)enemyAI).IsOwner) { enemyAI.SyncPositionToClients(); } ScarletNetworkManager.Instance?.CreateSpawnAudioPrefabLocal(position); } } 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00e9: 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.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 == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_0104: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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.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 != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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.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 != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; 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<ConfigMain>.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) //IL_00dc: 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.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); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((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); CreateSpawnAudioPrefabLocal(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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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)) { base.__rpc_exec_stage = (__RpcExecStage)0; 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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.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 == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (StartOfRound.Instance.localPlayerController.actualClientId != playerId) { CreateSpawnAudioPrefabLocal(position); } } } public void CreateSpawnAudioPrefabLocal(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) //IL_00c1: 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.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 != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!((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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (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 == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)ScarletGenericManager.Instance == (Object)null)) { ScarletGenericManager.Instance.selfDestroyTargets[index].Destroy(); } } } protected override vo
ScarletMansionCoronerPatch.dll
Decompiled 5 months 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", "2.3.3")] [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.3.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.3.0")) { flag = true; } else { Version version2 = new Version("2.3.0"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Plugin Scarlet Mansion Coroner Patch has been added!"); Patch.Activate(); } } } }
ScarletMansionMimicsPatch.dll
Decompiled 5 months 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 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) { FixFireExit componentInChildren = ((Component)doorway).GetComponentInChildren<FixFireExit>(true); componentInChildren.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 (componentInChildren.EnableVanillaFireExit) { FixDoorwayForVanillaFireExit(componentInChildren, mimicDoorMesh, mimicFrame, mimicLight); } else { FixDoorwayForSDMFireExit(componentInChildren, 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()); AddToWhiteList("sdmFoyer"); AddToWhiteList("sdmBasement"); Plugin.Instance.harmony.PatchAll(typeof(Patch)); } private static void AddToWhiteList(string dungeonName) { dungeonName = dungeonName.ToLower().Trim(); if (!Mimics.InteriorWhitelist.Contains(dungeonName)) { Mimics.InteriorWhitelist.Add(dungeonName); } } [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", "2.3.3")] [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.7.2"; 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.7.2")) { flag = true; } else { Version version2 = new Version("2.7.2"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Plugin Scarlet Mansion Mimics Patch has been added!"); Patch.Activate(); } } } }