Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ScorchWurmTweaks v1.2.2
plugins/ScorchWurmTweaks/ScorchWurmTweaks.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.Scorchling; using HG.Reflection; using IL; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using On.EntityStates.Scorchling; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Navigation; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScorchWurmTweaks")] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyInformationalVersion("1.0.0+be1f456601de8e06f63eccb52b377a8049d9aebd")] [assembly: AssemblyProduct("ScorchWurmTweaks")] [assembly: AssemblyTitle("ScorchWurmTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] [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 ScorchWurmTweaks { public class BreachComponentNux : NetworkBehaviour { [SyncVar(hook = "OnShouldReposition")] public Vector3 breachPosition = Vector3.zero; private EntityStateMachine entityStateMachine; public Vector3 NetworkbreachPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return breachPosition; } [param: In] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ref Vector3 reference = ref breachPosition; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnShouldReposition(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar<Vector3>(value, ref reference, 1u); } } private void OnShouldReposition(Vector3 newPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) NetworkbreachPosition = newPosition; if (Object.op_Implicit((Object)(object)entityStateMachine)) { entityStateMachine.SetNextState((EntityState)(object)new BetterScorchlingBurrow()); } } private void Start() { foreach (EntityStateMachine item in ((Component)this).GetComponents<EntityStateMachine>().ToList()) { if (item.customName == "Body") { entityStateMachine = item; } } } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { //IL_0008: 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) if (forceAll) { writer.Write(breachPosition); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(breachPosition); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (initialState) { breachPosition = reader.ReadVector3(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { OnShouldReposition(reader.ReadVector3()); } } } public class BetterLavaBomb : BaseState { public float breachToSpitTime = 1f; public float spitToLaunchTime; public float spitToBurrowTime = 2.5f; public float burrowToEndOfTime = 3f; public float animDurationBreach; public float animDurationSpit = 1f; public float animDurationBurrow = 1f; public float animDurationPostSpit = 1f; public float percentageToFireProjectile = 0.3f; public GameObject burrowEffectPrefab; public float burrowRadius = 1f; public static int mortarCount; public static float mortarDamageCoefficient = 2f; public static float minimumDistance = 10f; public string spitSoundString = "Play_scorchling_slagBomb_shoot"; public static float timeToTarget = 1.25f; public static float projectileVelocity = 55f; private CharacterBody enemyCBody; private bool spitStarted; private bool firedProjectile; private bool earlyExit; private ScorchlingController sController; public override void OnEnter() { ((BaseState)this).OnEnter(); sController = ((Component)((EntityState)this).characterBody).GetComponent<ScorchlingController>(); animDurationBreach = (sController.isBurrowed ? animDurationBreach : 0f); spitToBurrowTime += animDurationBreach + animDurationSpit; burrowToEndOfTime += spitToBurrowTime; Target currentEnemy = ((Component)((EntityState)this).characterBody.master).GetComponent<BaseAI>().currentEnemy; enemyCBody = ((currentEnemy != null) ? currentEnemy.characterBody : null); if (sController.isBurrowed) { earlyExit = true; } else { ((EntityState)this).characterBody.SetAimTimer(burrowToEndOfTime); } } public override void FixedUpdate() { if (earlyExit) { return; } ((EntityState)this).FixedUpdate(); if (!spitStarted && ((EntityState)this).fixedAge > animDurationBreach) { spitStarted = true; ((EntityState)this).PlayAnimation("FullBody, Override", "Spit", "Spit.playbackRate", animDurationSpit, 0f); } if (spitStarted && !firedProjectile && ((EntityState)this).fixedAge > animDurationSpit * percentageToFireProjectile + animDurationBreach) { firedProjectile = true; Util.PlaySound(spitSoundString, ((EntityState)this).gameObject); EffectManager.SimpleMuzzleFlash(ScorchlingLavaBomb.mortarMuzzleflashEffect, ((EntityState)this).gameObject, "MuzzleFire", false); if (((EntityState)this).isAuthority) { Spit(); } } if (firedProjectile && !(((EntityState)this).fixedAge <= animDurationBreach + animDurationSpit + animDurationPostSpit)) { ((EntityState)this).outer.SetNextStateToMain(); } } public void Spit() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_007c: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)((EntityState)this).characterBody.modelLocator.modelTransform).GetComponent<ChildLocator>().FindChild("MuzzleFire"); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val.position, val.forward); Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(((Ray)(ref val2)).origin, Vector3.up); bool flag = false; Vector3 val4 = Vector3.zero; if (Object.op_Implicit((Object)(object)enemyCBody)) { val4 = enemyCBody.transform.position; flag = true; } else { BullseyeSearch val5 = new BullseyeSearch(); val5.searchOrigin = ((Ray)(ref val2)).origin; val5.searchDirection = ((Ray)(ref val2)).direction; val5.filterByLoS = false; val5.teamMaskFilter = TeamMask.allButNeutral; if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent)) { ((TeamMask)(ref val5.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex); } val5.sortMode = (SortMode)2; val5.RefreshCandidates(); HurtBox val6 = val5.GetResults().FirstOrDefault(); RaycastHit val7 = default(RaycastHit); if (Object.op_Implicit((Object)(object)val6)) { val4 = ((Component)val6).transform.position; flag = true; } else if (Physics.Raycast(val2, ref val7, 1000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)1)) { val4 = ((RaycastHit)(ref val7)).point; flag = true; } } float magnitude = projectileVelocity; if (flag) { Vector3 val8 = val4 - ((Ray)(ref val3)).origin; Vector2 val9 = default(Vector2); ((Vector2)(ref val9))..ctor(val8.x, val8.z); float magnitude2 = ((Vector2)(ref val9)).magnitude; Vector2 val10 = val9 / magnitude2; if ((double)magnitude2 < (double)minimumDistance) { magnitude2 = minimumDistance; } float num = Trajectory.CalculateInitialYSpeed(timeToTarget, val8.y); float num2 = magnitude2 / timeToTarget; Vector3 direction = default(Vector3); ((Vector3)(ref direction))..ctor(val10.x * num2, num, val10.y * num2); magnitude = ((Vector3)(ref direction)).magnitude; ((Ray)(ref val3)).direction = direction; } Quaternion val11 = Util.QuaternionSafeLookRotation(((Ray)(ref val3)).direction); ProjectileManager.instance.FireProjectileWithoutDamageType(ScorchlingLavaBomb.mortarProjectilePrefab, ((Ray)(ref val3)).origin, val11, ((EntityState)this).gameObject, base.damageStat * mortarDamageCoefficient, 0f, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, magnitude); } public override void OnExit() { ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public class BetterScorchlingBurrow : BaseState { public string burrowSoundString = "Play_scorchling_burrow"; public string burrowLoopSoundString = "Play_scorchling_burrow_loop"; public string burrowStopLoopSoundString = "Stop_scorchling_burrow_loop"; public GameObject burrowEffectPrefab = Main.burrowEffectPrefab; public float burrowRadius = 1f; public float animDurationBurrow = 1f; public float burrowAnimationDuration = 1f; public float teleportDelay = 2f; private ScorchlingController sController; private bool waitingForBurrow; public override void OnEnter() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown ((BaseState)this).OnEnter(); sController = ((Component)((EntityState)this).characterBody).GetComponent<ScorchlingController>(); if (!sController.isBurrowed) { Util.PlaySound(burrowSoundString, ((EntityState)this).gameObject); Util.PlaySound(burrowLoopSoundString, ((EntityState)this).gameObject); EffectManager.SpawnEffect(burrowEffectPrefab, new EffectData { origin = ((EntityState)this).characterBody.footPosition, scale = burrowRadius }, true); ((EntityState)this).PlayAnimation("FullBody, Override", "Burrow", "Burrow.playbackRate", animDurationBurrow, 0f); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 0f; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.isSprinting = false; } waitingForBurrow = true; } } public override void FixedUpdate() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); HandleWaitForBurrow(); if (!(((EntityState)this).fixedAge <= teleportDelay)) { ((EntityState)this).outer.SetNextState((EntityState)new ScorchlingBreach()); } } public override void OnExit() { ((EntityState)this).OnExit(); HandleWaitForBurrow(); } private void HandleWaitForBurrow() { if (waitingForBurrow && !((double)((EntityState)this).fixedAge <= (double)burrowAnimationDuration)) { sController.Burrow(); waitingForBurrow = false; } } public override InterruptPriority GetMinimumInterruptPriority() { if (waitingForBurrow) { return (InterruptPriority)7; } return (InterruptPriority)1; } } public class CheckReposition : BaseState { public override void OnEnter() { ((BaseState)this).OnEnter(); if (NetworkServer.active) { ShouldReposition(); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); ((EntityState)this).outer.SetNextStateToMain(); } private void ShouldReposition() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) bool flag = true; Target currentEnemy = ((Component)((EntityState)this).characterBody.master).GetComponent<BaseAI>().currentEnemy; CharacterBody val = ((currentEnemy != null) ? currentEnemy.characterBody : null); if (!Object.op_Implicit((Object)(object)val)) { return; } BreachComponentNux component = ((EntityState)this).gameObject.GetComponent<BreachComponentNux>(); Vector3 footPosition = ((EntityState)this).characterBody.footPosition; NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)0); Vector3 val2 = RaycastToFloor(val.coreTransform.position); if (val2 == val.coreTransform.position) { flag = false; } List<NodeIndex> list = nodeGraph.FindNodesInRange(val2, 10f, 20f, (HullMask)2); Vector3 val3 = default(Vector3); bool flag2 = false; int num = 35; if (list.Count <= 0) { return; } while (!flag2) { NodeIndex val4 = list.ElementAt(Random.Range(0, list.Count)); nodeGraph.GetNodePosition(val4, ref val3); double num2 = Vector3.Distance(footPosition, val3); num--; if (num2 > 35.0 || num < 0) { flag2 = true; } } Vector3 val5 = val3; if (component.breachPosition == val5) { flag = false; } if (flag) { component.NetworkbreachPosition = val5; } } private Vector3 RaycastToFloor(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(position, Vector3.down), ref val, 200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return position; } return ((RaycastHit)(ref val)).point; } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)9; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber) { int num = callerPath.LastIndexOf("ScorchWurmTweaks"); if (num >= 0) { callerPath = callerPath.Substring(num + "ScorchWurmTweaks".Length + 1); } return $"{callerPath}:{callerLineNumber} ({callerMemberName}) "; } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Nuxlar.ScorchWurmTweaks", "ScorchWurmTweaks", "1.2.2")] public class Main : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Manipulator <0>__BaseStateOnEnterCallerMethodModifier; } public const string PluginGUID = "Nuxlar.ScorchWurmTweaks"; public const string PluginAuthor = "Nuxlar"; public const string PluginName = "ScorchWurmTweaks"; public const string PluginVersion = "1.2.2"; public static GameObject burrowEffectPrefab; private const BindingFlags allFlags = (BindingFlags)(-1); internal static Main Instance { get; private set; } public static string PluginDirectory { get; private set; } public void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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) //IL_0041: Expected O, but got Unknown Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); MethodInfo? method = typeof(Main).GetMethod("BaseStateOnEnterCaller", (BindingFlags)(-1)); object obj = <>O.<0>__BaseStateOnEnterCallerMethodModifier; if (obj == null) { Manipulator val = BaseStateOnEnterCallerMethodModifier; <>O.<0>__BaseStateOnEnterCallerMethodModifier = val; obj = (object)val; } new ILHook((MethodBase)method, (Manipulator)obj); bool flag = default(bool); ContentAddition.AddEntityState<CheckReposition>(ref flag); ContentAddition.AddEntityState<BetterLavaBomb>(ref flag); ContentAddition.AddEntityState<BetterScorchlingBurrow>(ref flag); LoadAssets(); TweakBody(); TweakBurrowDef(); TweakBreachDef(); TweakSkillDrivers(); TweakProjectileGhost(); TweakLavaBombDef(); ScorchlingController.Update += new Manipulator(PreventBreakage); ScorchlingBreach.OnEnter += new hook_OnEnter(TweakBreachState); SpawnState.OnEnter += new hook_OnEnter(TweakSpawnState); ScorchlingController.Start += new hook_Start(IncreaseTrailDelay); ScorchlingController.Burrow += new hook_Burrow(ReplaceBurrow); ScorchlingController.Breach += new hook_Breach(ReplaceBreach); } private void PreventBreakage(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Instruction instr = null; FieldReference val3 = default(FieldReference); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMotor>(x, "get_isGrounded"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2), (Instruction x) => MatchAny(x, out instr) })) { val.Emit(OpCodes.Br, instr); } } private void IncreaseTrailDelay(orig_Start orig, ScorchlingController self) { self.timeInAirToShutOffDustTrail = 10f; orig.Invoke(self); } private void TweakSpawnState(orig_OnEnter orig, SpawnState self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown orig.Invoke(self); ((EntityState)self).outer.SetNextState((EntityState)new ScorchlingBreach()); } private void ReplaceBurrow(orig_Burrow orig, ScorchlingController self) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) self.isRecentlyBurrowed = true; self.isBurrowed = true; self.SetTeleportPermission(true); if (NetworkServer.active) { self.ensureBurrowSkill.stock = 0; if (self.characterBody.GetBuffCount(Buffs.HiddenInvincibility.buffIndex) < 1) { self.characterBody.AddBuff(Buffs.HiddenInvincibility.buffIndex); } } self.originalLayer = ((Component)self).gameObject.layer; ((Component)self).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(self.characterBody.teamComponent.teamIndex).intVal; if (Object.op_Implicit((Object)(object)self.baseDirt) && Object.op_Implicit((Object)(object)self.dustTrail)) { self.baseDirt.SetActive(false); self.dustTrail.SetActive(true); self.dustTrailActive = true; self.armatureObject.SetActive(false); self.meshObject.SetActive(false); } self.enemyDetection.Enable(); } private void ReplaceBreach(orig_Breach orig, ScorchlingController self) { //IL_0023: 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_0063: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) self.isBurrowed = false; self.SetTeleportPermission(false); if (NetworkServer.active) { self.characterBody.RemoveBuff(Buffs.HiddenInvincibility.buffIndex); self.lavaBombSkill.stock = 1; if (Object.op_Implicit((Object)(object)self.characterBody)) { self.characterBody.isSprinting = false; } self.breachBaseDirtRotation = self.baseDirt.transform.rotation; ((Quaternion)(ref self.breachBaseDirtRotation)).eulerAngles = new Vector3(((Quaternion)(ref self.breachBaseDirtRotation)).eulerAngles.x, Mathf.Floor(((Quaternion)(ref self.breachBaseDirtRotation)).eulerAngles.y), ((Quaternion)(ref self.breachBaseDirtRotation)).eulerAngles.z); self.baseDirt.transform.localEulerAngles = Vector3.zero; self.baseDirt.transform.rotation = self.breachBaseDirtRotation; } ((Component)self).gameObject.layer = self.originalLayer; if (Object.op_Implicit((Object)(object)self.baseDirt) && Object.op_Implicit((Object)(object)self.dustTrail)) { self.baseDirt.SetActive(true); self.dustTrail.SetActive(false); self.dustTrailActive = false; self.armatureObject.SetActive(true); self.meshObject.SetActive(true); } self.enemyDetection.Disable(); } private void TweakBreachState(orig_OnEnter orig, ScorchlingBreach self) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown BaseStateOnEnterCaller((BaseState)(object)self); self.crackToBreachTime = 1f; self.breachToBurrow = 1f; self.proceedImmediatelyToLavaBomb = false; self.amServer = NetworkServer.active; self.scorchlingController = ((Component)((EntityState)self).characterBody).GetComponent<ScorchlingController>(); Util.PlaySound(self.preBreachSoundString, ((EntityState)self).gameObject); Target currentEnemy = ((Component)((EntityState)self).characterBody.master).GetComponent<BaseAI>().currentEnemy; self.enemyCBody = ((currentEnemy != null) ? currentEnemy.characterBody : null); BreachComponentNux component = ((EntityState)self).gameObject.GetComponent<BreachComponentNux>(); if (component.breachPosition != Vector3.zero) { self.breachPosition = component.breachPosition; } else { self.breachPosition = ((EntityState)self).characterBody.footPosition; } self.breachToBurrow += self.crackToBreachTime; self.burrowToEndOfTime += self.breachToBurrow; TeleportHelper.TeleportBody(((EntityState)self).characterBody, self.breachPosition, false); EffectManager.SpawnEffect(self.crackEffectPrefab, new EffectData { origin = self.breachPosition, scale = self.crackRadius }, true); self.scorchlingController.SetTeleportPermission(false); } private void LoadAssets() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Scorchling.VFXScorchlingEnterBurrow_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { burrowEffectPrefab = x.Result; }; } private void TweakBreachDef() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<SkillDef> val = AssetAsyncReferenceManager<SkillDef>.LoadAsset(new AssetReferenceT<SkillDef>(RoR2_DLC2_Scorchling.ScorchlingBreach_asset), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<SkillDef> x) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) x.Result.activationState = new SerializableEntityStateType(typeof(CheckReposition)); }; } private void TweakLavaBombDef() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<SkillDef> val = AssetAsyncReferenceManager<SkillDef>.LoadAsset(new AssetReferenceT<SkillDef>(RoR2_DLC2_Scorchling.ScorchlingLavaBomb_asset), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<SkillDef> x) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SkillDef result = x.Result; result.activationState = new SerializableEntityStateType(typeof(BetterLavaBomb)); result.baseRechargeInterval = 6f; }; } private void TweakBurrowDef() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<SkillDef> val = AssetAsyncReferenceManager<SkillDef>.LoadAsset(new AssetReferenceT<SkillDef>(RoR2_DLC2_Scorchling.ScorchlingEnsureBurrow_asset), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<SkillDef> x) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) SkillDef result = x.Result; result.activationState = new SerializableEntityStateType(typeof(CheckReposition)); result.baseRechargeInterval = 12f; }; } private void TweakBody() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Scorchling.ScorchlingBody_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { CharacterBody component = x.Result.GetComponent<CharacterBody>(); component.baseMoveSpeed = 0f; x.Result.AddComponent<BreachComponentNux>(); Object.Destroy((Object)(object)((Component)component).GetComponent<CharacterMotor>()); Object.Destroy((Object)(object)((Component)component).GetComponent<KinematicCharacterMotor>()); }; } private void TweakProjectileGhost() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Scorchling.LavaBombHeatOrbGhost_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown GameObject result = x.Result; AnimationCurve val2 = new AnimationCurve(); val2.AddKey(0f, 0f); val2.AddKey(1f, 1f); ObjectScaleCurve obj = ((Component)result.transform.GetChild(0)).gameObject.AddComponent<ObjectScaleCurve>(); obj.overallCurve = val2; obj.useOverallCurveOnly = true; obj.timeMax = 0.25f; }; } private void TweakSkillDrivers() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Scorchling.ScorchlingMaster_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { //IL_0077: 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_00b7: Unknown result type (might be due to invalid IL or missing references) AISkillDriver[] components = x.Result.GetComponents<AISkillDriver>(); foreach (AISkillDriver val2 in components) { if (val2.customName == "ChaseOffNodegraphClose" || val2.customName == "FollowNodeGraphToTarget") { Object.Destroy((Object)(object)val2); } if (val2.customName == "ChaseOffNodegraph") { val2.customName = "Stare"; val2.maxDistance = float.PositiveInfinity; val2.minDistance = 0f; val2.skillSlot = (SkillSlot)(-1); val2.requireSkillReady = false; } if (val2.customName == "Breach") { val2.maxDistance = float.PositiveInfinity; val2.skillSlot = (SkillSlot)2; val2.requiredSkill = null; val2.activationRequiresAimConfirmation = false; val2.aimType = (AimType)1; } if (val2.customName == "LavaBomb") { val2.maxDistance = 50f; val2.noRepeat = false; } } }; } private static void BaseStateOnEnterCaller(BaseState self) { } private static void BaseStateOnEnterCallerMethodModifier(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Call, (MethodBase)typeof(BaseState).GetMethod("OnEnter", (BindingFlags)(-1))); } public static bool MatchAny(Instruction instr, out Instruction instruction) { instruction = instr; return true; } } }