

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using DiversityRemastered.Player;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using JLL.API;
using JLL.API.Compatability;
using JLL.API.Events;
using JLL.API.JSON.Objects;
using JLL.API.LevelProperties;
using JLL.Components;
using JLL.Components.Filters;
using JLL.NetcodePatcher;
using JLL.Patches;
using JLL.ScriptableObjects;
using LCCutscene;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalLevelLoader;
using LethalMoonUnlocks;
using LittleCompany.modifications;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Serialization;
using WeatherRegistry;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JLL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JLL")]
[assembly: AssemblyTitle("JLL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace JLL
{
[BepInPlugin("JacobG5.JLL", "JLL", "1.10.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class JLL : BaseUnityPlugin
{
private const string modGUID = "JacobG5.JLL";
private const string modName = "JLL";
private const string modVersion = "1.10.1";
private readonly Harmony harmony = new Harmony("JacobG5.JLL");
public static JLL Instance;
internal ManualLogSource mls;
internal ManualLogSource wesley;
private static Transform JLLPrefabContainer;
public GameObject networkObject;
public JNetworkPrefabSet JLLNetworkPrefabs;
internal GameObject ElevatorPrefab;
public static ConfigEntry<JLogLevel> loggingLevel;
public static ConfigEntry<bool> purgeWesley;
public static ConfigEntry<bool> disableCutscenes;
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
JLLPrefabContainer = new GameObject("JLLPrefabContainer")
{
hideFlags = (HideFlags)61
}.transform;
((Component)JLLPrefabContainer).gameObject.SetActive(false);
mls = Logger.CreateLogSource("JacobG5.JLL");
wesley = Logger.CreateLogSource("Wesley");
NetcodePatch(mls, typeof(JLLNetworkManager), typeof(DamageTriggerNetworking), typeof(ItemConsumer), typeof(JActionEvents), typeof(JBridgeTrigger), typeof(JClientSync), typeof(JDestructableObject), typeof(JPlayerInsideRegion), typeof(JTerminalController), typeof(RandomizedEvent), typeof(SeatController));
loggingLevel = ((BaseUnityPlugin)this).Config.Bind<JLogLevel>("Logging", "LoggingLevel", JLogLevel.User, "Changes the amount of logging JLL performs in it's scripts.");
loggingLevel.SettingChanged += delegate
{
JLogHelper.UpdateLogLevel();
};
JLogHelper.UpdateLogLevel();
JLLNetworkPrefabs = ScriptableObject.CreateInstance<JNetworkPrefabSet>();
JLLNetworkPrefabs.SetName = "JLL";
JLLNetworkPrefabs.AddPrefabs(new JNetworkPrefabSet.JIdentifiablePrefab
{
name = "JLL",
prefab = (networkObject = CreateNetworkPrefab("JLL"))
}, new JNetworkPrefabSet.JIdentifiablePrefab
{
name = "EmptyPrefab",
prefab = (JNetworkPrefabSet.EmptyNetworkObject = CreateNetworkPrefab("EmptyPrefab"))
}, new JNetworkPrefabSet.JIdentifiablePrefab
{
name = "ElevatorBody",
prefab = (ElevatorPrefab = CreateNetworkPrefab("JLLElevator"))
});
networkObject.AddComponent<JLLNetworkManager>();
JNetworkPrefabSet.NetworkPrefabSets.Add(JLLNetworkPrefabs);
purgeWesley = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "PurgeWesley", false, "Destroys him.");
if (JCompatabilityHelper.IsLoaded(JCompatabilityHelper.CachedMods.LCCutscene))
{
disableCutscenes = ((BaseUnityPlugin)this).Config.Bind<bool>("LCCutscene", "DisableJLLCutscenes", false, "A global shutoff for all cutscenes triggered by JLL using LCCutscene.");
}
if (JCompatabilityHelper.IsLoaded(JCompatabilityHelper.CachedMods.LethalConfig))
{
LethalConfigHelper.CreateJLLModConfig();
}
HarmonyPatch(harmony, mls, typeof(ItemChargerPatch), typeof(TimeOfDayPatch), typeof(HudManagerPatch), typeof(StartOfRoundPatch), typeof(RoundManagerPatch), typeof(LungPropPatch), typeof(VehicleControllerPatch), typeof(MenuManagerPatch), typeof(BreakerBoxPatch), typeof(ItemDropshipPatch), typeof(GameNetworkManagerPatch), typeof(StormyWeatherPatch));
JFileHelper.LoadFilesInPlugins();
}
public static GameObject CreateNetworkPrefab(string name)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
GameObject val = new GameObject("JLL")
{
hideFlags = (HideFlags)61
};
val.transform.SetParent(JLLPrefabContainer);
byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + name));
Traverse.Create((object)val.AddComponent<NetworkObject>()).Field("GlobalObjectIdHash").SetValue((object)BitConverter.ToUInt32(value, 0));
return val;
}
public static void HarmonyPatch(Harmony harmony, ManualLogSource logSource, params Type[] patches)
{
foreach (Type type in patches)
{
try
{
harmony.PatchAll(type);
}
catch (Exception arg)
{
logSource.LogError((object)$"Caught Error while trying to patch {type.Name}\n{arg}");
}
}
}
public static void NetcodePatch(ManualLogSource logSource)
{
NetcodePatch(logSource, Assembly.GetCallingAssembly().GetTypes());
}
public static void NetcodePatch(ManualLogSource logSource, params Type[] types)
{
foreach (Type type in types)
{
try
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array = methods;
foreach (MethodInfo methodInfo in array)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
catch
{
logSource.LogInfo((object)"Skipping Netcode Class");
}
}
logSource.LogInfo((object)"Netcode Successfully Patched!");
}
}
}
namespace JLL.ScriptableObjects
{
[CreateAssetMenu(menuName = "JLL/JLevelProperties")]
public class JLevelProperties : ScriptableObject
{
[Header("-=-EXPERIMENTAL-=-")]
public JLevelPropertyEntry Properties = new JLevelPropertyEntry();
}
public abstract class JLLAddon : ScriptableObject
{
public abstract void Init(JLLMod parent);
}
[CreateAssetMenu(menuName = "JLL/JLLMod")]
public class JLLMod : ScriptableObject
{
[Serializable]
public class ConfigValue<T>
{
public string configName = "Example";
public string configCategory = "Main";
public string configDescription = "";
public T defaultValue;
}
private static readonly List<JLLMod> m_ModList = new List<JLLMod>();
public string modAuthor = "";
public string modName = "";
[Header("Network Prefabs")]
public JNetworkPrefabSet[] prefabSets = new JNetworkPrefabSet[0];
[Header("Config Values")]
public List<ConfigValue<bool>> Booleans = new List<ConfigValue<bool>>();
public List<ConfigValue<string>> Strings = new List<ConfigValue<string>>();
public List<ConfigValue<int>> Integers = new List<ConfigValue<int>>();
public List<ConfigValue<float>> Floats = new List<ConfigValue<float>>();
[Header("JLL Addons")]
public JLLAddon[] jllAddons = new JLLAddon[0];
public static JLLMod GetMod(string name, string author)
{
return GetMod(author + "." + name);
}
public static JLLMod GetMod(string guid)
{
for (int i = 0; i < m_ModList.Count; i++)
{
if (m_ModList[i].GUID() == guid)
{
return m_ModList[i];
}
}
return null;
}
public static JLLMod[] GetModsFromAuthor(string author)
{
List<JLLMod> list = new List<JLLMod>();
for (int i = 0; i < m_ModList.Count; i++)
{
if (m_ModList[i].modAuthor == author)
{
list.Add(m_ModList[i]);
}
}
return list.ToArray();
}
public string GUID()
{
return modAuthor + "." + modName;
}
public bool Invalid()
{
return Utility.IsNullOrWhiteSpace(modAuthor) || Utility.IsNullOrWhiteSpace(modName);
}
public bool HasConfigs()
{
return Booleans.Count + Strings.Count + Integers.Count + Floats.Count > 0;
}
internal void Init()
{
if (!m_ModList.Contains(this))
{
m_ModList.Add(this);
}
for (int i = 0; i < prefabSets.Length; i++)
{
if (!JNetworkPrefabSet.NetworkPrefabSets.Contains(prefabSets[i]))
{
JNetworkPrefabSet.NetworkPrefabSets.Add(prefabSets[i]);
}
}
for (int j = 0; j < jllAddons.Length; j++)
{
try
{
jllAddons[j].Init(this);
}
catch (Exception arg)
{
JLogHelper.LogError($"JLL Addon failed to initialize from {GUID()}: {arg}");
}
}
}
public JNetworkPrefabSet GetNetworkPrefabSet(string name)
{
for (int i = 0; i < prefabSets.Length; i++)
{
if (prefabSets[i].SetName == name)
{
return prefabSets[i];
}
}
return null;
}
}
[CreateAssetMenu(menuName = "JLL/JNetworkPrefabSet")]
public class JNetworkPrefabSet : ScriptableObject
{
[Serializable]
public class JIdentifiablePrefab : IWeightedItem
{
public string name;
public GameObject prefab;
[Range(0f, 100f)]
public int Weight = 20;
public int GetWeight()
{
return Weight;
}
}
public static readonly List<JNetworkPrefabSet> NetworkPrefabSets = new List<JNetworkPrefabSet>();
public string SetName;
public JIdentifiablePrefab[] prefabList = new JIdentifiablePrefab[1]
{
new JIdentifiablePrefab()
};
public static GameObject EmptyNetworkObject { get; internal set; }
public void AddPrefabs(params JIdentifiablePrefab[] prefabsToAdd)
{
List<JIdentifiablePrefab> list = prefabList.ToList();
list.AddRange(prefabsToAdd);
prefabList = list.ToArray();
}
public void AddPrefab(string name, GameObject prefab, int weight = 20)
{
AddPrefabs(new JIdentifiablePrefab
{
name = name,
prefab = prefab,
Weight = weight
});
}
internal static void RegisterPrefabs()
{
NetworkManager component = ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>();
List<GameObject> list = new List<GameObject>();
foreach (NetworkPrefab prefab in component.NetworkConfig.Prefabs.Prefabs)
{
list.Add(prefab.Prefab);
}
int num = 0;
foreach (JNetworkPrefabSet networkPrefabSet in NetworkPrefabSets)
{
for (int i = 0; i < networkPrefabSet.prefabList.Length; i++)
{
if (!((Object)(object)networkPrefabSet.prefabList[i].prefab == (Object)null) && !list.Contains(networkPrefabSet.prefabList[i].prefab))
{
try
{
component.AddNetworkPrefab(networkPrefabSet.prefabList[i].prefab);
num++;
JLogHelper.LogInfo("Registered Network Object: " + networkPrefabSet.prefabList[i].name + " (" + ((Object)networkPrefabSet.prefabList[i].prefab).name + ")", JLogLevel.Wesley);
}
catch (Exception arg)
{
JLogHelper.LogError($"JLL Addon failed to register network object: {arg}");
}
}
}
}
JLogHelper.LogInfo($"Registered {num} Network Objects");
}
public GameObject GetPrefab(string name)
{
for (int i = 0; i < prefabList.Length; i++)
{
if (prefabList[i].name == name)
{
return prefabList[i].prefab;
}
}
return EmptyNetworkObject;
}
public bool GetPrefab(string name, out GameObject prefab)
{
for (int i = 0; i < prefabList.Length; i++)
{
if (prefabList[i].name == name)
{
prefab = prefabList[i].prefab;
return true;
}
}
prefab = EmptyNetworkObject;
return false;
}
public GameObject GetRandomPrefab()
{
return prefabList.GetWeightedRandom().prefab;
}
}
}
namespace JLL.Patches
{
[HarmonyPatch(typeof(BreakerBox))]
internal static class BreakerBoxPatch
{
[HarmonyPatch("SwitchBreaker")]
[HarmonyPostfix]
public static void patchSwitchBreaker(bool on)
{
for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
{
JLevelEventTriggers.EventTriggers[i].ToggleBreakerBox(on);
}
}
[HarmonyPatch("SetSwitchesOff")]
[HarmonyPostfix]
public static void patchSetSwitchesOff()
{
for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
{
JLevelEventTriggers.EventTriggers[i].ToggleBreakerBox(active: false);
}
}
}
[HarmonyPatch(typeof(GameNetworkManager))]
internal static class GameNetworkManagerPatch
{
[CompilerGenerated]
private sealed class <RegisterNetworkPrefabs>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RegisterNetworkPrefabs>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (!JFileHelper.HaveJLLBundlesLoaded)
{
JLogHelper.LogInfo($"{JFileHelper.JLLBundlesLoaded} {JFileHelper.LLLBundlesLoaded}");
<>2__current = null;
<>1__state = 1;
return true;
}
JNetworkPrefabSet.RegisterPrefabs();
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 bool registeredPrefabs;
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void patchStart(GameNetworkManager __instance)
{
if (!registeredPrefabs)
{
registeredPrefabs = true;
((MonoBehaviour)__instance).StartCoroutine(RegisterNetworkPrefabs());
}
}
[IteratorStateMachine(typeof(<RegisterNetworkPrefabs>d__2))]
private static IEnumerator RegisterNetworkPrefabs()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RegisterNetworkPrefabs>d__2(0);
}
}
[HarmonyPatch(typeof(HUDManager))]
internal static class HudManagerPatch
{
[CompilerGenerated]
private sealed class <TipQueueCheck>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TipQueueCheck>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>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(5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
JHudHelper.isTipActive = false;
JHudHelper.DisplayNextTip();
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();
}
}
public static JWaterFilter customFilter;
[HarmonyPatch("UnderwaterScreenFilters")]
[HarmonyPrefix]
public static bool patchUnderwaterScreenFilters(HUDManager __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB localPlayer = __instance.localPlayer;
if ((Object)(object)__instance.localPlayer != (Object)null)
{
bool flag = false;
PlayerControllerB spectatedPlayerScript = localPlayer.spectatedPlayerScript;
if (localPlayer.isPlayerDead && (Object)(object)spectatedPlayerScript != (Object)null && (Object)(object)spectatedPlayerScript.underwaterCollider != (Object)null)
{
Bounds bounds = spectatedPlayerScript.underwaterCollider.bounds;
if (((Bounds)(ref bounds)).Contains(((Component)StartOfRound.Instance.spectateCamera).transform.position))
{
flag = true;
((Component)spectatedPlayerScript.underwaterCollider).TryGetComponent<JWaterFilter>(ref customFilter);
}
}
if ((Object)(object)customFilter == (Object)null && !localPlayer.isPlayerDead && (Object)(object)localPlayer.underwaterCollider != (Object)null)
{
((Component)localPlayer.underwaterCollider).TryGetComponent<JWaterFilter>(ref customFilter);
}
if ((Object)(object)customFilter != (Object)null)
{
if (__instance.setUnderwaterFilter || flag)
{
customFilter.UnderwaterFilters(__instance, flag);
__instance.breathingUnderwaterAudio.volume = Mathf.Lerp(__instance.breathingUnderwaterAudio.volume, 1f, 10f * Time.deltaTime);
if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
{
customFilter.customUnderwaterSounds.volume = __instance.breathingUnderwaterAudio.volume;
}
}
else
{
if (__instance.audioListenerLowPass.cutoffFrequency >= 19000f)
{
((Behaviour)__instance.audioListenerLowPass).enabled = false;
}
else
{
__instance.audioListenerLowPass.cutoffFrequency = Mathf.Lerp(__instance.audioListenerLowPass.cutoffFrequency, 20000f, 10f * Time.deltaTime);
}
if (customFilter.underwaterFilter.weight < 0.05f)
{
customFilter.underwaterFilter.weight = 0f;
__instance.breathingUnderwaterAudio.Stop();
if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
{
customFilter.customUnderwaterSounds.Stop();
}
customFilter = null;
}
else
{
__instance.breathingUnderwaterAudio.volume = Mathf.Lerp(__instance.breathingUnderwaterAudio.volume, 0f, 10f * Time.deltaTime);
if ((Object)(object)customFilter.customUnderwaterSounds != (Object)null)
{
customFilter.customUnderwaterSounds.volume = __instance.breathingUnderwaterAudio.volume;
}
customFilter.underwaterFilter.weight = Mathf.Lerp(customFilter.underwaterFilter.weight, 0f, 10f * Time.deltaTime);
}
}
return false;
}
}
return true;
}
[HarmonyPatch("DisplayTip")]
[HarmonyPrefix]
public static void patchDisplayTip(HUDManager __instance)
{
JHudHelper.isTipActive = true;
((MonoBehaviour)__instance).StartCoroutine(TipQueueCheck());
}
[IteratorStateMachine(typeof(<TipQueueCheck>d__3))]
private static IEnumerator TipQueueCheck()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TipQueueCheck>d__3(0);
}
}
[HarmonyPatch(typeof(ItemCharger))]
internal static class ItemChargerPatch
{
[HarmonyPatch("chargeItemDelayed")]
[HarmonyPrefix]
public static void patchChargeItemDelayed(ItemCharger __instance)
{
ChargeLimiter chargeLimiter = default(ChargeLimiter);
if (((Component)__instance).TryGetComponent<ChargeLimiter>(ref chargeLimiter))
{
JLogHelper.LogInfo("Found Limiter");
chargeLimiter.Charge();
}
}
}
[HarmonyPatch(typeof(ItemDropship))]
internal static class ItemDropshipPatch
{
[HarmonyPatch("OpenShipDoorsOnServer")]
[HarmonyPostfix]
public static void patchOpenShipDoorsOnServer(ItemDropship __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
JItemDropshipModifier jItemDropshipModifier = default(JItemDropshipModifier);
if (!((Component)__instance).TryGetComponent<JItemDropshipModifier>(ref jItemDropshipModifier))
{
return;
}
GrabbableObject val = default(GrabbableObject);
for (int i = 0; i < __instance.itemSpawnPositions.Length; i++)
{
Collider[] array = Physics.OverlapSphere(__instance.itemSpawnPositions[i].position, 0.5f, 64);
for (int j = 0; j < array.Length; j++)
{
if (((Component)array[j]).gameObject.TryGetComponent<GrabbableObject>(ref val))
{
JLogHelper.LogInfo("Found dropship item! " + val.itemProperties.itemName, JLogLevel.Wesley);
jItemDropshipModifier.ModifyDroppedItems(val);
}
}
}
}
}
public static class JTranspilerHelper
{
[CompilerGenerated]
private sealed class <CodeEdit>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
{
private int <>1__state;
private CodeInstruction <>2__current;
private int <>l__initialThreadId;
private IEnumerable<CodeInstruction> instructions;
public IEnumerable<CodeInstruction> <>3__instructions;
private string debugName;
public string <>3__debugName;
private CodeOperation operation;
public CodeOperation <>3__operation;
private List<CodeInstruction> <newInstructions>5__1;
private int <found>5__2;
private IEnumerator<CodeInstruction> <>s__3;
private CodeInstruction <instruction>5__4;
private List<CodeInstruction>.Enumerator <>s__5;
private CodeInstruction <instruction>5__6;
CodeInstruction IEnumerator<CodeInstruction>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CodeEdit>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<newInstructions>5__1 = null;
<>s__3 = null;
<instruction>5__4 = null;
<>s__5 = default(List<CodeInstruction>.Enumerator);
<instruction>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<newInstructions>5__1 = new List<CodeInstruction>();
<found>5__2 = 0;
<>s__3 = instructions.GetEnumerator();
try
{
while (<>s__3.MoveNext())
{
<instruction>5__4 = <>s__3.Current;
<newInstructions>5__1.Add(<instruction>5__4);
if (operation.Check(<instruction>5__4, ref <newInstructions>5__1))
{
<found>5__2++;
}
<instruction>5__4 = null;
}
}
finally
{
if (<>s__3 != null)
{
<>s__3.Dispose();
}
}
<>s__3 = null;
JLogHelper.LogInfo($"Patched {debugName}: {<found>5__2}");
<>s__5 = <newInstructions>5__1.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<instruction>5__6 = null;
break;
}
if (<>s__5.MoveNext())
{
<instruction>5__6 = <>s__5.Current;
<>2__current = <instruction>5__6;
<>1__state = 1;
return true;
}
<>m__Finally1();
<>s__5 = default(List<CodeInstruction>.Enumerator);
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__5).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
{
<CodeEdit>d__1 <CodeEdit>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<CodeEdit>d__ = this;
}
else
{
<CodeEdit>d__ = new <CodeEdit>d__1(0);
}
<CodeEdit>d__.instructions = <>3__instructions;
<CodeEdit>d__.debugName = <>3__debugName;
<CodeEdit>d__.operation = <>3__operation;
return <CodeEdit>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
}
}
[CompilerGenerated]
private sealed class <MultiCodeEdit>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
{
private int <>1__state;
private CodeInstruction <>2__current;
private int <>l__initialThreadId;
private IEnumerable<CodeInstruction> instructions;
public IEnumerable<CodeInstruction> <>3__instructions;
private string debugName;
public string <>3__debugName;
private CodeOperation[] operations;
public CodeOperation[] <>3__operations;
private List<CodeInstruction> <newInstructions>5__1;
private int[] <found>5__2;
private int <i>5__3;
private IEnumerator<CodeInstruction> <>s__4;
private CodeInstruction <instruction>5__5;
private int <i>5__6;
private CodeOperation[] <>s__7;
private int <>s__8;
private CodeOperation <op>5__9;
private List<CodeInstruction>.Enumerator <>s__10;
private CodeInstruction <instruction>5__11;
CodeInstruction IEnumerator<CodeInstruction>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MultiCodeEdit>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<newInstructions>5__1 = null;
<found>5__2 = null;
<>s__4 = null;
<instruction>5__5 = null;
<>s__7 = null;
<op>5__9 = null;
<>s__10 = default(List<CodeInstruction>.Enumerator);
<instruction>5__11 = null;
<>1__state = -2;
}
private bool MoveNext()
{
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<newInstructions>5__1 = new List<CodeInstruction>();
<found>5__2 = new int[operations.Length];
<i>5__3 = 0;
while (<i>5__3 < <found>5__2.Length)
{
<found>5__2[<i>5__3] = 0;
<i>5__3++;
}
<>s__4 = instructions.GetEnumerator();
try
{
while (<>s__4.MoveNext())
{
<instruction>5__5 = <>s__4.Current;
<newInstructions>5__1.Add(<instruction>5__5);
<i>5__6 = 0;
while (<i>5__6 < operations.Length)
{
if (operations[<i>5__6].Check(<instruction>5__5, ref <newInstructions>5__1))
{
<found>5__2[<i>5__6]++;
<>s__7 = operations;
for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
{
<op>5__9 = <>s__7[<>s__8];
<op>5__9.matches = 0;
<op>5__9 = null;
}
<>s__7 = null;
break;
}
<i>5__6++;
}
<instruction>5__5 = null;
}
}
finally
{
if (<>s__4 != null)
{
<>s__4.Dispose();
}
}
<>s__4 = null;
JLogHelper.LogInfo("Patched " + debugName + ": [" + string.Join(", ", <found>5__2) + "]");
<>s__10 = <newInstructions>5__1.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<instruction>5__11 = null;
break;
}
if (<>s__10.MoveNext())
{
<instruction>5__11 = <>s__10.Current;
<>2__current = <instruction>5__11;
<>1__state = 1;
return true;
}
<>m__Finally1();
<>s__10 = default(List<CodeInstruction>.Enumerator);
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__10).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
{
<MultiCodeEdit>d__2 <MultiCodeEdit>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<MultiCodeEdit>d__ = this;
}
else
{
<MultiCodeEdit>d__ = new <MultiCodeEdit>d__2(0);
}
<MultiCodeEdit>d__.instructions = <>3__instructions;
<MultiCodeEdit>d__.debugName = <>3__debugName;
<MultiCodeEdit>d__.operations = <>3__operations;
return <MultiCodeEdit>d__;
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
}
}
public static IEnumerable<CodeInstruction> CodeEdit(IEnumerable<CodeInstruction> instructions, string debugName, CodeTest[] search, Action<List<CodeInstruction>> action)
{
return CodeEdit(instructions, debugName, new CodeOperation(search, action));
}
[IteratorStateMachine(typeof(<CodeEdit>d__1))]
public static IEnumerable<CodeInstruction> CodeEdit(IEnumerable<CodeInstruction> instructions, string debugName, CodeOperation operation)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CodeEdit>d__1(-2)
{
<>3__instructions = instructions,
<>3__debugName = debugName,
<>3__operation = operation
};
}
[IteratorStateMachine(typeof(<MultiCodeEdit>d__2))]
public static IEnumerable<CodeInstruction> MultiCodeEdit(IEnumerable<CodeInstruction> instructions, string debugName, params CodeOperation[] operations)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MultiCodeEdit>d__2(-2)
{
<>3__instructions = instructions,
<>3__debugName = debugName,
<>3__operations = operations
};
}
public static IEnumerable<CodeInstruction> AddAfter(IEnumerable<CodeInstruction> instructions, string debugName, CodeTest[] search, MethodInfo methodInfo, MethodParams methodParams = MethodParams.Empty, bool replace = false)
{
IEnumerable<CodeInstruction> paramInstructions = ((IEnumerable<OpCode>)GetCodes(methodParams)).Select((Func<OpCode, CodeInstruction>)((OpCode code) => new CodeInstruction(code, (object)null)));
Action<List<CodeInstruction>> action = (replace ? ((Action<List<CodeInstruction>>)delegate(List<CodeInstruction> list)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
for (int i = 0; i < search.Length; i++)
{
list.RemoveAt(list.Count - 1);
}
list.AddRange(paramInstructions);
list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo));
}) : ((Action<List<CodeInstruction>>)delegate(List<CodeInstruction> list)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
list.AddRange(paramInstructions);
list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo));
}));
return CodeEdit(instructions, debugName, new CodeOperation(search, action));
}
public static IEnumerable<CodeInstruction> AddAfter(IEnumerable<CodeInstruction> instructions, string debugName, MethodInfo orig, MethodInfo methodInfo, MethodParams methodParams = MethodParams.Empty, bool replace = false)
{
List<CodeTest> list = new List<CodeTest>();
list.AddRange(from code in GetCodes(methodParams)
select new CodeTest(code));
list.Add(new CodeTest(OpCodes.Call, (CodeInstruction code) => CodeInstructionExtensions.Calls(code, orig)));
return AddAfter(instructions, debugName, list.ToArray(), methodInfo, methodParams, replace);
}
public static IEnumerable<CodeInstruction> AddAfter(IEnumerable<CodeInstruction> instructions, string debugName, FieldInfo orig, MethodInfo methodInfo, MethodParams methodParams = MethodParams.Empty, bool replace = false)
{
List<CodeTest> list = new List<CodeTest>();
list.AddRange(from code in GetCodes(methodParams)
select new CodeTest(code));
list.Add(new CodeTest(OpCodes.Ldfld, (CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, orig, false)));
return AddAfter(instructions, debugName, list.ToArray(), methodInfo, methodParams, replace);
}
private static OpCode[] GetCodes(MethodParams methodParams)
{
if (1 == 0)
{
}
OpCode[] result = methodParams switch
{
MethodParams.Self => new OpCode[1] { OpCodes.Ldarg_0 },
MethodParams.EnumerableSelf => new OpCode[1] { OpCodes.Ldloc_1 },
_ => Array.Empty<OpCode>(),
};
if (1 == 0)
{
}
return result;
}
}
public struct CodeTest
{
public OpCode? OpCode;
public Func<CodeInstruction, bool> Test;
public CodeTest(OpCode code)
{
OpCode = code;
Test = null;
}
public CodeTest(Func<CodeInstruction, bool> test)
{
OpCode = null;
Test = test;
}
public CodeTest(OpCode code, Func<CodeInstruction, bool> test)
{
OpCode = code;
Test = test;
}
public readonly bool Validate(CodeInstruction code)
{
if (OpCode.HasValue)
{
OpCode opcode = code.opcode;
OpCode? opCode = OpCode;
if (opcode != opCode)
{
return false;
}
}
if (Test == null)
{
return true;
}
return Test(code);
}
}
public class CodeOperation
{
public CodeTest[] Test;
public Action<List<CodeInstruction>> Action;
public int matches;
public CodeOperation(CodeTest[] test, Action<List<CodeInstruction>> action)
{
Test = test;
Action = action;
matches = 0;
base..ctor();
}
public bool Check(CodeInstruction instruction, ref List<CodeInstruction> newInstructions)
{
if (Test[matches].Validate(instruction))
{
matches++;
if (matches == Test.Length)
{
Action(newInstructions);
matches = 0;
return true;
}
}
else
{
matches = 0;
}
return false;
}
}
public enum MethodParams
{
Empty,
Self,
EnumerableSelf
}
[HarmonyPatch(typeof(LungProp))]
internal static class LungPropPatch
{
private static EnemyType VanillaRadMech;
[HarmonyPatch("EquipItem")]
[HarmonyPrefix]
public static void patchEquipItem(LungProp __instance)
{
if (__instance.isLungDocked)
{
if ((Object)(object)VanillaRadMech == (Object)null)
{
VanillaRadMech = JLevelPropertyRegistry.GetRegisteredEnemy("RadMech");
}
__instance.radMechEnemyType = VanillaRadMech;
JLevelPropertyRegistry.ApparatusPulled = true;
for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
{
JLevelEventTriggers.EventTriggers[i].InvokeApparatus();
}
}
}
}
[HarmonyPatch(typeof(MenuManager))]
internal static class MenuManagerPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
public static void patchStart()
{
JLevelPropertyRegistry.RemoveLevelOverrides();
}
}
[HarmonyPatch(typeof(RoundManager))]
internal static class RoundManagerPatch
{
[HarmonyPatch("FinishGeneratingLevel")]
[HarmonyPrefix]
public static void spawnFinishGeneratingLevel()
{
JMaterialReplacer[] array = Object.FindObjectsOfType<JMaterialReplacer>();
for (int i = 0; i < array.Length; i++)
{
if (array[i].triggerPostDunGen)
{
array[i].SearchAndReplace();
}
}
}
[HarmonyPatch("FinishGeneratingNewLevelClientRpc")]
[HarmonyPostfix]
public static void patchPostLevelGeneration()
{
if (JLevelPropertyRegistry.IsLevelGenerated)
{
return;
}
JLevelPropertyRegistry.ApplyLevelOverrides();
IDungeonLoadListener[] array = Object.FindObjectsOfType<MonoBehaviour>().OfType<IDungeonLoadListener>().ToArray();
if (array.Length != 0)
{
for (int i = 0; i < array.Length; i++)
{
array[i].PostDungeonGeneration();
}
}
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal static class StartOfRoundPatch
{
[CompilerGenerated]
private sealed class <StoreDefaults>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private List<EnemyType> <enemyTypes>5__1;
private SelectableLevel <allEnemiesLevel>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StoreDefaults>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<enemyTypes>5__1 = null;
<allEnemiesLevel>5__2 = 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;
<enemyTypes>5__1 = new List<EnemyType>();
<allEnemiesLevel>5__2 = Object.FindObjectOfType<QuickMenuManager>().testAllEnemiesLevel;
FindEnemyTypes(<allEnemiesLevel>5__2.Enemies, ref <enemyTypes>5__1);
FindEnemyTypes(<allEnemiesLevel>5__2.OutsideEnemies, ref <enemyTypes>5__1);
FindEnemyTypes(<allEnemiesLevel>5__2.DaytimeEnemies, ref <enemyTypes>5__1);
JLevelPropertyRegistry.AllSortedEnemies.Clear();
JLevelPropertyRegistry.AllSortedEnemies.AddRange(<enemyTypes>5__1);
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();
}
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void StartOfRound_Start(StartOfRound __instance)
{
if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
{
GameObject val = Object.Instantiate<GameObject>(JLL.Instance.networkObject);
val.GetComponent<NetworkObject>().Spawn(false);
JLogHelper.LogInfo("JLL Network Manager Initialized.", JLogLevel.User);
}
((MonoBehaviour)__instance).StartCoroutine(StoreDefaults());
}
[IteratorStateMachine(typeof(<StoreDefaults>d__1))]
private static IEnumerator StoreDefaults()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StoreDefaults>d__1(0);
}
private static void FindEnemyTypes(List<SpawnableEnemyWithRarity> spawnableEnemies, ref List<EnemyType> enemyTypes)
{
for (int i = 0; i < spawnableEnemies.Count; i++)
{
if ((Object)(object)spawnableEnemies[i].enemyType != (Object)null && !enemyTypes.Contains(spawnableEnemies[i].enemyType))
{
enemyTypes.Add(spawnableEnemies[i].enemyType);
}
}
}
[HarmonyPatch("EndOfGame")]
[HarmonyPrefix]
public static void patchEndOfGame()
{
JWeatherOverride.Instance = null;
if ((Object)(object)HudManagerPatch.customFilter != (Object)null)
{
HudManagerPatch.customFilter.underwaterFilter.weight = 0f;
HudManagerPatch.customFilter = null;
}
JLevelPropertyRegistry.RemoveLevelOverrides();
}
[HarmonyPatch("OnShipLandedMiscEvents")]
[HarmonyPrefix]
public static void patchOnShipLandedMiscEvents()
{
for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
{
JLevelEventTriggers.EventTriggers[i].ShipLanded.Invoke();
}
}
[HarmonyPatch("ShipLeave")]
[HarmonyPrefix]
public static void patchShipLeave()
{
for (int i = 0; i < JLevelEventTriggers.EventTriggers.Count; i++)
{
JLevelEventTriggers.EventTriggers[i].ShipLeaving.Invoke();
}
}
}
[HarmonyPatch(typeof(StormyWeather))]
internal static class StormyWeatherPatch
{
[HarmonyPatch("LightningStrike")]
[HarmonyPostfix]
public static void patchLightningStrike(Vector3 strikePosition)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
foreach (JLightningRod item in JLightningRod.All)
{
if (Vector3.Distance(strikePosition, ((Component)item).transform.position) < item.detectDist)
{
item.onStrike.Invoke();
}
}
}
}
[HarmonyPatch(typeof(TimeOfDay))]
internal static class TimeOfDayPatch
{
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(TimeOfDay), "DisableWeatherEffect")]
public static void DisableWeatherEffect(object instance, WeatherEffect effect)
{
throw new NotImplementedException("It's a stub");
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(TimeOfDay), "fadeOutEffect")]
public static IEnumerator fadeOutEffect(object instance, WeatherEffect effect, Vector3 moveFromPosition)
{
throw new NotImplementedException("It's a stub");
}
[HarmonyPatch("DisableWeatherEffect")]
[HarmonyPrefix]
public static void DisableWeatherEffect(WeatherEffect effect)
{
JWeatherOverride instance = JWeatherOverride.Instance;
if ((Object)(object)instance != (Object)null)
{
WeatherEffect overrideEffect = instance.getOverrideEffect(effect.name);
if (overrideEffect != null && (Object)(object)overrideEffect.effectObject != (Object)null)
{
overrideEffect.effectObject.SetActive(false);
}
}
}
[HarmonyPatch("DisableAllWeather")]
[HarmonyPrefix]
public static void DisableAllWeather(bool deactivateObjects)
{
JWeatherOverride instance = JWeatherOverride.Instance;
if (!((Object)(object)instance != (Object)null))
{
return;
}
for (int i = 0; i < instance.overrideEffects.Length; i++)
{
WeatherEffect val = instance.overrideEffects[i];
val.effectEnabled = false;
if (deactivateObjects && (Object)(object)val.effectObject != (Object)null)
{
val.effectObject.SetActive(false);
}
}
}
[HarmonyPatch("MoveTimeOfDay")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> MoveTimeOfDay_Transpiler(IEnumerable<CodeInstruction> instructions)
{
FieldInfo HourField = AccessTools.Field(typeof(TimeOfDay), "hour");
FieldInfo PrevHourField = AccessTools.Field(typeof(TimeOfDay), "previousHour");
MethodInfo methodInfo = AccessTools.Method(typeof(TimeOfDayPatch), "ProgressHour", (Type[])null, (Type[])null);
return JTranspilerHelper.AddAfter(instructions, "MoveTimeOfDay", new CodeTest[4]
{
new CodeTest(OpCodes.Ldarg_0),
new CodeTest(OpCodes.Ldarg_0),
new CodeTest(OpCodes.Ldfld, (CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, HourField, false)),
new CodeTest(OpCodes.Stfld, (CodeInstruction code) => CodeInstructionExtensions.StoresField(code, PrevHourField))
}, methodInfo, MethodParams.Self);
}
private static void ProgressHour(TimeOfDay timeOfDay)
{
try
{
foreach (JLevelEventTriggers eventTrigger in JLevelEventTriggers.EventTriggers)
{
JLevelEventTriggers.HourEvent[] hourlyEvents = eventTrigger.hourlyEvents;
foreach (JLevelEventTriggers.HourEvent hourEvent in hourlyEvents)
{
if (hourEvent.hour == timeOfDay.hour)
{
hourEvent.hourEvent.Invoke();
}
}
}
}
catch (Exception ex)
{
JLogHelper.LogError(ex.ToString());
}
}
}
[HarmonyPatch(typeof(VehicleController))]
public static class VehicleControllerPatch
{
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(VehicleController), "DealPermanentDamage")]
public static void DealPermanentDamage(object instance, int damageAmount, Vector3 damagePosition = default(Vector3))
{
throw new NotImplementedException("It's a stub");
}
}
}
namespace JLL.Components
{
public class AttatchToObject : MonoBehaviour
{
public Transform parent;
public bool attatchPos = true;
public bool attatchRot = true;
private void Update()
{
UpdatePosition();
}
private void LateUpdate()
{
UpdatePosition();
}
public void UpdatePosition()
{
//IL_003d: 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)
if (!((Object)(object)parent == (Object)null) && Object.op_Implicit((Object)(object)parent))
{
if (attatchPos)
{
((Component)this).transform.position = parent.position;
}
if (attatchRot)
{
((Component)this).transform.rotation = parent.rotation;
}
}
}
}
public class ChargeLimiter : MonoBehaviour
{
public int charges = 1;
public InteractTrigger trigger;
public GameObject disableObject;
public void Charge()
{
charges--;
if (charges <= 0)
{
SetHasCharge(value: false);
}
}
public void SetHasCharge(bool value)
{
BoxCollider val = default(BoxCollider);
if ((Object)(object)trigger != (Object)null && ((Component)trigger).TryGetComponent<BoxCollider>(ref val))
{
((Collider)val).enabled = value;
}
if ((Object)(object)disableObject != (Object)null)
{
disableObject.SetActive(value);
}
}
public void AddCharges(int amount)
{
charges += amount;
}
}
public class ClientSeperator : MonoBehaviour
{
[Tooltip("Event run for the given client.")]
public InteractEvent eventsForClient = new InteractEvent();
[Tooltip("Event run for every client except the given one.")]
public UnityEvent eventsForEveryoneElse = new UnityEvent();
public void SeperateClientEvents(PlayerControllerB player)
{
if (player.IsLocalPlayer())
{
((UnityEvent<PlayerControllerB>)(object)eventsForClient).Invoke(player);
}
else
{
eventsForEveryoneElse.Invoke();
}
}
}
public class DamageTrigger : MonoBehaviour
{
[Serializable]
public class DamageTarget<T>
{
public bool enabled = false;
public int damage = 1;
public bool applyDamageMultiplier = true;
public bool playCustomSounds = true;
public UnityEvent<T> hitEvent = new UnityEvent<T>();
public int GetTotalDamage(float multiplier = 1f)
{
if (applyDamageMultiplier)
{
return Mathf.RoundToInt((float)damage * multiplier);
}
return damage;
}
}
[SerializeField]
public CauseOfDeath damageSource = (CauseOfDeath)0;
public Vector3 hitDir = Vector3.zero;
public RotationType hitRotation = RotationType.ObjectRotation;
[Tooltip("Check RoundManager in the Ship Scene for corpse IDs\nA negative copseType will result in no corpse spawning.")]
public int corpseType = 0;
public Mesh OverrideCorpseMesh;
public bool attachCorpseToPoint = false;
public Transform corpseAttachPoint;
public PlayerBone connectedBone = PlayerBone.Base;
public bool matchPointExactly = false;
[Tooltip("Negative number will stay stuck to a point indefinately.")]
public float corpseStickTime = 2f;
[Header("NetworkHelper")]
[Tooltip("This is only required to trigger some network related events.")]
public DamageTriggerNetworking DamageTriggerNetworking;
[Header("Conditions")]
[Tooltip("Damage when something enters a trigger collider")]
public bool damageOnEnter = true;
[Tooltip("Damage when something exits a trigger collider")]
public bool damageOnExit = false;
[Tooltip("Damage when something collides with a non trigger collider")]
public bool damageOnCollision = true;
[Header("Continuous Damage")]
[Tooltip("Continuously damages anything inside of it's trigger collider")]
public bool continuousDamage = true;
[Tooltip("Continuously calculates a raycast and attempts to damage the whatever the ray hits")]
public bool continuousRaycastDamage = false;
public float hitInterval = 0.5f;
private float timer = 0f;
[Header("Raycast")]
public float raycastLength = 6f;
public Transform[] raycastDirections = Array.Empty<Transform>();
public LayerMask raycastMask = LayerMask.op_Implicit(1202194760);
[Header("Targets")]
public float damageMultiplier = 1f;
[Tooltip("Players have 100 HP")]
public DamageTarget<PlayerControllerB> playerTargets = new DamageTarget<PlayerControllerB>();
[Tooltip("Any instance of EnemyAICollisionDetect converted to EnemyAI")]
public DamageTarget<EnemyAI> enemyTargets = new DamageTarget<EnemyAI>();
[Tooltip("The Company Cruiser has 30 HP")]
public DamageTarget<VehicleController> vehicleTargets = new DamageTarget<VehicleController>();
[Tooltip("Anything that is damageable by shovels but not one of the things above")]
public DamageTarget<IHittable> objectTargets = new DamageTarget<IHittable>();
[Header("SFX")]
public bool playNormalDamageSFX = true;
public AudioClip[] clips = Array.Empty<AudioClip>();
public AudioSource[] sources = Array.Empty<AudioSource>();
private readonly Dictionary<GameObject, int> collidersInside = new Dictionary<GameObject, int>();
private readonly List<GameObject> markedForRemoval = new List<GameObject>();
private readonly List<GameObject> foundInside = new List<GameObject>();
private void Start()
{
if ((Object)(object)DamageTriggerNetworking != (Object)null)
{
DamageTriggerNetworking.DamageTrigger = this;
}
}
public void OnTriggerStay(Collider collider)
{
foundInside.Add(((Component)collider).gameObject);
if (collidersInside.ContainsKey(((Component)collider).gameObject))
{
return;
}
int num = IdentifyCollider(((Component)collider).gameObject);
if (!IsTargetDead(((Component)collider).gameObject, num))
{
collidersInside.Add(((Component)collider).gameObject, num);
if (damageOnEnter)
{
DamageType(((Component)collider).gameObject, num);
}
}
}
public void FixedUpdate()
{
foreach (KeyValuePair<GameObject, int> item in collidersInside)
{
if (!foundInside.Contains(item.Key))
{
if (damageOnExit)
{
DamageType(item.Key, item.Value);
}
markedForRemoval.Add(item.Key);
}
}
foundInside.Clear();
}
public void OnDisable()
{
collidersInside.Clear();
}
public void OnCollisionEnter(Collision collision)
{
if (damageOnCollision)
{
int num = IdentifyCollider(collision.gameObject);
if (num != -1)
{
DamageType(collision.gameObject, num);
}
}
}
private void OnDrawGizmos()
{
//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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
if (raycastLength > 0f)
{
for (int i = 0; i < raycastDirections.Length; i++)
{
Gizmos.color = Color.red;
Gizmos.DrawRay(((Component)this).transform.position, GetRayDirection(raycastDirections[i]) * raycastLength);
}
}
}
public void Update()
{
for (int i = 0; i < markedForRemoval.Count; i++)
{
collidersInside.Remove(markedForRemoval[i]);
}
markedForRemoval.Clear();
if (!continuousDamage && !continuousRaycastDamage)
{
return;
}
timer -= Time.deltaTime;
if (timer <= 0f)
{
timer = hitInterval;
if (continuousDamage)
{
DamageAllInside();
}
if (continuousRaycastDamage)
{
DamageRaycast();
}
}
}
public void DamageAllInside()
{
foreach (KeyValuePair<GameObject, int> item in collidersInside)
{
DamageType(item.Key, item.Value);
}
}
private void DamageType(GameObject target, int type)
{
switch (type)
{
case 0:
if (playerTargets.enabled)
{
DamagePlayer(target.GetComponent<PlayerControllerB>());
}
break;
case 1:
if (enemyTargets.enabled)
{
DamageEnemy(target.GetComponent<EnemyAICollisionDetect>().mainScript);
}
break;
case 2:
if (vehicleTargets.enabled)
{
DamageVehicle(target.GetComponent<VehicleController>());
}
break;
case 3:
if (objectTargets.enabled)
{
DamageObject(target.GetComponent<IHittable>());
}
break;
}
}
public static bool IsTargetDead(GameObject target, int type)
{
if (1 == 0)
{
}
bool result = type switch
{
0 => target.GetComponent<PlayerControllerB>().isPlayerDead,
1 => target.GetComponent<EnemyAICollisionDetect>().mainScript.isEnemyDead,
2 => target.GetComponent<VehicleController>().carDestroyed,
_ => false,
};
if (1 == 0)
{
}
return result;
}
public void DamageRaycast()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
if (!(raycastLength > 0f))
{
return;
}
RaycastHit val = default(RaycastHit);
for (int i = 0; i < raycastDirections.Length; i++)
{
if (Physics.Raycast(((Component)this).transform.position, GetRayDirection(raycastDirections[i]), ref val, raycastLength, LayerMask.op_Implicit(raycastMask)))
{
int num = IdentifyCollider(((Component)((RaycastHit)(ref val)).collider).gameObject);
if (num != -1)
{
DamageType(((Component)((RaycastHit)(ref val)).collider).gameObject, num);
}
}
}
}
private Vector3 GetRayDirection(Transform target)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = target.position - ((Component)this).transform.position;
return ((Vector3)(ref val)).normalized;
}
public static int IdentifyCollider(GameObject target)
{
if (target.CompareTag("Player"))
{
PlayerControllerB val = default(PlayerControllerB);
if (target.TryGetComponent<PlayerControllerB>(ref val))
{
return 0;
}
}
else if (target.CompareTag("Enemy"))
{
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
if (target.TryGetComponent<EnemyAICollisionDetect>(ref val2))
{
return 1;
}
}
else
{
VehicleController val3 = default(VehicleController);
if (target.TryGetComponent<VehicleController>(ref val3))
{
return 2;
}
IHittable val4 = default(IHittable);
if (target.TryGetComponent<IHittable>(ref val4))
{
return 3;
}
}
return -1;
}
private Vector3 CalcHitDir(Transform target)
{
//IL_001d: 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_002c: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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)
RotationType rotationType = hitRotation;
if (1 == 0)
{
}
Vector3 result = (Vector3)(rotationType switch
{
RotationType.ObjectRotation => Quaternion.AngleAxis(((Component)this).transform.rotation.y, Vector3.up) * hitDir,
RotationType.RandomRotation => Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.up) * hitDir,
_ => hitDir,
});
if (1 == 0)
{
}
return result;
}
public void SetDamageMultiplier(float multiplier)
{
damageMultiplier = multiplier;
}
public void DamagePlayer(PlayerControllerB player)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
if (player.isPlayerDead)
{
markedForRemoval.Add(((Component)player).gameObject);
return;
}
int totalDamage = playerTargets.GetTotalDamage(damageMultiplier);
CauseOfDeath val = damageSource;
Vector3 val2 = CalcHitDir(((Component)player).transform);
player.DamagePlayer(totalDamage, playNormalDamageSFX, true, val, Mathf.Clamp(corpseType, 0, StartOfRound.Instance.playerRagdolls.Count - 1), false, val2);
playerTargets.hitEvent.Invoke(player);
if (player.isPlayerDead)
{
if ((Object)(object)DamageTriggerNetworking != (Object)null)
{
DamageTriggerNetworking.DamageTriggerKilledPlayerServerRpc(player.Index());
}
else if (corpseType < 0)
{
JLLNetworkManager.Instance.DestroyPlayerCorpse(player);
}
}
if (playerTargets.playCustomSounds)
{
PlayCustomAudio();
}
}
public void SetPlayerDamage(int damage)
{
playerTargets.damage = damage;
}
public void DamageEnemy(EnemyAI enemy)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (enemy.isEnemyDead)
{
markedForRemoval.Add(((Component)enemy).gameObject);
return;
}
enemy.HitEnemyOnLocalClient(enemyTargets.GetTotalDamage(damageMultiplier), CalcHitDir(((Component)enemy).transform), (PlayerControllerB)null, playNormalDamageSFX, -1);
enemyTargets.hitEvent.Invoke(enemy);
if ((((NetworkBehaviour)RoundManager.Instance).IsHost || ((NetworkBehaviour)RoundManager.Instance).IsServer) && enemy.isEnemyDead && (Object)(object)DamageTriggerNetworking != (Object)null)
{
DamageTriggerNetworking.DamageTriggerKilledServerRpc(1);
}
if (enemyTargets.playCustomSounds)
{
PlayCustomAudio();
}
}
public void SetEnemyDamage(int damage)
{
enemyTargets.damage = damage;
}
public void DamageVehicle(VehicleController vehicle)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (vehicle.carDestroyed)
{
markedForRemoval.Add(((Component)vehicle).gameObject);
return;
}
VehicleControllerPatch.DealPermanentDamage(vehicle, vehicleTargets.GetTotalDamage(damageMultiplier), CalcHitDir(((Component)vehicle).transform));
vehicleTargets.hitEvent.Invoke(vehicle);
if (((NetworkBehaviour)vehicle).IsOwner && vehicle.carDestroyed && (Object)(object)DamageTriggerNetworking != (Object)null)
{
DamageTriggerNetworking.DamageTriggerKilledServerRpc(2);
}
if (vehicleTargets.playCustomSounds)
{
PlayCustomAudio();
}
}
public void SetVehicleDamage(int damage)
{
vehicleTargets.damage = damage;
}
public void DamageObject(IHittable obj)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
int totalDamage = objectTargets.GetTotalDamage(damageMultiplier);
MonoBehaviour val = (MonoBehaviour)(object)((obj is MonoBehaviour) ? obj : null);
obj.Hit(totalDamage, CalcHitDir((val != null) ? ((Component)val).transform : ((Component)this).transform), (PlayerControllerB)null, playNormalDamageSFX, -1);
objectTargets.hitEvent.Invoke(obj);
if (objectTargets.playCustomSounds)
{
PlayCustomAudio();
}
}
public void SetObjectDamage(int damage)
{
objectTargets.damage = damage;
}
private void PlayCustomAudio()
{
if (clips.Length != 0 && sources.Length != 0)
{
AudioClip clip = clips[Random.Range(0, clips.Length)];
AudioSource[] array = sources;
foreach (AudioSource val in array)
{
val.clip = clip;
val.Play();
}
}
}
}
public class DamageTriggerNetworking : NetworkBehaviour
{
private class PlayerCorpse
{
public PlayerControllerB player;
public float startTime = 0f;
public float stickTime = 0f;
public bool permaStuck = false;
private bool stuck = false;
private bool initialized = false;
public bool Update(DamageTrigger trigger)
{
if (permaStuck && initialized)
{
return true;
}
if ((Object)(object)player.deadBody != (Object)null)
{
if (!initialized)
{
if (trigger.corpseType < 0)
{
Object.Destroy((Object)(object)((Component)player.deadBody).gameObject);
player.deadBody = null;
return false;
}
if (permaStuck)
{
OverrideModel(trigger);
}
if (trigger.attachCorpseToPoint && (Object)(object)trigger.corpseAttachPoint != (Object)null)
{
JLogHelper.LogInfo("Attatching " + player.playerUsername + "'s corpse to " + ((Object)trigger.corpseAttachPoint).name);
player.deadBody.matchPositionExactly = trigger.matchPointExactly;
player.deadBody.attachedTo = trigger.corpseAttachPoint;
player.deadBody.attachedLimb = player.deadBody.bodyParts[(int)trigger.connectedBone];
stuck = true;
}
initialized = true;
}
if (!(stickTime > 0f))
{
OverrideModel(trigger);
return false;
}
if (stuck)
{
stickTime -= Time.deltaTime;
}
if (stickTime <= 0f)
{
DetachCorpse();
}
}
else if (Time.realtimeSinceStartup - startTime > 2f)
{
JLogHelper.LogInfo("Player Corpse could not be found after two seconds!");
return false;
}
return true;
}
public void OverrideModel(DamageTrigger trigger)
{
if ((Object)(object)trigger.OverrideCorpseMesh != (Object)null)
{
player.deadBody.ChangeMesh(trigger.OverrideCorpseMesh, (Material)null);
}
}
public void DetachCorpse()
{
JLogHelper.LogInfo("Releasing " + player.playerUsername + "'s corpse");
player.deadBody.matchPositionExactly = false;
player.deadBody.attachedTo = null;
player.deadBody.attachedLimb = null;
stuck = false;
permaStuck = false;
stickTime = 0f;
}
}
public DamageTrigger DamageTrigger;
[Tooltip("Warning!\nThe player will be dead at the time of this event. Be careful what you do when passing a player to another method that you don't break anything.")]
public InteractEvent PlayerKilled = new InteractEvent();
public UnityEvent EnemyKilled = new UnityEvent();
public UnityEvent VehicleKilled = new UnityEvent();
private readonly List<PlayerCorpse> playerCorpses = new List<PlayerCorpse>();
private readonly List<PlayerCorpse> removeCorpses = new List<PlayerCorpse>();
private void Update()
{
if ((Object)(object)DamageTrigger == (Object)null || playerCorpses.Count <= 0)
{
return;
}
for (int i = 0; i < playerCorpses.Count; i++)
{
if (!playerCorpses[i].Update(DamageTrigger))
{
removeCorpses.Add(playerCorpses[i]);
}
}
for (int j = 0; j < removeCorpses.Count; j++)
{
playerCorpses.Remove(removeCorpses[j]);
}
removeCorpses.Clear();
}
[ServerRpc(RequireOwnership = false)]
public void DamageTriggerKilledPlayerServerRpc(int playerTarget)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1067576157u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerTarget);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1067576157u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
DamageTriggerKilledClientRpc(0, playerTarget);
}
}
}
[ServerRpc(RequireOwnership = true)]
public void DamageTriggerKilledServerRpc(int type)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
//IL_0114: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3711696475u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, type);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3711696475u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
DamageTriggerKilledClientRpc(type);
}
}
[ClientRpc]
private void DamageTriggerKilledClientRpc(int type, int playerTarget = -1)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3159405848u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, type);
BytePacker.WriteValueBitPacked(val2, playerTarget);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3159405848u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
if ((Object)(object)DamageTrigger == (Object)null)
{
JLogHelper.LogWarning(((Object)this).name + " DamageTriggerNetworking is missing a linked DamageTrigger!");
return;
}
switch (type)
{
case 0:
if (playerTarget >= 0 && playerTarget < RoundManager.Instance.playersManager.allPlayerScripts.Length)
{
PlayerCorpse playerCorpse = new PlayerCorpse
{
player = StartOfRound.Instance.allPlayerScripts[playerTarget],
startTime = Time.realtimeSinceStartup,
stickTime = Mathf.Abs(DamageTrigger.corpseStickTime),
permaStuck = (DamageTrigger.corpseStickTime < 0f)
};
playerCorpses.Add(playerCorpse);
((UnityEvent<PlayerControllerB>)(object)PlayerKilled).Invoke(playerCorpse.player);
}
break;
case 1:
EnemyKilled.Invoke();
break;
case 2:
VehicleKilled.Invoke();
break;
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1067576157u, new RpcReceiveHandler(__rpc_handler_1067576157), "DamageTriggerKilledPlayerServerRpc");
((NetworkBehaviour)this).__registerRpc(3711696475u, new RpcReceiveHandler(__rpc_handler_3711696475), "DamageTriggerKilledServerRpc");
((NetworkBehaviour)this).__registerRpc(3159405848u, new RpcReceiveHandler(__rpc_handler_3159405848), "DamageTriggerKilledClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1067576157(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerTarget = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerTarget);
target.__rpc_exec_stage = (__RpcExecStage)1;
((DamageTriggerNetworking)(object)target).DamageTriggerKilledPlayerServerRpc(playerTarget);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3711696475(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0083: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
int type = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref type);
target.__rpc_exec_stage = (__RpcExecStage)1;
((DamageTriggerNetworking)(object)target).DamageTriggerKilledServerRpc(type);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3159405848(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0043: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int type = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref type);
int playerTarget = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerTarget);
target.__rpc_exec_stage = (__RpcExecStage)1;
((DamageTriggerNetworking)(object)target).DamageTriggerKilledClientRpc(type, playerTarget);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "DamageTriggerNetworking";
}
}
public class DamageZoneTrigger : MonoBehaviour
{
[Header("-=-DEPRICATED-=-")]
[SerializeField]
public CauseOfDeath damageSource = (CauseOfDeath)0;
public Vector3 hitDir = Vector3.zero;
public int corpseType = 0;
[Header("Conditions")]
public bool damageOnEnter = true;
public bool damageOnExit = false;
public bool damageOnCollision = true;
[Header("Damage")]
public bool damagePlayers = true;
public int damageForPlayers = 1;
public bool damageEnemies = true;
public int damageForEnemies = 1;
public bool damageVehicles = false;
public int damageForVehicles = 1;
public bool damageObjects = false;
public int damageForObjects = 1;
[Header("Continuous Damage")]
public bool continuousDamage = true;
public float hitInterval = 0.5f;
private float timer = 0f;
[Header("SFX")]
public bool playNormalDamageSFX = true;
public AudioClip[] clips = Array.Empty<AudioClip>();
public AudioSource[] sources = Array.Empty<AudioSource>();
[Header("Player")]
public InteractEvent OnPlayerDamaged = new InteractEvent();
private List<PlayerControllerB> playersInside = new List<PlayerControllerB>();
private List<EnemyAI> creaturesInside = new List<EnemyAI>();
private List<VehicleController> vehiclesInside = new List<VehicleController>();
private List<IHittable> objectsInside = new List<IHittable>();
public void OnTriggerEnter(Collider collider)
{
switch (DamageTarget(((Component)collider).gameObject, damageOnEnter))
{
case 0:
playersInside.Add(((Component)collider).GetComponent<PlayerControllerB>());
break;
case 1:
creaturesInside.Add(((Component)collider).GetComponent<EnemyAICollisionDetect>().mainScript);
break;
case 2:
vehiclesInside.Add(((Component)collider).GetComponent<VehicleController>());
break;
case 3:
objectsInside.Add(((Component)collider).GetComponent<IHittable>());
break;
}
}
public void OnTriggerExit(Collider collider)
{
switch (DamageTarget(((Component)collider).gameObject, damageOnExit))
{
case 0:
playersInside.Remove(((Component)collider).GetComponent<PlayerControllerB>());
break;
case 1:
creaturesInside.Remove(((Component)collider).GetComponent<EnemyAICollisionDetect>().mainScript);
break;
case 2:
vehiclesInside.Remove(((Component)collider).GetComponent<VehicleController>());
break;
case 3:
objectsInside.Remove(((Component)collider).GetComponent<IHittable>());
break;
}
}
public void OnCollisionEnter(Collision collision)
{
DamageTarget(collision.gameObject, damageOnCollision);
}
public void Update()
{
if (continuousDamage)
{
timer -= Time.deltaTime;
if (timer <= 0f)
{
timer = hitInterval;
DamageAllInside();
}
}
}
public void DamageAllInside()
{
if (damagePlayers)
{
for (int i = 0; i < playersInside.Count; i++)
{
if (!playersInside[i].isPlayerDead)
{
DamagePlayer(playersInside[i]);
}
}
}
if (damageEnemies)
{
for (int j = 0; j < creaturesInside.Count; j++)
{
if (!creaturesInside[j].isEnemyDead)
{
DamageEnemy(creaturesInside[j]);
}
}
}
if (damageVehicles)
{
for (int k = 0; k < vehiclesInside.Count; k++)
{
DamageVehicle(vehiclesInside[k]);
}
}
if (damageObjects)
{
for (int l = 0; l < objectsInside.Count; l++)
{
DamageObject(objectsInside[l]);
}
}
}
private int DamageTarget(GameObject target, bool condition = true)
{
if (target.CompareTag("Player"))
{
PlayerControllerB val = default(PlayerControllerB);
if (target.TryGetComponent<PlayerControllerB>(ref val))
{
if (condition && damagePlayers && !val.isPlayerDead)
{
DamagePlayer(val);
}
return 0;
}
}
else if (target.CompareTag("Enemy"))
{
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
if (target.TryGetComponent<EnemyAICollisionDetect>(ref val2))
{
if (condition && damageEnemies && !val2.mainScript.isEnemyDead)
{
DamageEnemy(val2.mainScript);
}
return 1;
}
}
else
{
VehicleController val3 = default(VehicleController);
if (target.TryGetComponent<VehicleController>(ref val3))
{
if (condition && damageVehicles && !val3.carDestroyed)
{
DamageVehicle(val3);
}
return 2;
}
IHittable obj = default(IHittable);
if (target.TryGetComponent<IHittable>(ref obj))
{
if (condition && damageObjects)
{
DamageObject(obj);
}
return 3;
}
}
return -1;
}
public void DamagePlayer(PlayerControllerB player, bool playCustomAudio = true)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
int num = damageForPlayers;
CauseOfDeath val = damageSource;
Vector3 val2 = hitDir;
player.DamagePlayer(num, playNormalDamageSFX, true, val, Mathf.Clamp(corpseType, 0, StartOfRound.Instance.playerRagdolls.Count), false, val2);
if (playCustomAudio)
{
PlayCustomAudio();
}
((UnityEvent<PlayerControllerB>)(object)OnPlayerDamaged).Invoke(player);
}
public void DamageEnemy(EnemyAI enemy, bool playCustomAudio = true)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
enemy.HitEnemyOnLocalClient(damageForEnemies, hitDir, (PlayerControllerB)null, playNormalDamageSFX, -1);
if (playCustomAudio)
{
PlayCustomAudio();
}
}
public void DamageVehicle(VehicleController vehicle, bool playCustomAudio = true)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
VehicleControllerPatch.DealPermanentDamage(vehicle, damageForVehicles, hitDir);
if (playCustomAudio)
{
PlayCustomAudio();
}
}
public void DamageObject(IHittable obj, bool playCustomAudio = true)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
obj.Hit(damageForObjects, hitDir, (PlayerControllerB)null, playNormalDamageSFX, -1);
if (playCustomAudio)
{
PlayCustomAudio();
}
}
private void PlayCustomAudio()
{
if (clips.Length != 0 && sources.Length != 0)
{
AudioClip clip = clips[Random.Range(0, clips.Length)];
AudioSource[] array = sources;
foreach (AudioSource val in array)
{
val.clip = clip;
val.Play();
}
}
}
}
[RequireComponent(typeof(Animator))]
public class DayCycleAnimator : MonoBehaviour
{
private Animator anim;
[Tooltip("Scale of time the animation synced to the day progression will use. A value of 1 plays the animation from beginning to end once. Numbers larger than 1 requires the animation to have looping enabled otherwise it will stop on the final frame.")]
[FormerlySerializedAs("timeScale")]
public float fixedAnimEndTime = 1f;
public void Start()
{
anim = ((Component)this).GetComponent<Animator>();
}
public void FixedUpdate()
{
float num = Mathf.Max(0f, TimeOfDay.Instance.currentDayTime - 100f);
float num2 = num / TimeOfDay.Instance.totalTime;
anim.SetFloat("time", num2 * fixedAnimEndTime);
}
public void SetFixedAnimTime(float time)
{
fixedAnimEndTime = time;
}
}
public class DelayScript : MonoBehaviour
{
public class QueuedEvent
{
public PlayerControllerB target = null;
public float timer;
}
[FormerlySerializedAs("waitOnAwake")]
public bool waitOnEnabled = false;
public bool clearOnDisable = false;
public float delaySeconds = 2f;
[Tooltip("Event run after StartWaiting() is called by another event.")]
public UnityEvent events = new UnityEvent();
[Tooltip("Only gets triggered if a player is given on the StartWaiting() call.")]
public InteractEvent playerEvents = new InteractEvent();
private readonly List<QueuedEvent> queuedEvents = new List<QueuedEvent>();
private readonly List<QueuedEvent> expiredEvents = new List<QueuedEvent>();
public void OnEnable()
{
if (waitOnEnabled)
{
StartWaiting();
}
}
public void OnDisable()
{
if (clearOnDisable)
{
ClearEventQueue();
}
}
public void Update()
{
for (int i = 0; i < queuedEvents.Count; i++)
{
queuedEvents[i].timer -= Time.deltaTime;
if (queuedEvents[i].timer <= 0f)
{
expiredEvents.Add(queuedEvents[i]);
}
}
if (expiredEvents.Count <= 0)
{
return;
}
for (int j = 0; j < expiredEvents.Count; j++)
{
events.Invoke();
if ((Object)(object)expiredEvents[j].target != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)playerEvents).Invoke(expiredEvents[j].target);
}
queuedEvents.Remove(expiredEvents[j]);
}
expiredEvents.Clear();
}
public void StartWaiting(PlayerControllerB player)
{
queuedEvents.Add(new QueuedEvent
{
timer = delaySeconds,
target = player
});
}
public void StartWaiting()
{
JLogHelper.LogInfo($"{((Object)this).name} started waiting {delaySeconds}");
queuedEvents.Add(new QueuedEvent
{
timer = delaySeconds
});
}
public void StartWaiting(float delay)
{
JLogHelper.LogInfo($"{((Object)this).name} started waiting {delay}");
queuedEvents.Add(new QueuedEvent
{
timer = delay
});
}
public void StartWaiting(int delay)
{
JLogHelper.LogInfo($"{((Object)this).name} started waiting {delay}");
queuedEvents.Add(new QueuedEvent
{
timer = delay
});
}
public void ClearEventQueue()
{
queuedEvents.Clear();
}
}
public class EnemySpawner : MonoBehaviour
{
[Serializable]
public class WeightedEnemyRefrence
{
public string enemyName = "";
public EnemyType enemyType;
[Range(0f, 100f)]
public int rarity;
}
[Tooltip("Determines weather to spawn a random enemy from the pool or to spawn the specified type")]
public bool spawnRandom = false;
public RotationType spawnRotation = RotationType.ObjectRotation;
public List<WeightedEnemyRefrence> randomPool = new List<WeightedEnemyRefrence>();
public string enemyName = "";
public EnemyType type;
[Tooltip("Ran after an enemy spawns. Enemy provided is the one that was just spawned.")]
public EnemyEvent SpawnedEvent = new EnemyEvent();
[Header("NavMesh")]
[Tooltip("The max distance from this transform that a navmesh will be found")]
public float navMeshRange = 10f;
[Header("Misc")]
[FormerlySerializedAs("spawnOnAwake")]
public bool spawnOnEnable = false;
public bool checkRegistry = true;
public bool spawnNests = true;
public bool respectEnemyCap = false;
public PowerCap respectPowerCap = PowerCap.None;
public static float GetRot(RotationType rotation, float yRot = 0f)
{
if (1 == 0)
{
}
float result = rotation switch
{
RotationType.ObjectRotation => yRot,
RotationType.RandomRotation => Random.Range(0f, 360f),
_ => 0f,
};
if (1 == 0)
{
}
return result;
}
public static Quaternion GetRot(RotationType rotation, Quaternion refrence)
{
//IL_0010: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
if (1 == 0)
{
}
Quaternion result = (Quaternion)(rotation switch
{
RotationType.ObjectRotation => refrence,
RotationType.RandomRotation => Quaternion.Euler(0f, Random.Range(0f, 360f), 0f),
_ => Quaternion.identity,
});
if (1 == 0)
{
}
return result;
}
public void Awake()
{
if (!checkRegistry)
{
return;
}
if (!string.IsNullOrEmpty(enemyName))
{
type = JLevelPropertyRegistry.GetRegisteredEnemy(enemyName);
}
else if ((Object)(object)type != (Object)null)
{
type = JLevelPropertyRegistry.GetRegisteredEnemy(type);
}
if (randomPool.Count > 0)
{
for (int i = 0; i < randomPool.Count; i++)
{
if (!string.IsNullOrEmpty(randomPool[i].enemyName))
{
EnemyType registeredEnemy = JLevelPropertyRegistry.GetRegisteredEnemy(randomPool[i].enemyName);
if ((Object)(object)registeredEnemy != (Object)null)
{
randomPool[i].enemyType = registeredEnemy;
}
}
else if ((Object)(object)randomPool[i].enemyType != (Object)null)
{
randomPool[i].enemyType = JLevelPropertyRegistry.GetRegisteredEnemy(randomPool[i].enemyType);
}
else
{
JLogHelper.LogWarning($"({((Object)this).name}) Enemy spawner is missing enemy at {i}", JLogLevel.Debuging);
}
}
}
else
{
for (int j = 0; j < JLevelPropertyRegistry.AllSortedEnemies.Count; j++)
{
WeightedEnemyRefrence item = new WeightedEnemyRefrence
{
enemyType = JLevelPropertyRegistry.AllSortedEnemies[j],
rarity = 10
};
randomPool.Add(item);
}
}
checkRegistry = false;
}
public void OnEnable()
{
if (spawnOnEnable)
{
SpawnEnemy();
}
}
public void SpawnEnemy()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
SpawnEnemy(((Component)this).transform.position);
}
public void SpawnEnemy(GameObject target)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
SpawnEnemy(target.transform.position);
}
public void SpawnEnemy(MonoBehaviour target)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
SpawnEnemy(((Component)target).transform.position);
}
public void SpawnEnemy(Vector3 pos)
{
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)RoundManager.Instance).IsHost && !((NetworkBehaviour)RoundManager.Instance).IsServer)
{
return;
}
EnemyType enemyType;
if (spawnRandom)
{
int weightedIndex = GetWeightedIndex();
JLogHelper.LogInfo($"({((Object)this).name}) Attempting to spawn enemy at index {weightedIndex}");
enemyType = randomPool[weightedIndex].enemyType;
}
else
{
enemyType = type;
}
if ((Object)(object)enemyType != (Object)null)
{
if (respectEnemyCap && enemyType.numberSpawned > enemyType.MaxCount)
{
return;
}
float powerLevel = enemyType.PowerLevel;
PowerCap powerCap = respectPowerCap;
if (1 == 0)
{
}
float num = powerCap switch
{
PowerCap.Indoor => RoundManager.Instance.currentMaxInsidePower - RoundManager.Instance.currentEnemyPower,
PowerCap.Daytime => (float)RoundManager.Instance.currentLevel.maxDaytimeEnemyPowerCount - RoundManager.Instance.currentDaytimeEnemyPower,
PowerCap.Nighttime => RoundManager.Instance.currentMaxOutsidePower - RoundManager.Instance.currentOutsideEnemyPower,
_ => 1000000f,
};
if (1 == 0)
{
}
if (powerLevel > num || !((Object)(object)enemyType.enemyPrefab != (Object)null))
{
return;
}
bool flag;
NavMeshHit val = default(NavMeshHit);
if ((flag = NavMesh.SamplePosition(pos, ref val, navMeshRange, -1)) || navMeshRange < 0f)
{
if (spawnNests && (Object)(object)enemyType.nestSpawnPrefab != (Object)null && enemyType.requireNestObjectsToSpawn && enemyType.isOutsideEnemy && !HasNest(enemyType))
{
JLogHelper.LogInfo("(" + ((Object)this).name + ") Spawning Missing Outside Nest for: " + enemyType.enemyName);
RoundManager.Instance.SpawnNestObjectForOutsideEnemy(enemyType, new Random());
RoundManager.Instance.SyncNestSpawnObjectsOrderServerRpc(RoundManager.Instance.enemyNestSpawnObjects.Select((EnemyAINestSpawnObject nest) => NetworkObjectReference.op_Implicit(((Component)nest).GetComponent<NetworkObject>())).ToArray());
}
JLogHelper.LogInfo($"({((Object)this).name}) Spawning: {enemyType.enemyName} at {pos}");
GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(flag ? ((NavMeshHit)(ref val)).position : pos, GetRot(spawnRotation, ((Component)((Component)this).transform).transform.eulerAngles.y), 0, enemyType));
EnemyAI val3 = default(EnemyAI);
if (val2.TryGetComponent<EnemyAI>(ref val3))
{
((UnityEvent<EnemyAI>)SpawnedEvent).Invoke(val3);
}
}
else
{
JLogHelper.LogInfo("(" + ((Object)this).name + ") Failed to spawn. (Couldn't Find NavMesh. If try increasing the EnemySpawner's navMeshDistance if you're having an issue.)");
}
}
else
{
JLogHelper.LogWarning("(" + ((Object)this).name + ") Enemy Spawner tried to spawn a null EnemyType!");
}
}
private bool HasNest(EnemyType enemyType)
{
foreach (EnemyAINestSpawnObject enemyNestSpawnObject in RoundManager.Instance.enemyNestSpawnObjects)
{
if ((Object)(object)enemyNestSpawnObject == (Object)null || !((Object)(object)enemyNestSpawnObject.enemyType == (Object)(object)enemyType))
{
continue;
}
return true;
}
return false;
}
private int GetWeightedIndex()
{
int num = 0;
for (int i = 0; i < randomPool.Count; i++)
{
num += randomPool[i].rarity;
}
int num2 = Random.Range(0, num);
for (int j = 0; j < randomPool.Count; j++)
{
num2 -= randomPool[j].rarity;
if (num2 <= 0)
{
return j;
}
}
return Random.Range(0, randomPool.Count);
}
}
public enum ColliderType
{
Unknown = -1,
Player,
Enemy,
Vehicle,
Object
}
public enum PlayerBone
{
Base = 6,
Neck = 0,
Spine = 5,
RightArmUpper = 9,
LeftArmUpper = 10,
RightArmLower = 1,
LeftArmLower = 2,
RightThigh = 7,
LeftThigh = 8,
RightShin = 3,
LeftShin = 4
}
public enum RotationType
{
ObjectRotation,
RandomRotation,
NoRotation
}
public enum PowerCap
{
None,
Indoor,
Daytime,
Nighttime
}
public enum SpawnPoolSource
{
CustomList,
AllItems,
LevelItems,
StoreItems
}
public enum ActiveCondition
{
None,
ActiveOutdoors,
ActiveIndoors,
ActiveOutdoorsOutsideShip
}
public enum SpawnRotation
{
Random,
FacingWall,
FacingAwayFromWall,
BackToWall
}
public enum SpawnNodes
{
Children,
OutsideAINodes,
InsideAINodes,
AINodes
}
public enum NavMeshToRebake
{
None = 0,
Exterior = 1,
Custom = -1
}
public enum RandomTeleportRegion
{
Indoor,
Outdoor,
Moon,
Nearby,
RandomPlayer
}
public enum Region
{
None,
Outdoor,
Indoor
}
public enum TeleportEffect
{
None,
ShipTeleport,
InverseTeleport
}
public enum PlayerTarget
{
Local,
Closest,
Farthest
}
public class EventLimiter : MonoBehaviour
{
public int maxTriggers = 1;
public UnityEvent Event = new UnityEvent();
public InteractEvent PlayerEvent = new InteractEvent();
public void Trigger()
{
Trigger(null);
}
public void Trigger(PlayerControllerB player)
{
if (maxTriggers > 0)
{
maxTriggers--;
Event.Invoke();
if ((Object)(object)player != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)PlayerEvent).Invoke(player);
}
}
}
public void AddUses(int num)
{
maxTriggers += num;
}
public void SetUses(int num)
{
maxTriggers = num;
}
}
public class ExplosiveEmitter : MonoBehaviour
{
[Header("Explosion Size")]
[FormerlySerializedAs("explodeOnAwake")]
public bool explodeOnEnabled = false;
public float killDistance = 5.7f;
public float damageRange = 6f;
[Header("Damage Properties")]
public int nonLethalDamage = 50;
public float pushForce = 0f;
public bool goThroughCar = false;
public GameObject overrideEffect = null;
public bool spawnParticles = true;
[Header("Screen Shake Emmision")]
[FormerlySerializedAs("shakeOnAwake")]
public bool shakeOnEnabled = false;
[Tooltip("Bridge Destroyed Default: 30")]
public float strongDistance = -1f;
[Tooltip("Bridge Destroyed Default: 50")]
public float longDistance = -1f;
[Tooltip("Landmine Default: 14")]
public float bigDistance = 14f;
[Tooltip("Landmine Default = 25")]
public float smallDistance = 25f;
[Header("Stun Explosion")]
[FormerlySerializedAs("stunOnAwake")]
public bool stunOnEnabled = false;
public bool affectAudio = true;
public float flashSeverityMultiplier = 1f;
public float enemyStunTime = 7.5f;
public float flashSeverityDistanceRolloff = 1f;
public void OnEnabled()
{
if (explodeOnEnabled)
{
Explode();
}
if (shakeOnEnabled)
{
DistanceShakeScreen();
}
if (stunOnEnabled)
{
StunFlash();
}
}
public void Explode()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Explode(((Component)this).transform.position);
}
public void Explode(MonoBehaviour target)
{
Explode(((Component)target).gameObject);
}
public void Explode(GameObject target)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Explode(target.transform.position);
}
public void Explode(Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(position, spawnParticles, killDistance, damageRange, nonLethalDamage, pushForce, overrideEffect, goThroughCar);
}
private void OnDrawGizmosSelected()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
if (killDistance > 0f)
{
Gizmos.color = Color.red;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using JLL;
using JLL.API;
using JLL.API.Events;
using JLL.Components;
using JLL.Patches;
using JLLItemsModule.Components;
using JLLItemsModule.NetcodePatcher;
using JLLItemsModule.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JLLItemsModule")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JLLItemsModule")]
[assembly: AssemblyTitle("JLLItemsModule")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
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;
}
}
}
namespace JLLItemsModule
{
[BepInPlugin("JacobG5.JLLItemModule", "JLLItemModule", "1.3.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class JLLItemsCore : BaseUnityPlugin
{
private const string modGUID = "JacobG5.JLLItemModule";
private const string modName = "JLLItemModule";
private const string modVersion = "1.3.7";
private readonly Harmony harmony = new Harmony("JacobG5.JLLItemModule");
public void Awake()
{
JLL.NetcodePatch(JLogHelper.GetSource(), new Type[6]
{
typeof(JEventBoxItem),
typeof(JGrabbableObject),
typeof(JInteractableItem),
typeof(JMeleeWeapon),
typeof(JNoisemakerProp),
typeof(JThrowableItem)
});
JLL.HarmonyPatch(harmony, JLogHelper.GetSource(), new Type[2]
{
typeof(PlayerPatch),
typeof(DepositItemsDeskPatch)
});
}
}
}
namespace JLLItemsModule.Patches
{
[HarmonyPatch(typeof(DepositItemsDesk))]
internal class DepositItemsDeskPatch
{
[HarmonyPatch("AddObjectToDeskClientRpc")]
[HarmonyPostfix]
public static void patchAddObjectToDeskClientRpc(NetworkObjectReference grabbableObjectNetObject)
{
NetworkObject val = default(NetworkObject);
JGrabbableObject jGrabbableObject = default(JGrabbableObject);
if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent<JGrabbableObject>(ref jGrabbableObject))
{
jGrabbableObject.PlacedOnDepositDesk();
jGrabbableObject.OnPlacedOnDepositDesk.Invoke();
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerPatch
{
[HarmonyPatch("SetItemInElevator")]
[HarmonyPrefix]
public static void patchSetItemInElevator(bool droppedInShipRoom, bool droppedInElevator, GrabbableObject gObject)
{
if (gObject.isInShipRoom != droppedInShipRoom && gObject is JGrabbableObject jGrabbableObject)
{
jGrabbableObject.OnSetInsideShip(droppedInShipRoom);
((UnityEvent<bool>)(object)jGrabbableObject.OnSetInShip).Invoke(droppedInShipRoom);
}
}
}
}
namespace JLLItemsModule.Components
{
public class JEventBoxItem : JGrabbableObject
{
[CompilerGenerated]
private sealed class <SetObjectToHitGroundSFX>d__24 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GrabbableObject gObject;
public JEventBoxItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetObjectToHitGroundSFX>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Debug.Log((object)("Setting " + gObject.itemProperties.itemName + " hit ground to false"));
gObject.reachedFloorTarget = false;
gObject.hasHitGround = false;
gObject.fallTime = 0f;
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();
}
}
[Header("Event Box")]
public bool canOpenInOrbit = true;
public int boxUses = 1;
public bool destroyWhenEmpty = true;
private float lastUsedTime = 0f;
public float openCooldown = 0.4f;
public PlayerEvent OpenEvent = new PlayerEvent();
public WeightedEvent[] RandomOpenEvent = (WeightedEvent[])(object)new WeightedEvent[1]
{
new WeightedEvent
{
Weight = 20
}
};
[Header("Item Spawner")]
public bool spawnItemsOnOpen = true;
public int numberToSpawn = 1;
public SpawnPoolSource SourcePool = (SpawnPoolSource)0;
public WeightedItemRefrence[] CustomList = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
{
new WeightedItemRefrence()
};
[Header("Audio & FX")]
public ParticleSystem? PoofParticle;
public AudioSource? BoxAudio;
public AudioClip? OpenBoxClip;
[HideInInspector]
public PlayerControllerB previousPlayerHeldBy;
public override void Start()
{
((GrabbableObject)this).Start();
WeightedItemRefrence[] customList = CustomList;
foreach (WeightedItemRefrence val in customList)
{
val.FindRegistered();
}
}
public override void LoadItemSaveData(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
boxUses = saveData;
}
public override int GetItemDataToSave()
{
((GrabbableObject)this).GetItemDataToSave();
return boxUses;
}
public override void EquipItem()
{
base.EquipItem();
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if ((canOpenInOrbit || !StartOfRound.Instance.inShipPhase) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && boxUses > 0 && Time.realtimeSinceStartup - lastUsedTime > openCooldown)
{
lastUsedTime = Time.realtimeSinceStartup;
((GrabbableObject)this).playerHeldBy.activatingItem = true;
if (((NetworkBehaviour)this).IsOwner)
{
OpenGiftBoxServerRpc();
}
}
}
public override void PocketItem()
{
base.PocketItem();
((GrabbableObject)this).playerHeldBy.activatingItem = false;
}
[ServerRpc(RequireOwnership = false)]
public void OpenGiftBoxServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1900567855u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1900567855u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
boxUses--;
int num = -1;
if (RandomOpenEvent.Length != 0)
{
IWeightedItem[] randomOpenEvent = (IWeightedItem[])(object)RandomOpenEvent;
num = IWeightedItem.GetRandomIndex(randomOpenEvent);
if (!RandomOpenEvent[num].SendClientRPC)
{
InvokeRandomEvent(num);
num = -1;
}
}
if (spawnItemsOnOpen)
{
SpawnItemsOnServer(numberToSpawn);
}
OpenBoxClientRpc(num, boxUses);
}
public virtual void SpawnItemsOnServer(int amount)
{
SpawnItemsServerRpc(amount);
}
[ServerRpc(RequireOwnership = false)]
private void SpawnItemsServerRpc(int amount)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2647915572u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, amount);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2647915572u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Vector3 val3 = ((Component)this).transform.position + Vector3.up * 0.25f;
Transform val4 = ((((!((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) || !((GrabbableObject)this).playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
SpawnPoolSource sourcePool = SourcePool;
Quaternion rotation = ((Component)this).transform.rotation;
List<KeyValuePair<GrabbableObject, int>> list = ItemSpawner.SpawnRandomItems(sourcePool, val3, val4, Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f), CustomList, (Vector3[])null, amount, false, (RotationType)2);
foreach (KeyValuePair<GrabbableObject, int> item in list)
{
item.Key.startFallingPosition = val3;
((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(item.Key));
item.Key.targetFloorPosition = item.Key.GetItemFloorPosition(((Component)this).transform.position);
if ((Object)(object)previousPlayerHeldBy != (Object)null && previousPlayerHeldBy.isInHangarShipRoom)
{
previousPlayerHeldBy.SetItemInElevator(true, true, item.Key);
}
((NetworkBehaviour)item.Key).NetworkObject.Spawn(false);
ItemSpawner.OverrideScrapValue(item.Key, item.Value);
}
}
[IteratorStateMachine(typeof(<SetObjectToHitGroundSFX>d__24))]
private IEnumerator SetObjectToHitGroundSFX(GrabbableObject gObject)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetObjectToHitGroundSFX>d__24(0)
{
<>4__this = this,
gObject = gObject
};
}
[ClientRpc]
private void OpenBoxClientRpc(int weightedEvent, int usesLeft)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1016085238u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, weightedEvent);
BytePacker.WriteValueBitPacked(val2, usesLeft);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1016085238u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if ((Object)(object)PoofParticle != (Object)null)
{
PoofParticle.Play();
}
if ((Object)(object)BoxAudio != (Object)null && (Object)(object)OpenBoxClip != (Object)null)
{
BoxAudio.PlayOneShot(OpenBoxClip);
WalkieTalkie.TransmitOneShotAudio(BoxAudio, OpenBoxClip, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)BoxAudio).transform.position, 8f, 0.5f, 0, ((GrabbableObject)this).isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
}
boxUses = usesLeft;
OnBoxOpen();
InvokeRandomEvent(weightedEvent);
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)OpenEvent).Invoke(((GrabbableObject)this).playerHeldBy);
((GrabbableObject)this).playerHeldBy.activatingItem = false;
if (destroyWhenEmpty && boxUses <= 0)
{
((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
}
}
}
private void InvokeRandomEvent(int weightedEvent)
{
if (weightedEvent >= 0 && weightedEvent < RandomOpenEvent.Length)
{
RandomOpenEvent[weightedEvent].Event.Invoke();
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)RandomOpenEvent[weightedEvent].PlayerEvent).Invoke(((GrabbableObject)this).playerHeldBy);
}
}
}
public virtual void OnBoxOpen()
{
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1900567855u, new RpcReceiveHandler(__rpc_handler_1900567855), "OpenGiftBoxServerRpc");
((NetworkBehaviour)this).__registerRpc(2647915572u, new RpcReceiveHandler(__rpc_handler_2647915572), "SpawnItemsServerRpc");
((NetworkBehaviour)this).__registerRpc(1016085238u, new RpcReceiveHandler(__rpc_handler_1016085238), "OpenBoxClientRpc");
base.__initializeRpcs();
}
private static void __rpc_handler_1900567855(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((JEventBoxItem)(object)target).OpenGiftBoxServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2647915572(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int amount = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref amount);
target.__rpc_exec_stage = (__RpcExecStage)1;
((JEventBoxItem)(object)target).SpawnItemsServerRpc(amount);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1016085238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0043: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int weightedEvent = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref weightedEvent);
int usesLeft = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref usesLeft);
target.__rpc_exec_stage = (__RpcExecStage)1;
((JEventBoxItem)(object)target).OpenBoxClientRpc(weightedEvent, usesLeft);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "JEventBoxItem";
}
}
public class JGrabbableObject : GrabbableObject
{
[Header("JGrabbableObject")]
public GameObject chargedEffects;
public GameObject[] hideWhenPocketed = (GameObject[])(object)new GameObject[0];
public UnityEvent OnEquip = new UnityEvent();
public InteractEvent OnEquipPlayer = new InteractEvent();
public UnityEvent OnPocketed = new UnityEvent();
public InteractEvent OnPocketedPlayer = new InteractEvent();
public BoolEvent OnSetInShip = new BoolEvent();
public UnityEvent OnPlacedOnDepositDesk = new UnityEvent();
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
if ((Object)(object)base.playerHeldBy != (Object)null && base.isHeld)
{
HeldUpdate();
}
if (base.itemProperties.requiresBattery && base.insertedBattery != null)
{
GameObject obj = chargedEffects;
if (obj != null)
{
obj.SetActive(!base.insertedBattery.empty);
}
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
GameObject[] array = hideWhenPocketed;
foreach (GameObject val in array)
{
val.SetActive(true);
}
OnEquip.Invoke();
if ((Object)(object)base.playerHeldBy != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)OnEquipPlayer).Invoke(base.playerHeldBy);
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
GameObject[] array = hideWhenPocketed;
foreach (GameObject val in array)
{
val.SetActive(false);
}
OnPocketed.Invoke();
if ((Object)(object)base.playerHeldBy != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)OnPocketedPlayer).Invoke(base.playerHeldBy);
}
}
public virtual void HeldUpdate()
{
}
public virtual void OnSetInsideShip(bool isEntering)
{
}
public virtual void PlacedOnDepositDesk()
{
}
public bool IsBeingHeldByPlayer()
{
return (Object)(object)base.playerHeldBy != (Object)null && base.isHeld;
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((GrabbableObject)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "JGrabbableObject";
}
}
public class JInteractableItem : JGrabbableObject
{
public enum InteractionType
{
Press,
Toggle,
Hold
}
[Header("Interactable Item")]
public InteractionType interactionType = InteractionType.Press;
public InteractEvent OnUse = new InteractEvent();
public BoolEvent OnToggle = new BoolEvent();
public UnityEvent OnHoldingButton = new UnityEvent();
[Header("Extra Events")]
public InteractEvent CollisionEvent = new InteractEvent();
[Space(5f)]
public AudioClip[] interactSFX = (AudioClip[])(object)new AudioClip[0];
public AudioClip[] disableSFX = (AudioClip[])(object)new AudioClip[0];
public AudioSource noiseAudio;
public float maxVolume = 1f;
public float minVolume = 0.8f;
public Animator? triggerAnimator;
[HideInInspector]
public PlayerControllerB? playerLastHeld;
private bool toggle = false;
public override void EquipItem()
{
base.EquipItem();
playerLastHeld = ((GrabbableObject)this).playerHeldBy;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
if (used && (Object)(object)playerLastHeld != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)OnUse).Invoke(playerLastHeld);
}
switch (interactionType)
{
case InteractionType.Toggle:
ToggleInteract(!toggle);
break;
case InteractionType.Hold:
if (buttonDown)
{
OnHoldInteraction();
OnHoldingButton.Invoke();
}
break;
default:
InteractFX(interactSFX, "interact");
break;
}
}
public virtual void InteractFX(AudioClip[] clips, string trigger)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Animator? obj = triggerAnimator;
if (obj != null)
{
obj.SetTrigger(trigger);
}
if ((Object)(object)noiseAudio != (Object)null && Object.op_Implicit((Object)(object)noiseAudio) && clips.Length != 0)
{
int num = Random.Range(0, clips.Length);
if ((Object)(object)clips[num] != (Object)null)
{
float num2 = Random.Range(minVolume, maxVolume);
noiseAudio.PlayOneShot(clips[num], num2);
RoundManager.Instance.PlayAudibleNoise(((Component)noiseAudio).transform.position, 4f * num2, num2 * 0.5f, 0, false, 0);
}
}
}
public void ToggleInteract()
{
ToggleInteract(!toggle);
}
public void ToggleInteract(bool on)
{
toggle = on;
if (on)
{
InteractFX(interactSFX, "toggleOn");
}
else
{
InteractFX(disableSFX, "toggleOff");
}
((GrabbableObject)this).isBeingUsed = on;
OnToggled(on);
((UnityEvent<bool>)(object)OnToggle).Invoke(on);
}
public virtual void OnToggled(bool on)
{
}
public virtual void OnHoldInteraction()
{
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
if ((Object)(object)playerLastHeld != (Object)null)
{
((UnityEvent<PlayerControllerB>)(object)CollisionEvent).Invoke(playerLastHeld);
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
base.__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "JInteractableItem";
}
}
public class JMeleeWeapon : JGrabbableObject
{
[CompilerGenerated]
private sealed class <ReelBackWeapon>d__29 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public JMeleeWeapon <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ReelBackWeapon>d__29(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Expected O, but got Unknown
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Expected O, but got Unknown
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
((GrabbableObject)<>4__this).playerHeldBy.activatingItem = true;
((GrabbableObject)<>4__this).playerHeldBy.twoHanded = true;
((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
if (JLLExtentions.IsLocalPlayer(((GrabbableObject)<>4__this).playerHeldBy))
{
<>4__this.reelingAnimSpeed = 0.35f / <>4__this.reelingTime;
((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.speed = <>4__this.reelingAnimSpeed;
}
<>4__this.PlayRandomSFX(<>4__this.reelUpSFX);
<>4__this.ReelUpSFXServerRpc();
<>2__current = (object)new WaitForSeconds(<>4__this.reelingTime);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>4__this.isHoldingButton || !((GrabbableObject)<>4__this).isHeld));
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
if (JLLExtentions.IsLocalPlayer(((GrabbableObject)<>4__this).playerHeldBy))
{
((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.speed = 1f;
}
<>4__this.SwingHeavyWeapon(!((GrabbableObject)<>4__this).isHeld);
<>2__current = (object)new WaitForSeconds(<>4__this.swingTime);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>4__this.HitWeapon(!((GrabbableObject)<>4__this).isHeld);
<>2__current = (object)new WaitForSeconds(<>4__this.weaponCooldown);
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>4__this.reelingUp = false;
<>4__this.reelingUpCoroutine = 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();
}
}
[Header("Melee Weapon")]
public int HitForce = 1;
[Tooltip("Shovel Default: 1.5\nKnife Default: 0.3")]
public float weaponRange = 1.5f;
[Tooltip("Shovel Default: 0.3\nKnife Default: 0.43")]
public float weaponCooldown = 0.3f;
[Tooltip("Leave blank for no blood particle on hit")]
public ParticleSystem bloodParticle;
private float timeAtLastDamageDealt;
[Tooltip("Player is the player who swung the weapon")]
public UnityEvent<PlayerControllerB> OnHitSuccess = new UnityEvent<PlayerControllerB>();
public LayerMask hitMask = LayerMask.op_Implicit(1084754248);
[Tooltip("Default: 1\nPop Butlers: 5")]
public int HitId = 1;
[Header("Heavy Weapons")]
[Tooltip("Heavy Weapons are similar to the shovel or signs.\nNon Heavy Weapons are similar to the Kitchen Knife")]
public bool isHeavyWeapon = true;
[Tooltip("Shovel Default: 0.35")]
public float reelingTime = 0.35f;
private float reelingAnimSpeed = 1f;
[Tooltip("Shovel Default: 0.13")]
public float swingTime = 0.13f;
private bool reelingUp;
private bool isHoldingButton;
private Coroutine? reelingUpCoroutine;
[Header("Damage Targets")]
public bool damagePlayers = true;
[Tooltip("Passes a Player that has been damaged by the weapon")]
public UnityEvent<PlayerControllerB> OnPlayerHit = new UnityEvent<PlayerControllerB>();
public bool damageEnemies = true;
[Tooltip("Passes an Enemy that has been damaged by the weapon")]
public UnityEvent<EnemyAI> OnEnemyHit = new UnityEvent<EnemyAI>();
public bool damageVehicles = false;
[Tooltip("Passes a Vehicle that has been damaged by the weapon")]
public UnityEvent<VehicleController> OnVehicleHit = new UnityEvent<VehicleController>();
public bool damageObjects = true;
[Tooltip("Passes an Object that has been damaged by the weapon")]
public UnityEvent<IHittable> OnObjectHit = new UnityEvent<IHittable>();
[Header("Audio")]
public AudioClip[] hitSFX;
[Tooltip("Only used for Heavy Weapons")]
public AudioClip[] reelUpSFX;
public AudioClip[] swingSFX;
public AudioSource weaponAudio;
[HideInInspector]
public PlayerControllerB previousPlayerHeldBy;
public override void ItemActivate(bool used, bool buttonDown = true)
{
if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
{
return;
}
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
if (((GrabbableObject)this).itemProperties.requiresBattery && ((GrabbableObject)this).insertedBattery.empty)
{
return;
}
if (isHeavyWeapon)
{
isHoldingButton = buttonDown;
if (!(!reelingUp && buttonDown))
{
return;
}
reelingUp = true;
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
if (reelingUpCoroutine != null)
{
if (JLLExtentions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy))
{
((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = 1f;
}
((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
}
reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelBackWeapon());
return;
}
PlayRandomSFX(swingSFX);
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
if (JLLExtentions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy))
{
((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1");
}
}
if (((NetworkBehaviour)this).IsOwner && Time.realtimeSinceStartup - timeAtLastDamageDealt > weaponCooldown)
{
HitWeapon();
}
}
[IteratorStateMachine(typeof(<ReelBackWeapon>d__29))]
private IEnumerator ReelBackWeapon()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ReelBackWeapon>d__29(0)
{
<>4__this = this
};
}
[ServerRpc]
public void ReelUpSFXServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0107: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3259025159u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3259025159u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
ReelUpSFXClientRpc();
}
}
[ClientRpc]
public void ReelUpSFXClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2764645124u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2764645124u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PlayRandomSFX(reelUpSFX);
}
}
}
public override void DiscardItem()
{
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
((GrabbableObject)this).playerHeldBy.activatingItem = false;
if (JLLExtentions.IsLocalPlayer(((GrabbableObject)this).playerHeldBy))
{
((GrabbableObject)this).playerHeldBy.playerBodyAnimator.speed = 1f;
}
}
((GrabbableObject)this).DiscardItem();
}
public virtual void SwingHeavyWeapon(bool cancel = false)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
if (!cancel)
{
PlayRandomSFX(swingSFX);
previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
}
}
public bool HitWeapon(bool cancel = false)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Expected I4, but got Unknown
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
return false;
}
previousPlayerHeldBy.activatingItem = false;
int num = -1;
bool flag = false;
bool flag2 = false;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
RaycastHit[] source = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, weaponRange / 1.5f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, weaponRange, LayerMask.op_Implicit(hitMask), (QueryTriggerInteraction)2);
List<RaycastHit> list = source.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
List<GameObject> list2 = new List<GameObject>();
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
IHittable val = default(IHittable);
VehicleController val8 = default(VehicleController);
foreach (RaycastHit item in list)
{
RaycastHit current = item;
if (((Component)((RaycastHit)(ref current)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref current)).collider).gameObject.layer == 11)
{
if (((RaycastHit)(ref current)).collider.isTrigger)
{
continue;
}
for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++)
{
if (((Component)((RaycastHit)(ref current)).collider).gameObject.tag == StartOfRound.Instance.footstepSurfaces[i].surfaceTag)
{
num = i;
flag = true;
break;
}
}
continue;
}
if (((Component)((RaycastHit)(ref current)).collider).TryGetComponent<IHittable>(ref val))
{
GameObject val2 = null;
ColliderType val3 = (ColliderType)3;
bool flag3 = true;
EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val is EnemyAICollisionDetect) ? val : null);
if (val4 != null)
{
flag3 = damageEnemies;
val2 = ((Component)val4.mainScript).gameObject;
val3 = (ColliderType)1;
}
else
{
PlayerControllerB val5 = (PlayerControllerB)(object)((val is PlayerControllerB) ? val : null);
if (val5 != null)
{
if (val5.actualClientId == previousPlayerHeldBy.actualClientId)
{
continue;
}
flag3 = damagePlayers;
val2 = ((Component)val5).gameObject;
val3 = (ColliderType)0;
}
else
{
flag3 = damageObjects;
val2 = ((Component)((RaycastHit)(ref current)).collider).gameObject;
}
}
JLogHelper.LogInfo($"{((Object)((RaycastHit)(ref current)).transform).name} {flag3}", (JLogLevel)2);
if (flag3 && (Object)(object)val2 != (Object)null && !list2.Contains(val2) && OnWeaponHit(val, forward))
{
list2.Add(val2);
if (!flag)
{
flag = true;
}
if (!flag2)
{
flag2 = true;
}
ColliderType val6 = val3;
ColliderType val7 = val6;
switch ((int)val7)
{
case 0:
{
OnPlayerHit.Invoke(((Component)((RaycastHit)(ref current)).collider).GetComponent<PlayerControllerB>());
ParticleSystem obj2 = bloodParticle;
if (obj2 != null)
{
obj2.Play(true);
}
break;
}
case 1:
{
OnEnemyHit.Invoke(((Component)((RaycastHit)(ref current)).collider).GetComponent<EnemyAICollisionDetect>().mainScript);
ParticleSystem obj = bloodParticle;
if (obj != null)
{
obj.Play(true);
}
break;
}
case 3:
OnObjectHit.Invoke(val);
break;
}
}
}
if (damageVehicles && ((Component)((RaycastHit)(ref current)).collider).TryGetComponent<VehicleController>(ref val8) && !list2.Contains(((Component)val8).gameObject))
{
list2.Add(((Component)val8).gameObject);
flag = true;
val8.PushTruckServerRpc(((Component)previousPlayerHeldBy).transform.position, forward);
VehicleControllerPatch.DealPermanentDamage((object)val8, HitForce, ((Component)previousPlayerHeldBy).transform.position);
OnVehicleHit.Invoke(val8);
}
}
}
if (flag)
{
timeAtLastDamageDealt = Time.realtimeSinceStartup;
PlayRandomSFX(hitSFX);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
if (isHeavyWeapon)
{
((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
}
HitWeaponServerRpc(num);
}
return flag;
}
public virtual bool OnWeaponHit(IHittable target, Vector3 hitDir)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
return target.Hit(HitForce, hitDir, previousPlayerHeldBy, true, HitId);
}
[ServerRpc]
public void HitWeaponServerRpc(int hitSurfaceID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
//IL_0114: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1250179881u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1250179881u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
HitWeaponClientRpc(hitSurfaceID);
}
}
[ClientRpc]
public void HitWeaponClientRpc(int hitSurfaceID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(209898509u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 209898509u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
PlayRandomSFX(hitSFX);
OnHitSuccess.Invoke(previousPlayerHeldBy);
if (hitSurfaceID != -1)
{
HitSurface(hitSurfaceID);
}
}
}
private void PlayRandomSFX(AudioClip[] clips)
{
if (clips.Length > 1)
{
RoundManager.PlayRandomClip(weaponAudio, clips, true, 1f, 0, 1000);
}
else if (clips.Length == 1)
{
weaponAudio.PlayOneShot(clips[0], Random.Range(0.82f, 1f));
}
}
private void HitSurface(int hitSurfaceID)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3259025159u, new RpcReceiveHandler(__rpc_handler_3259025159), "ReelUpSFXServerRpc");
((NetworkBehaviour)this).__registerRpc(2764645124u, new RpcReceiveHandler(__rpc_handler_2764645124), "ReelUpSFXClientRpc");
((NetworkBehaviour)this).__registerRpc(1250179881u, new RpcReceiveHandler(__rpc_handler_1250179881), "HitWeaponServerRpc");
((NetworkBehaviour)this).__registerRpc(209898509u, new RpcReceiveHandler(__rpc_handler_209898509), "HitWeaponClientRpc");
base.__initializeRpcs();
}
private static void __rpc_handler_3259025159(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((JMeleeWeapon)(object)target).ReelUpSFXServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2764645124(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((JMeleeWeapon)(object)target).ReelUpSFXClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1250179881(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0083: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
int hitSurfaceID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((JMeleeWeapon)(object)target).HitWeaponServerRpc(hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_209898509(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int hitSurfaceID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((JMeleeWeapon)(object)target).HitWeaponClientRpc(hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "JMeleeWeapon";
}
}
public class JNoisemakerProp : JGrabbableObject
{
[Header("Noisemaker")]
public bool isToggle = false;
public bool waitForCompletion = false;
private float activeClipLength = 0f;
private float lastUsedTime = 0f;
[Space(5f)]
public AudioClip[] noiseSFX = (AudioClip[])(object)new AudioClip[0];
public AudioClip[] disableSFX = (AudioClip[])(object)new AudioClip[0];
public AudioSource noiseAudio;
public AudioClip[] noiseSFXFar = (AudioClip[])(object)new AudioClip[0];
public AudioSource noiseAudioFar;
[Space(3f)]
[Tooltip("Airhorn: 65\nCash Register: 25\nClown Horn: 60\nHair Dryer: 30")]
public float noiseRange = 60f;
[Tooltip("Airhorn: 1\nCash Register: 1\nClown Horn: 1\nHair Dryer: 0.9")]
public float maxLoudness = 1f;
[Tooltip("Airhorn: 0.95\nCash Register: 0.9\nClown Horn: 0.6\nHair Dryer: 0.8")]
public float minLoudness = 0.6f;
[Tooltip("Airhorn: 1\nCash Register: 1\nClown Horn: 1\nHair Dryer: 1")]
public float maxPitch = 1f;
[Tooltip("Airhorn: 0.8\nCash Register: 0.95\nClown Horn: 0.93\nHair Dryer: 0.96")]
public float minPitch = 0.93f;
private Random noisemakerRandom;
public Animator? triggerAnimator;
public override void Start()
{
((GrabbableObject)this).Start();
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (Time.realtimeSinceStartup - lastUsedTime < activeClipLength)
{
if (isToggle)
{
if ((Object)(object)noiseAudio != (Object)null)
{
noiseAudio.Stop();
if (disableSFX.Length != 0)
{
int num = noisemakerRandom.Next(0, disableSFX.Length);
float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(disableSFX[num], num2);
}
}
AudioSource obj = noiseAudioFar;
if (obj != null)
{
obj.Stop();
}
activeClipLength = 0f;
return;
}
if (waitForCompletion)
{
return;
}
}
if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
{
int num3 = noisemakerRandom.Next(0, noiseSFX.Length);
float num4 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch2 = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
activeClipLength = noiseSFX[num3].length;
lastUsedTime = Time.realtimeSinceStartup;
if ((Object)(object)noiseAudio != (Object)null)
{
noiseAudio.pitch = pitch2;
noiseAudio.PlayOneShot(noiseSFX[num3], num4);
}
if ((Object)(object)noiseAudioFar != (Object)null && num3 < noiseSFXFar.Length)
{
noiseAudioFar.pitch = pitch2;
noiseAudioFar.PlayOneShot(noiseSFXFar[num3], num4);
}
Animator? obj2 = triggerAnimator;
if (obj2 != null)
{
obj2.SetTrigger("playAnim");
}
WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num3], num4);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num4, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
base.__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "JNoisemakerProp";
}
}
public class JThrowableItem : JGrabbableObject
{
[CompilerGenerated]
private sealed class <interactAnimation>d__58 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public JThrowableItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <interactAnimation>d__58(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<>4__this.inInteractAnimation = true;
((GrabbableObject)<>4__this).playerHeldBy.activatingItem = true;
((GrabbableObject)<>4__this).playerHeldBy.doingUpperBodyEmote = 1.16f;
((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetTrigger(<>4__this.playerAnimation);
Animator? itemAnimator = <>4__this.itemAnimator;
if (itemAnimator != null)
{
itemAnimator.SetTrigger("pullPin");
}
if (Object.op_Implicit((Object)(object)<>4__this.itemAudio) && (Object)(object)<>4__this.interactSFX != (Object)null)
{
<>4__this.itemAudio.PlayOneShot(<>4__this.interactSFX);
WalkieTalkie.TransmitOneShotAudio(<>4__this.itemAudio, <>4__this.interactSFX, 0.8f);
}
((UnityEvent<PlayerControllerB>)(object)<>4__this.InteractionEvent).Invoke(((GrabbableObject)<>4__this).playerHeldBy);
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
if ((Object)(object)((GrabbableObject)<>4__this).playerHeldBy != (Object)null)
{
if (!<>4__this.destroyOnExplode)
{
((GrabbableObject)<>4__this).playerHeldBy.activatingItem = false;
}
<>4__this.playerThrownBy = ((GrabbableObject)<>4__this).playerHeldBy;
}
<>4__this.inInteractAnimation = false;
<>4__this.interactedWith = true;
((GrabbableObject)<>4__this).itemUsedUp = true;
if (((NetworkBehaviour)<>4__this).IsOwner && (Object)(object)((GrabbableObject)<>4__this).playerHeldBy != (Object)null)
{
((GrabbableObject)<>4__this).SetControlTipsForItem();
}
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();
}
}
[Header("Throwable Item")]
public bool throwable = true;
public string throwString = "Throw grenade: [RMB]";
private LayerMask projectileMask = LayerMask.op_Implicit(268437761);
public AnimationCurve projectileFallCurve;
public AnimationCurve projectileVerticalFallCurve;
public AnimationCurve projectileVerticalFallCurveNoBounce;
[Header("Explosion Settings")]
public bool damageOnExplode = false;
public bool stunOnExplode = false;
public bool spawnItemsOnExplode = false;
public GameObject? explosionPrefab;
public bool hasExploded = false;
[Tooltip("Random chance is rolled on impact. If interaction is required then explosion chance will only be rolled on collisions after the interaction has been performed")]
public float chanceToExplodeOnThrow = 100f;
[Tooltip("Random chance is rolled on impact. If interaction is required then explosion chance will only be rolled on collisions after the interaction has been performed")]
public float chanceToExplodeOnDropped = 100f;
public bool destroyOnExplode = false;
[Header("Interact Before Throw")]
public bool hasInteraction = false;
public string interactString = "Pull pin: [RMB]";
public string playerAnimation = "PullGrenadePin";
public bool interactedWith = false;
private bool inInteractAnimation = false;
private Coroutine? interactCoroutine;
public bool interactionStartsTimer = false;
[Tooltip("Waits timeToExplode before exploding. If interactionStartsTimer is checked the timer will have to run twice for the explosion to occur.")]
[FormerlySerializedAs("explodeOnTimer")]
public bool explosionStartsTimer = false;
private bool markedToExplode = false;
public float timeToExplode = 2.25f;
private float explodeTimer = 0f;
[Header("Explosion Properties")]
public float killDistance = 0.5f;
public float damageRange = 3f;
public int nonLethalDamage = 40;
public float pushForce = 45f;
public bool goThroughCar = false;
[Header("Stun Explosion Properties")]
public bool affectAudio = true;
public float flashSeverityMultiplier = 1f;
public float enemyStunTime = 7.5f;
public float flashSeverityDistanceRolloff = 1f;
[Header("Item Spawner")]
[Tooltip("How many items get spawned in")]
public int numberToSpawn = 1;
public SpawnPoolSource SourcePool = (SpawnPoolSource)0;
public WeightedItemRefrence[] CustomList = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
{
new WeightedItemRefrence()
};
[Tooltip("Spawn offsets. Index is the number spawned")]
public Vector3[] SpawnOffsets = (Vector3[])(object)new Vector3[0];
[Header("Events")]
public UnityEvent ExplodeEvent = new UnityEvent();
public InteractEvent ThrowEvent = new InteractEvent();
public InteractEvent InteractionEvent = new InteractEvent();
public InteractEvent CollisionEvent = new InteractEvent();
[Header("FX")]
[Tooltip("Trigger: \"pullPin\"\nTrigger: \"explode\"")]
public Animator? itemAnimator;
public AudioSource itemAudio;
public AudioClip? interactSFX;
public AudioClip? explodeSFX;
private bool explodeOnThrow = false;
private bool explodeOnDrop = false;
public bool wasThrown = false;
[HideInInspector]
public PlayerControllerB? playerThrownBy;
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (inInteractAnimation)
{
return;
}
if (hasInteraction && !interactedWith)
{
if (interactCoroutine == null)
{
((GrabbableObject)this).playerHeldBy.activatingItem = true;
interactCoroutine = ((MonoBehaviour)this).StartCoroutine(interactAnimation());
}
}
else if (((NetworkBehaviour)this).IsOwner && throwable)
{
ThrowItem();
}
}
public virtual void ThrowItem()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
wasThrown = true;
((UnityEvent<PlayerControllerB>)(object)ThrowEvent).Invoke(((GrabbableObject)this).playerHeldBy);
((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetThrowDestination(), true);
}
public override void DiscardItem()
{
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
((GrabbableObject)this).playerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
public override void EquipItem()
{
base.EquipItem();
playerThrownBy = ((GrabbableObject)this).playerHeldBy;
explodeOnThrow = false;
explodeOnDrop = false;
wasThrown = false;
SetExplodeOnThrowServerRpc();
}
[ServerRpc(RequireOwnership = false)]
public void SetExplodeOnThrowServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4058280918u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4058280918u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SetExplodeOnThrowClientRpc(new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 100));
}
}
}
[ClientRpc]
public void SetExplodeOnThrowClientRpc(int random)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(217367956u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, random);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 217367956u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
explodeOnThrow = (float)random <= chanceToExplodeOnThrow;
explodeOnDrop = (float)random <= chanceToExplodeOnDropped;
}
}
}
public override void SetControlTipsForItem()
{
List<string> list = new List<string>();
list.AddRange(((GrabbableObject)this).itemProperties.toolTips);
if (hasInteraction && !interactedWith)
{
list.Add(interactString);
}
else if (throwable)
{
list.Add(throwString);
}
HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), true, ((GrabbableObject)this).itemProperties);
}
public override void FallWithCurve()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition;
float magnitude = ((Vector3)(ref val)).magnitude;
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude);
((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, projectileFallCurve.Evaluate(((GrabbableObject)this).fallTime));
if (magnitude > 5f)
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), projectileVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime));
}
else
{
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), projectileVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime));
}
((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
}
[IteratorStateMachine(typeof(<interactAnimation>d__58))]
private IEnumerator interactAnimation()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <interactAnimation>d__58(0)
{
<>4__this = this
};
}
public override void Update()
{
((GrabbableObject)this).Update();
if (((!interactionStartsTimer || !interactedWith) && (!explosionStartsTimer || !markedToExplode)) || hasExploded)
{
return;
}
explodeTimer += Time.deltaTime;
if (explodeTimer > timeToExplode)
{
if (interactionStartsTimer && explosionStartsTimer && !markedToExplode)
{
markedToExplode = true;
explodeTimer = 0f;
}
else
{
ExplodeProjectile(destroyOnExplode);
}
}
}
public override void Start()
{
((GrabbableObject)this).Start();
if (!hasInteraction)
{
interactedWith = true;
}
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
if ((Object)(object)playerThrownBy != (Object)null && (!hasInteraction || interactedWith))
{
((UnityEvent<PlayerControllerB>)(object)CollisionEvent).Invoke(playerThrownBy);
OnItemCollision(wasThrown);
}
}
public virtual void OnItemCollision(bool thrown)
{
if ((thrown && explodeOnThrow) || (!thrown && explodeOnDrop))
{
ExplodeProjectile(destroyOnExplode);
}
}
public void ExplodeProjectile(bool destroy = false)
{
if (hasExploded)
{
return;
}
if ((Object)(object)StartOfRound.Instance.currentLevel != (Object)null && !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
DepositItemsDesk val = Object.FindObjectOfType<DepositItemsDesk>();
if ((Object)(object)val != (Object)null && (Object)(object)playerThrownBy != (Object)null && (Object)(object)((GrabbableObject)this).parentObject == (Object)(object)val.deskObjectsContainer)
{
playerThrownBy.activatingItem = false;
return;
}
}
Animator? obj = itemAnimator;
if (obj != null)
{
obj.SetTrigger("explode");
}
if (explosionStartsTimer && !markedToExplode)
{
markedToExplode = true;
return;
}
hasExploded = true;
ExplodeEvent.Invoke();
Transform parent = ((!((GrabbableObject)this).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
CreateExplosion(parent);
if (destroy)
{
((GrabbableObject)this).DestroyObjectInHand(playerThrownBy);
}
}
public virtual void CreateExplosion(Transform parent)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
if (damageOnExplode)
{
Landmine.SpawnExplosion(((Component)this).transform.position, false, killDistance, damageRange, nonLethalDamage, pushForce, (GameObject)null, goThroughCar);
}
if (stunOnExplode)
{
StunGrenadeItem.StunExplosion(((Component)this).transform.position, affectAudio, flashSeverityMultiplier, enemyStunTime, flashSeverityDistanceRolloff, ((GrabbableObject)this).isHeld, ((GrabbableObject)this).playerHeldBy, playerThrownBy, 0f);
}
if (spawnItemsOnExplode)
{
SpawnItemsOnServer(numberToSpawn);
}
if ((Object)(object)explosionPrefab != (Object)null)
{
Object.Instantiate<GameObject>(explosionPrefab, ((Component)this).transform.position, Quaternion.identity, parent);
}
if (Object.op_Implicit((Object)(object)itemAudio) && (Object)(object)explodeSFX != (Object)null)
{
itemAudio.PlayOneShot(explodeSFX);
WalkieTalkie.TransmitOneShotAudio(itemAudio, explodeSFX, 1f);
}
}
public void ResetExplosionTimer()
{
explodeTimer = 0f;
}
public void SpawnItemsOnServer(int amount)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0058: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.position + Vector3.up * 0.25f;
Transform val2 = ((!((GrabbableObject)this).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
SpawnPoolSource sourcePool = SourcePool;
Quaternion rotation = ((Component)this).transform.rotation;
ItemSpawner.SpawnRandomItems(sourcePool, val, val2, Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f), CustomList, SpawnOffsets, amount, true, (RotationType)2);
}
public Vector3 GetThrowDestination()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position;
Debug.DrawRay(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward, Color.yellow, 15f);
Ray val = default(Ray);
((Ray)(ref val))..ctor(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
RaycastHit val2 = default(RaycastHit);
position = ((!Physics.Raycast(val, ref val2, 12f, LayerMask.op_Implicit(projectileMask), (QueryTriggerInteraction)1)) ? ((Ray)(ref val)).GetPoint(10f) : ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val2)).distance - 0.05f));
Debug.DrawRay(position, Vector3.down, Color.blue, 15f);
((Ray)(ref val))..ctor(position, Vector3.down);
if (Physics.Raycast(val, ref val2, 30f, LayerMask.op_Implicit(projectileMask), (QueryTriggerInteraction)1))
{
return ((RaycastHit)(ref val2)).point + Vector3.up * 0.05f;
}
return ((Ray)(ref val)).GetPoint(30f);
}
private void OnDrawGizmosSelected()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if (damageOnExplode)
{
if (killDistance > 0f)
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(((Component)this).transform.position, killDistance);
}
if (damageRange > 0f)
{
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(((Component)this).transform.position, damageRange);
}
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(4058280918u, new RpcReceiveHandler(__rpc_handler_4058280918), "SetExplodeOnThrowServerRpc");
((NetworkBehaviour)this).__registerRpc(217367956u, new RpcReceiveHandler(__rpc_handler_217367956), "SetExplodeOnThrowClientRpc");
base.__initializeRpcs();
}
private static void __rpc_handler_4058280918(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((JThrowableItem)(object)target).SetExplodeOnThrowServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_217367956(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int explodeOnThrowClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref explodeOnThrowClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((JThrowableItem)(object)target).SetExplodeOnThrowClientRpc(explodeOnThrowClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "JThrowableItem";
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace JLLItemsModule.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 DisplayAllMoons;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using JLL;
using JLL.API;
using JLL.API.Compatability;
using JLL.API.LevelProperties;
using JLL.Components;
using JLL.ScriptableObjects;
using JLLItemsModule.Components;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using MoonUnlockUnhide;
using MrovLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Video;
using WesleyMoonScripts.Components;
using WesleyMoonScripts.NetcodePatcher;
using WesleyMoonScripts.Patches;
using WesleyMoonScripts.Patches.ReLocker;
using WesleyMoonScripts.ScriptableObjects;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("MoonUnlockUnhide")]
[assembly: AssemblyCompany("WesleyMoonScripts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WesleyMoonScripts")]
[assembly: AssemblyTitle("WesleyMoonScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
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;
}
}
}
namespace WesleyMoonScripts
{
[BepInPlugin("JacobG5.WesleyMoonScripts", "WesleyMoonScripts", "1.1.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class WesleyScripts : BaseUnityPlugin
{
private const string modGUID = "JacobG5.WesleyMoonScripts";
private const string modName = "WesleyMoonScripts";
private const string modVersion = "1.1.7";
public static WesleyScripts Instance;
internal ManualLogSource mls;
public static ConfigEntry<bool> LockMoons;
private readonly Harmony harmony = new Harmony("JacobG5.WesleyMoonScripts");
internal static bool WesleyPresent;
public void Awake()
{
Instance = this;
mls = Logger.CreateLogSource("JacobG5.WesleyMoonScripts");
JLL.NetcodePatch(mls, new Type[5]
{
typeof(HorrorEvent),
typeof(ItemShop),
typeof(LevelCassetteLoader),
typeof(MicBombItem),
typeof(Mortor)
});
WesleyPresent = JCompatabilityHelper.IsLoaded((CachedMods)16);
if (WesleyPresent)
{
LockMoons = ((BaseUnityPlugin)this).Config.Bind<bool>("Core", "LockMoons", true, "Locks moons that have progression integration set up to enable playing the campaign.");
if (LockMoons.Value)
{
if (JCompatabilityHelper.IsLoaded("ProjectBots.MoonUnlockUnhide", StringComparison.InvariantCultureIgnoreCase))
{
mls.LogInfo((object)"Patching MoonUnlockUnhide");
try
{
harmony.PatchAll(typeof(MoonUnlockUnhidePatch));
}
catch (Exception arg)
{
mls.LogWarning((object)$"Patching MoonUnlockUnhide Failed!\n{arg}");
}
}
if (JCompatabilityHelper.IsLoaded("DisplayAllMoons", StringComparison.InvariantCultureIgnoreCase))
{
mls.LogInfo((object)"Patching DisplayAllMoons");
try
{
harmony.PatchAll(typeof(DisplayAllMoonsPatch));
}
catch (Exception arg2)
{
mls.LogWarning((object)$"Patching DisplayAllMoons Failed!\n{arg2}");
}
}
}
}
try
{
harmony.PatchAll(typeof(LLLContentPatch));
}
catch (Exception arg3)
{
mls.LogWarning((object)$"Patching LLL PatchedContent Failed!\n{arg3}");
}
harmony.PatchAll(typeof(EntranceTeleportPatch));
}
public static bool ProtectionEnabled()
{
return WesleyPresent && LockMoons.Value;
}
}
}
namespace WesleyMoonScripts.ScriptableObjects
{
[CreateAssetMenu(menuName = "JLL/WesleyMoons/ProgressionIntegration", order = 20)]
public class WesleyProgressionIntegration : JLLAddon
{
[Serializable]
public class WesleyIntegratedLevel
{
public string sceneName;
public string planetName;
public bool forceLock = true;
public bool moonUnlockerProtection = true;
[HideInInspector]
public string NumberlessName => new string(planetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray());
}
public static List<WesleyIntegratedLevel> AllLevels = new List<WesleyIntegratedLevel>();
public WesleyIntegratedLevel[] IntegratedLevels = new WesleyIntegratedLevel[1]
{
new WesleyIntegratedLevel()
};
public override void Init(JLLMod parent)
{
AllLevels.AddRange(IntegratedLevels);
if (!WesleyScripts.WesleyPresent || !WesleyScripts.LockMoons.Value)
{
return;
}
List<WesleyIntegratedLevel> source = IntegratedLevels.Where((WesleyIntegratedLevel x) => x.forceLock).ToList();
if (JCompatabilityHelper.IsLoaded((CachedMods)17))
{
LMUHelper.SubscribeStoryLocks(source.Select((WesleyIntegratedLevel x) => x.NumberlessName).ToArray());
}
}
}
}
namespace WesleyMoonScripts.Patches
{
[HarmonyPatch(typeof(EntranceTeleport))]
internal class EntranceTeleportPatch
{
[HarmonyPatch("TeleportPlayerClientRpc")]
[HarmonyPostfix]
public static void patchTeleportPlayerClient(EntranceTeleport __instance)
{
ExitDoorEffects exitDoorEffects = default(ExitDoorEffects);
if ((Object)(object)__instance.exitScript != (Object)null && ((Component)__instance.exitScript).TryGetComponent<ExitDoorEffects>(ref exitDoorEffects))
{
exitDoorEffects.PlayExitFX();
}
}
}
internal class LLLContentPatch
{
[HarmonyPatch(typeof(PatchedContent), "PopulateContentDictionaries")]
[HarmonyPostfix]
private static void PopulateContentPatch()
{
if (!WesleyScripts.ProtectionEnabled())
{
return;
}
foreach (WesleyProgressionIntegration.WesleyIntegratedLevel allLevel in WesleyProgressionIntegration.AllLevels)
{
ExtendedLevel level = LLLHelper.GetLevel(allLevel.sceneName);
if ((Object)(object)level != (Object)null && allLevel.forceLock)
{
level.IsRouteLocked = true;
level.IsRouteHidden = true;
}
}
}
}
}
namespace WesleyMoonScripts.Patches.ReLocker
{
[HarmonyPatch]
internal class DisplayAllMoonsPatch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(ConfigManager), "Init", (Type[])null, (Type[])null);
}
private static void Postfix()
{
List<string> list = new List<string>();
list.AddRange(from x in ((ConfigHandler<SelectableLevel[], string>)(object)ConfigManager.BlacklistList).ConfigEntry.Value.Split(';')
where !Utility.IsNullOrWhiteSpace(x)
select x);
foreach (WesleyProgressionIntegration.WesleyIntegratedLevel allLevel in WesleyProgressionIntegration.AllLevels)
{
string numberlessName = allLevel.NumberlessName;
if (allLevel.moonUnlockerProtection && !list.Contains(numberlessName))
{
list.Add(numberlessName);
}
}
((ConfigHandler<SelectableLevel[], string>)(object)ConfigManager.BlacklistList).ConfigEntry.Value = string.Join(';', list) + ";";
}
}
[HarmonyPatch]
public class MoonUnlockUnhidePatch
{
private static MethodBase TargetMethod()
{
return AccessTools.Method(typeof(UnlockUnhidePatch), "genIgnoreMoonsList", (Type[])null, (Type[])null);
}
private static void Postfix()
{
try
{
WesleyScripts.Instance.mls.LogInfo((object)$"Adding {WesleyProgressionIntegration.AllLevels.Count} ingore levels.");
foreach (WesleyProgressionIntegration.WesleyIntegratedLevel allLevel in WesleyProgressionIntegration.AllLevels)
{
if (allLevel.moonUnlockerProtection)
{
string text = allLevel.NumberlessName.ToLower();
UnlockUnhidePatch.ignoreMoons.Add(text);
WesleyScripts.Instance.mls.LogInfo((object)("Ignoring " + text));
}
}
}
catch (Exception arg)
{
WesleyScripts.Instance.mls.LogWarning((object)$"Caught Error patching MoonUnlockUnhide: {arg}");
}
}
}
}
namespace WesleyMoonScripts.Components
{
public class Clock : MonoBehaviour
{
public enum TimeScale
{
GameTime,
RealTime,
Random,
Disabled
}
public Transform hourHand;
public Transform minuteHand;
public TimeScale timeScale = TimeScale.GameTime;
public bool smoothTicks = false;
public Vector2 randomScaleRange = new Vector2(0f, 1.5f);
[Header("Complying with wesly's demands")]
public AudioClip[] tick = (AudioClip[])(object)new AudioClip[0];
private int clip = 0;
public AudioSource audioSource;
private float lastMinute = 0f;
private float randomCurrent;
private float randomScale;
public void Start()
{
randomCurrent = Random.Range(0f, 1440f);
randomScale = Random.Range(randomScaleRange.x, randomScaleRange.y);
}
public void Update()
{
switch (timeScale)
{
case TimeScale.GameTime:
{
int num = (int)(TimeOfDay.Instance.normalizedTimeOfDay * (60f * (float)TimeOfDay.Instance.numberOfHours)) + 360;
UpdateHandRots(num / 60, num);
break;
}
case TimeScale.RealTime:
{
DateTime now = DateTime.Now;
UpdateHandRots((float)now.Hour + (float)now.Minute / 60f, (float)now.Minute + (float)now.Second / 60f);
break;
}
case TimeScale.Random:
randomCurrent += Time.deltaTime * randomScale;
UpdateHandRots(randomCurrent / 60f, randomCurrent);
break;
}
}
public void UpdateHandRots(float hours, float minutes)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Floor(minutes);
if (lastMinute != num)
{
lastMinute = num;
if ((Object)(object)audioSource != (Object)null && tick.Length != 0)
{
audioSource.PlayOneShot(tick[clip]);
clip++;
if (clip >= tick.Length)
{
clip = 0;
}
}
}
if (!smoothTicks)
{
minutes = num;
}
hourHand.localEulerAngles = new Vector3(0f, 360f * (hours / 12f), 0f);
minuteHand.localEulerAngles = new Vector3(0f, 360f * (minutes / 60f), 0f);
}
public void SetRandomTimeScale(float timeScale)
{
randomScale = timeScale;
}
}
public class ExitDoorEffects : MonoBehaviour
{
public EntranceTeleport entranceDoor;
public ParticleSystem exitParticles;
public AudioClip exitSound;
public AudioSource audioSource;
public void PlayExitFX()
{
exitParticles.Play();
audioSource.PlayOneShot(exitSound);
}
}
[RequireComponent(typeof(LocalVolumetricFog))]
public class FadingFogVolume : MonoBehaviour, IDungeonLoadListener
{
public Vector2 ActiveDistanceMinMax = new Vector2(5f, 10f);
public Vector2 ActiveDurationMinMax = new Vector2(8f, 16f);
public Vector2 InActiveDistanceMinMax = new Vector2(15f, 25f);
public Vector2 InActiveDurationMinMax = new Vector2(4f, 12f);
public Vector2 transitionDurationMinMax = new Vector2(0.5f, 4f);
private bool activePhase = false;
public bool transitioning = false;
private float timer = 0f;
private float timerStart = 0f;
private float targetDensity;
private LocalVolumetricFog volumetricFog;
private Random Random;
private bool initialized = false;
public int relativeSeed = 21;
[Header("SFX")]
public AudioSource source;
public AudioClip fadeIn;
public AudioClip fadeOut;
public void PostDungeonGeneration()
{
volumetricFog = ((Component)this).GetComponent<LocalVolumetricFog>();
Random = new Random(StartOfRound.Instance.randomMapSeed + relativeSeed);
initialized = (Object)(object)volumetricFog != (Object)null;
}
public void Update()
{
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
if (!initialized)
{
return;
}
timer -= Time.deltaTime;
if (transitioning)
{
if (timer < 0f)
{
transitioning = false;
volumetricFog.parameters.meanFreePath = targetDensity;
timer = (timerStart = RandomBetween(activePhase ? ActiveDurationMinMax : InActiveDurationMinMax));
}
else
{
volumetricFog.parameters.meanFreePath = Mathf.Lerp(targetDensity, volumetricFog.parameters.meanFreePath, timer / timerStart);
}
}
else if (timer < 0f)
{
transitioning = true;
activePhase = !activePhase;
targetDensity = RandomBetween(activePhase ? ActiveDistanceMinMax : InActiveDistanceMinMax);
timer = (timerStart = RandomBetween(transitionDurationMinMax));
AudioClip val = (activePhase ? fadeIn : fadeOut);
if ((Object)(object)source != (Object)null && (Object)(object)val != (Object)null)
{
source.PlayOneShot(val);
}
}
}
private float RandomBetween(Vector2 minMax)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Mathf.Lerp(minMax.x, minMax.y, (float)Random.NextDouble());
}
}
[RequireComponent(typeof(Doorway))]
public class GrandArmoryBlocker : MonoBehaviour, IDungeonLoadListener
{
private Doorway doorway;
public List<GameObjectWeight> BlockerPrefabWeights = new List<GameObjectWeight>();
private void Start()
{
doorway = ((Component)this).GetComponent<Doorway>();
}
public void PostDungeonGeneration()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)doorway.ConnectedDoorway == (Object)null)
{
Object.Instantiate<GameObject>(DungeonUtil.GetRandom(BlockerPrefabWeights, RoundManager.Instance.dungeonGenerator.Generator.RandomStream), ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform);
}
}
}
public class HorrorEvent : NetworkBehaviour
{
[Serializable]
public class WeightedHorrorEvent : IWeightedItem
{
public string AnimationTrigger = "";
public UnityEvent Event = new UnityEvent();
[Range(0f, 100f)]
public int Weight = 20;
public int GetWeight()
{
return Weight;
}
}
[Header("Chances")]
[Range(0f, 100f)]
public float StandardChance = 2f;
[Range(0f, 100f)]
public float MeltdownChance = 20f;
[Header("Validation")]
public float MaxPlayerDistance = 15f;
public float MinPlayerDistance = 0f;
public bool RequireLineOfSight = false;
public LayerMask RaycastMask = LayerMask.op_Implicit(1084754248);
public float RollInterval = 25f;
private float RollTimer = 0f;
public int repeatLimit = 0;
private bool finished = false;
public float cooldown = 60f;
[Header("EventTrigger")]
public Animator? animator;
public WeightedHorrorEvent[] horrorEvents = new WeightedHorrorEvent[0];
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if (cooldown < 0f)
{
cooldown = 0f - cooldown;
}
RollTimer = Random.Range(0f - cooldown, 0f);
}
public void Update()
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if ((!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost) || finished)
{
return;
}
RollTimer += Time.deltaTime;
if (!(RollTimer > RollInterval))
{
return;
}
RollTimer -= RollInterval;
bool flag = false;
GameObject[] allPlayerObjects = RoundManager.Instance.playersManager.allPlayerObjects;
RaycastHit val2 = default(RaycastHit);
foreach (GameObject val in allPlayerObjects)
{
float num = Vector3.Distance(((Component)this).transform.position, val.transform.position);
if (num < MaxPlayerDistance && num >= MinPlayerDistance && (!RequireLineOfSight || !Physics.Raycast(((Component)this).transform.position, val.transform.position, ref val2, MaxPlayerDistance, LayerMask.op_Implicit(RaycastMask)) || ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == 3))
{
flag = true;
break;
}
}
if (flag && (float)Random.Range(0, 100) < (JLevelPropertyRegistry.ApparatusPulled ? MeltdownChance : StandardChance))
{
TriggerHorrorEventServerRpc();
}
}
[ServerRpc]
private void TriggerHorrorEventServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0107: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1348150288u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1348150288u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (horrorEvents.Length != 0)
{
IWeightedItem[] array = (IWeightedItem[])(object)horrorEvents;
TriggerHorrorEventClientRpc(IWeightedItem.GetRandomIndex(array));
}
}
}
[ClientRpc]
private void TriggerHorrorEventClientRpc(int index)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2586387981u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2586387981u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
if (horrorEvents.Length != 0 && index >= 0 && index < horrorEvents.Length)
{
WeightedHorrorEvent weightedHorrorEvent = horrorEvents[index];
if ((Object)(object)animator != (Object)null && !string.IsNullOrEmpty(weightedHorrorEvent.AnimationTrigger))
{
animator.ResetTrigger(weightedHorrorEvent.AnimationTrigger);
animator.SetTrigger(weightedHorrorEvent.AnimationTrigger);
}
weightedHorrorEvent.Event.Invoke();
repeatLimit--;
if (repeatLimit < 0)
{
finished = true;
}
else
{
RollTimer = 0f - cooldown;
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1348150288u, new RpcReceiveHandler(__rpc_handler_1348150288), "TriggerHorrorEventServerRpc");
((NetworkBehaviour)this).__registerRpc(2586387981u, new RpcReceiveHandler(__rpc_handler_2586387981), "TriggerHorrorEventClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1348150288(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((HorrorEvent)(object)target).TriggerHorrorEventServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2586387981(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
target.__rpc_exec_stage = (__RpcExecStage)1;
((HorrorEvent)(object)target).TriggerHorrorEventClientRpc(index);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "HorrorEvent";
}
}
public class ItemShop : NetworkBehaviour
{
[Serializable]
public class SaleSpot
{
public float emptyChance = 0.2f;
public Transform transform;
public InteractTrigger buyInteract;
[HideInInspector]
public int price;
[HideInInspector]
public GrabbableObject? item = null;
[HideInInspector]
public bool ready = false;
}
[CompilerGenerated]
private sealed class <SyncItems>d__12 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ItemShop <>4__this;
private int <i>5__1;
private SaleSpot <itemSpawn>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SyncItems>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<itemSpawn>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.syncDelay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<i>5__1 = 0;
while (<i>5__1 < <>4__this.spawnPositions.Length)
{
<itemSpawn>5__2 = <>4__this.spawnPositions[<i>5__1];
if ((Object)(object)<itemSpawn>5__2.item != (Object)null)
{
ItemSpawner.OverrideScrapValue(<itemSpawn>5__2.item, <>4__this.setScrapValue ? <itemSpawn>5__2.price : 0);
<itemSpawn>5__2.price = Mathf.RoundToInt((float)<itemSpawn>5__2.price * <>4__this.priceMultiplier);
<>4__this.SyncBuyableClientRpc(<i>5__1, <itemSpawn>5__2.price, NetworkObjectReference.op_Implicit(((NetworkBehaviour)<itemSpawn>5__2.item).NetworkObject));
<itemSpawn>5__2.ready = true;
}
<itemSpawn>5__2 = null;
<i>5__1++;
}
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();
}
}
public bool spawnOnStart = true;
public float priceMultiplier = 1.2f;
public bool setScrapValue = false;
public string purchasedString = "Purchased!";
public string emptyString = "Empty";
public SaleSpot[] spawnPositions = new SaleSpot[1]
{
new SaleSpot()
};
public WeightedItemRefrence[] Catalogue = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
{
new WeightedItemRefrence()
};
public AudioSource audioSource;
public AudioClip buyClip;
public float syncDelay = 2f;
public override void OnNetworkSpawn()
{
//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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
((NetworkBehaviour)this).OnNetworkSpawn();
SaleSpot[] array = spawnPositions;
foreach (SaleSpot saleSpot in array)
{
saleSpot.buyInteract.interactable = false;
saleSpot.buyInteract.disabledHoverTip = emptyString;
}
if (!((NetworkBehaviour)this).IsServer && !((NetworkBehaviour)this).IsHost)
{
return;
}
WeightedItemRefrence[] catalogue = Catalogue;
foreach (WeightedItemRefrence val in catalogue)
{
val.FindRegistered();
}
SaleSpot[] array2 = spawnPositions;
int num = default(int);
Vector3 val2 = default(Vector3);
foreach (SaleSpot saleSpot2 in array2)
{
if ((Object)(object)saleSpot2.transform == (Object)null || (Object)(object)saleSpot2.buyInteract == (Object)null || Random.Range(0f, 1f) < saleSpot2.emptyChance)
{
continue;
}
Item randomItem = ItemSpawner.GetRandomItem((SpawnPoolSource)0, ref num, ref val2, Catalogue);
if ((Object)(object)randomItem != (Object)null && (Object)(object)randomItem.spawnPrefab != (Object)null)
{
GrabbableObject val3 = ItemSpawner.SpawnItem(randomItem, saleSpot2.transform.position + val2, saleSpot2.transform, saleSpot2.transform.rotation, -1, false, (RotationType)2);
if ((Object)(object)val3 != (Object)null)
{
saleSpot2.price = ((num < 0) ? Mathf.RoundToInt((float)Random.Range(val3.itemProperties.minValue, val3.itemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier) : num);
saleSpot2.item = val3;
((NetworkBehaviour)val3).NetworkObject.Spawn(false);
}
}
}
((MonoBehaviour)this).StartCoroutine(SyncItems());
}
[IteratorStateMachine(typeof(<SyncItems>d__12))]
private IEnumerator SyncItems()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SyncItems>d__12(0)
{
<>4__this = this
};
}
[ClientRpc]
private void SyncBuyableClientRpc(int index, int price, NetworkObjectReference itemRef)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1254916123u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
BytePacker.WriteValueBitPacked(val2, price);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1254916123u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
int index2 = index;
if (index2 < 0 || index2 >= spawnPositions.Length)
{
return;
}
SaleSpot saleSpot = spawnPositions[index2];
NetworkObject val3 = default(NetworkObject);
GrabbableObject val4 = default(GrabbableObject);
if (((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).gameObject.TryGetComponent<GrabbableObject>(ref val4))
{
val4.grabbable = (val4.grabbableToEnemies = false);
saleSpot.price = price;
saleSpot.item = val4;
saleSpot.buyInteract.interactable = true;
saleSpot.buyInteract.hoverTip = $"{val4.itemProperties.itemName} : {price}";
((UnityEvent<PlayerControllerB>)(object)saleSpot.buyInteract.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate(PlayerControllerB player)
{
AttemptPurchaseServerRpc(index2, JLLExtentions.Index(player));
});
}
}
public void AttemptPurchase(int slot)
{
AttemptPurchaseServerRpc(slot);
}
[ServerRpc(RequireOwnership = false)]
private void AttemptPurchaseServerRpc(int slot, int client = -1)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2558224897u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, slot);
BytePacker.WriteValueBitPacked(val2, client);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2558224897u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
if (slot < 0 || slot >= spawnPositions.Length)
{
return;
}
SaleSpot saleSpot = spawnPositions[slot];
if (saleSpot.ready && !((Object)(object)saleSpot.item == (Object)null))
{
if (JLevelPropertyRegistry.GetTerminal().groupCredits >= saleSpot.price)
{
PurchaseClientRpc(slot, saleSpot.price, NetworkObjectReference.op_Implicit(((NetworkBehaviour)saleSpot.item).NetworkObject));
}
else
{
FailPurchaseClientRpc(client);
}
}
}
[ClientRpc]
private void PurchaseClientRpc(int slot, int price, NetworkObjectReference itemRef)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2489186323u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, slot);
BytePacker.WriteValueBitPacked(val2, price);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2489186323u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
Terminal terminal = JLevelPropertyRegistry.GetTerminal();
terminal.groupCredits -= price;
NetworkObject val3 = default(NetworkObject);
GrabbableObject val4 = default(GrabbableObject);
if (((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).gameObject.TryGetComponent<GrabbableObject>(ref val4))
{
val4.grabbable = (val4.grabbableToEnemies = true);
InteractTrigger buyInteract = spawnPositions[slot].buyInteract;
buyInteract.interactable = false;
buyInteract.disabledHoverTip = purchasedString;
}
if ((Object)(object)audioSource != (Object)null && (Object)(object)buyClip != (Object)null)
{
audioSource.PlayOneShot(buyClip);
}
}
}
[ClientRpc]
private void FailPurchaseClientRpc(int clientId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2869992630u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2869992630u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (JLLExtentions.Index(StartOfRound.Instance.localPlayerController) == clientId)
{
JHudHelper.QueueDisplayTip("Error", "Not enough credits to purchase this item.", true, false, "LC_Tip1");
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1254916123u, new RpcReceiveHandler(__rpc_handler_1254916123), "SyncBuyableClientRpc");
((NetworkBehaviour)this).__registerRpc(2558224897u, new RpcReceiveHandler(__rpc_handler_2558224897), "AttemptPurchaseServerRpc");
((NetworkBehaviour)this).__registerRpc(2489186323u, new RpcReceiveHandler(__rpc_handler_2489186323), "PurchaseClientRpc");
((NetworkBehaviour)this).__registerRpc(2869992630u, new RpcReceiveHandler(__rpc_handler_2869992630), "FailPurchaseClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1254916123(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
int price = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref price);
NetworkObjectReference itemRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ItemShop)(object)target).SyncBuyableClientRpc(index, price, itemRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2558224897(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0043: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int slot = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref slot);
int client = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref client);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ItemShop)(object)target).AttemptPurchaseServerRpc(slot, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2489186323(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int slot = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref slot);
int price = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref price);
NetworkObjectReference itemRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ItemShop)(object)target).PurchaseClientRpc(slot, price, itemRef);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2869992630(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int clientId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ItemShop)(object)target).FailPurchaseClientRpc(clientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ItemShop";
}
}
public class LevelCassetteItem : MonoBehaviour
{
[Header("Cassette Loader")]
public bool DestroyAfterUse = false;
public string LoaderName = "Galetry";
public VideoClip Video;
public AudioSource AudioLog;
[Header("Cassette Data")]
public string LevelSceneName = "";
public bool unlockLevel = true;
public UnityEvent OnCollect = new UnityEvent();
public bool GetExtendedLevel(out ExtendedLevel extendedLevel)
{
extendedLevel = ((IEnumerable<ExtendedLevel>)PatchedContent.ExtendedLevels).FirstOrDefault((Func<ExtendedLevel, bool>)((ExtendedLevel x) => x.SelectableLevel.sceneName == LevelSceneName));
if ((Object)(object)extendedLevel == (Object)null)
{
extendedLevel = PatchedContent.ExtendedLevels[0];
return false;
}
return true;
}
}
public class LevelCassetteLoader : NetworkBehaviour
{
[Serializable]
public class TapeFinishedEvent
{
public string clipName;
public InteractEvent FinishedEvent = new InteractEvent();
}
[Header("Cassette Loader")]
public string LoaderName = "Galetry";
public VideoPlayer screenPlayer;
public VideoClip awakeClip;
public AudioSource audioPlayer;
public Animator animator;
public InteractEvent OnTapeLoaded = new InteractEvent();
public float tapeEndOffset = -2f;
public bool isTapePlaying = false;
public float tapeLength = 0f;
private string unlockedLevelName = string.Empty;
private PlayerControllerB lastPlayerUsed;
public InteractEvent OnTapeFinished = new InteractEvent();
public TapeFinishedEvent[] TapeFinishedEvents = new TapeFinishedEvent[0];
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if (Object.op_Implicit((Object)(object)screenPlayer))
{
if ((Object)(object)awakeClip != (Object)null)
{
screenPlayer.clip = awakeClip;
screenPlayer.Play();
}
if (Object.op_Implicit((Object)(object)audioPlayer))
{
screenPlayer.audioOutputMode = (VideoAudioOutputMode)1;
screenPlayer.EnableAudioTrack((ushort)0, true);
screenPlayer.SetTargetAudioSource((ushort)0, audioPlayer);
screenPlayer.controlledAudioTrackCount = 1;
}
}
}
public void StartLoadingCassette(PlayerControllerB player)
{
LoadCassetteServerRpc(JLLExtentions.Index(player));
}
[ServerRpc(RequireOwnership = false)]
private void LoadCassetteServerRpc(int playerWhoSent)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2088416495u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerWhoSent);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2088416495u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
LoadCassetteClientRpc(playerWhoSent);
}
}
}
[ClientRpc]
private void LoadCassetteClientRpc(int playerWhoSent)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1055522164u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerWhoSent);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1055522164u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB val3 = RoundManager.Instance.playersManager.allPlayerScripts[playerWhoSent];
if ((Object)(object)val3.currentlyHeldObjectServer == (Object)null)
{
return;
}
bool flag = false;
LevelCassetteItem[] components = ((Component)val3.currentlyHeldObjectServer).GetComponents<LevelCassetteItem>();
foreach (LevelCassetteItem levelCassetteItem in components)
{
if (levelCassetteItem.LoaderName == LoaderName)
{
lastPlayerUsed = val3;
LoadCassette(levelCassetteItem);
((UnityEvent<PlayerControllerB>)(object)OnTapeLoaded).Invoke(lastPlayerUsed);
if (levelCassetteItem.DestroyAfterUse)
{
flag = true;
}
}
}
if (flag)
{
val3.DestroyItemInSlot(val3.currentItemSlot);
}
}
public void LoadCassette(LevelCassetteItem cassette)
{
TapeEnded();
isTapePlaying = true;
Animator obj = animator;
if (obj != null)
{
obj.SetBool("playing", true);
}
if (Object.op_Implicit((Object)(object)screenPlayer) && (Object)(object)cassette.Video != (Object)null)
{
WesleyScripts.Instance.mls.LogInfo((object)"Attempting to play video.");
screenPlayer.Stop();
screenPlayer.EnableAudioTrack((ushort)0, true);
screenPlayer.SetTargetAudioSource((ushort)0, audioPlayer);
screenPlayer.clip = cassette.Video;
screenPlayer.Play();
tapeLength = (float)cassette.Video.length + tapeEndOffset;
}
AudioSource audioLog = cassette.AudioLog;
if (audioLog != null)
{
audioLog.Play();
}
cassette.OnCollect.Invoke();
if (cassette.GetExtendedLevel(out ExtendedLevel extendedLevel))
{
unlockedLevelName = extendedLevel.SelectableLevel.PlanetName;
WesleyScripts.Instance.mls.LogInfo((object)$"Unlocking {unlockedLevelName} | Tape Length: {tapeLength}");
if (JCompatabilityHelper.IsLoaded((CachedMods)17))
{
LMUHelper.ReleaseLock(extendedLevel.NumberlessPlanetName);
return;
}
extendedLevel.IsRouteLocked = !cassette.unlockLevel;
extendedLevel.IsRouteHidden = !cassette.unlockLevel;
}
}
private void Update()
{
if (isTapePlaying)
{
tapeLength -= Time.deltaTime;
if (tapeLength <= 0f)
{
TapeEnded();
}
}
}
private void TapeEnded()
{
isTapePlaying = false;
Animator obj = animator;
if (obj != null)
{
obj.SetBool("playing", false);
}
tapeLength = 0f;
if (unlockedLevelName != string.Empty)
{
JHudHelper.QueueDisplayTip("Route Discovered!", "Location: " + unlockedLevelName, false, false, "LC_Tip1");
unlockedLevelName = string.Empty;
}
((UnityEvent<PlayerControllerB>)(object)OnTapeFinished).Invoke(lastPlayerUsed);
if ((Object)(object)screenPlayer == (Object)null)
{
return;
}
if ((Object)(object)awakeClip != (Object)null)
{
screenPlayer.Stop();
screenPlayer.clip = awakeClip;
screenPlayer.Play();
}
if (TapeFinishedEvents == null || !((Object)(object)screenPlayer.clip != (Object)null))
{
return;
}
TapeFinishedEvent[] tapeFinishedEvents = TapeFinishedEvents;
foreach (TapeFinishedEvent tapeFinishedEvent in tapeFinishedEvents)
{
if (tapeFinishedEvent.clipName == ((Object)screenPlayer.clip).name)
{
((UnityEvent<PlayerControllerB>)(object)tapeFinishedEvent.FinishedEvent).Invoke(lastPlayerUsed);
break;
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(2088416495u, new RpcReceiveHandler(__rpc_handler_2088416495), "LoadCassetteServerRpc");
((NetworkBehaviour)this).__registerRpc(1055522164u, new RpcReceiveHandler(__rpc_handler_1055522164), "LoadCassetteClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_2088416495(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerWhoSent = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
target.__rpc_exec_stage = (__RpcExecStage)1;
((LevelCassetteLoader)(object)target).LoadCassetteServerRpc(playerWhoSent);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1055522164(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerWhoSent = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
target.__rpc_exec_stage = (__RpcExecStage)1;
((LevelCassetteLoader)(object)target).LoadCassetteClientRpc(playerWhoSent);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "LevelCassetteLoader";
}
}
public class LoneTrap : MonoBehaviour
{
public float range = 12f;
public bool rotate = true;
public float rotSpeed = 1f;
[Header("Target is Close")]
public float closeRange = 4f;
public float closeEventCooldown = 2f;
private float closeTimer = 0f;
public InteractEvent CloseEvent = new InteractEvent();
private PlayerControllerB? target;
public void FixedUpdate()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)target == (Object)null)
{
PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < range && val.isPlayerAlone && !val.isPlayerDead)
{
target = val;
break;
}
}
}
else if (!target.isPlayerAlone || target.isPlayerDead || Vector3.Distance(((Component)target).transform.position, ((Component)this).transform.position) > range)
{
target = null;
closeTimer = 0f;
return;
}
if (!((Object)(object)target != (Object)null))
{
return;
}
if (rotate)
{
Transform transform = ((Component)this).transform;
Quaternion rotation = ((Component)this).transform.rotation;
Vector3 val2 = ((Component)target).transform.position - ((Component)this).transform.position;
Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up);
transform.rotation = Quaternion.Slerp(rotation, Quaternion.Euler(0f, ((Quaternion)(ref val3)).eulerAngles.y, 0f), Time.deltaTime * rotSpeed);
}
if (closeTimer <= 0f)
{
closeTimer = closeRange;
if (Vector3.Distance(((Component)target).transform.position, ((Component)this).transform.position) < closeRange)
{
((UnityEvent<PlayerControllerB>)(object)CloseEvent).Invoke(target);
}
}
else
{
closeTimer -= Time.deltaTime;
}
}
public void OnDrawGizmos()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
if (range > 0f)
{
Gizmos.color = Color.white;
Gizmos.DrawWireSphere(((Component)this).transform.position, range);
}
if (closeRange > 0f)
{
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(((Component)this).transform.position, closeRange);
}
}
}
public class MicBombItem : JGrabbableObject
{
[Header("Mic Bomb Item")]
public bool isBombActive = true;
public bool hasExploded = false;
public bool destroyOnExplode = true;
public UnityEvent ExplodeEvent = new UnityEvent();
public float minLoudness = 0.25f;
public float coolOffRate = 1f;
public float maxAgression = 16f;
private float currentAgression = 0f;
[Header("Beep Sounds")]
public float beepRate = 2f;
private float beepTimer = 0f;
public AudioClip[] audioClips = (AudioClip[])(object)new AudioClip[0];
public float minVolume = 0.8f;
public float maxVolume = 1f;
public float minPitch = 0.85f;
public float maxPitch = 1.2f;
public AudioSource audioSource;
public override void Update()
{
((GrabbableObject)this).Update();
if (isBombActive && !hasExploded && currentAgression > 0f)
{
if (currentAgression > maxAgression)
{
TriggerExplosionServerRpc();
}
beepTimer -= Time.deltaTime;
if (beepTimer < 0f)
{
PlayBeepAudio();
beepTimer = beepRate / Mathf.Max(1f, currentAgression);
}
currentAgression -= Time.deltaTime * coolOffRate;
currentAgression = Mathf.Max(0f, currentAgression);
}
}
private void PlayBeepAudio()
{
if ((Object)(object)audioSource != (Object)null && audioClips.Length != 0)
{
audioSource.pitch = Random.Range(minPitch, maxPitch);
audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)], Random.Range(minVolume, maxVolume));
}
}
[ServerRpc(RequireOwnership = false)]
private void TriggerExplosionServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3583080074u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3583080074u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
TriggerExplosionClientRpc();
}
}
}
[ClientRpc]
private void TriggerExplosionClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(521066593u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 521066593u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!hasExploded)
{
hasExploded = true;
ExplodeEvent.Invoke();
if (destroyOnExplode)
{
((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
}
}
}
public override void OnSetInsideShip(bool isInside)
{
((JGrabbableObject)this).OnSetInsideShip(isInside);
if (isInside)
{
isBombActive = false;
}
}
public void IncreaseAgression()
{
currentAgression += 1f;
}
public override void LoadItemSaveData(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
isBombActive = (saveData & 1) != 0;
hasExploded = (saveData & 2) != 0;
}
public override int GetItemDataToSave()
{
((GrabbableObject)this).GetItemDataToSave();
int num = 0;
if (isBombActive)
{
num |= 1;
}
if (hasExploded)
{
num |= 2;
}
return num;
}
protected override void __initializeVariables()
{
((JGrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3583080074u, new RpcReceiveHandler(__rpc_handler_3583080074), "TriggerExplosionServerRpc");
((NetworkBehaviour)this).__registerRpc(521066593u, new RpcReceiveHandler(__rpc_handler_521066593), "TriggerExplosionClientRpc");
((JGrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_3583080074(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((MicBombItem)(object)target).TriggerExplosionServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_521066593(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((MicBombItem)(object)target).TriggerExplosionClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "MicBombItem";
}
}
public class MicBombMicrophone : MonoBehaviour, INoiseListener
{
public MicBombItem micBombItem;
public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
{
noiseLoudness /= 2f;
}
if (!(noiseLoudness < micBombItem.minLoudness))
{
micBombItem.IncreaseAgression();
}
}
}
public class Mortor : NetworkBehaviour
{
public enum MortorRange
{
Surface,
MortorProximity
}
private class Shell
{
public GameObject obj;
public float destroyTimer = 0f;
public float airTime = 0f;
public Vector3 targetPos = Vector3.zero;
public bool inAir { get; private set; } = true;
public Vector3 CalcPos(Vector3 origin, AnimationCurve arc, float progress)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_0031: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.Lerp(origin, targetPos, progress);
return new Vector3(val.x, val.y + arc.Evaluate(progress), val.z);
}
public void Explode(float killRange, float damageRange, int nonLethalDamage, float pushForce, GameObject prefab)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(targetPos + Vector3.up, true, killRange, damageRange, nonLethalDamage, pushForce, prefab, true);
inAir = false;
MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val in componentsInChildren)
{
((Renderer)val).enabled = false;
}
}
}
public AnimationCurve arc;
public float projAirTime = 5f;
[Range(0f, 100f)]
public float targetPlayerChance = 60f;
[Header("Firing")]
public int shellCount = 4;
private int firedShells = 0;
private int playerShell = -1;
private bool isFiring = false;
public float shellSeperation = 0.5f;
private float timeSinceLastShell = 0f;
public float timeBetweenFires = 20f;
private float cooldownTimer = 0f;
[Header("Prefabs")]
public GameObject ProjectilePrefab;
public float destroyAfter = 5f;
public GameObject ExplosionPrefab;
public float killDistance = 8f;
public float damageRange = 18f;
public int nonLethalDMG = 50;
public float pushForce = 60f;
[Header("Targetting Region")]
public bool drawDebug = true;
public MortorRange targetRange = MortorRange.Surface;
public float proximityDistance = 35f;
public bool fireOnLoop = true;
public AnimationCurve fireLoopCooldown;
private float fireCooldown = 0f;
private List<Shell> launchedProjectiles = new List<Shell>();
private bool networkSpawned = false;
[Header("FX")]
public ParticleSystem shootParticle;
public AudioSource nearSource;
public AudioClip nearClip;
public AudioSource farSource;
public AudioClip farClip;
public Vector2 pitchMinMax = new Vector2(1f, 1f);
[HideInInspector]
public bool OnCooldown => cooldownTimer > 0f;
private void OnEnable()
{
cooldownTimer = timeBetweenFires * Random.Range(0.8f, 1.35f);
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
networkSpawned = true;
}
private void Update()
{
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
if (!networkSpawned)
{
return;
}
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
if (OnCooldown)
{
cooldownTimer -= Time.deltaTime;
}
else if (isFiring)
{
timeSinceLastShell += Time.deltaTime;
if (timeSinceLastShell > shellSeperation)
{
FireShellServerRpc();
timeSinceLastShell = 0f;
firedShells++;
}
if (firedShells >= shellCount)
{
isFiring = false;
firedShells = 0;
cooldownTimer = timeBetweenFires;
if (fireOnLoop)
{
fireCooldown = fireLoopCooldown.Evaluate(TimeOfDay.Instance.normalizedTimeOfDay);
}
}
}
else if (fireOnLoop)
{
if (fireCooldown < 0f)
{
FireShellSequence();
}
else
{
fireCooldown -= Time.deltaTime;
}
}
}
foreach (Shell item in new List<Shell>(launchedProjectiles))
{
if (item.inAir)
{
item.airTime += Time.deltaTime;
if (item.airTime > projAirTime)
{
item.Explode(killDistance, damageRange, nonLethalDMG, pushForce, ExplosionPrefab);
continue;
}
item.obj.transform.position = item.CalcPos(((Component)this).transform.position, arc, item.airTime / projAirTime);
item.obj.transform.LookAt(item.CalcPos(((Component)this).transform.position, arc, (item.airTime + 0.01f) / projAirTime));
}
else
{
item.destroyTimer -= Time.deltaTime;
if (item.destroyTimer < 0f)
{
Object.Destroy((Object)(object)item.obj);
launchedProjectiles.Remove(item);
}
}
}
}
public void EnableLooping()
{
ToggleLoopFireServerRpc(enabled: true);
}
public void DisableFire()
{
ToggleLoopFireServerRpc(enabled: false);
}
public void ToggleLoop(bool toggle)
{
ToggleLoopFireServerRpc(toggle);
}
[ServerRpc(RequireOwnership = false)]
private void ToggleLoopFireServerRpc(bool enabled)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2063045087u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2063045087u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
ToggleLoopFireClientRpc(enabled);
}
}
}
[ClientRpc]
private void ToggleLoopFireClientRpc(bool enabled)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2165139199u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2165139199u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
fireOnLoop = enabled;
if (enabled)
{
FireShellSequence();
return;
}
isFiring = false;
cooldownTimer = timeBetweenFires;
}
}
public void FireShellSequence(bool respectCooldown = true)
{
FireShellSequence(targetPlayerChance, respectCooldown);
}
public void FireShellSequence(float playerChance, bool respectCooldown = true)
{
if (!respectCooldown || !OnCooldown)
{
firedShells = 0;
timeSinceLastShell = 0f;
cooldownTimer = 0f;
isFiring = true;
playerShell = ((Random.Range(0f, 100f) < playerChance) ? Random.Range(0, firedShells) : (-1));
}
}
[ServerRpc]
private void FireShellServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0107: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(434675724u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 434675724u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
List<Vector3> list = new List<Vector3>();
if (firedShells == playerShell)
{
MortorRange mortorRange = targetRange;
MortorRange mortorRange2 = mortorRange;
if (mortorRange2 == MortorRange.MortorProximity)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
NavMeshHit val4 = default(NavMeshHit);
foreach (PlayerControllerB val3 in allPlayerScripts)
{
if (!val3.isPlayerDead && Vector3.Distance(((Component)val3).transform.position, ((Component)this).transform.position) < proximityDistance && NavMesh.SamplePosition(((Component)val3).transform.position, ref val4, 15f, 655))
{
list.Add(((NavMeshHit)(ref val4)).position);
}
}
}
else
{
PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
NavMeshHit val6 = default(NavMeshHit);
foreach (PlayerControllerB val5 in allPlayerScripts2)
{
if (!val5.isPlayerDead && !val5.isInsideFactory && !val5.isInElevator && NavMesh.SamplePosition(((Component)val5).transform.position, ref val6, 15f, 655))
{
list.Add(((NavMeshHit)(ref val6)).position);
}
}
}
}
if (list.Count == 0)
{
Vector3 result;
switch (targetRange)
{
case MortorRange.Surface:
{
GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes;
foreach (GameObject val7 in outsideAINodes)
{
if (RandomNavPos(val7.transform.position, proximityDistance, out result))
{
list.Add(result);
}
}
break;
}
case MortorRange.MortorProximity:
if (RandomNavPos(((Component)this).transform.position, proximityDistance, out result))
{
list.Add(result);
}
break;
}
}
if (list.Count > 0)
{
FireShellClientRpc(list[Random.Range(0, list.Count)]);
}
}
[ClientRpc]
private void FireShellClientRpc(Vector3 targetPos)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1721816884u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1721816884u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
FireShellLocal(targetPos);
}
}
}
private void FireShellLocal(Vector3 targetPos)
{
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
float pitch = ((pitchMinMax.x >= pitchMinMax.y) ? pitchMinMax.y : Random.Range(pitchMinMax.x, pitchMinMax.y));
if ((Object)(object)nearSource != (Object)null && (Object)(object)nearClip != (Object)null)
{
nearSource.pitch = pitch;
nearSource.PlayOneShot(nearClip);
}
if ((Object)(object)farSource != (Object)null && (Object)(object)farClip != (Object)null)
{
farSource.pitch = pitch;
farSource.PlayOneShot(farClip);
}
ParticleSystem obj = shootParticle;
if (obj != null)
{
obj.Play();
}
Shell shell = new Shell
{
obj = Object.Instantiate<GameObject>(ProjectilePrefab, ((Component)this).transform.position, Quaternion.identity),
destroyTimer = destroyAfter,
airTime = 0f,
targetPos = targetPos
};
launchedProjectiles.Add(shell);
((Component)this).transform.LookAt(shell.CalcPos(((Component)this).transform.position, arc, 0.01f));
}
public bool RandomNavPos(Vector3 pos, float radius, out Vector3 result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
pos = Random.insideUnitSphere * radius + pos;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(pos, ref val, radius, 655))
{
result = ((NavMeshHit)(ref val)).position;
return true;
}
result = Vector3.zero;
return false;
}
private void OnDrawGizmos()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
if (!drawDebug)
{
return;
}
switch (targetRange)
{
case MortorRange.Surface:
{
GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
foreach (GameObject val in array)
{
if (proximityDistance > 0f)
{
Gizmos.color = Color.black;
Gizmos.DrawWireSphere(val.transform.position, proximityDistance);
}
if (killDistance > 0f)
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(val.transform.position, killDistance);
}
if (damageRange > 0f)
{
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(val.transform.position, damageRange);
}
}
break;
}
case MortorRange.MortorProximity:
if (proximityDistance > 0f)
{
Gizmos.color = Color.black;
Gizmos.DrawWireSphere(((Component)this).transform.position, proximityDistance);
}
if (killDistance > 0f)
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(((Component)this).transform.position, killDistance);
}
if (damageRange > 0f)
{
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(((Component)this).transform.position, damageRange);
}
break;
}
}
public void OnDisable()
{
foreach (Shell launchedProjectile in launchedProjectiles)
{
Object.Destroy((Object)(object)launchedProjectile.obj);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(2063045087u, new RpcReceiveHandler(__rpc_handler_2063045087), "ToggleLoopFireServerRpc");
((NetworkBehaviour)this).__registerRpc(2165139199u, new RpcReceiveHandler(__rpc_handler_2165139199), "ToggleLoopFireClientRpc");
((NetworkBehaviour)this).__registerRpc(434675724u, new RpcReceiveHandler(__rpc_handler_434675724), "FireShellServerRpc");
((NetworkBehaviour)this).__registerRpc(1721816884u, new RpcReceiveHandler(__rpc_handler_1721816884), "FireShellClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_2063045087(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool enabled = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enabled, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((Mortor)(object)target).ToggleLoopFireServerRpc(enabled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2165139199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool enabled = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enabled, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((Mortor)(object)target).ToggleLoopFireClientRpc(enabled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_434675724(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((Mortor)(object)target).FireShellServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1721816884(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 targetPos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos);
target.__rpc_exec_stage = (__RpcExecStage)1;
((Mortor)(object)target).FireShellClientRpc(targetPos);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "Mortor";
}
}
public class MortorSensor : MonoBehaviour
{
public Mortor mortor;
public bool respectCooldown = true;
[Range(0f, 100f)]
public float triggerChance = 20f;
private void OnTriggerEnter(Collider other)
{
PlayerControllerB val = default(PlayerControllerB);
if ((((NetworkBehaviour)mortor).IsHost || ((NetworkBehaviour)mortor).IsServer) && Random.Range(0f, 100f) < triggerChance && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val))
{
mortor.FireShellSequence(100f, respectCooldown);
}
}
}
public class ProggressionObject : MonoBehaviour
{
public bool active = true;
public bool destroy = true;
private void Start()
{
if (WesleyScripts.ProtectionEnabled() != active)
{
if (destroy)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
else
{
((Component)this).gameObject.SetActive(false);
}
}
}
}
public class StoneRaycast : MonoBehaviour
{
public float Range = 5f;
public bool ActiveBeam = true;
public LayerMask mask = LayerMask.op_Implicit(1084754248);
public Material Replacement;
private void FixedUpdate()
{
if (ActiveBeam)
{
KillCast();
}
}
public void KillCast()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
PlayerControllerB val2 = default(PlayerControllerB);
if (!Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.TransformDirection(Vector3.forward), ref val, Range, LayerMask.op_Implicit(mask)) || !((Component)((RaycastHit)(ref val)).collider).gameObject.CompareTag("Player") || !((Component)((RaycastHit)(ref val)).collider).gameObject.TryGetComponent<PlayerControllerB>(ref val2))
{
return;
}
try
{
Transform val3 = Object.Instantiate<Transform>(((Component)val2).transform.Find("ScavengerModel"));
((Component)val3).transform.position = ((Component)val2).transform.position;
((Component)val3).transform.rotation = ((Component)val2).transform.rotation;
LODGroup val4 = default(LODGroup);
if (((Component)val3).TryGetComponent<LODGroup>(ref val4))
{
WesleyScripts.Instance.mls.LogInfo((object)val4.GetLODs()[0].renderers.Count());
}
Transform val5 = val3.Find("metarig");
((Renderer)val2.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
RigBuilder val6 = default(RigBuilder);
if (((Component)val5).TryGetComponent<RigBuilder>(ref val6))
{
Object.Destroy((Object)(object)val6);
}
PlayerAnimationEvents val7 = default(PlayerAnimationEvents);
if (((Component)val5).TryGetComponent<PlayerAnimationEvents>(ref val7))
{
Object.Destroy((Object)(object)val7);
}
PlayAudioAnimationEvent val8 = default(PlayAudioAnimationEvent);
if (((Component)val5).TryGetComponent<PlayAudioAnimationEvent>(ref val8))
{
Object.Destroy((Object)(object)val8);
}
Animator val9 = default(Animator);
if (((Component)val5).TryGetComponent<Animator>(ref val9))
{
Object.Destroy((Object)(object)val9);
}
BoxCollider val10 = ((Component)val3).gameObject.AddComponent<BoxCollider>();
val10.center = new Vector3(0f, 1.2f, 0f);
val10.size = new Vector3(0.75f, 2.3f, 0.4f);
Rigidbody val11 = ((Component)val3).gameObject.AddComponent<Rigidbody>();
val11.drag = 5f;
val11.angularDrag = 12f;
SkinnedMeshRenderer val12 = default(SkinnedMeshRenderer);
for (int i = 0; i < val3.childCount; i++)
{
if (((Component)val3.GetChild(i)).TryGetComponent<SkinnedMeshRenderer>(ref val12))
{
((Renderer)val12).materials = (Material[])(object)new Material[1] { Replacement };
((Renderer)val12).allowOcclusionWhenDynamic = false;
}
}
Object.Destroy((Object)(object)((Component)val5.Find("ScavengerModelArmsOnly")).gameObject);
Object.Destroy((Object)(object)((Component)val5.Find("CameraContainer")).gameObject);
}
catch (Exception arg)
{
WesleyScripts.Instance.mls.LogWarning((object)$"Something went wrong destroying parts of the Player Rig!\n{arg}");
}
val2.KillPlayer(Vector3.zero, false, (CauseOfDeath)5, 0, default(Vector3), false);
}
private void OnDrawGizmosSelected()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_00