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.Versioning;
using BepInEx;
using HarmonyLib;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("REPOIMP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPOIMP")]
[assembly: AssemblyTitle("REPOIMP")]
[assembly: AssemblyVersion("1.0.0.0")]
public class RepoFreecamController : MonoBehaviour
{
public KeyCode toggleKey = (KeyCode)286;
public float moveSpeed = 10f;
public float lookSpeed = 2f;
private bool _freecamEnabled = false;
private Camera _cam;
private Vector2 _rotation;
private void Start()
{
_cam = Camera.main;
if ((Object)(object)_cam == (Object)null)
{
Debug.LogError((object)"Freecam: Main camera not found.");
}
}
private void Update()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(toggleKey))
{
ToggleFreecam();
}
if (_freecamEnabled)
{
UpdateFreecamMovement();
}
}
private void ToggleFreecam()
{
_freecamEnabled = !_freecamEnabled;
if (_freecamEnabled)
{
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
}
else
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
}
private void UpdateFreecamMovement()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
float num = Input.GetAxis("Mouse X") * lookSpeed;
float num2 = Input.GetAxis("Mouse Y") * lookSpeed;
_rotation.x += num;
_rotation.y -= num2;
_rotation.y = Mathf.Clamp(_rotation.y, -89f, 89f);
((Component)_cam).transform.rotation = Quaternion.Euler(_rotation.y, _rotation.x, 0f);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(Input.GetAxis("Horizontal"), (float)((Input.GetKey((KeyCode)32) ? 1 : 0) - (Input.GetKey((KeyCode)306) ? 1 : 0)), Input.GetAxis("Vertical"));
Transform transform = ((Component)_cam).transform;
transform.position += ((Component)_cam).transform.TransformDirection(val) * moveSpeed * Time.unscaledDeltaTime;
}
}
[BepInPlugin("net.regularben.repoimp", "REPO Impostor", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RepoImp : BaseUnityPlugin
{
private void Awake()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"[RepoImp] Plugin loaded and initialized.");
Harmony val = new Harmony("net.regularben.repoimp");
val.PatchAll();
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)("[RepoImp] Scene loaded: " + ((Scene)(ref scene)).name));
if ((Object)(object)GameObject.Find("RepoImpHandler") == (Object)null)
{
GameObject val = new GameObject("RepoImpHandler");
val.AddComponent<RepoImpHandler>();
Object.DontDestroyOnLoad((Object)(object)val);
}
}
}
public class RepoImpHandler : MonoBehaviour
{
[CompilerGenerated]
private sealed class <ScanIDsAfterDelay>d__49 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RepoImpHandler <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ScanIDsAfterDelay>d__49(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = null;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>4__this.ScanIDs();
<>4__this.GetLocalClientID();
<>4__this.DetermineIfHost();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <TriggerLightsOut>d__32 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RepoImpHandler <>4__this;
private IEnumerable<Light> <flashlights>5__1;
private List<float> <originalIntensities>5__2;
private int <i>5__3;
private IEnumerator<Light> <>s__4;
private Light <light>5__5;
private IEnumerator<Light> <>s__6;
private Light <light>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TriggerLightsOut>d__32(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<flashlights>5__1 = null;
<originalIntensities>5__2 = null;
<>s__4 = null;
<light>5__5 = null;
<>s__6 = null;
<light>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<flashlights>5__1 = from l in Object.FindObjectsOfType<Light>()
where ((Object)l).name.ToLower().Contains("flash")
select l;
<originalIntensities>5__2 = new List<float>();
<>s__4 = <flashlights>5__1.GetEnumerator();
try
{
while (<>s__4.MoveNext())
{
<light>5__5 = <>s__4.Current;
<originalIntensities>5__2.Add(<light>5__5.intensity);
<light>5__5.intensity = 0f;
<light>5__5 = null;
}
}
finally
{
if (<>s__4 != null)
{
<>s__4.Dispose();
}
}
<>s__4 = null;
<>2__current = (object)new WaitForSeconds(60f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<i>5__3 = 0;
<>s__6 = <flashlights>5__1.GetEnumerator();
try
{
while (<>s__6.MoveNext())
{
<light>5__7 = <>s__6.Current;
if ((Object)(object)<light>5__7 != (Object)null && <i>5__3 < <originalIntensities>5__2.Count)
{
<light>5__7.intensity = <originalIntensities>5__2[<i>5__3];
}
<i>5__3++;
<light>5__7 = null;
}
}
finally
{
if (<>s__6 != null)
{
<>s__6.Dispose();
}
}
<>s__6 = null;
Debug.Log((object)"[RepoImp] Lights out triggered.");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <TriggerVoiceSabotage>d__33 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RepoImpHandler <>4__this;
private List<MonoBehaviour> <voiceManagers>5__1;
private List<MonoBehaviour>.Enumerator <>s__2;
private MonoBehaviour <voice>5__3;
private PropertyInfo <enabledProp>5__4;
private List<MonoBehaviour>.Enumerator <>s__5;
private MonoBehaviour <voice>5__6;
private PropertyInfo <enabledProp>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TriggerVoiceSabotage>d__33(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<voiceManagers>5__1 = null;
<>s__2 = default(List<MonoBehaviour>.Enumerator);
<voice>5__3 = null;
<enabledProp>5__4 = null;
<>s__5 = default(List<MonoBehaviour>.Enumerator);
<voice>5__6 = null;
<enabledProp>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<voiceManagers>5__1 = (from obj in Object.FindObjectsOfType<MonoBehaviour>()
where ((object)obj).GetType().Name.ToLower().Contains("voice")
select obj).ToList();
<>s__2 = <voiceManagers>5__1.GetEnumerator();
try
{
while (<>s__2.MoveNext())
{
<voice>5__3 = <>s__2.Current;
<enabledProp>5__4 = ((object)<voice>5__3).GetType().GetProperty("enabled", BindingFlags.Instance | BindingFlags.Public);
if (<enabledProp>5__4 != null && <enabledProp>5__4.CanWrite)
{
<enabledProp>5__4.SetValue(<voice>5__3, false);
}
<enabledProp>5__4 = null;
<voice>5__3 = null;
}
}
finally
{
((IDisposable)<>s__2).Dispose();
}
<>s__2 = default(List<MonoBehaviour>.Enumerator);
<>2__current = (object)new WaitForSeconds(30f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__5 = <voiceManagers>5__1.GetEnumerator();
try
{
while (<>s__5.MoveNext())
{
<voice>5__6 = <>s__5.Current;
<enabledProp>5__7 = ((object)<voice>5__6).GetType().GetProperty("enabled", BindingFlags.Instance | BindingFlags.Public);
if (<enabledProp>5__7 != null && <enabledProp>5__7.CanWrite)
{
<enabledProp>5__7.SetValue(<voice>5__6, true);
}
<enabledProp>5__7 = null;
<voice>5__6 = null;
}
}
finally
{
((IDisposable)<>s__5).Dispose();
}
<>s__5 = default(List<MonoBehaviour>.Enumerator);
Debug.Log((object)"[RepoImp] Voice sabotage triggered.");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private float _lightsCooldown = 60f;
private float _voiceCooldown = 30f;
private float _spawnCooldown = 60f;
private float _lastLightsTime = -999f;
private float _lastVoiceTime = -999f;
private float _lastSpawnTime = -999f;
private List<string> _spawnableEnemies = new List<string> { "Rugrat", "Spewer", "Banger", "Upscream", "ApexPredator" };
private GameObject _keybindsMenu;
private Text _lightsKeyText;
private Text _voiceKeyText;
private Text _spawnKeyText;
private string _waitingForKeybind = null;
private bool _levelInitialized = false;
private object _levelGeneratorInstance = null;
private Type _levelGeneratorType = null;
private bool _impostorSelected = false;
private string _selectedImpostorClientID = "";
private string _localClientID = "";
private bool _resurrectionPrevention = true;
private List<string> _clientIDs = new List<string>();
private List<string> _steamIDs = new List<string>();
private List<object> _trackedBodies = new List<object>();
private GameObject _impostorUI;
private Text _impostorText;
private GameObject _crewUI;
private Text _crewText;
private Canvas _uiCanvas;
private bool _isHost = false;
private void Awake()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
SceneManager.activeSceneChanged += OnActiveSceneChanged;
SceneManager.sceneLoaded += OnSceneLoaded;
Scene activeScene = SceneManager.GetActiveScene();
Debug.Log((object)("[RepoImp] Initial Scene: " + ((Scene)(ref activeScene)).name));
CreateKeybindsMenu();
GetLocalClientID();
}
private void CreateKeybindsMenu()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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)
GameObject val = new GameObject("RepoImpKeybindsCanvas");
Canvas val2 = val.AddComponent<Canvas>();
val2.renderMode = (RenderMode)0;
val2.sortingOrder = 2000;
val.AddComponent<CanvasScaler>();
val.AddComponent<GraphicRaycaster>();
_keybindsMenu = new GameObject("KeybindsMenu");
_keybindsMenu.transform.SetParent(val.transform, false);
RectTransform val3 = _keybindsMenu.AddComponent<RectTransform>();
val3.sizeDelta = new Vector2(300f, 200f);
val3.anchorMin = new Vector2(0.5f, 0.5f);
val3.anchorMax = new Vector2(0.5f, 0.5f);
val3.pivot = new Vector2(0.5f, 0.5f);
val3.anchoredPosition = Vector2.zero;
Image val4 = _keybindsMenu.AddComponent<Image>();
((Graphic)val4).color = new Color(0f, 0f, 0f, 0.8f);
CreateUIText("Keybind Settings", new Vector2(0f, 80f), 24, _keybindsMenu.transform, (TextAnchor)4);
_keybindsMenu.SetActive(false);
}
private Text CreateKeybindEntry(string label, KeyCode key, Vector2 pos)
{
//IL_002b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
CreateUIText(label + ":", new Vector2(-80f, pos.y), 18, _keybindsMenu.transform, (TextAnchor)5);
GameObject val = new GameObject(label + "KeyBtn");
val.transform.SetParent(_keybindsMenu.transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(100f, 25f);
val2.anchoredPosition = pos;
Button val3 = val.AddComponent<Button>();
Image val4 = val.AddComponent<Image>();
((Graphic)val4).color = Color.gray;
Text btnText = CreateUIText(((object)(KeyCode)(ref key)).ToString(), Vector2.zero, 16, val.transform, (TextAnchor)4);
((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
{
_waitingForKeybind = label;
btnText.text = "Press any key...";
});
return btnText;
}
private Text CreateUIText(string text, Vector2 pos, int fontSize, Transform parent, TextAnchor anchor = 4)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Text_" + text);
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = new Vector2(280f, 25f);
val2.anchoredPosition = pos;
Text val3 = val.AddComponent<Text>();
val3.text = text;
val3.font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
val3.fontSize = fontSize;
((Graphic)val3).color = Color.white;
val3.alignment = anchor;
return val3;
}
[IteratorStateMachine(typeof(<TriggerLightsOut>d__32))]
private IEnumerator TriggerLightsOut()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TriggerLightsOut>d__32(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<TriggerVoiceSabotage>d__33))]
private IEnumerator TriggerVoiceSabotage()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TriggerVoiceSabotage>d__33(0)
{
<>4__this = this
};
}
private void TriggerEnemySpawn()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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_007d: 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)
string text = _spawnableEnemies[Random.Range(0, _spawnableEnemies.Count)];
EnemySetup val = default(EnemySetup);
if (!Enemies.TryGetEnemyByName(text, ref val) || (Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("[RepoImp] Could not find EnemySetup for enemy ID: " + text));
return;
}
Vector3 val2 = ((Component)this).transform.position + ((Component)this).transform.forward * 5f;
Quaternion identity = Quaternion.identity;
List<EnemyParent> list = Enemies.SpawnEnemy(val, val2, identity, true);
Debug.Log((object)$"[RepoImp] # of Spawned Enemies: {list.Count}");
if (list == null || list.Count == 0)
{
Debug.LogWarning((object)("[RepoImp] Failed to spawn enemy: " + text));
}
else
{
Debug.Log((object)$"[RepoImp] Spawned enemy: {text} at {val2}");
}
}
private void OnDestroy()
{
SceneManager.activeSceneChanged -= OnActiveSceneChanged;
SceneManager.sceneLoaded -= OnSceneLoaded;
if ((Object)(object)_impostorUI != (Object)null)
{
Object.Destroy((Object)(object)_impostorUI);
}
if ((Object)(object)_crewUI != (Object)null)
{
Object.Destroy((Object)(object)_crewUI);
}
}
private void OnActiveSceneChanged(Scene oldScene, Scene newScene)
{
Debug.Log((object)("[RepoImp] Active Scene Changed: " + ((Scene)(ref oldScene)).name + " → " + ((Scene)(ref newScene)).name));
_impostorSelected = false;
_selectedImpostorClientID = "";
if ((Object)(object)_impostorUI != (Object)null)
{
_impostorUI.SetActive(false);
}
if ((Object)(object)_crewUI != (Object)null)
{
_crewUI.SetActive(false);
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)$"[RepoImp] Scene Loaded: {((Scene)(ref scene)).name}, Mode: {mode}");
((MonoBehaviour)this).StartCoroutine(ScanIDsAfterDelay());
SetupImpostorUI();
SetupCrewUI();
}
private void GetLocalClientID()
{
MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>();
MonoBehaviour[] array2 = array;
foreach (MonoBehaviour val in array2)
{
Type type = ((object)val).GetType();
if (!type.Name.Contains("LocalPlayer") && !type.Name.Contains("Player"))
{
continue;
}
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo[] array3 = fields;
foreach (FieldInfo fieldInfo in array3)
{
string text = fieldInfo.Name.ToLower();
if (!text.Contains("clientid") && !text.Contains("client_id"))
{
continue;
}
try
{
object value = fieldInfo.GetValue(val);
if (value != null)
{
_localClientID = value.ToString();
Debug.Log((object)("[RepoImp] Found local client ID: " + _localClientID));
return;
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[RepoImp] Failed to get local client ID: " + ex.Message));
}
}
}
if (string.IsNullOrEmpty(_localClientID) && _clientIDs.Count > 0)
{
_localClientID = _clientIDs[0];
Debug.Log((object)("[RepoImp] Using fallback local client ID: " + _localClientID));
}
}
private void SetupImpostorUI()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
_uiCanvas = Object.FindObjectOfType<Canvas>();
if ((Object)(object)_uiCanvas == (Object)null)
{
GameObject val = new GameObject("RepoImp_Canvas");
_uiCanvas = val.AddComponent<Canvas>();
_uiCanvas.renderMode = (RenderMode)0;
_uiCanvas.sortingOrder = 1000;
val.AddComponent<CanvasScaler>();
val.AddComponent<GraphicRaycaster>();
}
_impostorUI = new GameObject("ImpostorUI");
_impostorUI.transform.SetParent(((Component)_uiCanvas).transform, false);
RectTransform val2 = _impostorUI.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(1f, 1f);
val2.anchorMax = new Vector2(1f, 1f);
val2.pivot = new Vector2(1f, 1f);
val2.anchoredPosition = new Vector2(-20f, -25f);
val2.sizeDelta = new Vector2(200f, 50f);
_impostorText = _impostorUI.AddComponent<Text>();
_impostorText.text = "IMPOSTOR";
_impostorText.font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
_impostorText.fontSize = 24;
_impostorText.fontStyle = (FontStyle)1;
((Graphic)_impostorText).color = Color.red;
_impostorText.alignment = (TextAnchor)4;
Outline val3 = _impostorUI.AddComponent<Outline>();
((Shadow)val3).effectColor = Color.black;
((Shadow)val3).effectDistance = new Vector2(2f, 2f);
_impostorUI.SetActive(false);
Debug.Log((object)"[RepoImp] Impostor UI setup complete");
}
private void SetupCrewUI()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if ((Object)(object)_uiCanvas == (Object)null)
{
GameObject val = new GameObject("RepoImp_Canvas");
_uiCanvas = val.AddComponent<Canvas>();
_uiCanvas.renderMode = (RenderMode)0;
_uiCanvas.sortingOrder = 1000;
val.AddComponent<CanvasScaler>();
val.AddComponent<GraphicRaycaster>();
}
_crewUI = new GameObject("CrewUI");
_crewUI.transform.SetParent(((Component)_uiCanvas).transform, false);
RectTransform val2 = _crewUI.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(0f, 1f);
val2.anchorMax = new Vector2(0f, 1f);
val2.pivot = new Vector2(0f, 1f);
val2.anchoredPosition = new Vector2(20f, -25f);
val2.sizeDelta = new Vector2(200f, 50f);
_crewText = _crewUI.AddComponent<Text>();
_crewText.text = "CREWMATE";
_crewText.font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
_crewText.fontSize = 24;
_crewText.fontStyle = (FontStyle)1;
((Graphic)_crewText).color = Color.cyan;
_crewText.alignment = (TextAnchor)4;
Outline val3 = _crewUI.AddComponent<Outline>();
((Shadow)val3).effectColor = Color.black;
((Shadow)val3).effectDistance = new Vector2(2f, 2f);
_crewUI.SetActive(false);
Debug.Log((object)"[RepoImp] Crew UI setup complete");
}
private void ScanIDs()
{
_clientIDs.Clear();
_steamIDs.Clear();
MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>();
MonoBehaviour[] array2 = array;
foreach (MonoBehaviour val in array2)
{
Type type = ((object)val).GetType();
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo[] array3 = fields;
foreach (FieldInfo fieldInfo in array3)
{
string text = fieldInfo.Name.ToLower();
if (text.Contains("clientid") || text.Contains("client_id") || text == "clientid")
{
try
{
object value = fieldInfo.GetValue(val);
if (value != null)
{
string text2 = value.ToString();
if (!_clientIDs.Contains(text2) && !string.IsNullOrEmpty(text2))
{
_clientIDs.Add(text2);
}
}
}
catch (Exception ex)
{
Debug.LogWarning((object)("[RepoImp] Failed to get clientID field " + fieldInfo.Name + " in " + type.Name + ": " + ex.Message));
}
}
else
{
if (!text.Contains("steamid") && !text.Contains("steam_id") && !(text == "steamid"))
{
continue;
}
try
{
object value2 = fieldInfo.GetValue(val);
if (value2 != null)
{
string text3 = value2.ToString();
if (!_steamIDs.Contains(text3) && !string.IsNullOrEmpty(text3))
{
_steamIDs.Add(text3);
}
}
}
catch (Exception ex2)
{
Debug.LogWarning((object)("[RepoImp] Failed to get steamID field " + fieldInfo.Name + " in " + type.Name + ": " + ex2.Message));
}
}
}
PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
PropertyInfo[] array4 = properties;
foreach (PropertyInfo propertyInfo in array4)
{
if (!propertyInfo.CanRead)
{
continue;
}
string text4 = propertyInfo.Name.ToLower();
if (text4.Contains("clientid") || text4.Contains("client_id") || text4 == "clientid")
{
try
{
object value3 = propertyInfo.GetValue(val);
if (value3 != null)
{
string text5 = value3.ToString();
if (!_clientIDs.Contains(text5) && !string.IsNullOrEmpty(text5))
{
_clientIDs.Add(text5);
}
}
}
catch (Exception ex3)
{
Debug.LogWarning((object)("[RepoImp] Failed to get clientID property " + propertyInfo.Name + " in " + type.Name + ": " + ex3.Message));
}
}
else
{
if (!text4.Contains("steamid") && !text4.Contains("steam_id") && !(text4 == "steamid"))
{
continue;
}
try
{
object value4 = propertyInfo.GetValue(val);
if (value4 != null)
{
string text6 = value4.ToString();
if (!_steamIDs.Contains(text6) && !string.IsNullOrEmpty(text6))
{
_steamIDs.Add(text6);
}
}
}
catch (Exception ex4)
{
Debug.LogWarning((object)("[RepoImp] Failed to get steamID property " + propertyInfo.Name + " in " + type.Name + ": " + ex4.Message));
}
}
}
}
Debug.Log((object)$"[RepoImp] Found {_clientIDs.Count} client IDs and {_steamIDs.Count} steam IDs.");
}
private void SelectImpostor()
{
if (_clientIDs.Count == 0)
{
Debug.LogWarning((object)"[RepoImp] No client IDs available to select impostor!");
return;
}
_selectedImpostorClientID = _clientIDs[Random.Range(0, _clientIDs.Count)];
_impostorSelected = true;
Debug.Log((object)("[RepoImp] Selected impostor: " + _selectedImpostorClientID));
if (_selectedImpostorClientID == _localClientID)
{
ShowImpostorUI();
Debug.Log((object)"[RepoImp] You are the impostor!");
}
else
{
ShowCrewUI();
Debug.Log((object)"[RepoImp] You are a crewmate.");
}
}
private void ShowImpostorUI()
{
if ((Object)(object)_impostorUI != (Object)null)
{
_impostorUI.SetActive(true);
Debug.Log((object)"[RepoImp] Impostor UI displayed");
}
if ((Object)(object)_crewUI != (Object)null)
{
_crewUI.SetActive(false);
}
}
private void ShowCrewUI()
{
if ((Object)(object)_crewUI != (Object)null)
{
_crewUI.SetActive(true);
Debug.Log((object)"[RepoImp] Crew UI displayed");
}
if ((Object)(object)_impostorUI != (Object)null)
{
_impostorUI.SetActive(false);
}
}
private void HideImpostorUI()
{
if ((Object)(object)_impostorUI != (Object)null)
{
_impostorUI.SetActive(false);
Debug.Log((object)"[RepoImp] Impostor UI hidden");
}
}
private void HideCrewUI()
{
if ((Object)(object)_crewUI != (Object)null)
{
_crewUI.SetActive(false);
Debug.Log((object)"[RepoImp] Crew UI hidden");
}
}
private void HideAllUI()
{
HideImpostorUI();
HideCrewUI();
}
private void DetermineIfHost()
{
_isHost = SemiFunc.IsMasterClientOrSingleplayer();
if (_isHost)
{
Debug.Log((object)"[RepoImp] Host status confirmed. You may use debug features");
}
else
{
Debug.Log((object)"[RepoImp] You are not the host.");
}
}
[IteratorStateMachine(typeof(<ScanIDsAfterDelay>d__49))]
private IEnumerator ScanIDsAfterDelay()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ScanIDsAfterDelay>d__49(0)
{
<>4__this = this
};
}
private void Update()
{
if (!_levelInitialized && TryGetLevelGeneratorInstance(out _levelGeneratorInstance, out _levelGeneratorType))
{
FieldInfo field = _levelGeneratorType.GetField("Generated", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null && (bool)field.GetValue(_levelGeneratorInstance))
{
_levelInitialized = true;
Debug.Log((object)"[RepoImp] Level is initialized (LevelGenerator.Generated == true)");
if (!_impostorSelected && _clientIDs.Count > 0)
{
SelectImpostor();
}
}
}
if (Input.GetKeyDown((KeyCode)289) && SemiFunc.IsMasterClientOrSingleplayer())
{
Debug.Log((object)("[RepoImp] Client IDs: " + string.Join(", ", _clientIDs) + " \nSteam IDs: " + string.Join(", ", _steamIDs)));
Debug.Log((object)("[RepoImp] Local Client ID: " + _localClientID));
Debug.Log((object)("[RepoImp] Selected Impostor: " + _selectedImpostorClientID));
}
if (Input.GetKeyDown((KeyCode)290) && SemiFunc.IsMasterClientOrSingleplayer())
{
if (_clientIDs.Count > 0)
{
SelectImpostor();
}
else
{
Debug.LogWarning((object)"[RepoImp] No client IDs found for impostor selection!");
}
}
if (Input.GetKeyDown((KeyCode)291) && SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_impostorUI != (Object)null)
{
_impostorUI.SetActive(!_impostorUI.activeSelf);
Debug.Log((object)$"[RepoImp] Impostor UI toggled: {_impostorUI.activeSelf}");
}
if (Input.GetKeyDown((KeyCode)292) && SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_crewUI != (Object)null)
{
_crewUI.SetActive(!_crewUI.activeSelf);
Debug.Log((object)$"[RepoImp] Crew UI toggled: {_crewUI.activeSelf}");
}
}
private bool TryGetLevelGeneratorInstance(out object instance, out Type type)
{
type = AppDomain.CurrentDomain.GetAssemblies().SelectMany((Assembly a) => a.GetTypes()).FirstOrDefault((Type t) => t.Name == "LevelGenerator");
if (type != null)
{
FieldInfo field = type.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
if (field != null)
{
instance = field.GetValue(null);
return instance != null;
}
}
instance = null;
return false;
}
}