using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SawTapes.Behaviours;
using SawTapes.Files;
using SawTapes.Files.Values;
using SawTapes.Managers;
using SawTapes.NetcodePatcher;
using SawTapes.Patches;
using SawTapes.Values;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SawTapes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SawTapes")]
[assembly: AssemblyTitle("SawTapes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 SawTapes
{
internal class ConfigManager
{
public static ConfigEntry<bool> isDebug;
public static ConfigEntry<bool> isSawTheme;
public static ConfigEntry<bool> isSubtitles;
public static ConfigEntry<int> survivalRarity;
public static ConfigEntry<bool> killPlayerWhoCamp;
public static ConfigEntry<int> campDuration;
internal static void Load()
{
isDebug = SawTapes.configFile.Bind<bool>("_Global_", "Enable debugging", false, "Is debugging enabled?");
isSawTheme = SawTapes.configFile.Bind<bool>("_Global_", "Enable Saw theme", true, "Is Saw theme enabled?");
isSubtitles = SawTapes.configFile.Bind<bool>("_Global_", "Enable subtitles", false, "Is subtitles enabled?");
survivalRarity = SawTapes.configFile.Bind<int>("Survival Game", "Rarity", 20, "Probability of the 'Survival Game' mini-game appearing");
killPlayerWhoCamp = SawTapes.configFile.Bind<bool>("Survival Game", "Kill campers", true, "Enable the possibility to kill the player who is camping");
campDuration = SawTapes.configFile.Bind<int>("Survival Game", "Camping duration", 10, "Total camping duration before the player is killed");
}
}
[BepInPlugin("Lega.SawTapes", "Saw Tapes", "1.0.3")]
public class SawTapes : BaseUnityPlugin
{
private const string modGUID = "Lega.SawTapes";
private const string modName = "Saw Tapes";
private const string modVersion = "1.0.3";
private readonly Harmony harmony = new Harmony("Lega.SawTapes");
private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sawtapes"));
internal static ManualLogSource mls;
public static ConfigFile configFile;
public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("SawTapesNetworkManager");
public static List<CustomItem> customItems = new List<CustomItem>();
public static GameObject sawTheme;
public static GameObject sawRecordingSurvival;
public static GameObject spawnParticle;
public static GameObject despawnParticle;
public static List<EnemyAI> allEnemies = new List<EnemyAI>();
public static List<Tile> eligibleTiles = new List<Tile>();
public static List<Room> rooms = new List<Room>();
public static List<Horde> hordes = new List<Horde>();
public void Awake()
{
mls = Logger.CreateLogSource("SawTapes");
configFile = ((BaseUnityPlugin)this).Config;
ConfigManager.Load();
LoadManager();
NetcodePatcher();
LoadItems();
LoadParticles();
LoadAudios();
harmony.PatchAll(typeof(GameNetworkManagerPatch));
harmony.PatchAll(typeof(HUDManagerPatch));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(StartOfRoundPatch));
harmony.PatchAll(typeof(DungeonPatch));
harmony.PatchAll(typeof(TilePatch));
harmony.PatchAll(typeof(DoorLockPatch));
harmony.PatchAll(typeof(RoundManagerPatch));
}
public static void LoadManager()
{
Utilities.FixMixerGroups(managerPrefab);
managerPrefab.AddComponent<SawTapesNetworkManager>();
}
public static void LoadItems()
{
List<CustomItem> list = new List<CustomItem>();
list.Add(new CustomItem(typeof(SurvivalTape), bundle.LoadAsset<Item>("Assets/SawTape/SawTapeItem.asset"), ConfigManager.survivalRarity.Value, null, isTileGame: true));
customItems = list;
foreach (CustomItem customItem in customItems)
{
Component obj = customItem.Item.spawnPrefab.AddComponent(customItem.Type);
PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
((GrabbableObject)val).grabbable = true;
((GrabbableObject)val).grabbableToEnemies = true;
((GrabbableObject)val).itemProperties = customItem.Item;
NetworkPrefabs.RegisterNetworkPrefab(customItem.Item.spawnPrefab);
Utilities.FixMixerGroups(customItem.Item.spawnPrefab);
Items.RegisterItem(customItem.Item);
}
}
private static void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
public static void LoadParticles()
{
spawnParticle = bundle.LoadAsset<GameObject>("Assets/ParticleSystem/SpawnParticle.prefab");
NetworkPrefabs.RegisterNetworkPrefab(spawnParticle);
Utilities.FixMixerGroups(spawnParticle);
despawnParticle = bundle.LoadAsset<GameObject>("Assets/ParticleSystem/DespawnParticle.prefab");
NetworkPrefabs.RegisterNetworkPrefab(despawnParticle);
Utilities.FixMixerGroups(despawnParticle);
}
public static void LoadAudios()
{
sawTheme = bundle.LoadAsset<GameObject>("Assets/Audios/SawTheme.prefab");
NetworkPrefabs.RegisterNetworkPrefab(sawTheme);
Utilities.FixMixerGroups(sawTheme);
sawRecordingSurvival = bundle.LoadAsset<GameObject>("Assets/Audios/SawRecording_Survival.prefab");
NetworkPrefabs.RegisterNetworkPrefab(sawRecordingSurvival);
Utilities.FixMixerGroups(sawRecordingSurvival);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SawTapes";
public const string PLUGIN_NAME = "SawTapes";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace SawTapes.Values
{
public class CustomItem
{
public Type Type { get; internal set; }
public Item Item { get; internal set; }
public int Rarity { get; internal set; }
public string Description { get; internal set; }
public bool IsTileGame { get; internal set; }
public CustomItem(Type type, Item item, int rarity, string description, bool isTileGame)
{
Type = type;
Item = item;
Rarity = rarity;
Description = description;
IsTileGame = isTileGame;
}
}
public class Horde
{
public string HordeName { get; internal set; }
public int GameDuration { get; internal set; }
public Dictionary<int, EnemyAI> EnemiesSpawn { get; internal set; }
public Horde(string hordeName, int gameDuration, Dictionary<int, EnemyAI> enemiesSpawn)
{
HordeName = hordeName;
GameDuration = gameDuration;
EnemiesSpawn = enemiesSpawn;
}
}
public class Room
{
public string RoomName { get; internal set; }
public string DoorName { get; internal set; }
public List<Horde> Hordes { get; internal set; }
public Room(string roomName, string doorName, List<Horde> hordes)
{
RoomName = roomName;
DoorName = doorName;
Hordes = hordes;
}
}
}
namespace SawTapes.Patches
{
internal class DoorLockPatch
{
public static Dictionary<DoorLock, Tile> blockedDoors = new Dictionary<DoorLock, Tile>();
[HarmonyPatch(typeof(DoorLock), "OnTriggerStay")]
[HarmonyPrefix]
private static bool OpenDoorAsEnemy(ref DoorLock __instance)
{
return !IsDoorBlocked(ref __instance);
}
[HarmonyPatch(typeof(DoorLock), "TryDoorHaunt")]
[HarmonyPrefix]
private static bool OpenDoorAsHaunt(ref DoorLock __instance)
{
return !IsDoorBlocked(ref __instance);
}
[HarmonyPatch(typeof(DoorLock), "OpenOrCloseDoor")]
[HarmonyPrefix]
private static bool OpenDoorAsPlayer(ref DoorLock __instance)
{
if (IsDoorBlocked(ref __instance))
{
HUDManager.Instance.DisplayTip("Impossible Action", "You can't open the door until the end of the game!", false, false, "LC_Tip1");
return false;
}
return true;
}
public static bool IsDoorBlocked(ref DoorLock doorLock)
{
if (blockedDoors.ContainsKey(doorLock))
{
return true;
}
return false;
}
}
internal class DungeonPatch
{
public static bool isGenerateTileGame = true;
[HarmonyPatch(typeof(Dungeon), "SpawnDoorPrefab")]
[HarmonyPrefix]
private static void SpawnDoor(ref Doorway a, ref Doorway b)
{
if (isGenerateTileGame)
{
RemoveSpawnEmptyDoor(a);
RemoveSpawnEmptyDoor(b);
}
}
private static void RemoveSpawnEmptyDoor(Doorway doorway)
{
Room room = SawTapes.rooms.FirstOrDefault((Room r) => ((Object)doorway.tile).name.Contains(r.RoomName));
if (room != null && DungeonUtil.HasAnyViableEntries(doorway.ConnectorPrefabWeights) && DungeonUtil.HasAnyViableEntries(doorway.ConnectedDoorway.ConnectorPrefabWeights))
{
doorway.ConnectorPrefabWeights.RemoveAll((GameObjectWeight d) => !((Object)d.GameObject).name.Equals(room.DoorName));
doorway.ConnectedDoorway.ConnectorPrefabWeights.RemoveAll((GameObjectWeight d) => !((Object)d.GameObject).name.Equals(room.DoorName));
if (!SawTapes.eligibleTiles.Contains(doorway.tile))
{
SawTapes.eligibleTiles.Add(doorway.tile);
}
}
}
}
internal class GameNetworkManagerPatch
{
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
private static void StartGameNetworkManager()
{
foreach (EnemyAI item in (from e in Resources.FindObjectsOfTypeAll<EnemyAI>()
where (Object)(object)e.enemyType != (Object)null
select e).Distinct())
{
SawTapes.allEnemies.Add(item);
}
SurvivalGameFile.LoadJSON();
SubtitleFile.LoadJSON();
}
}
internal class GrabbableObjectPatch
{
}
internal class HUDManagerPatch
{
public static TextMeshProUGUI chronoText;
public static TextMeshProUGUI subtitleText;
public static Dictionary<EntranceTeleport, Tile> blockedEntrances = new Dictionary<EntranceTeleport, Tile>();
[HarmonyPatch(typeof(HUDManager), "Start")]
[HarmonyPostfix]
private static void StartHUDManager(ref HUDManager __instance)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(((Component)__instance.weightCounterAnimator).gameObject, ((Component)__instance.weightCounterAnimator).transform.parent);
Transform transform = val.transform;
transform.localPosition += new Vector3(-85f, 185f, 0f);
((Object)val).name = "ChronoUI";
chronoText = val.GetComponentInChildren<TextMeshProUGUI>();
((TMP_Text)chronoText).text = "";
((TMP_Text)chronoText).alignment = (TextAlignmentOptions)1025;
((Object)chronoText).name = "Chrono";
if (ConfigManager.isSubtitles.Value)
{
GameObject val2 = new GameObject("SubtitleUI");
val2.transform.localPosition = new Vector3(0f, -125f, 0f);
val2.AddComponent<RectTransform>();
TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
RectTransform rectTransform = ((TMP_Text)val3).rectTransform;
((Transform)rectTransform).SetParent(GameObject.Find("Systems/UI/Canvas/Panel/GameObject/PlayerScreen").transform, false);
rectTransform.sizeDelta = new Vector2(600f, 200f);
rectTransform.anchoredPosition = new Vector2(0f, -125f);
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((TMP_Text)val3).font = ((TMP_Text)__instance.controlTipLines[0]).font;
((TMP_Text)val3).fontSize = 14f;
subtitleText = val3;
}
}
public static IEnumerator StartChronoCoroutine(int seconds)
{
while (!IsChronoEnded(seconds))
{
seconds--;
yield return (object)new WaitForSeconds(1f);
}
}
private static bool IsChronoEnded(int totalSeconds)
{
int num = (int)Math.Floor((double)totalSeconds / 60.0);
int num2 = (int)Math.Floor((double)totalSeconds % 60.0);
((TMP_Text)chronoText).text = $"{num:D2}:{num2:D2}";
if (GameNetworkManager.Instance.localPlayerController.isPlayerDead || (num == 0 && num2 == 0))
{
((TMP_Text)chronoText).text = "";
return true;
}
return false;
}
[HarmonyPatch(typeof(HUDManager), "ChangeControlTipMultiple")]
[HarmonyPrefix]
private static void SawTapeToolTip(bool holdingItem, ref Item itemProperties)
{
if (holdingItem && (Object)(object)itemProperties != (Object)null && itemProperties.itemName.Equals("Saw Tape"))
{
itemProperties.itemName = "tape";
}
}
[HarmonyPatch(typeof(HUDManager), "HoldInteractionFill")]
[HarmonyPostfix]
private static void HoldInteraction(ref bool __result)
{
if (!__result)
{
return;
}
InteractTrigger hoveringOverTrigger = GameNetworkManager.Instance.localPlayerController.hoveringOverTrigger;
if (!((Object)(object)hoveringOverTrigger == (Object)null))
{
EntranceTeleport entranceTeleport = ((Component)hoveringOverTrigger).GetComponent<EntranceTeleport>();
if ((Object)(object)entranceTeleport != (Object)null && IsEntranceBlocked(ref entranceTeleport))
{
HUDManager.Instance.DisplayTip("Impossible Action", "You can't use the entrance until the end of the game!", false, false, "LC_Tip1");
__result = false;
}
}
}
public static bool IsEntranceBlocked(ref EntranceTeleport entranceTeleport)
{
if (blockedEntrances.ContainsKey(entranceTeleport))
{
return true;
}
return false;
}
}
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
[HarmonyPostfix]
private static void StartPlayerControllerB(ref PlayerControllerB __instance)
{
if (__instance.isPlayerControlled && (Object)(object)((Component)__instance).GetComponent<PlayerSTBehaviour>() == (Object)null)
{
PlayerSTBehaviour playerSTBehaviour = ((Component)__instance).gameObject.AddComponent<PlayerSTBehaviour>();
playerSTBehaviour.playerProperties = __instance;
}
}
}
internal class RoundManagerPatch
{
public static List<Item> tileGameTapes = new List<Item>();
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPostfix]
private static void LoadNewGame(ref RoundManager __instance)
{
SawTapes.eligibleTiles.Clear();
tileGameTapes.Clear();
if (!((NetworkBehaviour)__instance).IsServer)
{
return;
}
foreach (CustomItem item in SawTapes.customItems.Where((CustomItem i) => i.IsTileGame && new Random().Next(1, 100) <= i.Rarity))
{
tileGameTapes.Add(item.Item);
}
SawTapesNetworkManager.Instance.SetGenerateGameTileClientRpc(tileGameTapes.Count() > 0);
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPostfix]
private static void SpawnItems(ref RoundManager __instance)
{
AddNewItems(ref __instance);
}
private static void AddNewItems(ref RoundManager roundManager)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
List<Tile> usedTiles = new List<Tile>();
foreach (Item tileGameTape in tileGameTapes)
{
foreach (Tile tile in SawTapes.eligibleTiles.ToList())
{
List<DoorLock> list = new List<DoorLock>();
bool flag = false;
foreach (Doorway doorway in tile.UsedDoorways)
{
Vector3 position = ((Component)doorway).transform.position;
DoorLock val = (from d in Object.FindObjectsOfType<DoorLock>()
where Vector3.Distance(((Component)d).transform.position, ((Component)doorway).transform.position) < 5f
orderby Vector3.Distance(((Component)d).transform.position, ((Component)doorway).transform.position)
select d).FirstOrDefault();
if ((Object)(object)val == (Object)null)
{
flag = true;
break;
}
list.Add(val);
}
if (flag)
{
SawTapes.eligibleTiles.Remove(tile);
continue;
}
List<RandomScrapSpawn> list2 = Object.FindObjectsOfType<RandomScrapSpawn>().Where(delegate(RandomScrapSpawn s)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (!s.spawnUsed)
{
Bounds bounds2 = tile.Bounds;
return ((Bounds)(ref bounds2)).Contains(((Component)s).transform.position);
}
return false;
}).ToList();
if (list2.Count <= 0)
{
SawTapes.eligibleTiles.Remove(tile);
continue;
}
Random random = new Random();
int index = random.Next(0, list2.Count);
RandomScrapSpawn val2 = list2[index];
if (val2.spawnedItemsCopyPosition)
{
val2.spawnUsed = true;
list2.RemoveAt(index);
}
else
{
((Component)val2).transform.position = roundManager.GetRandomNavMeshPositionInBoxPredictable(((Component)val2).transform.position, val2.itemSpawnRange, roundManager.navHit, roundManager.AnomalyRandom, -1) + Vector3.up * tileGameTape.verticalOffset;
}
Vector3 position2 = ((Component)val2).transform.position + Vector3.up * 0.5f;
SpawnItem(ref tileGameTape.spawnPrefab, ref position2);
Vector3[] doorsPos = list.Select((DoorLock d) => ((Component)d).transform.position).ToArray();
List<NetworkObjectReference> list3 = new List<NetworkObjectReference>();
foreach (EntranceTeleport entranceTeleport in Object.FindObjectsOfType<EntranceTeleport>().Where(delegate(EntranceTeleport e)
{
//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_0014: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = tile.Bounds;
return ((Bounds)(ref bounds)).Contains(((Component)e).transform.position);
}))
{
NetworkObject component = ((Component)entranceTeleport).GetComponent<NetworkObject>();
if (!((Object)(object)component != (Object)null))
{
continue;
}
list3.Add(NetworkObjectReference.op_Implicit(component));
foreach (EntranceTeleport item in from e in Object.FindObjectsOfType<EntranceTeleport>()
where e.isEntranceToBuilding != entranceTeleport.isEntranceToBuilding && e.entranceId == entranceTeleport.entranceId
select e)
{
NetworkObject component2 = ((Component)item).GetComponent<NetworkObject>();
if ((Object)(object)component2 != (Object)null)
{
list3.Add(NetworkObjectReference.op_Implicit(component2));
}
}
}
SawTapesNetworkManager.Instance.AddTileInfosClientRpc(((Component)tile).transform.position, doorsPos, list3.ToArray());
usedTiles.Add(tile);
break;
}
}
SawTapes.eligibleTiles.RemoveAll((Tile t) => !usedTiles.Contains(t));
}
public static void SpawnItem(ref GameObject spawnPrefab, ref Vector3 position)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer || ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost)
{
try
{
GameObject val = Object.Instantiate<GameObject>(spawnPrefab, position, Quaternion.identity, StartOfRound.Instance.propsContainer);
GrabbableObject component = val.GetComponent<GrabbableObject>();
component.fallTime = 0f;
val.GetComponent<NetworkObject>().Spawn(false);
}
catch (Exception arg)
{
SawTapes.mls.LogError((object)$"Error in SpawnItem: {arg}");
}
}
}
}
internal class StartOfRoundPatch
{
[HarmonyPatch(typeof(StartOfRound), "Start")]
[HarmonyBefore(new string[] { "evaisa.lethallib" })]
[HarmonyPostfix]
private static void StartRound(ref StartOfRound __instance)
{
if (NetworkManager.Singleton.IsHost && (Object)(object)SawTapesNetworkManager.Instance == (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(SawTapes.managerPrefab, ((Component)__instance).transform.parent);
val.GetComponent<NetworkObject>().Spawn(false);
SawTapes.mls.LogInfo((object)"Spawning SawTapesNetworkManager");
}
}
[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
[HarmonyPostfix]
public static void OnDisable()
{
SawTapesNetworkManager.Instance = null;
}
[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
[HarmonyPostfix]
private static void PlayerConnection(ref StartOfRound __instance)
{
PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (val.isPlayerControlled && (Object)(object)((Component)val).GetComponent<PlayerSTBehaviour>() == (Object)null)
{
PlayerSTBehaviour playerSTBehaviour = ((Component)val).gameObject.AddComponent<PlayerSTBehaviour>();
playerSTBehaviour.playerProperties = val;
}
}
}
}
internal class TilePatch
{
[HarmonyPatch(typeof(Tile), "OnTriggerEnter")]
[HarmonyPrefix]
private static void EnterTile(ref Tile __instance, Collider other)
{
if (ConfigManager.isDebug.Value)
{
PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null)
{
SawTapes.mls.LogDebug((object)("Enter in the " + ((Object)__instance).name + " tile"));
SawTapes.mls.LogDebug((object)"Names of the different possible connections for each doorway:");
foreach (Doorway usedDoorway in __instance.UsedDoorways)
{
SawTapes.mls.LogDebug((object)"---");
foreach (GameObjectWeight connectorPrefabWeight in usedDoorway.ConnectedDoorway.ConnectorPrefabWeights)
{
SawTapes.mls.LogDebug((object)("- " + ((Object)connectorPrefabWeight.GameObject).name));
}
}
}
}
if (!SawTapes.eligibleTiles.Contains(__instance))
{
return;
}
PlayerSTBehaviour componentInChildren = ((Component)other).GetComponentInChildren<PlayerSTBehaviour>();
if (!((Object)(object)componentInChildren != (Object)null))
{
return;
}
TileSTBehaviour component2 = ((Component)__instance).GetComponent<TileSTBehaviour>();
if (!((Object)(object)component2 != (Object)null))
{
return;
}
componentInChildren.isInGame = true;
componentInChildren.tileGame = __instance;
AnimatedObjectTrigger val = default(AnimatedObjectTrigger);
foreach (DoorLock doorLock in component2.doorLocks)
{
if (doorLock.isDoorOpened && ((Component)doorLock).gameObject.TryGetComponent<AnimatedObjectTrigger>(ref val))
{
val.TriggerAnimationNonPlayer(true, true, false);
if (!val.boolValue)
{
doorLock.CloseDoorNonPlayerServerRpc();
}
}
if (!DoorLockPatch.blockedDoors.ContainsKey(doorLock))
{
DoorLockPatch.blockedDoors.Add(doorLock, __instance);
}
}
foreach (EntranceTeleport entranceTeleport in component2.entranceTeleports)
{
if (!HUDManagerPatch.blockedEntrances.ContainsKey(entranceTeleport))
{
HUDManagerPatch.blockedEntrances.Add(entranceTeleport, __instance);
}
}
}
}
}
namespace SawTapes.Managers
{
internal class SawTapesNetworkManager : NetworkBehaviour
{
public static SawTapesNetworkManager Instance;
public void Awake()
{
Instance = this;
}
[ClientRpc]
public void SetGenerateGameTileClientRpc(bool enable)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1706180775u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1706180775u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
DungeonPatch.isGenerateTileGame = enable;
}
}
}
[ClientRpc]
public void AddTileInfosClientRpc(Vector3 tilePos, Vector3[] doorsPos, NetworkObjectReference[] entrancesObj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_0158: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: 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_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2079390549u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref tilePos);
bool flag = doorsPos != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(doorsPos);
}
bool flag2 = entrancesObj != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(entrancesObj, default(ForNetworkSerializable));
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2079390549u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
Vector3 tilePos2 = tilePos;
Tile val3 = ((IEnumerable<Tile>)Object.FindObjectsOfType<Tile>()).FirstOrDefault((Func<Tile, bool>)((Tile t) => ((Component)t).transform.position == tilePos2));
if ((Object)(object)val3 != (Object)null)
{
TileSTBehaviour tileSTBehaviour = ((Component)val3).GetComponent<TileSTBehaviour>() ?? ((Component)val3).gameObject.AddComponent<TileSTBehaviour>();
foreach (Vector3 doorPos in doorsPos)
{
DoorLock val4 = ((IEnumerable<DoorLock>)Object.FindObjectsOfType<DoorLock>()).FirstOrDefault((Func<DoorLock, bool>)((DoorLock t) => ((Component)t).transform.position == doorPos));
if ((Object)(object)val4 != (Object)null)
{
tileSTBehaviour.doorLocks.Add(val4);
}
else
{
SawTapes.mls.LogWarning((object)"DoorLock not found during the creation of the game room");
}
}
NetworkObject val6 = default(NetworkObject);
for (int j = 0; j < entrancesObj.Length; j++)
{
NetworkObjectReference val5 = entrancesObj[j];
if (((NetworkObjectReference)(ref val5)).TryGet(ref val6, (NetworkManager)null))
{
EntranceTeleport component = ((Component)val6).GetComponent<EntranceTeleport>();
if ((Object)(object)component != (Object)null)
{
tileSTBehaviour.entranceTeleports.Add(component);
}
else
{
SawTapes.mls.LogWarning((object)"EntranceTeleport not found during the creation of the game room");
}
}
}
}
else
{
SawTapes.mls.LogWarning((object)"Tile not found during the creation of the game room");
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_SawTapesNetworkManager()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1706180775u, new RpcReceiveHandler(__rpc_handler_1706180775));
NetworkManager.__rpc_func_table.Add(2079390549u, new RpcReceiveHandler(__rpc_handler_2079390549));
}
private static void __rpc_handler_1706180775(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 generateGameTileClientRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref generateGameTileClientRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SawTapesNetworkManager)(object)target).SetGenerateGameTileClientRpc(generateGameTileClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2079390549(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_003c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 tilePos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref tilePos);
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
Vector3[] doorsPos = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref doorsPos);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
NetworkObjectReference[] entrancesObj = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref entrancesObj, default(ForNetworkSerializable));
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((SawTapesNetworkManager)(object)target).AddTileInfosClientRpc(tilePos, doorsPos, entrancesObj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SawTapesNetworkManager";
}
}
}
namespace SawTapes.Files
{
internal class SubtitleFile
{
public static string FilePath = Path.Combine(Paths.ConfigPath, "ST.subtitles.json");
public static List<SubtitleMapping> survivalGameSubtitles;
public static string Get()
{
return "{\n \"survival_game\": [\n {\n \"timestamp\": 0,\n // Hello worker\n \"text\": \"Bonjour travailleur\"\n },\n {\n \"timestamp\": 1.2,\n // Until now\n \"text\": \"Jusqu'à maintenant\"\n },\n {\n \"timestamp\": 2.15,\n // you have shown cowardice in crucial moments\n \"text\": \"vous avez fait preuve de lâcheté dans les moments cruciaux\"\n },\n {\n \"timestamp\": 4.56,\n // abandoning those who relied on you and avoiding your responsibilities\n \"text\": \"abandonnant ceux qui comptaient sur vous et évitant vos responsabilités\"\n },\n {\n \"timestamp\": 9.05,\n // You now find yourself in a sealed room\n \"text\": \"Vous vous trouvez maintenant dans une pièce scellée\"\n },\n {\n \"timestamp\": 11.65,\n // faced with a test of bravery\n \"text\": \"et vous êtes confronté à une épreuve de bravoure\"\n },\n {\n \"timestamp\": 13.84,\n // Terrifying and unpredictable creatures\n \"text\": \"Des créatures terrifiantes et imprévisibles\"\n },\n {\n \"timestamp\": 16.69,\n // have been released here\n \"text\": \"ont été relâchées ici\"\n },\n {\n \"timestamp\": 18.11,\n // If you manage to survive until the end of the allotted time\n \"text\": \"Si vous parvenez à survivre jusqu'à la fin du temps imparti\"\n },\n {\n \"timestamp\": 21.46,\n // you will have overcome your own cowardice and proven\n \"text\": \"vous aurez surmonté votre propre lâcheté et prouvé\"\n },\n {\n \"timestamp\": 24.47,\n // that you are capable of standing firm in critical moments\n \"text\": \"que vous êtes capable de vous affirmer dans les moments critiques\"\n },\n {\n \"timestamp\": 28.6,\n // Let the game begin\n \"text\": \"Que le jeu commence\"\n }\n ]\n}";
}
public static void LoadJSON()
{
if (!File.Exists(Path.Combine(Paths.ConfigPath, FilePath)))
{
File.WriteAllText(Path.Combine(Paths.ConfigPath, FilePath), Get());
}
using (new StreamReader(Path.Combine(Paths.ConfigPath, FilePath)))
{
survivalGameSubtitles = LoadSurvivalGameSubtitles();
}
}
public static List<SubtitleMapping> LoadSurvivalGameSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["survival_game"].ToObject<List<SubtitleMapping>>();
}
}
internal class SurvivalGameFile
{
public static string FilePath = Path.Combine(Paths.ConfigPath, "ST.survival_game.json");
public static string Get()
{
return "{\n \"hordes\": [\n {\n \"horde_name\": \"Horde1\",\n \"game_duration\": 60,\n \"enemies_spawn\": [\n { \"enemy\": \"Crawler\", \"time\": 0 },\n { \"enemy\": \"Bunker Spider\", \"time\": 10 },\n { \"enemy\": \"Bunker Spider\", \"time\": 20 },\n { \"enemy\": \"Crawler\", \"time\": 40 },\n { \"enemy\": \"Bunker Spider\", \"time\": 45 }\n ]\n },\n {\n \"horde_name\": \"Horde2\",\n \"game_duration\": 60,\n \"enemies_spawn\": [\n { \"enemy\": \"Masked\", \"time\": 0 },\n { \"enemy\": \"Nutcracker\", \"time\": 10 },\n { \"enemy\": \"Masked\", \"time\": 20 },\n { \"enemy\": \"Spring\", \"time\": 40 },\n { \"enemy\": \"Nutcracker\", \"time\": 45 }\n ]\n }\n ],\n \"rooms\": [\n {\n \"room_name\": \"4x4BigStairTile\",\n \"door_name\": \"SteelDoorMapSpawn\",\n \"hordes\": [\"Horde1\"]\n },\n {\n \"room_name\": \"4x4ServerRoomTile\",\n \"door_name\": \"SteelDoorMapSpawn\",\n \"hordes\": [\"Horde1\"]\n },\n {\n \"room_name\": \"MediumRoomHallway1B\",\n \"door_name\": \"SteelDoorMapSpawn\",\n \"hordes\": [\"Horde1\"]\n },\n {\n \"room_name\": \"LibraryTile\",\n \"door_name\": \"FancyDoorMapSpawn\",\n \"hordes\": [\"Horde2\"]\n },\n {\n \"room_name\": \"HallwayTileTypeB\",\n \"door_name\": \"FancyDoorMapSpawn\",\n \"hordes\": [\"Horde2\"]\n },\n {\n \"room_name\": \"HallwayTileTypeC\",\n \"door_name\": \"FancyDoorMapSpawn\",\n \"hordes\": [\"Horde2\"]\n }\n ]\n}";
}
public static void LoadJSON()
{
if (!File.Exists(Path.Combine(Paths.ConfigPath, FilePath)))
{
File.WriteAllText(Path.Combine(Paths.ConfigPath, FilePath), Get());
}
using (new StreamReader(Path.Combine(Paths.ConfigPath, FilePath)))
{
List<HordeMapping> list = LoadHordes();
foreach (HordeMapping item in list)
{
Dictionary<int, EnemyAI> dictionary = new Dictionary<int, EnemyAI>();
foreach (EnemySpawnMapping enemySpawnMapping in item.EnemiesSpawn)
{
EnemyAI val = ((IEnumerable<EnemyAI>)SawTapes.allEnemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI e) => e.enemyType.enemyName.Equals(enemySpawnMapping.Enemy)));
if ((Object)(object)val != (Object)null)
{
dictionary.Add(enemySpawnMapping.Time, val);
}
else
{
SawTapes.mls.LogWarning((object)("The enemy " + enemySpawnMapping.Enemy + " could not be found from the ST.survival_game.json file."));
}
}
SawTapes.hordes.Add(new Horde(item.HordeName, item.GameDuration, dictionary));
}
List<RoomMapping> list2 = LoadRooms();
foreach (RoomMapping item2 in list2)
{
List<Horde> list3 = new List<Horde>();
foreach (string hordeName in item2.Hordes)
{
Horde horde = SawTapes.hordes.FirstOrDefault((Horde h) => h.HordeName.Equals(hordeName));
if (horde != null)
{
list3.Add(horde);
}
else
{
SawTapes.mls.LogWarning((object)("The horde " + hordeName + " could not be found from the file configuration."));
}
}
SawTapes.rooms.Add(new Room(item2.RoomName, item2.DoorName, list3));
}
}
}
public static List<HordeMapping> LoadHordes()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["hordes"].ToObject<List<HordeMapping>>();
}
public static List<RoomMapping> LoadRooms()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["rooms"].ToObject<List<RoomMapping>>();
}
}
}
namespace SawTapes.Files.Values
{
internal class EnemySpawnMapping
{
[JsonProperty("enemy")]
public string Enemy { get; internal set; }
[JsonProperty("time")]
public int Time { get; internal set; }
}
internal class HordeMapping
{
[JsonProperty("horde_name")]
public string HordeName { get; internal set; }
[JsonProperty("game_duration")]
public int GameDuration { get; internal set; }
[JsonProperty("enemies_spawn")]
public List<EnemySpawnMapping> EnemiesSpawn { get; internal set; }
}
internal class RoomMapping
{
[JsonProperty("room_name")]
public string RoomName { get; internal set; }
[JsonProperty("door_name")]
public string DoorName { get; internal set; }
[JsonProperty("hordes")]
public List<string> Hordes { get; internal set; }
}
internal class SubtitleMapping
{
public string GameName { get; internal set; }
[JsonProperty("timestamp")]
public float Timestamp { get; internal set; }
[JsonProperty("text")]
public string Text { get; internal set; }
}
}
namespace SawTapes.Behaviours
{
internal class PlayerSTBehaviour : MonoBehaviour
{
public PlayerControllerB playerProperties;
public bool isInGame;
public Tile tileGame;
public int campTime;
}
public class SawTape : PhysicsProp
{
public bool isGameStarted;
public bool isGameEnded;
public AudioSource sawTheme;
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0044: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (ConfigManager.isSawTheme.Value && buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !isGameEnded && !isGameStarted)
{
GameObject val = Object.Instantiate<GameObject>(SawTapes.sawTheme, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, Quaternion.identity);
sawTheme = val.GetComponent<AudioSource>();
sawTheme.Play();
val.transform.SetParent(((Component)((GrabbableObject)this).playerHeldBy).transform);
}
}
[ClientRpc]
public void StartGameClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2002432415u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2002432415u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isGameStarted = true;
}
}
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_SawTape()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2002432415u, new RpcReceiveHandler(__rpc_handler_2002432415));
}
private static void __rpc_handler_2002432415(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)2;
((SawTape)(object)target).StartGameClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SawTape";
}
}
internal class SurvivalTape : SawTape
{
public AudioSource sawRecording;
public ParticleSystem spawnParticle;
public ParticleSystem despawnParticle;
public bool wasCampingLastSecond;
public override void Start()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Start();
GameObject val = Object.Instantiate<GameObject>(SawTapes.sawRecordingSurvival, ((Component)this).transform.position, Quaternion.identity);
sawRecording = val.GetComponent<AudioSource>();
val.transform.SetParent(((Component)this).transform);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
base.ItemActivate(used, buttonDown);
if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !sawRecording.isPlaying)
{
PlaySawTapeServerRpc();
PlayerSTBehaviour component = ((Component)((GrabbableObject)this).playerHeldBy).GetComponent<PlayerSTBehaviour>();
if (!isGameStarted && !isGameEnded && component.isInGame && (Object)(object)component.tileGame != (Object)null)
{
((MonoBehaviour)this).StartCoroutine(SawGameBegin(component));
}
}
}
[ServerRpc(RequireOwnership = false)]
public void PlaySawTapeServerRpc()
{
//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)
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(1249238746u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1249238746u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlaySawTapeClientRpc();
}
}
}
[ClientRpc]
public void PlaySawTapeClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3149529701u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3149529701u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
sawRecording.Play();
if (ConfigManager.isSubtitles.Value)
{
((MonoBehaviour)this).StartCoroutine(ShowSubtitles());
}
}
}
public IEnumerator SawGameBegin(PlayerSTBehaviour playerBehaviour)
{
Room room = SawTapes.rooms.FirstOrDefault((Room r) => ((Object)playerBehaviour.tileGame).name.Contains(r.RoomName));
Horde horde = room.Hordes[new Random().Next(room.Hordes.Count)];
yield return (object)new WaitUntil((Func<bool>)(() => sawRecording.isPlaying));
yield return (object)new WaitWhile((Func<bool>)(() => sawRecording.isPlaying));
if ((Object)(object)sawTheme != (Object)null)
{
AudioSource obj = sawTheme;
obj.volume *= 1.5f;
}
((MonoBehaviour)HUDManager.Instance).StartCoroutine(HUDManagerPatch.StartChronoCoroutine(horde.GameDuration));
StartSawGameServerRpc((int)playerBehaviour.playerProperties.playerClientId, horde.HordeName);
}
public IEnumerator ShowSubtitles()
{
while (sawRecording.isPlaying)
{
string text = (from s in SubtitleFile.survivalGameSubtitles
where s.Timestamp <= sawRecording.time
orderby s.Timestamp descending
select s).FirstOrDefault()?.Text;
if (!string.IsNullOrEmpty(text))
{
if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 25f)
{
((TMP_Text)HUDManagerPatch.subtitleText).text = text;
}
else
{
((TMP_Text)HUDManagerPatch.subtitleText).text = "";
}
}
yield return null;
}
((TMP_Text)HUDManagerPatch.subtitleText).text = "";
}
[ServerRpc(RequireOwnership = false)]
public void StartSawGameServerRpc(int playerId, string hordeName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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(2888657303u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
bool flag = hordeName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(hordeName, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2888657303u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
string hordeName2 = hordeName;
Horde horde = SawTapes.hordes.FirstOrDefault((Horde h) => h.HordeName.Equals(hordeName2));
StartGameClientRpc();
((MonoBehaviour)this).StartCoroutine(StartSawGame(StartOfRound.Instance.allPlayerObjects[playerId].GetComponentInChildren<PlayerSTBehaviour>(), horde));
}
}
public IEnumerator StartSawGame(PlayerSTBehaviour playerBehaviour, Horde horde)
{
List<NetworkObject> spawnedEnemies = new List<NetworkObject>();
for (int timePassed = 0; timePassed < horde.GameDuration; timePassed++)
{
if (playerBehaviour.playerProperties.isPlayerDead)
{
yield break;
}
((MonoBehaviour)this).StartCoroutine(SpawnEnemy(timePassed, playerBehaviour.tileGame, horde, spawnedEnemies));
bool flag = true;
foreach (NetworkObject item in spawnedEnemies.Where((NetworkObject s) => s.IsSpawned))
{
SetEnemyFocusClientRpc((int)playerBehaviour.playerProperties.playerClientId, NetworkObjectReference.op_Implicit(item));
if (ConfigManager.killPlayerWhoCamp.Value && flag)
{
KillPlayerWhoCampClientRpc((int)playerBehaviour.playerProperties.playerClientId, NetworkObjectReference.op_Implicit(item));
flag = false;
}
}
yield return (object)new WaitForSeconds(1f);
}
EndGame(spawnedEnemies, playerBehaviour);
}
public IEnumerator SpawnEnemy(int enemySpawnKey, Tile tile, Horde horde, List<NetworkObject> spawnedEnemies)
{
KeyValuePair<int, EnemyAI> enemySpawn = horde.EnemiesSpawn.FirstOrDefault((KeyValuePair<int, EnemyAI> e) => e.Key == enemySpawnKey);
if ((Object)(object)enemySpawn.Value != (Object)null)
{
Vector3 spawnPosition = GetRandomNavMeshPositionInTile(ref tile);
PlaySpawnParticleClientRpc(spawnPosition, isSpawn: true);
yield return (object)new WaitUntil((Func<bool>)(() => !spawnParticle.isPlaying));
Object.Destroy((Object)(object)((Component)spawnParticle).gameObject);
GameObject val = Object.Instantiate<GameObject>(enemySpawn.Value.enemyType.enemyPrefab, spawnPosition, Quaternion.identity);
NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>();
componentInChildren.Spawn(true);
spawnedEnemies.Add(componentInChildren);
}
}
public Vector3 GetRandomNavMeshPositionInTile(ref Tile tile)
{
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0041: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0088: 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_00a8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
float num = 2f;
Bounds bounds = tile.Bounds;
float num2 = ((Bounds)(ref bounds)).min.x + num;
bounds = tile.Bounds;
float num3 = Random.Range(num2, ((Bounds)(ref bounds)).max.x - num);
bounds = tile.Bounds;
float y = ((Bounds)(ref bounds)).min.y;
bounds = tile.Bounds;
float num4 = Random.Range(y, ((Bounds)(ref bounds)).max.y);
bounds = tile.Bounds;
float num5 = ((Bounds)(ref bounds)).min.z + num;
bounds = tile.Bounds;
float num6 = Random.Range(num5, ((Bounds)(ref bounds)).max.z - num);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num3, num4, num6);
Vector3 val2 = val;
bounds = tile.Bounds;
float x = ((Bounds)(ref bounds)).size.x;
bounds = tile.Bounds;
NavMeshHit val3 = default(NavMeshHit);
if (NavMesh.SamplePosition(val2, ref val3, Mathf.Max(x, ((Bounds)(ref bounds)).size.z), 1))
{
return ((NavMeshHit)(ref val3)).position;
}
return val;
}
[ClientRpc]
public void SetEnemyFocusClientRpc(int playerId, NetworkObjectReference enemyObject)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1804947778u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1804947778u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
PlayerControllerB movingTowardsTargetPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
NetworkObject val3 = default(NetworkObject);
if (((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null) && val3.IsSpawned)
{
EnemyAI componentInChildren = ((Component)val3).GetComponentInChildren<EnemyAI>();
if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.thisNetworkObject != (Object)null)
{
componentInChildren.SetMovingTowardsTargetPlayer(movingTowardsTargetPlayer);
}
}
}
[ClientRpc]
public void KillPlayerWhoCampClientRpc(int playerId, NetworkObjectReference enemyObject)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1672754600u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1672754600u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
PlayerSTBehaviour componentInChildren = StartOfRound.Instance.allPlayerObjects[playerId].GetComponentInChildren<PlayerSTBehaviour>();
NetworkObject val3 = default(NetworkObject);
if (!((Object)(object)componentInChildren.playerProperties == (Object)(object)GameNetworkManager.Instance.localPlayerController) || !((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null) || !val3.IsSpawned)
{
return;
}
EnemyAI componentInChildren2 = ((Component)val3).GetComponentInChildren<EnemyAI>();
if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren2.thisNetworkObject != (Object)null && !componentInChildren2.agent.CalculatePath(((Component)componentInChildren.playerProperties).transform.position, componentInChildren2.path1))
{
if (wasCampingLastSecond)
{
componentInChildren.campTime++;
if (componentInChildren.campTime == ConfigManager.campDuration.Value)
{
componentInChildren.playerProperties.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3));
}
else if (componentInChildren.campTime % 5 == 0)
{
HUDManager.Instance.DisplayTip("Information", "You must move or there will be consequences!", false, false, "LC_Tip1");
}
}
wasCampingLastSecond = true;
}
else
{
wasCampingLastSecond = false;
}
}
public void EndGame(List<NetworkObject> spawnedEnemies, PlayerSTBehaviour playerBehaviour)
{
//IL_0053: 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)
foreach (NetworkObject item in spawnedEnemies.Where((NetworkObject s) => s.IsSpawned))
{
EnemyAI componentInChildren = ((Component)item).GetComponentInChildren<EnemyAI>();
if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.isEnemyDead)
{
PlaySpawnParticleClientRpc(((Component)item).transform.position, isSpawn: false);
NutcrackerEnemyAI val = (NutcrackerEnemyAI)(object)((componentInChildren is NutcrackerEnemyAI) ? componentInChildren : null);
if (val != null)
{
DestroyObjectClientRpc(NetworkObjectReference.op_Implicit(((Component)val.gun).GetComponent<NetworkObject>()));
}
item.Despawn(true);
}
}
UnlockDoorsClientRpc((int)playerBehaviour.playerProperties.playerClientId);
SendEndGameClientRpc((int)playerBehaviour.playerProperties.playerClientId);
}
[ClientRpc]
public void DestroyObjectClientRpc(NetworkObjectReference obj)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(622137394u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 622137394u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
{
GrabbableObject componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.DestroyObjectInHand((PlayerControllerB)null);
}
}
}
[ClientRpc]
public void UnlockDoorsClientRpc(int playerId)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1134549533u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1134549533u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
PlayerSTBehaviour componentInChildren = StartOfRound.Instance.allPlayerObjects[playerId].GetComponentInChildren<PlayerSTBehaviour>();
if (!((Object)(object)componentInChildren != (Object)null))
{
return;
}
AnimatedObjectTrigger val3 = default(AnimatedObjectTrigger);
foreach (DoorLock item in ((Component)componentInChildren.tileGame).GetComponent<TileSTBehaviour>()?.doorLocks)
{
if (!item.isLocked && ((Component)item).gameObject.TryGetComponent<AnimatedObjectTrigger>(ref val3))
{
val3.TriggerAnimationNonPlayer(false, true, false);
item.OpenDoorAsEnemyServerRpc();
}
DoorLockPatch.blockedDoors.Remove(item);
}
foreach (EntranceTeleport item2 in ((Component)componentInChildren.tileGame).GetComponent<TileSTBehaviour>()?.entranceTeleports)
{
HUDManagerPatch.blockedEntrances.Remove(item2);
}
}
[ClientRpc]
public void SendEndGameClientRpc(int playerId)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3808628496u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3808628496u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
PlayerSTBehaviour component = ((Component)val3).GetComponent<PlayerSTBehaviour>();
if (!val3.isPlayerDead)
{
SawTapes.eligibleTiles.Remove(component.tileGame);
isGameEnded = true;
if ((Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
HUDManager.Instance.DisplayTip("Information", "Congratulations, you survived!", false, false, "LC_Tip1");
}
}
isGameStarted = false;
component.campTime = 0;
component.isInGame = false;
component.tileGame = null;
if ((Object)(object)val3 == (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)sawTheme != (Object)null)
{
sawTheme.Stop();
Object.Destroy((Object)(object)sawTheme);
}
}
[ClientRpc]
public void PlaySpawnParticleClientRpc(Vector3 position, bool isSpawn)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3477988290u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isSpawn, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3477988290u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (isSpawn)
{
GameObject val3 = Object.Instantiate<GameObject>(SawTapes.spawnParticle, position, Quaternion.identity);
spawnParticle = val3.GetComponent<ParticleSystem>();
return;
}
GameObject val4 = Object.Instantiate<GameObject>(SawTapes.despawnParticle, position, Quaternion.identity);
despawnParticle = val4.GetComponent<ParticleSystem>();
MainModule main = despawnParticle.main;
float duration = ((MainModule)(ref main)).duration;
main = despawnParticle.main;
MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
Object.Destroy((Object)(object)val4, duration + ((MinMaxCurve)(ref startLifetime)).constantMax);
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_SurvivalTape()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1249238746u, new RpcReceiveHandler(__rpc_handler_1249238746));
NetworkManager.__rpc_func_table.Add(3149529701u, new RpcReceiveHandler(__rpc_handler_3149529701));
NetworkManager.__rpc_func_table.Add(2888657303u, new RpcReceiveHandler(__rpc_handler_2888657303));
NetworkManager.__rpc_func_table.Add(1804947778u, new RpcReceiveHandler(__rpc_handler_1804947778));
NetworkManager.__rpc_func_table.Add(1672754600u, new RpcReceiveHandler(__rpc_handler_1672754600));
NetworkManager.__rpc_func_table.Add(622137394u, new RpcReceiveHandler(__rpc_handler_622137394));
NetworkManager.__rpc_func_table.Add(1134549533u, new RpcReceiveHandler(__rpc_handler_1134549533));
NetworkManager.__rpc_func_table.Add(3808628496u, new RpcReceiveHandler(__rpc_handler_3808628496));
NetworkManager.__rpc_func_table.Add(3477988290u, new RpcReceiveHandler(__rpc_handler_3477988290));
}
private static void __rpc_handler_1249238746(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;
((SurvivalTape)(object)target).PlaySawTapeServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3149529701(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)2;
((SurvivalTape)(object)target).PlaySawTapeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2888657303(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: 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_008c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string hordeName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref hordeName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((SurvivalTape)(object)target).StartSawGameServerRpc(playerId, hordeName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1804947778(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
NetworkObjectReference enemyObject = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).SetEnemyFocusClientRpc(playerId, enemyObject);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1672754600(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
NetworkObjectReference enemyObject = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).KillPlayerWhoCampClientRpc(playerId, enemyObject);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_622137394(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_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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference obj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).DestroyObjectClientRpc(obj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1134549533(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 playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).UnlockDoorsClientRpc(playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3808628496(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 playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).SendEndGameClientRpc(playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3477988290(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_003c: 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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
bool isSpawn = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isSpawn, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((SurvivalTape)(object)target).PlaySpawnParticleClientRpc(position, isSpawn);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SurvivalTape";
}
}
internal class TileSTBehaviour : MonoBehaviour
{
public List<DoorLock> doorLocks = new List<DoorLock>();
public List<EntranceTeleport> entranceTeleports = new List<EntranceTeleport>();
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace SawTapes.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}