Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Refightilization v1.2.3
Refightilization.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HG; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Navigation; using RoR2.Orbs; using SimpleJSON; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Refightilization")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b6fd06156617fc9f904edbf90316bf48beb23c7d")] [assembly: AssemblyProduct("Refightilization")] [assembly: AssemblyTitle("Refightilization")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Wonda { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Wonda.Refightilization", "Refightilization", "1.2.3")] public class Refightilization : BaseUnityPlugin { public class PlayerStorage { public NetworkUser user; public CharacterMaster master; public GameObject origPrefab; public bool isDead; public int[] blacklistedInventory = new int[ItemCatalog.itemCount]; public bool giftedAffix; public EquipmentIndex previousEquipment = (EquipmentIndex)(-1); public NetworkUser lastDamagedBy; public float lastDamagedTime; public bool isLoggedOut; public int lastStage; } private const string guid = "com.Wonda.Refightilization"; private const string modName = "Refightilization"; private const string version = "1.2.3"; private RefightilizationConfig _config; private RefightilizationLanguage _language; public List<PlayerStorage> playerStorage = new List<PlayerStorage>(); private List<GameObject> voidWhitelist = new List<GameObject>(); private List<GameObject> finalBossWhitelist = new List<GameObject>(); private List<string> respawnMethodCheck = new List<string> { "RefightRespawn" }; public float respawnTime; private int respawnLoops; public List<GameObject> currEnemyWhitelist = new List<GameObject>(); public List<GameObject> currSpecialEnemyWhitelist = new List<GameObject>(); public List<EquipmentIndex> currEliteWhitelist = new List<EquipmentIndex>(); public List<ItemIndex> currItemBlacklist = new List<ItemIndex>(); public bool moonDisabled; public void Awake() { _config = new RefightilizationConfig(((BaseUnityPlugin)this).Config); SetupHooks(); respawnMethodCheck.AddRange(_config.PreventPrefabResetMethods); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Refightilization!"); } public void Start() { if (Chainloader.PluginInfos.TryGetValue("com.rune580.riskofoptions", out var _)) { _config.BuildRiskOfOptionsMenu(); } } private void SetupHooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown Run.Start += new hook_Start(Run_Start); GlobalEventManager.OnPlayerCharacterDeath += new hook_OnPlayerCharacterDeath(GlobalEventManager_OnPlayerCharacterDeath); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; Run.OnServerSceneChanged += new hook_OnServerSceneChanged(Run_OnServerSceneChanged); Run.OnUserAdded += new hook_OnUserAdded(Run_OnUserAdded); Run.OnUserRemoved += new hook_OnUserRemoved(Run_OnUserRemoved); TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(TeleporterInteraction_OnInteractionBegin); GenericPickupController.AttemptGrant += new hook_AttemptGrant(GenericPickupController_AttemptGrant); Inventory.GiveItem_ItemIndex_int += new hook_GiveItem_ItemIndex_int(Inventory_GiveItem_ItemIndex_int); CharacterMaster.Respawn += new hook_Respawn(CharacterMaster_Respawn); CharacterMaster.PickRandomSurvivorBodyPrefab += new hook_PickRandomSurvivorBodyPrefab(CharacterMaster_PickRandomSurvivorBodyPrefab); CharacterMaster.IsDeadAndOutOfLivesServer += new hook_IsDeadAndOutOfLivesServer(CharacterMaster_IsDeadAndOutOfLivesServer); Run.BeginGameOver += new hook_BeginGameOver(Run_BeginGameOver); InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer += new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer); } private void Run_Start(orig_Start orig, Run self) { orig.Invoke(self); if (_config.EnableRefightilization) { respawnTime = _config.RespawnDelay; SetupPlayers(); SetupLang(); moonDisabled = false; } } private void GlobalEventManager_OnPlayerCharacterDeath(orig_OnPlayerCharacterDeath orig, GlobalEventManager self, DamageReport damageReport, NetworkUser victimNetworkUser) { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown orig.Invoke(self, damageReport, victimNetworkUser); if (!_config.EnableRefightilization) { return; } if (_config.MurderRevive) { PlayerStorage playerStorage = FindPlayerStorage(victimNetworkUser.master); PlayerStorage playerStorage2 = null; if (playerStorage != null && (Object)(object)playerStorage.lastDamagedBy != (Object)null && FindPlayerStorage(playerStorage.lastDamagedBy.master) != null) { playerStorage2 = FindPlayerStorage(playerStorage.lastDamagedBy.master); } if (playerStorage != null && !playerStorage.isDead && playerStorage2 != null && playerStorage2.isDead && Time.time <= playerStorage.lastDamagedTime + _config.MurderWindow) { CleanPlayer(playerStorage2); playerStorage2.master.RespawnExtraLife(); playerStorage2.master.inventory.RemoveItem(Items.ExtraLifeConsumed, 1); string text = _language.RevengeMessages[Random.Range(0, _language.RevengeMessages.Count - 1)]; text = text.Replace("{0}", playerStorage2.master.playerCharacterMasterController.networkUser.userName); text = text.Replace("{1}", playerStorage.master.playerCharacterMasterController.networkUser.userName); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cWorldEvent><sprite name=\"Skull\" tint=1> " + text + " <sprite name=\"Skull\" tint=1></style>" }); } } ((MonoBehaviour)this).StartCoroutine(RespawnCheck(((Component)victimNetworkUser.master).transform.position, respawnTime)); respawnTime += _config.AdditionalRespawnTime; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if ((_config.EnableRefightilization || _config.MurderRevive) && FindPlayerStorage(report.attackerMaster) != null && FindPlayerStorage(report.victimMaster) != null) { PlayerStorage obj = FindPlayerStorage(report.victimMaster); obj.lastDamagedBy = FindPlayerStorage(report.attackerMaster).user; obj.lastDamagedTime = Time.time; } } private void Run_OnServerSceneChanged(orig_OnServerSceneChanged orig, Run self, string sceneName) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (_config.EnableRefightilization) { ((MonoBehaviour)this).StopCoroutine(RespawnCheck()); } orig.Invoke(self, sceneName); if (_config.EnableRefightilization) { if (sceneName.Equals("moon") || sceneName.Equals("moon2")) { moonDisabled = true; } if (self.stageClearCount > 0) { ResetPrefabs(); } ((MonoBehaviour)this).Invoke("UpdateStageWhitelist", 1f); ((MonoBehaviour)this).Invoke("UpdateEliteWhitelist", 1f); ((MonoBehaviour)this).Invoke("UpdateBlacklistedItems", 1f); respawnTime = _config.RespawnDelay; } } private void Run_OnUserAdded(orig_OnUserAdded orig, Run self, NetworkUser user) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, user); if (!(Run.instance.time > 1f) || !_config.EnableRefightilization) { return; } bool flag = false; foreach (PlayerStorage item in playerStorage) { if (item.user.userName == user.userName) { item.user = user; item.master = user.master; item.isLoggedOut = false; flag = true; ((BaseUnityPlugin)this).Logger.LogDebug((object)(user.userName + " returned. Marking them as logged in.")); if (item.lastStage < Run.instance.stageClearCount && Object.op_Implicit((Object)(object)user.master) && Object.op_Implicit((Object)(object)Stage.instance)) { ((MonoBehaviour)this).Invoke("NaturalRespawnCharacter", 3f); } else { item.isDead = true; ((MonoBehaviour)this).StartCoroutine(RespawnCheck(((Component)item.master).transform.position, 3f)); } item.blacklistedInventory = new int[ItemCatalog.itemCount]; break; } } if (!flag) { SetupPlayers(StageUpdate: false); } } private void NaturalRespawnCharacter() { foreach (PlayerStorage item in playerStorage) { if (!item.isDead && !item.isLoggedOut && !Object.op_Implicit((Object)(object)item.master.GetBody())) { Stage.instance.RespawnCharacter(item.master); } } } private void Run_OnUserRemoved(orig_OnUserRemoved orig, Run self, NetworkUser user) { if (Run.instance.time > 1f && _config.EnableRefightilization) { foreach (PlayerStorage item in playerStorage) { if (item.user.userName == user.userName) { CleanPlayer(item); break; } } } orig.Invoke(self, user); if (!(Run.instance.time > 1f) || !_config.EnableRefightilization) { return; } foreach (PlayerStorage item2 in playerStorage) { if (item2.user.userName == user.userName) { item2.isLoggedOut = true; item2.lastStage = Run.instance.stageClearCount; ((BaseUnityPlugin)this).Logger.LogDebug((object)(user.userName + " left. Marking them as logged out.")); break; } } } private void TeleporterInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 if (_config.EnableRefightilization) { foreach (PlayerStorage item in playerStorage) { if (self.isCharged) { ((MonoBehaviour)this).StopCoroutine(RespawnCheck()); } if ((Object)(object)item.master != (Object)null && (Object)(object)item.master.GetBody() != (Object)null && (Object)(object)((Component)item.master.GetBody()).gameObject == (Object)(object)((Component)activator).gameObject && item.isDead && (int)item.master.teamIndex != 1 && playerStorage.Count > 1) { return; } } } orig.Invoke(self, activator); } private void GenericPickupController_AttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (_config.EnableRefightilization) { PlayerStorage playerStorage = null; if (Object.op_Implicit((Object)(object)body.master)) { playerStorage = FindPlayerStorage(body.master); } if (playerStorage != null && playerStorage.isDead && _config.ItemPickupToggle) { playerStorage.master.GetBody().teamComponent.teamIndex = (TeamIndex)1; } orig.Invoke(self, body); if (playerStorage != null && playerStorage.isDead && _config.ItemPickupToggle) { playerStorage.master.GetBody().teamComponent.teamIndex = _config.RespawnTeam; } } else { orig.Invoke(self, body); } } private void WhyDoActionsDoSillySillyThings(ItemTransferOrb orb) { } private void Inventory_GiveItem_ItemIndex_int(orig_GiveItem_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count) { //IL_00e0: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown if (_config.EnableRefightilization && currItemBlacklist.Contains(itemIndex)) { CharacterMaster component = ((Component)self).GetComponent<CharacterMaster>(); PlayerStorage playerStorage = null; if ((Object)(object)component != (Object)null) { playerStorage = FindPlayerStorage(component); } if (playerStorage != null && playerStorage.isDead) { playerStorage.blacklistedInventory[itemIndex] += count; ItemTransferOrb.DispatchItemTransferOrb(component.GetBody().footPosition, component.inventory, itemIndex, 0, (Action<ItemTransferOrb>)WhyDoActionsDoSillySillyThings, default(Either<NetworkIdentity, HurtBox>)); string itemBlacklistWarning = _language.ItemBlacklistWarning; itemBlacklistWarning = itemBlacklistWarning.Replace("{0}", playerStorage.user.userName); itemBlacklistWarning = itemBlacklistWarning.Replace("{1}", ItemCatalog.itemNames[itemIndex]); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cStack>" + itemBlacklistWarning }); return; } } orig.Invoke(self, itemIndex, count); } private CharacterBody CharacterMaster_Respawn(orig_Respawn orig, CharacterMaster self, Vector3 footPosition, Quaternion rotation, bool wasRevivedMidStage = false) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (_config.EnableRefightilization) { string currMethod = new StackFrame(2).GetMethod().Name; if (!respawnMethodCheck.Exists((string x) => x.Equals(currMethod)) && FindPlayerStorage(self) != null) { CleanPlayer(FindPlayerStorage(self)); } } return orig.Invoke(self, footPosition, rotation, wasRevivedMidStage); } private GameObject CharacterMaster_PickRandomSurvivorBodyPrefab(orig_PickRandomSurvivorBodyPrefab orig, Xoroshiro128Plus rng, NetworkUser networkUser, bool allowHidden) { if (_config.EnableRefightilization && _config.OverrideMetamorphosis && new StackFrame(6).GetMethod().Name == "RefightRespawn") { return currEnemyWhitelist[Random.Range(0, currEnemyWhitelist.Count - 1)]; } return orig.Invoke(rng, networkUser, allowHidden); } private bool CharacterMaster_IsDeadAndOutOfLivesServer(orig_IsDeadAndOutOfLivesServer orig, CharacterMaster self) { if (_config.EnableRefightilization) { PlayerStorage playerStorage = FindPlayerStorage(self); if (playerStorage != null && playerStorage.isDead) { return true; } } return orig.Invoke(self); } private void Run_BeginGameOver(orig_BeginGameOver orig, Run self, GameEndingDef gameEndingDef) { //IL_001e: 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) if (!_config.EnableRefightilization || _config.EndGameWhenEverybodyDead) { ((MonoBehaviour)this).StopCoroutine(RespawnCheck()); ResetPrefabs(); orig.Invoke(self, gameEndingDef); } } private void InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer(orig_OnWaveAllEnemiesDefeatedServer orig, InfiniteTowerRun self, InfiniteTowerWaveController wc) { foreach (PlayerStorage item in playerStorage) { if (item == null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Player is null! Continuing."); } else if (item.isDead) { item.master.TrueKill(); } } orig.Invoke(self, wc); } private void SetupLang() { _language = new RefightilizationLanguage(); } private void SetupPlayers(bool StageUpdate = true) { //IL_018a: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Setting up players..."); if (StageUpdate) { this.playerStorage.Clear(); } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (this.playerStorage != null && (Object)(object)instance.networkUser == (Object)null) { continue; } if (!StageUpdate && this.playerStorage != null) { bool flag = false; foreach (PlayerStorage item in this.playerStorage) { if ((Object)(object)item.master == (Object)(object)instance.master) { flag = true; break; } } if (flag) { continue; } } PlayerStorage playerStorage = new PlayerStorage(); if (Object.op_Implicit((Object)(object)instance.networkUser)) { playerStorage.user = instance.networkUser; } if (Object.op_Implicit((Object)(object)instance.master)) { playerStorage.master = instance.master; } if (Object.op_Implicit((Object)(object)instance.master.bodyPrefab)) { playerStorage.origPrefab = instance.master.bodyPrefab; } if (Object.op_Implicit((Object)(object)instance.master.inventory)) { playerStorage.blacklistedInventory = new int[ItemCatalog.itemCount]; } this.playerStorage.Add(playerStorage); ((BaseUnityPlugin)this).Logger.LogDebug((object)(playerStorage.user.userName + " added to PlayerStorage!")); } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Setting up players finished."); if (!StageUpdate) { ((MonoBehaviour)this).StartCoroutine(RespawnCheck(new Vector3(0f, 0f, 0f), respawnTime)); } } private IEnumerator RespawnCheck(Vector3 deathPos = default(Vector3), float waitTime = 1f) { //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) ((BaseUnityPlugin)this).Logger.LogDebug((object)("Respawn called! Waiting " + waitTime + " seconds!")); yield return (object)new WaitForSeconds(waitTime); if (!Object.op_Implicit((Object)(object)Run.instance) || !((Behaviour)Run.instance).isActiveAndEnabled) { yield break; } if (!_config.EnableRefightilization) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Nevermind. Mod is disabled via config."); yield break; } if (_config.NoRespawnsAfterTeleporter && Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && TeleporterInteraction.instance.isCharged) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Respawning after teleporter is disabled!"); yield break; } if (_config.DisableMoon && moonDisabled) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Respawn prevented due to current stage."); yield break; } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Checking players..."); bool flag = true; if (playerStorage == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"PlayerStorage is null!"); yield break; } foreach (PlayerStorage item in playerStorage) { if (item == null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Player doesn't exist! Skipping..."); playerStorage.Remove(item); RespawnCheck(deathPos, waitTime); yield break; } if (item.master.IsDeadAndOutOfLivesServer() && !item.isLoggedOut && (!Object.op_Implicit((Object)(object)item.master.GetBody()) || (Object.op_Implicit((Object)(object)item.master.GetBody()) && !item.master.GetBody().healthComponent.alive))) { ((BaseUnityPlugin)this).Logger.LogDebug((object)(item.user.userName + " passed spawn check!")); if (!item.isDead) { item.isDead = true; } item.master.teamIndex = _config.RespawnTeam; respawnLoops = 0; RefightRespawn(item.master, deathPos); } else { ((BaseUnityPlugin)this).Logger.LogDebug((object)(item.user.userName + " failed spawn check.")); if (!item.isDead) { flag = false; } } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Checking players complete."); if (flag && (!((Object)(object)TeleporterInteraction.instance != (Object)null) || !TeleporterInteraction.instance.isInFinalSequence) && _config.EndGameWhenEverybodyDead) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Everybody is dead. Forcibly ending the game."); ResetPrefabs(); Run.instance.BeginGameOver(GameEndings.StandardLoss); } } private void RefightRespawn(CharacterMaster player, Vector3 deathPos) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Expected O, but got Unknown //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Invalid comparison between Unknown and I4 //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Attempting player respawn!"); respawnLoops++; if (respawnLoops > 99) { ((BaseUnityPlugin)this).Logger.LogError((object)"INFINITE LOOP CAUGHT! Please file a bug report for Refightilization! This is not intended behavior."); return; } if ((Object)(object)player == (Object)null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Player is null!? Aborting Respawn."); return; } if ((Object)(object)player.playerCharacterMasterController.networkUser == (Object)null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Player doesn't have a networkUser!? Aborting Respawn."); return; } if (FindPlayerStorage(player).giftedAffix) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Yoinking that Affix."); player.inventory.SetEquipmentIndex(FindPlayerStorage(player).previousEquipment); FindPlayerStorage(player).giftedAffix = false; } List<GameObject> list = currEnemyWhitelist; if (Util.CheckRoll(5f, player.playerCharacterMasterController.master) && currSpecialEnemyWhitelist.Count >= 1) { list = new List<GameObject>(currSpecialEnemyWhitelist); } if (Util.CheckRoll(0.1f, player.playerCharacterMasterController.master) && finalBossWhitelist.Count >= 1) { list = new List<GameObject>(finalBossWhitelist); } if (_config.NoRepeatRespawns && list.Count > 1) { list.Remove(list.Where((GameObject entity) => ((Object)entity).name == ((Object)player.bodyPrefab).name).FirstOrDefault()); } GameObject val = list[Random.Range(0, list.Count - 1)]; ((BaseUnityPlugin)this).Logger.LogDebug((object)("Found body " + ((Object)val).name + ".")); TakeBlacklistedItems(player); if (Object.op_Implicit((Object)(object)player.bodyPrefab) && Object.op_Implicit((Object)(object)val)) { player.bodyPrefab = val; ((BaseUnityPlugin)this).Logger.LogDebug((object)(player.playerCharacterMasterController.networkUser.userName + " was assigned to " + ((Object)player.bodyPrefab).name + ".")); Vector3 val2 = deathPos; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor((float)Random.Range(-5, 5), (float)Random.Range(-5, 5), (float)Random.Range(-2, 2)); Random r = new Random(); foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController.instances.OrderBy((PlayerCharacterMasterController x) => r.Next())) { if (!item.master.IsDeadAndOutOfLivesServer() && (Object)(object)item.master != (Object)null) { val2 = ((Component)item.master).transform.position + val3; break; } } if (val2 == deathPos && Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { val2 = ((Component)TeleporterInteraction.instance).transform.position + val3; } player.Respawn(GrabNearestNodePosition(val2), Quaternion.identity, false); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Respawned " + player.playerCharacterMasterController.networkUser.userName + "!")); CharacterBody body = player.GetBody(); body.baseMaxHealth *= _config.RespawnHealthMultiplier; CharacterBody body2 = player.GetBody(); body2.baseDamage *= _config.RespawnDamageMultiplier; if (Object.op_Implicit((Object)(object)((Component)player.GetBody()).GetComponent<DeathRewards>())) { DeathRewards component = ((Component)player.GetBody()).GetComponent<DeathRewards>(); component.goldReward *= (uint)_config.RespawnMoneyMultiplier; } player.GetBody().baseRegen = 1f; player.GetBody().levelRegen = 0.2f; ((BaseUnityPlugin)this).Logger.LogDebug((object)"Applied stats."); if (!Object.op_Implicit((Object)(object)((Component)player.GetBody()).GetComponent<InteractionDriver>())) { ((Component)player.GetBody()).gameObject.AddComponent<InteractionDriver>(); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Granting an interaction driver."); } if (Object.op_Implicit((Object)(object)((Component)player.GetBody()).GetComponent<Interactor>())) { Interactor component2 = ((Component)player.GetBody()).GetComponent<Interactor>(); Bounds bounds = ((Renderer)((Component)player.GetBody().modelLocator.modelTransform).GetComponent<CharacterModel>().mainSkinnedMeshRenderer).bounds; Vector3 val4 = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)player.GetBody().modelLocator).transform.localScale); float maxInteractionDistance = Mathf.Max(Mathf.Max(val4.x, val4.y), val4.z); component2.maxInteractionDistance = maxInteractionDistance; if (player.GetBody().isFlying) { component2.maxInteractionDistance *= 1.5f; } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Modifying interaction distance."); } ChangeMinionsTeam(player); player.GetBody().AddTimedBuff(Buffs.ArmorBoost, 15f); player.GetBody().AddTimedBuff(Buffs.CloakSpeed, 30f); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Applied buffs."); if (_config.RespawnAffixEnabled && (Util.CheckRoll(_config.RespawnAffixChance, player.playerCharacterMasterController.master) || RunArtifactManager.instance.IsArtifactEnabled(Artifacts.eliteOnlyArtifactDef))) { if ((int)player.inventory.GetEquipmentIndex() != -1 && !_config.ForceGrantAffix) { return; } if (_config.ForceGrantAffix) { FindPlayerStorage(player).previousEquipment = player.inventory.GetEquipmentIndex(); } int index = Random.Range(0, currEliteWhitelist.Count - 1); player.inventory.SetEquipmentIndex(currEliteWhitelist[index]); FindPlayerStorage(player).giftedAffix = _config.TakeAffix; ((BaseUnityPlugin)this).Logger.LogDebug((object)"Gifted affix."); } player.preventGameOver = false; respawnLoops = 0; if (_config.AnnounceRespawns) { string text = _language.ReviveMessages[Random.Range(0, _language.ReviveMessages.Count - 1)]; text = text.Replace("{0}", player.playerCharacterMasterController.networkUser.userName); text = text.Replace("{1}", player.GetBody().GetDisplayName()); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cWorldEvent><sprite name=\"Skull\" tint=1> " + text + " <sprite name=\"Skull\" tint=1></style>" }); } } else { ((BaseUnityPlugin)this).Logger.LogDebug((object)(player.playerCharacterMasterController.networkUser.userName + " has no bodyPrefab!? Retrying...")); RefightRespawn(player, deathPos); } } private void ResetPrefabs() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Resetting player prefabs..."); if (playerStorage == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"PlayerStorage is null!"); return; } foreach (PlayerStorage item in playerStorage) { if (item == null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Player is null! Continuing."); continue; } if (item.isDead) { CleanPlayer(item); } ((BaseUnityPlugin)this).Logger.LogDebug((object)(item.user.userName + "'s prefab reset.")); } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Reset player prefabs!"); } private void CleanPlayer(PlayerStorage player) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) player.master.bodyPrefab = player.origPrefab; player.master.teamIndex = (TeamIndex)1; ChangeMinionsTeam(player.master); if (player.giftedAffix) { player.master.inventory.SetEquipmentIndex(player.previousEquipment); player.giftedAffix = false; } ((MonoBehaviour)this).StartCoroutine(ReturnBlacklistedItemsWait(player.master, 1f)); player.isDead = false; } private void ChangeMinionsTeam(CharacterMaster player) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!_config.ChangeMinionsTeam) { return; } MinionGroup val = null; for (int i = 0; i < MinionGroup.instancesList.Count; i++) { MinionGroup val2 = MinionGroup.instancesList[i]; if (MinionGroup.instancesList[i].ownerId == ((NetworkBehaviour)player).netId) { val = val2; break; } } if (val == null) { return; } MinionOwnership[] members = val.members; foreach (MinionOwnership val3 in members) { if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)((Component)val3).GetComponent<CharacterMaster>())) { ((Component)val3).GetComponent<CharacterMaster>().teamIndex = player.teamIndex; if (Object.op_Implicit((Object)(object)((Component)val3).GetComponent<CharacterMaster>().GetBody())) { ((Component)val3).GetComponent<CharacterMaster>().GetBody().teamComponent.teamIndex = player.teamIndex; } ((BaseUnityPlugin)this).Logger.LogDebug((object)("Changed " + ((Object)((Component)val3).GetComponent<CharacterMaster>()).name + "'s team.")); } } } private void UpdateStageWhitelist() { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Updating the stage whitelist."); currEnemyWhitelist.Clear(); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Whitelist cleared."); if (_config.EnableFixedPool) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Fixed pool is enabled."); string[] fixedPool = _config.FixedPool; foreach (string text in fixedPool) { currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab(text)); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Adding " + text + " to the currWhitelist.")); } } else if ((Object)(object)ClassicStageInfo.instance == (Object)null || ClassicStageInfo.instance.monsterSelection == null || ClassicStageInfo.instance.monsterSelection.choices == null) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"There is no available monster selection!"); if (Object.op_Implicit((Object)(object)VoidRaidGauntletController.instance)) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Void raid detected! Forcing monster selection..."); currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab("NullifierBody")); currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab("VoidJailerBody")); currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab("VoidMegaCrabBody")); } } else { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Selection isn't null."); foreach (ChoiceInfo<DirectorCard> item in ClassicStageInfo.instance.monsterSelection.choices.ToList()) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Testing choice."); if (item.value == null) { continue; } SpawnCard spawnCard = item.value.spawnCard; if ((Object)(object)spawnCard == (Object)null) { continue; } GameObject val = BodyCatalog.FindBodyPrefab(((Object)spawnCard.prefab).name.Replace("Master", "Body")); if ((Object)(object)val == (Object)null) { continue; } ((BaseUnityPlugin)this).Logger.LogDebug((object)("We have found " + ((Object)val).name + ".")); if ((!_config.AllowBosses || Run.instance.loopClearCount < _config.BossRequiredLoopCount) && val.GetComponent<CharacterBody>().isChampion) { if (_config.AllowBosses) { currSpecialEnemyWhitelist.Add(val); } } else if (((_config.AllowScavengers && Run.instance.loopClearCount >= _config.ScavangerRequiredLoopCount) || !(((Object)val).name == "ScavengerBody")) && !CheckBlacklist(((Object)val).name)) { currEnemyWhitelist.Add(val); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Adding " + ((Object)val).name + " to the currWhitelist.")); } } } finalBossWhitelist.Add(BodyCatalog.FindBodyPrefab("BrotherBody")); finalBossWhitelist.Add(BodyCatalog.FindBodyPrefab("MiniVoidRaidCrabBodyBase")); finalBossWhitelist.Add(BodyCatalog.FindBodyPrefab("FalseSonBossBody")); if (currEnemyWhitelist.Count <= 0) { ((BaseUnityPlugin)this).Logger.LogDebug((object)"No enemies were found, pulling out the backup enemies."); string[] fixedPool = _config.FixedPool; foreach (string text2 in fixedPool) { currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab(text2)); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Adding " + text2 + " to the currWhitelist.")); } if (currEnemyWhitelist.Count <= 0) { currEnemyWhitelist.Add(BodyCatalog.FindBodyPrefab("LemurianBody")); } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Done updating Whitelist."); } private void UpdateEliteWhitelist() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Updating the Elite whitelist."); if (CombatDirector.instancesList == null && (Object)(object)CombatDirector.instancesList[0] == (Object)null) { return; } currEliteWhitelist.Clear(); EliteTierDef[] eliteTiers = CombatDirector.eliteTiers; if (eliteTiers == null || eliteTiers.Length == 0) { return; } for (int i = 0; i < eliteTiers.Length; i++) { if (!eliteTiers[i].isAvailable((EliteRules)0) && !eliteTiers[i].isAvailable((EliteRules)2)) { continue; } for (int j = 0; j < eliteTiers[i].eliteTypes.Length; j++) { if (!((Object)(object)eliteTiers[i].eliteTypes[j] == (Object)null) && !((Object)(object)eliteTiers[i].eliteTypes[j].eliteEquipmentDef == (Object)null) && !((Object)(object)eliteTiers[i].eliteTypes[j].eliteEquipmentDef.pickupIconSprite == (Object)null)) { currEliteWhitelist.Add(eliteTiers[i].eliteTypes[j].eliteEquipmentDef.equipmentIndex); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Added " + eliteTiers[i].eliteTypes[j].eliteEquipmentDef.nameToken + " to the pool.")); } } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Done updating Whitelist."); } private Vector3 GrabNearestNodePosition(Vector3 startPos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeIndex val = groundNodes.FindClosestNode(startPos, (HullClassification)2, float.PositiveInfinity); NodeGraphSpider val2 = new NodeGraphSpider(groundNodes, (HullMask)4); val2.AddNodeForNextStep(val); List<StepInfo> list = new List<StepInfo>(); int num = 0; List<StepInfo> collectedSteps = val2.collectedSteps; while (val2.PerformStep() && num < 8) { num++; for (int i = 0; i < collectedSteps.Count; i++) { list.Add(collectedSteps[i]); } collectedSteps.Clear(); } Vector3 result = default(Vector3); groundNodes.GetNodePosition(list[Random.Range(0, list.Count - 1)].node, ref result); return result; } private bool CheckBlacklist(string name) { bool result = false; string[] blacklistedEnemies = _config.BlacklistedEnemies; foreach (string text in blacklistedEnemies) { if (name == text) { result = true; break; } } return result; } private PlayerStorage FindPlayerStorage(CharacterMaster cMaster) { foreach (PlayerStorage item in playerStorage) { if ((Object)(object)item.master == (Object)(object)cMaster) { return item; } } return null; } private void UpdateBlacklistedItems() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Updating the Item blacklist."); currItemBlacklist = new List<ItemIndex>(); string[] blacklistedItems = _config.BlacklistedItems; foreach (string text in blacklistedItems) { ItemIndex val = ItemCatalog.FindItemIndex(text); if ((int)val != -1) { currItemBlacklist.Add(val); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Added " + ((object)(ItemIndex)(ref val)).ToString() + "|" + text + " to the pool.")); } else { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Couldn't find " + text + ".")); } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Done updating Blacklist."); } private void TakeBlacklistedItems(CharacterMaster player) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005b: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Taking blacklisted items."); PlayerStorage playerStorage = FindPlayerStorage(player); foreach (ItemIndex item in currItemBlacklist) { ItemIndex current = item; if (player.inventory.itemStacks[current] != 0) { playerStorage.blacklistedInventory[current] = player.inventory.itemStacks[current]; player.inventory.RemoveItem(current, player.inventory.itemStacks[current]); ItemTransferOrb.DispatchItemTransferOrb(player.GetBody().footPosition, player.inventory, current, 0, (Action<ItemTransferOrb>)WhyDoActionsDoSillySillyThings, default(Either<NetworkIdentity, HurtBox>)); ((BaseUnityPlugin)this).Logger.LogDebug((object)("Took away an item at " + ((object)(ItemIndex)(ref current)).ToString())); } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Done checking for blacklisted items."); } private IEnumerator ReturnBlacklistedItemsWait(CharacterMaster player, float time) { yield return (object)new WaitForSeconds(time); ReturnBlacklistedItems(player); } private void ReturnBlacklistedItems(CharacterMaster player) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogDebug((object)"Giving blacklisted items."); PlayerStorage playerStorage = FindPlayerStorage(player); foreach (ItemIndex item in currItemBlacklist) { ItemIndex current = item; if (playerStorage.blacklistedInventory[current] != 0) { ItemTransferOrb.DispatchItemTransferOrb(player.GetBody().footPosition, player.inventory, current, playerStorage.blacklistedInventory[current], (Action<ItemTransferOrb>)null, default(Either<NetworkIdentity, HurtBox>)); playerStorage.blacklistedInventory[current] = 0; ((BaseUnityPlugin)this).Logger.LogDebug((object)("Gave an item at " + ((object)(ItemIndex)(ref current)).ToString())); } } ((BaseUnityPlugin)this).Logger.LogDebug((object)"Done checking for blacklisted items."); } } internal class RefightilizationConfig { private readonly ConfigEntry<bool> _enableRefightilization; private readonly ConfigEntry<bool> _allowBosses; private readonly ConfigEntry<bool> _allowScavengers; private readonly ConfigEntry<string> _blacklistedEnemies; private readonly ConfigEntry<int> _bossRequiredLoopCount; private readonly ConfigEntry<int> _scavangerRequiredLoopCount; private readonly ConfigEntry<bool> _enableFixedPool; private readonly ConfigEntry<string> _fixedPool; private readonly ConfigEntry<float> _respawnDelay; private readonly ConfigEntry<TeamIndex> _respawnTeam; private readonly ConfigEntry<float> _respawnHealthMultiplier; private readonly ConfigEntry<float> _respawnDamageMultiplier; private readonly ConfigEntry<float> _respawnMoneyMultiplier; private readonly ConfigEntry<bool> _respawnAffixEnabled; private readonly ConfigEntry<float> _respawnAffixChance; private readonly ConfigEntry<float> _additionalRespawnTime; private readonly ConfigEntry<bool> _noRespawnsAfterTeleporter; private readonly ConfigEntry<bool> _noRepeatRespawns; private readonly ConfigEntry<bool> _itemPickupToggle; private readonly ConfigEntry<bool> _takeAffix; private readonly ConfigEntry<bool> _forceGrantAffix; private readonly ConfigEntry<string> _blacklistedItems; private readonly ConfigEntry<bool> _murderRevive; private readonly ConfigEntry<float> _murderWindow; private readonly ConfigEntry<bool> _announceRespawns; private readonly ConfigEntry<bool> _disableMoon; private readonly ConfigEntry<bool> _overrideMetamorphosis; private readonly ConfigEntry<bool> _changeMinionsTeam; private readonly ConfigEntry<bool> _endGameWhenEverybodyDead; private readonly ConfigEntry<int> _maxRespawnTries; private readonly ConfigEntry<string> _preventPrefabResetMethods; public bool EnableRefightilization => _enableRefightilization.Value; public bool AllowBosses => _allowBosses.Value; public bool AllowScavengers => _allowScavengers.Value; public string[] BlacklistedEnemies => _blacklistedEnemies.Value.Replace(" ", "").Split(','); public int BossRequiredLoopCount => _bossRequiredLoopCount.Value; public int ScavangerRequiredLoopCount => _scavangerRequiredLoopCount.Value; public bool EnableFixedPool => _enableFixedPool.Value; public string[] FixedPool => _fixedPool.Value.Replace(" ", "").Split(','); public float RespawnDelay => _respawnDelay.Value; public TeamIndex RespawnTeam => _respawnTeam.Value; public float RespawnHealthMultiplier => _respawnHealthMultiplier.Value; public float RespawnDamageMultiplier => _respawnDamageMultiplier.Value; public float RespawnMoneyMultiplier => _respawnMoneyMultiplier.Value; public bool RespawnAffixEnabled => _respawnAffixEnabled.Value; public float RespawnAffixChance => _respawnAffixChance.Value; public float AdditionalRespawnTime => _additionalRespawnTime.Value; public bool NoRespawnsAfterTeleporter => _noRespawnsAfterTeleporter.Value; public bool NoRepeatRespawns => _noRepeatRespawns.Value; public bool ItemPickupToggle => _itemPickupToggle.Value; public bool TakeAffix => _takeAffix.Value; public bool ForceGrantAffix => _forceGrantAffix.Value; public string[] BlacklistedItems => _blacklistedItems.Value.Replace(" ", "").Split(','); public bool MurderRevive => _murderRevive.Value; public float MurderWindow => _murderWindow.Value; public bool AnnounceRespawns => _announceRespawns.Value; public bool DisableMoon => _disableMoon.Value; public bool OverrideMetamorphosis => _overrideMetamorphosis.Value; public bool ChangeMinionsTeam => _changeMinionsTeam.Value; public bool EndGameWhenEverybodyDead => _endGameWhenEverybodyDead.Value; public int MaxRespawnTries => _maxRespawnTries.Value; public string[] PreventPrefabResetMethods => _preventPrefabResetMethods.Value.Replace(" ", "").Split(','); public RefightilizationConfig(ConfigFile config) { _enableRefightilization = config.Bind<bool>("Master", "EnableRefightilization", true, "Enables/Disables the entire mod."); _allowBosses = config.Bind<bool>("Monster Categories", "AllowBosses", true, "Allows players to spawn as bosses."); _allowScavengers = config.Bind<bool>("Monster Categories", "AllowScavengers", false, "Allows players to spawn as Scavengers."); _blacklistedEnemies = config.Bind<string>("Monster Categories", "BlacklistedEnemies", "BeetleBody, JellyfishBody, WispBody, MinorConstructBody, VoidBarnacleBody, ClayBossBody", "Sets monsters to prevent players from spawning as. A list of bodies can be grabbed by using body_list in the console."); _bossRequiredLoopCount = config.Bind<int>("Monster Categories", "BossRequiredLoopCount", 2, "The required amount of loops before a player can spawn as a boss."); _scavangerRequiredLoopCount = config.Bind<int>("Monster Categories", "ScavangerRequiredLoopCount", 5, "The required amount of loops before a player can spawn as a scavanger."); _enableFixedPool = config.Bind<bool>("Monster Categories", "EnableFixedPool", false, "Forces players to respawn from a pre-defined list of monsters, instead of the current stage's monsters."); _fixedPool = config.Bind<string>("Monster Categories", "FixedPool", "LemurianBody", "Provides a fixed list of monsters that the player could spawn as with EnableFixedPool enabled. This list will also be used if there are no available monsters to spawn as."); _respawnDelay = config.Bind<float>("Respawn Settings", "RespawnDelay", 5f, "Sets the delay until the player can respawn."); _respawnTeam = config.Bind<TeamIndex>("Respawn Settings", "RespawnTeam", (TeamIndex)0, "Sets the team of the respawned players."); _respawnHealthMultiplier = config.Bind<float>("Respawn Settings", "RespawnHealthMultiplier", 1.1f, "Multiplies the health a player spawns with."); _respawnDamageMultiplier = config.Bind<float>("Respawn Settings", "RespawnDamageMultiplier", 5f, "Multiplies the damage a player spawns with."); _respawnMoneyMultiplier = config.Bind<float>("Respawn Settings", "RespawnMoneyMultiplier", 1.1f, "Multiplies the money rewarded for killing a player."); _respawnAffixEnabled = config.Bind<bool>("Respawn Settings", "RespawnAffixEnabled", true, "Allows players to spawn with affixes if they have an empty equipment slot."); _respawnAffixChance = config.Bind<float>("Respawn Settings", "RespawnAffixChance", 60f, "Sets the chance that a respawned player will have an affix."); _additionalRespawnTime = config.Bind<float>("Respawn Settings", "AdditionalRespawnTime", 0.2f, "Sets how much respawn time will increase per player death. This will effect everyone."); _noRespawnsAfterTeleporter = config.Bind<bool>("Respawn Settings", "NoRespawnsAfterTeleporter", true, "Disables respawning after the Teleporter event concludes."); _noRepeatRespawns = config.Bind<bool>("Respawn Settings", "NoRepeatRespawns", true, "Will attempt to prevent the player from respawning as the same monster twice in a row."); _itemPickupToggle = config.Bind<bool>("Item Settings", "ItemPickupToggle", true, "Allows monster players to pick up items off the ground. (Disabling won't work if RespawnTeam is set to Player.)"); _takeAffix = config.Bind<bool>("Item Settings", "TakeAffix", true, "Will take away granted affixes upon respawning."); _forceGrantAffix = config.Bind<bool>("Item Settings", "ForceGrantAffix", false, "Will forcibly give the player an aspect, even if they have an equipment item."); _blacklistedItems = config.Bind<string>("Item Settings", "BlacklistedItems", "HealingPotion, FragileDamageBonus, LunarPrimaryReplacement, LunarSecondaryReplacement, LunarSpecialReplacement, LunarUtilityReplacement, Thorns, ExtraLife, ExtraLifeVoid, AncientScepterItem", "Will take away these items from monster players, returning them after they respawn."); _murderRevive = config.Bind<bool>("Behavior Settings", "MurderRevive", true, "Will respawn a dead player as a survivor if they kill another player."); _murderWindow = config.Bind<float>("Behavior Settings", "MurderWindow", 15f, "The amount of time that a player has after damaging a player to respawn as them."); _announceRespawns = config.Bind<bool>("Behavior Settings", "AnnounceRespawns", true, "Will announce a player respawning in the chat."); _disableMoon = config.Bind<bool>("Behavior Settings", "DisableMoon", true, "Prevents players from respawning in Commencement."); _overrideMetamorphosis = config.Bind<bool>("Behavior Settings", "OverrideMetamorphosis", true, "Allows Refightilization to override Artifact of Metamorphosis's behavior."); _changeMinionsTeam = config.Bind<bool>("Behavior Settings", "ChangeMinionsTeam", true, "Minions will have their team changed to match the player."); _endGameWhenEverybodyDead = config.Bind<bool>("Debug", "EndGameWhenEverybodyDead", true, "Ends the round when everybody is dead. (Keep this on.)"); _maxRespawnTries = config.Bind<int>("Debug", "MaxRespawnTries", 5, "The maximum attempts the game will make to retry spawning a player."); _preventPrefabResetMethods = config.Bind<string>("Debug", "PreventPrefabResetMethods", "SwapCharacters, RevertCharacter, CCSpawnAs", "Manually set methods to not be affected by Refight's BodyPrefab-Resetting behavior. (Don't touch this unless you know what you're doing.)"); } public void BuildRiskOfOptionsMenu() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0088: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00fe: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown byte[] array = File.ReadAllBytes(Assembly.GetExecutingAssembly().Location.Replace("Refightilization.dll", "") + "icon.png"); Texture2D val = new Texture2D(256, 256); ImageConversion.LoadImage(val, array); ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero)); ModSettingsManager.SetModDescriptionToken("REFIGHT_MOD_DESCRIPTION"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_enableRefightilization)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_allowBosses)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_allowScavengers)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_blacklistedEnemies)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_bossRequiredLoopCount)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_scavangerRequiredLoopCount)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_enableFixedPool)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_fixedPool)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_respawnDelay, new StepSliderConfig { min = 0f, max = 60f, increment = 1f })); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)_respawnTeam)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_respawnHealthMultiplier, new StepSliderConfig { min = 0f, max = 2f, increment = 0.1f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_respawnDamageMultiplier, new StepSliderConfig { min = 0f, max = 10f, increment = 0.2f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_respawnMoneyMultiplier, new StepSliderConfig { min = 0f, max = 2f, increment = 0.1f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_respawnAffixEnabled)); ModSettingsManager.AddOption((BaseOption)new SliderOption(_respawnAffixChance)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_additionalRespawnTime, new StepSliderConfig { min = 0f, max = 2f, increment = 0.1f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_noRespawnsAfterTeleporter)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_noRepeatRespawns)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_itemPickupToggle)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_takeAffix)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_forceGrantAffix)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_blacklistedItems)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_murderRevive)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(_murderWindow, new StepSliderConfig { min = 1f, max = 60f, increment = 1f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_announceRespawns)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_disableMoon)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_overrideMetamorphosis)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_changeMinionsTeam)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_endGameWhenEverybodyDead)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_maxRespawnTries)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_preventPrefabResetMethods, new InputFieldConfig { restartRequired = true })); } } internal class RefightilizationLanguage { public List<string> ReviveMessages { get; set; } public List<string> RevengeMessages { get; set; } public string ItemBlacklistWarning { get; set; } public string RiskOfOptionsDescription { get; set; } public RefightilizationLanguage() { ReviveMessages = new List<string>(); RevengeMessages = new List<string>(); ItemBlacklistWarning = "{0}'s {1} will be returned, later."; string text = Language.currentLanguageName; StreamReader streamReader = new StreamReader(File.Open(Assembly.GetExecutingAssembly().Location.Replace("Refightilization.dll", "") + "LanguageResource.json", FileMode.Open, FileAccess.Read), Encoding.Unicode); JSONNode val = JSON.Parse(streamReader.ReadToEnd()); if (val[text] == (object)null) { text = "en"; } ConvertArrayToStringList(val[text]["reviveMessages"].AsArray, ReviveMessages); ConvertArrayToStringList(val[text]["revengeMessages"].AsArray, RevengeMessages); ItemBlacklistWarning = JSONNode.op_Implicit(val[text]["itemBlacklistWarning"]); streamReader.Close(); } private void ConvertArrayToStringList(JSONArray input, List<string> output) { for (int i = 0; i < ((JSONNode)input).Count; i++) { output.Add(((JSONNode)input)[i].Value); } } } }