using 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LuckyBlocks; using Microsoft.CodeAnalysis; using PEAKLib.Core; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("legocool.LuckyBlocks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+4681c05a93bbcb811af05cfdca6ee5270723060d")] [assembly: AssemblyProduct("legocool.LuckyBlocks")] [assembly: AssemblyTitle("Lucky_Blocks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } } [RequireComponent(typeof(PhotonView))] public class LuckyBreakable : MonoBehaviour { public Item item; public bool breakOnCollision = true; public float minBreakVelocity = 5f; public List breakSFX; public List instantiateNonItemOnBreak; public List instantiatePoints; public bool spawnsItemsKinematic; public bool playAnimationOnInstantiatedObject; public string animString; public bool ragdollCharacterOnBreak; private Rigidbody rig; private bool alreadyBroke; private Vector3 lastVelocity = Vector3.zero; public float pushForce = 2f; public float wholeBodyPushForce = 1f; private void Awake() { item = ((Component)this).GetComponent(); rig = ((Component)this).GetComponent(); } private void OnCollisionEnter(Collision collision) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && (int)item.itemState == 0 && breakOnCollision && Object.op_Implicit((Object)(object)item.rig)) { Vector3 relativeVelocity = collision.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude > minBreakVelocity) { Break(collision); } } } private void FixedUpdate() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rig == (Object)null) && !rig.isKinematic) { lastVelocity = rig.linearVelocity; } } public virtual void Break(Collision coll) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0083: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (alreadyBroke) { return; } alreadyBroke = true; for (int i = 0; i < breakSFX.Count; i++) { breakSFX[i].Play(((Component)this).transform.position); } if (ragdollCharacterOnBreak) { Character componentInParent = ((Component)coll.transform).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { Rigidbody componentInParent2 = ((Component)coll.transform).GetComponentInParent(); Vector3 val = ((Vector3)(ref lastVelocity)).normalized * pushForce; componentInParent.AddForceToBodyPart(componentInParent2, val * pushForce, val * wholeBodyPushForce); componentInParent.Fall(2f, 15f); } } Outcomes.TriggerRandom(this, coll); PhotonNetwork.Destroy(((Component)this).gameObject); } } public static class Outcomes { public static List<(Action action, int weight)> ActionWeights; public static void Initialize() { ActionWeights = new List<(Action, int)>(); if (Config.TornadoEnabled.Value) { ActionWeights.Add((SpawnTornado, Config.TornadoWeight.Value)); } if (Config.LuggageEnabled.Value) { ActionWeights.Add((SpawnLuggage, Config.LuggageWeight.Value)); } if (Config.BounceEnabled.Value) { ActionWeights.Add((SpawnBounce, Config.BounceWeight.Value)); } if (Config.ShelfEnabled.Value) { ActionWeights.Add((SpawnShelf, Config.ShelfWeight.Value)); } if (Config.LuckyRainEnabled.Value) { ActionWeights.Add((LuckyRain, Config.LuckyRainWeight.Value)); } if (Config.EruptionEnabled.Value) { ActionWeights.Add((SpawnEruption, Config.EruptionWeight.Value)); } if (Config.PeelRainEnabled.Value) { ActionWeights.Add((PeelRain, Config.PeelRainWeight.Value)); } if (Config.ExplodeEnabled.Value) { ActionWeights.Add((Explode, Config.ExplodeWeight.Value)); } if (Config.ScorpoRainEnabled.Value) { ActionWeights.Add((ScorpoRain, Config.ScorpoRainWeight.Value)); } if (Config.BerryRainEnabled.Value) { ActionWeights.Add((BerryRain, Config.BerryRainWeight.Value)); } if (Config.SummonScoutmasterEnabled.Value) { ActionWeights.Add((SummonScoutmaster, Config.SummonScoutmasterWeight.Value)); } if (Config.RopeSpawnEnabled.Value) { ActionWeights.Add((RopeSpawn, Config.RopeSpawnWeight.Value)); } if (Config.ChaosCloudEnabled.Value) { ActionWeights.Add((ChaosCloud, Config.ChaosCloudWeight.Value)); } if (Config.ZombieEnabled.Value) { ActionWeights.Add((Zombie, Config.ZombieWeight.Value)); } if (Config.BackpacksEnabled.Value) { ActionWeights.Add((Backpacks, Config.BackpacksWeight.Value)); } if (Config.PuffHealSpawnEnabled.Value) { ActionWeights.Add((PuffHealSpawn, Config.PuffHealSpawnWeight.Value)); } if (Config.EquipmentShowerEnabled.Value) { ActionWeights.Add((EquipmentShower, Config.EquipmentShowerWeight.Value)); } if (Config.MythicSpawnEnabled.Value) { ActionWeights.Add((MythicSpawn, Config.MythicSpawnWeight.Value)); } if (Config.FlagEnabled.Value) { ActionWeights.Add((Flag, Config.FlagWeight.Value)); } if (Config.CannonEnabled.Value) { ActionWeights.Add((Cannon, Config.CannonWeight.Value)); } if (Config.CookEnabled.Value) { ActionWeights.Add((Cook, Config.CookWeight.Value)); } if (Config.SunscreenEnabled.Value) { ActionWeights.Add((Sunscreen, Config.SunscreenWeight.Value)); } if (Config.EnderpearlEnabled.Value) { ActionWeights.Add((Enderpearl, Config.EnderpearlWeight.Value)); } } public static void AddOutcome(Action action, int weight = 100, string? name = null) { if (name == null) { name = action.Method.Name; } ConfigEntry val = Config.Instance.Bind("Custom Outcomes." + name, name + " Enabled", true, "Enable custom outcome: " + name); ConfigEntry val2 = Config.Instance.Bind("Custom Outcomes." + name, name + " Weight", weight, "Weight for custom outcome: " + name); Plugin.Log.LogInfo((object)$"Adding outcome {name} with weight {val2.Value}"); if (val.Value) { ActionWeights.Add((action, val2.Value)); } } public static void TriggerRandom(LuckyBreakable lb, Collision coll) { if (ActionWeights == null || ActionWeights.Count == 0) { return; } int num = 0; foreach (var actionWeight in ActionWeights) { if (actionWeight.weight > 0) { num += actionWeight.weight; } } if (num <= 0) { return; } int num2 = Random.Range(0, num); foreach (var actionWeight2 in ActionWeights) { if (actionWeight2.weight > 0) { if (num2 < actionWeight2.weight) { actionWeight2.action(lb, coll); break; } num2 -= actionWeight2.weight; } } } public static void SpawnTornado(LuckyBreakable lb, Collision coll) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) GameObject val = PhotonNetwork.Instantiate("Tornado", lb.item.Center(), Quaternion.identity, (byte)0, (object[])null); Tornado component = val.GetComponent(); component.tornadoLifetimeMax = Config.TornadoMaxLifetime.Value; component.tornadoLifetimeMin = Config.TornadoMinLifetime.Value; component.force = Config.TornadoForce.Value; } public static void SpawnLuggage(LuckyBreakable lb, Collision coll) { //IL_0000: 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_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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_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) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); switch (Random.Range(0, 4)) { case 0: PhotonNetwork.Instantiate("0_Items/LuggageSmall", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; case 1: PhotonNetwork.Instantiate("0_Items/LuggageBig", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; case 2: PhotonNetwork.Instantiate("0_Items/LuggageEpic", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; case 3: PhotonNetwork.Instantiate("0_Items/LuggageAncient", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; } } public static void SpawnBounce(LuckyBreakable lb, Collision coll) { //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_001c: 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_0037: 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_004e: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); PhotonNetwork.Instantiate("0_Items/BounceShroomSpawn", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); } public static void SpawnShelf(LuckyBreakable lb, Collision coll) { //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_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) Quaternion val = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); PhotonNetwork.Instantiate("0_Items/ShelfShroomSpawn", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); } public static void LuckyRain(LuckyBreakable lb, Collision coll) { //IL_001b: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) int value = Config.LuckyRainCount.Value; for (int i = 0; i < value; i++) { Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3(Random.Range(-3f, 3f), Random.Range(4f, 7f), Random.Range(-3f, 3f)); GameObject val2 = PhotonNetwork.Instantiate("0_Items/legocool.LuckyBlocks:LuckyBlock", val, Quaternion.identity, (byte)0, (object[])null); Item component = val2.GetComponent(); component.lastThrownCharacter = lb.item.lastThrownCharacter; } } public static void Enderpearl(LuckyBreakable lb, Collision coll) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0051: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + ((ContactPoint)(ref coll.contacts[0])).normal; Character lastThrownCharacter = lb.item.lastThrownCharacter; if ((Object)(object)lastThrownCharacter != (Object)null) { ((MonoBehaviourPun)lastThrownCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); } } public static void SpawnEruption(LuckyBreakable lb, Collision coll) { //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_002c: Unknown result type (might be due to invalid IL or missing references) EruptionSpawner val = Object.FindAnyObjectByType(); Vector3 point = ((ContactPoint)(ref coll.contacts[0])).point; val.photonView.RPC("RPCA_SpawnEruption", (RpcTarget)0, new object[1] { point }); } public static void PeelRain(LuckyBreakable lb, Collision coll) { //IL_0031: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) int value = Config.PeelRainGridSize.Value; float value2 = Config.PeelRainSpacing.Value; float num = 6f; for (int i = 0; i < value; i++) { for (int j = 0; j < value; j++) { Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3((float)(i - value / 2) * value2, num, (float)(j - value / 2) * value2); GameObject val2 = PhotonNetwork.Instantiate("0_Items/Berrynana Peel Yellow", val, Quaternion.identity, (byte)0, (object[])null); RemoveAfterSeconds val3 = val2.AddComponent(); val3.photonRemove = true; val3.seconds = Config.PeelRainLifetime.Value; } } } public static void Explode(LuckyBreakable lb, Collision coll) { //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) GameObject val = PhotonNetwork.Instantiate("0_Items/Dynamite", ((ContactPoint)(ref coll.contacts[0])).point, Quaternion.identity, (byte)0, (object[])null); Dynamite component = val.GetComponent(); component.LightFlare(); component.startingFuseTime = 0f; } public static void ScorpoRain(LuckyBreakable lb, Collision coll) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references) int value = Config.ScorpoRainCount.Value; for (int i = 0; i < value; i++) { Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3(Random.Range(-1f, 1f), Random.Range(2f, 4f), Random.Range(-1f, 1f)); GameObject val2 = PhotonNetwork.Instantiate("0_Items/Scorpion", val, Quaternion.identity, (byte)0, (object[])null); RemoveAfterSeconds val3 = val2.AddComponent(); val3.photonRemove = true; val3.seconds = Config.ScorpoRainLifetime.Value; } } public static void BerryRain(LuckyBreakable lb, Collision coll) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) int value = Config.BerryRainCount.Value; string[] array = new string[23] { "0_items/Winterberry Yellow", "0_Items/Winterberry Orange", "0_Items/Prickleberry_Gold", "0_Items/Prickleberry_Red", "0_Items/Apple Berry Green", "0_Items/Apple Berry Red", "0_Items/Apple Berry Yellow", "0_Items/Berrynana Brown", "0_Items/Berrynana Blue", "0_Items/Berrynana Pink", "0_Items/Berrynana Yellow", "0_Items/Clusterberry Black", "0_Items/Clusterberry Red", "0_Items/Clusterberry Yellow", "0_Items/Kingberry Green", "0_Items/Kingberry Purple", "0_Items/Kingberry Yellow", "0_Items/Napberry", "0_Items/Shroomberry_Blue", "0_Items/Shroomberry_Green", "0_Items/Shroomberry_Purple", "0_Items/Shroomberry_Red", "0_Items/Shroomberry_Yellow" }; for (int i = 0; i < value; i++) { string text = array[Random.Range(0, array.Length)]; Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3(Random.Range(-3f, 3f), Random.Range(4f, 6f), Random.Range(-3f, 3f)); GameObject val2 = PhotonNetwork.Instantiate(text, val, Quaternion.identity, (byte)0, (object[])null); val2.GetComponent().isKinematic = false; } } public static void SummonScoutmaster(LuckyBreakable lb, Collision coll) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Scoutmaster val = default(Scoutmaster); if (Scoutmaster.GetPrimaryScoutmaster(ref val)) { Vector3 val2 = ((ContactPoint)(ref coll.contacts[0])).point + ((ContactPoint)(ref coll.contacts[0])).normal; float num = 30f; Character lastThrownCharacter = lb.item.lastThrownCharacter; if ((Object)(object)lastThrownCharacter != (Object)null) { val.SetCurrentTarget(lastThrownCharacter, num); } val.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val2, true }); val.view.RPC("StopClimbingRpc", (RpcTarget)0, new object[1] { 0f }); } } public static void RopeSpawn(LuckyBreakable lb, Collision coll) { //IL_0000: 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_0040: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); GameObject val2 = null; switch (Random.Range(0, 2)) { case 0: val2 = PhotonNetwork.Instantiate("RopeAnchorWithAntiRope", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; case 1: val2 = PhotonNetwork.Instantiate("RopeAnchorWithRope", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); break; } if ((Object)(object)val2 != (Object)null) { RopeAnchorWithRope component = val2.GetComponent(); component.SpawnRope(); } } public static void ChaosCloud(LuckyBreakable lb, Collision coll) { //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) GameObject val = PhotonNetwork.Instantiate("0_Items/PandorasBox", ((ContactPoint)(ref coll.contacts[0])).point, Quaternion.identity, (byte)0, (object[])null); ItemCooking component = val.GetComponent(); component.FinishCooking(); } public static void Zombie(LuckyBreakable lb, Collision coll) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) GameObject val = PhotonNetwork.Instantiate("MushroomZombie", lb.item.Center(), Quaternion.identity, (byte)0, (object[])null); MushroomZombie component = val.GetComponent(); component.zombieSprintDistance = Config.ZombieSprintDistance.Value; component.zombieLungeDistance = Config.ZombieLungeDistance.Value; component.lungeRecoveryTime = Config.ZombieLungeRecoveryTime.Value; component.lifetime = Config.ZombieLifetime.Value; component.currentState = (State)0; } public static void Backpacks(LuckyBreakable lb, Collision coll) { //IL_001b: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) int value = Config.BackpackCount.Value; for (int i = 0; i < value; i++) { Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3(Random.Range(-2f, 2f), Random.Range(3f, 6f), Random.Range(-2f, 2f)); PhotonNetwork.Instantiate("0_Items/Backpack", val, Quaternion.identity, (byte)0, (object[])null); } } public static void PuffHealSpawn(LuckyBreakable lb, Collision coll) { //IL_0000: 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_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) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); PhotonNetwork.Instantiate("0_Items/HealingPuffShroomSpawn", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); } public static void EquipmentShower(LuckyBreakable lb, Collision coll) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) int value = Config.EquipmentShowerCount.Value; string[] array = new string[7] { "0_Items/ChainShooter", "0_Items/ClimbingSpike", "0_Items/Energy Drink", "0_Items/Lollipop", "0_Items/RescueHook", "0_Items/RopeShooter", "0_Items/RopeSpool" }; for (int i = 0; i < value; i++) { string text = array[Random.Range(0, array.Length)]; Vector3 val = ((ContactPoint)(ref coll.contacts[0])).point + new Vector3(Random.Range(-2f, 2f), Random.Range(3f, 5f), Random.Range(-2f, 2f)); PhotonNetwork.Instantiate(text, val, Quaternion.identity, (byte)0, (object[])null); } } public static void MythicSpawn(LuckyBreakable lb, Collision coll) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[12] { "0_Items/Anti-Rope Spool", "0_Items/AncientIdol", "0_Items/BookOfBones", "0_Items/Bugle_Magic", "0_Items/Bugle_Scoutmaster Variant", "0_Items/Cure-All", "0_Items/Cursed Skull", "0_Items/Lantern_Faerie", "0_Items/PandorasBox", "0_Items/RopeShooterAnti", "0_Items/ScoutEffigy", "0_Items/Warp Compass" }; string text = array[Random.Range(0, array.Length)]; PhotonNetwork.Instantiate(text, lb.item.Center(), Quaternion.identity, (byte)0, (object[])null); } public static void Sunscreen(LuckyBreakable lb, Collision coll) { //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) GameObject val = PhotonNetwork.Instantiate("0_Items/Sunscreen", ((ContactPoint)(ref coll.contacts[0])).point, Quaternion.identity, (byte)0, (object[])null); ItemCooking component = val.GetComponent(); component.FinishCooking(); } public static void Cannon(LuckyBreakable lb, Collision coll) { //IL_0000: 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_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) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); PhotonNetwork.Instantiate("ScoutCannon_Placed", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); } public static void Cook(LuckyBreakable lb, Collision coll) { //IL_0000: 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_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) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); PhotonNetwork.Instantiate("PortableStovetop_Placed", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); } public static void Flag(LuckyBreakable lb, Collision coll) { //IL_0000: 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_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) Quaternion val = Quaternion.LookRotation(Vector3.forward, ((ContactPoint)(ref coll.contacts[0])).normal); GameObject val2 = PhotonNetwork.Instantiate("Flag_Planted_Checkpoint", ((ContactPoint)(ref coll.contacts[0])).point, val, (byte)0, (object[])null); CheckpointFlag component = val2.GetComponent(); component.Initialize(lb.item.lastThrownCharacter); } public static void SpawnErikTower(LuckyBreakable lb, Collision coll) { } } [HarmonyPatch(typeof(Tornado), "PickTarget")] public static class Tornado_PickTarget_Patch { private static bool Prefix(Tornado __instance) { return (Object)(object)__instance.targetParent != (Object)null; } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace LuckyBlocks { public static class Config { public static ConfigFile Instance; public static ConfigEntry TornadoEnabled; public static ConfigEntry TornadoWeight; public static ConfigEntry TornadoMaxLifetime; public static ConfigEntry TornadoMinLifetime; public static ConfigEntry TornadoForce; public static ConfigEntry LuggageEnabled; public static ConfigEntry LuggageWeight; public static ConfigEntry BounceEnabled; public static ConfigEntry BounceWeight; public static ConfigEntry ShelfEnabled; public static ConfigEntry ShelfWeight; public static ConfigEntry LuckyRainEnabled; public static ConfigEntry LuckyRainWeight; public static ConfigEntry LuckyRainCount; public static ConfigEntry EruptionEnabled; public static ConfigEntry EruptionWeight; public static ConfigEntry PeelRainEnabled; public static ConfigEntry PeelRainWeight; public static ConfigEntry PeelRainGridSize; public static ConfigEntry PeelRainSpacing; public static ConfigEntry PeelRainLifetime; public static ConfigEntry ExplodeEnabled; public static ConfigEntry ExplodeWeight; public static ConfigEntry ScorpoRainEnabled; public static ConfigEntry ScorpoRainWeight; public static ConfigEntry ScorpoRainCount; public static ConfigEntry ScorpoRainLifetime; public static ConfigEntry BerryRainEnabled; public static ConfigEntry BerryRainWeight; public static ConfigEntry BerryRainCount; public static ConfigEntry SummonScoutmasterEnabled; public static ConfigEntry SummonScoutmasterWeight; public static ConfigEntry RopeSpawnEnabled; public static ConfigEntry RopeSpawnWeight; public static ConfigEntry ChaosCloudEnabled; public static ConfigEntry ChaosCloudWeight; public static ConfigEntry ZombieEnabled; public static ConfigEntry ZombieWeight; public static ConfigEntry ZombieSprintDistance; public static ConfigEntry ZombieLungeDistance; public static ConfigEntry ZombieLungeRecoveryTime; public static ConfigEntry ZombieLifetime; public static ConfigEntry BackpacksEnabled; public static ConfigEntry BackpacksWeight; public static ConfigEntry BackpackCount; public static ConfigEntry PuffHealSpawnEnabled; public static ConfigEntry PuffHealSpawnWeight; public static ConfigEntry EquipmentShowerEnabled; public static ConfigEntry EquipmentShowerWeight; public static ConfigEntry EquipmentShowerCount; public static ConfigEntry MythicSpawnEnabled; public static ConfigEntry MythicSpawnWeight; public static ConfigEntry FlagEnabled; public static ConfigEntry FlagWeight; public static ConfigEntry CannonEnabled; public static ConfigEntry CannonWeight; public static ConfigEntry CookEnabled; public static ConfigEntry CookWeight; public static ConfigEntry SunscreenEnabled; public static ConfigEntry SunscreenWeight; public static ConfigEntry EnderpearlEnabled; public static ConfigEntry EnderpearlWeight; public static void BindAll() { TornadoEnabled = Instance.Bind("Outcomes.Tornado", "Spawn Tornado Enabled", true, "Enable Spawn Tornado outcome"); TornadoWeight = Instance.Bind("Outcomes.Tornado", "Spawn Tornado Weight", 80, "Weight for Spawn Tornado"); TornadoMinLifetime = Instance.Bind("Outcomes.Tornado", "Tornado Min Lifetime", 6f, "Minimum lifetime for the tornado (in seconds)"); TornadoMaxLifetime = Instance.Bind("Outcomes.Tornado", "Tornado Max Lifetime", 10f, "Maximum lifetime for the tornado (in seconds)"); TornadoForce = Instance.Bind("Outcomes.Tornado", "Tornado Force", 50, "Force applied by the tornado"); LuggageEnabled = Instance.Bind("Outcomes.Luggage", "Spawn Luggage Enabled", true, "Enable Spawn Luggage outcome"); LuggageWeight = Instance.Bind("Outcomes.Luggage", "Spawn Luggage Weight", 110, "Weight for Spawn Luggage"); BounceEnabled = Instance.Bind("Outcomes.Bounce Shroom", "Spawn Bounce Shroom Enabled", true, "Enable Spawn Bounce Shroom outcome"); BounceWeight = Instance.Bind("Outcomes.Bounce Shroom", "Spawn Bounce Shroom Weight", 100, "Weight for Spawn Bounce Shroom"); ShelfEnabled = Instance.Bind("Outcomes.Shelf Fungus", "Spawn Shelf Fungus Enabled", true, "Enable Spawn Shelf Fungus outcome"); ShelfWeight = Instance.Bind("Outcomes.Shelf Fungus", "Spawn Shelf Fungus Weight", 90, "Weight for Spawn Shelf Fungus"); LuckyRainEnabled = Instance.Bind("Outcomes.LuckyRain", "Lucky Block Rain Enabled", true, "Enable Lucky Block Rain outcome"); LuckyRainWeight = Instance.Bind("Outcomes.LuckyRain", "Lucky Block Rain Weight", 75, "Weight for Lucky Block Rain"); LuckyRainCount = Instance.Bind("Outcomes.LuckyRain", "Lucky Block Count", 3, "Number of lucky blocks to spawn"); EruptionEnabled = Instance.Bind("Outcomes.Eruption", "Spawn Eruption Enabled", true, "Enable Spawn Eruption outcome"); EruptionWeight = Instance.Bind("Outcomes.Eruption", "Spawn Eruption Weight", 90, "Weight for Spawn Eruption"); PeelRainEnabled = Instance.Bind("Outcomes.Berrynana Peel Rain", "Berrynana Peel Rain Enabled", true, "Enable Berrynana Peel Rain outcome"); PeelRainWeight = Instance.Bind("Outcomes.Berrynana Peel Rain", "Berrynana Peel Rain Weight", 100, "Weight for Berrynana Peel Rain"); PeelRainGridSize = Instance.Bind("Outcomes.Berrynana Peel Rain", "Grid Size", 5, "Grid size for Berrynana Peel Rain (size of 5 = 5x5 grid or 25 peels)"); PeelRainSpacing = Instance.Bind("Outcomes.Berrynana Peel Rain", "Berrynana Peel Spacing", 1f, "Spacing between the peels"); PeelRainLifetime = Instance.Bind("Outcomes.Berrynana Peel Rain", "Berrynana Peel Lifetime", 120f, "Time before the peels despawn (in seconds)"); ExplodeEnabled = Instance.Bind("Outcomes.Explosion", "Explosion Enabled", true, "Enable Explosion outcome"); ExplodeWeight = Instance.Bind("Outcomes.Explosion", "Explosion Weight", 80, "Weight for Explosion"); ScorpoRainEnabled = Instance.Bind("Outcomes.Scorpion Rain", "Scorpion Rain Enabled", true, "Enable Scorpion Rain outcome"); ScorpoRainWeight = Instance.Bind("Outcomes.Scorpion Rain", "Scorpion Rain Weight", 60, "Weight for Scorpion Rain"); ScorpoRainCount = Instance.Bind("Outcomes.Scorpion Rain", "Scorpion Count", 3, "Number of scorpions to spawn"); ScorpoRainLifetime = Instance.Bind("Outcomes.Scorpion Rain", "Scorpion Lifetime", 60f, "Time before scorpions despawn (in seconds)"); BerryRainEnabled = Instance.Bind("Outcomes.Berry Rain", "Berry Rain Enabled", true, "Enable Berry Rain outcome"); BerryRainWeight = Instance.Bind("Outcomes.Berry Rain", "Berry Rain Weight", 100, "Weight for Berry Rain"); BerryRainCount = Instance.Bind("Outcomes.Berry Rain", "Berry Count", 4, "Number of berries to spawn"); SummonScoutmasterEnabled = Instance.Bind("Outcomes.Scoutmaster", "Spawn Scoutmaster Enabled", true, "Enable Spawn Scoutmaster outcome"); SummonScoutmasterWeight = Instance.Bind("Outcomes.Scoutmaster", "Spawn Scoutmaster Weight", 50, "Weight for Spawn Scoutmaster"); RopeSpawnEnabled = Instance.Bind("Outcomes.Rope/Anti Rope Spawn", "Rope/Anti Rope Spawn Enabled", true, "Enable Rope/Anti Rope Spawn outcome"); RopeSpawnWeight = Instance.Bind("Outcomes.Rope/Anti Rope Spawn", "Rope/Anti Rope Spawn Weight", 95, "Weight for Rope/Anti Rope Spawn"); ChaosCloudEnabled = Instance.Bind("Outcomes.Chaos Cloud", "Chaos Cloud Enabled", true, "Enable Chaos Cloud outcome"); ChaosCloudWeight = Instance.Bind("Outcomes.Chaos Cloud", "Chaos Cloud Weight", 100, "Weight for Chaos Cloud"); ZombieEnabled = Instance.Bind("Outcomes.Zombie", "Spawn Zombie Enabled", true, "Enable Spawn Zombie outcome"); ZombieWeight = Instance.Bind("Outcomes.Zombie", "Spawn Zombie Weight", 70, "Weight for Spawn Zombie"); ZombieSprintDistance = Instance.Bind("Outcomes.Zombie", "Zombie Sprint Distance", 30f, "Distance at which the zombie starts sprinting"); ZombieLungeDistance = Instance.Bind("Outcomes.Zombie", "Zombie Lunge Distance", 15f, "Distance at which the zombie can lunge"); ZombieLungeRecoveryTime = Instance.Bind("Outcomes.Zombie", "Zombie Lunge Recovery Time", 2f, "Time it takes for the zombie to recover after lunging (in seconds)"); ZombieLifetime = Instance.Bind("Outcomes.Zombie", "Zombie Lifetime", 90f, "Time before the zombie dies (in seconds)"); BackpacksEnabled = Instance.Bind("Outcomes.Backpacks", "Backpack Spawn Enabled", true, "Enable Backpack Spawn outcome"); BackpacksWeight = Instance.Bind("Outcomes.Backpacks", "Backpack Spawn Weight", 90, "Weight for Backpack Spawn"); BackpackCount = Instance.Bind("Outcomes.Backpacks", "Backpack Count", 3, "Number of backpacks to spawn"); PuffHealSpawnEnabled = Instance.Bind("Outcomes.Remed Fungus Heal", "Remed Fungus Heal Spawn Enabled", true, "Enable Remed Fungus Heal Spawn outcome"); PuffHealSpawnWeight = Instance.Bind("Outcomes.Remed Fungus Heal", "Remed Fungus Heal Spawn Weight", 100, "Weight for Remed Fungus Heal Spawn"); EquipmentShowerEnabled = Instance.Bind("Outcomes.Equipment Shower", "Equipment Shower Enabled", true, "Enable Equipment Shower outcome"); EquipmentShowerWeight = Instance.Bind("Outcomes.Equipment Shower", "Equipment Shower Weight", 100, "Weight for Equipment Shower"); EquipmentShowerCount = Instance.Bind("Outcomes.Equipment Shower", "Equipment Count", 4, "Number of equipment pieces to spawn"); MythicSpawnEnabled = Instance.Bind("Outcomes.Mythic Item Spawn", "Mythic Item Spawn Enabled", true, "Enable Mythic Item Spawn outcome"); MythicSpawnWeight = Instance.Bind("Outcomes.Mythic Item Spawn", "Mythic Item Spawn Weight", 85, "Weight for Mythic Item Spawn"); FlagEnabled = Instance.Bind("Outcomes.Checkpoint Flag", "Checkpoint Flag Enabled", true, "Enable Checkpoint Flag outcome"); FlagWeight = Instance.Bind("Outcomes.Checkpoint Flag", "Checkpoint Flag Weight", 90, "Weight for Checkpoint Flag"); CannonEnabled = Instance.Bind("Outcomes.Scout Cannon", "Scout Cannon Spawn Enabled", true, "Enable Scout Cannon outcome"); CannonWeight = Instance.Bind("Outcomes.Scout Cannon", "Scout Cannon Spawn Weight", 95, "Weight for Scout Cannon"); CookEnabled = Instance.Bind("Outcomes.Portable Pot", "Portable Pot Spawn Enabled", true, "Enable Portable Pot Spawn outcome"); CookWeight = Instance.Bind("Outcomes.Portable Pot", "Portable Pot Spawn Weight", 85, "Weight for Portable Pot Spawn"); SunscreenEnabled = Instance.Bind("Outcomes.Sunscreen Area", "Sunscreen Area Enabled", true, "Enable Sunscreen area outcome"); SunscreenWeight = Instance.Bind("Outcomes.Sunscreen Area", "Sunscreen Area Weight", 65, "Weight for Sunscreen area"); EnderpearlEnabled = Instance.Bind("Outcomes.Teleport", "Teleport Enabled", true, "Enable Teleport outcome"); EnderpearlWeight = Instance.Bind("Outcomes.Teleport", "Teleport Weight", 80, "Weight for Teleport"); } } public static class LuckyBlockRarity { public const Rarity LuckyBlockDefault = -1; } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("legocool.LuckyBlocks", "Lucky_Blocks", "1.2.0")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public const string Id = "legocool.LuckyBlocks"; internal static ManualLogSource Log { get; private set; } public static string Name => "Lucky_Blocks"; public static string Version => "1.2.0"; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _harmony = new Harmony("legocool.LuckBlock"); _harmony.PatchAll(); Log = ((BaseUnityPlugin)this).Logger; Config.Instance = ((BaseUnityPlugin)this).Config; Config.BindAll(); Outcomes.Initialize(); BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "luckyblock.peakbundle", (Action)InitLuckyBlock); LocalizedText.mainTable["NAME_LUCKYBLOCK"] = new List(new string[14]); for (int i = 0; i < 14; i++) { LocalizedText.mainTable["NAME_LUCKYBLOCK"][i] = "Lucky Block"; } LocalizedText.mainTable["NAME_LUCKYBLOCK"][9] = "幸运方块"; LootData.RarityWeights.Add((Rarity)(-1), 500); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void InitLuckyBlock(PeakBundle bundle) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { Log.LogInfo((object)("Asset: " + text)); } GameObject val = bundle.LoadAsset("LuckyBlock.prefab"); LuckyBreakable luckyBreakable = val.AddComponent(); luckyBreakable.breakOnCollision = true; luckyBreakable.minBreakVelocity = 10f; LootData component = val.GetComponent(); component.Rarity = (Rarity)(-1); bundle.Mod.RegisterContent(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }