using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BalancedMortician.Changes; using BalancedMortician.Modules; using BepInEx; using BepInEx.Logging; using EntityStates; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Morris.Components; using Morris.Modules.NPC; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Navigation; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using SkillStates.Ghoul; using SkillStates.Morris; using SkillStates.SharedStates; using UnityEngine; using UnityEngine.AddressableAssets; 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: IgnoresAccessChecksTo("AmpMod")] [assembly: IgnoresAccessChecksTo("Morris")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BalancedMortician")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BalancedMortician")] [assembly: AssemblyTitle("BalancedMortician")] [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 BalancedMortician { [BepInPlugin("com.Bloonjitsu7.BalancedMortician", "BalancedMortician", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public const string PluginGUID = "Bloonjitsu7.BalancedMortician"; public const string PluginAuthor = "Bloonjitsu7"; public const string PluginName = "BalancedMortician"; public const string PluginVersion = "1.0.0"; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); new ContentPacks().Initialize(); SurvivorChanges survivorChanges = new SurvivorChanges(); survivorChanges.Initialize(); } } 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); } } } namespace BalancedMortician.Modules { public static class DamageTypes { public static ModdedDamageType arsonistLifesteal = DamageAPI.ReserveDamageType(); } public static class Projectiles { internal static List projectilePrefabs = new List(); internal static void RegisterProjectiles() { } } public static class Buffs { internal static List buffDefs = new List(); internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool isCooldown, bool isHidden) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.isCooldown = isCooldown; val.isHidden = isHidden; buffDefs.Add(val); return val; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public string identifier => "com.Bloonjitsu7.BalancedMortician"; public void Initialize() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Projectiles.RegisterProjectiles(); ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.buffDefs.Add(Buffs.buffDefs.ToArray()); contentPack.projectilePrefabs.Add(Projectiles.projectilePrefabs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } } namespace BalancedMortician.Changes { public class SurvivorChanges : BaseState { private ILHook shovelHook; private Hook launchHook; private Hook sacrificeHook; private Hook tombstoneHook; private Hook minionHook; private Hook ghoulSpawnHook; private Hook tombstoneSpawnHook; private static GameObject fireExplosionPrefab = Addressables.LoadAssetAsync((object)RoR2_Base_Common.TeamAreaIndicator__GroundOnly_prefab).WaitForCompletion(); public void Initialize() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(SwingShovel), "OnEnter", (Type[])null, (Type[])null); shovelHook = new ILHook((MethodBase)methodInfo, new Manipulator(IL_ShovelEnter)); MethodInfo methodInfo2 = AccessTools.Method(typeof(BaseLaunchedState), "OnEnter", (Type[])null, (Type[])null); launchHook = new Hook((MethodBase)methodInfo2, (Delegate)new Action, BaseLaunchedState>(OnLaunchEnter)); MethodInfo methodInfo3 = AccessTools.Method(typeof(GhoulDeath), "OnEnter", (Type[])null, (Type[])null); sacrificeHook = new Hook((MethodBase)methodInfo3, (Delegate)new Action, GhoulDeath>(OnSacrificeEnter)); MethodInfo methodInfo4 = AccessTools.Method(typeof(TombstoneController), "Start", (Type[])null, (Type[])null); tombstoneHook = new Hook((MethodBase)methodInfo4, (Delegate)new Action, TombstoneController>(OnTombstoneStart)); MethodInfo methodInfo5 = AccessTools.Method(typeof(MorrisMinionController), "Start", (Type[])null, (Type[])null); minionHook = new Hook((MethodBase)methodInfo5, (Delegate)new Action, MorrisMinionController>(OnMinionStart)); MethodInfo methodInfo6 = AccessTools.Method(typeof(SpawnGhoul), "AttemptSpawnGhoul", (Type[])null, (Type[])null); ghoulSpawnHook = new Hook((MethodBase)methodInfo6, (Delegate)new Action, SpawnGhoul>(OnSpawnGhoul)); MethodInfo methodInfo7 = AccessTools.Method(typeof(TombstoneController), "SpawnGhoulAtClosestNode", (Type[])null, (Type[])null); tombstoneSpawnHook = new Hook((MethodBase)methodInfo7, (Delegate)new Action, TombstoneController>(OnSpawnGhoulTombstone)); } public void IL_ShovelEnter(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MoveType val2 = (MoveType)2; if (val.TryGotoNext(val2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(OverlapAttack), "damageType") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)delegate(SwingShovel self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) self.attack.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1); }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)delegate { SwingShovel.damageCoefficient = 3.6f; }); } else { Log.Error(((MemberReference)il.Method).Name + " Hook 1 failed!"); } } private void OnLaunchEnter(Action orig, BaseLaunchedState self) { BaseLaunchedState.damageCoefficient = 6f; orig(self); } private void OnGhoulEnter(Action orig, GhoulMelee self) { GhoulMelee.damageCoefficient = 1.2f; orig(self); self.attack.procCoefficient = 0.5f; } private void OnSpitEnter(Action orig, BileSpit self) { BileSpit.damageCoefficient = 0.8f; orig(self); } private void OnClingEnter(Action orig, ClingState self) { ClingState.biteInterval = 0.85f; orig(self); } private void OnSacrificeEnter(Action orig, GhoulDeath self) { GhoulDeath.sacrificedDamageCoefficient = 9.25f; GhoulDeath.sacrificedRadius = 20f; orig(self); } private void OnTombstoneStart(Action orig, TombstoneController self) { TombstoneController.soulOrbDamage = 2f; orig(self); } private void OnMinionStart(Action orig, MorrisMinionController self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 orig(self); if ((int)self.minionType == 1) { self.characterBody.baseDamage = 8f; self.characterBody.levelDamage = 1.6f; } } private void OnSpawnGhoul(Action orig, SpawnGhoul self) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_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) MasterSummon val = new MasterSummon(); val.masterPrefab = GhoulMinion.ghoulMasterPrefab; val.ignoreTeamMemberLimit = true; val.teamIndexOverride = (TeamIndex)1; val.summonerBodyObject = ((EntityState)self).gameObject; val.position = self.GetBestSpawnPosition(((BaseState)self).GetAimRay()); val.rotation = Util.QuaternionSafeLookRotation(((EntityState)self).characterDirection.forward); if (NetworkServer.active) { CharacterMaster val2 = val.Perform(); } } private void OnSpawnGhoulTombstone(Action orig, TombstoneController self) { //IL_0027: 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_0035: 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_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_0055: 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_0068: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void Morris.Components.TombstoneController::SpawnGhoulAtClosestNode()' called on client"); return; } NodeIndex val = self.nodeGraph.FindClosestNodeWithFlagConditions(((Component)self).transform.position, (HullClassification)0, (NodeFlags)0, (NodeFlags)4, false); Vector3 position = default(Vector3); self.nodeGraph.GetNodePosition(val, ref position); CharacterMaster val2 = new MasterSummon { masterPrefab = GhoulMinion.ghoulMasterPrefab, ignoreTeamMemberLimit = true, teamIndexOverride = (TeamIndex)1, summonerBodyObject = self.minionController.owner, position = position, rotation = ((Component)self).transform.rotation }.Perform(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }