using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates.TeleporterCatastrophe.DLC4.Teleporter; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KillBossChargeTeleporter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3ea1d11c4d23cdf85ad2d25fba28c6fc8fc38c5b")] [assembly: AssemblyProduct("KillBossChargeTeleporter")] [assembly: AssemblyTitle("KillBossChargeTeleporter")] [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 KillBossChargeTeleporter { [BepInPlugin("OakPrime.KillBossChargeTeleporter", "KillBossChargeTeleporter", "1.1.1")] public class KillBossChargeTeleporter : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_UpdateMonstersClear <>9__4_0; public static hook_FixedUpdate <>9__4_1; internal void b__4_0(orig_UpdateMonstersClear orig, TeleporterInteraction self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self)) { TrySkipCharge(self, self.monstersCleared); } } internal void b__4_1(orig_FixedUpdate orig, TeleporterInteraction self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.mainStateMachine) && self.mainStateMachine.state is ChargingState && Object.op_Implicit((Object)(object)self.bossGroup)) { TrySkipCharge(self, !((Behaviour)self.bossGroup).enabled); } } } public const string PluginGUID = "OakPrime.KillBossChargeTeleporter"; public const string PluginAuthor = "OakPrime"; public const string PluginName = "KillBossChargeTeleporter"; public const string PluginVersion = "1.1.1"; public void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); try { object obj = <>c.<>9__4_0; if (obj == null) { hook_UpdateMonstersClear val = delegate(orig_UpdateMonstersClear orig, TeleporterInteraction self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self)) { TrySkipCharge(self, self.monstersCleared); } }; <>c.<>9__4_0 = val; obj = (object)val; } TeleporterInteraction.UpdateMonstersClear += (hook_UpdateMonstersClear)obj; object obj2 = <>c.<>9__4_1; if (obj2 == null) { hook_FixedUpdate val2 = delegate(orig_FixedUpdate orig, TeleporterInteraction self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.mainStateMachine) && self.mainStateMachine.state is ChargingState && Object.op_Implicit((Object)(object)self.bossGroup)) { TrySkipCharge(self, !((Behaviour)self.bossGroup).enabled); } }; <>c.<>9__4_1 = val2; obj2 = (object)val2; } TeleporterInteraction.FixedUpdate += (hook_FixedUpdate)obj2; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace)); } } private static void TrySkipCharge(TeleporterInteraction self, bool monstersCleared) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance) && monstersCleared && Object.op_Implicit((Object)(object)self.holdoutZoneController) && (int)self.activationState == 2 && !(self.chargeFraction <= 0.02f) && !(self.holdoutZoneController.charge >= 1f)) { HoldoutZoneController holdoutZoneController = self.holdoutZoneController; int displayChargePercent = holdoutZoneController.displayChargePercent; float runStopwatch = Run.instance.GetRunStopwatch(); GetTotalItemCountFromTeamArgs val = default(GetTotalItemCountFromTeamArgs); ((GetTotalItemCountFromTeamArgs)(ref val))..ctor(Items.FocusConvergence.itemIndex); val.requiresAlive = true; val.requiredTeam = holdoutZoneController.chargingTeam; val.requiresConnected = true; int num = Math.Min(Util.GetTotalItemCountFromTeam(val), 3); float num2 = (float)Math.Round((100.0 - (double)displayChargePercent) / 100.0 * ((double)holdoutZoneController.baseChargeDuration / (1.0 + 0.300000011920929 * (double)num)), 2); if (Object.op_Implicit((Object)(object)self.bonusDirector) && self.bonusDirector.moneyWaves != null) { GrantWouldBeRewards(num2, self.bonusDirector, self); } Run.instance.SetRunStopwatch(runStopwatch + num2); holdoutZoneController.FullyChargeHoldoutZone(); } } private static void GrantWouldBeRewards(float timeRemaining, CombatDirector combatDirector, TeleporterInteraction tpInteraction) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Invalid comparison between Unknown and I4 //IL_01d7: Unknown result type (might be due to invalid IL or missing references) float num = combatDirector.monsterCredit; for (int i = 0; i < combatDirector.moneyWaves.Length; i++) { num += combatDirector.moneyWaves[i].Update(timeRemaining, Run.instance.compensatedDifficultyCoefficient); while (combatDirector.moneyWaves[i].timer > combatDirector.moneyWaves[i].interval) { num += combatDirector.moneyWaves[i].Update(0f, Run.instance.compensatedDifficultyCoefficient); } } float num2 = num * combatDirector.expRewardCoefficient; if (!((double)num2 > (double)Mathf.Epsilon)) { return; } uint num3 = (uint)Mathf.Max(1f, num2 * Run.instance.compensatedDifficultyCoefficient); float num4 = (float)(1.0 + ((double)Run.instance.ambientLevel - 1.0) * 0.300000011920929); CharacterBody val = null; foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController._instancesReadOnly) { if ((Object)(object)item.body != (Object)null) { val = item.body; break; } } if ((Object)(object)val == (Object)null) { Log.LogError("No player bodies found!"); return; } ExperienceManager.instance.AwardExperience(tpInteraction.teleporterPositionIndicator.defaultPosition, val, (ulong)(uint)((double)num3 * (double)num4)); uint num5 = (uint)Mathf.Max(1f, (float)((double)num2 * (double)combatDirector.goldRewardCoefficient * 2.0) * Run.instance.compensatedDifficultyCoefficient); if ((int)Run.instance.selectedDifficulty >= 8) { num5 = (uint)((double)num5 * 0.800000011920929); } TeamManager.instance.GiveTeamMoney(tpInteraction.holdoutZoneController.chargingTeam, num5, false); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } }