#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Tartarus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Tartarus")]
[assembly: AssemblyTitle("Tartarus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
public class BreakableObject : NetworkBehaviour, IHittable
{
private Animator animator;
private AudioSource audioSource;
[SerializeField]
private AudioClip breakSound;
private void Start()
{
animator = ((Component)this).GetComponent<Animator>();
audioSource = ((Component)this).GetComponent<AudioSource>();
}
bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID = -1)
{
OnHitServerRpc();
return true;
}
[ServerRpc]
private void OnHitServerRpc()
{
OnHitClientRpc();
}
[ClientRpc]
private void OnHitClientRpc()
{
animator.SetTrigger("Break");
audioSource.PlayOneShot(breakSound);
}
}
public static class Extensions
{
public static void SetLayer(this GameObject obj, LayerMask layerMask, bool children)
{
//IL_0002: 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)
obj.layer = LayerMask.op_Implicit(layerMask);
if (children && obj.transform.childCount > 0)
{
Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>();
Transform[] array = componentsInChildren;
foreach (Transform val in array)
{
((Component)val).gameObject.layer = LayerMask.op_Implicit(layerMask);
}
}
}
public static void SetLayer(this GameObject obj, string layerName, bool children)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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)
LayerMask val = LayerMask.op_Implicit(LayerMask.NameToLayer(layerName));
obj.layer = LayerMask.op_Implicit(val);
if (children && obj.transform.childCount > 0)
{
Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>();
Transform[] array = componentsInChildren;
foreach (Transform val2 in array)
{
((Component)val2).gameObject.layer = LayerMask.op_Implicit(val);
}
}
}
public static Transform GetClosest(this Transform _transform, params Component[] array)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
Transform result = null;
float num = float.PositiveInfinity;
foreach (Component val in array)
{
float num2 = Vector3.Distance(_transform.position, val.transform.position);
if (num2 < num)
{
num = num2;
result = val.transform;
}
}
return result;
}
public static void SetColliderEnabled(this GameObject obj, bool enable, bool children)
{
obj.GetComponent<Collider>().enabled = enable;
if (children)
{
Collider[] componentsInChildren = obj.GetComponentsInChildren<Collider>();
Collider[] array = componentsInChildren;
foreach (Collider val in array)
{
val.enabled = enable;
}
}
}
public static void SetTag(this GameObject obj, string newTag, bool children)
{
obj.tag = newTag;
if (children)
{
Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>();
Transform[] array = componentsInChildren;
foreach (Transform val in array)
{
((Component)val).gameObject.tag = newTag;
}
}
}
public static void AddComponent<T>(this GameObject obj, bool children) where T : Component
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
obj.AddComponent<T>();
if (!children)
{
return;
}
foreach (Transform item in obj.transform)
{
Transform val = item;
((Component)val).gameObject.AddComponent<T>();
}
}
public static T GetVariableFromString<T>(this Component comp, string varName)
{
return (T)((object)comp).GetType().GetField(varName).GetValue(comp);
}
public static void MoveTowards(this Transform trans, Vector3 target, float maxDistanceDelta)
{
//IL_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references)
trans.position = Vector3.MoveTowards(trans.position, target, maxDistanceDelta);
}
public static Vector3 GetCenter(this GameObject obj)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
List<float> list = new List<float>();
List<float> list2 = new List<float>();
List<float> list3 = new List<float>();
Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
Bounds bounds = val.bounds;
list.Add(((Bounds)(ref bounds)).center.x);
bounds = val.bounds;
list2.Add(((Bounds)(ref bounds)).center.y);
bounds = val.bounds;
list3.Add(((Bounds)(ref bounds)).center.z);
}
float num = (Mathf.Max(list.ToArray()) + Mathf.Min(list.ToArray())) / 2f;
float num2 = (Mathf.Max(list2.ToArray()) + Mathf.Min(list2.ToArray())) / 2f;
float num3 = (Mathf.Max(list3.ToArray()) + Mathf.Min(list3.ToArray())) / 2f;
return new Vector3(num, num2, num3);
}
public static Vector3 GetBottom(this GameObject obj)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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)
MeshFilter[] componentsInChildren = obj.GetComponentsInChildren<MeshFilter>();
Vector3 center = obj.GetCenter();
Vector3 val = componentsInChildren[0].mesh.vertices[0];
MeshFilter[] array = componentsInChildren;
foreach (MeshFilter val2 in array)
{
Mesh mesh = val2.mesh;
Vector3[] vertices = mesh.vertices;
foreach (Vector3 val3 in vertices)
{
if (val3.y < val.y)
{
val = val3;
}
}
}
center.y = val.y;
return center;
}
public static Vector3 GetCenterNew(this GameObject obj)
{
//IL_0003: 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_0026: Expected O, but got Unknown
//IL_008a: 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_005b: 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_004e: 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)
Bounds val = default(Bounds);
bool flag = true;
foreach (Transform item in obj.transform)
{
Transform val2 = item;
if (Object.op_Implicit((Object)(object)((Component)val2).GetComponent<MeshRenderer>()))
{
if (flag)
{
flag = false;
val = ((Renderer)((Component)val2).GetComponent<MeshRenderer>()).bounds;
}
else
{
((Bounds)(ref val)).Encapsulate(((Renderer)((Component)val2).GetComponent<MeshRenderer>()).bounds);
}
}
}
return ((Bounds)(ref val)).center;
}
public static Transform[] GetAllChildren(this Transform trans)
{
return ((Component)trans).GetComponentsInChildren<Transform>();
}
public static void SetAlpha(this Image image, float alpha)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Color color = ((Graphic)image).color;
color.a = alpha;
((Graphic)image).color = color;
}
public static void SetAlpha(this Material mat, float alpha)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Color color = mat.color;
color.a = alpha;
mat.color = color;
}
public static void SetX(this Transform trans, float newX, bool relative)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
Vector3 position = trans.position;
position.x = (relative ? (position.x + newX) : newX);
trans.position = position;
}
public static void SetY(this Transform trans, float newY, bool relative)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
Vector3 position = trans.position;
position.y = (relative ? (position.y + newY) : newY);
trans.position = position;
}
public static void SetZ(this Transform trans, float newZ, bool relative)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
Vector3 position = trans.position;
position.z = (relative ? (position.z + newZ) : newZ);
trans.position = position;
}
public static bool IsSimilar(this Material mat, Material other)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = (Texture2D)mat.mainTexture;
Texture2D val2 = (Texture2D)other.mainTexture;
if ((Object)(object)mat.mainTexture == (Object)null && (Object)(object)other.mainTexture == (Object)null)
{
return mat.color == other.color;
}
return mat.color == other.color && (Object)(object)val == (Object)(object)val2;
}
}
public class Ext
{
public static void LoadSceneOffline(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
public static Scene GetActiveScene()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
return SceneManager.GetActiveScene();
}
public static int CryptoRandomInt(int min, int max)
{
return RandomNumberGenerator.GetInt32(min, max);
}
public static float CryptoRandomFloat(float min, float max)
{
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
byte[] array = new byte[4];
randomNumberGenerator.GetBytes(array);
float num = BitConverter.ToSingle(array, 0);
return num * (max - min) + min;
}
public static IEnumerator WaitAndDo(Action firstAction, float time, Action secondAction)
{
firstAction();
yield return (object)new WaitForSeconds(time);
secondAction();
}
public static IEnumerator WaitAndDo(Func<bool> condition, Action action)
{
while (condition())
{
yield return null;
}
action();
}
public static IEnumerator CheckForInternet(Action connected, Action notConnected)
{
UnityWebRequest request = UnityWebRequest.Get("https://www.google.com/");
try
{
yield return request.SendWebRequest();
if ((int)request.result == 1)
{
connected();
}
else
{
notConnected();
}
}
finally
{
((IDisposable)request)?.Dispose();
}
}
}
public class MathExt
{
public static float Wrap(float value, float min, float max)
{
if (value % 1f == 0f)
{
while (value > max || value < min)
{
if (value > max)
{
value += min - max - 1f;
}
else if (value < min)
{
value += max - min + 1f;
}
}
return value;
}
float num = value + 1f;
while (value != num)
{
num = value;
if (value < min)
{
value = max - (min - value);
}
else if (value > max)
{
value = min + (value - max);
}
}
return value;
}
public static int Wrap(int value, int min, int max)
{
if (value % 1 == 0)
{
while (value > max || value < min)
{
if (value > max)
{
value += min - max - 1;
}
else if (value < min)
{
value += max - min + 1;
}
}
return value;
}
int num = value + 1;
while (value != num)
{
num = value;
if (value < min)
{
value = max - (min - value);
}
else if (value > max)
{
value = min + (value - max);
}
}
return value;
}
public static bool Chance(float chance)
{
return chance > Random.Range(0f, 1f);
}
public static bool CryptoChance(float chance)
{
return chance > Ext.CryptoRandomFloat(0f, 1f);
}
public static T Choose<T>(params T[] array)
{
int num = array.Length;
return array[Random.Range(0, num)];
}
public static T Choose<T>(List<T> list)
{
return Choose(list.ToArray());
}
public static T CryptoChoose<T>(params T[] array)
{
int max = array.Length;
return array[Ext.CryptoRandomInt(0, max)];
}
public static T CryptoChoose<T>(List<T> list)
{
return CryptoChoose(list.ToArray());
}
}
public class FunnyDoor : NetworkBehaviour
{
private Animator animator;
private AudioSource audioSource;
public int inTriggerCount = 0;
private bool isOpen = false;
public AudioClip doorOpenSound;
public AudioClip doorCloseSound;
private void Start()
{
animator = ((Component)this).GetComponent<Animator>();
audioSource = ((Component)this).GetComponent<AudioSource>();
}
[ServerRpc]
private void OpenDoorServerRpc()
{
OpenDoorClientRpc();
}
[ClientRpc]
private void OpenDoorClientRpc()
{
animator.SetTrigger("Open");
audioSource.PlayOneShot(doorOpenSound);
isOpen = true;
}
[ServerRpc]
private void CloseDoorServerRpc()
{
CloseDoorClientRpc();
}
[ClientRpc]
private void CloseDoorClientRpc()
{
animator.SetTrigger("Close");
audioSource.PlayOneShot(doorCloseSound);
isOpen = false;
}
private void OnTriggerEnter(Collider other)
{
if (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("Enemy"))
{
UpdateCount(1);
}
}
private void OnTriggerExit(Collider other)
{
if (((Component)other).CompareTag("Player") || ((Component)other).CompareTag("Enemy"))
{
UpdateCount(-1);
}
}
private void UpdateCount(int update)
{
inTriggerCount += update;
if (inTriggerCount == 1 && !isOpen)
{
OpenDoorServerRpc();
}
else if (inTriggerCount == 0 && isOpen)
{
CloseDoorServerRpc();
}
}
}
public class MoveBackAndForth : MonoBehaviour
{
[SerializeField]
private Vector3 frequency;
[SerializeField]
private Vector3 magnitude;
[SerializeField]
private Vector3 offset;
private void Update()
{
//IL_009e: 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)
float num = Mathf.Sin(Time.time * frequency.x + offset.x) * magnitude.x;
float num2 = Mathf.Sin(Time.time * frequency.y + offset.y) * magnitude.y;
float num3 = Mathf.Sin(Time.time * frequency.z + offset.z) * magnitude.z;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num, num2, num3);
((Component)this).transform.Translate(val * Time.deltaTime);
}
}
public class RotateObject : MonoBehaviour
{
[SerializeField]
private Vector3 rotationVelocity;
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.Rotate(rotationVelocity * Time.deltaTime, (Space)1);
}
}
public class TartarusTeleporter : NetworkBehaviour
{
public bool isEntranceToBuilding;
public Transform entrancePoint;
private Transform exitPoint;
public int entranceId;
public StartOfRound playersManager;
private bool initializedVariables;
public int audioReverbPreset = -1;
public AudioSource entrancePointAudio;
private AudioSource exitPointAudio;
public AudioClip[] doorAudios;
public AudioClip firstTimeAudio;
public int dungeonFlowId = -1;
private InteractTrigger triggerScript;
private float checkForEnemiesInterval;
private bool enemyNearLastCheck;
private bool gotExitPoint;
private bool checkedForFirstTime;
public float timeAtLastUse;
public bool poweredOn;
private void Awake()
{
playersManager = Object.FindObjectOfType<StartOfRound>();
triggerScript = ((Component)this).gameObject.GetComponent<InteractTrigger>();
checkForEnemiesInterval = 10f;
}
public bool FindExitPoint()
{
EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
for (int i = 0; i < array.Length; i++)
{
if (array[i].isEntranceToBuilding != isEntranceToBuilding && array[i].entranceId == entranceId)
{
if ((Object)(object)array[i].entrancePointAudio != (Object)null)
{
exitPointAudio = array[i].entrancePointAudio;
}
exitPoint = array[i].entrancePoint;
}
}
if ((Object)(object)exitPoint == (Object)null)
{
return false;
}
return true;
}
public void TeleportPlayer()
{
//IL_0077: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
HUDManager.Instance.DisplayTip("???", "Tried to teleport!", false, false, "LC_Tip1");
bool flag = false;
if (!FindExitPoint())
{
flag = true;
}
if (flag)
{
HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
return;
}
Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody;
GameNetworkManager.Instance.localPlayerController.TeleportPlayer(exitPoint.position, false, 0f, false, true);
GameNetworkManager.Instance.localPlayerController.isInElevator = false;
GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
thisPlayerBody.eulerAngles = new Vector3(thisPlayerBody.eulerAngles.x, exitPoint.eulerAngles.y, thisPlayerBody.eulerAngles.z);
SetAudioPreset((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
if (!checkedForFirstTime)
{
checkedForFirstTime = true;
if ((Object)(object)firstTimeAudio != (Object)null && dungeonFlowId != -1 && !ES3.Load<bool>($"PlayedDungeonEntrance{dungeonFlowId}", "LCGeneralSaveData", false))
{
((MonoBehaviour)this).StartCoroutine(playMusicOnDelay());
}
}
for (int i = 0; i < GameNetworkManager.Instance.localPlayerController.ItemSlots.Length; i++)
{
if ((Object)(object)GameNetworkManager.Instance.localPlayerController.ItemSlots[i] != (Object)null)
{
GameNetworkManager.Instance.localPlayerController.ItemSlots[i].isInFactory = isEntranceToBuilding;
}
}
timeAtLastUse = Time.realtimeSinceStartup;
TeleportPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
GameNetworkManager.Instance.localPlayerController.isInsideFactory = isEntranceToBuilding;
}
private IEnumerator playMusicOnDelay()
{
yield return (object)new WaitForSeconds(0.6f);
ES3.Save<bool>($"PlayedDungeonEntrance{dungeonFlowId}", true, "LCGeneralSaveData");
HUDManager.Instance.UIAudio.PlayOneShot(firstTimeAudio);
}
[ServerRpc(RequireOwnership = false)]
public void TogglePowerServerRpc()
{
TogglePowerClientRpc();
Debug.LogError((object)"Pulled1");
}
[ClientRpc]
public void TogglePowerClientRpc()
{
poweredOn = false;
Debug.LogError((object)"Pulled");
}
[ServerRpc(RequireOwnership = false)]
public void TeleportPlayerServerRpc(int playerObj)
{
TeleportPlayerClientRpc(playerObj);
}
[ClientRpc]
public void TeleportPlayerClientRpc(int playerObj)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return;
}
FindExitPoint();
playersManager.allPlayerScripts[playerObj].TeleportPlayer(exitPoint.position, true, exitPoint.eulerAngles.y, false, true);
playersManager.allPlayerScripts[playerObj].isInElevator = false;
playersManager.allPlayerScripts[playerObj].isInHangarShipRoom = false;
PlayAudioAtTeleportPositions();
playersManager.allPlayerScripts[playerObj].isInsideFactory = isEntranceToBuilding;
for (int i = 0; i < playersManager.allPlayerScripts[playerObj].ItemSlots.Length; i++)
{
if ((Object)(object)playersManager.allPlayerScripts[playerObj].ItemSlots[i] != (Object)null)
{
playersManager.allPlayerScripts[playerObj].ItemSlots[i].isInFactory = isEntranceToBuilding;
}
}
if (GameNetworkManager.Instance.localPlayerController.isPlayerDead && (Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript)
{
SetAudioPreset(playerObj);
}
timeAtLastUse = Time.realtimeSinceStartup;
}
private void SetAudioPreset(int playerObj)
{
if (audioReverbPreset != -1)
{
Object.FindObjectOfType<AudioReverbPresets>().audioPresets[audioReverbPreset].ChangeAudioReverbForPlayer(StartOfRound.Instance.allPlayerScripts[playerObj]);
if ((Object)(object)entrancePointAudio != (Object)null)
{
PlayAudioAtTeleportPositions();
}
}
}
public void PlayAudioAtTeleportPositions()
{
if (doorAudios.Length != 0)
{
entrancePointAudio.PlayOneShot(doorAudios[Random.Range(0, doorAudios.Length)]);
exitPointAudio.PlayOneShot(doorAudios[Random.Range(0, doorAudios.Length)]);
}
}
private void Update()
{
//IL_0148: 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_007f: 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_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
if (!isEntranceToBuilding)
{
return;
}
if (checkForEnemiesInterval <= 0f)
{
if (!gotExitPoint)
{
if (FindExitPoint())
{
gotExitPoint = true;
}
return;
}
checkForEnemiesInterval = 1f;
bool flag = false;
for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++)
{
if (Vector3.Distance(((Component)RoundManager.Instance.SpawnedEnemies[i]).transform.position, ((Component)exitPoint).transform.position) < 7.7f)
{
flag = true;
break;
}
}
if (flag && !enemyNearLastCheck)
{
enemyNearLastCheck = true;
triggerScript.hoverTip = "[Near activity detected!]";
}
else if (enemyNearLastCheck)
{
enemyNearLastCheck = false;
triggerScript.hoverTip = "Enter: [LMB]";
}
}
else
{
checkForEnemiesInterval -= Time.deltaTime;
}
Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody;
if (Vector3.Distance(thisPlayerBody.position, entrancePoint.position) < 1.5f && poweredOn)
{
TeleportPlayer();
}
else
{
Debug.Log((object)Vector3.Distance(thisPlayerBody.position, entrancePoint.position));
}
}
}
public class TeleporterApparatus : GrabbableObject
{
public bool isLungPowered = true;
public bool isLungDocked = true;
public bool isLungDockedInElevator;
public RoundManager roundManager;
public GameObject sparkParticle;
private Coroutine disconnectAnimation;
public AudioClip connectSFX;
public AudioClip disconnectSFX;
public AudioClip removeFromMachineSFX;
public float lungDeviceLightIntensity;
public MeshRenderer lungDeviceMesh;
private Color emissiveColor;
public EnemyType radMechEnemyType;
public TartarusTeleporter tartarusTeleporter;
public override void EquipItem()
{
Debug.Log((object)$"Lung apparatice was grabbed. Is owner: {((NetworkBehaviour)this).IsOwner}");
if (isLungDocked)
{
isLungDocked = false;
if (disconnectAnimation != null)
{
((MonoBehaviour)this).StopCoroutine(disconnectAnimation);
}
disconnectAnimation = ((MonoBehaviour)this).StartCoroutine(DisconnectFromMachinery());
}
if (isLungDockedInElevator)
{
isLungDockedInElevator = false;
((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(disconnectSFX);
_ = isLungPowered;
}
((GrabbableObject)this).EquipItem();
}
private IEnumerator DisconnectFromMachinery()
{
GameObject newSparkParticle = Object.Instantiate<GameObject>(sparkParticle, ((Component)this).transform.position, Quaternion.identity, (Transform)null);
AudioSource thisAudio = ((Component)this).gameObject.GetComponent<AudioSource>();
thisAudio.Stop();
thisAudio.PlayOneShot(disconnectSFX, 0.7f);
yield return (object)new WaitForSeconds(0.1f);
newSparkParticle.SetActive(true);
thisAudio.PlayOneShot(removeFromMachineSFX);
}
public override void Start()
{
((GrabbableObject)this).Start();
roundManager = Object.FindObjectOfType<RoundManager>();
}
}
namespace ExampleEnemy
{
internal class ReaperEnemyAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
StickingInFrontOfPlayer,
HeadSwingAttackInProgress
}
public Transform turnCompass = null;
public Transform attackArea = null;
public Transform leftGunAttackPoint;
public Transform rightGunAttackPoint;
public ParticleSystem leftGunFlare;
public ParticleSystem rightGunFlare;
public ParticleSystem deathParticles;
public TrailRenderer bullet;
private float bullets = 6f;
public float timeBeforeShooting;
public float timeBetweenShots;
private float timeSinceHittingLocalPlayer;
private float timeSinceNewRandPos;
private float timeSinceAttacking;
private Vector3 positionRandomness;
private Vector3 StalkPos;
private Random enemyRandom = null;
private bool isDeadAnimationDone;
[Conditional("DEBUG")]
private void LogIfDebugBuild(string text)
{
}
public override void Start()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
LogIfDebugBuild("Example Enemy Spawned");
timeSinceHittingLocalPlayer = 0f;
base.creatureAnimator.SetTrigger("startWalk");
timeSinceNewRandPos = 0f;
positionRandomness = new Vector3(0f, 0f, 0f);
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
isDeadAnimationDone = false;
base.currentBehaviourStateIndex = 0;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
public override void Update()
{
//IL_00cc: 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_00f3: 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_0107: 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)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
LogIfDebugBuild("Stopping enemy voice with janky code.");
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX);
}
return;
}
timeSinceAttacking += Time.deltaTime;
timeSinceHittingLocalPlayer += Time.deltaTime;
timeSinceNewRandPos += Time.deltaTime;
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2))
{
turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
}
if (base.stunNormalizedTimer > 0f)
{
base.agent.speed = 0f;
}
if (timeSinceAttacking > 5f && currentBehaviourStateIndex == 1)
{
bullets = 6f;
}
}
public override void DoAIInterval()
{
//IL_00b5: 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)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 3f;
if (FoundClosestPlayerInRange(25f, 3f))
{
LogIfDebugBuild("Start Target Player");
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
base.agent.speed = 5f;
if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
{
LogIfDebugBuild("Stop Target Player");
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
else
{
StickingInFrontOfPlayer();
}
break;
case 2:
break;
default:
LogIfDebugBuild("This Behavior State doesn't exist!");
break;
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_004e: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001f: 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)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
private void StickingInFrontOfPlayer()
{
//IL_009a: 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_00b0: 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_00d4: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner && timeSinceNewRandPos > 0.7f)
{
timeSinceNewRandPos = 0f;
if (enemyRandom.Next(0, 5) == 0)
{
Debug.Log((object)"Reaper attack!");
((MonoBehaviour)this).StartCoroutine(SwingAttack());
}
else
{
positionRandomness = new Vector3((float)enemyRandom.Next(-2, 2), 0f, (float)enemyRandom.Next(-2, 2));
StalkPos = ((Component)base.targetPlayer).transform.position - Vector3.Scale(new Vector3(-5f, 0f, -5f), ((Component)base.targetPlayer).transform.forward) + positionRandomness;
}
((EnemyAI)this).SetDestinationToPosition(StalkPos, false);
}
}
private IEnumerator SwingAttack()
{
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
Transform startPosition = leftGunAttackPoint;
if (bullets % 2f == 0f)
{
leftGunFlare.Play();
}
else
{
startPosition = rightGunAttackPoint;
rightGunFlare.Play();
}
RaycastHit hit = default(RaycastHit);
if (Physics.Linecast(startPosition.position, ((Component)base.targetPlayer).transform.position, ref hit))
{
TrailRenderer trail2 = Object.Instantiate<TrailRenderer>(bullet, startPosition.position, Quaternion.identity);
((MonoBehaviour)this).StartCoroutine(BulletTrail(trail2, ((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, MadeImpact: true));
}
else
{
TrailRenderer trail = Object.Instantiate<TrailRenderer>(bullet, startPosition.position, Quaternion.identity);
((MonoBehaviour)this).StartCoroutine(BulletTrail(trail, startPosition.position + ((Component)this).transform.forward * 100f, Vector3.zero, MadeImpact: false));
}
DoAnimationClientRpc("startAttack");
yield return (object)new WaitForSeconds(0.35f);
ShootAttackHitClientRpc();
timeSinceAttacking = 0f;
if (base.currentBehaviourStateIndex == 2)
{
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
}
private IEnumerator BulletTrail(TrailRenderer trail, Vector3 HitPoint, Vector3 HitNormal, bool MadeImpact)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
Vector3 startPosition = ((Component)trail).transform.position;
float distance = Vector3.Distance(((Component)trail).transform.position, HitPoint);
float remainingDistance = distance;
while (remainingDistance > 0f)
{
((Component)trail).transform.position = Vector3.Lerp(startPosition, HitPoint, 1f - remainingDistance / distance);
remainingDistance -= 100f * Time.deltaTime;
yield return null;
}
((Component)trail).transform.position = HitPoint;
Object.Destroy((Object)(object)((Component)trail).gameObject, trail.time);
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_004c: 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)
if (!(timeSinceHittingLocalPlayer < 1f))
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
LogIfDebugBuild("Example Enemy Collision with Player!");
timeSinceHittingLocalPlayer = 0f;
val.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
if (!base.isEnemyDead)
{
base.enemyHP -= force;
if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
{
((MonoBehaviour)this).StartCoroutine(Death());
((MonoBehaviour)this).StopCoroutine(SwingAttack());
((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
private IEnumerator Death()
{
deathParticles.Play();
List<Material> materialList = new List<Material>();
float duration = 0f;
SkinnedMeshRenderer[] skinnedMeshRenderers = base.skinnedMeshRenderers;
foreach (SkinnedMeshRenderer renderer in skinnedMeshRenderers)
{
Material[] materials = ((Renderer)renderer).materials;
foreach (Material material in materials)
{
materialList.Add(material);
}
}
while (duration < 1f)
{
foreach (Material material2 in materialList)
{
material2.SetFloat("_DissolveAmount", duration);
duration += Time.deltaTime / 7f;
}
yield return null;
}
foreach (Material material3 in materialList)
{
material3.SetFloat("_DissolveAmount", 1f);
}
}
[ClientRpc]
public void DoAnimationClientRpc(string animationName)
{
LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
[ClientRpc]
public void SwingAttackHitClientRpc()
{
//IL_0015: 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_0025: 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_008d: Unknown result type (might be due to invalid IL or missing references)
LogIfDebugBuild("SwingAttackHitClientRPC");
int num = 8;
Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
if (array.Length == 0)
{
return;
}
Collider[] array2 = array;
foreach (Collider val in array2)
{
PlayerControllerB val2 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val, false, false);
if ((Object)(object)val2 != (Object)null)
{
LogIfDebugBuild("Swing attack hit player!");
timeSinceHittingLocalPlayer = 0f;
val2.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
[ClientRpc]
public void ShootAttackHitClientRpc()
{
//IL_004f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
LogIfDebugBuild("ShootAttackHitClientRpc");
if (!(bullets > 0f))
{
return;
}
bullets -= 1f;
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(((Component)base.targetPlayer).GetComponent<Collider>(), false, false);
RaycastHit val2 = default(RaycastHit);
if (Physics.Linecast(attackArea.position, ((Component)base.targetPlayer).transform.position, ref val2))
{
Object.Instantiate<TrailRenderer>(bullet, ((RaycastHit)(ref val2)).transform.position, ((RaycastHit)(ref val2)).transform.rotation);
if ((Object)(object)val != (Object)null)
{
LogIfDebugBuild("Bullet hit player!");
timeSinceHittingLocalPlayer = 0f;
val.DamagePlayer(5, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
if (bullets > 0f)
{
((MonoBehaviour)this).StartCoroutine(Ext.WaitAndDo(delegate
{
}, 0.25f, delegate
{
ShootAttackHitClientRpc();
}));
}
}
}
}
namespace Tartarus
{
[BepInPlugin("Tartarus", "Tartarus", "0.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "Tartarus";
public const string ModName = "Tartarus";
public const string ModVersion = "0.1.3";
public static Plugin Instance;
internal static readonly Harmony Harmony = new Harmony("Tartarus");
private void Awake()
{
NetcodePatch();
}
private void NetcodePatch()
{
try
{
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);
}
}
}
}
catch
{
Debug.LogError((object)"NetcodePatcher Failed! This Is Very Bad.");
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Tartarus";
public const string PLUGIN_NAME = "Tartarus";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace TestMod
{
public class CustomBehaviour : MonoBehaviour
{
}
}