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 GameNetcodeStuff;
using HarmonyLib;
using LegaFusionCore;
using LegaFusionCore.Behaviours.Addons;
using LegaFusionCore.Behaviours.Shaders;
using LegaFusionCore.Managers;
using LegaFusionCore.Managers.NetworkManagers;
using LegaFusionCore.Registries;
using LegaFusionCore.Utilities;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SawTapes.Behaviours.Bathroom;
using SawTapes.Behaviours.Enemies;
using SawTapes.Behaviours.Games;
using SawTapes.Behaviours.Games.EscapeGame;
using SawTapes.Behaviours.Games.ExplosiveGame;
using SawTapes.Behaviours.Games.HuntingGame;
using SawTapes.Behaviours.Games.SurvivalGame;
using SawTapes.Behaviours.Items;
using SawTapes.Behaviours.Items.Addons;
using SawTapes.Behaviours.Items.Addons.Scripts;
using SawTapes.Files;
using SawTapes.Files.Values;
using SawTapes.Managers;
using SawTapes.NetcodePatcher;
using SawTapes.Patches;
using SawTapes.Values;
using TMPro;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[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("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[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.Components")]
[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]
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
{
public class Constants
{
public const string IMPOSSIBLE_ACTION = "Impossible Action";
public const string INFORMATION = "Information";
public const string MESSAGE_IMPAC_KEY = "This key is needed by a tested player to survive";
public const string MESSAGE_IMPAC_SAW = "This saw is needed by the tested players to survive";
public const string MESSAGE_IMPAC_TESTED_PLAYER = "You are not a tested player, the game can't start";
public const string GLOBAL = "_Global_";
public const string HUD = "_HUD_";
public const string SURVIVAL_GAME = "Survival Game";
public const string HUNTING_GAME = "Hunting Game";
public const string ESCAPE_GAME = "Escape Game";
public const string EXPLOSIVE_GAME = "Explosive Game";
public const string JIGSAW_JUDGEMENT = "Jigsaw Judgement";
public const string HUNTER_MARK = "Hunter Mark";
public const string SHOVEL = "Shovel";
public const string REVERSE_BEAR_TRAP = "Reverse Bear Trap";
public const string SAW = "Saw";
public const string SAW_TAPE = "Saw Tape";
public const string JIGSAW_JUDGEMENT_NAME = "Jigsaw's Judgement";
public const string BLEEDING_CHAINS = "Bleeding Chains";
public const string FINAL_DETONATION = "Final Detonation";
public const string HUNTER_MARK_NAME = "Hunter's Mark";
public const string SPRINT_BURST = "Sprint Burst";
}
[BepInPlugin("Lega.SawTapes", "Saw Tapes", "3.0.2")]
public class SawTapes : BaseUnityPlugin
{
internal const string modGUID = "Lega.SawTapes";
internal const string modName = "Saw Tapes";
internal const string modVersion = "3.0.2";
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 SawTape sawTape;
public static Bathroom bathroom;
public static HashSet<EnemyType> allEnemies = new HashSet<EnemyType>();
public static List<SawTapeValue> sawTapeValues = new List<SawTapeValue>();
public static Item billyPuppet;
public static Item billyPuppetJJ;
public static Item billyHead;
public static Item billyBody;
public static Item sawEscape;
public static Item sawBombExplosive;
public static Item billyPuppetFD;
public static Item rBTrapHunting;
public static Item sawKeyHunting;
public static Item billyPuppetHunting;
public static Item billyPuppetHM;
public static Item billyPuppetSurvival;
public static Item billyPuppetSB;
public static Item sawKeyBathroom;
public static Item sawBathroom;
public static Item sawBC;
public static EnemyType billyAnnouncementEnemy;
public static EnemyType billyBathroomEnemy;
public static EnemyType billyFDEnemy;
public static EnemyType billyHMEnemy;
public static GameObject puzzleBoardInterface;
public static GameObject puzzleBoardPrefab;
public static GameObject puzzlePiecePrefab;
public static GameObject chainEscapeObj;
public static GameObject sawBoxExplosiveObj;
public static GameObject bathroomObj;
public static GameObject bleedingChainsObj;
public static GameObject redExplosionParticle;
public static GameObject bleedingChainsAudio;
public void Awake()
{
mls = Logger.CreateLogSource("SawTapes");
configFile = ((BaseUnityPlugin)this).Config;
ConfigManager.Load();
LoadManager();
NetcodePatcher();
LoadItems();
LoadEnemies();
LoadPrefabs();
harmony.PatchAll(typeof(HUDManagerPatch));
harmony.PatchAll(typeof(StartOfRoundPatch));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(RoundManagerPatch));
harmony.PatchAll(typeof(ShovelPatch));
harmony.PatchAll(typeof(EnemyAIPatch));
}
public static void LoadManager()
{
Utilities.FixMixerGroups(managerPrefab);
managerPrefab.AddComponent<SawTapesNetworkManager>();
}
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 void LoadItems()
{
List<SawTapeValue> list = new List<SawTapeValue>(4);
list.Add(new SawTapeValue(typeof(SurvivalTape), bundle.LoadAsset<Item>("Assets/SawTape/SurvivalTapeItem.asset"), ConfigManager.SurvivalRarity, ConfigManager.survivalMinPlayers.Value, ConfigManager.survivalMaxPlayers.Value, ConfigManager.survivalInteriorExclusions.Value));
list.Add(new SawTapeValue(typeof(HuntingTape), bundle.LoadAsset<Item>("Assets/SawTape/HuntingTapeItem.asset"), ConfigManager.HuntingRarity, ConfigManager.huntingMinPlayers.Value, ConfigManager.huntingMaxPlayers.Value, ConfigManager.huntingInteriorExclusions.Value));
list.Add(new SawTapeValue(typeof(EscapeTape), bundle.LoadAsset<Item>("Assets/SawTape/EscapeTapeItem.asset"), ConfigManager.EscapeRarity, ConfigManager.escapeMinPlayers.Value, ConfigManager.escapeMaxPlayers.Value, ConfigManager.escapeInteriorExclusions.Value));
list.Add(new SawTapeValue(typeof(ExplosiveTape), bundle.LoadAsset<Item>("Assets/SawTape/ExplosiveTapeItem.asset"), ConfigManager.ExplosiveRarity, ConfigManager.explosiveMinPlayers.Value, ConfigManager.explosiveMaxPlayers.Value, ConfigManager.explosiveInteriorExclusions.Value));
sawTapeValues = list;
foreach (SawTapeValue sawTapeValue in sawTapeValues)
{
RegisterItem(sawTapeValue.Type, sawTapeValue.Item);
}
billyPuppet = RegisterItem(typeof(BillyPuppet), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetItem.asset"));
billyPuppetJJ = RegisterItem(typeof(BillyPuppetJJ), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetJJItem.asset"));
billyHead = RegisterItem(typeof(BillyHead), bundle.LoadAsset<Item>("Assets/Billy/Head/BillyHeadItem.asset"));
billyBody = RegisterItem(typeof(BillyBody), bundle.LoadAsset<Item>("Assets/Billy/Body/BillyBodyItem.asset"));
sawEscape = RegisterItem(typeof(SawEscape), bundle.LoadAsset<Item>("Assets/Saw/SawEscapeItem.asset"));
sawBombExplosive = RegisterItem(typeof(SawBombExplosive), bundle.LoadAsset<Item>("Assets/SawBomb/SawBombExplosiveItem.asset"));
billyPuppetFD = RegisterItem(typeof(BillyPuppetFD), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetFDItem.asset"));
rBTrapHunting = RegisterItem(typeof(RBTrapHunting), bundle.LoadAsset<Item>("Assets/ReverseBearTrap/RBTrapHuntingItem.asset"));
sawKeyHunting = RegisterItem(typeof(SawKeyHunting), bundle.LoadAsset<Item>("Assets/SawKey/SawKeyHuntingItem.asset"));
billyPuppetHunting = RegisterItem(typeof(BillyPuppetHunting), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetHuntingItem.asset"));
billyPuppetHM = RegisterItem(typeof(BillyPuppetHM), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetHMItem.asset"));
billyPuppetSurvival = RegisterItem(typeof(BillyPuppetSurvival), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetSurvivalItem.asset"));
billyPuppetSB = RegisterItem(typeof(BillyPuppetSB), bundle.LoadAsset<Item>("Assets/Billy/Puppet/BillyPuppetSBItem.asset"));
sawKeyBathroom = RegisterItem(typeof(SawKeyBathroom), bundle.LoadAsset<Item>("Assets/SawKey/SawKeyBathroomItem.asset"));
sawBathroom = RegisterItem(typeof(SawBathroom), bundle.LoadAsset<Item>("Assets/Saw/SawBathroomItem.asset"));
sawBC = RegisterItem(typeof(SawBC), bundle.LoadAsset<Item>("Assets/Saw/SawBC.asset"));
}
public Item RegisterItem(Type type, Item item)
{
if ((Object)(object)item.spawnPrefab.GetComponent(type) == (Object)null)
{
Component obj = item.spawnPrefab.AddComponent(type);
PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
((GrabbableObject)val).grabbable = true;
((GrabbableObject)val).grabbableToEnemies = true;
((GrabbableObject)val).itemProperties = item;
}
NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
Utilities.FixMixerGroups(item.spawnPrefab);
Items.RegisterItem(item);
return item;
}
public void LoadEnemies()
{
List<EnemyType> list = new List<EnemyType>(4)
{
billyAnnouncementEnemy = bundle.LoadAsset<EnemyType>("Assets/Billy/Enemy/BillyAnnouncementEnemy.asset"),
billyBathroomEnemy = bundle.LoadAsset<EnemyType>("Assets/Billy/Enemy/BillyBathroomEnemy.asset"),
billyFDEnemy = bundle.LoadAsset<EnemyType>("Assets/Billy/Enemy/BillyFDEnemy.asset"),
billyHMEnemy = bundle.LoadAsset<EnemyType>("Assets/Billy/Enemy/BillyHMEnemy.asset")
};
list.ForEach(delegate(EnemyType e)
{
NetworkPrefabs.RegisterNetworkPrefab(e.enemyPrefab);
});
}
public static void LoadPrefabs()
{
puzzleBoardPrefab = bundle.LoadAsset<GameObject>("Assets/SlidingPuzzle/PuzzleBoard.prefab");
puzzlePiecePrefab = bundle.LoadAsset<GameObject>("Assets/SlidingPuzzle/PuzzlePiece.prefab");
List<GameObject> list = new List<GameObject>(6)
{
sawBoxExplosiveObj = bundle.LoadAsset<GameObject>("Assets/SawBox/SawBoxExplosive.prefab"),
chainEscapeObj = bundle.LoadAsset<GameObject>("Assets/Chain/ChainEscape.prefab"),
bathroomObj = bundle.LoadAsset<GameObject>("Assets/Addons/JigsawJudgement/Bathroom.prefab"),
bleedingChainsObj = bundle.LoadAsset<GameObject>("Assets/Addons/BleedingChains/BleedingChains.prefab"),
redExplosionParticle = bundle.LoadAsset<GameObject>("Assets/Particles/RedExplosionParticle.prefab"),
bleedingChainsAudio = bundle.LoadAsset<GameObject>("Assets/Audios/Prefabs/BleedingChainsAudio.prefab")
};
list.ForEach(delegate(GameObject o)
{
NetworkPrefabs.RegisterNetworkPrefab(o);
Utilities.FixMixerGroups(o);
});
}
}
public class STUtilities
{
public static bool IsEligiblePlayer(PlayerControllerB player)
{
if (player.isPlayerControlled && !player.isPlayerDead && ((Object)(object)SawTapes.bathroom == (Object)null || ((Object)(object)SawTapes.bathroom != (Object)null && (Object)(object)SawTapes.bathroom.player != (Object)(object)player)))
{
if (!string.IsNullOrEmpty(ConfigManager.excludedPlayers.Value))
{
return !ConfigManager.excludedPlayers.Value.Contains(player.playerUsername);
}
return true;
}
return false;
}
public static Transform FindMainEntrancePoint()
{
return ((IEnumerable<EntranceTeleport>)LFCSpawnRegistry.GetAllAs<EntranceTeleport>()).FirstOrDefault((Func<EntranceTeleport, bool>)((EntranceTeleport e) => e.entranceId == 0 && !e.isEntranceToBuilding))?.entrancePoint;
}
public static Vector3[] GetFurthestPositions(Vector3 position, int? amount = null)
{
//IL_0007: 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)
IOrderedEnumerable<Vector3> source = from n in RoundManager.Instance.insideAINodes
select n.transform.position into p
orderby Vector3.Distance(position, p) descending
select p;
if (!amount.HasValue)
{
return source.ToArray();
}
return source.Take(amount.Value).ToArray();
}
public static Vector3? GetFurthestValidPosition(Vector3 position, NavMeshAgent agent, GameObject[] nodes)
{
//IL_0020: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
Vector3? result = null;
float num = -1f;
foreach (GameObject val in nodes)
{
Vector3 position2 = val.transform.position;
NavMeshPath val2 = new NavMeshPath();
if (agent.CalculatePath(position2, val2) && !(Vector3.Distance(val2.corners[val2.corners.Length - 1], position2) > 1.55f))
{
float num2 = Vector3.Distance(position, position2);
if (num2 > num)
{
num = num2;
result = position2;
}
}
}
return result;
}
public static Vector3? GetClosestPositionScrapSpawn(Vector3 position, float minDistance, Item itemToSpawn)
{
//IL_0007: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_00b8: 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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
RandomScrapSpawn val = (from s in Object.FindObjectsOfType<RandomScrapSpawn>()
where Vector3.Distance(position, ((Component)s).transform.position) >= minDistance
orderby Vector3.Distance(position, ((Component)s).transform.position)
select s).FirstOrDefault();
if (!val.spawnedItemsCopyPosition)
{
((Component)val).transform.position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)val).transform.position, val.itemSpawnRange, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1, 1f) + Vector3.up * itemToSpawn.verticalOffset;
}
return ((Component)val).transform.position + Vector3.up * 0.5f;
}
public static Vector3 GetFurthestPositionScrapSpawn(Vector3 position, Item itemToSpawn)
{
//IL_0007: 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_0094: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
RandomScrapSpawn val = (from s in Object.FindObjectsOfType<RandomScrapSpawn>()
where !s.spawnUsed
orderby Vector3.Distance(position, ((Component)s).transform.position) descending
select s).FirstOrDefault();
if ((Object)(object)val == (Object)null)
{
val = (from p in Object.FindObjectsOfType<RandomScrapSpawn>()
orderby Vector3.Distance(position, ((Component)p).transform.position) descending
select p).FirstOrDefault();
}
if (val.spawnedItemsCopyPosition)
{
val.spawnUsed = true;
}
else
{
((Component)val).transform.position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)val).transform.position, val.itemSpawnRange, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1, 1f) + Vector3.up * itemToSpawn.verticalOffset;
}
return ((Component)val).transform.position + Vector3.up * 0.5f;
}
public static void ShowAuraAimedEnemy(PlayerControllerB player, string tag, float distance, ref EnemyAI aimedEnemy)
{
//IL_000b: 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_009c: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward), ref val, distance, 524288, (QueryTriggerInteraction)2))
{
EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<EnemyAICollisionDetect>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.mainScript == (Object)null))
{
if ((Object)(object)aimedEnemy != (Object)null && (Object)(object)aimedEnemy != (Object)(object)component.mainScript)
{
RemoveAuraFromEnemy(tag, ref aimedEnemy);
}
aimedEnemy = component.mainScript;
CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)component.mainScript).gameObject }, LegaFusionCore.transparentShader, tag, Color.red);
}
}
else
{
RemoveAuraFromEnemy(tag, ref aimedEnemy);
}
}
public static void RemoveAuraFromEnemy(string tag, ref EnemyAI aimedEnemy)
{
if (!((Object)(object)aimedEnemy == (Object)null))
{
CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { ((Component)aimedEnemy).gameObject }, tag);
aimedEnemy = null;
}
}
public static void ShowAuraAimedPlayer(PlayerControllerB player, string tag, float distance, ref PlayerControllerB aimedPlayer)
{
//IL_000b: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] array = Physics.RaycastAll(new Ray(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward), distance);
Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance));
RaycastHit[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
PlayerControllerB component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<PlayerControllerB>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component == (Object)(object)player))
{
if ((Object)(object)aimedPlayer != (Object)null && (Object)(object)aimedPlayer != (Object)(object)component)
{
RemoveAuraFromPlayer(tag, ref aimedPlayer);
}
aimedPlayer = component;
CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)component).gameObject }, LegaFusionCore.transparentShader, tag, Color.yellow);
return;
}
}
RemoveAuraFromPlayer(tag, ref aimedPlayer);
}
public static void RemoveAuraFromPlayer(string tag, ref PlayerControllerB aimedPlayer)
{
if (!((Object)(object)aimedPlayer == (Object)null))
{
CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { ((Component)aimedPlayer).gameObject }, tag);
aimedPlayer = null;
}
}
}
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 EscapeHazard
{
public string HazardName { get; internal set; }
public bool SpawnFacingAwayFromWall { get; internal set; }
public bool SpawnFacingWall { get; internal set; }
public bool SpawnWithBackToWall { get; internal set; }
public bool SpawnWithBackFlushAgainstWall { get; internal set; }
public EscapeHazard(string hazardName, bool spawnFacingAwayFromWall, bool spawnFacingWall, bool spawnWithBackToWall, bool spawnWithBackFlushAgainstWall)
{
HazardName = hazardName;
SpawnFacingAwayFromWall = spawnFacingAwayFromWall;
SpawnFacingWall = spawnFacingWall;
SpawnWithBackToWall = spawnWithBackToWall;
SpawnWithBackFlushAgainstWall = spawnWithBackFlushAgainstWall;
base..ctor();
}
}
public class SawTapeValue
{
public Type Type { get; internal set; }
public Item Item { get; internal set; }
public int DefaultRarity { get; internal set; }
public int Rarity { get; internal set; }
public int MinPlayers { get; internal set; }
public int MaxPlayers { get; internal set; }
public string InteriorsExclusion { get; internal set; }
public SawTapeValue(Type type, Item item, int rarity, int minPlayers, int maxPlayers, string interiorsExclusion)
{
Type = type;
Item = item;
DefaultRarity = rarity;
Rarity = rarity;
MinPlayers = minPlayers;
MaxPlayers = maxPlayers;
InteriorsExclusion = interiorsExclusion;
base..ctor();
}
}
}
namespace SawTapes.Patches
{
internal class EnemyAIPatch
{
[HarmonyPatch(typeof(EnemyAI), "KillEnemy")]
[HarmonyPostfix]
private static void KillEnemy(ref EnemyAI __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (LFCUtilities.IsServer && !((Object)(object)SawTapes.sawTape == (Object)null) && SawTapes.sawTape is HuntingTape huntingTape && huntingTape.spawnedEnemies.Contains(__instance.thisNetworkObject))
{
LFCObjectsManager.SpawnObjectForServer(SawTapes.sawKeyHunting.spawnPrefab, ((Component)__instance).transform.position);
}
}
[HarmonyPatch(typeof(EnemyAI), "PlayerIsTargetable")]
[HarmonyPrefix]
private static bool IsPlayerTargetable(ref bool __result)
{
if (PlayerControllerBPatch.isTargetable)
{
return true;
}
__result = false;
return false;
}
}
internal class HUDManagerPatch
{
public static TextMeshProUGUI chronoText;
public static TextMeshProUGUI subtitleText;
public static bool isPlayingGame;
public static bool isChronoEnded;
public static int remainedTime;
public static bool isFlashFilterUsed;
[HarmonyPatch(typeof(HUDManager), "Start")]
[HarmonyPostfix]
private static void StartHUDManager()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00b1: 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)
chronoText = CreateUIElement("ChronoUI", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(ConfigManager.chronoPosX.Value, ConfigManager.chronoPosY.Value), new Vector2(300f, 300f), (TextAlignmentOptions)257);
if (ConfigManager.isSubtitles.Value)
{
subtitleText = CreateUIElement("SubtitleUI", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -125f), new Vector2(600f, 200f), (TextAlignmentOptions)514);
}
}
public static TextMeshProUGUI CreateUIElement(string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 anchoredPosition, Vector2 sizeDelta, TextAlignmentOptions alignment)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_001d: 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_003e: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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)
Transform transform = GameObject.Find("Systems/UI/Canvas/Panel/GameObject/PlayerScreen").transform;
GameObject val = new GameObject(name);
val.transform.localPosition = Vector3.zero;
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(transform, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchoredPosition;
val2.sizeDelta = sizeDelta;
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).alignment = alignment;
((TMP_Text)val3).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font;
((TMP_Text)val3).fontSize = 14f;
return val3;
}
public static IEnumerator StartChronoCoroutine(int seconds)
{
isPlayingGame = true;
remainedTime = seconds;
while (!IsChronoEnded(remainedTime))
{
remainedTime--;
yield return (object)new WaitForSecondsRealtime(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 || isChronoEnded || (num == 0 && num2 == 0))
{
isPlayingGame = false;
isChronoEnded = false;
((TMP_Text)chronoText).text = "";
return true;
}
return false;
}
[HarmonyPatch(typeof(HUDManager), "SetScreenFilters")]
[HarmonyPrefix]
private static bool UpdateScreenFilters()
{
return !isFlashFilterUsed;
}
}
internal class PlayerControllerBPatch
{
public static bool isTargetable = true;
[HarmonyPatch(typeof(PlayerControllerB), "spawnPlayerAnimTimer")]
[HarmonyPostfix]
private static IEnumerator SpawnPlayerAnim(IEnumerator __result)
{
isTargetable = false;
while (__result.MoveNext())
{
yield return __result.Current;
}
isTargetable = true;
}
[HarmonyPatch(typeof(PlayerControllerB), "Discard_performed")]
[HarmonyPrefix]
private static bool PreDiscardPerformed(ref PlayerControllerB __instance)
{
if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject) || (Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
if (__instance.currentlyHeldObjectServer is SawBombExplosive sawBombExplosive)
{
sawBombExplosive.RemoveAuraFromPlayer();
if (!sawBombExplosive.isTransferred && !sawBombExplosive.hasBeenDestroyed && !((GrabbableObject)sawBombExplosive).deactivated)
{
sawBombExplosive.SpawnExplosionEveryoneRpc();
}
return false;
}
return true;
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
[HarmonyPrefix]
private static bool PreKillPlayer(ref PlayerControllerB __instance)
{
if (StartOfRound.Instance.shipIsLeaving || HUDManagerPatch.isPlayingGame || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || (Object)(object)SawTapes.bathroom != (Object)null)
{
return true;
}
JigsawJudgement addonComponent = LFCUtilities.GetAddonComponent<JigsawJudgement>(__instance);
if ((Object)(object)addonComponent != (Object)null && !((AddonComponent)addonComponent).onCooldown)
{
((AddonComponent)addonComponent).ActivateAddonAbility();
return false;
}
return true;
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerServerRpc")]
[HarmonyPrefix]
private static void KillPlayerForServer(int playerId)
{
if (SawTapes.sawTape?.players != null && SawTapes.sawTape is HuntingTape huntingTape)
{
PlayerControllerB val = ((IEnumerable<PlayerControllerB>)SawTapes.sawTape.players).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => (Object)(object)p == (Object)null || (int)p.playerClientId == playerId));
if ((Object)(object)val != (Object)null && huntingTape.playerRBTs.TryGetValue(val, out var value))
{
LFCObjectsManager.DestroyObjectOfTypeForServer<RBTrapHunting>(value);
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")]
[HarmonyPrefix]
private static void KillPlayerForEveryone(int playerId)
{
if (SawTapes.sawTape?.players != null)
{
SawTapes.sawTape.players.RemoveWhere((PlayerControllerB p) => (Object)(object)p == (Object)null || (int)p.playerClientId == playerId);
if (!((Object)(object)SawTapes.sawTape.sawTheme == (Object)null) && !((Object)(object)((Component)SawTapes.sawTape.sawTheme).transform == (Object)null))
{
((Component)SawTapes.sawTape.sawTheme).transform.SetParent((Transform)null);
}
}
}
}
internal class RoundManagerPatch
{
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
[HarmonyPostfix]
private static void SpawnItems()
{
AddNewItems();
}
public static void AddNewItems()
{
List<RandomScrapSpawn> list = (from s in Object.FindObjectsOfType<RandomScrapSpawn>()
where !s.spawnUsed
select s).ToList();
SpawnTape(list[new Random().Next(0, list.Count)]);
}
public static void SpawnTape(RandomScrapSpawn randomScrapSpawn)
{
//IL_0036: 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_005b: 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_0070: 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_0090: 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_009f: 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)
if ((Object)(object)randomScrapSpawn == (Object)null)
{
return;
}
SawTapeValue sawTapeValue = GetSawTapeValue();
if (sawTapeValue != null)
{
if (randomScrapSpawn.spawnedItemsCopyPosition)
{
randomScrapSpawn.spawnUsed = true;
}
else
{
((Component)randomScrapSpawn).transform.position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)randomScrapSpawn).transform.position, randomScrapSpawn.itemSpawnRange, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1, 1f) + Vector3.up * sawTapeValue.Item.verticalOffset;
}
LFCObjectsManager.SpawnObjectForServer(sawTapeValue.Item.spawnPrefab, ((Component)randomScrapSpawn).transform.position + Vector3.up * 0.5f);
}
}
public static SawTapeValue GetSawTapeValue()
{
SawTapeValue sawTapeValue = null;
LFCUtilities.Shuffle<SawTapeValue>((IList<SawTapeValue>)SawTapes.sawTapeValues);
foreach (SawTapeValue sawTapeValue3 in SawTapes.sawTapeValues)
{
if ((string.IsNullOrEmpty(sawTapeValue3.InteriorsExclusion) || !sawTapeValue3.InteriorsExclusion.Contains(((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name)) && sawTapeValue3.MinPlayers <= StartOfRound.Instance.allPlayerScripts.Count(STUtilities.IsEligiblePlayer) && sawTapeValue == null && new Random().Next(1, 100) <= sawTapeValue3.Rarity)
{
sawTapeValue = sawTapeValue3;
sawTapeValue3.Rarity = sawTapeValue3.DefaultRarity;
break;
}
}
if (sawTapeValue == null)
{
SawTapeValue sawTapeValue2 = SawTapes.sawTapeValues.FirstOrDefault();
sawTapeValue2.Rarity = Mathf.Min(100, sawTapeValue2.Rarity + ConfigManager.rarityIncrement.Value);
}
return sawTapeValue;
}
}
internal class ShovelPatch
{
[HarmonyPatch(typeof(Shovel), "HitShovel")]
[HarmonyPrefix]
private static void HitShovel(ref Shovel __instance)
{
//IL_0039: 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_0053: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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 ((Object)(object)SawTapes.sawTape == (Object)null || !(SawTapes.sawTape is EscapeTape escapeTape))
{
return;
}
PlayerControllerB previousPlayerHeldBy = __instance.previousPlayerHeldBy;
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
return;
}
RaycastHit[] array = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, __instance.shovelMask, (QueryTriggerInteraction)2);
RaycastHit[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
GameObject gameObject = ((Component)((Component)((RaycastHit)(ref val)).collider).transform.root).gameObject;
if (escapeTape.hazards.Contains(gameObject))
{
escapeTape.DespawnHazardServerRpc(NetworkObjectReference.op_Implicit(gameObject.GetComponent<NetworkObject>()));
break;
}
}
}
}
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");
}
AffectEnemiesForSawGames();
SubtitleFile.LoadJSON();
}
public static void AffectEnemiesForSawGames()
{
SawTapes.allEnemies.Clear();
EnemyAI val = default(EnemyAI);
foreach (EnemyType item in Resources.FindObjectsOfTypeAll<EnemyType>().Distinct())
{
if (!((Object)(object)item == (Object)null) && !((Object)(object)item.enemyPrefab == (Object)null) && item.enemyPrefab.TryGetComponent<EnemyAI>(ref val) && (Object)(object)val != (Object)null)
{
SawTapes.allEnemies.Add(item);
}
}
}
[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
[HarmonyPostfix]
public static void EndRound()
{
LFCStatRegistry.RemoveModifier("Speed", "Saw TapesJigsawJudgement");
Object.FindObjectsOfType<SawTape>().ToList().ForEach((Action<SawTape>)LFCObjectsManager.DestroyObjectOfTypeForServer<SawTape>);
SawTapes.sawTape = null;
}
[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
[HarmonyPostfix]
public static void OnDisable()
{
SawTapesNetworkManager.Instance = null;
}
}
}
namespace SawTapes.Managers
{
public class ConfigManager
{
public static ConfigEntry<int> rarityIncrement;
public static ConfigEntry<bool> isSawTheme;
public static ConfigEntry<float> sawThemeVolume;
public static ConfigEntry<float> gassingDistance;
public static ConfigEntry<string> excludedPlayers;
public static ConfigEntry<bool> isSubtitles;
public static ConfigEntry<float> chronoPosX;
public static ConfigEntry<float> chronoPosY;
public static ConfigEntry<int> survivalRarity;
public static ConfigEntry<int> survivalMinPlayers;
public static ConfigEntry<int> survivalMaxPlayers;
public static ConfigEntry<int> survivalDuration;
public static ConfigEntry<int> survivalBillyValue;
public static ConfigEntry<string> survivalEnemies;
public static ConfigEntry<string> survivalInteriorExclusions;
public static ConfigEntry<float> survivalItemDistance;
public static ConfigEntry<int> survivalItemCooldown;
public static ConfigEntry<int> huntingRarity;
public static ConfigEntry<int> huntingMinPlayers;
public static ConfigEntry<int> huntingMaxPlayers;
public static ConfigEntry<int> huntingDuration;
public static ConfigEntry<int> huntingBillyValue;
public static ConfigEntry<string> huntingEnemies;
public static ConfigEntry<string> huntingInteriorExclusions;
public static ConfigEntry<float> huntingItemAuraDuration;
public static ConfigEntry<int> huntingItemCooldown;
public static ConfigEntry<int> escapeRarity;
public static ConfigEntry<int> escapeMinPlayers;
public static ConfigEntry<int> escapeMaxPlayers;
public static ConfigEntry<int> escapeDuration;
public static ConfigEntry<int> escapeBillyValue;
public static ConfigEntry<string> escapeHazards;
public static ConfigEntry<string> escapeInteriorExclusions;
public static ConfigEntry<int> explosiveRarity;
public static ConfigEntry<int> explosiveMinPlayers;
public static ConfigEntry<int> explosiveMaxPlayers;
public static ConfigEntry<int> explosiveDuration;
public static ConfigEntry<int> explosiveBillyValue;
public static ConfigEntry<float> explosiveAura;
public static ConfigEntry<string> explosiveInteriorExclusions;
public static ConfigEntry<float> bathroomPosX;
public static ConfigEntry<float> bathroomPosY;
public static ConfigEntry<int> bathroomDuration;
public static ConfigEntry<int> bathroomCooldown;
public static ConfigEntry<int> bleedingChainsCooldown;
public static ConfigEntry<int> finalDetonationCooldown;
public static ConfigEntry<string> finalDetonationEnemiesExclusions;
public static ConfigEntry<int> hunterMarkCooldown;
public static ConfigEntry<string> hunterMarkEnemiesExclusions;
public static ConfigEntry<int> sprintBurstCooldown;
public static int SurvivalRarity => survivalRarity.Value;
public static int HuntingRarity => huntingRarity.Value;
public static int EscapeRarity => escapeRarity.Value;
public static int ExplosiveRarity => explosiveRarity.Value;
public static void Load()
{
rarityIncrement = SawTapes.configFile.Bind<int>("_Global_", "Rarity increment", 15, "By how much does the chance of a Saw game appearing increase with each round if it hasn't appeared?");
isSawTheme = SawTapes.configFile.Bind<bool>("_Global_", "Enable Saw theme", true, "Is Saw theme enabled?");
sawThemeVolume = SawTapes.configFile.Bind<float>("_Global_", "Saw theme volume", 1f, "Saw theme volume (between 0 and 1)");
gassingDistance = SawTapes.configFile.Bind<float>("_Global_", "Gassing distance", 30f, "Maximum distance between the player and the tape before he is gassed");
excludedPlayers = SawTapes.configFile.Bind<string>("_Global_", "Excluded players", "", "List of players who cannot be selected for mini-games");
isSubtitles = SawTapes.configFile.Bind<bool>("_HUD_", "Enable subtitles", false, "Is subtitles enabled?");
chronoPosX = SawTapes.configFile.Bind<float>("_HUD_", "Chrono pos X", 106f, "X position of chrono on interface.");
chronoPosY = SawTapes.configFile.Bind<float>("_HUD_", "Chrono pos Y", -50f, "Y position of chrono on interface.");
survivalRarity = SawTapes.configFile.Bind<int>("Survival Game", "Rarity", 20, "Default probability of the Survival Game mini-game appearing");
survivalMinPlayers = SawTapes.configFile.Bind<int>("Survival Game", "Min players", 2, "Minimum number of players for Survival Game - Set to -1 to limit it to the number of connected players who can participate");
survivalMaxPlayers = SawTapes.configFile.Bind<int>("Survival Game", "Max players", -1, "Maximum number of players for Survival Game - Set to -1 to limit it to the number of connected players who can participate");
survivalDuration = SawTapes.configFile.Bind<int>("Survival Game", "Duration", 120, "Duration of the Survival Game");
survivalBillyValue = SawTapes.configFile.Bind<int>("Survival Game", "Billy value", 120, "Billy value for the Survival Game");
survivalEnemies = SawTapes.configFile.Bind<string>("Survival Game", "Enemies list", "Blob,Crawler,Bunker Spider,Flowerman,Puffer,Hoarding bug,Spring,Clay Surgeon,Masked,Nutcracker,Butler", "List of creatures that will be selected by the Survival Game.\nYou can add enemies by separating them with a comma.");
survivalInteriorExclusions = SawTapes.configFile.Bind<string>("Survival Game", "Interiors exclusion list", "", "List of interiors in which the Survival Game will not appear.");
survivalItemDistance = SawTapes.configFile.Bind<float>("Survival Game", "Item activation range", 10f, "Maximum distance between player and enemy to activate the item in the Survival Game");
survivalItemCooldown = SawTapes.configFile.Bind<int>("Survival Game", "Item cooldown", 20, "Cooldown for the item in the Survival Game");
huntingRarity = SawTapes.configFile.Bind<int>("Hunting Game", "Rarity", 20, "Default probability of the Hunting Game mini-game appearing");
huntingMinPlayers = SawTapes.configFile.Bind<int>("Hunting Game", "Min players", 2, "Minimum number of players for Hunting Game - Set to -1 to limit it to the number of connected players who can participate");
huntingMaxPlayers = SawTapes.configFile.Bind<int>("Hunting Game", "Max players", -1, "Maximum number of players for Hunting Game - Set to -1 to limit it to the number of connected players who can participate");
huntingDuration = SawTapes.configFile.Bind<int>("Hunting Game", "Duration", 150, "Duration of the Hunting Game");
huntingBillyValue = SawTapes.configFile.Bind<int>("Hunting Game", "Billy value", 90, "Billy value for the Hunting Game");
huntingEnemies = SawTapes.configFile.Bind<string>("Hunting Game", "Enemies list", "Crawler,Bunker Spider,Flowerman,Hoarding bug,Masked,Nutcracker,Butler", "List of creatures that will be selected by the Hunting Game.\nYou can add enemies by separating them with a comma.");
huntingInteriorExclusions = SawTapes.configFile.Bind<string>("Hunting Game", "Interiors exclusion list", "", "List of interiors in which the Hunting Game will not appear.");
huntingItemAuraDuration = SawTapes.configFile.Bind<float>("Hunting Game", "Item aura duration", 5f, "Duration for which the enemy's aura, given by the item, is visible through walls for the Hunting Game");
huntingItemCooldown = SawTapes.configFile.Bind<int>("Hunting Game", "Item cooldown", 20, "Cooldown for the item in the Hunting Game");
escapeRarity = SawTapes.configFile.Bind<int>("Escape Game", "Rarity", 20, "Default probability of the Escape Game mini-game appearing");
escapeMinPlayers = SawTapes.configFile.Bind<int>("Escape Game", "Min players", 2, "Minimum number of players for Escape Game - Set to -1 to limit it to the number of connected players who can participate");
escapeMaxPlayers = SawTapes.configFile.Bind<int>("Escape Game", "Max players", -1, "Maximum number of players for Escape Game - Set to -1 to limit it to the number of connected players who can participate");
escapeDuration = SawTapes.configFile.Bind<int>("Escape Game", "Duration", 150, "Duration of the Escape Game");
escapeBillyValue = SawTapes.configFile.Bind<int>("Escape Game", "Billy value", 90, "Billy value for the Escape Game");
escapeHazards = SawTapes.configFile.Bind<string>("Escape Game", "Hazards list", "Landmine:2:false:false:false:false,SpikeRoofTrapHazard:3:false:true:true:true,TurretContainer:1:true:false:false:false,LaserTurret:2:false:false:false:false,FanTrapAnimated:2:false:false:false:false,FunctionalMicrowave:1:false:false:false:false", "List of spawnable hazards for the Escape Game.\nThe format is 'HazardName:Weight:SpawnFacingAwayFromWall:SpawnFacingWall:SpawnWithBackToWall:SpawnWithBackFlushAgainstWall'.");
escapeInteriorExclusions = SawTapes.configFile.Bind<string>("Escape Game", "Interiors exclusion list", "GrandArmoryFlow,Level3Flow,StorehouseFlow", "List of interiors in which the Escape Game will not appear.");
explosiveRarity = SawTapes.configFile.Bind<int>("Explosive Game", "Rarity", 20, "Default probability of the Explosive Game mini-game appearing");
explosiveMinPlayers = SawTapes.configFile.Bind<int>("Explosive Game", "Min players", 2, "Minimum number of players for Explosive Game - Set to -1 to limit it to the number of connected players who can participate");
explosiveMaxPlayers = SawTapes.configFile.Bind<int>("Explosive Game", "Max players", -1, "Maximum number of players for Explosive Game - Set to -1 to limit it to the number of connected players who can participate");
explosiveDuration = SawTapes.configFile.Bind<int>("Explosive Game", "Duration", 150, "Duration of the Explosive Game");
explosiveBillyValue = SawTapes.configFile.Bind<int>("Explosive Game", "Billy value", 60, "Billy value for the Explosive Game");
explosiveAura = SawTapes.configFile.Bind<float>("Explosive Game", "Aura duration", 30f, "Duration for which the Hoarding bug's aura is visible through walls");
explosiveInteriorExclusions = SawTapes.configFile.Bind<string>("Explosive Game", "Interiors exclusion list", "", "List of interiors in which the Explosive Game will not appear.");
bathroomPosX = SawTapes.configFile.Bind<float>("Jigsaw Judgement", "Position X", -700f, "Position X of the Bathroom");
bathroomPosY = SawTapes.configFile.Bind<float>("Jigsaw Judgement", "Position Y", -200f, "Position Y of the Bathroom");
bathroomDuration = SawTapes.configFile.Bind<int>("Jigsaw Judgement", "Duration", 60, "Duration of the Jigsaw Judgement");
bathroomCooldown = SawTapes.configFile.Bind<int>("Jigsaw Judgement", "Cooldown", 600, "Cooldown duration of the Jigsaw Judgement");
bleedingChainsCooldown = SawTapes.configFile.Bind<int>("Bleeding Chains", "Cooldown", 45, "Cooldown duration of the Bleeding Chains");
finalDetonationCooldown = SawTapes.configFile.Bind<int>("Final Detonation", "Cooldown", 600, "Cooldown duration of the Final Detonation");
finalDetonationEnemiesExclusions = SawTapes.configFile.Bind<string>("Final Detonation", "Enemies exclusion list", "Doctor's Corpse", "List of invulnerable creatures that will not be impacted by the Final Detonation addon.\nYou can add enemies by separating them with a comma.");
hunterMarkCooldown = SawTapes.configFile.Bind<int>("Hunter Mark", "Cooldown", 180, "Cooldown duration of the Hunter Mark");
hunterMarkEnemiesExclusions = SawTapes.configFile.Bind<string>("Hunter Mark", "Enemies exclusion list", "Doctor's Brain,Billy", "List of creatures that will not be impacted by the Hunter Mark addon.\nYou can add enemies by separating them with a comma.");
sprintBurstCooldown = SawTapes.configFile.Bind<int>("Sprint Burst", "Cooldown", 45, "Cooldown duration of the Sprint Burst");
}
}
public class EnemySTManager
{
public static NetworkObject SpawnEnemyForServer(EnemyType enemyType, Vector3 spawnPosition)
{
//IL_0006: 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)
GameObject val = Object.Instantiate<GameObject>(enemyType.enemyPrefab, spawnPosition, Quaternion.identity);
NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>();
componentInChildren.Spawn(true);
return componentInChildren;
}
public static void DespawnEnemiesForServer(List<NetworkObject> spawnedEnemies)
{
foreach (NetworkObject spawnedEnemy in spawnedEnemies)
{
if (!((Object)(object)spawnedEnemy == (Object)null))
{
EnemyAI componentInChildren = ((Component)spawnedEnemy).GetComponentInChildren<EnemyAI>();
if (!((Object)(object)componentInChildren?.thisNetworkObject == (Object)null) && componentInChildren.thisNetworkObject.IsSpawned && !componentInChildren.isEnemyDead)
{
DespawnEnemy(spawnedEnemy);
}
}
}
}
public static void DespawnEnemy(NetworkObject spawnedEnemy)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
EnemyAI val = ((spawnedEnemy != null) ? ((Component)spawnedEnemy).GetComponentInChildren<EnemyAI>() : null);
if (!((Object)(object)val == (Object)null) && !val.isEnemyDead)
{
LFCNetworkManager.Instance.PlayParticleEveryoneRpc("Lega Fusion Core" + ((Object)LegaFusionCore.smokeParticle).name, ((Component)spawnedEnemy).transform.position, Quaternion.Euler(-90f, 0f, 0f));
NutcrackerEnemyAI val2 = (NutcrackerEnemyAI)(object)((val is NutcrackerEnemyAI) ? val : null);
if (val2 != null && (Object)(object)val2.gun != (Object)null)
{
LFCNetworkManager.Instance.DestroyObjectEveryoneRpc(NetworkObjectReference.op_Implicit(((Component)val2.gun).GetComponent<NetworkObject>()));
}
spawnedEnemy.Despawn(true);
}
}
}
public class SawGameSTManager
{
public static GameObject SpawnHazard(GameObject hazardPrefab, Vector3 position, bool spawnFacingAwayFromWall, bool spawnFacingWall, bool spawnWithBackToWall, bool spawnWithBackFlushAgainstWall)
{
//IL_0007: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_005c: 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_006e: 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_007c: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_016d: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
Random random = new Random(StartOfRound.Instance.randomMapSeed + 587);
List<RandomMapObject> source = (from m in Object.FindObjectsOfType<RandomMapObject>()
where Vector3.Distance(position, ((Component)m).transform.position) <= 5f
select m).ToList();
if (source.Any())
{
RandomMapObject val = source.First();
position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)val).transform.position, 2f, default(NavMeshHit), random, -1, 1f);
}
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(position + Vector3.up * 2f, Vector3.down, ref val2, 80f, 268437760, (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref val2)).point;
GameObject val3 = Object.Instantiate<GameObject>(hazardPrefab, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
val3.transform.eulerAngles = (spawnFacingAwayFromWall ? new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheFarthestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f) : (spawnFacingWall ? new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheNearestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f) : new Vector3(val3.transform.eulerAngles.x, (float)random.Next(0, 360), val3.transform.eulerAngles.z)));
RaycastHit val4 = default(RaycastHit);
if (spawnWithBackToWall && Physics.Raycast(val3.transform.position, -val3.transform.forward, ref val4, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
val3.transform.position = ((RaycastHit)(ref val4)).point;
if (spawnWithBackFlushAgainstWall)
{
val3.transform.forward = ((RaycastHit)(ref val4)).normal;
val3.transform.eulerAngles = new Vector3(0f, val3.transform.eulerAngles.y, 0f);
}
}
val3.GetComponent<NetworkObject>().Spawn(true);
return val3;
}
SawTapes.mls.LogWarning((object)"No surface detected to place the trap.");
return null;
}
public static void DespawnHazard(GameObject hazard)
{
//IL_0037: 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)
if (!((Object)(object)hazard == (Object)null) && !((Object)(object)hazard.transform == (Object)null))
{
LFCNetworkManager.Instance.PlayParticleEveryoneRpc("Lega Fusion Core" + ((Object)LegaFusionCore.smokeParticle).name, hazard.transform.position, Quaternion.Euler(-90f, 0f, 0f));
hazard.GetComponent<NetworkObject>().Despawn(true);
}
}
}
public class SawTapesNetworkManager : NetworkBehaviour
{
public static SawTapesNetworkManager Instance;
public void Awake()
{
Instance = this;
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnBathroomServerRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: 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_008e: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00de: 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)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1592624267u, val2, val, (SendTo)2, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val3, playerId);
((NetworkBehaviour)this).__endSendRpc(ref val3, 1592624267u, val2, val, (SendTo)2, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
GameObject val4 = Object.Instantiate<GameObject>(SawTapes.bathroomObj, Vector3.up * ConfigManager.bathroomPosY.Value + Vector3.right * ConfigManager.bathroomPosX.Value, Quaternion.identity);
val4.GetComponent<NetworkObject>().Spawn(false);
SawTapes.bathroom = val4.GetComponent<Bathroom>();
SawTapes.bathroom.InitializeBathroomEveryoneRpc(playerId, NetworkObjectReference.op_Implicit(val4.GetComponent<NetworkObject>()));
}
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnBleedingChainsEveryoneRpc(NetworkObjectReference entityObj, 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: 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_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(643054802u, val2, val, (SendTo)6, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val3, playerId);
((NetworkBehaviour)this).__endSendRpc(ref val3, 643054802u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1)
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref entityObj)).TryGet(ref val4, (NetworkManager)null))
{
GameObject gameObject = ((Component)val4).gameObject;
BoxCollider componentInChildren = gameObject.GetComponentInChildren<BoxCollider>();
Vector3 val5;
if (componentInChildren == null)
{
val5 = gameObject.transform.position;
}
else
{
Bounds bounds = ((Collider)componentInChildren).bounds;
val5 = ((Bounds)(ref bounds)).center;
}
Vector3 val6 = val5;
GameObject val7 = Object.Instantiate<GameObject>(SawTapes.bleedingChainsObj, val6, gameObject.transform.rotation, gameObject.transform);
BCScript component = val7.GetComponent<BCScript>();
component.entity = gameObject;
component.playerWhoHit = playerId;
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnFinalDetonationServerRpc(NetworkObjectReference entityObj, 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: 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_00fd: 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_0117: 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_0120: 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)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: 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)
//IL_0146: 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)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3507942983u, val2, val, (SendTo)2, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val3, playerId);
((NetworkBehaviour)this).__endSendRpc(ref val3, 3507942983u, val2, val, (SendTo)2, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
Vector3 val4 = ((Component)component.gameplayCamera).transform.position + ((Component)component.gameplayCamera).transform.forward;
val4 = RoundManager.Instance.GetNavMeshPosition(val4, default(NavMeshHit), 2f, -1);
NetworkObject val5 = EnemySTManager.SpawnEnemyForServer(SawTapes.billyFDEnemy, val4);
SpawnFinalDetonationEveryoneRpc(NetworkObjectReference.op_Implicit(val5), entityObj, playerId);
}
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnFinalDetonationEveryoneRpc(NetworkObjectReference billyObj, NetworkObjectReference entityObj, 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_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)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3866684181u, val2, val, (SendTo)6, (RpcDelivery)0);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref billyObj, default(ForNetworkSerializable));
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val3, playerId);
((NetworkBehaviour)this).__endSendRpc(ref val3, 3866684181u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1)
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
NetworkObject val5 = default(NetworkObject);
if (((NetworkObjectReference)(ref billyObj)).TryGet(ref val4, (NetworkManager)null) && ((NetworkObjectReference)(ref entityObj)).TryGet(ref val5, (NetworkManager)null))
{
BillyFD billyFD = ((Component)val4).gameObject.GetComponentInChildren<EnemyAI>() as BillyFD;
if ((Object)(object)billyFD != (Object)null && (Object)(object)((Component)val5).gameObject != (Object)null)
{
billyFD.player = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
billyFD.targetedEntity = ((Component)val5).gameObject;
}
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnHunterMarkServerRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: 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_008e: 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_00c0: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_0117: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3671512855u, val2, val, (SendTo)2, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val3, playerId);
((NetworkBehaviour)this).__endSendRpc(ref val3, 3671512855u, val2, val, (SendTo)2, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
Vector3 val4 = ((Component)component.gameplayCamera).transform.position + ((Component)component.gameplayCamera).transform.forward;
val4 = RoundManager.Instance.GetNavMeshPosition(val4, default(NavMeshHit), 2f, -1);
EnemySTManager.SpawnEnemyForServer(SawTapes.billyHMEnemy, val4);
}
}
}
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
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1592624267u, new RpcReceiveHandler(__rpc_handler_1592624267), "SpawnBathroomServerRpc");
((NetworkBehaviour)this).__registerRpc(643054802u, new RpcReceiveHandler(__rpc_handler_643054802), "SpawnBleedingChainsEveryoneRpc");
((NetworkBehaviour)this).__registerRpc(3507942983u, new RpcReceiveHandler(__rpc_handler_3507942983), "SpawnFinalDetonationServerRpc");
((NetworkBehaviour)this).__registerRpc(3866684181u, new RpcReceiveHandler(__rpc_handler_3866684181), "SpawnFinalDetonationEveryoneRpc");
((NetworkBehaviour)this).__registerRpc(3671512855u, new RpcReceiveHandler(__rpc_handler_3671512855), "SpawnHunterMarkServerRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1592624267(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)1;
((SawTapesNetworkManager)(object)target).SpawnBathroomServerRpc(playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_643054802(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_003e: 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)
{
NetworkObjectReference entityObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SawTapesNetworkManager)(object)target).SpawnBleedingChainsEveryoneRpc(entityObj, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3507942983(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_003e: 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)
{
NetworkObjectReference entityObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SawTapesNetworkManager)(object)target).SpawnFinalDetonationServerRpc(entityObj, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3866684181(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_004a: 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_0059: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference billyObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref billyObj, default(ForNetworkSerializable));
NetworkObjectReference entityObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref entityObj, default(ForNetworkSerializable));
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((SawTapesNetworkManager)(object)target).SpawnFinalDetonationEveryoneRpc(billyObj, entityObj, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3671512855(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)1;
((SawTapesNetworkManager)(object)target).SpawnHunterMarkServerRpc(playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SawTapesNetworkManager";
}
}
}
namespace SawTapes.Files
{
public class SubtitleFile
{
public static string FilePath = Path.Combine(Paths.ConfigPath, "ST.subtitles.json");
public static HashSet<SubtitleMapping> survivalGameSubtitles;
public static HashSet<SubtitleMapping> huntingGameSubtitles;
public static HashSet<SubtitleMapping> escapeGameSubtitles;
public static HashSet<SubtitleMapping> explosiveGameSubtitles;
public static HashSet<SubtitleMapping> billyAnnouncementSubtitles;
public static HashSet<SubtitleMapping> billyBathroomSubtitles;
public static string Get()
{
return "{\n \"survival_game\": [\n {\n \"timestamp\": 0,\n // Hello workers\n \"text\": \"Bonjour travailleurs\"\n },\n {\n \"timestamp\": 1.2,\n // All your life, you have fled from responsibility\n \"text\": \"Toute votre vie, vous avez fui toute responsabilité\"\n },\n {\n \"timestamp\": 4.01,\n // sacrificing others to ensure your own survival\n \"text\": \"sacrifiant les autres pour assurer votre propre survie\"\n },\n {\n \"timestamp\": 7.59,\n // But today, there is no escape\n \"text\": \"Mais aujourd’hui, il n’y a plus d’échappatoire\"\n },\n {\n \"timestamp\": 9.94,\n // You are being hunted and you will inevitably draw the attention of the creatures lurking here\n \"text\": \"Vous êtes traqués et vous attirerez inévitablement l’attention des créatures qui rôdent ici\"\n },\n {\n \"timestamp\": 15.11,\n // A single eye may divert their gaze… but at the cost of another sacrifice\n \"text\": \"Un œil peut détourner leur regard… mais au prix d’un autre sacrifice\"\n },\n {\n \"timestamp\": 19.56,\n // Let the game begin\n \"text\": \"Que le jeu commence\"\n }\n ],\n \"hunting_game\": [\n {\n \"timestamp\": 0,\n // Hello workers\n \"text\": \"Bonjour travailleurs\"\n },\n {\n \"timestamp\": 1.25,\n // All your life, you have spilled blood without consequences\n \"text\": \"Toute votre vie, vous avez fait couler le sang sans conséquences\"\n },\n {\n \"timestamp\": 4.91,\n // finding pleasure in the pain of others\n \"text\": \"trouvant du plaisir dans la douleur des autres\"\n },\n {\n \"timestamp\": 7.44,\n // Today, that brutality has become your only way out\n \"text\": \"Aujourd’hui, cette brutalité est devenue votre seule issue\"\n },\n {\n \"timestamp\": 11.41,\n // A key is your salvation, but it lies within the guts of beasts you must hunt\n \"text\": \"Une clé est votre salut, mais elle repose dans les entrailles de bêtes que vous devrez traquer\"\n },\n {\n \"timestamp\": 16.63,\n // Live or die, the choice is yours\n \"text\": \"Vivre ou mourir, à vous de choisir\"\n }\n ],\n \"escape_game\": [\n {\n \"timestamp\": 0,\n // Hello workers\n \"text\": \"Bonjour travailleurs\"\n },\n {\n \"timestamp\": 1.27,\n // Until now\n \"text\": \"Jusqu'à maintenant\"\n },\n {\n \"timestamp\": 2.21,\n // you have made decisions that impacted the lives of others without facing the consequences yourselves\n \"text\": \"vous avez pris des décisions qui ont affecté la vie des autres sans en subir vous-même les conséquences\"\n },\n {\n \"timestamp\": 8.43,\n // But today, your lives are bound together\n \"text\": \"Mais aujourd'hui, vos vies sont liées\"\n },\n {\n \"timestamp\": 11.16,\n // The chains that tether you represent your ability—or inability—to work as one\n \"text\": \"Les chaînes qui vous attachent représentent votre capacité, ou votre incapacité, à travailler ensemble\"\n },\n {\n \"timestamp\": 16.85,\n // Path to freedom is littered with deadly traps\n \"text\": \"Votre chemin vers la liberté est jonché de pièges mortels\"\n },\n {\n \"timestamp\": 20.41,\n // Reach the saw before it's too late, or prepare to perish together\n \"text\": \"Atteignez la scie avant qu'il ne soit trop tard, ou préparez-vous à périr ensemble\"\n },\n {\n \"timestamp\": 24.93,\n // The choice is yours\n \"text\": \"Le choix est à vous\"\n }\n ],\n \"explosive_game\": [\n {\n \"timestamp\": 0,\n // Hello workers\n \"text\": \"Bonjour travailleurs\"\n },\n {\n \"timestamp\": 1.24,\n // You’ve played with fire your entire lives\n \"text\": \"Vous avez joué avec le feu toute votre vie\"\n },\n {\n \"timestamp\": 3.85,\n // taking reckless risks without ever facing the consequences\n \"text\": \"prenant des risques inconsidérés sans jamais en assumer les conséquences\"\n },\n {\n \"timestamp\": 7.96,\n // Today, danger rests in your hands\n \"text\": \"Aujourd'hui, le danger repose entre vos mains\"\n },\n {\n \"timestamp\": 10.74,\n // One of you holds an unstable bomb\n \"text\": \"L'un d'entre vous détient une bombe instable\"\n },\n {\n \"timestamp\": 13.04,\n // Pass it on… or perish with it\n \"text\": \"Transmettez-la... ou périssez avec elle\"\n },\n {\n \"timestamp\": 15.33,\n // But remember, every action comes at a price\n \"text\": \"Mais n'oubliez pas que chaque action a un prix\"\n },\n {\n \"timestamp\": 18.66,\n // Find the container… if you hope to survive\n \"text\": \"Trouvez le conteneur, si vous espérez survivre\"\n },\n {\n \"timestamp\": 21.37,\n // Let the game begin\n \"text\": \"Que le jeu commence\"\n }\n ],\n \"billy_announcement\": [\n {\n \"timestamp\": 0,\n // Congratulations\n \"text\": \"Félicitations\"\n },\n {\n \"timestamp\": 1.37,\n // you've survived\n \"text\": \"vous avez survécu\"\n },\n {\n \"timestamp\": 2.71,\n // Today, you have emerged from this trial changed\n \"text\": \"Aujourd'hui, vous êtes sorti de cette épreuve changé\"\n },\n {\n \"timestamp\": 6.13,\n // But remember... life is made of choices\n \"text\": \"Mais rappelez-vous… la vie est faite de choix\"\n }\n ],\n \"billy_bathroom\": [\n {\n \"timestamp\": 0,\n // Hello worker\n \"text\": \"Bonjour travailleur\"\n },\n {\n \"timestamp\": 1.1,\n // You have survived many trials\n \"text\": \"Tu as survécu à de nombreuses épreuves\"\n },\n {\n \"timestamp\": 3.13,\n // You may believe this grants you respite… but today, a new opportunity lies before you\n \"text\": \"Tu crois peut-être que cela t’offre un répit… mais aujourd’hui, c’est une nouvelle opportunité qui s’offre à toi\"\n },\n {\n \"timestamp\": 8.78,\n // In this room hides the object that will set you free\n \"text\": \"Dans cette pièce se cache ce dont tu as besoin pour te libérer\"\n },\n {\n \"timestamp\": 12.08,\n // Yet another path stands open to you: the blade before you offers immediate freedom… at the cost of your flesh\n \"text\": \"Mais une autre possibilité s'offre à toi, la lame devant toi peut t’offrir la liberté immédiate… au prix de ta chair\"\n },\n {\n \"timestamp\": 19.08,\n // The choice is yours\n \"text\": \"Fais ton choix\"\n }\n ]\n}";
}
public static void LoadJSON()
{
string text = Path.Combine(Paths.ConfigPath, FilePath);
if (File.Exists(text))
{
try
{
string text2 = File.ReadAllText(text);
JObject parsedJson = JObject.Parse(text2);
if (!ValidateJsonStructure(parsedJson))
{
RenameOldFile(text);
}
}
catch (Exception)
{
RenameOldFile(text);
}
}
else
{
File.WriteAllText(text, Get());
}
using (new StreamReader(Path.Combine(Paths.ConfigPath, FilePath)))
{
survivalGameSubtitles = LoadSurvivalGameSubtitles();
huntingGameSubtitles = LoadHuntingGameSubtitles();
escapeGameSubtitles = LoadEscapeGameSubtitles();
explosiveGameSubtitles = LoadExplosiveGameSubtitles();
billyAnnouncementSubtitles = LoadBillyAnnouncementSubtitles();
billyBathroomSubtitles = LoadBillyBathroomSubtitles();
}
}
public static bool ValidateJsonStructure(JObject parsedJson)
{
List<string> list = new List<string>(6) { "survival_game", "hunting_game", "escape_game", "explosive_game", "billy_announcement", "billy_bathroom" };
foreach (string item in list)
{
if (parsedJson[item] == null)
{
return false;
}
JToken obj = parsedJson[item];
JArray val = (JArray)(object)((obj is JArray) ? obj : null);
if (val == null)
{
continue;
}
foreach (JToken item2 in val)
{
if (item2[(object)"timestamp"] == null || item2[(object)"text"] == null)
{
return false;
}
}
}
return true;
}
public static void RenameOldFile(string filePath)
{
string text = filePath + ".old";
if (File.Exists(text))
{
File.Delete(text);
}
File.Move(filePath, text);
File.WriteAllText(filePath, Get());
}
public static HashSet<SubtitleMapping> LoadSurvivalGameSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["survival_game"].ToObject<HashSet<SubtitleMapping>>();
}
public static HashSet<SubtitleMapping> LoadHuntingGameSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["hunting_game"].ToObject<HashSet<SubtitleMapping>>();
}
public static HashSet<SubtitleMapping> LoadEscapeGameSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["escape_game"].ToObject<HashSet<SubtitleMapping>>();
}
public static HashSet<SubtitleMapping> LoadExplosiveGameSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["explosive_game"].ToObject<HashSet<SubtitleMapping>>();
}
public static HashSet<SubtitleMapping> LoadBillyAnnouncementSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["billy_announcement"].ToObject<HashSet<SubtitleMapping>>();
}
public static HashSet<SubtitleMapping> LoadBillyBathroomSubtitles()
{
string text = File.ReadAllText(FilePath);
return JObject.Parse(text)["billy_bathroom"].ToObject<HashSet<SubtitleMapping>>();
}
}
}
namespace SawTapes.Files.Values
{
public 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.Items
{
public class BillyBody : PhysicsProp
{
public BillyHead aimedHead;
public override void Update()
{
((GrabbableObject)this).Update();
if (((GrabbableObject)this).isHeld && !((GrabbableObject)this).isPocketed && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
ShowAuraTargetedHead();
}
}
public void ShowAuraTargetedHead()
{
//IL_0010: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 832, (QueryTriggerInteraction)2))
{
BillyHead component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<BillyHead>();
if (!((Object)(object)component == (Object)null))
{
if ((Object)(object)aimedHead != (Object)null && (Object)(object)aimedHead != (Object)(object)component)
{
RemoveAuraFromHead();
}
aimedHead = component;
CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)aimedHead).gameObject }, LegaFusionCore.transparentShader, "Saw TapesBillyPiece", Color.yellow);
}
}
else
{
RemoveAuraFromHead();
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (buttonDown && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)aimedHead == (Object)null))
{
SpawnBillyServerRpc(NetworkObjectReference.op_Implicit(((Component)aimedHead).GetComponent<NetworkObject>()));
RemoveAuraFromHead();
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void SpawnBillyServerRpc(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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Invalid comparison between Unknown and I4
//IL_0043: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_009c: Unknown result type (might be due to invalid IL or missing referenc