using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using infiltratorMod.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("infiltratorMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("infiltratorMod")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("08de51c8-694e-4a4e-9cbf-d565d3fb11d3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace infiltratorMod
{
[BepInPlugin("EVIL.Tormad", "Infiltrator", "1.0.1")]
public class ModBase : BaseUnityPlugin
{
public const string modGUID = "EVIL.Tormad";
public const string modName = "Infiltrator";
public const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("EVIL.Tormad");
private static ModBase Instance;
internal ManualLogSource mls;
private ConfigEntry<float> movSpeed;
private ConfigEntry<float> carryWeight;
private ConfigEntry<int> health;
private ConfigEntry<float> transparency;
private ConfigEntry<float> sprintSpeed;
private ConfigEntry<float> hitDistance;
private ConfigEntry<int> attackForce;
private ConfigEntry<int> maxEnemies;
private ConfigEntry<bool> canFly;
private ConfigEntry<bool> canDrop;
private ConfigEntry<bool> canRegen;
private ConfigEntry<bool> canOpenDoors;
private ConfigEntry<bool> canUnlockDoors;
private ConfigEntry<bool> canInteractInShip;
private ConfigEntry<int> doorLockMax;
private ConfigEntry<bool> nightVision;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("EVIL.Tormad");
mls.LogInfo((object)"!!!!!!!!!!!!!!!!!!!!!!!!The EVIL mod started!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
movSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("EvilPlayer", "MovementSpeed", 2f, "Movement speed of the evil player. (normal player can move at 4.6 with 0 weight)");
carryWeight = ((BaseUnityPlugin)this).Config.Bind<float>("EvilPlayer", "CarryWeight", 2.5f, "Carry weight of the evil player. (will reduce sprint time)");
health = ((BaseUnityPlugin)this).Config.Bind<int>("EvilPlayer", "Health", 10, "Health of the evil player.");
transparency = ((BaseUnityPlugin)this).Config.Bind<float>("EvilPlayer", "Transparency", 0.1f, "Transparency of the evil player.");
sprintSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("EvilPlayer", "SprintSpeed", 10f, "Sprint speed of the evil player.");
hitDistance = ((BaseUnityPlugin)this).Config.Bind<float>("EvilPlayer", "HitDistance", 1.5f, "Hit distance of the evil player.");
attackForce = ((BaseUnityPlugin)this).Config.Bind<int>("EvilPlayer", "AttackForce", 1, "Damage dealt by the evil player.");
maxEnemies = ((BaseUnityPlugin)this).Config.Bind<int>("EvilPlayer", "MaxEnemies", 1, "Max enemies put 0 if none (does not increase past vanilla amount).");
canFly = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanFly", true, "Can the evil player fly (jump on air).");
canDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanDrop", true, "Can the evil player drop the clipboard. (allows switching of evil player only in ship)");
canRegen = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanRegen", false, "Can regen of the evil player. (after being killed)");
canOpenDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanOpenDoors", true, "Can the evil player open doors. (will not open doors that require a key)");
canUnlockDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanUnlockDoors", true, "Can the evil player unlock doors. (will not require a key)");
doorLockMax = ((BaseUnityPlugin)this).Config.Bind<int>("EvilPlayer", "DoorLockMax", 1, "Max doors the evil player can lock.");
canInteractInShip = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "CanInteractInShip", true, "Can the evil player interact with things in the ship.");
nightVision = ((BaseUnityPlugin)this).Config.Bind<bool>("EvilPlayer", "NightVision", false, "Can the evil player see in the dark. (broken currently do nto enable)");
movSpeed.SettingChanged += OnConfigChanged;
carryWeight.SettingChanged += OnConfigChanged;
health.SettingChanged += OnConfigChanged;
transparency.SettingChanged += OnConfigChanged;
sprintSpeed.SettingChanged += OnConfigChanged;
hitDistance.SettingChanged += OnConfigChanged;
attackForce.SettingChanged += OnConfigChanged;
maxEnemies.SettingChanged += OnConfigChanged;
canFly.SettingChanged += OnConfigChanged;
canDrop.SettingChanged += OnConfigChanged;
canRegen.SettingChanged += OnConfigChanged;
canOpenDoors.SettingChanged += OnConfigChanged;
canUnlockDoors.SettingChanged += OnConfigChanged;
doorLockMax.SettingChanged += OnConfigChanged;
canInteractInShip.SettingChanged += OnConfigChanged;
nightVision.SettingChanged += OnConfigChanged;
PlayerSelectorPatch.modBaseInstance = this;
ApplyConfig();
harmony.PatchAll();
}
public void ApplyConfig()
{
EvilPlayer.movSpeed = movSpeed.Value;
EvilPlayer.carryWeight = carryWeight.Value;
EvilPlayer.health = health.Value;
EvilPlayer.transparency = transparency.Value;
EvilPlayer.sprintSpeed = sprintSpeed.Value;
EvilPlayer.hitDistance = hitDistance.Value;
EvilPlayer.attackHitForce = attackForce.Value;
EvilPlayer.canFly = canFly.Value;
EvilPlayer.canDrop = canDrop.Value;
EvilPlayer.RegenHealth = canRegen.Value;
EvilPlayer.maxEnemy = maxEnemies.Value;
EvilPlayer.canOpenDoors = canOpenDoors.Value;
EvilPlayer.canUnlockDoors = canUnlockDoors.Value;
EvilPlayer.doorLockMax = doorLockMax.Value;
EvilPlayer.canInteractInShip = canInteractInShip.Value;
EvilPlayer.nightVision = nightVision.Value;
}
private void OnConfigChanged(object sender, EventArgs e)
{
ApplyConfig();
}
}
}
namespace infiltratorMod.Patches
{
public static class EvilPlayer
{
public static ulong evilPlayerId = 696969uL;
public static List<float> yRot = new List<float>();
public static bool shouldTP = false;
public static bool hasLanded = false;
public static float movSpeed;
public static float carryWeight = 2.5f;
public static float jumpForce = 2f;
public static float sprintSpeed;
public static float hitDistance = 1.5f;
public static int health = 100;
public static float transparency = 0.7f;
public static List<Vector3> positions = new List<Vector3>();
public static int ventIndex = 0;
public static bool shipPhase = true;
public static string currentMoon = "";
public static bool changedSkin = false;
public static int attackHitForce = 1;
public static bool RegenHealth = true;
public static bool canFly = true;
public static bool canDrop = false;
public static int maxEnemy = 0;
public static int EnemyCount = 0;
public static bool canOpenDoors = true;
public static bool canUnlockDoors = false;
public static int DoorsLocked = 0;
public static int doorLockMax = 1;
public static bool canInteractInShip = true;
public static bool nightVision = true;
}
[HarmonyPatch(typeof(ClipboardItem))]
internal class PlayerSelectorPatch
{
private static ManualLogSource logger;
private static int attackMask;
public static ModBase modBaseInstance;
static PlayerSelectorPatch()
{
attackMask = 11012424;
logger = Logger.CreateLogSource("EVIL.Tormad");
}
[HarmonyPostfix]
[HarmonyPatch("EquipItem")]
private static void PostfixEquipItem(ClipboardItem __instance)
{
if ((Object)(object)__instance == (Object)null || (Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null)
{
logger.LogError((object)"PostfixEquipItem: __instance or playerHeldBy is null.");
return;
}
modBaseInstance.ApplyConfig();
EvilPlayer.evilPlayerId = ((GrabbableObject)__instance).playerHeldBy.playerClientId;
((GrabbableObject)__instance).playerHeldBy.health = EvilPlayer.health;
((GrabbableObject)__instance).playerHeldBy.carryWeight = EvilPlayer.carryWeight;
((GrabbableObject)__instance).playerHeldBy.grabDistance = 2f;
((GrabbableObject)__instance).playerHeldBy.movementSpeed = EvilPlayer.movSpeed;
logger.LogInfo((object)"!___Player ID___!");
logger.LogInfo((object)EvilPlayer.evilPlayerId.ToString());
logger.LogInfo((object)"!___Player ID___!");
EvilPlayer.changedSkin = false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ClipboardItem), "ItemInteractLeftRight")]
private static bool preItemInteractLeftRight(ClipboardItem __instance, bool right)
{
int ventIndex = EvilPlayer.ventIndex;
((GrabbableObject)__instance).RequireCooldown();
if (!right)
{
EvilPlayer.ventIndex = Mathf.Clamp(EvilPlayer.ventIndex - 1, -1, EvilPlayer.positions.Count - 1);
}
if (EvilPlayer.ventIndex != ventIndex)
{
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)("Vent num is num! " + ventIndex + " And VentIndex is " + EvilPlayer.ventIndex));
RoundManager.PlayRandomClip(__instance.thisAudio, __instance.turnPageSFX, true, 1f, 0);
if (EvilPlayer.ventIndex == -1)
{
EvilPlayer.ventIndex = EvilPlayer.positions.Count - 1;
}
logger.LogInfo((object)("!___Vent___! " + ventIndex));
EvilPlayer.shouldTP = true;
}
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GrabbableObject), "ItemActivate")]
private static void PostfixItemActivate(GrabbableObject __instance, bool used, bool buttonDown)
{
ClipboardItem val = (ClipboardItem)(object)((__instance is ClipboardItem) ? __instance : null);
if (val != null && !((Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null) && buttonDown)
{
PerformInstantHit(((GrabbableObject)val).playerHeldBy);
TryUnlockDoor(((GrabbableObject)val).playerHeldBy);
if (EvilPlayer.DoorsLocked >= EvilPlayer.doorLockMax)
{
TryLockDoor(((GrabbableObject)val).playerHeldBy);
}
}
}
private static void PerformInstantHit(PlayerControllerB playerHeldBy)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] source = Physics.SphereCastAll(((Component)playerHeldBy.gameplayCamera).transform.position, 0.75f, ((Component)playerHeldBy.gameplayCamera).transform.forward, EvilPlayer.hitDistance, attackMask, (QueryTriggerInteraction)2);
IHittable val = default(IHittable);
foreach (RaycastHit item in source.OrderBy((RaycastHit h) => ((RaycastHit)(ref h)).distance))
{
RaycastHit current = item;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<IHittable>(ref val) && !((Object)(object)((RaycastHit)(ref current)).transform == (Object)(object)((Component)playerHeldBy).transform))
{
try
{
ManualLogSource obj = logger;
string[] obj2 = new string[10]
{
"!___Player ID___! ",
EvilPlayer.attackHitForce.ToString(),
" ",
null,
null,
null,
null,
null,
null,
null
};
Vector3 val2 = ((RaycastHit)(ref current)).point;
obj2[3] = ((object)(Vector3)(ref val2)).ToString();
obj2[4] = " ";
obj2[5] = ((object)playerHeldBy)?.ToString();
obj2[6] = " ";
val2 = ((RaycastHit)(ref current)).normal;
obj2[7] = ((object)(Vector3)(ref val2)).ToString();
obj2[8] = " tranform ";
obj2[9] = ((object)((RaycastHit)(ref current)).transform)?.ToString();
obj.LogInfo((object)string.Concat(obj2));
val.Hit(EvilPlayer.attackHitForce, ((RaycastHit)(ref current)).point, playerHeldBy, false);
}
catch (Exception arg)
{
logger.LogError((object)$"Exception caught when hitting object with ClipboardItem: {arg}");
}
}
}
}
private static void TryUnlockDoor(PlayerControllerB playerHeldBy)
{
//IL_000e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
Ray val = default(Ray);
((Ray)(ref val))..ctor(((Component)playerHeldBy.gameplayCamera).transform.position, ((Component)playerHeldBy.gameplayCamera).transform.forward);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 3f, 2816))
{
DoorLock component = ((Component)((RaycastHit)(ref val2)).transform).GetComponent<DoorLock>();
if ((Object)(object)component != (Object)null && component.isLocked && !component.isPickingLock)
{
component.UnlockDoorSyncWithServer();
}
}
}
private static void TryLockDoor(PlayerControllerB playerHeldBy)
{
//IL_000e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
Ray val = default(Ray);
((Ray)(ref val))..ctor(((Component)playerHeldBy.gameplayCamera).transform.position, ((Component)playerHeldBy.gameplayCamera).transform.forward);
RaycastHit val2 = default(RaycastHit);
if (!Physics.Raycast(val, ref val2, 3f, 2816))
{
return;
}
DoorLock component = ((Component)((RaycastHit)(ref val2)).transform).GetComponent<DoorLock>();
if ((Object)(object)component != (Object)null && !component.isLocked)
{
component.doorLockSFX.Stop();
component.doorLockSFX.PlayOneShot(component.unlockSFX);
if (!component.isLocked)
{
component.isLocked = true;
EvilPlayer.DoorsLocked++;
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
internal class PlayerKillPatch
{
[HarmonyPrefix]
private static bool preKillPlayer(PlayerControllerB __instance)
{
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
((Renderer)__instance.thisPlayerModelArms).enabled = false;
EvilPlayer.shouldTP = true;
if (EvilPlayer.RegenHealth)
{
__instance.health = EvilPlayer.health;
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "OnDestroy")]
internal class OnDestroyPatch
{
[HarmonyPrefix]
private static void preOnDestroy(PlayerControllerB __instance)
{
EvilPlayer.evilPlayerId = 696969uL;
}
}
[HarmonyPatch(typeof(DoorLock), "Update")]
internal class DoorLockPatch
{
[HarmonyPrefix]
private static bool preUpdate(DoorLock __instance)
{
InteractTrigger val = AccessTools.FieldRefAccess<DoorLock, InteractTrigger>(__instance, "doorTrigger");
int num = AccessTools.FieldRefAccess<DoorLock, int>(__instance, "playersPickingDoor");
float num2 = AccessTools.FieldRefAccess<DoorLock, float>(__instance, "playerPickingLockProgress");
if (GameNetworkManager.Instance.localPlayerController.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
if (EvilPlayer.canUnlockDoors && __instance.isLocked)
{
if (StartOfRound.Instance.localPlayerUsingController)
{
val.disabledHoverTip = "Use key: [R-trigger]";
}
else
{
val.disabledHoverTip = "Unlock: [ LMB ]";
}
}
if (EvilPlayer.DoorsLocked >= EvilPlayer.doorLockMax && !__instance.isLocked)
{
if (StartOfRound.Instance.localPlayerUsingController)
{
val.disabledHoverTip = "Use key: [R-trigger]";
}
else
{
val.disabledHoverTip = "Lock Door: [ LMB ] only done once per moon";
}
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
internal class PlayerJumpPatch
{
[HarmonyPrefix]
private static bool preJump_performed(PlayerControllerB __instance)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
string name = ((Object)((Component)__instance).gameObject).name;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)("GameObject Name: " + name));
if (__instance.playerClientId != EvilPlayer.evilPlayerId || !EvilPlayer.canFly)
{
return true;
}
if (!__instance.quickMenuManager.isMenuOpen && __instance.isPlayerControlled && !__instance.isTypingChat)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerControllerB), "isJumping");
fieldInfo.SetValue(__instance, true);
FieldInfo fieldInfo2 = AccessTools.Field(typeof(PlayerControllerB), "jumpCoroutine");
Coroutine val = (Coroutine)fieldInfo2.GetValue(__instance);
if (val != null)
{
((MonoBehaviour)__instance).StopCoroutine(val);
}
MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "PlayerJump", (Type[])null, (Type[])null);
val = ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)methodInfo.Invoke(__instance, null));
fieldInfo2.SetValue(__instance, val);
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
internal class DiscardHeldObjectpPatch
{
[HarmonyPrefix]
private static bool preDiscardHeldObject(PlayerControllerB __instance)
{
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
if (EvilPlayer.shipPhase && EvilPlayer.canDrop)
{
EvilPlayer.evilPlayerId = 696969uL;
return true;
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
internal class ScrollMouse_performedPatch
{
[HarmonyPrefix]
private static bool preScrollMouse_performed(PlayerControllerB __instance)
{
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
internal class BeginGrabObjectPatch
{
[HarmonyPrefix]
private static bool preBeginGrabObject(PlayerControllerB __instance)
{
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")]
internal class SwitchToItemSlotPatch
{
[HarmonyPrefix]
private static bool preSwitchToItemSlot(PlayerControllerB __instance)
{
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
return true;
}
__instance.twoHanded = true;
return false;
}
}
[HarmonyPatch(typeof(EnemyVent), "Update")]
internal class EnemyVentPatch
{
[HarmonyPostfix]
private static void postUpdate(EnemyVent __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
Vector3 newPos = __instance.floorNode.position;
newPos.y += 1f;
if (!EvilPlayer.positions.Any((Vector3 pos) => pos == newPos))
{
EvilPlayer.positions.Add(newPos);
EvilPlayer.ventIndex = EvilPlayer.positions.Count / 2;
EvilPlayer.yRot.Add(__instance.floorNode.eulerAngles.y);
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___TRIED TO STOP SPAWN___!");
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)newPos);
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___TRIED TO STOP SPAWN___!");
EvilPlayer.shouldTP = true;
}
}
}
[HarmonyPatch(typeof(RoundManager), "Update")]
internal class LandingCheckerPatch
{
[HarmonyPrefix]
private static void preUpdate(RoundManager __instance)
{
EvilPlayer.hasLanded = __instance.dungeonCompletedGenerating;
if (__instance.currentLevel.PlanetName != EvilPlayer.currentMoon)
{
EvilPlayer.changedSkin = false;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)("!_____" + __instance.currentLevel.PlanetName));
EvilPlayer.currentMoon = __instance.currentLevel.PlanetName;
}
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")]
internal class EnemySpawnPatch
{
[HarmonyPrefix]
private static bool preSpawnEnemyFromVent()
{
if (EvilPlayer.maxEnemy <= EvilPlayer.EnemyCount)
{
return false;
}
EvilPlayer.EnemyCount++;
return true;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
internal class PlayerControllerPatch
{
private static TimerUtility timer = new TimerUtility(0.1f, 10f);
[HarmonyPrefix]
private static void PrefixUpdate(PlayerControllerB __instance)
{
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0520: Unknown result type (might be due to invalid IL or missing references)
//IL_054f: Unknown result type (might be due to invalid IL or missing references)
//IL_059c: Unknown result type (might be due to invalid IL or missing references)
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
if (__instance.playerClientId != EvilPlayer.evilPlayerId)
{
if (__instance.carryWeight == EvilPlayer.carryWeight)
{
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___Dropped___!");
UnlockableSuit.SwitchSuitForPlayer(__instance, 0, true);
__instance.movementSpeed = 4.6f;
__instance.sprintTime = 5f;
__instance.jumpForce = 13f;
__instance.hinderedMultiplier = 1f;
__instance.velocityMovingAverageLength = 20;
__instance.insanitySpeedMultiplier = 1f;
__instance.carryWeight = 1f;
__instance.grabDistance = 3f;
((Behaviour)__instance.nightVision).enabled = false;
__instance.twoHanded = false;
__instance.isMovementHindered = 0;
__instance.sprintMeter = 1f;
}
return;
}
__instance.AddBloodToBody();
timer.Update();
if (__instance.playersManager.livingPlayers == 1 && __instance.playerClientId == EvilPlayer.evilPlayerId && __instance.isInsideFactory)
{
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)(EvilPlayer.evilPlayerId + " - " + __instance.playerClientId));
__instance.playersManager.allPlayersDead = true;
__instance.playersManager.ShipLeaveAutomatically(false);
}
if (!EvilPlayer.changedSkin)
{
Material val = new Material(Shader.Find("HDRP/Lit"));
val.SetFloat("_Smoothness", 1f);
val.SetFloat("_Metallic", 1f);
val.SetFloat("_RefractionModel", 1f);
val.SetFloat("_IOR", 1.5f);
val.SetFloat("_MaterialType", 1f);
val.SetColor("_SubsurfaceColor", Color.red);
val.SetFloat("_SurfaceType", 1f);
val.SetColor("_BaseColor", new Color(0f, 0f, 0f, EvilPlayer.transparency));
val.EnableKeyword("_RIMLIGHT");
val.SetFloat("_RimLightIntensity", 0.2f);
((Renderer)__instance.thisPlayerModel).material = val;
((Renderer)__instance.thisPlayerModelLOD1).material = val;
((Renderer)__instance.thisPlayerModelLOD2).material = val;
((Renderer)__instance.thisPlayerModelArms).material = val;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___Updated Material___!");
EvilPlayer.changedSkin = true;
}
if (__instance.movementSpeed != EvilPlayer.movSpeed && !__instance.isSprinting)
{
__instance.movementSpeed = EvilPlayer.movSpeed;
}
if (__instance.movementSpeed != EvilPlayer.sprintSpeed && __instance.isSprinting)
{
__instance.movementSpeed = EvilPlayer.sprintSpeed;
}
if (!__instance.isInsideFactory && !EvilPlayer.shipPhase)
{
EvilPlayer.changedSkin = false;
EvilPlayer.shipPhase = true;
}
if (__instance.isInsideFactory && EvilPlayer.shipPhase)
{
EvilPlayer.shipPhase = false;
}
if (EvilPlayer.shipPhase == __instance.isInsideFactory)
{
EvilPlayer.evilPlayerId = 696969uL;
}
if (__instance.grabDistance != 0f && EvilPlayer.shipPhase && !EvilPlayer.canInteractInShip)
{
__instance.grabDistance = 0f;
}
else if (__instance.grabDistance != 2f && !EvilPlayer.shipPhase && EvilPlayer.canOpenDoors)
{
__instance.grabDistance = 2f;
}
if (__instance.isInHangarShipRoom && !EvilPlayer.shouldTP && EvilPlayer.hasLanded)
{
EvilPlayer.shouldTP = true;
}
if (!((Behaviour)__instance.nightVision).enabled && EvilPlayer.nightVision)
{
((Behaviour)__instance.nightVision).enabled = true;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___night vision___!");
}
if (EvilPlayer.shouldTP && timer.Triggered)
{
Transform thisPlayerBody = __instance.thisPlayerBody;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)"!___TRIED TO TELEPORT___!");
thisPlayerBody.eulerAngles = new Vector3(thisPlayerBody.eulerAngles.x, EvilPlayer.yRot[EvilPlayer.ventIndex], thisPlayerBody.eulerAngles.z);
Vector3 forward = ((Component)thisPlayerBody).transform.forward;
float num = 1f;
Vector3 val2 = EvilPlayer.positions[EvilPlayer.ventIndex] + forward * num;
__instance.TeleportPlayer(val2, false, 0f, false, true);
__instance.isInHangarShipRoom = false;
__instance.isInsideFactory = true;
if (!__instance.isInHangarShipRoom && EvilPlayer.shouldTP)
{
EvilPlayer.shouldTP = false;
}
}
if (__instance.thisPlayerBody.position.y <= -300f)
{
Transform thisPlayerBody2 = __instance.thisPlayerBody;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)thisPlayerBody2.position);
Random random = new Random();
__instance.TeleportPlayer(EvilPlayer.positions[random.Next(0, EvilPlayer.positions.Count)], false, 0f, false, true);
}
if (EvilPlayer.currentMoon == "71 Gordion" && timer.Triggered)
{
Transform thisPlayerBody3 = __instance.thisPlayerBody;
Logger.CreateLogSource("EVIL.Tormad").LogInfo((object)thisPlayerBody3.position);
Random random2 = new Random();
__instance.TeleportPlayer(new Vector3(0f, 6f, 0f), false, 0f, false, true);
}
}
}
public class TimerUtility
{
private float _interval;
private float _nextTriggerTime;
private bool _isInitialized = false;
public bool Triggered { get; private set; }
public TimerUtility(float intervalSeconds, float startingDelaySeconds)
{
_interval = intervalSeconds;
_nextTriggerTime = Time.realtimeSinceStartup + startingDelaySeconds;
_isInitialized = true;
}
public void Update()
{
if (_isInitialized)
{
if (Time.realtimeSinceStartup >= _nextTriggerTime)
{
_nextTriggerTime = Time.realtimeSinceStartup + _interval;
Triggered = true;
}
else
{
Triggered = false;
}
}
}
}
}