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 MonarchsStarstormEdits v0.1.1
MonarchStarstormEdits.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; 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 BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MSU.Config; using Microsoft.CodeAnalysis; using MonarchStarstormEdits.patches; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; using RoR2.ExpansionManagement; using SS2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityHotReloadNS; [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("MonarchStarstormEdits")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f6676ca7adceafe8f8bc541ea4598e8487290979")] [assembly: AssemblyProduct("MonarchStarstormEdits")] [assembly: AssemblyTitle("MonarchStarstormEdits")] [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 MonarchStarstormEdits { 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); } } [BepInPlugin("icebro.MonarchStarstormEdits", "MonarchStarstormEdits", "0.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MonarchStarstormEdits : BaseUnityPlugin { private const string PluginGUID = "icebro.MonarchStarstormEdits"; private const string PluginAuthor = "icebro"; private const string PluginName = "MonarchStarstormEdits"; private const string PluginVersion = "0.1.1"; private static bool UHRInstalled => Chainloader.PluginInfos.ContainsKey("iDeathHD.UnityHotReload"); public void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Harmony harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(PatchBase)) select type; foreach (Type item in enumerable) { PatchBase patchBase = (PatchBase)Activator.CreateInstance(item); try { patchBase.Config(((BaseUnityPlugin)this).Config); patchBase.Init(harmony); } catch (Exception data) { Log.Error(data); } } } private void Update() { if (Input.GetKeyUp((KeyCode)286)) { if (UHRInstalled) { UHRSupport.hotReload(typeof(MonarchStarstormEdits).Assembly, Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "MonarchStarstormEdits.dll")); } else { Log.Debug("couldnt finds unity hot reload !!"); } } } } internal static class UHRSupport { internal static void hotReload(Assembly assembly, string path) { UnityHotReload.LoadNewAssemblyVersion(assembly, path); } } } namespace MonarchStarstormEdits.patches { public class eliteEvents : PatchBase<eliteEvents> { [HarmonyPatch] public class Starstorm2EliteEventChanges { [HarmonyPatch(typeof(EliteEventMissionController), "SpawnBoss")] [HarmonyPrefix] public static bool EliteEventMissionControllerPrefix(EliteEventMissionController __instance) { if (!preventBossSpawns.Value) { return true; } __instance.hasSpawnedBoss = true; __instance.StopEvent(); return false; } [HarmonyPatch(typeof(EventDirector), "CreateEventTimeline")] [HarmonyILManipulator] public static void EventDirectorIL(ILContext il) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (disableEliteEvents.Value) { Log.Debug("fkgndflkgdfg ,,."); ILCursor val = new ILCursor(il); ILLabel _ilLabel = null; if (val.TryGotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "SS2.SS2Config", "enableBeta"), (Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)typeof(ConfiguredVariable<>).MakeGenericType(typeof(bool)).GetMethod("op_Implicit")), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2), (Instruction x) => ILPatternMatchingExt.MatchAnd(x), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref _ilLabel) })) { val.Index += 6; val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Brfalse, (object)_ilLabel); Log.Debug("managed to ilhook elite events !! they will never show up ever again .,,."); } else { Log.Warning("failed il hook elite events!!"); } } } } private static ConfigEntry<bool> eliteEventChanges; private static ConfigEntry<bool> disableEliteEvents; private static ConfigEntry<bool> preventBossSpawns; public override void Init(Harmony harmony) { if (eliteEventChanges.Value) { harmony.CreateClassProcessor(typeof(Starstorm2EliteEventChanges)).Patch(); } } public override void Config(ConfigFile config) { eliteEventChanges = config.Bind<bool>("elite event change s,s,.,.", "apply any elite event changes at al l !!", true, "byeah ,.,"); disableEliteEvents = config.Bind<bool>("elite event change s,s,.,.", "disable elite events entirely !!!!", false, "byeah ,.,"); preventBossSpawns = config.Bind<bool>("elite event change s,s,.,.", "disable boss spawns during elite events ,..,", false, "byeah ,.,"); } } public class etherealSaplingChanges : PatchBase<etherealSaplingChanges> { [HarmonyPatch] public class Starstorm2EtherealChanges { [HarmonyPatch(typeof(EtherealBehavior), "SpawnShrine")] [HarmonyPrefix] public static bool SpawnShrinePrefix(EtherealBehavior __instance) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown float num = Run.instance.runRNG.RangeFloat(0f, 1f); if (num <= spawnChance.Value) { if (sendChatMessage.Value) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = chatMessage.Value }); } return true; } return false; } } private static ConfigEntry<bool> etherealChanges; private static ConfigEntry<float> spawnChance; private static ConfigEntry<bool> sendChatMessage; private static ConfigEntry<string> chatMessage; public override void Init(Harmony harmony) { if (etherealChanges.Value) { harmony.CreateClassProcessor(typeof(Starstorm2EtherealChanges)).Patch(); } } public override void Config(ConfigFile config) { etherealChanges = config.Bind<bool>("ethereal shrine change s,s,.,.", "apply any ethereal sapling changes at al l !!", true, "byeah ,.,"); spawnChance = config.Bind<float>("ethereal shrine change s,s,.,.", "chance in percent to spawn ethereal shrine !! 1 is 100% ,.,,.", 0.5f, "byeah ,.,"); sendChatMessage = config.Bind<bool>("ethereal shrine change s,s,.,.", "should if a shrine spawn send a chat message !!", true, "byeah ,.,"); chatMessage = config.Bind<string>("ethereal shrine change s,s,.,.", "said chat message if chat message enabled ,,.", "<style=\"cIsHealing\">Unknown forces start to coalesce...</style>", "byeah ,.,"); } } public class gamblerTweaks : PatchBase<gamblerTweaks> { [HarmonyPatch] public class Starstorm2GamblerTweaks { [HarmonyPatch(typeof(CurseManager), "OnBodyStartGlobal")] [HarmonyILManipulator] public static void OnEnterPostFix(ILContext il) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (baseCloakDuration.Value == 0f) { return; } Log.Debug("tryings il hook curse cloak unevilify ,,."); ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Buffs", "Cloak"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(CharacterBody).GetMethod("AddBuff", new Type[1] { typeof(BuffDef) })) })) { val.RemoveRange(3); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody cb) { cb.AddTimedBuff(Buffs.Cloak, baseCloakDuration.Value * CurseManager.GetCurseIntensity() * (float)CurseManager.GetActiveCurseCount((CurseIndex)7)); }); Log.Debug("unevilified cloak !!"); } else { Log.Warning("failed il hook curse cloak !!"); } } [HarmonyPatch(typeof(RewardDropper), "GeneratePickups")] [HarmonyPrefix] public static bool PickupPostFix(RewardDropper __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) if (injectorToCoupler.Value && Run.instance.IsExpansionEnabled(Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC3/DLC3.asset").WaitForCompletion())) { PickupIndex[] pickups = __instance.reward.pickups; foreach (PickupIndex val in pickups) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val); if (pickupDef != null && (int)pickupDef.equipmentIndex == -1) { Log.Debug("not equipmnet ,..,"); continue; } Log.Debug("adding extra equip item to reward !!"); Array.Resize(ref __instance.reward.pickups, __instance.reward.pickups.Length + 1); __instance.reward.pickups[^1] = PickupCatalog.FindPickupIndex(Items.ExtraEquipment.itemIndex); } } return true; } } private static ConfigEntry<float> baseCloakDuration; private static ConfigEntry<bool> injectorToCoupler; public override void Init(Harmony harmony) { harmony.CreateClassProcessor(typeof(Starstorm2GamblerTweaks)).Patch(); } public override void Config(ConfigFile config) { baseCloakDuration = config.Bind<float>("lunar gambler tweaks !!!", "makes cloak curse have a timer instead of always .,., i hate them so much ,.,..,,. 0 to disable !!", 15f, "byeah ,.,"); injectorToCoupler = config.Bind<bool>("lunar gambler tweaks !!!", "add a functional coupler (if dlc3 enabled( to rewards with equipments (ones that used to have composite injector .,.,", true, "byeah ,.,"); } } public abstract class PatchBase<T> : PatchBase where T : PatchBase<T> { public static T instance { get; private set; } public PatchBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBase was instantiated twice"); } instance = this as T; } } public abstract class PatchBase { public abstract void Init(Harmony harmony); public abstract void Config(ConfigFile config); public virtual void Hooks() { } } }