using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Bobi;
using HarmonyLib;
using R.E.P.O.Roles;
using R.E.P.O.Roles.patches;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("R.E.P.O. Roles")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("R.E.P.O. Roles")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1400cf89-b246-4aa9-983d-84d939d983bb")]
[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 R.E.P.O.Roles
{
[HarmonyPatch(typeof(TruckScreenText))]
internal static class Sender
{
private static bool hasRanOnce;
private static ClassManager manager = new ClassManager();
public static readonly Harmony harmonyPatcher = new Harmony("sender.reporoles.mod");
[HarmonyPatch("ArrowPointAtGoalLogic")]
[HarmonyPrefix]
private static void PrefixMethod()
{
if (!hasRanOnce)
{
manager.rollRole(PlayerController.instance);
Logger.CreateLogSource("ChatMsgMgr").LogInfo((object)"Successfully rolled role!");
hasRanOnce = true;
}
}
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void StartPrefix()
{
hasRanOnce = false;
}
}
public class ClassManager
{
[CompilerGenerated]
private sealed class <waiter>d__18 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public int seconds;
public ClassManager <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <waiter>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds((float)seconds);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
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 Random rnd = new Random();
public int chosenRoleId;
public string chosenRole;
internal static ManualLogSource mls;
public RepoRoles repoRoles = new RepoRoles();
public readonly Harmony harmonyPatcher = new Harmony("patches.reporoles.mod");
public List<string> roleList = new List<string> { "Runner", "Tank", "Gambler" };
private float origMoveSpeed;
private float origSprintSpeed;
private float origCrouchSpeed;
private float speedMultiplier;
private int origPlayerHealth;
private int origMaxPlayerHealth;
private float origJumpForce;
private float origEnergy;
private float origMaxEnergy;
private float origGrabStrength;
public ClassManager()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
if (mls == null)
{
mls = Logger.CreateLogSource("ClassManager");
}
origMoveSpeed = PlayerController.instance.MoveSpeed;
origSprintSpeed = PlayerController.instance.SprintSpeed;
origCrouchSpeed = PlayerController.instance.CrouchSpeed;
speedMultiplier = 1.5f;
origJumpForce = PlayerController.instance.JumpForce;
origPlayerHealth = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
origMaxPlayerHealth = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
origMaxEnergy = PlayerController.instance.EnergyStart;
origGrabStrength = PhysGrabber.instance.grabStrength;
}
[IteratorStateMachine(typeof(<waiter>d__18))]
private IEnumerator waiter(int seconds)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <waiter>d__18(0)
{
<>4__this = this,
seconds = seconds
};
}
public void rollRole(PlayerController __instance)
{
chosenRoleId = rnd.Next(1, 5);
assignRole(chosenRoleId, __instance);
}
public void assignRole(int roleId, PlayerController __instance)
{
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0544: Unknown result type (might be due to invalid IL or missing references)
//IL_0549: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Unknown result type (might be due to invalid IL or missing references)
//IL_0567: Unknown result type (might be due to invalid IL or missing references)
__instance.CrouchSpeed = origCrouchSpeed;
__instance.MoveSpeed = origMoveSpeed;
__instance.SprintSpeed = origSprintSpeed;
__instance.JumpForce = origJumpForce;
__instance.EnergyStart = origMaxEnergy;
__instance.EnergyCurrent = __instance.EnergyStart;
PhysGrabber.instance.grabStrength = origGrabStrength;
AccessTools.Field(typeof(PlayerHealth), "maxHealth").SetValue(PlayerAvatar.instance.playerHealth, origMaxPlayerHealth);
AccessTools.Field(typeof(PlayerHealth), "health").SetValue(PlayerAvatar.instance.playerHealth, origPlayerHealth);
guiManager.showGUI = true;
if (roleId <= 0)
{
mls.LogWarning((object)"Unable to find RoleId! Please contact the mod developer.");
return;
}
switch (roleId)
{
case 1:
mls.LogInfo((object)"Assigning role Runner.");
__instance.CrouchSpeed = origCrouchSpeed * speedMultiplier;
__instance.MoveSpeed = origMoveSpeed * speedMultiplier;
__instance.SprintSpeed = origSprintSpeed * speedMultiplier;
RepoRoles.GUIinstance.text = "Runner";
RepoRoles.GUIinstance.color = Color.yellow;
RepoRoles.GUIinstance.descText = "You run much faster than everyone else!\nPress R to continue";
RepoRoles.GUIinstance.descColor = Color.yellow;
break;
case 2:
mls.LogInfo((object)"Assigning role Tank.");
AccessTools.Field(typeof(PlayerHealth), "maxHealth").SetValue(PlayerAvatar.instance.playerHealth, 200);
AccessTools.Field(typeof(PlayerHealth), "health").SetValue(PlayerAvatar.instance.playerHealth, 200);
__instance.CrouchSpeed = origCrouchSpeed * 0.9f;
__instance.MoveSpeed = origMoveSpeed * 0.9f;
__instance.SprintSpeed = origSprintSpeed * 0.9f;
RepoRoles.GUIinstance.text = "Tank";
RepoRoles.GUIinstance.color = Color.gray;
RepoRoles.GUIinstance.descText = "You walk slower but your hp is doubled!\nPress R to continue";
RepoRoles.GUIinstance.descColor = Color.gray;
break;
case 3:
{
int num = rnd.Next(1, 5);
mls.LogInfo((object)"Assigning role Gambler.");
RepoRoles.GUIinstance.text = "Gambler";
RepoRoles.GUIinstance.color = Color.magenta;
RepoRoles.GUIinstance.descColor = Color.magenta;
switch (num)
{
case 1:
mls.LogMessage((object)"You rolled effect combo 1. You walk, crouch and run slower but you have more health!");
__instance.CrouchSpeed = origCrouchSpeed * 0.9f;
__instance.MoveSpeed = origMoveSpeed * 0.9f;
__instance.SprintSpeed = origSprintSpeed * 0.9f;
AccessTools.Field(typeof(PlayerHealth), "maxHealth").SetValue(PlayerAvatar.instance.playerHealth, 125);
AccessTools.Field(typeof(PlayerHealth), "health").SetValue(PlayerAvatar.instance.playerHealth, 125);
RepoRoles.GUIinstance.descText = "You rolled random effects: You walk, crouch and run slower but you have more health!\nPress R to continue";
break;
case 2:
mls.LogMessage((object)"You rolled effect combo 2. You don\u00b4t jump as high but you walk, crouch and run faster!");
__instance.JumpForce = origJumpForce - 5f;
__instance.CrouchSpeed = origCrouchSpeed * 1.2f;
__instance.MoveSpeed = origMoveSpeed * 1.2f;
__instance.SprintSpeed = origSprintSpeed * 1.2f;
RepoRoles.GUIinstance.descText = "You rolled random effects: You rolled effect combo 2. You don\u00b4t jump as high but you walk, crouch and run faster!\nPress R to continue";
break;
case 3:
mls.LogMessage((object)"You rolled effect combo 3. You have more stamina but you have less health.");
__instance.EnergyStart = origMaxEnergy * 2f;
__instance.EnergyCurrent = __instance.EnergyStart;
AccessTools.Field(typeof(PlayerHealth), "maxHealth").SetValue(PlayerAvatar.instance.playerHealth, 80);
AccessTools.Field(typeof(PlayerHealth), "health").SetValue(PlayerAvatar.instance.playerHealth, 80);
RepoRoles.GUIinstance.descText = "You rolled random effects: You have more stamina but you have less health!\nPress R to continue";
break;
case 4:
mls.LogMessage((object)"You rolled effect combo 4. You\u00b4re stronger but you have less stamina.");
PhysGrabber.instance.grabStrength = origGrabStrength * 1.3f;
__instance.EnergyStart = origMaxEnergy - 10f;
__instance.EnergyCurrent = __instance.EnergyStart;
RepoRoles.GUIinstance.descText = "You rolled random effects: You\u00b4re stronger but you have less stamina!\nPress R to continue";
break;
}
break;
}
case 4:
mls.LogMessage((object)"Assigning role Strongman.");
PhysGrabber.instance.grabStrength = origGrabStrength * 1.5f;
RepoRoles.GUIinstance.text = "Strongman";
RepoRoles.GUIinstance.color = Color.red;
RepoRoles.GUIinstance.descText = "You\u00b4re incredibly strong!\nPress R to continue";
RepoRoles.GUIinstance.descColor = Color.red;
break;
}
}
}
}
namespace R.E.P.O.Roles.patches
{
public class guiManager : MonoBehaviour
{
public static bool showGUI = true;
public GUIStyle style;
public string text;
public Color color = Color.white;
public string descText;
public Color descColor = Color.white;
private void OnGUI()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0065: 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_007f: Expected O, but got Unknown
//IL_0085: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Expected O, but got Unknown
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Expected O, but got Unknown
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_038f: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.RunIsLevel() && showGUI)
{
float num = Screen.width / 2 - 100;
float num2 = Screen.height / 2 - 35;
GUIStyle val = new GUIStyle();
val.fontSize = 40;
val.fontStyle = (FontStyle)1;
val.richText = true;
val.normal.textColor = color;
val.alignment = (TextAnchor)4;
GUIStyle val2 = new GUIStyle(val);
val2.normal.textColor = Color.black;
val2.alignment = (TextAnchor)4;
float num3 = 2f;
GUI.Label(new Rect(num - num3, num2, 200f, 50f), text, val2);
GUI.Label(new Rect(num + num3, num2, 200f, 50f), text, val2);
GUI.Label(new Rect(num, num2 - num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num, num2 + num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num - num3, num2 - num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num - num3, num2 + num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num + num3, num2 - num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num + num3, num2 + num3, 200f, 50f), text, val2);
GUI.Label(new Rect(num, num2, 200f, 50f), text, val);
float num4 = Screen.width / 2 - 100;
float num5 = Screen.height / 2 + 25;
GUIStyle val3 = new GUIStyle();
val3.fontSize = 30;
val3.fontStyle = (FontStyle)1;
val3.richText = true;
val3.normal.textColor = color;
val3.alignment = (TextAnchor)4;
GUIStyle val4 = new GUIStyle(val3);
val4.normal.textColor = Color.black;
val4.alignment = (TextAnchor)4;
float num6 = 2f;
GUI.Label(new Rect(num4 - num6, num5, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4 + num6, num5, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4, num5 - num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4, num5 + num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4 - num6, num5 - num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4 - num6, num5 + num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4 + num6, num5 - num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4 + num6, num5 + num6, 200f, 50f), descText, val4);
GUI.Label(new Rect(num4, num5, 200f, 50f), descText, val3);
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)114))
{
showGUI = !showGUI;
}
}
}
}
namespace Bobi
{
[BepInPlugin("reporoles.mod", "RepoRoles", "1.0")]
public class RepoRoles : BaseUnityPlugin
{
public const string pluginGuid = "reporoles.mod";
public const string pluginName = "RepoRoles";
public const string pluginVersion = "1.0";
public readonly Harmony harmony = new Harmony("reporoles.mod");
public static RepoRoles Instance;
internal ManualLogSource mls;
public static Font newFont;
public static guiManager GUIinstance;
private void Awake()
{
mls = Logger.CreateLogSource("reporoles.mod");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll(typeof(RepoRoles));
harmony.PatchAll(typeof(Sender));
mls.LogInfo((object)"Init");
SceneManager.sceneLoaded += delegate
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0036: 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 (!Object.op_Implicit((Object)(object)GUIinstance))
{
GameObject val = new GameObject();
GUIinstance = val.AddComponent<guiManager>();
GUIinstance.text = "";
GUIinstance.color = Color.cyan;
Object.DontDestroyOnLoad((Object)(object)val);
}
};
}
}
}