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 BetterSpite v1.1.2
BetterSpite.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; 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.Configuration; using BepInEx.Logging; using On.RoR2; using On.RoR2.Artifacts; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using UnityEngine; [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.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BetterSpite")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterSpite")] [assembly: AssemblyTitle("BetterSpite")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace BetterSpite { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("HIFU.BetterSpite", "BetterSpite", "1.1.1")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.BetterSpite"; public const string PluginAuthor = "HIFU"; public const string PluginName = "BetterSpite"; public const string PluginVersion = "1.1.1"; public static ConfigFile BSConfig; public static ManualLogSource BSLogger; public AssetBundle betterspite; public void Awake() { BSLogger = ((BaseUnityPlugin)this).Logger; BSConfig = ((BaseUnityPlugin)this).Config; betterspite = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("BetterSpite.dll", "betterspite")); ModSettingsManager.SetModIcon(betterspite.LoadAsset<Sprite>("texModIcon.png")); IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase)) select type; BSLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+=="); foreach (Type item in enumerable) { TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item); if (ValidateTweak(tweakBase)) { tweakBase.Init(); } } } public bool ValidateTweak(TweakBase tb) { if (tb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(tb.Name, "Enable?", true, "Vanilla is false").Value) { return true; } return false; } } internal class Publicize { } public abstract class TweakBase { public abstract string Name { get; } public virtual bool isEnabled { get; } = true; public T ConfigOption<T>(T value, string name, string description) { //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_005f: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00c9: 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) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b9: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown ConfigEntryBase val = (ConfigEntryBase)(object)Main.BSConfig.Bind<T>(Name, name, value, description); if (!(value is bool)) { if (!(value is float)) { if (value is int) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption((ConfigEntry<int>)(object)val, new IntSliderConfig { restartRequired = true, min = 0, max = (int)val.DefaultValue * 10 })); } else { Main.BSLogger.LogInfo((object)("Failed to add a Risk Of Options config for" + Name)); } } else if ((float)val.DefaultValue == 0f) { ModSettingsManager.AddOption((BaseOption)new StepSliderOption((ConfigEntry<float>)(object)val, new StepSliderConfig { restartRequired = true, increment = 0.01f, min = 0f, max = 1f })); } else { ModSettingsManager.AddOption((BaseOption)new StepSliderOption((ConfigEntry<float>)(object)val, new StepSliderConfig { restartRequired = true, increment = (float)val.DefaultValue / 10f, min = 0f, max = (float)val.DefaultValue * 10f })); } } else { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption((ConfigEntry<bool>)(object)val, new CheckBoxConfig { restartRequired = true })); } return Main.BSConfig.Bind<T>(Name, name, value, description).Value; } public abstract void Hooks(); public virtual void Init() { Hooks(); Main.BSLogger.LogInfo((object)("Added " + Name)); } } } namespace BetterSpite.Tweaks { public class HIFUBallTweaks : TweakBase { [CompilerGenerated] private static class <>O { public static hook_OnArtifactEnabled <0>__ChangeStats; public static hook_FixedUpdate <1>__ChaoticSpiteBombsPart1; public static hook_Start <2>__ChaoticSpiteBombsPart2; } public static float BlastRadius; public static float DamageCoefficient; public static float FuseTimeout; public static float SpawnBaseRadius; public static float SpawnRadiusCoefficient; public static float ExtraPerRadius; public static int MaxCount; public static float MaxFallDistance; public static float MaxStepUpDistance; public static float ScaleBlastRadius; public static float ScaleDamageCoefficient; public static float ScaleFuseTimeout; public static float MinimumFuse; public static float ScaleSpawnBaseRadius; public static float ScaleSpawnRadiusCoefficient; public static float ScaleExtraPerRadius; public static int ScaleMaxCount; public override string Name => "Artifact of Spite Changes"; public override void Init() { BlastRadius = ConfigOption(7.5f, "Explosion Radius", "Vanilla is 7"); DamageCoefficient = ConfigOption(1.2f, "Damage Coefficient", "Vanilla is 1.5"); FuseTimeout = ConfigOption(4.5f, "Max Fuse Time", "Vanilla is 8"); SpawnBaseRadius = ConfigOption(7f, "Spawn Radius", "Vanilla is 3"); SpawnRadiusCoefficient = ConfigOption(7f, "Spawn Radius Coefficient", "Vanilla is 4"); ExtraPerRadius = ConfigOption(16f, "Extra Bombs per Radius", "Vanilla is 4"); MaxCount = ConfigOption(1000, "Max Bomb Count", "Vanilla is 30"); MaxFallDistance = ConfigOption(500f, "Max Fall Distance", "Vanilla is 60"); MaxStepUpDistance = ConfigOption(100f, "Max Step Up Distance", "Vanilla is 8"); ScaleBlastRadius = ConfigOption(0f, "Scaling Explosion Radius", "Vanilla is 0"); ScaleDamageCoefficient = ConfigOption(0.1f, "Scaling Damage Coefficient", "Vanilla is 0"); ScaleFuseTimeout = ConfigOption(0.1f, "Scaling Max Fuse Time", "Vanilla is 0"); ScaleSpawnBaseRadius = ConfigOption(0.15f, "Scaling Spawn Radius", "Vanilla is 0"); ScaleSpawnRadiusCoefficient = ConfigOption(0.15f, "Scaling Spawn Radius Coefficient", "Vanilla is 0"); ScaleExtraPerRadius = ConfigOption(0.15f, "Scaling Extra Bombs per Radius", "Vanilla is 0"); ScaleMaxCount = ConfigOption(10, "Scaling Max Bomb Count", "Vanilla is 0"); MinimumFuse = ConfigOption(0.4f, "Minimum Fuse Time", "Default is 0.4"); base.Init(); } public override void Hooks() { //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) //IL_001c: Expected O, but got Unknown //IL_0032: 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_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown object obj = <>O.<0>__ChangeStats; if (obj == null) { hook_OnArtifactEnabled val = ChangeStats; <>O.<0>__ChangeStats = val; obj = (object)val; } BombArtifactManager.OnArtifactEnabled += (hook_OnArtifactEnabled)obj; object obj2 = <>O.<1>__ChaoticSpiteBombsPart1; if (obj2 == null) { hook_FixedUpdate val2 = ChaoticSpiteBombsPart1; <>O.<1>__ChaoticSpiteBombsPart1 = val2; obj2 = (object)val2; } SpiteBombController.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__ChaoticSpiteBombsPart2; if (obj3 == null) { hook_Start val3 = ChaoticSpiteBombsPart2; <>O.<2>__ChaoticSpiteBombsPart2 = val3; obj3 = (object)val3; } SpiteBombController.Start += (hook_Start)obj3; } public static void ChangeStats(orig_OnArtifactEnabled orig, RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { BombArtifactManager.bombBlastRadius = BlastRadius + 1f * ScaleBlastRadius * (float)Run.instance.stageClearCount; BombArtifactManager.bombDamageCoefficient = DamageCoefficient + 1f * ScaleDamageCoefficient * (float)Run.instance.stageClearCount; BombArtifactManager.bombFuseTimeout = FuseTimeout - 1f * ScaleFuseTimeout * (float)Run.instance.stageClearCount; BombArtifactManager.bombSpawnBaseRadius = SpawnBaseRadius + 1f * ScaleSpawnBaseRadius * (float)Run.instance.stageClearCount; BombArtifactManager.bombSpawnRadiusCoefficient = SpawnRadiusCoefficient + 1f * ScaleSpawnRadiusCoefficient * (float)Run.instance.stageClearCount; BombArtifactManager.extraBombPerRadius = ExtraPerRadius + 1f * ScaleExtraPerRadius * (float)Run.instance.stageClearCount; BombArtifactManager.maxBombCount = MaxCount + ScaleMaxCount * Run.instance.stageClearCount; BombArtifactManager.maxBombFallDistance = MaxFallDistance; BombArtifactManager.maxBombStepUpDistance = MaxStepUpDistance; if (BombArtifactManager.bombFuseTimeout < 0f) { BombArtifactManager.bombFuseTimeout = MinimumFuse; } orig.Invoke(runArtifactManager, artifactDef); } public static void ChaoticSpiteBombsPart1(orig_FixedUpdate orig, SpiteBombController self) { //IL_0002: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0046: 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_004a: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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) //IL_00cb: 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_0073: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0098: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) Vector3 val = self.velocity; float fixedDeltaTime = Time.fixedDeltaTime; val.y += fixedDeltaTime * Physics.gravity.y; Vector3 position = self.transform.position; float num = ((Vector3)(ref val)).magnitude * fixedDeltaTime + self.radius; Vector3 val2 = position; Vector3 val3 = val; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val2, val3, ref val4, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { position = ((RaycastHit)(ref val4)).point; val -= 2f * Vector3.Dot(val, ((RaycastHit)(ref val4)).normal) * ((RaycastHit)(ref val4)).normal; val *= 0.8f; try { Reflection.InvokeMethod((object)self, "OnBounce"); } catch { } } else { position += val * fixedDeltaTime; } Reflection.SetFieldValue<Vector3>((object)self, "velocity", val); self.rb.MovePosition(position); self.delayBlast.position = position; } public static void ChaoticSpiteBombsPart2(orig_Start orig, SpiteBombController self) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) //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_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_006a: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) self.initialVelocityY = Random.Range(-40f, 40f); Vector3 position = self.transform.position; float num = Trajectory.CalculateFlightDuration(position.y, self.bouncePosition.y, self.initialVelocityY); Vector3 val = self.bouncePosition - position; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; float num2 = Trajectory.CalculateGroundSpeed(num, magnitude); Vector3 val2 = val / magnitude * num2; val2.y = self.initialVelocityY; Reflection.SetFieldValue<Vector3>((object)self, "velocity", val2); } public static void ThemissileknowswhereitisatalltimesItknowsthisbecauseitknowswhereitisntBysubtractingwhereitisfromwhereitisntorwhereitisntfromwhereitiswhicheverisgreateritobtainsadifferenceordeviationTheguidancesubsystemusesdeviationstogeneratecorrectivecommandstodrivethemissilefromapositionwhereitistoapositionwhereitisntandarrivingatapositionwhereitwasntitnowisConsquentlythepositionwhereitisisnowthepositionthatitwasntanditfollowsthatthepositionthatitwasisnowthepositionthatitisntIntheeventthatthepositionthatitisinisnotthepositionthatitwasntthesystemhasacquiredavariation() { } public static void ThevariationbeingthedifferencebetweenwherethemissileisandwhereitwasntIfvariationisconsideredtobeasignificantfactorittoomaybecorrectedbytheGEAhoweverthemissilemustalsoknowwhereitwasThemissileguidancecomputerscenarioworksasfollowsBecausethevariationhasmodifiedsomeoftheinformationthemissilehasobtaineditisnotsurejustwhereitishoweveritissurewhereitisntwithinreasonanditknowswhereitwasItnowsubtractswhereitshouldbefromwhereitwasntorviceversaAndbydifferentiatingthisfromthealgebraicsumofwhereitshouldntbeandwhereitwasitisabletoobtainthedeviationanditsvariationwhichiscallederror() { } } }