using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EmployeeClasses.GUI;
using EmployeeClasses.Inputs;
using EmployeeClasses.Patches;
using EmployeeClasses.Roles;
using EmployeeClasses.Util;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
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: AssemblyTitle("EmployeeClasses")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmployeeClasses")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0ce88ebc-9cb4-47d2-8bb1-f10e6bcfb72e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EmployeeClasses
{
[BepInPlugin("Jade.EmployeeClasses", "EmployeeClasses", "0.1.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ModBase : BaseUnityPlugin
{
private const string modGUID = "Jade.EmployeeClasses";
private const string modName = "EmployeeClasses";
private const string modVersion = "0.1.2";
private readonly Harmony harmony = new Harmony("Jade.EmployeeClasses");
public static ModBase Instance;
public static ManualLogSource als;
public static AssetBundle assets;
internal static Keybinds keybinds;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
als = Logger.CreateLogSource("Jade.EmployeeClasses");
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "employeeclasses"));
if ((Object)(object)assets == (Object)null)
{
als.LogError((object)"Failed to load custom assets.");
}
keybinds = new Keybinds();
SetupKeybindCallbacks();
Sounds.Awake();
harmony.PatchAll(typeof(ModBase));
harmony.PatchAll(typeof(RoleManager));
harmony.PatchAll(typeof(StartOfRoundPatch));
harmony.PatchAll(typeof(QuickMenuManagerPatch));
harmony.PatchAll(typeof(ShovelPatch));
harmony.PatchAll(typeof(HUDManagerPatch));
harmony.PatchAll(typeof(PlayerControllerBPAtch));
harmony.PatchAll(typeof(GameNetworkManagerPatch));
harmony.PatchAll(typeof(TimeOfDayPatch));
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);
}
}
}
als.LogInfo((object)":");
als.LogInfo((object)"EmployeeClasses has loaded!");
als.LogInfo((object)":");
}
public void SetupKeybindCallbacks()
{
keybinds.SkillKey.canceled += OnSkillKeyReleased;
keybinds.SkillKey.performed += OnSkillKeyPressed;
}
public void OnSkillKeyPressed(CallbackContext context)
{
RoleManager.Instance.PressSkill();
}
public void OnSkillKeyReleased(CallbackContext context)
{
RoleManager.Instance.ReleaseSkill();
}
public static void logOutput(string msg)
{
als.LogInfo((object)msg);
}
}
}
namespace EmployeeClasses.Util
{
public static class NetworkObjectExtensions
{
public static IEnumerator WaitUntilSpawned(this NetworkObject networkObject)
{
yield return (object)new WaitUntil((Func<bool>)(() => networkObject.IsSpawned));
}
private static IEnumerator RunActionAfterSpawned(NetworkObject networkObject, Action action)
{
yield return networkObject.WaitUntilSpawned();
action();
}
public static void OnSpawn(this NetworkObject networkObject, Action action)
{
((MonoBehaviour)networkObject).StartCoroutine(RunActionAfterSpawned(networkObject, action));
}
}
internal class Sounds
{
public static AudioClip beaconSound;
public static AudioClip reelSound;
public static AudioClip swingSound;
public static AudioClip kickSound;
public static AudioClip harvestSound;
public static AudioClip synthSound;
public static AudioClip stimSound;
public static AudioClip switchSound;
public static AudioClip hackSound;
public static AudioClip failSound;
public static Dictionary<int, AudioClip> library;
public static void Awake()
{
beaconSound = LoadClip("Beacon");
reelSound = LoadClip("KickReel");
swingSound = LoadClip("KickSwing");
kickSound = LoadClip("KickHit");
harvestSound = LoadClip("Harvest");
synthSound = LoadClip("Synthesize");
stimSound = LoadClip("Stim");
switchSound = LoadClip("Switch");
hackSound = LoadClip("Hacking");
failSound = LoadClip("HackFail");
library = new Dictionary<int, AudioClip>
{
{ 0, beaconSound },
{ 1, reelSound },
{ 2, swingSound },
{ 3, kickSound },
{ 4, harvestSound },
{ 5, synthSound },
{ 6, stimSound },
{ 7, switchSound },
{ 8, hackSound },
{ 9, failSound }
};
}
public static AudioClip LoadClip(string clip)
{
AudioClip val = ModBase.assets.LoadAsset<AudioClip>(clip);
if ((Object)(object)val == (Object)null)
{
ModBase.als.LogError((object)"Trouble loading Beacon clip");
}
return val;
}
public static void PlayClipFromSource(int clip, AudioSource source, float volume)
{
source.PlayOneShot(library[clip], volume);
}
}
}
namespace EmployeeClasses.Roles
{
public class Role
{
public string name;
public List<RoleTag> tags;
public string ability;
public string description;
public Role(string name, List<RoleTag> tags, string ability, string description)
{
this.name = name;
this.tags = tags;
this.ability = ability;
this.description = description;
}
public Role(string name, List<RoleTag> tags, string description)
{
this.name = name;
this.tags = tags;
ability = null;
this.description = description;
}
}
internal class RoleManager : NetworkBehaviour
{
private const float KICK_COST = 0.4f;
public string selectedRole;
public List<RoleTag> tags;
public string ability;
public float maxSprintSpeed = 2.25f;
public float weightPenalty = 1f;
public float oxygenReserves = 1f;
private float speedMultiplier = 1f;
public float fallDamage = 1f;
public int attackDamage = 1;
public float footstepVolume = 1f;
public float scanRange = 1f;
private int maxHealth = 100;
public bool scanWall = false;
private int threatLevel = 0;
public int weightPenaltyThreshhold = 0;
public float bulletDamage = 0f;
public float fogVisibility = 1f;
public float sprintTime = 1f;
public float sprintMeter = 1f;
public float battery = 1f;
public bool alwaysClock = false;
public float sprintMultiplier = 0.5f;
public float drowningTimer = 1f;
public float extract = 0f;
public int charges = 0;
public bool freeCharge = true;
public bool stimmed = false;
private GameObject headlamp;
private float abilityCooldown = 0f;
private float duration = 0f;
private bool active = false;
private Coroutine abilityRoutine;
private PlayerControllerB player;
public float carryWeight;
public static RoleManager Instance;
public int playerID;
private float holdTimer;
private float second = 0f;
private Image extractBar;
private Image batteryBar;
private Image chargeBar;
private Dictionary<string, int> extractValues = new Dictionary<string, int>
{
{ "Flowerman", 75 },
{ "Crawler", 50 },
{ "Hoarding bug", 30 },
{ "Centipede", 20 },
{ "Bunker Spider", 60 },
{ "Puffer", 40 },
{ "Nutcracker", 60 },
{ "Masked", 50 },
{ "Butler", 60 },
{ "Clay Surgeon", 50 },
{ "MouthDog", 100 },
{ "ForestGiant", 100 },
{ "Baboon hawk", 50 },
{ "Bush Wolf", 50 },
{ "Manticoil", 20 },
{ "Tulip Snake", 20 }
};
private Dictionary<LevelWeatherType, float> batteryRates = new Dictionary<LevelWeatherType, float>
{
{
(LevelWeatherType)(-1),
0.09f
},
{
(LevelWeatherType)2,
0.1f
},
{
(LevelWeatherType)1,
0.07f
},
{
(LevelWeatherType)5,
0.2f
},
{
(LevelWeatherType)3,
0.05f
},
{
(LevelWeatherType)0,
0.08f
}
};
public void Awake()
{
}
public void CreateHUD()
{
extractBar = ((Component)Object.Instantiate<GameObject>(ModBase.assets.LoadAsset<GameObject>("ExtractBar"), GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner").transform).transform.Find("Bar")).GetComponent<Image>();
((Component)((Component)extractBar).transform.parent).gameObject.SetActive(false);
chargeBar = ((Component)((Component)extractBar).transform.parent.Find("Charges")).GetComponent<Image>();
batteryBar = ((Component)Object.Instantiate<GameObject>(ModBase.assets.LoadAsset<GameObject>("BatteryBar"), GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner").transform).transform.Find("Bar")).GetComponent<Image>();
((Component)((Component)batteryBar).transform.parent).gameObject.SetActive(false);
}
public void reset()
{
if ((Object)(object)headlamp != (Object)null)
{
DestroyHeadlamp();
}
sprintMeter = 1f;
maxSprintSpeed = 2.25f;
maxHealth = 100;
weightPenalty = 1f;
oxygenReserves = 1f;
speedMultiplier = 1f;
fallDamage = 1f;
attackDamage = 1;
footstepVolume = 1f;
scanRange = 1f;
threatLevel = 0;
weightPenaltyThreshhold = 0;
bulletDamage = 1f;
alwaysClock = false;
scanWall = false;
holdTimer = -1f;
stimmed = false;
sprintTime = 1f;
fogVisibility = 1f;
if (charges == 0)
{
charges = 1;
}
battery = 1f;
}
public void changeRole(Role role)
{
reset();
tags = role.tags;
ability = ((role.ability == null) ? null : role.ability);
selectedRole = role.name;
RoleTag[] array = tags.ToArray();
foreach (RoleTag roleTag in array)
{
if (roleTag.Id == 0)
{
maxSprintSpeed *= roleTag.Power;
}
else if (roleTag.Id == 2)
{
maxHealth = (int)roleTag.Power;
}
else if (roleTag.Id == 3)
{
weightPenalty = roleTag.Power;
}
else if (roleTag.Id == 4)
{
oxygenReserves = roleTag.Power;
}
else if (roleTag.Id == 1)
{
speedMultiplier = roleTag.Power;
}
else if (roleTag.Id == 5)
{
fallDamage = roleTag.Power;
}
else if (roleTag.Id == 6)
{
attackDamage = (int)roleTag.Power;
}
else if (roleTag.Id == 7)
{
weightPenaltyThreshhold = (int)roleTag.Power;
}
else if (roleTag.Id == 8)
{
footstepVolume = roleTag.Power;
}
else if (roleTag.Id == 9)
{
scanRange = roleTag.Power;
}
else if (roleTag.Id == 10)
{
scanWall = true;
}
else if (roleTag.Id == 11)
{
threatLevel = (int)roleTag.Power;
}
else if (roleTag.Id == 12)
{
bulletDamage = roleTag.Power;
}
else if (roleTag.Id == 13)
{
alwaysClock = true;
}
else if (roleTag.Id == 14)
{
CreateHeadlamp();
}
else if (roleTag.Id == 15)
{
sprintTime = roleTag.Power;
}
else if (roleTag.Id == 16)
{
fogVisibility = roleTag.Power;
}
}
if (ability == "STIM")
{
((Component)((Component)extractBar).transform.parent).gameObject.SetActive(true);
}
else
{
((Component)((Component)extractBar).transform.parent).gameObject.SetActive(false);
}
}
public void applyRole(PlayerControllerB instance)
{
instance.health = maxHealth;
instance.movementSpeed = 4.6f * speedMultiplier;
drowningTimer = oxygenReserves;
abilityCooldown = 0f;
duration = 0f;
active = false;
if (((NetworkBehaviour)this).NetworkManager.IsHost)
{
ApplyRoleClientRpc(playerID, footstepVolume, selectedRole);
}
else
{
ApplyRoleServerRpc(playerID, footstepVolume, selectedRole);
}
}
[ServerRpc(RequireOwnership = false)]
public void ApplyRoleServerRpc(int id, float footstepVolume, string role)
{
ApplyRoleClientRpc(id, footstepVolume, role);
}
[ClientRpc]
public void ApplyRoleClientRpc(int id, float footstepVolume, string role)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[id];
((Component)val).GetComponent<RoleManager>().footstepVolume = footstepVolume;
((Component)val).GetComponent<RoleManager>().selectedRole = role;
((TMP_Text)val.usernameBillboardText).text = val.playerUsername + "\n[" + selectedRole + "]\n\n";
}
public void SyncRoles()
{
if (NetworkManager.Singleton.IsHost)
{
BroadcastRoleClientRpc();
}
else
{
BroadcastRoleServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void BroadcastRoleServerRpc()
{
ApplyRoleClientRpc(playerID, footstepVolume, selectedRole);
}
[ClientRpc]
public void BroadcastRoleClientRpc()
{
if (NetworkManager.Singleton.IsHost)
{
ApplyRoleServerRpc(playerID, footstepVolume, selectedRole);
}
else
{
ApplyRoleClientRpc(playerID, footstepVolume, selectedRole);
}
}
public void SyncClassObjects()
{
if (NetworkManager.Singleton.IsHost)
{
BroadcastRoleClientRpc();
}
else
{
BroadcastRoleServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void SyncClassObjectsServerRpc()
{
SyncClassObjectsClientRpc();
}
[ClientRpc]
public void SyncClassObjectsClientRpc()
{
if ((Object)(object)headlamp != (Object)null)
{
CreateHeadlamp();
}
if (NetworkManager.Singleton.IsHost)
{
ApplyRoleServerRpc(playerID, footstepVolume, selectedRole);
}
else
{
ApplyRoleClientRpc(playerID, footstepVolume, selectedRole);
}
}
public static float GetScanRange(float range)
{
return range * Instance.scanRange;
}
public float GetFootstepVolume(float volume)
{
return volume * Instance.footstepVolume;
}
public static int GetThreatLevel()
{
return Instance.threatLevel;
}
public static int GetMaxHealth(int health)
{
return Instance.maxHealth;
}
public static float GetSprintMultiplier()
{
return Instance.sprintMultiplier;
}
public static float GetSprintMeter()
{
return Instance.sprintMeter;
}
public static float GetCarryWeight(float weight)
{
return Instance.carryWeight;
}
public void Revive()
{
if ((Object)(object)headlamp != (Object)null)
{
headlamp.SetActive(false);
}
player = StartOfRound.Instance.localPlayerController;
EndSkill();
abilityCooldown = 0f;
duration = 0f;
active = false;
extract = 0f;
stimmed = false;
battery = 1f;
sprintMeter = 1f;
if (!freeCharge && charges < 3)
{
charges++;
}
freeCharge = true;
if (((NetworkBehaviour)this).NetworkManager.IsHost)
{
ApplyRoleClientRpc(playerID, footstepVolume, selectedRole);
}
else
{
ApplyRoleServerRpc(playerID, footstepVolume, selectedRole);
}
}
public void Update()
{
if ((Object)(object)player == (Object)null && !((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null))
{
player = StartOfRound.Instance.localPlayerController;
playerID = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player);
}
}
public void UpdateIt()
{
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0680: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null || RolesGUI.instance == null)
{
return;
}
second += Time.deltaTime;
if (second >= 0.1f)
{
second = 0f;
if (stimmed)
{
if ((double)player.drunkness < 0.1)
{
player.drunkness = 0.1f;
}
if (player.health <= maxHealth)
{
PlayerControllerB obj = player;
obj.health += ((maxHealth < 100) ? 1 : (maxHealth / 100));
}
if (player.health > maxHealth)
{
player.health = maxHealth;
stimmed = false;
}
HUDManager.Instance.UpdateHealthUI(player.health, true);
}
}
if ((ability == null && (Object)(object)headlamp == (Object)null) || ((!player.isPlayerControlled || StartOfRound.Instance.inShipPhase) && !((NetworkBehaviour)this).NetworkManager.IsHost))
{
RolesGUI.instance.HideTip();
return;
}
List<string> list = new List<string>();
if (!player.isInsideFactory && battery < 1f)
{
battery += batteryRates[TimeOfDay.Instance.currentLevelWeather] * Time.deltaTime;
if (battery > 1f)
{
battery = 1f;
}
}
if ((Object)(object)headlamp != (Object)null && player.isPlayerControlled)
{
list.Add($"TOGGLE LAMP : [Press {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
batteryBar.fillAmount = Mathf.Lerp(batteryBar.fillAmount, battery / 1f, Mathf.SmoothStep(0f, 1f, 0.1f));
if (headlamp.activeSelf)
{
battery -= 0.004f * Time.deltaTime;
if (battery <= 0f)
{
SyncLamp(active: false);
}
}
}
HoldSkill();
if (duration <= 0f && ability != null)
{
if (abilityCooldown > -10f)
{
abilityCooldown -= Time.deltaTime * 1f;
}
if (abilityCooldown > 0f)
{
list.Add(((int)abilityCooldown).ToString() ?? "");
}
else if (ability == "HACK")
{
if (holdTimer > 0.5f)
{
string text = Math.Round(3f - holdTimer, 2).ToString() ?? "";
if (text.Length < 4)
{
text += "0";
}
list.Add("HACKING : " + text);
}
else if (HackAvailable())
{
list.Add($"HACK : [Hold {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
}
else if (ability == "STIM")
{
extractBar.fillAmount = Mathf.Lerp(extractBar.fillAmount, extract / 100f, Mathf.SmoothStep(0f, 1f, 0.1f));
chargeBar.fillAmount = (float)charges / 3f;
if (HarvestAvailable())
{
list.Add($"HARVEST : [Press {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
else if (SynthesizeAvailable() || StimAvailable())
{
if (StimAvailable())
{
if (StimmingTeam())
{
list.Add($"STIM ALLY : [Press {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
else
{
list.Add($"STIM SELF : [Press {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
}
if (SynthesizeAvailable())
{
list.Add($"SYNTHESIZE : [Hold {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
}
else
{
RolesGUI.instance.HideTip();
}
}
else if (abilityCooldown <= 0f && (!(ability == "KICK") || !(sprintMeter < 0.4f)))
{
list.Add(ability + $": [Press {InputActionRebindingExtensions.GetBindingDisplayString(ModBase.keybinds.SkillKey, (DisplayStringOptions)0, (string)null)[0]}]");
}
string text2 = "";
foreach (string item in list)
{
text2 = text2 + item + "\n";
}
RolesGUI.instance.ShowTip(text2, new Color(50f, 50f, 50f));
}
else
{
UpdateSkill();
duration -= Time.deltaTime * 1f;
if (duration <= 0f)
{
EndSkill();
}
}
}
public void PressSkill()
{
if (player.inTerminalMenu || player.isTypingChat)
{
return;
}
if (holdTimer == -1f)
{
holdTimer = 0f;
}
if (abilityCooldown < 0f && player.isPlayerControlled && (!StartOfRound.Instance.inShipPhase || ((NetworkBehaviour)StartOfRound.Instance).IsHost) && ability == "KICK")
{
TriggerKick();
if (NetworkManager.Singleton.IsHost)
{
TriggerClientRpc(ability, playerID);
}
else
{
TriggerServerRpc(ability, playerID);
}
RolesGUI.instance.HideTip();
}
}
public void HoldSkill()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
if (player.inTerminalMenu || player.isTypingChat)
{
return;
}
if (holdTimer > -1f)
{
holdTimer += Time.deltaTime;
}
if (holdTimer < 0.5f)
{
return;
}
if (ability == "STIM" && SynthesizeAvailable())
{
TriggerSynthesize();
}
else if (ability == "HACK")
{
if (HackAvailable())
{
RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 30f, 1f, 0, false, 0);
if (holdTimer < 0.6f)
{
BeginHack();
holdTimer = 0.6f;
return;
}
if (!(holdTimer > 3f))
{
return;
}
TriggerHack();
}
else if (holdTimer >= 0.6f)
{
StopItemAudio(playerID);
PlayClipFromItemAudio(9, playerID, 0.3f);
RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 30f, 1f, 0, false, 0);
}
}
holdTimer = -2f;
}
public void ReleaseSkill()
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if (player.inTerminalMenu || player.isTypingChat)
{
return;
}
if (holdTimer == -2f)
{
holdTimer = -1f;
return;
}
if (ability == "HACK" && holdTimer >= 0.6f)
{
StopItemAudio(playerID);
PlayClipFromItemAudio(9, playerID, 0.3f);
RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 30f, 1f, 0, false, 0);
}
holdTimer = -1f;
if ((Object)(object)headlamp != (Object)null && player.isPlayerControlled && !player.inTerminalMenu)
{
SyncLamp(!headlamp.activeSelf);
}
if (!(abilityCooldown < 0f) || !player.isPlayerControlled || player.inTerminalMenu || (StartOfRound.Instance.inShipPhase && !((NetworkBehaviour)StartOfRound.Instance).IsHost))
{
return;
}
if (ability == "STIM")
{
if (HarvestAvailable())
{
TriggerHarvest();
}
else
{
if (!StimAvailable())
{
return;
}
TriggerStim();
}
}
else
{
if (!(ability == "BEACON"))
{
return;
}
TriggerBeacon();
}
if (NetworkManager.Singleton.IsHost)
{
TriggerClientRpc(ability, playerID);
}
else
{
TriggerServerRpc(ability, playerID);
}
RolesGUI.instance.HideTip();
}
[ServerRpc(RequireOwnership = false)]
public void TriggerServerRpc(string ability, int playerID)
{
ModBase.als.LogInfo((object)"SRpc is working");
TriggerClientRpc(ability, playerID);
}
[ClientRpc]
public void TriggerClientRpc(string ability, int playerID)
{
ModBase.als.LogInfo((object)"CRpc is working");
if (ability == "BEACON")
{
TriggerBeaconClient(playerID);
}
}
public void EndSkill()
{
if (abilityRoutine != null)
{
((MonoBehaviour)player).StopCoroutine(abilityRoutine);
}
if (ability == "BEACON")
{
EndBeacon();
}
else if (ability == "KICK")
{
EndKick();
}
if (NetworkManager.Singleton.IsHost)
{
EndClientRpc(ability, playerID);
}
else
{
EndServerRpc(ability, playerID);
}
}
[ServerRpc(RequireOwnership = false)]
public void EndServerRpc(string ability, int playerID)
{
EndClientRpc(ability, playerID);
}
[ClientRpc]
public void EndClientRpc(string ability, int playerID)
{
if (ability == "BEACON")
{
EndBeaconClient(playerID);
}
}
public void UpdateSkill()
{
if (ability == "BEACON")
{
UpdateBeacon();
}
if (NetworkManager.Singleton.IsHost)
{
UpdateClientRpc(ability, playerID);
}
else
{
UpdateServerRpc(ability, playerID);
}
}
[ServerRpc(RequireOwnership = false)]
public void UpdateServerRpc(string ability, int playerID)
{
UpdateClientRpc(ability, playerID);
}
[ClientRpc]
public void UpdateClientRpc(string ability, int playerID)
{
if (ability == "BEACON")
{
UpdateBeaconClient(playerID);
}
}
public void PlayClipFromItemAudio(int clip, int playerID, float volume)
{
if (NetworkManager.Singleton.IsHost)
{
PlayClipFromItemAudioClientRpc(clip, playerID, volume);
}
else
{
PlayClipFromItemAudioServerRpc(clip, playerID, volume);
}
}
[ServerRpc(RequireOwnership = false)]
public void PlayClipFromItemAudioServerRpc(int clip, int playerID, float volume)
{
PlayClipFromItemAudioClientRpc(clip, playerID, volume);
}
[ClientRpc]
public void PlayClipFromItemAudioClientRpc(int clip, int playerID, float volume)
{
Sounds.PlayClipFromSource(clip, StartOfRound.Instance.allPlayerScripts[playerID].itemAudio, volume);
}
public void StopItemAudio(int playerID)
{
if (NetworkManager.Singleton.IsHost)
{
StopItemAudioClientRpc(playerID);
}
else
{
StopItemAudioServerRpc(playerID);
}
}
[ServerRpc(RequireOwnership = false)]
public void StopItemAudioServerRpc(int playerID)
{
StopItemAudioClientRpc(playerID);
}
[ClientRpc]
public void StopItemAudioClientRpc(int playerID)
{
StartOfRound.Instance.allPlayerScripts[playerID].itemAudio.Stop();
}
public void DestroyEnemy(int id)
{
if (NetworkManager.Singleton.IsHost)
{
DestroyEnemyClientRpc(id);
}
else
{
DestroyEnemyServerRpc(id);
}
}
[ServerRpc(RequireOwnership = false)]
public void DestroyEnemyServerRpc(int id)
{
DestroyEnemyClientRpc(id);
}
[ClientRpc]
public void DestroyEnemyClientRpc(int id)
{
Object.Destroy((Object)(object)((Component)RoundManager.Instance.SpawnedEnemies[id]).gameObject);
}
public void TriggerBeacon()
{
ModBase.logOutput("Beacon activated!");
duration = 5f;
abilityCooldown = 60f;
}
public void TriggerBeaconClient(int playerID)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if (playerID != -1)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
((Component)((Component)val).transform.Find("BeaconLight")).gameObject.SetActive(true);
PlayClipFromItemAudio(0, playerID, 1.2f);
RoundManager.Instance.PlayAudibleNoise(((Component)val).transform.position, 80f, 3f, 0, false, 0);
}
}
public void UpdateBeacon()
{
sprintMeter = 1f;
}
public void UpdateBeaconClient(int playerID)
{
//IL_0046: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (((Object)(object)spawnedEnemy.targetPlayer != (Object)(object)val || !spawnedEnemy.movingTowardsTargetPlayer) && Vector3.Distance(((Component)val).transform.position, ((Component)spawnedEnemy).transform.position) <= 70f)
{
ModBase.als.LogInfo((object)"target changed");
spawnedEnemy.targetPlayer = val;
spawnedEnemy.movingTowardsTargetPlayer = true;
}
}
RoundManager.Instance.PlayAudibleNoise(((Component)val).transform.position, 80f, 3f, 0, false, 0);
}
public void EndBeacon()
{
ModBase.logOutput("Beacon ended!");
}
public void EndBeaconClient(int playerID)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
((Component)((Component)val).transform.Find("BeaconLight")).gameObject.SetActive(false);
}
public void TriggerKick()
{
if (!active && sprintMeter > 0.4f)
{
active = true;
if (abilityRoutine != null)
{
((MonoBehaviour)player).StopCoroutine(abilityRoutine);
}
abilityRoutine = ((MonoBehaviour)player).StartCoroutine(reelKick());
}
}
private IEnumerator reelKick()
{
player.activatingItem = true;
player.twoHanded = true;
player.playerBodyAnimator.ResetTrigger("shovelHit");
player.playerBodyAnimator.SetBool("reelingUp", true);
PlayClipFromItemAudio(1, playerID, 1f);
yield return (object)new WaitForSeconds(0.35f);
if (!ModBase.keybinds.SkillKey.IsPressed())
{
EndKick();
yield break;
}
ModBase.logOutput("pulled back");
yield return (object)new WaitUntil((Func<bool>)(() => !ModBase.keybinds.SkillKey.IsPressed()));
ModBase.logOutput("released");
SwingKick();
yield return (object)new WaitForSeconds(0.13f);
yield return (object)new WaitForEndOfFrame();
ModBase.logOutput("hit");
HitKick();
yield return (object)new WaitForSeconds(0.3f);
ModBase.logOutput("done");
active = false;
abilityRoutine = null;
}
private void SwingKick()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
player.playerBodyAnimator.SetBool("reelingUp", false);
PlayClipFromItemAudio(2, playerID, 1f);
player.UpdateSpecialAnimationValue(true, (short)((Component)player).transform.localEulerAngles.y, 0.4f, false);
}
private void HitKick()
{
//IL_0064: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: 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_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
if (sprintMeter >= 0.4f)
{
sprintMeter -= 0.4f;
}
else
{
sprintMeter = 0f;
}
player.activatingItem = false;
player.twoHanded = false;
bool flag = false;
bool flag2 = false;
int num = -1;
RaycastHit[] source = Physics.SphereCastAll(((Component)player.gameplayCamera).transform.position + ((Component)player.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)player.gameplayCamera).transform.forward, 1.5f, 11012424, (QueryTriggerInteraction)2);
List<RaycastHit> list = source.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
IHittable val2 = default(IHittable);
RaycastHit val3 = default(RaycastHit);
for (int i = 0; i < list.Count; i++)
{
RaycastHit val = list[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = list[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = list[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = list[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)player).transform)
{
continue;
}
val = list[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)player.gameplayCamera).transform.position;
val = list[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)player.gameplayCamera).transform.forward;
val2.Hit(1, forward, player, true, 1);
if (((object)val2).GetType() == typeof(EnemyAICollisionDetect))
{
((EnemyAICollisionDetect)val2).mainScript.SetEnemyStunned(true, 2f, (PlayerControllerB)null);
}
flag2 = true;
continue;
}
}
flag = true;
val = list[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
if (flag)
{
PlayClipFromItemAudio(3, playerID, 1f);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)player).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
player.itemAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(player.itemAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
player.playerBodyAnimator.SetTrigger("shovelHit");
}
if (flag2)
{
abilityCooldown = 0f;
}
}
private void EndKick()
{
active = false;
abilityRoutine = null;
player.activatingItem = false;
player.twoHanded = false;
player.playerBodyAnimator.SetBool("reelingUp", false);
}
private bool HarvestAvailable()
{
return HarvestTargetExists() && player.isCrouching;
}
private bool SynthesizeAvailable()
{
return extract >= 50f && charges < 3;
}
private bool StimAvailable()
{
return charges > 0;
}
private bool StimmingTeam()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_004a: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] array = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 5f, 11012424, (QueryTriggerInteraction)2);
RaycastHit[] array2 = array;
PlayerControllerB val2 = default(PlayerControllerB);
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
if (((Component)((RaycastHit)(ref val)).transform).TryGetComponent<PlayerControllerB>(ref val2) && !((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)player).transform) && !val2.isPlayerDead)
{
return true;
}
}
return false;
}
private bool HarvestTargetExists()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_004a: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] array = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 2f, 11012424, (QueryTriggerInteraction)2);
RaycastHit[] array2 = array;
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
if (((Component)((RaycastHit)(ref val)).transform).TryGetComponent<EnemyAICollisionDetect>(ref val2) && val2.mainScript.isEnemyDead)
{
return true;
}
}
return false;
}
public void TriggerHarvest()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] array = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 2f, 11012424, (QueryTriggerInteraction)2);
RaycastHit[] array2 = array;
EnemyAICollisionDetect val2 = default(EnemyAICollisionDetect);
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
if (((Component)((RaycastHit)(ref val)).transform).TryGetComponent<EnemyAICollisionDetect>(ref val2) && val2.mainScript.isEnemyDead)
{
extract += extractValues[val2.mainScript.enemyType.enemyName];
if (extract > 100f)
{
extract = 100f;
}
DestroyEnemy(Array.IndexOf(RoundManager.Instance.SpawnedEnemies.ToArray(), val2.mainScript));
PlayClipFromItemAudio(4, playerID, 1f);
break;
}
}
}
public void TriggerSynthesize()
{
extract -= 50f;
PlayClipFromItemAudio(5, playerID, 1f);
charges++;
}
public void TriggerStim()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
freeCharge = false;
if (!StimmingTeam())
{
charges--;
SelfStimmed();
return;
}
charges--;
int num = -1;
RaycastHit[] source = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 5f, 11012424, (QueryTriggerInteraction)2);
List<RaycastHit> list = source.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
PlayerControllerB val = default(PlayerControllerB);
foreach (RaycastHit item in list)
{
RaycastHit current = item;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)((RaycastHit)(ref current)).transform == (Object)(object)((Component)player).transform) && !val.isPlayerDead)
{
num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val);
ModBase.als.LogInfo((object)("Found component on " + num));
break;
}
}
if (num == -1)
{
charges++;
}
else if (NetworkManager.Singleton.IsHost)
{
TriggerStimClientRpc(num);
}
else
{
TriggerStimServerRpc(num);
}
}
[ServerRpc(RequireOwnership = false)]
public void TriggerStimServerRpc(int playerID)
{
TriggerStimClientRpc(playerID);
}
[ClientRpc]
public void TriggerStimClientRpc(int id)
{
if (id == Instance.playerID)
{
Instance.SelfStimmed();
}
}
public void SelfStimmed()
{
PlayClipFromItemAudio(6, playerID, 1f);
if (player.health >= maxHealth)
{
PlayerControllerB obj = player;
obj.drunkness += 0.5f;
}
else
{
PlayerControllerB obj2 = player;
obj2.drunkness += 0.2f;
}
sprintMeter += 0.2f;
if (sprintMeter > 1f)
{
sprintMeter = 1f;
}
PlayerControllerB obj3 = player;
obj3.health += (int)((float)maxHealth * 0.3f);
if (player.health > maxHealth)
{
player.health = maxHealth;
}
player.criticallyInjured = false;
stimmed = true;
}
private bool HackAvailable()
{
return HackTargetExists() && battery >= 0.15f && abilityCooldown <= 0f;
}
private bool HackTargetExists()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0073: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
RaycastHit[] source = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 6f, 1 << LayerMask.NameToLayer("MapHazards"), (QueryTriggerInteraction)2);
List<RaycastHit> list = source.ToList();
list.AddRange(Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 6f, 1 << LayerMask.NameToLayer("Default"), (QueryTriggerInteraction)2));
TerminalAccessibleObject val = default(TerminalAccessibleObject);
foreach (RaycastHit item in list)
{
RaycastHit current = item;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<TerminalAccessibleObject>(ref val) && !Physics.Linecast(((Component)player.gameplayCamera).transform.position, ((RaycastHit)(ref current)).point, StartOfRound.Instance.collidersAndRoomMask))
{
return true;
}
}
return false;
}
private void BeginHack()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
PlayClipFromItemAudio(8, playerID, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 30f, 1f, 0, false, 0);
}
public void TriggerHack()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0073: 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)
RaycastHit[] source = Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 6f, 1 << LayerMask.NameToLayer("Default"), (QueryTriggerInteraction)2);
List<RaycastHit> list = source.ToList();
list.AddRange(Physics.RaycastAll(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, 6f, 1 << LayerMask.NameToLayer("MapHazards"), (QueryTriggerInteraction)2));
TerminalAccessibleObject val = default(TerminalAccessibleObject);
foreach (RaycastHit item in list)
{
RaycastHit current = item;
if (((Component)((RaycastHit)(ref current)).transform).TryGetComponent<TerminalAccessibleObject>(ref val))
{
val.CallFunctionFromTerminal();
battery -= 0.15f;
abilityCooldown = 5f;
}
}
}
public void DestroyHeadlamp()
{
if (((NetworkBehaviour)this).NetworkManager.IsHost)
{
DestroyHeadlampClientRpc(playerID);
}
else
{
DestroyHeadlampServerRpc(playerID);
}
}
[ServerRpc(RequireOwnership = false)]
public void DestroyHeadlampServerRpc(int playerID)
{
DestroyHeadlampClientRpc(playerID);
}
[ClientRpc]
public void DestroyHeadlampClientRpc(int playerID)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
Object.Destroy((Object)(object)((Component)val).GetComponent<RoleManager>().headlamp);
((Component)val).GetComponent<RoleManager>().headlamp = null;
if (playerID == this.playerID)
{
((Component)((Component)batteryBar).transform.parent).gameObject.SetActive(false);
}
}
public void CreateHeadlamp()
{
if (((NetworkBehaviour)this).NetworkManager.IsHost)
{
CreateHeadlampClientRpc(playerID);
}
else
{
CreateHeadlampServerRpc(playerID);
}
}
[ServerRpc(RequireOwnership = false)]
public void CreateHeadlampServerRpc(int playerID)
{
CreateHeadlampClientRpc(playerID);
}
[ClientRpc]
public void CreateHeadlampClientRpc(int playerID)
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
if (!((Object)(object)((Component)val).GetComponent<RoleManager>().headlamp != (Object)null))
{
GameObject val2 = Object.Instantiate<GameObject>(ModBase.assets.LoadAsset<GameObject>("Headlamp"));
((Component)val).GetComponent<RoleManager>().headlamp = val2;
Light component = val2.GetComponent<Light>();
component.colorTemperature = 4677f;
component.useColorTemperature = true;
component.lightShadowCasterMode = (LightShadowCasterMode)2;
component.cookie = (Texture)(object)Resources.Load<Texture2D>("flashlightCookie2 4");
val2.transform.parent = ((Component)val).transform.Find("PlayerEye");
val2.transform.localPosition = new Vector3(-0.1f, 0.3f, 0f);
val2.transform.rotation = new Quaternion(0f, 0f, 0f, 0f);
val2.SetActive(false);
if (playerID == this.playerID)
{
((Component)((Component)batteryBar).transform.parent).gameObject.SetActive(true);
}
}
}
public void SyncLamp(bool active)
{
PlayClipFromItemAudio(7, playerID, 1f);
if (((NetworkBehaviour)this).NetworkManager.IsHost)
{
SyncLampClientRpc(playerID, active);
}
else
{
SyncLampServerRpc(playerID, active);
}
}
[ServerRpc(RequireOwnership = false)]
public void SyncLampServerRpc(int playerID, bool active)
{
SyncLampClientRpc(playerID, active);
}
[ClientRpc]
public void SyncLampClientRpc(int playerID, bool active)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
((Component)val).GetComponent<RoleManager>().headlamp.SetActive(active);
}
}
public class RoleTag
{
public enum Ids
{
SPRINT_MULTIPLIER,
SPEED_MULTIPLIER,
MAX_HEALTH,
WEIGHT_PENALTY,
OXYGEN,
FALL_DAMAGE,
ATTACK_DAMAGE,
WEIGHT_PENALTY_THRESH,
FOOTSTEP_VOLUME,
SCAN_RANGE,
SCAN_WALL,
THREAT_LEVEL,
BULLET_DAMAGE,
ALWAYS_CLOCK,
HEADLAMP,
SPRINT_TIME,
FOG_VISIBILITY
}
public int Id;
public float Power;
public RoleTag(int id, float power)
{
Id = id;
Power = power;
}
public RoleTag(int id)
{
Id = id;
Power = 1f;
}
}
}
namespace EmployeeClasses.Patches
{
internal class GameNetworkManagerPatch
{
}
internal class HUDManagerPatch
{
[HarmonyPatch(typeof(HUDManager), "UpdateHealthUI")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> UpdateHealthUIPatch(IEnumerable<CodeInstruction> instructions)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
MethodInfo method = typeof(RoleManager).GetMethod("GetMaxHealth");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldc_I4_S && list[i].operand.ToString() == "100")
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)method));
}
}
return list.AsEnumerable();
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPAtch
{
[HarmonyPatch(typeof(PlayerControllerB), "Awake")]
[HarmonyPrefix]
public static void AwakePatch(PlayerControllerB __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0033: 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)
GameObject val = new GameObject("BeaconLight");
val.transform.parent = ((Component)__instance).transform;
val.transform.localPosition = new Vector3(0f, 2.6f, 0f);
Light val2 = val.AddComponent<Light>();
val2.type = (LightType)2;
val2.color = new Color(0.2f, 0.8f, 0.2f);
val2.intensity = 3f;
val2.range = 3f;
val.SetActive(false);
((TMP_Text)__instance.usernameBillboardText).verticalAlignment = (VerticalAlignmentOptions)1024;
}
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
[HarmonyPostfix]
public static void LocalPlayer(ref PlayerControllerB __instance)
{
RoleManager.Instance = ((Component)__instance).gameObject.GetComponent<RoleManager>();
RoleManager.Instance.CreateHUD();
RoleManager.Instance.SyncRoles();
RoleManager.Instance.SyncClassObjects();
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> SpoofSprintMultiplier(IEnumerable<CodeInstruction> instructions)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
FieldInfo field = typeof(PlayerControllerB).GetField("sprintMultiplier", BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo method = typeof(RoleManager).GetMethod("GetSprintMultiplier", BindingFlags.Static | BindingFlags.Public);
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
{
list[i] = new CodeInstruction(OpCodes.Call, (object)method);
list.RemoveAt(i - 1);
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> SpoofSprintMeter(IEnumerable<CodeInstruction> instructions)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
FieldInfo field = typeof(PlayerControllerB).GetField("sprintMeter", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method = typeof(RoleManager).GetMethod("GetSprintMeter", BindingFlags.Static | BindingFlags.Public);
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
{
list[i] = new CodeInstruction(OpCodes.Call, (object)method);
list.RemoveAt(i - 1);
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> SpoofSprintMeterLate(IEnumerable<CodeInstruction> instructions)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
FieldInfo field = typeof(PlayerControllerB).GetField("sprintMeter", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method = typeof(RoleManager).GetMethod("GetSprintMeter", BindingFlags.Static | BindingFlags.Public);
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
{
list[i] = new CodeInstruction(OpCodes.Call, (object)method);
list.RemoveAt(i - 1);
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
[HarmonyPostfix]
public static void CorrectMeterUI(PlayerControllerB __instance, bool ___isPlayerControlled, bool ___isPlayerDead, Image ___sprintMeterUI, float ___drunkness, ref bool ___isExhausted, bool ___isSprinting, bool ___isWalking, int ___isMovementHindered, float ___sprintTime)
{
if (!((NetworkBehaviour)__instance).IsOwner || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject) || !___isPlayerControlled || ___isPlayerDead)
{
return;
}
float num = RoleManager.Instance.sprintMeter;
float num2 = 1f;
if (___drunkness > 0.02f)
{
num2 *= Mathf.Abs(StartOfRound.Instance.drunknessSpeedEffect.Evaluate(___drunkness) - 1.25f);
}
if (___isSprinting)
{
num = Mathf.Clamp(num - Time.deltaTime / (___sprintTime * RoleManager.Instance.sprintTime) * RoleManager.GetCarryWeight(0f) * num2, 0f, 1f);
}
else if (___isMovementHindered > 0)
{
if (___isWalking)
{
num = Mathf.Clamp(num - Time.deltaTime / (___sprintTime * RoleManager.Instance.sprintTime) * num2 * 0.5f, 0f, 1f);
}
}
else
{
num = (___isWalking ? Mathf.Clamp(num + Time.deltaTime / (___sprintTime * RoleManager.Instance.sprintTime + 9f) * num2, 0f, 1f) : Mathf.Clamp(num + Time.deltaTime / (___sprintTime * RoleManager.Instance.sprintTime + 4f) * num2, 0f, 1f));
if (___isExhausted && num > 0.2f)
{
___isExhausted = false;
}
}
RoleManager.Instance.sprintMeter = num;
___sprintMeterUI.fillAmount = num;
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPrefix]
public static void CalculateCarryWeight(float ___carryWeight)
{
if (!((Object)(object)RoleManager.Instance == (Object)null))
{
if (Mathf.RoundToInt(Mathf.Clamp(___carryWeight - 1f, 0f, 100f) * 105f) > RoleManager.Instance.weightPenaltyThreshhold)
{
RoleManager.Instance.carryWeight = (___carryWeight - 1f) * RoleManager.Instance.weightPenalty + 1f;
}
else
{
RoleManager.Instance.carryWeight = ___carryWeight;
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> SpoofCarryWeight(IEnumerable<CodeInstruction> instructions)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method = typeof(RoleManager).GetMethod("GetCarryWeight");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field)
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)method));
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPrefix]
public static void Update(PlayerControllerB __instance)
{
if (!((Object)(object)RoleManager.Instance == (Object)null) && ((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
{
if (__instance.isSprinting)
{
RoleManager.Instance.sprintMultiplier = Mathf.Lerp(RoleManager.Instance.sprintMultiplier, RoleManager.Instance.maxSprintSpeed, Time.deltaTime * 1f);
}
else
{
RoleManager.Instance.sprintMultiplier = Mathf.Lerp(RoleManager.Instance.sprintMultiplier, 1f, 10f * Time.deltaTime);
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "SetFaceUnderwaterFilters")]
[HarmonyPostfix]
public static void DrowningPostfix(ref bool ___isPlayerDead, ref bool ___isUnderwater, ref Collider ___underwaterCollider, ref Camera ___gameplayCamera)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (___isPlayerDead || (Object)(object)RoleManager.Instance == (Object)null)
{
return;
}
if (___isUnderwater && (Object)(object)___underwaterCollider != (Object)null)
{
Bounds bounds = ___underwaterCollider.bounds;
if (((Bounds)(ref bounds)).Contains(((Component)___gameplayCamera).transform.position))
{
RoleManager.Instance.drowningTimer -= Time.deltaTime / 10f;
goto IL_009a;
}
}
RoleManager.Instance.drowningTimer = Mathf.Clamp(RoleManager.Instance.drowningTimer + Time.deltaTime, 0.1f, RoleManager.Instance.oxygenReserves);
goto IL_009a;
IL_009a:
StartOfRound.Instance.drowningTimer = RoleManager.Instance.drowningTimer + Time.deltaTime / 10f;
if (RoleManager.Instance.drowningTimer < 0f)
{
RoleManager.Instance.drowningTimer = RoleManager.Instance.oxygenReserves;
}
}
[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
[HarmonyPrefix]
public static void DamagePrefix(ref int __0, bool ___takingFallDamage, CauseOfDeath causeOfDeath)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
if (___takingFallDamage)
{
__0 = (int)((float)__0 * RoleManager.Instance.fallDamage);
}
if ((int)causeOfDeath == 7)
{
__0 = (int)((float)__0 * RoleManager.Instance.bulletDamage);
}
RoleManager.Instance.stimmed = false;
if (__0 >= 10)
{
RoleManager.Instance.sprintMeter = Mathf.Clamp(RoleManager.Instance.sprintMeter + (float)__0 / 125f, 0f, 1f);
}
}
[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> DamagePlayerTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
MethodInfo method = typeof(RoleManager).GetMethod("GetMaxHealth");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldc_I4_S && list[i].operand.ToString() == "100")
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)method));
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepSound")]
[HarmonyPrefix]
public static bool PlayFootstepSound(ref PlayerControllerB __instance, int ___previousFootstepClip)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
__instance.GetCurrentMaterialStandingOn();
int num = Random.Range(0, StartOfRound.Instance.footstepSurfaces[__instance.currentFootstepSurfaceIndex].clips.Length);
if (num == ___previousFootstepClip)
{
num = (num + 1) % StartOfRound.Instance.footstepSurfaces[__instance.currentFootstepSurfaceIndex].clips.Length;
}
__instance.movementAudio.pitch = Random.Range(0.93f, 1.07f);
bool num2;
if (((NetworkBehaviour)__instance).IsOwner)
{
num2 = __instance.isSprinting;
}
else
{
AnimatorStateInfo currentAnimatorStateInfo = __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(0);
num2 = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("Sprinting");
}
bool flag = num2;
float footstepVolume = ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.9f);
if (!flag)
{
footstepVolume = ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.6f);
}
__instance.movementAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[__instance.currentFootstepSurfaceIndex].clips[num], footstepVolume);
___previousFootstepClip = num;
WalkieTalkie.TransmitOneShotAudio(__instance.movementAudio, StartOfRound.Instance.footstepSurfaces[__instance.currentFootstepSurfaceIndex].clips[num], footstepVolume);
return false;
}
[HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepServer")]
[HarmonyPrefix]
public static bool PlayFootstepServer(ref PlayerControllerB __instance)
{
//IL_0093: 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)
if (!__instance.isClimbingLadder && !__instance.inSpecialInteractAnimation && !((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)
{
bool flag = __instance.isInHangarShipRoom && __instance.playersManager.hangarDoorsClosed;
if (__instance.isSprinting)
{
RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 22f, ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.6f), 0, flag, 7);
}
else
{
RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 17f, ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.4f), 0, flag, 7);
}
__instance.PlayFootstepSound();
}
return false;
}
[HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepLocal")]
[HarmonyPrefix]
public static bool PlayFootstepLocal(ref PlayerControllerB __instance)
{
//IL_00a2: 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)
if (!__instance.isClimbingLadder && !__instance.inSpecialInteractAnimation && (__instance.isTestingPlayer || (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled)))
{
bool flag = __instance.isInHangarShipRoom && __instance.playersManager.hangarDoorsClosed;
if (__instance.isSprinting)
{
RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 22f, ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.6f), 0, flag, 7);
}
else
{
RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 17f, ((Component)__instance).GetComponent<RoleManager>().GetFootstepVolume(0.4f), 0, flag, 7);
}
__instance.PlayFootstepSound();
}
return false;
}
[HarmonyPatch(typeof(HUDManager), "AssignNewNodes")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> SpoofScanRange(IEnumerable<CodeInstruction> instructions)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
MethodInfo method = typeof(RoleManager).GetMethod("GetScanRange");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldc_R4)
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)method));
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(HUDManager), "MeetsScanNodeRequirements")]
[HarmonyPrefix]
public static void MeetsScanNodeRequirements(ref ScanNodeProperties __0)
{
__0.maxRange = (int)((float)__0.maxRange * RoleManager.Instance.scanRange);
__0.requiresLineOfSight = !RoleManager.Instance.scanWall;
}
[HarmonyPatch(typeof(HUDManager), "MeetsScanNodeRequirements")]
[HarmonyPostfix]
public static void MeetsScanNodeRequirementsUndo(ref ScanNodeProperties __0)
{
__0.maxRange = (int)((float)__0.maxRange / RoleManager.Instance.scanRange);
}
[HarmonyPatch(typeof(PlayerControllerB), "IVisibleThreat.GetThreatLevel")]
[HarmonyPostfix]
public static void SpoofThreatLevel(ref int __result)
{
__result += RoleManager.GetThreatLevel();
}
[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
[HarmonyPrefix]
public static void JumpPatch(PlayerControllerB __instance, bool ___isJumping, float ___playerSlidingTimer)
{
if (!__instance.quickMenuManager.isMenuOpen && __instance.isPlayerControlled && !__instance.inSpecialInteractAnimation && !__instance.isTypingChat && (__instance.isMovementHindered <= 0 || __instance.isUnderwater) && !__instance.isExhausted && __instance.thisController.isGrounded && (!___isJumping || __instance.IsPlayerNearGround()) && !___isJumping && (!__instance.isPlayerSliding || ___playerSlidingTimer > 2.5f) && !__instance.isCrouching)
{
RoleManager.Instance.sprintMeter = Mathf.Clamp(RoleManager.Instance.sprintMeter - 0.08f, 0f, 1f);
}
}
}
[HarmonyPatch]
internal class QuickMenuManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")]
public static void GUIAwake()
{
if (RolesGUI.instance == null)
{
new RolesGUI();
}
RolesGUI.instance.OpenMenu();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")]
public static void GUIAsleep()
{
RolesGUI.instance.CloseMenu();
}
}
internal class RoundManagerPatch
{
[HarmonyPatch(typeof(RoundManager), "SetSteamValveTimes")]
[HarmonyPostfix]
public static void SteamValvePatch()
{
SteamValveHazard[] array = Object.FindObjectsOfType<SteamValveHazard>();
SteamValveHazard[] array2 = array;
foreach (SteamValveHazard val in array2)
{
((Component)((Component)val).transform.parent.Find("FogZoneContainer/FogZone")).GetComponent<LocalVolumetricFog>().parameters.distanceFadeEnd *= RoleManager.Instance.fogVisibility;
}
}
}
[HarmonyPatch]
internal class ShovelPatch
{
[HarmonyPatch(typeof(Shovel), "HitShovel")]
[HarmonyPrefix]
private static void HitShovelPatch(ref int ___shovelHitForce)
{
___shovelHitForce = RoleManager.Instance.attackDamage;
}
}
internal class StartOfRoundPatch
{
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
public static void AwakePatch(ref StartOfRound __instance)
{
RolesGUI.instance = null;
PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
((Component)val).gameObject.AddComponent<RoleManager>();
}
}
private static void CreateNetworkManager()
{
//IL_0059: 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_0081: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)StartOfRound.Instance).IsServer || ((NetworkBehaviour)StartOfRound.Instance).IsHost)
{
if ((Object)(object)RoleManager.Instance == (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(ModBase.assets.LoadAsset<GameObject>("RoleManager"));
val.AddComponent<RoleManager>();
SceneManager.MoveGameObjectToScene(val, ((Component)StartOfRound.Instance).gameObject.scene);
val.GetComponent<NetworkObject>().Spawn(false);
ManualLogSource als = ModBase.als;
Scene scene = val.scene;
als.LogInfo((object)("Created RoleManager. Scene is: '" + ((Scene)(ref scene)).name + "'"));
}
else
{
ModBase.als.LogWarning((object)"RoleManager already exists?");
}
}
}
[HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> ReviveDeadPlayersTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
MethodInfo method = typeof(RoleManager).GetMethod("GetMaxHealth");
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Ldc_I4_S && list[i].operand.ToString() == "100")
{
list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)method));
}
}
return list.AsEnumerable();
}
[HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")]
[HarmonyPostfix]
public static void ReviveDeadPlayersPatch()
{
RoleManager.Instance.Revive();
}
[HarmonyPatch(typeof(StartOfRound), "Update")]
[HarmonyPostfix]
public static void UpdatePatch()
{
if (!((Object)(object)RoleManager.Instance == (Object)null))
{
RoleManager.Instance.UpdateIt();
}
}
}
internal class TimeOfDayPatch
{
[HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")]
[HarmonyPostfix]
public static void SetInsideLightingDimnessPatch()
{
if (RoleManager.Instance.alwaysClock && StartOfRound.Instance.localPlayerController.isCrouching)
{
HUDManager.Instance.SetClockVisible(true);
}
}
}
}
namespace EmployeeClasses.Inputs
{
internal class Keybinds : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction SkillKey { get; set; }
}
}
namespace EmployeeClasses.GUI
{
internal class RolesGUI
{
public static RolesGUI instance;
public GameObject mainPanel;
public GameObject classSelect;
public GameObject buttons;
public TextMeshProUGUI currentRole;
public TextMeshProUGUI abilityTip;
private List<Role> roles = new List<Role>
{
new Role("Scout", new List<RoleTag>
{
new RoleTag(0, 1.3f),
new RoleTag(2, 50f),
new RoleTag(3, 1.7f),
new RoleTag(4, 1.8f),
new RoleTag(5, 0.5f),
new RoleTag(7, 30f)
}, "BEACON", ""),
new Role("Brute", new List<RoleTag>
{
new RoleTag(8, 1.05f),
new RoleTag(2, 200f),
new RoleTag(3, 0.5f),
new RoleTag(1, 0.85f),
new RoleTag(5, 2f),
new RoleTag(6, 2f),
new RoleTag(11, 4f)
}, "KICK", ""),
new Role("Researcher", new List<RoleTag>
{
new RoleTag(8, 0.5f),
new RoleTag(2, 80f),
new RoleTag(5, 1.12f),
new RoleTag(9, 2f),
new RoleTag(3, 1.2f),
new RoleTag(10)
}, "STIM", ""),
new Role("Maintenance", new List<RoleTag>
{
new RoleTag(8, 1.1f),
new RoleTag(0, 0.9f),
new RoleTag(12, 0.75f),
new RoleTag(13),
new RoleTag(14),
new RoleTag(15, 1.15f),
new RoleTag(16, 0.5f)
}, "HACK", ""),
new Role("Employee", new List<RoleTag>(), "Just a boring old asset")
};
public RolesGUI()
{
instance = this;
CreateMenu();
}
public void ShowTip(string text)
{
((TMP_Text)abilityTip).text = text;
((Component)abilityTip).gameObject.SetActive(true);
}
public void ShowTip(string text, Color color)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)abilityTip).text = text;
((Graphic)abilityTip).color = color;
((Component)abilityTip).gameObject.SetActive(true);
}
public void HideTip()
{
((Component)abilityTip).gameObject.SetActive(false);
}
public void CreateMenu()
{
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_017e: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Expected O, but got Unknown
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Expected O, but got Unknown
mainPanel = Object.Instantiate<GameObject>(ModBase.assets.LoadAsset<GameObject>("ClassesHUD"), GameObject.Find("Systems/UI").transform);
((Component)mainPanel.transform.Find("Ability")).gameObject.SetActive(true);
abilityTip = ((Component)mainPanel.transform.Find("Ability/Tip")).GetComponent<TextMeshProUGUI>();
classSelect = ((Component)mainPanel.transform.Find("ClassSelect")).gameObject;
currentRole = ((Component)classSelect.transform.Find("Current")).GetComponent<TextMeshProUGUI>();
buttons = ((Component)classSelect.transform.Find("Buttons")).gameObject;
Transform val = buttons.transform.Find("Button");
GameObject val2 = ((Component)val).gameObject;
val2.GetComponent<Button>().onClick = new ButtonClickedEvent();
((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
SelectClass(roles[0]);
});
((Object)val2).name = roles[0].name;
((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = roles[0].name;
for (int j = 1; j < roles.Count; j++)
{
val2 = Object.Instantiate<GameObject>(val2, buttons.transform);
val2.transform.position = new Vector3(val2.transform.position.x, val2.transform.position.y - (float)(40 * j), val2.transform.position.z);
int i = j;
val2.GetComponent<Button>().onClick = new ButtonClickedEvent();
((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
SelectClass(roles[i]);
});
((Object)val2).name = roles[j].name;
((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = roles[j].name;
}
}
public void OpenMenu()
{
classSelect.SetActive(true);
if (StartOfRound.Instance.inShipPhase || ((NetworkBehaviour)StartOfRound.Instance).IsHost)
{
buttons.SetActive(true);
}
else
{
buttons.SetActive(false);
}
}
public void CloseMenu()
{
classSelect.SetActive(false);
}
private void SelectClass(Role role)
{
((TMP_Text)currentRole).text = "Role: " + role.name + " ";
RoleManager.Instance.changeRole(role);
RoleManager.Instance.applyRole(StartOfRound.Instance.localPlayerController);
HUDManager.Instance.AddTextToChatOnServer("<color=#00FF00>" + StartOfRound.Instance.localPlayerController.playerUsername + "</color>: <color=#FFFF00>" + role.name + "</color>", -1);
}
}
}