using 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 <ForceZombieAwake>d__38 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameObject zombie;
public Character targetCharacter;
public TrappedLuggagePlugin <>4__this;
private MushroomZombie <zombieComponent>5__1;
private MethodInfo <wakeUpMethod>5__2;
private FieldInfo <timeSpentWakingUpField>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ForceZombieAwake>d__38(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<zombieComponent>5__1 = null;
<wakeUpMethod>5__2 = null;
<timeSpentWakingUpField>5__3 = 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
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Invalid comparison between Unknown and I4
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)zombie == (Object)null)
{
return false;
}
<zombieComponent>5__1 = zombie.GetComponent<MushroomZombie>();
if ((Object)(object)<zombieComponent>5__1 == (Object)null)
{
return false;
}
<zombieComponent>5__1.initialWakeUpTime = 0f;
if ((int)<zombieComponent>5__1.currentState == 0)
{
<wakeUpMethod>5__2 = typeof(MushroomZombie).GetMethod("WakeUpFromSleep", BindingFlags.Instance | BindingFlags.NonPublic);
if (<wakeUpMethod>5__2 != null)
{
<wakeUpMethod>5__2.Invoke(<zombieComponent>5__1, null);
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Forced zombie to wake up from sleep");
}
<wakeUpMethod>5__2 = null;
}
if ((int)<zombieComponent>5__1.currentState == 1)
{
<timeSpentWakingUpField>5__3 = typeof(MushroomZombie).GetField("timeSpentWakingUp", BindingFlags.Instance | BindingFlags.NonPublic);
if (<timeSpentWakingUpField>5__3 != null)
{
<timeSpentWakingUpField>5__3.SetValue(<zombieComponent>5__1, 999f);
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Set zombie wake-up timer to skip delay");
}
<timeSpentWakingUpField>5__3 = 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 <SetTornadoLifetime>d__36 : 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__36(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__37 : 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__37(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();
}
}
[CompilerGenerated]
private sealed class <ZombieLifetimeTimer>d__39 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameObject zombie;
public TrappedLuggagePlugin <>4__this;
private float <lifetime>5__1;
private MushroomZombie <zombieComponent>5__2;
private MethodInfo <dieMethod>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ZombieLifetimeTimer>d__39(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<zombieComponent>5__2 = null;
<dieMethod>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<lifetime>5__1 = <>4__this.mushroomZombieLifetimeConfig.Value;
<>2__current = (object)new WaitForSeconds(<lifetime>5__1);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)zombie == (Object)null)
{
return false;
}
<zombieComponent>5__2 = zombie.GetComponent<MushroomZombie>();
if ((Object)(object)<zombieComponent>5__2 == (Object)null)
{
return false;
}
if ((int)<zombieComponent>5__2.currentState == 6)
{
return false;
}
<dieMethod>5__3 = typeof(MushroomZombie).GetMethod("Die", BindingFlags.Instance | BindingFlags.NonPublic);
if (<dieMethod>5__3 != null)
{
<dieMethod>5__3.Invoke(<zombieComponent>5__2, null);
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)$"Zombie died after {<lifetime>5__1} second lifetime (coroutine timer)");
}
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 ConfigEntry<bool> enableMushroomZombieConfig;
private ConfigEntry<int> mushroomZombieSpawnChanceConfig;
private ConfigEntry<int> mushroomZombieCountMinConfig;
private ConfigEntry<int> mushroomZombieCountMaxConfig;
private ConfigEntry<float> mushroomZombieLifetimeConfig;
private const ushort DynamiteID = 106;
private const ushort ScorpionID = 111;
private Harmony harmony;
public static HashSet<GameObject> ourSpawnedZombies;
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.");
enableMushroomZombieConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Mushroom Zombie", "Enable Mushroom Zombie", true, "Enable spawning mushroom zombies when luggage is opened.");
mushroomZombieSpawnChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Mushroom Zombie", "Spawn Chance Percent", 10, "Percentage chance (0-100) that mushroom zombies will spawn when luggage is opened.");
mushroomZombieCountMinConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Mushroom Zombie", "Zombie Count Min", 1, "Minimum number of mushroom zombies to spawn when luggage is opened.");
mushroomZombieCountMaxConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Mushroom Zombie", "Zombie Count Max", 2, "Maximum number of mushroom zombies to spawn when luggage is opened.");
mushroomZombieLifetimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Mushroom Zombie", "Zombie Lifetime", 120f, "How long (in seconds) mushroom zombies live before automatically dying. Default is 120 seconds.");
}
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_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: 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_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: 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"))
{
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 });
}
}
}
if (!Instance.ShouldSpawnTrap(Instance.enableMushroomZombieConfig, Instance.mushroomZombieSpawnChanceConfig, "MUSHROOM ZOMBIES"))
{
return;
}
int num2 = Random.Range(Instance.mushroomZombieCountMinConfig.Value, Instance.mushroomZombieCountMaxConfig.Value + 1);
Vector3 val8 = default(Vector3);
for (int j = 0; j < num2; j++)
{
((Vector3)(ref val8))..ctor(Random.Range(-2.5f, 2.5f), 0.5f, Random.Range(-2.5f, 2.5f));
Vector3 val9 = position + val8;
GameObject val10 = null;
string[] array2 = new string[3] { "MushroomZombie", "0_Items/MushroomZombie", "Zombie/MushroomZombie" };
string[] array3 = array2;
foreach (string text in array3)
{
try
{
val10 = PhotonNetwork.Instantiate(text, val9, Random.rotation, (byte)0, (object[])null);
if ((Object)(object)val10 != (Object)null)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Successfully spawned MushroomZombie using path: " + text));
break;
}
}
catch (Exception ex)
{
((BaseUnityPlugin)Instance).Logger.LogDebug((object)("Failed to spawn with path '" + text + "': " + ex.Message));
}
}
if ((Object)(object)val10 != (Object)null)
{
ourSpawnedZombies.Add(val10);
MushroomZombie component4 = val10.GetComponent<MushroomZombie>();
if ((Object)(object)component4 != (Object)null)
{
component4.initialWakeUpTime = 0f;
Mob component5 = val10.GetComponent<Mob>();
if ((Object)(object)component5 != (Object)null && (Object)(object)character != (Object)null)
{
component5.mobState = (MobState)1;
component5.SetForcedTarget(character);
}
((MonoBehaviour)Instance).StartCoroutine(Instance.ForceZombieAwake(val10, character));
((MonoBehaviour)Instance).StartCoroutine(Instance.ZombieLifetimeTimer(val10));
((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Mushroom zombie spawned at {val9} (wake-up time set to 0)");
}
}
else
{
((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Failed to spawn MushroomZombie - prefab path not found. Tried: " + string.Join(", ", array2)));
}
}
}
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__36))]
private IEnumerator SetTornadoLifetime(GameObject tornado)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetTornadoLifetime>d__36(0)
{
<>4__this = this,
tornado = tornado
};
}
[IteratorStateMachine(typeof(<TeleportScoutmasterWithRetry>d__37))]
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__37(0)
{
<>4__this = this,
luggagePosition = luggagePosition,
targetCharacter = targetCharacter
};
}
[IteratorStateMachine(typeof(<ForceZombieAwake>d__38))]
private IEnumerator ForceZombieAwake(GameObject zombie, Character targetCharacter)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ForceZombieAwake>d__38(0)
{
<>4__this = this,
zombie = zombie,
targetCharacter = targetCharacter
};
}
[IteratorStateMachine(typeof(<ZombieLifetimeTimer>d__39))]
private IEnumerator ZombieLifetimeTimer(GameObject zombie)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ZombieLifetimeTimer>d__39(0)
{
<>4__this = this,
zombie = zombie
};
}
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;
ourSpawnedZombies = new HashSet<GameObject>();
}
}
[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(MushroomZombie), "DoWakingUp")]
public static class MushroomZombie_DoWakingUp_Patch
{
private static void Prefix(MushroomZombie __instance)
{
if (TrappedLuggagePlugin.ourSpawnedZombies.Contains(((Component)__instance).gameObject))
{
__instance.initialWakeUpTime = 0f;
FieldInfo field = typeof(MushroomZombie).GetField("timeSpentWakingUp", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(__instance, 999f);
}
}
}
}
[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);
}
}
}