The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of Trapped Luggage v2.1.1
tony4twentys-Trapped Luggage.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Trapped Luggage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Trapped Luggage")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("116b48d9-8079-4ed0-9ea8-d6b2b553b8c6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TrappedLuggage; [BepInPlugin("tony4twentys.Trapped_Luggage", "Trapped Luggage", "2.0.0")] public class TrappedLuggagePlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <SetTornadoLifetime>d__30 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject tornado; public TrappedLuggagePlugin <>4__this; private Tornado <tornadoComponent>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetTornadoLifetime>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <tornadoComponent>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)tornado != (Object)null) { <tornadoComponent>5__1 = tornado.GetComponent<Tornado>(); if ((Object)(object)<tornadoComponent>5__1 != (Object)null) { <tornadoComponent>5__1.lifeTime = <>4__this.tornadoLifetimeConfig.Value; ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Tornado will last {<>4__this.tornadoLifetimeConfig.Value} seconds (stationary - no movement)"); } <tornadoComponent>5__1 = null; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TeleportScoutmasterWithRetry>d__31 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector3 luggagePosition; public Character targetCharacter; public TrappedLuggagePlugin <>4__this; private Vector3 <teleportPosition>5__1; private int <attempts>5__2; private int <maxAttempts>5__3; private Scoutmaster <scoutmaster>5__4; private PhotonView <smView>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TeleportScoutmasterWithRetry>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <scoutmaster>5__4 = null; <smView>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_0173: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <teleportPosition>5__1 = luggagePosition + Vector3.up * 2f; <attempts>5__2 = 0; <maxAttempts>5__3 = 4; break; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; case 3: <>1__state = -1; <scoutmaster>5__4 = null; break; } if (<attempts>5__2 < <maxAttempts>5__3) { <attempts>5__2++; if (Scoutmaster.GetPrimaryScoutmaster(ref <scoutmaster>5__4) && (Object)(object)<scoutmaster>5__4 != (Object)null) { if ((Object)(object)<scoutmaster>5__4.character == (Object)null) { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Scoutmaster found but character not initialized yet (attempt {<attempts>5__2}/{<maxAttempts>5__3})"); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; } <smView>5__5 = ((Component)<scoutmaster>5__4).GetComponent<PhotonView>(); if ((Object)(object)<smView>5__5 == (Object)null) { ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Scoutmaster found but PhotonView not ready (attempt {<attempts>5__2}/{<maxAttempts>5__3})"); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; } ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Teleporting Scoutmaster to {<teleportPosition>5__1} (attempt {<attempts>5__2}/{<maxAttempts>5__3})"); <smView>5__5.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { <teleportPosition>5__1, false }); if ((Object)(object)targetCharacter != (Object)null) { <scoutmaster>5__4.SetCurrentTarget(targetCharacter, <>4__this.scoutmasterChaseTimeConfig.Value); ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Scoutmaster now hunting {targetCharacter.characterName} for {<>4__this.scoutmasterChaseTimeConfig.Value} seconds!"); } return false; } ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Scoutmaster not found in game yet (attempt {<attempts>5__2}/{<maxAttempts>5__3})"); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 3; return true; } ((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)"Failed to teleport Scoutmaster after all retry attempts!"); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly SpawnPool[] LuggagePools; private ConfigEntry<int> weightConfig; private ConfigEntry<bool> enableConfig; private ConfigEntry<bool> enableScorpionConfig; private ConfigEntry<int> scorpionSpawnChanceConfig; private ConfigEntry<int> scorpionCountMinConfig; private ConfigEntry<int> scorpionCountMaxConfig; private ConfigEntry<bool> enableScoutmasterConfig; private ConfigEntry<int> scoutmasterSpawnChanceConfig; private ConfigEntry<float> scoutmasterChaseTimeConfig; private ConfigEntry<bool> enableBeeSwarmConfig; private ConfigEntry<int> beeSwarmSpawnChanceConfig; private ConfigEntry<float> beeSwarmAngerTimeConfig; private ConfigEntry<bool> enableTornadoConfig; private ConfigEntry<int> tornadoSpawnChanceConfig; private ConfigEntry<float> tornadoLifetimeConfig; private ConfigEntry<bool> enableEruptionConfig; private ConfigEntry<int> eruptionSpawnChanceConfig; private const ushort DynamiteID = 106; private const ushort ScorpionID = 111; private Harmony harmony; public static TrappedLuggagePlugin Instance { get; private set; } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Trapped Luggage v2.0.0 loaded!"); SetupConfig(); harmony = new Harmony("tony4twentys.Trapped_Luggage"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied!"); } private void SetupConfig() { enableConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Luggage Trap Toggle", "Enable Dynamite", true, "Enable Dynamite to spawn in luggage."); weightConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Luggage Trap Rarity", "DynamiteWeight", 100, "Weight of Dynamite in luggage. Higher means more likely to spawn. Set to 100 for high chance."); enableScorpionConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Scorpion Spawn", "Enable Scorpions", true, "Enable scorpions to spawn when luggage is opened."); scorpionSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Scorpion Spawn", "Spawn Chance Percent", 10, "Percentage chance (0-100) that scorpions will spawn when luggage is opened."); scorpionCountMinConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Scorpion Spawn", "Scorpion Count Min", 1, "Minimum number of scorpions to spawn when luggage is opened."); scorpionCountMaxConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Scorpion Spawn", "Scorpion Count Max", 3, "Maximum number of scorpions to spawn when luggage is opened."); enableScoutmasterConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Scoutmaster Summon", "Enable Scoutmaster", true, "Enable summoning the Scoutmaster when luggage is opened."); scoutmasterSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Scoutmaster Summon", "Summon Chance Percent", 10, "Percentage chance (0-100) that the Scoutmaster will be summoned when luggage is opened."); scoutmasterChaseTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Scoutmaster Summon", "Forced Chase Time", 60f, "How long (in seconds) the Scoutmaster will be forced to chase the player who opened the luggage."); enableBeeSwarmConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Bee Swarm", "Enable Bee Swarm", true, "Enable spawning an angry bee swarm when luggage is opened."); beeSwarmSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Bee Swarm", "Spawn Chance Percent", 10, "Percentage chance (0-100) that a bee swarm will spawn when luggage is opened."); beeSwarmAngerTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Bee Swarm", "Anger Duration", 20f, "How long (in seconds) the bees stay angry and chase players."); enableTornadoConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Tornado", "Enable Tornado", true, "Enable spawning a stationary tornado vortex when luggage is opened."); tornadoSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Tornado", "Spawn Chance Percent", 10, "Percentage chance (0-100) that a tornado will spawn when luggage is opened."); tornadoLifetimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Tornado", "Tornado Lifetime", 5f, "How long (in seconds) the stationary tornado lasts before disappearing."); enableEruptionConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Lava Eruption", "Enable Eruption", true, "Enable spawning a lava eruption when luggage is opened."); eruptionSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Lava Eruption", "Spawn Chance Percent", 10, "Percentage chance (0-100) that a lava eruption will spawn when luggage is opened."); } public void AddDynamiteToLuggage() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) SpawnPool[] luggagePools = LuggagePools; Item val = default(Item); foreach (SpawnPool key in luggagePools) { if (!LootData.AllSpawnWeightData.ContainsKey(key)) { LootData.AllSpawnWeightData[key] = new Dictionary<ushort, int>(); } if (enableConfig.Value && ItemDatabase.TryGetItem((ushort)106, ref val) && !((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent<LootData>() == (Object)null)) { int value = weightConfig.Value; if (!LootData.AllSpawnWeightData[key].ContainsKey(106)) { LootData.AllSpawnWeightData[key].Add(106, value); } } } } public static void HandleLuggageOpened(Luggage luggage, Character character) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_025f: 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_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || (Object)(object)luggage == (Object)null) { return; } Vector3 position = ((Component)luggage).transform.position; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Luggage opened at {position}"); if (Instance.ShouldSpawnTrap(Instance.enableScorpionConfig, Instance.scorpionSpawnChanceConfig, "SCORPIONS")) { int num = Random.Range(Instance.scorpionCountMinConfig.Value, Instance.scorpionCountMaxConfig.Value + 1); Vector3 val = default(Vector3); for (int i = 0; i < num; i++) { ((Vector3)(ref val))..ctor(Random.Range(-2.5f, 2.5f), 0.5f, Random.Range(-2.5f, 2.5f)); Vector3 val2 = position + val; GameObject val3 = PhotonNetwork.Instantiate("0_Items/Scorpion", val2, Random.rotation, (byte)0, (object[])null); if (!((Object)(object)val3 != (Object)null)) { continue; } Mob component = val3.GetComponent<Mob>(); if ((Object)(object)component != (Object)null) { component.mobState = (MobState)1; if ((Object)(object)character != (Object)null) { component.SetForcedTarget(character); } } } } if (Instance.ShouldSpawnTrap(Instance.enableScoutmasterConfig, Instance.scoutmasterSpawnChanceConfig, "SCOUTMASTER")) { ((MonoBehaviour)Instance).StartCoroutine(Instance.TeleportScoutmasterWithRetry(position, character)); } if (Instance.ShouldSpawnTrap(Instance.enableBeeSwarmConfig, Instance.beeSwarmSpawnChanceConfig, "BEE SWARM")) { Vector3 val4 = position + Vector3.up * 1f; GameObject val5 = PhotonNetwork.Instantiate("BeeSwarm", val4, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val5 != (Object)null) { BeeSwarm component2 = val5.GetComponent<BeeSwarm>(); if ((Object)(object)component2 != (Object)null) { component2.lastSawBeehivePosition = position; component2.GetAngry(Instance.beeSwarmAngerTimeConfig.Value); } } } if (Instance.ShouldSpawnTrap(Instance.enableTornadoConfig, Instance.tornadoSpawnChanceConfig, "TORNADO")) { Vector3 val6 = position + Vector3.up * 2f; GameObject val7 = PhotonNetwork.Instantiate("Tornado", val6, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val7 != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(Instance.SetTornadoLifetime(val7)); } } if (!Instance.ShouldSpawnTrap(Instance.enableEruptionConfig, Instance.eruptionSpawnChanceConfig, "LAVA ERUPTION")) { return; } EruptionSpawner[] array = Object.FindObjectsByType<EruptionSpawner>((FindObjectsSortMode)0); if (array.Length != 0) { PhotonView component3 = ((Component)array[0]).GetComponent<PhotonView>(); if (component3 != null) { component3.RPC("RPCA_SpawnEruption", (RpcTarget)0, new object[1] { position }); } } } private bool ShouldSpawnTrap(ConfigEntry<bool> enableConfig, ConfigEntry<int> chanceConfig, string trapName) { if (!enableConfig.Value) { return false; } int num = Random.Range(0, 100); bool flag = num < chanceConfig.Value; if (flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Spawning {trapName}! (chance roll: {num}%, required: {chanceConfig.Value}%)"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Luggage opened - no {trapName.ToLower()} spawned (chance roll: {num}%, required: {chanceConfig.Value}%)"); } return flag; } [IteratorStateMachine(typeof(<SetTornadoLifetime>d__30))] private IEnumerator SetTornadoLifetime(GameObject tornado) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetTornadoLifetime>d__30(0) { <>4__this = this, tornado = tornado }; } [IteratorStateMachine(typeof(<TeleportScoutmasterWithRetry>d__31))] private IEnumerator TeleportScoutmasterWithRetry(Vector3 luggagePosition, Character targetCharacter) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TeleportScoutmasterWithRetry>d__31(0) { <>4__this = this, luggagePosition = luggagePosition, targetCharacter = targetCharacter }; } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } static TrappedLuggagePlugin() { SpawnPool[] array = new SpawnPool[7]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); LuggagePools = (SpawnPool[])(object)array; } } [HarmonyPatch(typeof(Tornado), "PickTarget")] public static class Tornado_PickTarget_Patch { private static bool Prefix(Tornado __instance) { if ((Object)(object)__instance.targetParent == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(LootData), "PopulateLootData")] [HarmonyPriority(0)] public static class LootData_PopulateLootData_Patch { public static void Postfix() { try { TrappedLuggagePlugin.Instance.AddDynamiteToLuggage(); } catch (Exception arg) { Debug.LogError((object)$"[Trapped Luggage] Error in PopulateLootData patch: {arg}"); } } } [HarmonyPatch(typeof(Luggage), "OpenLuggageRPC")] public static class Luggage_OpenLuggageRPC_Patch { private static void Postfix(Luggage __instance, bool spawnItems) { //IL_0053: 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) if (!PhotonNetwork.IsMasterClient || !spawnItems) { return; } Character val = null; float num = float.MaxValue; foreach (Character allCharacter in Character.AllCharacters) { if (!allCharacter.isBot) { float num2 = Vector3.Distance(allCharacter.Center, ((Component)__instance).transform.position); if (num2 < 5f && num2 < num) { num = num2; val = allCharacter; } } } if ((Object)(object)val != (Object)null) { TrappedLuggagePlugin.HandleLuggageOpened(__instance, val); } } }