Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of RandomEvents v1.0.0
RandomEvents.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BattleLib; using BepInEx; using BepInEx.Configuration; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("RandomEvents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Makes random events occur, such as objects falling from the sky or changes in gravity")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RandomEvents")] [assembly: AssemblyTitle("RandomEvents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 RandomEvents { [BepInPlugin("com.PizzaMan730.RandomEvents", "RandomEvents", "1.0.0")] public class Plugin : BaseUnityPlugin, IUpdatable { public class Patches { [HarmonyPatch(typeof(PlayerPhysics), "UpdateSim")] [HarmonyPrefix] public static void PatchUpdateSim(ref PlayerPhysics __instance) { //IL_0003: 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) __instance.gravity_modifier = gravityScale; } [HarmonyPatch(typeof(BoplBody), "UpdateSim")] [HarmonyPrefix] public static void PatchBoplBodyUpdate(ref BoplBody __instance) { //IL_0003: 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) __instance.gravityScale = gravityScale; } [HarmonyPatch(typeof(DetPhysics), "UpdateRopeMesh_parallell")] [HarmonyPrefix] public static void RopePatch(ref DetPhysics __instance) { //IL_0003: 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_000f: 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) __instance.playerGravity = gravityScale; __instance.ropeGravity = gravityScale; } } public class EventText { private int eventType; public int timeAlive; private GameObject gameObject; public EventText(int eventType) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) this.eventType = eventType; timeAlive = 0; gameObject = new GameObject("EventAnnouncement", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); GameObject val = GameObject.Find("AbilitySelectCanvas"); gameObject.transform.SetParent(val.transform); TextMeshProUGUI component = gameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).font = LocalizedText.localizationTable.GetFont(Settings.Get().Language, false); ((Graphic)component).color = Color.red; ((TMP_Text)component).fontSize = 100f; ((TMP_Text)component).alignment = (TextAlignmentOptions)514; ((TMP_Text)component).richText = false; switch (eventType) { case 0: ((TMP_Text)component).text = "Grenade Rain!"; break; case 1: ((TMP_Text)component).text = "Arrow Rain!"; break; case 2: ((TMP_Text)component).text = "Land Mines!"; break; case 3: ((TMP_Text)component).text = "Smoke Storm!"; break; case 4: ((TMP_Text)component).text = "Gravity Change!"; break; case 5: ((TMP_Text)component).text = "Teleporting Players!"; break; case 6: ((TMP_Text)component).text = "Black Hole Attack!"; break; case 7: ((TMP_Text)component).text = "Meteor Strike!"; break; case 8: ((TMP_Text)component).text = "Meteor Shower!"; break; case 9: ((TMP_Text)component).text = "Cloning Players!"; break; default: ((TMP_Text)component).text = "Untitled event!"; break; } RectTransform component2 = gameObject.GetComponent<RectTransform>(); Rect rect = val.GetComponent<RectTransform>().rect; float height = ((Rect)(ref rect)).height; rect = val.GetComponent<RectTransform>().rect; float width = ((Rect)(ref rect)).width; component2.sizeDelta = new Vector2(5000f, 100f); component2.anchoredPosition = new Vector2(0f, height / 2f - 100f); gameObject.SetActive(true); } public void Update() { timeAlive++; if (timeAlive >= 200) { Object.Destroy((Object)(object)gameObject); } } } private ConfigEntry<int> minTime; private ConfigEntry<int> maxTime; private List<ConfigEntry<bool>> allowedEvents; private int timeSinceEvent; private int timeTillNextEvent; private ConfigEntry<bool> showAnnouncements; private List<EventText> eventTexts = new List<EventText>(); public static Fix gravityScale; private ConfigFile config; private Boulder boulderPrefab; private MachoThrow2 throwerPrefab; private BlackHole blackHolePrefab; private BoplBody arrowPrefab; private BoplBody grenadePrefab; private BoplBody minePrefab; private BoplBody smokePrefab; private int hierarchyNumber; public bool IsDestroyed { get; set; } public int HierarchyNumber { get { return hierarchyNumber; } set { hierarchyNumber = value; } } private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEvents has loaded!"); Harmony val = new Harmony("com.PizzaMan730.RandomEvents"); config = ((BaseUnityPlugin)this).Config; minTime = config.Bind<int>("Times", "Minimum time", 100, "Minimum time between events"); maxTime = config.Bind<int>("Times", "Maximum time", 1000, "Maximum time between events"); showAnnouncements = config.Bind<bool>("Misc", "Show announcements", true, "Show announcement when event is starting"); allowedEvents = new List<ConfigEntry<bool>>(); allowedEvents.Add(config.Bind<bool>("Events", "Grenade Rain", true, "Allow the Grenade Rain event?")); allowedEvents.Add(config.Bind<bool>("Events", "Arrow Rain", true, "Allow the Arrow Rain event?")); allowedEvents.Add(config.Bind<bool>("Events", "Land Mines", true, "Allow the Land Mines event?")); allowedEvents.Add(config.Bind<bool>("Events", "Smoke Storm", true, "Allow the Smoke Storm event?")); allowedEvents.Add(config.Bind<bool>("Events", "Gravity Change", true, "Allow the Gravity Change event?")); allowedEvents.Add(config.Bind<bool>("Events", "Teleport players", true, "Allow the Teleport Players event?")); allowedEvents.Add(config.Bind<bool>("Events", "Black Hole Attack", true, "Allow the Black Hole Attack event?")); allowedEvents.Add(config.Bind<bool>("Events", "Meteor Strike", true, "Allow the Meteor Strike event?")); allowedEvents.Add(config.Bind<bool>("Events", "Meteor Shower", true, "Allow the Meteor Shower event?")); timeSinceEvent = 0; timeTillNextEvent = Updater.RandomInt(minTime.Value, maxTime.Value); gravityScale = Fix.One; val.PatchAll(typeof(Patches)); SceneManager.sceneLoaded += OnSceneLoaded; GetPrefabs(); } public void GetPrefabs() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown Boulder val = new Boulder(); MachoThrow2 val2 = new MachoThrow2(); MachoThrow2[] array = Resources.FindObjectsOfTypeAll(typeof(MachoThrow2)) as MachoThrow2[]; MachoThrow2[] array2 = array; foreach (MachoThrow2 val3 in array2) { if (((Object)val3).name == "Throw") { boulderPrefab = (Boulder)AccessTools.Field(typeof(MachoThrow2), "boulderPrefab").GetValue(val3); throwerPrefab = val3; } } BlackHole val4 = new BlackHole(); BlackHole[] array3 = Resources.FindObjectsOfTypeAll(typeof(BlackHole)) as BlackHole[]; BlackHole[] array4 = array3; foreach (BlackHole val5 in array4) { if (((Object)val5).name == "BlackHole2") { blackHolePrefab = val5; } } BoplBody val6 = new BoplBody(); BoplBody[] array5 = Resources.FindObjectsOfTypeAll(typeof(BoplBody)) as BoplBody[]; BoplBody[] array6 = array5; foreach (BoplBody val7 in array6) { if (((Object)val7).name == "Arrow") { arrowPrefab = val7; } } BoplBody val8 = new BoplBody(); array5 = Resources.FindObjectsOfTypeAll(typeof(BoplBody)) as BoplBody[]; BoplBody[] array7 = array5; foreach (BoplBody val9 in array7) { if (((Object)val9).name == "Grenade") { grenadePrefab = val9; } } BoplBody val10 = new BoplBody(); array5 = Resources.FindObjectsOfTypeAll(typeof(BoplBody)) as BoplBody[]; BoplBody[] array8 = array5; foreach (BoplBody val11 in array8) { if (((Object)val11).name == "Mine") { minePrefab = val11; } } BoplBody val12 = new BoplBody(); array5 = Resources.FindObjectsOfTypeAll(typeof(BoplBody)) as BoplBody[]; BoplBody[] array9 = array5; foreach (BoplBody val13 in array9) { if (((Object)val13).name == "SmokeCircle") { smokePrefab = val13; } } } public void UpdateSim(Fix SimDeltaTime) { int num = 0; for (int i = 0; i < eventTexts.Count; i++) { eventTexts[num].Update(); if (eventTexts[num].timeAlive > 210) { eventTexts.RemoveAt(num); } else { num++; } } if (!GameTime.IsTimeStopped()) { timeSinceEvent++; } if (!BattleUtils.IsGameSessionActive()) { timeSinceEvent = 0; ChangeGravity(reset: true); } if (timeSinceEvent == timeTillNextEvent) { SpawnEvent(); } } private void SpawnEvent() { timeTillNextEvent = Updater.RandomInt(minTime.Value, maxTime.Value); timeSinceEvent = 0; int num = Updater.RandomInt(0, 9); while (!allowedEvents[num].Value) { num = Updater.RandomInt(0, 9); } if (showAnnouncements.Value) { eventTexts.Add(new EventText(num)); } switch (num) { case 0: SpawnGrenades(); break; case 1: SpawnArrows(); break; case 2: SpawnMines(); break; case 3: SpawnSmoke(); break; case 4: ChangeGravity(); break; case 5: TeleportPlayers(); break; case 6: SpawnBlackHole(); break; case 7: SpawnMeteor(); break; case 8: SpawnMeteorShower(); break; case 9: ClonePlayers(); break; } } private void ClonePlayers() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) SlimeController[] array = Resources.FindObjectsOfTypeAll(typeof(SlimeController)) as SlimeController[]; SlimeController[] array2 = array; foreach (SlimeController val in array2) { if (((Object)val).name.StartsWith("Player(")) { PlayerCollision val2 = (PlayerCollision)Traverse.Create((object)val).Field("playerCollision").GetValue(); MethodInfo method = typeof(PlayerCollision).GetMethod("SpawnClone", BindingFlags.Instance | BindingFlags.NonPublic); object[] parameters = new object[3] { PlayerHandler.Get().GetPlayer(val2.GetPlayerId()), val, val.GetPos() }; SlimeController val3 = (SlimeController)method.Invoke(val2, parameters); ((Object)val3).name = "Player (Clone)"; FixTransform.InstantiateFixed<SlimeController>(val3, val.GetPos()); typeof(SlimeController).GetMethod("BeforeSpawnInit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(val3, null); typeof(SlimeController).GetMethod("Spawn", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(val3, null); } } } private void TeleportPlayers() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011b: Unknown result type (might be due to invalid IL or missing references) ParticleSystem prefab = new ParticleSystem(); QuantumTunnel[] array = Resources.FindObjectsOfTypeAll(typeof(QuantumTunnel)) as QuantumTunnel[]; QuantumTunnel[] array2 = array; foreach (QuantumTunnel val in array2) { if (((Object)val).name == "QuantumTunnel") { prefab = val.onPlayerHitParticlePrefab; } } PlayerBody[] array3 = Resources.FindObjectsOfTypeAll(typeof(PlayerBody)) as PlayerBody[]; List<FixTransform> list = new List<FixTransform>(); PlayerBody[] array4 = array3; foreach (PlayerBody val2 in array4) { if (((Object)val2).name.Contains("(") && ((Component)(FixTransform)Traverse.Create((object)val2).Field("fixTransform").GetValue()).gameObject.active) { list.Add(((Component)val2).GetComponent<FixTransform>()); } } foreach (FixTransform item in list) { Vec2 position = item.position; TeleportChangePos(item); Vec2 position2 = item.position; TeleportSpawnEffect(prefab, position, position2); } } private void TeleportChangePos(FixTransform player) { //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_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_008c: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_0509: 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_0510: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) PlayerPhysics component = ((Component)player).GetComponent<PlayerPhysics>(); PhysicsBodyList<RoundedRect> roundedRects = DetPhysics.Get().roundedRects; DetPhysics val = DetPhysics.Get(); if (!((Object)(object)component != (Object)null) || !component.IsGrounded()) { Vec2 val2 = Vec2.zero; for (int i = 0; i < roundedRects.Length; i++) { val2 += ((RoundedRect)(ref roundedRects.colliders[i])).Pos(); } val2 /= (Fix)(long)roundedRects.Length; Tools.Debug_DrawPos(val2, Color.red, 10f); Fix val3 = val2.y - (Fix)4L; Fix val4 = SceneBounds.BlastZone_XMin; Fix val5 = SceneBounds.BlastZone_XMax; int num = 0; for (int j = 0; j < val.roundedRects.Length; j++) { if (DetPhysics.IsActive(val.roundedRects.physicsParents[j])) { Vec2 val6 = ((RoundedRect)(ref val.roundedRects.colliders[j])).Pos(); if (Fix.Abs(val6.x - player.position.x) > SceneBounds.BlastZone_YMax) { Tools.Debug_DrawPos(val6, Color.red, 10f); continue; } num++; AABB val7 = PhysTools.ComputeBoundingBox(val.roundedRects.colliders[j], j); Tools.Debug_DrawAABB(val7, Color.green, 10f); val4 = Fix.Max(val4, val7.max.x); val5 = Fix.Min(val5, val7.min.x); } } if (num == 0 || val4 < val5) { val4 = player.position.x + (Fix)30L; val5 = player.position.x - (Fix)30L; } Vec2 val8 = default(Vec2); ((Vec2)(ref val8))..ctor(val5, Fix.Max(val3, SceneBounds.WaterHeight + Fix.One)); Vec2 val9 = default(Vec2); ((Vec2)(ref val9))..ctor(val4, SceneBounds.Camera_YMax - (Fix)1.7); AABB val10 = default(AABB); val10.min = val8; val10.max = val9; Tools.Debug_DrawAABB(val10, Color.red, 10f); Vec2 position = player.position; if (val8.x > val9.x) { val8.x = val9.x; } if (val8.y > val9.y) { val8.y = val9.y; } for (int k = 0; k < 10; k++) { Fix val11 = Updater.RandomFix(val8.x, val9.x); Fix val12 = Updater.RandomFix(val8.y, val9.y); ((Vec2)(ref position))..ctor(val11, val12); if (!RaycastInformation.op_Implicit(val.PointCheckAllRoundedRects(position))) { break; } } player.position = position; PlayerBody component2 = ((Component)player).GetComponent<PlayerBody>(); if ((Object)(object)component2 != (Object)null) { component2.selfImposedVelocity = Vec2.zero; } return; } Vec2 position2 = player.position; List<int> list = new List<int>(val.roundedRects.Length); Fix val13 = SceneBounds.WaterHeight + (Fix)0.5; Vec2 val14 = default(Vec2); ((Vec2)(ref val14))..ctor(Fix.Zero, (Fix)1000L); for (int l = 0; l < val.roundedRects.Length; l++) { if (DetPhysics.IsActive(val.roundedRects.physicsParents[l]) && SceneBounds.IsInSceneBounds(((RoundedRect)(ref val.roundedRects.colliders[l])).Pos()) && ((RoundedRect)(ref val.roundedRects.colliders[l])).GetClosestPoint(val14).y > val13) { Vec2 val15 = ((RoundedRect)(ref val.roundedRects.colliders[l])).Pos(); if (Fix.Abs(val15.x - player.position.x) > SceneBounds.BlastZone_YMax) { Tools.Debug_DrawLine(val15, new Vec2((Fix)0L, (Fix)1000L), Color.red, 10f); } else { list.Add(l); } } } if (list.Count == 0) { return; } int index = Updater.RandomInt(0, list.Count); int num2 = list[index]; PhysicsParent val16 = val.roundedRects.physicsParents[num2]; StickyRoundedRectangle component3 = ((Component)val16.fixTrans).GetComponent<StickyRoundedRectangle>(); if ((Object)(object)component3 == (Object)null) { return; } for (int m = 0; m < 10; m++) { Fix val17 = Updater.RandomFix(Fix.Zero, Fix.One); Vec2 val18 = component3.PositionFromLocalPlayerPos(val17, Fix.Zero); Vec2 val19 = val18 + component3.currentNormal(val18) * component.radius; bool flag = false; for (int n = 0; n < val.roundedRects.Length; n++) { Tools.Debug_DrawPos(val18, Color.blue, 2f); Tools.Debug_DrawLine(val18, val19, Color.black, 2f); if (val.roundedRects.physicsParents[n].hierarchyNumber != val16.hierarchyNumber && ((RoundedRect)(ref val.roundedRects.colliders[n])).OverlapPoint(val19)) { flag = true; break; } } if (val18.y > val13 && SceneBounds.IsInSceneBounds(val18) && !flag) { component.AttachToGround(component3, val18); player.position = component.GetPlayerBody().position; return; } } player.position = ((RoundedRect)(ref val.roundedRects.colliders[num2])).GetClosestPoint(val14); } private void TeleportSpawnEffect(ParticleSystem prefab, Vec2 from, Vec2 to) { //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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_002c: 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_0032: 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_0043: 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_0051: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) float num = 5f; Vector3 val = (Vector3)to - (Vector3)from; if (((Vector3)(ref val)).sqrMagnitude > num) { ParticleSystem val2 = Object.Instantiate<ParticleSystem>(prefab, (Vector3)from, Quaternion.identity); VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime; MinMaxCurve val3 = default(MinMaxCurve); ((MinMaxCurve)(ref val3)).constantMin = val.x; ((MinMaxCurve)(ref val3)).constantMax = val.x; ((MinMaxCurve)(ref val3)).mode = (ParticleSystemCurveMode)3; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalOffsetX = val3; val3 = default(MinMaxCurve); ((MinMaxCurve)(ref val3)).constantMin = val.y - 0.5f; ((MinMaxCurve)(ref val3)).constantMax = val.y + 0.5f; ((MinMaxCurve)(ref val3)).mode = (ParticleSystemCurveMode)3; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalOffsetY = val3; float num2 = 0.25f; float num3 = ((Vector3)(ref val)).magnitude / num2; if (num3 > 100f) { ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).radial = MinMaxCurve.op_Implicit(0f - num3); return; } num3 = -100f; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).radial = MinMaxCurve.op_Implicit(num3); num2 = (0f - Mathf.Abs(((Vector3)(ref val)).magnitude)) / num3; MainModule val4 = default(MainModule); ((MainModule)(ref val4))..ctor(val2); ((MainModule)(ref val4)).startLifetime = MinMaxCurve.op_Implicit(num2); Debug.Log((object)"This part ran!"); } } private void SpawnMeteor() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Boulder val = FixTransform.InstantiateFixed<Boulder>(boulderPrefab, new Vec2(Updater.RandomFix((Fix)(-70L), (Fix)70L), (Fix)50L)); val.hitbox.Scale = (Fix)3L; val.hitbox.ManualInit(); val.hitbox.Scale = (Fix)3L; ((Component)val.hitbox).GetComponent<StickyRoundedRectangle>().platformType = (PlatformType)3; ((Component)val.hitbox).GetComponent<SpriteRenderer>().sprite = throwerPrefab.boulders.sprites[3].sprite; } private void SpawnMeteorShower() { //IL_0012: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 10; i++) { Boulder val = FixTransform.InstantiateFixed<Boulder>(boulderPrefab, new Vec2(Updater.RandomFix((Fix)(-70L), (Fix)70L), Updater.RandomFix((Fix)40L, (Fix)60L))); val.hitbox.Scale = (Fix)0.5; val.hitbox.ManualInit(); val.hitbox.Scale = (Fix)0.5; ((Component)val.hitbox).GetComponent<StickyRoundedRectangle>().platformType = (PlatformType)3; ((Component)val.hitbox).GetComponent<SpriteRenderer>().sprite = throwerPrefab.boulders.sprites[3].sprite; } } private void SpawnBlackHole() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //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) BlackHole val = FixTransform.InstantiateFixed<BlackHole>(blackHolePrefab, new Vec2(Updater.RandomFix((Fix)(-90L), (Fix)90L), Updater.RandomFix((Fix)0L, (Fix)45L))); } private void SpawnArrows() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) SpawnObjects(arrowPrefab, Updater.RandomInt(10, 30), (Fix)100L, (Fix)(-100L), (Fix)60L, (Fix)40L); } private void SpawnGrenades() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) SpawnObjects(grenadePrefab, Updater.RandomInt(10, 30), (Fix)100L, (Fix)(-100L), (Fix)60L, (Fix)40L); } private void SpawnMines() { //IL_0013: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) SpawnObjects(minePrefab, Updater.RandomInt(5, 15), (Fix)90L, (Fix)(-90L), (Fix)45L, (Fix)0L, isMine: true); } private void SpawnSmoke() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) SpawnObjects(smokePrefab, Updater.RandomInt(10, 20), (Fix)90L, (Fix)(-90L), (Fix)45L, (Fix)0L); } private void SpawnObjects(BoplBody prefab, int amount, Fix xMax, Fix xMin, Fix yMax, Fix yMin, bool isMine = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < amount; i++) { BoplBody val = FixTransform.InstantiateFixed<BoplBody>(prefab, new Vec2(Updater.RandomFix(xMin, xMax), Updater.RandomFix(yMin, yMax))); val.Scale = Fix.One; val.StartVelocity = new Vec2(Fix.Zero, Fix.Zero); val.rotation = Fix.Zero; val.StartAngularVelocity = Fix.Zero; if (isMine) { Mine component = ((Component)val).GetComponent<Mine>(); component.ScansFor = LayerMask.op_Implicit(LayerMask.NameToLayer("Player")); component.Light.color = Color.red; } } } private void ChangeGravity(bool reset = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) gravityScale = Updater.RandomFix((Fix)0L, (Fix)1.5); if (reset) { gravityScale = Fix.One; } } public void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!BattleUtils.IsGameSessionActive()) { Updater.RegisterUpdatable((IUpdatable)(object)this); timeSinceEvent = 0; } } public void Init() { } public bool IsEnabled() { return ((Behaviour)this).isActiveAndEnabled; } public void LateUpdateSim(Fix SimDeltaTime) { } public void OnDestroyUpdatable() { } } public static class PluginInfo { public const string PLUGIN_GUID = "RandomEvents"; public const string PLUGIN_NAME = "RandomEvents"; public const string PLUGIN_VERSION = "1.0.0"; } }