using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bobi;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace R.E.P.O.Roles
{
[HarmonyPatch(typeof(EnemyHealth))]
internal static class ReaperPatch
{
public static readonly Harmony harmonyPatcher = new Harmony("sender.reporoles.mod");
[HarmonyPatch("Death")]
[HarmonyPrefix]
public static void PrefixMethod()
{
if (ClassManager.isReaper)
{
ClassManager.stackKills++;
}
}
}
[HarmonyPatch(typeof(TruckScreenText))]
internal static class Sender
{
private static bool hasRanOnce;
public 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.assignRoleFromConfig(PlayerController.instance);
Logger.CreateLogSource("ChatMsgMgr").LogInfo((object)"Successfully rolled role!");
hasRanOnce = true;
}
}
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void StartPrefix()
{
hasRanOnce = false;
}
}
public class ClassManager
{
private Random rnd = new Random();
public int chosenRoleId;
public string chosenRole;
public int roleAmount = 8;
internal static ManualLogSource mls;
public RepoRoles repoRoles = new RepoRoles();
public readonly Harmony harmonyPatcher = new Harmony("patches.reporoles.mod");
private float origMoveSpeed;
private float origSprintSpeed;
private float origCrouchSpeed;
private float speedMultiplier;
private int origPlayerHealth;
private int origMaxPlayerHealth;
private float origJumpForce;
private float origMaxEnergy;
private float origGrabStrength;
private float origGrabRange;
public static int stackKills;
public static bool isReaper;
public ClassManager()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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;
origGrabRange = PhysGrabber.instance.grabRange;
}
public int genGamblerEffectNr()
{
return rnd.Next(0, 5);
}
public object[] genGamblerEffects()
{
string[] array = new string[5] { "You walk faster", "You have more stamina", "You have more health", "You\u00b4re stronger", "You jump higher" };
string[] array2 = new string[5] { "you walk slower", "you have less stamina", "you have less health", "you\u00b4re weaker", "you don\u00b4t jump as high" };
int num = genGamblerEffectNr();
int num2 = genGamblerEffectNr();
while (num == num2)
{
num = genGamblerEffectNr();
num2 = genGamblerEffectNr();
}
string text = array[num];
string text2 = array2[num2];
string text3 = "You rolled random effects: " + text + " but " + text2 + "!";
return new object[3] { text3, num, num2 };
}
public void assignRoleFromConfig(PlayerController __instance)
{
string[] array = new string[9] { "Random", "Runner", "Tank", "Gambler", "Strongman", "Ranged Looter", "Athletic", "Mage", "Reaper" };
string value = RepoRoles.savedRole.Value;
if (value == "" || value == "Random")
{
chosenRoleId = rnd.Next(1, roleAmount + 1);
mls.LogInfo((object)"Rolling random role...");
}
else
{
chosenRoleId = Array.IndexOf(array, value);
mls.LogInfo((object)("Assigning fixed role " + value));
}
assignRole(chosenRoleId, __instance);
}
public void assignRole(int roleId, PlayerController __instance)
{
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Expected O, but got Unknown
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Expected O, but got Unknown
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_050e: Expected O, but got Unknown
//IL_0bbc: Unknown result type (might be due to invalid IL or missing references)
//IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
//IL_0bd5: Unknown result type (might be due to invalid IL or missing references)
//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
//IL_0c0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c11: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0cb6: Unknown result type (might be due to invalid IL or missing references)
//IL_0cbb: Unknown result type (might be due to invalid IL or missing references)
//IL_0ccf: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd4: Unknown result type (might be due to invalid IL or missing references)
//IL_0d06: Unknown result type (might be due to invalid IL or missing references)
//IL_0d0b: Unknown result type (might be due to invalid IL or missing references)
//IL_0dcb: Unknown result type (might be due to invalid IL or missing references)
//IL_0dd0: Unknown result type (might be due to invalid IL or missing references)
//IL_0de4: Unknown result type (might be due to invalid IL or missing references)
//IL_0de9: Unknown result type (might be due to invalid IL or missing references)
//IL_0e0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0e11: Unknown result type (might be due to invalid IL or missing references)
//IL_0774: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Expected O, but got Unknown
//IL_0a8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
//IL_0aac: Unknown result type (might be due to invalid IL or missing references)
//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee0: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee7: Expected O, but got Unknown
//IL_111c: Unknown result type (might be due to invalid IL or missing references)
//IL_1123: Expected O, but got Unknown
//IL_0985: Unknown result type (might be due to invalid IL or missing references)
//IL_098c: Expected O, but got Unknown
//IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
//IL_0ada: Unknown result type (might be due to invalid IL or missing references)
//IL_11c1: Unknown result type (might be due to invalid IL or missing references)
//IL_11c6: Unknown result type (might be due to invalid IL or missing references)
//IL_11da: Unknown result type (might be due to invalid IL or missing references)
//IL_11df: Unknown result type (might be due to invalid IL or missing references)
//IL_1211: Unknown result type (might be due to invalid IL or missing references)
//IL_1216: Unknown result type (might be due to invalid IL or missing references)
//IL_0fb8: Unknown result type (might be due to invalid IL or missing references)
//IL_0fbd: Unknown result type (might be due to invalid IL or missing references)
//IL_0fdc: Unknown result type (might be due to invalid IL or missing references)
//IL_0fe1: Unknown result type (might be due to invalid IL or missing references)
//IL_1000: Unknown result type (might be due to invalid IL or missing references)
//IL_1005: Unknown result type (might be due to invalid IL or missing references)
//IL_103b: Unknown result type (might be due to invalid IL or missing references)
//IL_1040: Unknown result type (might be due to invalid IL or missing references)
string text = SemiFunc.PlayerGetName(PlayerAvatar.instance);
string key = SemiFunc.PlayerGetSteamID(PlayerAvatar.instance);
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
if (StatsManager.instance.playerUpgradeHealth.TryGetValue(key, out var value))
{
num = value;
}
if (StatsManager.instance.playerUpgradeSpeed.TryGetValue(key, out var value2))
{
num2 = value2;
}
if (StatsManager.instance.playerUpgradeStamina.TryGetValue(key, out var value3))
{
num3 = value3;
}
if (StatsManager.instance.playerUpgradeStrength.TryGetValue(key, out var value4))
{
num4 = value4;
}
if (StatsManager.instance.playerUpgradeRange.TryGetValue(key, out var value5))
{
num5 = value5;
}
stackKills = 0;
isReaper = false;
__instance.CrouchSpeed = origCrouchSpeed;
__instance.MoveSpeed = origMoveSpeed;
__instance.SprintSpeed = origSprintSpeed + (float)num2 * 1f;
__instance.JumpForce = origJumpForce;
__instance.EnergyStart = origMaxEnergy + (float)num3 * 10f;
__instance.EnergyCurrent = origMaxEnergy + (float)num3 * 10f;
PhysGrabber.instance.grabStrength = origGrabStrength + (float)num4 * 0.2f;
PhysGrabber.instance.grabRange = origGrabRange + (float)num5 * 1f;
int num6 = origMaxPlayerHealth + num * 20;
int num7 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if ((int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) > num6)
{
if (GameManager.Multiplayer())
{
PhotonView val = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { num6, num6, false });
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC(num6, num6, false);
}
}
else if (GameManager.Multiplayer())
{
PhotonView val2 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val2.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { num7, num6, false });
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC(num7, num6, false);
}
if (!SemiFunc.RunIsLevel() || SemiFunc.RunIsShop())
{
return;
}
guiManager.showGUI = true;
guiManager.isMage = false;
if (roleId <= 0)
{
mls.LogWarning((object)"Unable to find RoleId! Please contact the mod developer.");
return;
}
KeyCode value6;
switch (roleId)
{
case 1:
{
mls.LogInfo((object)("Assigning role " + RepoRoles.customRoleNameRunner.Value + "."));
__instance.CrouchSpeed = origCrouchSpeed * speedMultiplier;
__instance.MoveSpeed = origMoveSpeed * speedMultiplier;
__instance.SprintSpeed = origSprintSpeed * speedMultiplier + (float)num2 * 1f;
__instance.EnergyStart = (origMaxEnergy + (float)num3 * 10f) * 1.2f;
__instance.EnergyCurrent = (origMaxEnergy + (float)num3 * 10f) * 1.2f;
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameRunner.Value;
RepoRoles.GUIinstance.color = new Color(0.973f, 1f, 0.196f);
guiManager gUIinstance4 = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance4.descText = "You have more stamina and run much faster than everyone else!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = new Color(0.973f, 1f, 0.196f);
break;
}
case 2:
{
mls.LogInfo((object)("Assigning role " + RepoRoles.customRoleNameTank.Value + "."));
int num12 = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
int num13 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if (GameManager.Multiplayer())
{
PhotonView val5 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val5.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3]
{
num13 * 2,
num12 * 2,
false
});
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC(num13 * 2, num12 * 2, false);
}
__instance.CrouchSpeed = origCrouchSpeed * 0.9f;
__instance.MoveSpeed = origMoveSpeed * 0.9f;
__instance.SprintSpeed = (origSprintSpeed + (float)num2 * 1f) * 0.9f;
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameTank.Value;
RepoRoles.GUIinstance.color = Color.gray;
guiManager gUIinstance7 = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance7.descText = "You walk slower but your hp is doubled!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = Color.gray;
break;
}
case 3:
{
mls.LogInfo((object)("Assigning role " + RepoRoles.customRoleNameGambler.Value + "."));
object[] array = genGamblerEffects();
if ((int)array[1] == 0)
{
__instance.CrouchSpeed = origCrouchSpeed;
__instance.MoveSpeed = origMoveSpeed;
__instance.SprintSpeed = origSprintSpeed + (float)num2 * 1.3f;
}
else if ((int)array[1] == 1)
{
__instance.EnergyStart = (origMaxEnergy + (float)num3 * 10f) * 1.4f;
__instance.EnergyCurrent = (origMaxEnergy + (float)num3 * 10f) * 1.4f;
}
else if ((int)array[1] == 2)
{
int num14 = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
int num15 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if (GameManager.Multiplayer())
{
PhotonView val6 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val6.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3]
{
(int)((double)num15 * 1.5),
(int)((double)num14 * 1.5),
true
});
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC((int)((double)num15 * 1.5), (int)((double)num14 * 1.5), true);
}
}
else if ((int)array[1] == 3)
{
PhysGrabber.instance.grabStrength = (origGrabStrength + (float)num4 * 0.2f) * 1.3f;
}
else if ((int)array[1] == 4)
{
__instance.JumpForce *= 1.5f;
}
if ((int)array[2] == 0)
{
__instance.CrouchSpeed = origCrouchSpeed;
__instance.MoveSpeed = origMoveSpeed;
__instance.SprintSpeed = origSprintSpeed + (float)num2 * 0.8f;
}
else if ((int)array[2] == 1)
{
__instance.EnergyStart = (origMaxEnergy + (float)num3 * 10f) * 0.8f;
__instance.EnergyCurrent = (origMaxEnergy + (float)num3 * 10f) * 0.8f;
}
else if ((int)array[2] == 2)
{
int num16 = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
int num17 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if (GameManager.Multiplayer())
{
PhotonView val7 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val7.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3]
{
(int)((double)num17 * 0.8),
(int)((double)num16 * 0.8),
true
});
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC((int)((double)num17 * 0.8), (int)((double)num16 * 0.8), true);
}
}
else if ((int)array[2] == 3)
{
PhysGrabber.instance.grabStrength = (origGrabStrength + (float)num4 * 0.2f) * 0.8f;
}
else if ((int)array[2] == 4)
{
__instance.JumpForce *= 0.5f;
}
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameGambler.Value;
RepoRoles.GUIinstance.color = new Color(0.576f, 0f, 0.831f);
RepoRoles.GUIinstance.descColor = new Color(0.576f, 0f, 0.831f);
guiManager gUIinstance8 = RepoRoles.GUIinstance;
string? obj2 = array[0]?.ToString();
value6 = RepoRoles.toggleKey.Value;
gUIinstance8.descText = obj2 + "\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
break;
}
case 4:
{
mls.LogMessage((object)("Assigning role " + RepoRoles.customRoleNameStrongman.Value + "."));
Debug.Log((object)("Strength before: " + PhysGrabber.instance.grabStrength));
PhysGrabber.instance.grabStrength = (origGrabStrength + (float)num4 * 0.2f) * 1.5f + 2f;
Debug.Log((object)("Strength after: " + PhysGrabber.instance.grabStrength));
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameStrongman.Value;
RepoRoles.GUIinstance.color = new Color(0.761f, 0.055f, 0.055f);
guiManager gUIinstance6 = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance6.descText = "You\u00b4re incredibly strong!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = new Color(0.761f, 0.055f, 0.055f);
break;
}
case 5:
{
mls.LogMessage((object)("Assigning role " + RepoRoles.customRoleNameRL.Value + "."));
PhysGrabber.instance.grabRange = (origGrabRange + (float)num5 * 1f) * 2.5f;
PhysGrabber.instance.grabStrength = (origGrabStrength + (float)num4 * 0.2f) * 1.2f;
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameRL.Value;
RepoRoles.GUIinstance.color = new Color(0.592f, 0.969f, 0.663f);
guiManager gUIinstance2 = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance2.descText = "You can reach objects from far away!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = new Color(0.592f, 0.969f, 0.663f);
break;
}
case 6:
{
mls.LogMessage((object)("Assigning role " + RepoRoles.customRoleNameAthletic.Value + "."));
PhysGrabber.instance.grabStrength = (origGrabStrength + (float)num4 * 0.2f) * 1.3f;
__instance.EnergyStart = origMaxEnergy + (float)num3 * 10f + 20f;
__instance.EnergyCurrent = origMaxEnergy + (float)num3 * 10f + 20f;
__instance.JumpForce = origJumpForce + 3f;
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameAthletic.Value;
RepoRoles.GUIinstance.color = Color.white;
guiManager gUIinstance3 = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance3.descText = "You have more stamina, strength and can jump higher!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = Color.white;
break;
}
case 7:
{
mls.LogMessage((object)("Assigning role " + RepoRoles.customRoleNameMage.Value + "."));
guiManager.isMage = true;
guiManager.aviableMana = 8;
int num10 = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
int num11 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if (GameManager.Multiplayer())
{
PhotonView val4 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
if ((int)((double)num11 * 0.5) > 0)
{
val4.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3]
{
(int)((double)num11 * 0.5),
(int)((double)num10 * 0.5),
false
});
}
}
else if ((int)((double)num11 * 0.5) > 0)
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC((int)((double)num11 * 0.5), (int)((double)num10 * 0.5), false);
}
RepoRoles.GUIinstance.text = RepoRoles.customRoleNameMage.Value;
RepoRoles.GUIinstance.color = new Color(0f, 0.384f, 1f);
guiManager gUIinstance5 = RepoRoles.GUIinstance;
string[] obj = new string[5] { "You are able to use your mana to become incredibly strong!\nPress ", null, null, null, null };
value6 = RepoRoles.showSpellsKey.Value;
obj[1] = ((object)(KeyCode)(ref value6)).ToString();
obj[2] = " to see all your spells and press ";
value6 = RepoRoles.toggleKey.Value;
obj[3] = ((object)(KeyCode)(ref value6)).ToString();
obj[4] = " to continue";
gUIinstance5.descText = string.Concat(obj);
RepoRoles.GUIinstance.descColor = new Color(0f, 0.384f, 1f);
break;
}
case 8:
{
mls.LogMessage((object)("Assigning role " + RepoRoles.customRoleNameReaper.Value + "."));
harmonyPatcher.PatchAll(typeof(ReaperPatch));
isReaper = true;
int num8 = (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth);
int num9 = (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth);
if (GameManager.Multiplayer())
{
PhotonView val3 = (PhotonView)AccessTools.Field(typeof(PlayerHealth), "photonView").GetValue(PlayerAvatar.instance.playerHealth);
val3.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3]
{
(int)((double)num9 * 1.5),
(int)((double)num8 * 1.5),
true
});
}
else
{
PlayerAvatar.instance.playerHealth.UpdateHealthRPC((int)((double)num9 * 1.5), (int)((double)num8 * 1.5), true);
}
RepoRoles.GUIinstance.text = "Reaper";
RepoRoles.GUIinstance.color = new Color(0.141f, 0.6f, 0.502f);
guiManager gUIinstance = RepoRoles.GUIinstance;
value6 = RepoRoles.toggleKey.Value;
gUIinstance.descText = "For each enemy you and your friends kill, you become stronger!\nPress " + ((object)(KeyCode)(ref value6)).ToString() + " to continue";
RepoRoles.GUIinstance.descColor = new Color(0.141f, 0.6f, 0.502f);
break;
}
}
}
}
}
namespace R.E.P.O.Roles.patches
{
public class guiManager : MonoBehaviour
{
public static bool showGUI = true;
public static bool isMage = false;
public static bool showSpells = false;
public bool isDead = false;
public string text;
public Color color = Color.white;
public string descText;
public Color descColor = Color.white;
private Texture2D _backgroundTexture;
private Texture2D _manaTexture;
private static Font customFont;
private static AssetBundle fontBundle;
public static int aviableMana = 0;
public int speedTicker = 0;
public int manaTicks = 0;
public bool speedActive;
private float multiSpeed = 1.4f;
private float crouchSpeedBefore;
private float moveSpeedBefore;
private float sprintSpeedBefore;
private int overchargeMulti = 1;
private bool isOvercharged = false;
private int overchargeTicker = 0;
private bool jumpActive = false;
private float jumpOriginal;
private int jumpTicker = 0;
private int neededJumpTicker = 1800;
private int neededSpeedTicker = 1800;
private int manaUsageTicker = 0;
private bool showManaUsage = false;
private int enemyDeathTimer = 0;
private string manaUsageText = "Used x (- y Mana)";
public static AssetBundle LoadAssetBundle(string name)
{
Logger.CreateLogSource("AssetBundles").LogDebug((object)("Loading Asset Bundle: " + name));
AssetBundle val = null;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
return AssetBundle.LoadFromFile(text);
}
public static Texture2D LoadBottleTextureFromFile()
{
AssetBundle val = LoadAssetBundle("assets");
Texture2D result = val.LoadAsset<Texture2D>("emptyBottle.png");
val.Unload(false);
return result;
}
public static Texture2D LoadFullBottleTextureFromFile()
{
AssetBundle val = LoadAssetBundle("assets");
Texture2D result = val.LoadAsset<Texture2D>("filledBottle.png");
val.Unload(false);
return result;
}
public static void loadFont()
{
if ((Object)(object)fontBundle == (Object)null)
{
fontBundle = LoadAssetBundle("assets");
customFont = fontBundle.LoadAsset<Font>("font.ttf");
}
if ((Object)(object)fontBundle == (Object)null)
{
Logger.CreateLogSource("RepoRoles ERROR").LogError((object)"Missing Assets: Put the assets file next to the dll in your plugins folder. If this does not fix it contact us on our discord (see thunderstore description or README)");
}
}
private void Start()
{
_backgroundTexture = LoadBottleTextureFromFile();
_backgroundTexture.Apply();
_manaTexture = LoadFullBottleTextureFromFile();
_manaTexture.Apply();
}
private void OnGUI()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_009b: 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)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: 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_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Expected O, but got Unknown
//IL_0243: 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_026d: Expected O, but got Unknown
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Expected O, but got Unknown
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Expected O, but got Unknown
//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
//IL_04d8: Expected O, but got Unknown
//IL_050a: Unknown result type (might be due to invalid IL or missing references)
//IL_052d: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Expected O, but got Unknown
//IL_053b: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_059c: Unknown result type (might be due to invalid IL or missing references)
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0611: Unknown result type (might be due to invalid IL or missing references)
//IL_063a: Unknown result type (might be due to invalid IL or missing references)
//IL_0663: Unknown result type (might be due to invalid IL or missing references)
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_06af: Unknown result type (might be due to invalid IL or missing references)
//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0720: Unknown result type (might be due to invalid IL or missing references)
//IL_0741: Unknown result type (might be due to invalid IL or missing references)
//IL_0768: Unknown result type (might be due to invalid IL or missing references)
//IL_078f: Unknown result type (might be due to invalid IL or missing references)
//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
//IL_07dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0804: Unknown result type (might be due to invalid IL or missing references)
//IL_083d: Unknown result type (might be due to invalid IL or missing references)
//IL_0877: Unknown result type (might be due to invalid IL or missing references)
//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0a: Expected O, but got Unknown
//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
//IL_0a5f: Unknown result type (might be due to invalid IL or missing references)
//IL_0a66: Expected O, but got Unknown
//IL_0a6d: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa4: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
//IL_0ac8: Unknown result type (might be due to invalid IL or missing references)
//IL_0acd: Unknown result type (might be due to invalid IL or missing references)
//IL_0aec: Unknown result type (might be due to invalid IL or missing references)
//IL_0af1: Unknown result type (might be due to invalid IL or missing references)
//IL_0b10: Unknown result type (might be due to invalid IL or missing references)
//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
//IL_0b35: Unknown result type (might be due to invalid IL or missing references)
//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0bac: Unknown result type (might be due to invalid IL or missing references)
//IL_0bca: Unknown result type (might be due to invalid IL or missing references)
//IL_0beb: Unknown result type (might be due to invalid IL or missing references)
//IL_0c0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c2d: Unknown result type (might be due to invalid IL or missing references)
//IL_0c4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
//IL_091f: Unknown result type (might be due to invalid IL or missing references)
//IL_0959: Unknown result type (might be due to invalid IL or missing references)
//IL_0993: Unknown result type (might be due to invalid IL or missing references)
//IL_09cd: Unknown result type (might be due to invalid IL or missing references)
float num = Screen.width / 2 - 100;
float num2 = Screen.height / 2 - 60;
loadFont();
if (SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && showGUI)
{
GUIStyle val = new GUIStyle();
val.fontSize = 60;
val.fontStyle = (FontStyle)1;
val.richText = true;
val.normal.textColor = color;
val.alignment = (TextAnchor)4;
val.font = customFont;
GUIStyle val2 = new GUIStyle(val);
val2.normal.textColor = Color.black;
val2.alignment = (TextAnchor)4;
val2.font = customFont;
float num3 = 2f;
GUI.Label(new Rect(num - num3, num2, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num + num3, num2, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num, num2 - num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num, num2 + num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num - num3, num2 - num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num - num3, num2 + num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num + num3, num2 - num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num + num3, num2 + num3, 200f, 50f), this.text, val2);
GUI.Label(new Rect(num, num2, 200f, 50f), this.text, val);
float num4 = Screen.width / 2 - 100;
float num5 = Screen.height / 2 + 40;
GUIStyle val3 = new GUIStyle();
val3.fontSize = 40;
val3.fontStyle = (FontStyle)1;
val3.richText = true;
val3.normal.textColor = color;
val3.alignment = (TextAnchor)4;
val3.font = customFont;
GUIStyle val4 = new GUIStyle(val3);
val4.normal.textColor = Color.black;
val4.alignment = (TextAnchor)4;
val4.font = customFont;
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);
}
if (!isMage || !SemiFunc.RunIsLevel() || SemiFunc.RunIsShop() || (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) <= 0)
{
return;
}
GUIStyle val5 = new GUIStyle();
val5.alignment = (TextAnchor)1;
val5.normal.background = _manaTexture;
val5.font = customFont;
GUIStyle val6 = new GUIStyle();
val6.alignment = (TextAnchor)1;
val6.normal.background = _backgroundTexture;
val6.font = customFont;
if (showManaUsage && SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && isMage)
{
int num7 = Screen.width / 2 - 100;
int num8 = Screen.height - 125;
GUIStyle val7 = new GUIStyle();
val7.fontSize = 20;
val7.fontStyle = (FontStyle)1;
val7.richText = true;
val7.normal.textColor = new Color(0f, 0.384f, 1f);
val7.alignment = (TextAnchor)4;
val7.font = customFont;
GUIStyle val8 = new GUIStyle(val7);
val8.normal.textColor = Color.black;
val8.alignment = (TextAnchor)4;
val8.font = customFont;
float num9 = 1.5f;
GUI.Label(new Rect((float)num7 - num9, (float)num8, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7 + num9, (float)num8, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7, (float)num8 - num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7, (float)num8 + num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7 - num9, (float)num8 - num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7 - num9, (float)num8 + num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7 + num9, (float)num8 - num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7 + num9, (float)num8 + num9, 200f, 50f), manaUsageText, val8);
GUI.Label(new Rect((float)num7, (float)num8, 200f, 50f), manaUsageText, val7);
}
if (SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && isMage)
{
GUI.Box(new Rect(num - 100f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num - 50f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num + 50f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num + 100f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num + 150f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num + 200f, 50f, 50f, 50f), GUIContent.none, val6);
GUI.Box(new Rect(num + 250f, 50f, 50f, 50f), GUIContent.none, val6);
if (aviableMana >= 1)
{
GUI.Box(new Rect(num - 100f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 2)
{
GUI.Box(new Rect(num - 50f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 3)
{
GUI.Box(new Rect(num, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 4)
{
GUI.Box(new Rect(num + 50f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 5)
{
GUI.Box(new Rect(num + 100f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 6)
{
GUI.Box(new Rect(num + 150f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 7)
{
GUI.Box(new Rect(num + 200f, 50f, 50f, 50f), GUIContent.none, val5);
}
if (aviableMana >= 8)
{
GUI.Box(new Rect(num + 250f, 50f, 50f, 50f), GUIContent.none, val5);
}
}
if (showSpells && SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())
{
GUIStyle val9 = new GUIStyle();
val9.fontSize = 40;
val9.fontStyle = (FontStyle)1;
val9.richText = true;
val9.normal.textColor = new Color(0f, 0.384f, 1f);
val9.alignment = (TextAnchor)4;
val9.font = customFont;
GUIStyle val10 = new GUIStyle(val9);
val10.normal.textColor = Color.black;
val10.alignment = (TextAnchor)4;
val10.font = customFont;
string[] obj = new string[11]
{
"[", null, null, null, null, null, null, null, null, null,
null
};
KeyCode value = RepoRoles.healKey.Value;
obj[1] = ((object)(KeyCode)(ref value)).ToString();
obj[2] = "] Heal yourself for 5 health (1 Mana)\n\n[";
value = RepoRoles.staminaKey.Value;
obj[3] = ((object)(KeyCode)(ref value)).ToString();
obj[4] = "] Regenerate your stamina to full (3 Mana)\n\n[";
value = RepoRoles.speedKey.Value;
obj[5] = ((object)(KeyCode)(ref value)).ToString();
obj[6] = "] Become faster for 30 seconds (2 Mana)\n\n[";
value = RepoRoles.overchargeKey.Value;
obj[7] = ((object)(KeyCode)(ref value)).ToString();
obj[8] = "] Boost the effectivity of spells used in the next 20 seconds (3 Mana)\n\n[";
value = RepoRoles.jumpKey.Value;
obj[9] = ((object)(KeyCode)(ref value)).ToString();
obj[10] = "] Jump higher for 30 seconds (2 Mana)";
string text = string.Concat(obj);
float num10 = 2f;
GUI.Label(new Rect(num - num10, num2, 200f, 50f), text, val10);
GUI.Label(new Rect(num + num10, num2, 200f, 50f), text, val10);
GUI.Label(new Rect(num, num2 - num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num, num2 + num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num - num10, num2 - num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num - num10, num2 + num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num + num10, num2 - num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num + num10, num2 + num10, 200f, 50f), text, val10);
GUI.Label(new Rect(num, num2, 200f, 50f), text, val9);
}
}
private void Update()
{
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0772: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.RunIsLevel() && (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) <= 0)
{
isDead = true;
}
if (!SemiFunc.RunIsLevel())
{
isMage = false;
ClassManager.isReaper = false;
isDead = false;
}
if (!RepoRoles.afterDeathNewRole)
{
isDead = false;
}
if (isDead && (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) > 0 && RepoRoles.afterDeathNewRole)
{
Sender.manager.assignRoleFromConfig(PlayerController.instance);
Logger.CreateLogSource("REPO Roles guiManager").LogInfo((object)"Assigning new role on respawn!");
isDead = false;
}
if (ClassManager.isReaper && (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) > 0 && ClassManager.stackKills > 0 && enemyDeathTimer <= 0)
{
AccessTools.Field(typeof(PlayerHealth), "maxHealth").SetValue(PlayerAvatar.instance.playerHealth, (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth) + 5);
if ((int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) + 30 > (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth))
{
PlayerAvatar.instance.playerHealth.Heal((int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth) - (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth), true);
}
else
{
PlayerAvatar.instance.playerHealth.Heal(30, true);
}
PlayerController instance = PlayerController.instance;
instance.EnergyStart += 10f;
PlayerController instance2 = PlayerController.instance;
instance2.EnergyCurrent += 10f;
ClassManager.stackKills = 0;
enemyDeathTimer = 50;
}
if (enemyDeathTimer > 0)
{
enemyDeathTimer--;
}
if (Input.GetKeyDown(RepoRoles.toggleKey.Value))
{
showGUI = !showGUI;
}
if ((int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) > 0 && isMage)
{
if (Input.GetKeyDown(RepoRoles.showSpellsKey.Value))
{
showSpells = !showSpells;
}
if (Input.GetKeyDown(RepoRoles.healKey.Value))
{
if ((int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) + 5 * overchargeMulti < (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth))
{
if (aviableMana >= 1)
{
PlayerAvatar.instance.playerHealth.Heal(5 * overchargeMulti, true);
aviableMana--;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Heal (-1 Mana)";
}
}
else if ((int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth) != (int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth) && aviableMana >= 1)
{
PlayerAvatar.instance.playerHealth.Heal((int)AccessTools.Field(typeof(PlayerHealth), "maxHealth").GetValue(PlayerAvatar.instance.playerHealth) - (int)AccessTools.Field(typeof(PlayerHealth), "health").GetValue(PlayerAvatar.instance.playerHealth), true);
aviableMana--;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Heal (-1 Mana)";
}
}
if (Input.GetKeyDown(RepoRoles.speedKey.Value) && !speedActive)
{
crouchSpeedBefore = PlayerController.instance.CrouchSpeed;
moveSpeedBefore = PlayerController.instance.MoveSpeed;
sprintSpeedBefore = PlayerController.instance.SprintSpeed;
if (aviableMana >= 2)
{
speedTicker = 0;
speedActive = true;
PlayerController.instance.CrouchSpeed = crouchSpeedBefore * multiSpeed;
PlayerController.instance.MoveSpeed = moveSpeedBefore * multiSpeed;
PlayerController.instance.SprintSpeed = sprintSpeedBefore * multiSpeed;
aviableMana -= 2;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Speed (-2 Mana)";
if (isOvercharged)
{
neededSpeedTicker = 3600;
}
else
{
neededSpeedTicker = 1800;
}
}
}
if (Input.GetKeyDown(RepoRoles.overchargeKey.Value) && !isOvercharged && aviableMana >= 3)
{
aviableMana -= 3;
isOvercharged = true;
overchargeMulti = 2;
overchargeTicker = 0;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Overcharge (-3 Mana)";
}
if (Input.GetKeyDown(RepoRoles.jumpKey.Value) && !jumpActive)
{
jumpOriginal = PlayerController.instance.JumpForce;
if (aviableMana >= 2)
{
jumpTicker = 0;
jumpActive = true;
PlayerController.instance.JumpForce = jumpOriginal + 3f;
aviableMana -= 2;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Jump Boost (-2 Mana)";
if (isOvercharged)
{
neededJumpTicker = 3600;
}
else
{
neededJumpTicker = 1800;
}
}
}
if (Input.GetKeyDown(RepoRoles.staminaKey.Value) && PlayerController.instance.EnergyCurrent < PlayerController.instance.EnergyStart && aviableMana >= 3)
{
PlayerController.instance.EnergyCurrent = PlayerController.instance.EnergyStart;
aviableMana -= 3;
showManaUsage = true;
manaUsageTicker = 0;
manaUsageText = "Used Stamina Refill (-3 Mana)";
}
}
if (speedActive && speedTicker >= neededSpeedTicker)
{
PlayerController.instance.CrouchSpeed = crouchSpeedBefore;
PlayerController.instance.MoveSpeed = moveSpeedBefore;
PlayerController.instance.SprintSpeed = sprintSpeedBefore;
speedActive = false;
}
if (jumpActive && jumpTicker >= neededJumpTicker)
{
PlayerController.instance.JumpForce = jumpOriginal;
jumpActive = false;
}
}
private void FixedUpdate()
{
if (overchargeTicker >= 1200)
{
isOvercharged = false;
overchargeMulti = 1;
}
if (isOvercharged)
{
overchargeTicker++;
}
manaUsageTicker++;
speedTicker++;
jumpTicker++;
if (manaUsageTicker >= 420)
{
showManaUsage = false;
}
if (aviableMana < 8)
{
manaTicks++;
}
if (manaTicks >= 1000)
{
aviableMana++;
manaTicks = 0;
}
}
}
}
namespace Bobi
{
[BepInPlugin("reporoles.mod", "RepoRoles", "1.4.4")]
public class RepoRoles : BaseUnityPlugin
{
public const string pluginGuid = "reporoles.mod";
public const string pluginName = "RepoRoles";
public const string pluginVersion = "1.4.4";
public readonly Harmony harmony = new Harmony("reporoles.mod");
public static RepoRoles Instance;
internal ManualLogSource mls;
public static Font newFont;
public static guiManager GUIinstance;
public static ConfigEntry<KeyCode> toggleKey;
public static ConfigEntry<KeyCode> showSpellsKey;
public static ConfigEntry<KeyCode> healKey;
public static ConfigEntry<KeyCode> speedKey;
public static ConfigEntry<KeyCode> overchargeKey;
public static ConfigEntry<KeyCode> jumpKey;
public static ConfigEntry<KeyCode> staminaKey;
public static ConfigEntry<string> customRoleNameRunner;
public static ConfigEntry<string> customRoleNameTank;
public static ConfigEntry<string> customRoleNameGambler;
public static ConfigEntry<string> customRoleNameStrongman;
public static ConfigEntry<string> customRoleNameRL;
public static ConfigEntry<string> customRoleNameAthletic;
public static ConfigEntry<string> customRoleNameMage;
public static ConfigEntry<string> customRoleNameReaper;
public static ConfigEntry<string> savedRole;
public static ConfigEntry<bool> assignRoleAfterRevive;
public ConfigDefinition def = new ConfigDefinition("GUI", "GUI Toggle Key");
public ConfigDefinition customRoleNameRunnerDef = new ConfigDefinition("Role Names", "Runner Name");
public ConfigDefinition customRoleNameTankDef = new ConfigDefinition("Role Names", "Tank Name");
public ConfigDefinition customRoleNameGamblerDef = new ConfigDefinition("Role Names", "Gambler Name");
public ConfigDefinition customRoleNameStrongmanDef = new ConfigDefinition("Role Names", "Strongman Name");
public ConfigDefinition customRoleNameRLDef = new ConfigDefinition("Role Names", "Ranged Looter Name");
public ConfigDefinition customRoleNameAthleticDef = new ConfigDefinition("Role Names", "Athletic Name");
public ConfigDefinition customRoleNameMageDef = new ConfigDefinition("Role Names", "Mage Name");
public ConfigDefinition customRoleNameReaperDef = new ConfigDefinition("Role Names", "Reaper Name");
public ConfigDefinition showSpellsDef = new ConfigDefinition("Mage", "Show Spells");
public ConfigDefinition healDef = new ConfigDefinition("Mage", "Healing Spell");
public ConfigDefinition speedDef = new ConfigDefinition("Mage", "Speed Spell");
public ConfigDefinition overchargeDef = new ConfigDefinition("Mage", "Overcharge Spell");
public ConfigDefinition jumpDef = new ConfigDefinition("Mage", "Jump Boost Spell");
public ConfigDefinition staminaDef = new ConfigDefinition("Mage", "Stamina Refill Spell");
public ConfigDefinition selectedRoleDef = new ConfigDefinition("Role", "Your selected role");
public ConfigDefinition afterDeathRoleDef = new ConfigDefinition("Role", "Reaasign roles after being revived");
private REPOSlider slider;
private REPOPopupPage configPage;
private REPOButton buttonOpen;
private REPOButton buttonOpenLobby;
private REPOButton buttonClose;
private REPOToggle afterDeathRoleToggle;
public static bool afterDeathNewRole = false;
public static string chosenRoleName = "Random";
public void sliderConf(string a)
{
savedRole.Value = a;
chosenRoleName = a;
}
public void aDRC(bool a)
{
assignRoleAfterRevive.Value = a;
afterDeathNewRole = a;
}
private void Awake()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
mls = Logger.CreateLogSource("reporoles.mod");
savedRole = ((BaseUnityPlugin)this).Config.Bind<string>(selectedRoleDef, "Random", (ConfigDescription)null);
assignRoleAfterRevive = ((BaseUnityPlugin)this).Config.Bind<bool>(afterDeathRoleDef, false, (ConfigDescription)null);
MenuAPI.AddElementToSettingsMenu((BuilderDelegate)delegate(Transform parent)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
if ((Object)(object)configPage == (Object)null)
{
configPage = MenuAPI.CreateREPOPopupPage("REPO Roles", (PresetSide)0, true, true, 1.5f);
}
buttonOpen = MenuAPI.CreateREPOButton("REPO Roles Config", (Action)delegate
{
configPage.OpenPage(false);
}, parent, new Vector2(500f, 10f));
configPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)slider == (Object)null)
{
slider = MenuAPI.CreateREPOSlider("REPO Roles", "Choose your role", (Action<string>)delegate(string s)
{
sliderConf(s);
}, scrollView, new string[9] { "Random", "Runner", "Tank", "Gambler", "Strongman", "Ranged Looter", "Athletic", "Mage", "Reaper" }, savedRole.Value, new Vector2(0f, 0f), "", "", (BarBehavior)0);
}
return ((REPOElement)slider).rectTransform;
}, 0f, 0f);
configPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)afterDeathRoleToggle == (Object)null)
{
afterDeathRoleToggle = MenuAPI.CreateREPOToggle("Reassign role on respawn", (Action<bool>)delegate(bool b)
{
aDRC(b);
}, scrollView, new Vector2(0f, 0f), "ON", "OFF", assignRoleAfterRevive.Value);
}
return ((REPOElement)afterDeathRoleToggle).rectTransform;
}, 0f, 0f);
configPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)buttonClose == (Object)null)
{
buttonClose = MenuAPI.CreateREPOButton("Back", (Action)delegate
{
configPage.ClosePage(false);
}, parent, Vector2.zero);
}
});
});
MenuAPI.AddElementToLobbyMenu((BuilderDelegate)delegate(Transform parent)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
buttonOpenLobby = MenuAPI.CreateREPOButton("REPO Roles Config", (Action)delegate
{
configPage.OpenPage(false);
}, parent, new Vector2(500f, 500f));
});
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);
}
};
toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(def, (KeyCode)114, (ConfigDescription)null);
showSpellsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(showSpellsDef, (KeyCode)109, (ConfigDescription)null);
healKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(healDef, (KeyCode)104, (ConfigDescription)null);
speedKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(speedDef, (KeyCode)106, (ConfigDescription)null);
overchargeKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(overchargeDef, (KeyCode)111, (ConfigDescription)null);
jumpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(jumpDef, (KeyCode)107, (ConfigDescription)null);
staminaKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(staminaDef, (KeyCode)110, (ConfigDescription)null);
customRoleNameRunner = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameRunnerDef, "Runner", (ConfigDescription)null);
customRoleNameTank = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameTankDef, "Tank", (ConfigDescription)null);
customRoleNameGambler = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameGamblerDef, "Gambler", (ConfigDescription)null);
customRoleNameStrongman = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameStrongmanDef, "Strongman", (ConfigDescription)null);
customRoleNameRL = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameRLDef, "Ranged Looter", (ConfigDescription)null);
customRoleNameAthletic = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameAthleticDef, "Athletic", (ConfigDescription)null);
customRoleNameMage = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameMageDef, "Mage", (ConfigDescription)null);
customRoleNameReaper = ((BaseUnityPlugin)this).Config.Bind<string>(customRoleNameReaperDef, "Reaper", (ConfigDescription)null);
}
}
}