Please disclose if any significant portion of your mod was created 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 REPO Randomizer v1.0.5
Repo_Randomizer.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using On; using Photon.Pun; using Repo_Randomizer.NetcodePatcher; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("MMHOOK_Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: AssemblyCompany("bcs4313")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Corrupts the game! For better or for worse.")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+de30a7b4fd06f505c14721da353043ab3517b186")] [assembly: AssemblyProduct("Repo_Randomizer")] [assembly: AssemblyTitle("Repo_Randomizer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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; } } } public class ClockHook { public ClockHook() { Debug.Log((object)"Lethal Chaos: Hooking World Modifiers... "); } } public class CustomChaosPrefabPool : IPunPrefabPool { private GameObject chaosPrefab; public CustomChaosPrefabPool(GameObject prefab) { chaosPrefab = prefab; } public GameObject Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Object.Instantiate<GameObject>(chaosPrefab, position, rotation); } public void Destroy(GameObject go) { Object.Destroy((Object)(object)go); } } namespace LethalChaos.EntropySystem.Util { internal class Repo_Randomizer { private List<int> options; private Random rnd; } internal class PresetSystem { } } namespace Repo_Randomizer { public class EntityDestructionManager { public static List<GameObject> destroyOnLeave = new List<GameObject>(); public static List<GameObject> destroyOnFail = new List<GameObject>(); public EntityDestructionManager() { Debug.Log((object)"Lethal Chaos: Invoked Entity Destruction Manager"); } } public class entropyBlaster { public static Random r = new Random(); public static Transform btransform = new GameObject().transform; public static float nearestPlayerToCoordDistance(Vector3 position) { //IL_002c: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) try { List<PlayerAvatar> players = getPlayers(); float num = float.PositiveInfinity; foreach (PlayerAvatar item in players) { Vector3 val = ((Component)item).gameObject.transform.position - position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < num) { num = magnitude; } } return num; } catch (Exception ex) { Debug.LogError((object)("Lethal Chaos: nearestPlayerToCoordDistance method failure -> " + ex.ToString())); } return 0f; } public static PlayerAvatar nearestPlayerToCoord(Vector3 position) { //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_003b: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar result = null; try { List<PlayerAvatar> players = getPlayers(); float num = float.PositiveInfinity; foreach (PlayerAvatar item in players) { Vector3 val = ((Component)item).gameObject.transform.position - position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < num) { num = magnitude; result = item; } } return result; } catch (Exception ex) { Debug.LogError((object)("Lethal Chaos: nearestPlayerToCoord method failure -> " + ex.ToString())); } return result; } public static List<PlayerAvatar> getPlayers() { return GameDirector.instance.PlayerList; } public static Vector3 safeNodePosition(GameObject target, float inner_threshold, float outer_threshold) { //IL_0099: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_008a: 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_0050: Unknown result type (might be due to invalid IL or missing references) try { PlayerAvatar val = nearestPlayerToCoord(target.transform.position); PlayerAvatar component = ((Component)val).GetComponent<PlayerAvatar>(); LevelPoint val2 = SemiFunc.LevelPointGet(((Component)val).gameObject.transform.position, inner_threshold, outer_threshold); if (!Object.op_Implicit((Object)(object)val2)) { Debug.Log((object)"Repo Randomizer: SafeNodePosition GET failure"); return Vector3.zero; } Vector3 position = ((Component)val2).transform.position; Debug.Log((object)("Repo Randomizer: SafeNodePosition == " + ((object)(Vector3)(ref position)).ToString())); return ((Component)val2).transform.position; } catch (Exception ex) { Debug.LogError((object)ex); return Vector3.zero; } } public static Vector3 safeRandomizedPositionFlex(GameObject target, float inner_threshold, float outer_threshold, NavMeshHit navHit = default(NavMeshHit)) { //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0113: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); for (int i = 0; i < 5; i++) { GameObject gameObject = ((Component)nearestPlayerToCoord(target.transform.position)).gameObject; PlayerAvatar component = gameObject.GetComponent<PlayerAvatar>(); int num = 1; int num2 = 1; if (EntropyEngine.rnd.NextDouble() < 0.5) { num = -1; } if (EntropyEngine.rnd.NextDouble() < 0.5) { num2 = -1; } int num3 = 5; while (num3 > 0) { num3--; try { outer_threshold -= inner_threshold; float num4 = gameObject.transform.position.x + (inner_threshold + outer_threshold * (float)EntropyEngine.rnd.NextDouble()) * (float)num; float num5 = gameObject.transform.position.z + (inner_threshold + outer_threshold * (float)EntropyEngine.rnd.NextDouble()) * (float)num2; ((Vector3)(ref val))..ctor(num4, gameObject.transform.position.y, num5); if (NavMesh.SamplePosition(val, ref navHit, outer_threshold, -1) && avoidsAllPlayers(inner_threshold, ((NavMeshHit)(ref navHit)).position)) { return ((NavMeshHit)(ref navHit)).position; } } catch (Exception) { num3--; } } Debug.Log((object)"Lethal Chaos: Position Flex failed, trying safeRandomizedPosition"); } return safeNodePosition(target, inner_threshold, outer_threshold); } catch (Exception ex2) { Debug.LogError((object)ex2); return Vector3.zero; } } public static bool avoidsAllPlayers(float inner_threshold, Vector3 pos) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!Object.op_Implicit((Object)(object)player) || !Object.op_Implicit((Object)(object)((Component)player).gameObject) || !(Vector3.Distance(((Component)player).gameObject.transform.position, pos) < inner_threshold)) { continue; } return false; } return true; } public static void TEST1(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: EVENT 1:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); Plugin.rpcCalls.TEST(); } public static void spawnRandomEnemy(GameObject target, bool targetIsPlayer) { //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) //IL_001b: 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) try { Vector3 val = safeRandomizedPositionFlex(target, 0.5f, 2f); Debug.Log((object)"REPO Randomizer: spawnRandomEnemy:::"); EnemySetup[] array = Resources.FindObjectsOfTypeAll<EnemySetup>(); EnemySetup val2 = array[EntropyEngine.rnd.Next(0, array.Length)]; LevelGenerator.Instance.EnemySpawn(val2, val); } catch (Exception ex) { Debug.Log((object)("Repo Randomizer: Enemy Spawn Failure -> " + ex)); } } public static void spawnRandomItem(GameObject target, bool targetIsPlayer) { //IL_000e: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_008d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = safeRandomizedPositionFlex(target, 0.5f, 2f); try { List<ItemAttributes> spawnedItems = PunManager.instance.itemManager.spawnedItems; if (PunManager.instance.itemManager.spawnedItems.Count > 0) { ItemAttributes val2 = spawnedItems[EntropyEngine.rnd.Next(0, spawnedItems.Count)]; string text = "Items/" + ((Object)val2.item.prefab).name; if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(text, val, Quaternion.identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val2.item.prefab, val, Quaternion.identity); } } } catch (Exception ex) { Debug.LogError((object)ex); } } public static void randomForceApply(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: randomForceApply:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("applyForce", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void randomTumbleApply(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: randomTumbleApply:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("applyTumble", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void upgradeHealth(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeHealth:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("upgradeHealth", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void upgradeSprint(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeSprint:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("upgradeSprint", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void upgradeStrength(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeStrength:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("upgradeStrength", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void upgradeTumble(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeTumble:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("upgradeTumble", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void upgradeStamina(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeStamina:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("upgradeStamina", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void showLove(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: upgradeStamina:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("showLove", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void randomSound(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: random sound:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); AudioClip[] array = Resources.FindObjectsOfTypeAll<AudioClip>(); AudioClip val2 = array[EntropyEngine.rnd.Next(0, array.Length)]; if (Object.op_Implicit((Object)(object)val2)) { ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("soundPlay", (RpcTarget)0, new object[2] { val.photonView.ControllerActorNr, ((Object)val2).name }); } } public static void fastHeal(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: fastheal:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("fastHeal", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void fastDmg(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: fastdmg:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("fastDmg", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static async void falseDeath(GameObject target, bool targetIsPlayer) { Debug.Log((object)"REPO Randomizer: falseDeath :::"); PlayerAvatar player = nearestPlayerToCoord(target.transform.position); _ = player.playerHealth.health; player.PlayerDeathRPC(0); await Task.Delay(1000); player.ReviveRPC(false); player.playerReviveEffects.swirlParticle.Play(); } public static void glitchEffect(GameObject target, bool targetIsPlayer) { List<PlayerAvatar> players = getPlayers(); float num = float.PositiveInfinity; foreach (PlayerAvatar item in players) { item.PlayerGlitchShortRPC(); } } public static void tempPitchUp(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: tempPitchUp:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("tempPitchUp", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static void tempPitchDown(GameObject target, bool targetIsPlayer) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO Randomizer: tempPitchDown:::"); PlayerAvatar val = nearestPlayerToCoord(target.transform.position); ((MonoBehaviourPun)Plugin.rpcCalls).photonView.RPC("tempPitchDown", (RpcTarget)0, new object[1] { val.photonView.ControllerActorNr }); } public static GameObject FindPrefabWithComponent<T>(string resourcePath = "") where T : Component { GameObject[] array = Resources.LoadAll<GameObject>(resourcePath); GameObject[] array2 = array; foreach (GameObject val in array2) { if ((Object)(object)val.GetComponent<T>() != (Object)null) { return val; } } Debug.LogWarning((object)("No prefab found in Resources/" + resourcePath + " with component: " + typeof(T).Name)); return null; } public static void explosion(GameObject target, bool targetIsPlayer) { //IL_000e: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown Vector3 val = safeRandomizedPositionFlex(target, 0.5f, 5f); EnemyBang val2 = new EnemyBang(); val2.explosionScript = val2.particleScriptExplosion.Spawn(val2.enemy.CenterTransform.position, 1f, 30, 25, 2f, false, false, 1f); val2.explosionScript.HurtCollider.onImpactEnemy.AddListener(new UnityAction(val2.OnExplodeHitEnemy)); } public static async void explodeEnd(EnemyBang bang) { await Task.Delay(1000); Object.Destroy((Object)(object)bang); } } public class EntropyEngine { public static Random rnd = new Random(); public static bool SimultaneousOutcomes = false; public static float EventHookMultiplier = 1f; public static float EventChanceMultiplier = 0.4f; public static float EventChanceOffset = 0f; public static EntropyHost entropyHost; public static LightningHook lightninghook; public static ItemHooks itemhooks; public static PlayerHooks playerhooks; public static EnemyHooks enemyhooks; public static ClockHook modifierhook; public static PlanetResetHook resetHooks; public static EntityDestructionManager destructionManager = new EntityDestructionManager(); public static List<EntropyHost> hosts = new List<EntropyHost>(); public EntropyEngine() { Hooks(); } public static void LaunchEngine() { Debug.Log((object)"Lethal Chaos: Launching Entropy Engine..."); hosts.Clear(); hosts.Add(new EntropyHost("BASE")); } public static EntropyHost getMoonHost() { if (hosts.Count > 0) { return hosts[0]; } return new EntropyHost("None"); } public void Hooks() { lightninghook = new LightningHook(); itemhooks = new ItemHooks(); playerhooks = new PlayerHooks(); enemyhooks = new EnemyHooks(); modifierhook = new ClockHook(); resetHooks = new PlanetResetHook(); WorldModifiers.Hooks(); } } public class EntropyHost { public static int eventTotal = 17; private List<Event> events; public string planet; public WorldModifiers modifiers = new WorldModifiers(); private int it_randomizer_seed = EntropyEngine.rnd.Next(); public EventThrottler throttler = new EventThrottler(); public EntropyHost(string planet) { Debug.Log((object)"Lethal Chaos: New Entropy Host Launched."); events = new List<Event>(); for (int i = 0; i < eventTotal; i++) { Event @event = new Event(i); @event.printData(planet); this.planet = planet; events.Add(@event); } throttler = new EventThrottler(); } public void queueHook(string hookID, GameObject obj, bool isSelective, bool targetIsPlayer) { for (int i = 0; i < events.Count; i++) { Event @event = events[i]; if (!@event.hooksAttached.Contains(hookID) || !@event.runOutcome(hookID)) { continue; } if (EntropyEngine.SimultaneousOutcomes) { for (int j = 0; j < events.Count; j++) { Event event2 = events[j]; if (event2.hooksAttached.Contains(hookID)) { runEvent(event2.eventID, obj, isSelective, targetIsPlayer); } } } else { runEvent(events[i].eventID, obj, isSelective, targetIsPlayer); } } } public void runEvent(int method, GameObject obj, bool isSelective, bool playerOrigin) { try { Debug.Log((object)("running event: " + method + " to " + planet)); if (!PhotonNetwork.IsMasterClient) { Debug.Log((object)"block: is not hosting... Returning..."); return; } if (EntropyEngine.getMoonHost().planet.Equals("None")) { Debug.Log((object)"block: host is none. Returning..."); return; } switch (method) { case 0: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(0, 6, 1f, 0f)) { return; } entropyBlaster.spawnRandomItem(obj, playerOrigin); } break; case 1: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(1, 12, 0f, 0f)) { return; } entropyBlaster.randomForceApply(obj, playerOrigin); } break; case 2: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(2, 6, 0f, 1f)) { return; } entropyBlaster.spawnRandomEnemy(obj, playerOrigin); } break; case 3: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(3, 12, 0f, 0f)) { return; } entropyBlaster.randomTumbleApply(obj, playerOrigin); } break; case 4: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(4, 0, 0f, 0f)) { return; } if (EntropyEngine.rnd.NextDouble() < 0.05000000074505806) { entropyBlaster.upgradeHealth(obj, playerOrigin); } } break; case 5: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(5, 0, 0f, 0f)) { return; } if (EntropyEngine.rnd.NextDouble() < 0.05000000074505806) { entropyBlaster.upgradeSprint(obj, playerOrigin); } } break; case 6: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(6, 0, 0f, 0f)) { return; } if (EntropyEngine.rnd.NextDouble() < 0.05000000074505806) { entropyBlaster.upgradeStrength(obj, playerOrigin); } } break; case 7: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(7, 0, 0f, 0f)) { return; } if (EntropyEngine.rnd.NextDouble() < 0.05000000074505806) { entropyBlaster.upgradeTumble(obj, playerOrigin); } } break; case 8: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(8, 0, 0f, 0f)) { return; } if (EntropyEngine.rnd.NextDouble() < 0.05000000074505806) { entropyBlaster.upgradeStamina(obj, playerOrigin); } } break; case 9: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(9, 20, 0f, 0f)) { return; } entropyBlaster.showLove(obj, playerOrigin); } break; case 10: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(10, 25, 0f, 0f)) { return; } entropyBlaster.randomSound(obj, playerOrigin); } break; case 11: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(11, 3, 0f, 0f)) { return; } entropyBlaster.fastDmg(obj, playerOrigin); } break; case 12: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 15, 0f, 0f)) { return; } entropyBlaster.fastHeal(obj, playerOrigin); } break; case 13: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 3, 0f, 0f)) { return; } entropyBlaster.glitchEffect(obj, playerOrigin); } break; case 14: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 3, 0f, 0f)) { return; } entropyBlaster.tempPitchDown(obj, playerOrigin); } break; case 15: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 3, 0f, 0f)) { return; } entropyBlaster.tempPitchUp(obj, playerOrigin); } break; case 16: if (isSelective) { if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 3, 0f, 0f)) { return; } entropyBlaster.explosion(obj, playerOrigin); } break; } Object.Destroy((Object)(object)obj); } catch (Exception ex) { Debug.LogError((object)("Lethal Chaos: " + ex.ToString())); try { Object.Destroy((Object)(object)obj); } catch (Exception) { } } } public void addRandomOutcome() { Random random = new Random(); int index = random.Next(0, events.Count); Event @event = events[index]; int num = random.Next(0, @event.availableHooks.Length); @event.hooksAttached.Add(@event.availableHooks[num]); double num2 = random.NextDouble(); double num3 = random.NextDouble(); double num4 = random.NextDouble(); double num5 = random.NextDouble() + @event.implicitWeights[num]; @event.hookChances.Add(100.0 * num2 * num3 * num4 * num5); } } internal class Event { public int eventID; public string[] availableHooks = new string[9] { "SendChat", "Jump", "Death", "Tumble", "Crouch", "HealOther", "Slide", "Walk", "Sprint" }; public double[] implicitWeights = new double[9] { 4.0, 2.0, 100.0, 1.35, 1.35, 40.0, 2.0, 0.15, 0.2 }; public List<string> hooksAttached = new List<string>(); public List<double> hookChances = new List<double>(); private bool forceEvent = false; private int forceValue = 28; private Random rnd = EntropyEngine.rnd; public Event(int eventID) { this.eventID = eventID; double num = 5.0; try { num *= (double)(EntropyEngine.EventHookMultiplier * getUniqueMult(eventID)); } catch { Debug.LogError((object)"LethalChaos: error parsing EventHookMultiplier setting! Check to see if the setting is a decimal value!"); } for (int i = 0; i < availableHooks.Length; i++) { double num2 = rnd.NextDouble() * 100.0; if (num2 < num) { hooksAttached.Add(availableHooks[i]); double num3 = rnd.NextDouble(); double num4 = implicitWeights[i]; float num5 = EntropyEngine.EventChanceMultiplier * getUniqueMult(eventID); float eventChanceOffset = EntropyEngine.EventChanceOffset; hookChances.Add(Math.Min(Math.Min(100.0 * num3 * num4, 100.0) * (double)num5, 100.0) + (double)eventChanceOffset); } } if (forceEvent && this.eventID == forceValue) { int num6 = 0; try { num6 = (int)Math.Round(rnd.NextDouble() * (double)availableHooks.Length) - 1; hooksAttached.Add(availableHooks[num6]); } catch { return; } double num7 = rnd.NextDouble(); double num8 = implicitWeights[num6]; float eventChanceMultiplier = EntropyEngine.EventChanceMultiplier; float eventChanceOffset2 = EntropyEngine.EventChanceOffset; hookChances.Add(Math.Min(Math.Min(100.0 * num7 * num8, 100.0) * (double)eventChanceMultiplier, 100.0) + (double)eventChanceOffset2); } } public static float getUniqueMult(int eventID) { return 1f; } public bool runOutcome(string hook) { int num = -1; for (int i = 0; i < hooksAttached.Count; i++) { if (hooksAttached[i].Equals(hook)) { num = i; break; } } if (num == -1) { return false; } double num2 = hookChances[num]; return rnd.NextDouble() * 100.0 < num2; } public void printData(string planet) { Debug.Log((object)("Data for ID: " + eventID + " :: " + planet)); Debug.Log((object)"Hooks - "); for (int i = 0; i < hooksAttached.Count; i++) { Debug.Log((object)("-> " + hooksAttached[i] + " -- Chance: " + hookChances[i])); } } } public class EnemyHooks { public EnemyHooks() { Debug.Log((object)"Lethal Chaos: Hooking Enemy Interactions..."); } } public class ItemHooks { public ItemHooks() { Debug.Log((object)"Lethal Chaos: Hooking Items..."); } } public class LightningHook { public LightningHook() { Debug.Log((object)"Lethal Chaos: Hooking Lightning Bolts..."); } } public class PlanetResetHook { public void linkEngineToScene() { Debug.Log((object)"Repo Randomizer: Link Engine Call..."); if (!Object.op_Implicit((Object)(object)Plugin.ChaosHostRef)) { Plugin.ChaosHostRef = Plugin.Assets.MainAssetBundle.LoadAsset<GameObject>("ChaosHost"); IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null && !val.ResourceCache.ContainsKey("ChaosHost")) { val.ResourceCache.Add("ChaosHost", Plugin.ChaosHostRef); Plugin.LogDebug("Injected ChaosHost into REPO's existing prefab pool."); } } } public void StartHost() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) try { if (PhotonNetwork.IsMasterClient) { if (Object.op_Implicit((Object)(object)Plugin.ChaosHost)) { Debug.Log((object)"REPO Chaos: Destroying existing Chaos Host"); Object.Destroy((Object)(object)Plugin.ChaosHost); } Plugin.ChaosHost = PhotonNetwork.Instantiate("ChaosHost", Vector3.zero, Quaternion.identity, (byte)0, (object[])null); Plugin.rpcCalls = Plugin.ChaosHost.GetComponent<LethalNet>(); Debug.Log((object)"REPO Chaos: Created Chaos Host (Networking)"); } } catch (Exception ex) { Debug.LogError((object)("CHAOS HOST INITIALIZATION ERROR: " + ex)); } } public PlanetResetHook() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown LoadingUI.StartLoading += (hook_StartLoading)delegate(orig_StartLoading orig, LoadingUI self) { orig.Invoke(self); Debug.Log((object)"STARTLOADING"); try { Debug.Log((object)"Repo Randomizer: Resetting Entropy Engine"); EntropyEngine.EventHookMultiplier = Plugin.levelOfChaos.Value + Plugin.chaosRamp.Value * (float)RunManager.instance.levelsCompleted; EntropyEngine.EventChanceMultiplier = Plugin.randomOutcomeMultiplier.Value; linkEngineToScene(); EntropyEngine.LaunchEngine(); } catch (Exception ex2) { Debug.LogError((object)ex2); } }; LoadingUI.PlayCrash += (hook_PlayCrash)delegate(orig_PlayCrash orig, LoadingUI self) { orig.Invoke(self); if (!LevelGenerator.Instance.Generated) { return; } try { Debug.Log((object)"Repo Randomizer: ROUND START"); StartHost(); } catch (Exception ex) { Debug.LogError((object)ex); } }; } } public class PlayerHooks { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_ChatMessageSpeak <>9__0_0; public static hook_JumpRPC <>9__0_1; public static hook_PlayerDeath <>9__0_2; public static hook_TumbleStart <>9__0_3; public static hook_StandToCrouch <>9__0_4; public static hook_HealedOther <>9__0_5; public static hook_Slide <>9__0_6; public static hook_Footstep <>9__0_7; internal void <.ctor>b__0_0(orig_ChatMessageSpeak orig, PlayerAvatar self, string _message, bool crouching) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, _message, crouching); Debug.Log((object)"Repo Randomizer: Sendchat"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("SendChat", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_1(orig_JumpRPC orig, PlayerAvatar self, bool _powerupEffect) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, _powerupEffect); Debug.Log((object)"Repo Randomizer: JUMP"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Jump", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_2(orig_PlayerDeath orig, PlayerAvatar self, int enemyIndex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, enemyIndex); Debug.Log((object)"Repo Randomizer: Death"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Death", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_3(orig_TumbleStart orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: TumbleStart"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Tumble", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_4(orig_StandToCrouch orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Crouch"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Crouch", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_5(orig_HealedOther orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Heal Other Player"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("HealOther", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_6(orig_Slide orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Slide"); GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Slide", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } internal void <.ctor>b__0_7(orig_Footstep orig, PlayerAvatar self, SoundType soundType) { //IL_0003: 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_0056: Expected O, but got Unknown //IL_0062: 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_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, soundType); if (self.isSprinting) { GameObject val = new GameObject(); val.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Sprint", val, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val); } else { GameObject val2 = new GameObject(); val2.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Walk", val2, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val2); } } } public PlayerHooks() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0071: 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_007c: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00bb: 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: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_012a: 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) //IL_0135: Expected O, but got Unknown Debug.Log((object)"Lethal Chaos: Hooking Player Actions..."); object obj = <>c.<>9__0_0; if (obj == null) { hook_ChatMessageSpeak val = delegate(orig_ChatMessageSpeak orig, PlayerAvatar self, string _message, bool crouching) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, _message, crouching); Debug.Log((object)"Repo Randomizer: Sendchat"); GameObject val17 = new GameObject(); val17.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("SendChat", val17, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val17); }; <>c.<>9__0_0 = val; obj = (object)val; } PlayerAvatar.ChatMessageSpeak += (hook_ChatMessageSpeak)obj; object obj2 = <>c.<>9__0_1; if (obj2 == null) { hook_JumpRPC val2 = delegate(orig_JumpRPC orig, PlayerAvatar self, bool _powerupEffect) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, _powerupEffect); Debug.Log((object)"Repo Randomizer: JUMP"); GameObject val16 = new GameObject(); val16.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Jump", val16, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val16); }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } PlayerAvatar.JumpRPC += (hook_JumpRPC)obj2; object obj3 = <>c.<>9__0_2; if (obj3 == null) { hook_PlayerDeath val3 = delegate(orig_PlayerDeath orig, PlayerAvatar self, int enemyIndex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, enemyIndex); Debug.Log((object)"Repo Randomizer: Death"); GameObject val15 = new GameObject(); val15.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Death", val15, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val15); }; <>c.<>9__0_2 = val3; obj3 = (object)val3; } PlayerAvatar.PlayerDeath += (hook_PlayerDeath)obj3; object obj4 = <>c.<>9__0_3; if (obj4 == null) { hook_TumbleStart val4 = delegate(orig_TumbleStart orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: TumbleStart"); GameObject val14 = new GameObject(); val14.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Tumble", val14, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val14); }; <>c.<>9__0_3 = val4; obj4 = (object)val4; } PlayerAvatar.TumbleStart += (hook_TumbleStart)obj4; object obj5 = <>c.<>9__0_4; if (obj5 == null) { hook_StandToCrouch val5 = delegate(orig_StandToCrouch orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Crouch"); GameObject val13 = new GameObject(); val13.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Crouch", val13, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val13); }; <>c.<>9__0_4 = val5; obj5 = (object)val5; } PlayerAvatar.StandToCrouch += (hook_StandToCrouch)obj5; object obj6 = <>c.<>9__0_5; if (obj6 == null) { hook_HealedOther val6 = delegate(orig_HealedOther orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Heal Other Player"); GameObject val12 = new GameObject(); val12.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("HealOther", val12, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val12); }; <>c.<>9__0_5 = val6; obj6 = (object)val6; } PlayerAvatar.HealedOther += (hook_HealedOther)obj6; object obj7 = <>c.<>9__0_6; if (obj7 == null) { hook_Slide val7 = delegate(orig_Slide orig, PlayerAvatar self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Debug.Log((object)"Repo Randomizer: Slide"); GameObject val11 = new GameObject(); val11.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Slide", val11, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val11); }; <>c.<>9__0_6 = val7; obj7 = (object)val7; } PlayerAvatar.Slide += (hook_Slide)obj7; object obj8 = <>c.<>9__0_7; if (obj8 == null) { hook_Footstep val8 = delegate(orig_Footstep orig, PlayerAvatar self, SoundType soundType) { //IL_0003: 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_0056: Expected O, but got Unknown //IL_0062: 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_001b: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, soundType); if (self.isSprinting) { GameObject val9 = new GameObject(); val9.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Sprint", val9, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val9); } else { GameObject val10 = new GameObject(); val10.transform.position = ((Component)self).transform.position; EntropyEngine.getMoonHost().queueHook("Walk", val10, isSelective: true, targetIsPlayer: true); Object.Destroy((Object)(object)val10); } }; <>c.<>9__0_7 = val8; obj8 = (object)val8; } PlayerAvatar.Footstep += (hook_Footstep)obj8; } } public class PlayerHooksLocalized { public PlayerHooksLocalized() { Debug.Log((object)"Lethal Chaos: Hooking Player Actions (Localized)..."); } } public class LethalNet : MonoBehaviourPun { public static Dictionary<string, Color> albedoMap = new Dictionary<string, Color>(); public static Dictionary<string, float> meanMap = new Dictionary<string, float>(); public PlayerAvatar GetPlayerByActorNumber(int actorNumber) { List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; for (int i = 0; i < playerList.Count; i++) { PlayerAvatar val = playerList[i]; if (val.photonView.Owner != null && val.photonView.Owner.ActorNumber == actorNumber) { return val; } } return null; } [PunRPC] public void TEST() { Debug.Log((object)"REPO Chaos: PUNRPC CALL"); } [PunRPC] public void applyForce(int actorNumber) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO CHAOS: Random Force APPLY Clientside:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); Debug.Log((object)((Object)playerByActorNumber).GetInstanceID()); Debug.Log((object)((Object)playerByActorNumber).name); Debug.Log((object)playerByActorNumber.playerHealth); Debug.Log((object)((Component)playerByActorNumber).gameObject.transform.position); Debug.Log((object)"BAM"); float num = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); float num2 = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); float num3 = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); playerByActorNumber.ForceImpulse(new Vector3(num, num2, num3)); } [PunRPC] public void applyTumble(int actorNumber) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO CHAOS: Random Force APPLY Clientside:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); Debug.Log((object)((Object)playerByActorNumber).GetInstanceID()); Debug.Log((object)((Object)playerByActorNumber).name); Debug.Log((object)playerByActorNumber.playerHealth); Debug.Log((object)((Component)playerByActorNumber).gameObject.transform.position); Debug.Log((object)"BAM"); float num = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); float num2 = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); float num3 = (float)(EntropyEngine.rnd.NextDouble() * EntropyEngine.rnd.NextDouble() * 500.0); playerByActorNumber.tumble.TumbleSet(true, true); playerByActorNumber.tumble.TumbleForce(new Vector3(num, num2, num3)); playerByActorNumber.ForceImpulse(new Vector3(num, num2, num3)); } [PunRPC] public void upgradeStrength(int actorNumber) { Debug.Log((object)"REPO CHAOS: Strength Upgrade:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); PunManager.instance.UpgradePlayerThrowStrength(playerByActorNumber.steamID); playerByActorNumber.ChatMessageSend("Strength Upgrade Complete", false); } [PunRPC] public void upgradeSprint(int actorNumber) { Debug.Log((object)"REPO CHAOS: Sprint Upgrade:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); PunManager.instance.UpgradePlayerSprintSpeed(playerByActorNumber.steamID); playerByActorNumber.ChatMessageSend("Sprint Upgrade Complete", false); } [PunRPC] public void upgradeTumble(int actorNumber) { Debug.Log((object)"REPO CHAOS: Tumble Upgrade:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); PunManager.instance.UpgradePlayerTumbleLaunch(playerByActorNumber.steamID); playerByActorNumber.ChatMessageSend("Tumble Upgrade Complete", false); } [PunRPC] public void upgradeHealth(int actorNumber) { Debug.Log((object)"REPO CHAOS: Health Upgrade:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); PunManager.instance.UpgradePlayerHealth(playerByActorNumber.steamID); playerByActorNumber.ChatMessageSend("Health Upgrade Complete", false); } [PunRPC] public void upgradeStamina(int actorNumber) { Debug.Log((object)"REPO CHAOS: Stamina Upgrade:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); PunManager.instance.UpgradePlayerEnergy(playerByActorNumber.steamID); playerByActorNumber.ChatMessageSend("Stamina Upgrade Complete", false); } [PunRPC] public void showLove(int actorNumber) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"REPO CHAOS: Sharing the Love:::"); PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); ValuableLovePotion val = new ValuableLovePotion(); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.3f, 0.6f, 1f); ChatManager.instance.PossessChatScheduleStart(10); ChatManager.instance.PossessChat((PossessChatID)1, val.GenerateAffectionateSentence(), 1f, val2, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); Object.Destroy((Object)(object)val); } [PunRPC] public void soundPlay(int actorNumber, string name) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerByActorNumber = GetPlayerByActorNumber(actorNumber); AudioClip[] array = Resources.FindObjectsOfTypeAll<AudioClip>(); AudioClip[] array2 = array; foreach (AudioClip val in array2) { if (((Object)val).name.Equals(name)) { AudioSource.PlayClipAtPoint(val, ((Component)playerByActorNumber).gameObject.transform.position); } } } public async void healLoop(int actorNumber) { PlayerAvatar actor = GetPlayerByActorNumber(actorNumber); int heal = EntropyEngine.rnd.Next(0, 40); for (int i = 0; i < heal; i++) { await Task.Delay(200); actor.playerHealth.Heal(1, true); } } [PunRPC] public void fastHeal(int actorNumber) { healLoop(actorNumber); } public async void dmgLoop(int actorNumber) { PlayerAvatar actor = GetPlayerByActorNumber(actorNumber); int heal = EntropyEngine.rnd.Next(0, (int)((float)actor.playerHealth.health * 0.2f)); for (int i = 0; i < heal; i++) { await Task.Delay(200); actor.playerHealth.Hurt(1, true, -1); } } [PunRPC] public void fastDmg(int actorNumber) { dmgLoop(actorNumber); } [PunRPC] public void directHeal(int actorNumber, int amount) { dmgLoop(actorNumber); } [PunRPC] public void tempPitchUp(int actorNumber) { Debug.Log((object)"REPO CHAOS: tempPitchUp:::"); PlayerVoiceChat[] array = Object.FindObjectsOfType<PlayerVoiceChat>(); PlayerVoiceChat[] array2 = array; foreach (PlayerVoiceChat val in array2) { val.OverridePitch(1f + 4f * (float)EntropyEngine.rnd.NextDouble(), 6f, 16f, 10f, true); } } [PunRPC] public void tempPitchDown(int actorNumber) { Debug.Log((object)"REPO CHAOS: tempPitchDown:::"); PlayerVoiceChat[] array = Object.FindObjectsOfType<PlayerVoiceChat>(); PlayerVoiceChat[] array2 = array; foreach (PlayerVoiceChat val in array2) { val.OverridePitch((float)EntropyEngine.rnd.NextDouble(), 6f, 16f, 10f, true); } } public async void pitchUp(int actorNumber) { PlayerVoiceChat[] chats = Object.FindObjectsOfType<PlayerVoiceChat>(); PlayerVoiceChat[] array = chats; foreach (PlayerVoiceChat chat in array) { chat.OverridePitch((float)EntropyEngine.rnd.NextDouble(), 6f, 16f, 10f, true); } } public async void pitchDown(int actorNumber) { PlayerAvatar actor = GetPlayerByActorNumber(actorNumber); PlayerAvatarVisuals playerAvatarVisuals = actor.playerAvatarVisuals; playerAvatarVisuals.animationSpeedMultiplier *= (float)EntropyEngine.rnd.NextDouble(); await Task.Delay(EntropyEngine.rnd.Next(1000, 30000)); actor.playerAvatarVisuals.animationSpeedMultiplier = 1f; } } [BepInPlugin("Repo_Randomizer", "Repo_Randomizer", "1.0.0")] public class Plugin : BaseUnityPlugin { public static class Assets { public static AssetBundle MainAssetBundle; public static void PopulateAssets() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "repo_randomizer")); if ((Object)(object)MainAssetBundle == (Object)null) { Debug.LogError((object)"Failed to load custom assets."); } } } public static Harmony _harmony; public static ManualLogSource Logger; public static EntropyEngine engine; public static GameObject ChaosHostRef; public static GameObject ChaosHost; public static LethalNet rpcCalls; public static int maxObjectCount = 20; public static int maxMonsterCount = 15; public static ConfigEntry<float> levelOfChaos; public static ConfigEntry<float> randomOutcomeMultiplier; public static ConfigEntry<float> chaosRamp; public static void LogDebug(string text) { Logger.LogInfo((object)text); } public static void LogProduction(string text) { Logger.LogInfo((object)text); } private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; levelOfChaos = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Level Of Chaos", 0.75f, new ConfigDescription("Increases total outcomes linked to actions. Exponential \n (You will need to generate a new seed for this to take effect)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); randomOutcomeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Outcome Predictability", 1f, new ConfigDescription("Overall increases the chance for individual outcomes to happen, making them predictable. Generally increases chaos. \n (You will need to generate a new seed for this to take effect)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); chaosRamp = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Chaos Ramp", 0.06f, new ConfigDescription("Increases Level of Chaos by X amount per level. A way to make later levels much harder.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } Random.InitState((int)DateTime.Now.Ticks); try { Debug.Log((object)"Repo_Randomizer: Creating the Randomizer Engine..."); Assets.PopulateAssets(); EntropyEngine.EventHookMultiplier = 100f; EntropyEngine.EventChanceMultiplier = 0.3f; engine = new EntropyEngine(); Logger.LogInfo((object)"REPO Randomizer: is loaded!"); } catch (Exception ex) { Debug.LogError((object)("REPO Randomizer: Initialization Error -> " + ex.ToString())); } Logger.LogInfo((object)"Plugin Repo_Randomizer is loaded!"); } } public class Accumulators { public static float itemGetMult = 1f; public static float enemySpawnMult = 1f; public static float lightningSafetyMult = 1f; public static float explosionSafetyMult = 1f; public static int outcomeCounter = 0; public static void resetMults() { itemGetMult = 1f; enemySpawnMult = 1f; lightningSafetyMult = 1f; explosionSafetyMult = 1f; outcomeCounter = 0; } } public class EventThrottler { public static float summons; public static float objects; public static int[] triggerTotals; public EventThrottler() { triggerTotals = new int[EntropyHost.eventTotal]; summons = 0f; objects = 0f; } public bool throttleGate(int eventid, int softcap, float objectWeight, float summonWeight) { softcap = (int)((float)softcap * Event.getUniqueMult(eventid)); if (objects >= (float)Plugin.maxObjectCount && objectWeight > 0f) { Debug.Log((object)("Lethal Chaos: Event throttled - id: " + eventid + " objects: " + objects + " max objects: " + Plugin.maxObjectCount)); return true; } if (summons >= (float)Plugin.maxMonsterCount && summonWeight > 0f) { Debug.Log((object)("Lethal Chaos: Event throttled - id: " + eventid + " summons: " + summons + " max summons: " + Plugin.maxMonsterCount)); return true; } if (softcapGate(eventid, softcap)) { Debug.Log((object)"Lethal Chaos: Event throttled - (softcap) "); return true; } objects += objectWeight; summons += summonWeight; return false; } private bool softcapGate(int eventid, int softcap) { int num = triggerTotals[eventid]; if (num > softcap) { double num2 = EntropyEngine.rnd.NextDouble(); double num3 = Math.Pow(num - softcap, 1.149999976158142) * (double)softcap; if (num2 > (double)softcap / num3) { Debug.Log((object)("Softcap throttle triggered: randomroll" + num2 + " timesTriggered" + num + " divisor: " + num3 + " softcap: " + softcap)); return true; } } triggerTotals[eventid]++; return false; } } public class WorldModifiers { private float chance = 0.1f; public static float fogChance = 0.2f; private Color fogColor = Random.ColorHSV(0f, 1f, 1f, 1f, 1f, 1f); private float meanFreePath = EntropyEngine.rnd.Next(10, 70); private bool fogEnabled = false; private float jumpForce = 12f; private float movementSpeed = 4.6f; private float playerReach = 3f; public static void Hooks() { } public void applyModifiers() { } } public static class PluginInfo { public const string PLUGIN_GUID = "Repo_Randomizer"; public const string PLUGIN_NAME = "Repo_Randomizer"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace Repo_Randomizer.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }