Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Uncap monster level v1.1.1
plugins/UncapMonsterLevel/UncapMonsterLevel.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Drone.DroneJunk; using EntityStates.LynxArcher; using Microsoft.CodeAnalysis; using On.EntityStates.Drone.DroneJunk; using On.EntityStates.LynxArcher; using On.RoR2; using On.RoR2.Items; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("UncapMonsterLevel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8219f233642ca7be854ca518aad857527f2654e6")] [assembly: AssemblyProduct("UncapMonsterLevel")] [assembly: AssemblyTitle("UncapMonsterLevel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 UncapMonsterLevel { internal static class DirectorCreditHooks { [CompilerGenerated] private static class <>O { public static hook_Update <0>__Update; public static hook_OnEnter <1>__OnEnter; public static Action<SceneDirector> <2>__OnPrePopulateScene; } private const double BOSS_CREDIT = 600.0; public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__Update; if (obj == null) { hook_Update val = Update; <>O.<0>__Update = val; obj = (object)val; } DirectorMoneyWave.Update += (hook_Update)obj; object obj2 = <>O.<1>__OnEnter; if (obj2 == null) { hook_OnEnter val2 = OnEnter; <>O.<1>__OnEnter = val2; obj2 = (object)val2; } ChargingState.OnEnter += (hook_OnEnter)obj2; SceneDirector.onPrePopulateSceneServer += OnPrePopulateScene; } private static float Update(orig_Update orig, DirectorMoneyWave self, float deltaTime, float difficultyCoefficient) { self.timer += deltaTime; if (self.timer > self.interval) { float num = 0.5f + (float)Run.instance.participatingPlayerCount * 0.5f; self.timer -= self.interval; self.accumulatedAward += self.interval * self.multiplier * (1f + 0.4f * difficultyCoefficient) * num; } float num2 = (float)Math.Floor(self.accumulatedAward); self.accumulatedAward -= num2; return num2; } private static void OnPrePopulateScene(SceneDirector director) { if (director.monsterCredit < 0 && Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance)) { ClassicStageInfo component = ((Component)SceneInfo.instance).GetComponent<ClassicStageInfo>(); if (Object.op_Implicit((Object)(object)component)) { double val = (double)component.sceneDirectorMonsterCredits * (double)Run.instance.difficultyCoefficient; director.monsterCredit = (int)Math.Min(val, 2147483647.0); } } } private static void OnEnter(orig_OnEnter orig, ChargingState self) { TeleporterInteraction component = ((EntityState)self).GetComponent<TeleporterInteraction>(); CombatDirector val = (Object.op_Implicit((Object)(object)component) ? component.bossDirector : null); float num = (Object.op_Implicit((Object)(object)val) ? val.monsterCredit : 0f); orig.Invoke(self); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)Run.instance) || !NetworkServer.active) { return; } double num2 = 600.0 * Math.Sqrt(Run.instance.compensatedDifficultyCoefficient); if (!(num2 <= 2147483647.0)) { double num3 = Math.Max(val.overrideCost, num2) * (double)(1 + component.shrineBonusStacks + component.hexBonusStacks); val.monsterCredit = (float)((double)num + num3); CombatDirector companionBoss = component.companionBoss; if (Object.op_Implicit((Object)(object)companionBoss) && companionBoss.HasOverrideBoss()) { companionBoss.monsterCredit = Mathf.Max((float)companionBoss.overrideCost, val.monsterCredit); } } } } public enum NumberStyle { Short, Scientific, Full } internal static class LevelDisplay { [CompilerGenerated] private static class <>O { public static hook_Update <0>__Update; } private const double THOUSAND = 1000.0; private const double FULL_LIMIT = 1000000000000000.0; private const string FORMAT_TOKEN = "AMBIENT_LEVEL_DISPLAY_FORMAT"; private static readonly string[] SUFFIXES = new string[12] { "", "K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc" }; private static string shownText; private static double shownLevel; public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__Update; if (obj == null) { hook_Update val = Update; <>O.<0>__Update = val; obj = (object)val; } AmbientLevelDisplay.Update += (hook_Update)obj; UncapMonsterLevel.numberStyle.SettingChanged += delegate { shownText = null; }; UncapMonsterLevel.digits.SettingChanged += delegate { shownText = null; }; } private static void Update(orig_Update orig, AmbientLevelDisplay self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)self.text)) { return; } double num = Math.Floor(MonsterLevelHooks.Level); if (!(num < 1000.0) && !(num < (double)Run.instance.ambientLevelFloor)) { if (shownText == null || shownLevel != num) { shownText = Language.GetStringFormatted("AMBIENT_LEVEL_DISPLAY_FORMAT", new object[1] { Format(num) }); shownLevel = num; } if ((object)((TMP_Text)self.text).text != shownText) { ((TMP_Text)self.text).text = shownText; } } } public static string Format(double number) { if (double.IsInfinity(number) || double.IsNaN(number)) { return number.ToString(CultureInfo.InvariantCulture); } int value = UncapMonsterLevel.digits.Value; double value2 = RoundToDigits(number, value); if (Math.Abs(value2) < 1000.0) { return value2.ToString("0.##########", CultureInfo.InvariantCulture); } switch (UncapMonsterLevel.numberStyle.Value) { case NumberStyle.Full: if (!(Math.Abs(number) < 1000000000000000.0)) { return FormatScientific(number, value); } return number.ToString("N0", CultureInfo.InvariantCulture); case NumberStyle.Scientific: return FormatScientific(number, value); default: return FormatShort(number, value); } } private static string FormatScientific(double number, int digits) { GetMantissa(number, digits, out var mantissa, out var exponent); return mantissa.ToString("F" + (digits - 1), CultureInfo.InvariantCulture) + "e" + exponent; } private static string FormatShort(double number, int digits) { GetMantissa(number, digits, out var mantissa, out var exponent); int num = exponent / 3; if (num >= SUFFIXES.Length) { return FormatScientific(number, digits); } int num2 = exponent % 3; return (mantissa * Math.Pow(10.0, num2)).ToString("F" + (digits - 1 - num2), CultureInfo.InvariantCulture) + SUFFIXES[num]; } private static void GetMantissa(double number, int digits, out double mantissa, out int exponent) { exponent = (int)Math.Floor(Math.Log10(Math.Abs(number))); mantissa = Math.Round(number / Math.Pow(10.0, exponent), digits - 1); if (Math.Abs(mantissa) >= 10.0) { mantissa /= 10.0; exponent++; } } private static double RoundToDigits(double number, int digits) { if (number == 0.0) { return 0.0; } int num = (int)Math.Floor(Math.Log10(Math.Abs(number))); int val = Math.Max(0, digits - 1 - num); return Math.Round(number, Math.Min(val, 15)); } } internal static class LevelUpEffectHooks { [CompilerGenerated] private static class <>O { public static hook_OnCharacterLevelUp <0>__OnCharacterLevelUp; } private static readonly Dictionary<CharacterBody, float> lastShown = new Dictionary<CharacterBody, float>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__OnCharacterLevelUp; if (obj == null) { hook_OnCharacterLevelUp val = OnCharacterLevelUp; <>O.<0>__OnCharacterLevelUp = val; obj = (object)val; } LevelUpEffectManager.OnCharacterLevelUp += (hook_OnCharacterLevelUp)obj; CharacterBody.onBodyDestroyGlobal += delegate(CharacterBody body) { lastShown.Remove(body); }; Run.onRunStartGlobal += delegate { lastShown.Clear(); }; } private static void OnCharacterLevelUp(orig_OnCharacterLevelUp orig, CharacterBody characterBody) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 if (!UncapMonsterLevel.levelUpEffect.Value || (!UncapMonsterLevel.allyLevelUpEffects.Value && Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.teamComponent) && (int)characterBody.teamComponent.teamIndex == 1 && MonsterStatHooks.UsesMonsterLevel(characterBody))) { return; } int value = UncapMonsterLevel.levelUpEffectInterval.Value; if (value > 0 && Object.op_Implicit((Object)(object)characterBody)) { if (lastShown.TryGetValue(characterBody, out var value2) && Time.unscaledTime - value2 < (float)value) { return; } lastShown[characterBody] = Time.unscaledTime; } orig.Invoke(characterBody); } } internal static class LevelUpLimitHooks { [CompilerGenerated] private static class <>O { public static hook_OnCalculatedLevelChanged <0>__OnCalculatedLevelChanged; public static hook_OnCharacterLevelUp <1>__PlaceWarbanner; } private const float MIN_INTERVAL = 1f; private static readonly Dictionary<CharacterBody, float> lastLevelUp = new Dictionary<CharacterBody, float>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__OnCalculatedLevelChanged; if (obj == null) { hook_OnCalculatedLevelChanged val = OnCalculatedLevelChanged; <>O.<0>__OnCalculatedLevelChanged = val; obj = (object)val; } CharacterBody.OnCalculatedLevelChanged += (hook_OnCalculatedLevelChanged)obj; object obj2 = <>O.<1>__PlaceWarbanner; if (obj2 == null) { hook_OnCharacterLevelUp val2 = PlaceWarbanner; <>O.<1>__PlaceWarbanner = val2; obj2 = (object)val2; } WardOnLevelManager.OnCharacterLevelUp += (hook_OnCharacterLevelUp)obj2; CharacterBody.onBodyDestroyGlobal += delegate(CharacterBody body) { lastLevelUp.Remove(body); }; Run.onRunStartGlobal += delegate { lastLevelUp.Clear(); }; } private static void OnCalculatedLevelChanged(orig_OnCalculatedLevelChanged orig, CharacterBody self, float oldLevel, float newLevel) { if (newLevel > 99f && MonsterStatHooks.UsesMonsterLevel(self)) { if (lastLevelUp.TryGetValue(self, out var value) && Time.time - value < 1f) { return; } lastLevelUp[self] = Time.time; } orig.Invoke(self, oldLevel, newLevel); } private static void PlaceWarbanner(orig_OnCharacterLevelUp orig, CharacterBody characterBody) { if (UncapMonsterLevel.warbannersPastLimit.Value || !Object.op_Implicit((Object)(object)characterBody) || !(characterBody.level > 99f) || !MonsterStatHooks.UsesMonsterLevel(characterBody)) { orig.Invoke(characterBody); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public enum LevelLimit { Vanilla, GameLimit, NoLimit } internal static class MonsterLevelHooks { [CompilerGenerated] private static class <>O { public static Action<Run> <0>__OnRunStart; public static hook_RecalculateDifficultyCoefficentInternal <1>__RecalculateDifficultyCoefficentInternal; public static hook_OnRunAmbientLevelUp <2>__OnRunAmbientLevelUp; public static hook_OnEnter <3>__OnEnter; public static hook_OnEnter <4>__OnEnter; } public const int VANILLA_MAX_LEVEL = 99; public const int MAX_LEVEL = int.MaxValue; public const double MAX_REAL_LEVEL = 1E+27; private const double DIFFICULTY_PER_LEVEL = 0.33; private const double REFRESH_STEP = 0.01; private const double PERCENT = 100.0; private static int capBefore; private static bool capMoved; private static double refreshedAt; private static float lastLevelUpSound = float.NegativeInfinity; public static double Level { get; private set; } = 1.0; public static double MaxLevel { get { double num = UncapMonsterLevel.levelLimit.Value switch { LevelLimit.Vanilla => 99.0, LevelLimit.GameLimit => 2147483647.0, _ => 1E+27, }; int value = UncapMonsterLevel.maxLevel.Value; if (value <= 0) { return num; } return Math.Min(num, value); } } public static void Init() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: 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_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown Run.onRunStartGlobal += OnRunStart; object obj = <>O.<1>__RecalculateDifficultyCoefficentInternal; if (obj == null) { hook_RecalculateDifficultyCoefficentInternal val = RecalculateDifficultyCoefficentInternal; <>O.<1>__RecalculateDifficultyCoefficentInternal = val; obj = (object)val; } Run.RecalculateDifficultyCoefficentInternal += (hook_RecalculateDifficultyCoefficentInternal)obj; object obj2 = <>O.<2>__OnRunAmbientLevelUp; if (obj2 == null) { hook_OnRunAmbientLevelUp val2 = OnRunAmbientLevelUp; <>O.<2>__OnRunAmbientLevelUp = val2; obj2 = (object)val2; } LevelUpEffectManager.OnRunAmbientLevelUp += (hook_OnRunAmbientLevelUp)obj2; object obj3 = <>O.<3>__OnEnter; if (obj3 == null) { hook_OnEnter val3 = OnEnter; <>O.<3>__OnEnter = val3; obj3 = (object)val3; } Surprise.OnEnter += (hook_OnEnter)obj3; object obj4 = <>O.<4>__OnEnter; if (obj4 == null) { hook_OnEnter val4 = OnEnter; <>O.<4>__OnEnter = val4; obj4 = (object)val4; } Substitution.OnEnter += (hook_OnEnter)obj4; } private static void OnRunStart(Run run) { Level = 1.0; refreshedAt = 0.0; } private static void RecalculateDifficultyCoefficentInternal(orig_RecalculateDifficultyCoefficentInternal orig, Run self) { double maxLevel = MaxLevel; if (maxLevel == 99.0) { RestoreCap(); orig.Invoke(self); Level = self.ambientLevel; return; } if (!capMoved) { capBefore = Run.ambientLevelCap; capMoved = true; } int ambientLevelFloor = self.ambientLevelFloor; Run.ambientLevelCap = int.MaxValue; self.ambientLevelFloor = 0; orig.Invoke(self); double num = self.ambientLevel; if (num >= 2147483647.0) { num = Math.Max(num, (double)self.difficultyCoefficient / 0.33); } num = (Level = Math.Min(SlowDown(num), maxLevel)); self.ambientLevel = (float)num; double num3 = Math.Min(maxLevel, 2147483647.0); self.ambientLevelFloor = ((num >= num3) ? ((int)num3) : ((int)Math.Floor(num))); bool flag = num > 2147483647.0 && num >= refreshedAt * 1.01; if (ambientLevelFloor != 0 && (self.ambientLevelFloor > ambientLevelFloor || flag)) { refreshedAt = num; self.OnAmbientLevelUp(); } } private static double SlowDown(double level) { if (level <= 99.0) { return level; } return 99.0 + (level - 99.0) * ((double)UncapMonsterLevel.levelSpeed.Value / 100.0); } private static void RestoreCap() { if (capMoved) { Run.ambientLevelCap = capBefore; capMoved = false; } } private static void OnRunAmbientLevelUp(orig_OnRunAmbientLevelUp orig, Run run) { if (UncapMonsterLevel.levelUpSound.Value) { int value = UncapMonsterLevel.levelUpSoundInterval.Value; if (value <= 0 || !(Time.unscaledTime - lastLevelUpSound < (float)value)) { lastLevelUpSound = Time.unscaledTime; orig.Invoke(run); } } } private static void OnEnter(orig_OnEnter orig, Surprise self) { float level = LimitLevel(); try { orig.Invoke(self); } finally { RestoreLevel(level); } } private static void OnEnter(orig_OnEnter orig, Substitution self) { float level = LimitLevel(); try { orig.Invoke(self); } finally { RestoreLevel(level); } } private static float LimitLevel() { Run instance = Run.instance; if (!Object.op_Implicit((Object)(object)instance)) { return 0f; } float ambientLevel = instance.ambientLevel; instance.ambientLevel = Mathf.Min(ambientLevel, 2.1474836E+09f); return ambientLevel; } private static void RestoreLevel(float level) { if (Object.op_Implicit((Object)(object)Run.instance)) { Run.instance.ambientLevel = level; } } } internal static class MonsterStatHooks { private readonly struct LevelStats { private readonly float maxHealth; private readonly float regen; private readonly float maxShield; private readonly float moveSpeed; private readonly float jumpPower; private readonly float damage; private readonly float attackSpeed; private readonly float crit; private readonly float armor; public LevelStats(CharacterBody body) { maxHealth = body.levelMaxHealth; regen = body.levelRegen; maxShield = body.levelMaxShield; moveSpeed = body.levelMoveSpeed; jumpPower = body.levelJumpPower; damage = body.levelDamage; attackSpeed = body.levelAttackSpeed; crit = body.levelCrit; armor = body.levelArmor; } public void Apply(CharacterBody body, float factor) { body.levelMaxHealth = maxHealth * factor; body.levelRegen = regen * factor; body.levelMaxShield = maxShield * factor; body.levelMoveSpeed = moveSpeed * factor; body.levelJumpPower = jumpPower * factor; body.levelDamage = damage * factor; body.levelAttackSpeed = attackSpeed * factor; body.levelCrit = crit * factor; body.levelArmor = armor * factor; } } [CompilerGenerated] private static class <>O { public static hook_RecalculateStats <0>__RecalculateStats; } private const double STUCK_LEVEL = 2147483648.0; private static readonly Dictionary<CharacterBody, LevelStats> originals = new Dictionary<CharacterBody, LevelStats>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__RecalculateStats; if (obj == null) { hook_RecalculateStats val = RecalculateStats; <>O.<0>__RecalculateStats = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; CharacterBody.onBodyDestroyGlobal += delegate(CharacterBody body) { originals.Remove(body); }; Run.onRunStartGlobal += delegate { originals.Clear(); }; } private static void RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { double level = MonsterLevelHooks.Level; if (level > 2147483647.0 || originals.Count > 0) { SetLevelStats(self, level); } orig.Invoke(self); } private static void SetLevelStats(CharacterBody body, double level) { LevelStats value; bool flag = originals.TryGetValue(body, out value); float factor = GetFactor(body, level); if (factor == 1f) { if (flag) { value.Apply(body, 1f); originals.Remove(body); } return; } if (!flag) { value = new LevelStats(body); originals[body] = value; } value.Apply(body, factor); } public static float GetFactor(CharacterBody body, double level) { if (level <= 2147483647.0 || !UsesMonsterLevel(body)) { return 1f; } return (float)((level - 1.0) / 2147483647.0); } public static bool UsesMonsterLevel(CharacterBody body) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((body.bodyFlags & 0x20000000) != 0) { return true; } if (Object.op_Implicit((Object)(object)body.inventory)) { return body.inventory.GetItemCountEffective(Items.UseAmbientLevel) > 0; } return false; } } internal class MonsterStatsOverlay : MonoBehaviour { private const float REFRESH_INTERVAL = 0.25f; private const float REFERENCE_SCREEN_HEIGHT = 1080f; private const float MARGIN = 10f; private const float MAX_AIM_ANGLE = 10f; private const float MAX_AIM_DISTANCE = 1000f; private readonly BullseyeSearch search = new BullseyeSearch { sortMode = (SortMode)2, filterByLoS = true, maxAngleFilter = 10f, maxDistanceFilter = 1000f }; private readonly StringBuilder builder = new StringBuilder(); private readonly GUIContent content = new GUIContent(); private GUIStyle style; private CharacterBody target; private float elapsed; private void Awake() { ((MonoBehaviour)this).useGUILayout = false; } private void OnEnable() { target = null; content.text = null; elapsed = 0.25f; } private void Update() { elapsed += Time.unscaledDeltaTime; if (!(elapsed < 0.25f)) { elapsed = 0f; Refresh(); } } private void Refresh() { Run instance = Run.instance; LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)val)) { content.text = null; return; } CharacterBody val2 = FindAimedAt(val); if (Object.op_Implicit((Object)(object)val2)) { target = val2; } if (Object.op_Implicit((Object)(object)target) && (!Object.op_Implicit((Object)(object)target.healthComponent) || !target.healthComponent.alive)) { target = null; } builder.Clear(); builder.Append("Uncap monster level\n"); builder.Append($"Monster level: {LevelDisplay.Format(MonsterLevelHooks.Level)} (the game counts {instance.ambientLevelFloor})\n"); if (!Object.op_Implicit((Object)(object)target)) { builder.Append("Aim at a monster to see its stats"); } else { HealthComponent healthComponent = target.healthComponent; builder.Append(Util.GetBestBodyName(((Component)target).gameObject) + ", level " + LevelDisplay.Format(target.level) + "\n"); builder.Append("Health: " + LevelDisplay.Format(healthComponent.health) + " / " + LevelDisplay.Format(target.maxHealth)); if (target.maxShield > 0f) { builder.Append(", shield: " + LevelDisplay.Format(healthComponent.shield) + " / " + LevelDisplay.Format(target.maxShield)); } builder.Append("\nDamage: " + LevelDisplay.Format(target.damage) + ", armor: " + LevelDisplay.Format(target.armor) + ", regen: " + LevelDisplay.Format(target.regen) + "/s\n"); builder.Append("Stats per level: x" + LevelDisplay.Format(MonsterStatHooks.GetFactor(target, MonsterLevelHooks.Level))); } content.text = builder.ToString(); } private CharacterBody FindAimedAt(CharacterBody player) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Ray val = (Ray)(Object.op_Implicit((Object)(object)player.inputBank) ? player.inputBank.GetAimRay() : new Ray(player.corePosition, player.transform.forward)); search.viewer = player; search.searchOrigin = ((Ray)(ref val)).origin; search.searchDirection = ((Ray)(ref val)).direction; search.teamMaskFilter = TeamMask.GetEnemyTeams(player.teamComponent.teamIndex); search.RefreshCandidates(); HurtBox val2 = search.GetResults().FirstOrDefault(); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.healthComponent)) { return null; } return val2.healthComponent.body; } private void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0074: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0062: Expected O, but got Unknown if ((int)Event.current.type == 7 && !string.IsNullOrEmpty(content.text)) { if (style == null) { style = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)0, fontSize = 14, wordWrap = false, padding = new RectOffset(8, 8, 6, 6) }; } float num = (float)Screen.height / 1080f; GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f)); Vector2 val = style.CalcSize(content); float num2 = (1080f - val.y) / 2f; GUI.Box(new Rect(10f, num2, val.x, val.y), content, style); } } } internal static class RiskOfOptionsCompat { public const string GUID = "com.rune580.riskofoptions"; private const string ICON_FILE = "icon.png"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); [MethodImpl(MethodImplOptions.NoInlining)] public static void Init(string pluginLocation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0084: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown ModSettingsManager.SetModDescription("Lets the monsters level past 99, also past what the game can count to, and lets you change how fast they do so."); Sprite val = LoadIcon(pluginLocation); if (Object.op_Implicit((Object)(object)val)) { ModSettingsManager.SetModIcon(val); } ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)UncapMonsterLevel.levelLimit)); ConfigEntry<int> maxLevel = UncapMonsterLevel.maxLevel; IntFieldConfig val2 = new IntFieldConfig(); ((NumericFieldConfig<int>)val2).Min = 0; ((NumericFieldConfig<int>)val2).Max = int.MaxValue; ModSettingsManager.AddOption((BaseOption)new IntFieldOption(maxLevel, val2)); ModSettingsManager.AddOption((BaseOption)new SliderOption(UncapMonsterLevel.levelSpeed, new SliderConfig { min = 1f, max = 1000f, FormatString = "{0:0.#}%" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UncapMonsterLevel.levelUpSound)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(UncapMonsterLevel.levelUpSoundInterval, new IntSliderConfig { min = 0, max = 60 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UncapMonsterLevel.levelUpEffect)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(UncapMonsterLevel.levelUpEffectInterval, new IntSliderConfig { min = 0, max = 60 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UncapMonsterLevel.allyLevelUpEffects)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UncapMonsterLevel.warbannersPastLimit)); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)UncapMonsterLevel.numberStyle)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(UncapMonsterLevel.digits, new IntSliderConfig { min = 3, max = 10 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UncapMonsterLevel.showMonsterStats)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(UncapMonsterLevel.toggleMonsterStatsKey)); } private static Sprite LoadIcon(string pluginLocation) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) string directoryName = Path.GetDirectoryName(pluginLocation); string path = Path.Combine(directoryName, "icon.png"); if (!File.Exists(path)) { path = Path.Combine(Path.GetDirectoryName(directoryName), "icon.png"); } if (!File.Exists(path)) { return null; } Texture2D val = new Texture2D(2, 2); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } [BepInPlugin("360gaggi.UncapMonsterLevel", "UncapMonsterLevel", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class UncapMonsterLevel : BaseUnityPlugin { public const string PLUGIN_GUID = "360gaggi.UncapMonsterLevel"; public const string PLUGIN_AUTHOR = "360gaggi"; public const string PLUGIN_NAME = "UncapMonsterLevel"; public const string PLUGIN_VERSION = "1.1.1"; public const float MIN_LEVEL_SPEED = 1f; public const float MAX_LEVEL_SPEED = 1000f; public const int MAX_LEVEL_UP_INTERVAL = 60; public const int MIN_DIGITS = 3; public const int MAX_DIGITS = 10; public static ConfigEntry<LevelLimit> levelLimit; public static ConfigEntry<int> maxLevel; public static ConfigEntry<float> levelSpeed; public static ConfigEntry<bool> levelUpSound; public static ConfigEntry<int> levelUpSoundInterval; public static ConfigEntry<bool> levelUpEffect; public static ConfigEntry<int> levelUpEffectInterval; public static ConfigEntry<bool> allyLevelUpEffects; public static ConfigEntry<bool> warbannersPastLimit; public static ConfigEntry<NumberStyle> numberStyle; public static ConfigEntry<int> digits; public static ConfigEntry<bool> showMonsterStats; public static ConfigEntry<KeyboardShortcut> toggleMonsterStatsKey; private MonsterStatsOverlay overlay; public void Awake() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); levelLimit = ((BaseUnityPlugin)this).Config.Bind<LevelLimit>("Monsters", "Level limit", LevelLimit.GameLimit, "How far the monsters can level. Vanilla: 99, like without the mod. GameLimit: 2,147,483,647, as high as the game can count. NoLimit: past that as well, up to a level with 27 zeros"); maxLevel = ((BaseUnityPlugin)this).Config.Bind<int>("Monsters", "Max level", 0, new ConfigDescription("A cap of your own, if it is lower than the level limit it counts instead. 0 is none", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>())); levelSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Monsters", "Level speed past 99", 100f, new ConfigDescription("How fast the monsters keep levelling once they are past 99, in percent. 100% is what the difficulty of the run asks for, which gets out of hand in a long run: the levels come faster with every stage. With 50% they come half as fast. Up to 99 nothing changes", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>())); levelUpSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Monsters", "Level up sound", true, "Plays the sound when the monsters level up. Turn it off to never hear it"); levelUpSoundInterval = ((BaseUnityPlugin)this).Config.Bind<int>("Monsters", "Level up sound interval", 1, new ConfigDescription("The least time between two of the sounds that play when the monsters level up, in seconds. Late in a run they level many times a second. 0 plays every single one like vanilla", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 60), Array.Empty<object>())); levelUpEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("Monsters", "Level up effect", true, "Shows the ring of light a character gets when it levels up. Turn it off to never see it, on any character"); levelUpEffectInterval = ((BaseUnityPlugin)this).Config.Bind<int>("Monsters", "Level up effect interval", 1, new ConfigDescription("The least time between two of the rings of light a character gets when it levels up, in seconds. Counts for every character on its own: monsters, allies and players. Late in a run the monsters level many times a second. 0 shows every single one like vanilla", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 60), Array.Empty<object>())); allyLevelUpEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Monsters", "Ally level up effects", true, "Shows the ring of light (and plays its sound) when an ally that levels with the monsters levels up: drones, turrets and the like, which the game gives the level of the monsters. Past 99 they level up all the time. Your own level ups are not touched"); warbannersPastLimit = ((BaseUnityPlugin)this).Config.Bind<bool>("Monsters", "Warbanners past 99", true, "Lets everything that levels with the monsters put down a Warbanner for a level up past 99: drones and turrets that carry your items, monsters with items. Even once a second that can be a lot. Your own Warbanners are not touched"); KeepOldSettings(); numberStyle = ((BaseUnityPlugin)this).Config.Bind<NumberStyle>("Display", "Number style", NumberStyle.Short, "How a level of 1000 or more gets shown. Short: 12.5K, Scientific: 1.25e4, Full: 12,500"); digits = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "Digits", 3, new ConfigDescription("How many digits a shortened level shows at most. With 3: 1.25K, 12.5K, 125K, 1.25M. Full always shows every digit", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 10), Array.Empty<object>())); showMonsterStats = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Show monster stats", false, "Shows the level, health and damage of the monster you aim at, to see them getting stronger"); toggleMonsterStatsKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Debug", "Toggle monster stats", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), "Shows and hides the monster stats"); MonsterLevelHooks.Init(); MonsterStatHooks.Init(); LevelUpEffectHooks.Init(); LevelUpLimitHooks.Init(); DirectorCreditHooks.Init(); LevelDisplay.Init(); overlay = ((Component)this).gameObject.AddComponent<MonsterStatsOverlay>(); ((Behaviour)overlay).enabled = showMonsterStats.Value; if (RiskOfOptionsCompat.Enabled) { RiskOfOptionsCompat.Init(((BaseUnityPlugin)this).Info.Location); } } private void KeepOldSettings() { ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Monsters", "Uncap level", true, ""); if (!val.Value) { levelLimit.Value = LevelLimit.Vanilla; } ((BaseUnityPlugin)this).Config.Remove(((ConfigEntryBase)val).Definition); ((BaseUnityPlugin)this).Config.Save(); if (maxLevel.Value == int.MaxValue) { maxLevel.Value = 0; } } public void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = toggleMonsterStatsKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { showMonsterStats.Value = !showMonsterStats.Value; } ((Behaviour)overlay).enabled = showMonsterStats.Value; } } }