using System;
using System.Collections;
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 ArtifactOfTheUnchained.ArtifactHooks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using MSU.Config;
using Mdh.RoR2.HealthComponent;
using Mdh.SS2.Items.RelicOfForce;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using MonoDetour.Reflection.Unspeakable;
using MonoMod.Utils;
using On.RoR2;
using R2API;
using RoR2;
using SS2;
using SS2.Items;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Starstorm2")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LordVGames.ArtifactOfTheUnchained")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+4f2c37f379461e5980963fd228942fb7cd74d20a")]
[assembly: AssemblyProduct("LordVGames.ArtifactOfTheUnchained")]
[assembly: AssemblyTitle("ArtifactOfTheUnchained")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 Mdh.SS2.Items.RelicOfForce
{
internal static class ForceHitToken
{
internal static class RelicForceDelayedHits
{
public delegate void PrefixSignature(ForceHitToken self, ref DamageReport damageReport, ref int count);
public delegate void PostfixSignature(ForceHitToken self, ref DamageReport damageReport, ref int count, ref IEnumerator returnValue);
public delegate void PrefixMoveNextSignature(SpeakableEnumerator<object, ForceHitToken> self);
public delegate void PostfixMoveNextSignature(SpeakableEnumerator<object, ForceHitToken> self, ref bool continueEnumeration);
public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
}
public static MonoDetourHook PrefixMoveNext(PrefixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>((MethodBase)StateMachineTarget(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook PostfixMoveNext(PostfixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>((MethodBase)StateMachineTarget(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook ILHookMoveNext(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).ILHook((MethodBase)StateMachineTarget(), manipulator, config, applyByDefault);
}
public static MethodBase Target()
{
return typeof(ForceHitToken).GetMethod("RelicForceDelayedHits", (BindingFlags)(-1), null, new Type[2]
{
typeof(DamageReport),
typeof(int)
}, null) ?? throw new MissingMethodException("SS2.Items.RelicOfForce+ForceHitToken", "RelicForceDelayedHits");
}
public static MethodInfo StateMachineTarget()
{
return Extensions.GetStateMachineTarget((MethodInfo)Target());
}
}
}
}
namespace Mdh.RoR2.HealthComponent
{
internal static class TakeDamageProcess
{
public delegate void PrefixSignature(HealthComponent self, ref DamageInfo damageInfo);
public delegate void PostfixSignature(HealthComponent self, ref DamageInfo damageInfo);
public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
}
public static MethodBase Target()
{
return typeof(HealthComponent).GetMethod("TakeDamageProcess", (BindingFlags)(-1), null, new Type[1] { typeof(DamageInfo) }, null) ?? throw new MissingMethodException("RoR2.HealthComponent", "TakeDamageProcess");
}
}
internal static class Init
{
public delegate void PrefixSignature();
public delegate void PostfixSignature();
public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
}
public static MethodBase Target()
{
return typeof(HealthComponent).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), null) ?? throw new MissingMethodException("RoR2.HealthComponent", "Init");
}
}
internal static class TakeDamage
{
public delegate void PrefixSignature(HealthComponent self, ref DamageInfo damageInfo);
public delegate void PostfixSignature(HealthComponent self, ref DamageInfo damageInfo);
public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
}
public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
{
return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
}
public static MethodBase Target()
{
return typeof(HealthComponent).GetMethod("TakeDamage", (BindingFlags)(-1), null, new Type[1] { typeof(DamageInfo) }, null) ?? throw new MissingMethodException("RoR2.HealthComponent", "TakeDamage");
}
}
}
namespace MonoDetour.HookGen
{
internal static class DefaultMonoDetourManager
{
internal static MonoDetourManager Instance { get; } = New();
internal static MonoDetourManager New()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
}
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets
{
public Type? TargetType { get; }
public bool IncludeNestedTypes { get; set; }
public string[]? Members { get; set; }
public string[]? MemberNamePrefixes { get; set; }
public string[]? MemberNameSuffixes { get; set; }
public bool GenerateControlFlowVariants { get; set; }
public MonoDetourTargetsAttribute(Type? targetType = null)
{
TargetType = targetType;
IncludeNestedTypes = true;
base..ctor();
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace ArtifactOfTheUnchained
{
public static class Artifact
{
public static ArtifactDef Unchained = ScriptableObject.CreateInstance<ArtifactDef>();
internal static void SetupArtifact()
{
Unchained.nameToken = "ARTIFACT_UNCHAINED_NAME";
Unchained.descriptionToken = "ARTIFACT_UNCHAINED_DESC";
Unchained.cachedName = "Artifact of the Unchained";
Unchained.smallIconSelectedSprite = Assets.AssetBundle.LoadAsset<Sprite>("NoProcChainsArtifactIcon_Enabled.png");
Unchained.smallIconDeselectedSprite = Assets.AssetBundle.LoadAsset<Sprite>("NoProcChainsArtifactIcon_Disabled.png");
ContentAddition.AddArtifactDef(Unchained);
}
}
public static class Assets
{
public static AssetBundle AssetBundle;
public const string BundleName = "unchainedartifacticons";
public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Plugin.PluginInfo.Location), "unchainedartifacticons");
public static void Init()
{
AssetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
}
}
public static class ConfigOptions
{
public static class ForModItself
{
public enum HookType
{
MonoMod,
MonoDetour
}
private const string _sectionName = "For mod itself";
public static ConfigEntry<bool> EnableDebugLogging;
public static ConfigEntry<bool> ArtifactlessMode;
public static ConfigEntry<HookType> HookTypeToUse;
public static ConfigEntry<string> ItemProcNerfBodyBlacklist;
internal static string[] ItemProcNerfBodyBlacklistArray;
internal static void BindConfigOptions(ConfigFile config)
{
EnableDebugLogging = Extensions.BindOption<bool>(config, "For mod itself", "Enable debug logging", "", false, (ConfigFlags)0);
ArtifactlessMode = Extensions.BindOption<bool>(config, "For mod itself", "Run without requiring artifact", "Should the effects of the artifact always be on without needing to activate it?", false, (ConfigFlags)1);
HookTypeToUse = Extensions.BindOption<HookType>(config, "For mod itself", "Hook Type To Use", "Doesn't matter too much, but hooking via MonoDetour may lead to better performance while potentially having less compatibility with other mods (i doubt it but i dont know yet)", HookType.MonoMod, (ConfigFlags)1);
ItemProcNerfBodyBlacklist = Extensions.BindOption<string>(config, "For mod itself", "Blacklist for DamageSource-less characters", "Modded characters that have not been completely updated for the latest RoR2 version or rely on SeekersPatcher will be missing a \"DamageSource\" on their skills. This causes the artifact to see damage from those modded characters as damage from items, thus nerfing any procs from those skills. Add a survivor's internal body name (i.e CommandoBody) here, separating each one with a comma and no spaces, to add those survivors to a blacklist excluding them from damage nerfs for procs from items. \n\nNOTE: This will make survivors added here stronger than other survivors, due to some of their damage not being nerfed, but it's better than consistently having barely any damage.", "", (ConfigFlags)0);
ItemProcNerfBodyBlacklist.SettingChanged += ItemProcNerfBodyBlacklist_SettingChanged;
ItemProcNerfBodyBlacklistArray = ItemProcNerfBodyBlacklist.Value.Split(',');
}
internal static void ItemProcNerfBodyBlacklist_SettingChanged(object sender, EventArgs e)
{
ItemProcNerfBodyBlacklistArray = ItemProcNerfBodyBlacklist.Value.Split(',');
}
}
public static class ProcNerfing
{
public static class FromProc
{
private const string _sectionName = "Procs From Procs";
public static ConfigEntry<float> ProcChainDamageNerfToPercent;
public static ConfigEntry<float> ProcChainCoefficientNerfToPercent;
public static ConfigEntry<int> ProcChainAmountLimit;
public static ConfigEntry<float> NerfProcDamagePerEthereal;
internal static void BindConfigOptions(ConfigFile config)
{
ProcChainDamageNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Procs", "Nerf damage", "Should damage from chained procs (i.e. atg procced by a charged perforator hit) be reduced to a percent of what they would normally do? I.E. 0.4 is 40% of the normal damage, 0.04 is 4%, and 1 is vanilla behavior as there is no change.", 0.4f, (ConfigFlags)0);
ProcChainCoefficientNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Procs", "Nerf proc coefficient", "Should the proc coefficients for chained procs (i.e. polylute from an atg) be reduced to a percent of what they would normally are? I.E. 0.1 is 10% of the normal proc coefficient, and 1 is vanilla behavior as there is no change.", 1f, (ConfigFlags)0);
ProcChainAmountLimit = Extensions.BindOptionSlider<int>(config, "Procs From Procs", "Proc chaining limit", "The limit for how many times on-hit proc items can proc other on-hit proc items. 1 means item procs cannot chain into any other items, i.e. an atg hit can proc your other on-hit proc items, then those procs will not proc anything else. Set to -1 for vanilla behavior.", 1, (ConfigFlags)0);
NerfProcDamagePerEthereal = Extensions.BindOptionSlider<float>(config, "Procs From Procs", "Nerf proc damage per ethereal level", "(For Starstorm 2 beta content) Nerfs ALL proc damage based on how many ethereal teleporters you've completed. Because this applies to EVERY proc anything does, it will apply multiple times in a proc chain.\nFormula: 1 - (This config's value * # of Ethereal teleporters completed)", 0.07f, (ConfigFlags)0);
}
}
public static class FromItem
{
private const string _sectionName = "Procs From Items";
public static ConfigEntry<float> ProcFromItemDamageNerfToPercent;
public static ConfigEntry<float> ProcFromItemCoefficientNerfToPercent;
internal static void BindConfigOptions(ConfigFile config)
{
ProcFromItemDamageNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Items", "Nerf damage", "Should damage for procs from items (i.e. fireworks or royal capacitor) be nerfed to a percent of what it would normally be? I.E. 0.15 is 15% of the normal damage, 0.05 is 5%, and 1 is vanilla behavior as there is no change.", 0.15f, (ConfigFlags)0);
ProcFromItemCoefficientNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Items", "Nerf proc coefficient", "Should the proc coefficient for procs from items (i.e. fireworks or royal capacitor) be nerfed to a percent of what it would normally be? I.E. 0.1 is 10% of the normal proc coefficient, and 1 is vanilla behavior as there is no change.", 1f, (ConfigFlags)0);
}
}
public static class FromEquipment
{
private const string _sectionName = "Procs From Equipment";
public static ConfigEntry<float> ProcFromEquipmentDamageNerfToPercent;
public static ConfigEntry<float> ProcFromEquipmentCoefficientNerfToPercent;
internal static void BindConfigOptions(ConfigFile config)
{
ProcFromEquipmentDamageNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Equipment", "Nerf damage", "Should damage for procs from equipments (i.e. sawmerang or royal capacitor) be nerfed to a percent of what it would normally be? I.E. 0.2 is 20% of the normal damage, 0.02 is 2%, and 1 is vanilla behavior as there is no change.", 0.25f, (ConfigFlags)0);
ProcFromEquipmentCoefficientNerfToPercent = Extensions.BindOptionSlider<float>(config, "Procs From Equipment", "Nerf proc coefficient", "Should the proc coefficient for procs from equipments (i.e. sawmerang or royal capacitor) be nerfed to a percent of what it would normally be? I.E. 0.1 is 10% of the normal proc coefficient, and 1 is vanilla behavior as there is no change.", 1f, (ConfigFlags)0);
}
}
private const string _sectionName = "General Proc Chain Nerfs";
public static ConfigEntry<bool> PreventAllItemChaining;
internal static void BindAllConfigOptions(ConfigFile config)
{
PreventAllItemChaining = Extensions.BindOption<bool>(config, "General Proc Chain Nerfs", "Prevent ALL items from proccing other items", "Should not just procs from other procs but item procs from ANY item be blocked? This means that ONLY damage from skills can proc your items.", false, (ConfigFlags)0);
FromProc.BindConfigOptions(config);
FromItem.BindConfigOptions(config);
FromEquipment.BindConfigOptions(config);
}
}
internal static void BindAllConfigOptions(ConfigFile config)
{
ForModItself.BindConfigOptions(config);
ProcNerfing.BindAllConfigOptions(config);
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
if (ConfigOptions.ForModItself.EnableDebugLogging.Value)
{
_logSource.LogDebug(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);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void DebugDamageInfo(DamageInfo damageInfo, bool loggingBeforeChanges)
{
//IL_0098: 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_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
if (ConfigOptions.ForModItself.EnableDebugLogging.Value && !((Object)(object)damageInfo.attacker == (Object)null) && (!((Object)(object)damageInfo.inflictor != (Object)null) || !(((Object)damageInfo.inflictor).name == "DotController(Clone)")))
{
Debug("\n\n\n");
if (loggingBeforeChanges)
{
Warning("BEFORE");
Warning("BEFORE");
Warning("BEFORE");
}
else
{
Warning("AFTER");
Warning("AFTER");
Warning("AFTER");
}
Debug($"damageSource is {damageInfo.damageType.damageSource}");
Debug($"IsDamageSourceSkillBased is {((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased}");
Debug($"attacker is {damageInfo.attacker}");
Debug($"crit is {damageInfo.crit}");
Debug($"damage is {damageInfo.damage}");
if (ModSupport.Starstorm2.ModIsRunning && ModSupport.Starstorm2.IsBetaEnabled)
{
Debug($"ethereal damage mult is {1f - ConfigOptions.ProcNerfing.FromProc.NerfProcDamagePerEthereal.Value * (float)ModSupport.Starstorm2.EtherealsCount}");
}
Debug($"damageType is {damageInfo.damageType}");
Debug($"inflictor is {damageInfo.inflictor}");
Debug($"procChainMask is {damageInfo.procChainMask}");
Debug($"real proc chain count in mask is {HookMethods.GetProcCountInChain(damageInfo.procChainMask)}");
Debug($"procCoefficient is {damageInfo.procCoefficient}");
}
}
}
public static class Main
{
internal static class NerfLoggingMessages
{
internal static string ProcNotFromSkillBlocked;
internal static string ProcBlockedForZeroLimit;
internal static string ProcChainDamageNerf;
internal static string ProcChainCoefficientNerf;
internal static string ProcChainBlocked;
internal static string ProcFromItemDamageNerf;
internal static string ProcFromItemCoefficientNerf;
internal static string ProcFromEquipmentDamageNerf;
internal static string ProcFromEquipmentCoefficientNerf;
}
internal static bool IsArtifactEnabled
{
get
{
if ((Object)(object)RunArtifactManager.instance != (Object)null)
{
return RunArtifactManager.instance.IsArtifactEnabled(Artifact.Unchained);
}
return false;
}
}
internal static void SetupLanguageSpecificStrings()
{
NerfLoggingMessages.ProcNotFromSkillBlocked = Language.GetStringFormatted("ARTIFACT_UNCHAINED_NO_ITEM_PROC", Array.Empty<object>());
NerfLoggingMessages.ProcBlockedForZeroLimit = Language.GetStringFormatted("ARTIFACT_UNCHAINED_", Array.Empty<object>());
NerfLoggingMessages.ProcChainDamageNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_PROC_CHAIN_DAMAGE_NERF", Array.Empty<object>());
NerfLoggingMessages.ProcChainCoefficientNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_PROC_CHAIN_COEFFICIENT_NERF", Array.Empty<object>());
NerfLoggingMessages.ProcChainBlocked = Language.GetStringFormatted("ARTIFACT_UNCHAINED_PROC_CHAIN_BLOCKED", Array.Empty<object>());
NerfLoggingMessages.ProcFromItemCoefficientNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_ITEM_PROC_COEFFICIENT_NERF", Array.Empty<object>());
NerfLoggingMessages.ProcFromItemDamageNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_ITEM_PROC_DAMAGE_NERF", Array.Empty<object>());
NerfLoggingMessages.ProcFromEquipmentCoefficientNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_EQUIPMENT_PROC_DAMAGE_NERF", Array.Empty<object>());
NerfLoggingMessages.ProcFromEquipmentDamageNerf = Language.GetStringFormatted("ARTIFACT_UNCHAINED_EQUIPMENT_PROC_COEFFICIENT_NERF", Array.Empty<object>());
}
internal static bool IsAttackerBlacklisted(GameObject attackerGameObject)
{
if (Utility.IsNullOrWhiteSpace(ConfigOptions.ForModItself.ItemProcNerfBodyBlacklist.Value))
{
return false;
}
if (Utility.IsNullOrWhiteSpace(((Object)attackerGameObject).name))
{
return false;
}
string value = ((Object)attackerGameObject).name.Substring(0, ((Object)attackerGameObject).name.Length - 7);
if (ConfigOptions.ForModItself.ItemProcNerfBodyBlacklistArray.Contains(value))
{
return true;
}
return false;
}
}
public static class ModProcTypes
{
public static ModdedProcType ProccedBySkill;
public static ModdedProcType ProccedByProc;
public static ModdedProcType ProccedByItem;
public static ModdedProcType ProccedByEquipment;
public static readonly ProcType[] FakeProcTypes;
internal static void SetupProcTypes()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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)
ProccedBySkill = ProcTypeAPI.ReserveProcType();
ProccedByItem = ProcTypeAPI.ReserveProcType();
ProccedByProc = ProcTypeAPI.ReserveProcType();
ProccedByEquipment = ProcTypeAPI.ReserveProcType();
}
static ModProcTypes()
{
ProcType[] array = new ProcType[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
FakeProcTypes = (ProcType[])(object)array;
}
}
internal static class ModSupport
{
internal static class Starstorm2
{
[MonoDetourTargets(typeof(ForceHitToken))]
internal static class RelicOfForceDamageSourceFix
{
internal static void Setup()
{
if (ModIsRunning)
{
ForceHitToken.RelicForceDelayedHits.Prefix(RemoveDamageSource);
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static void RemoveDamageSource(ForceHitToken self, ref DamageReport damageReport, ref int count)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
damageReport.damageInfo.damageType.damageSource = (DamageSource)0;
}
}
private static bool? _modexists;
internal static bool ModIsRunning
{
get
{
bool valueOrDefault = _modexists.GetValueOrDefault();
if (!_modexists.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm");
_modexists = valueOrDefault;
}
return _modexists.Value;
}
}
internal static bool IsBetaEnabled
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
if (ModIsRunning)
{
return ConfiguredVariable<bool>.op_Implicit((ConfiguredVariable<bool>)(object)SS2Config.enableBeta);
}
return false;
}
}
internal static int EtherealsCount
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
if (!ModIsRunning || !IsBetaEnabled)
{
return 0;
}
return EtherealBehavior.instance.etherealsCompleted;
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("LordVGames.ArtifactOfTheUnchained", "ArtifactOfTheUnchained", "3.0.0")]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_TakeDamage <0>__HealthComponent_TakeDamage_Artifactless;
public static hook_TakeDamage <1>__HealthComponent_TakeDamage_Artifact;
public static Action <2>__SetupLanguageSpecificStrings;
}
public const string Id = "LordVGames.ArtifactOfTheUnchained";
public static PluginInfo PluginInfo { get; private set; }
public static string Name => "ArtifactOfTheUnchained";
public static string Version => "3.0.0";
public void Awake()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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
PluginInfo = ((BaseUnityPlugin)this).Info;
Log.Init(((BaseUnityPlugin)this).Logger);
ConfigOptions.BindAllConfigOptions(((BaseUnityPlugin)this).Config);
Assets.Init();
ModProcTypes.SetupProcTypes();
if (ConfigOptions.ForModItself.ArtifactlessMode.Value)
{
if (ConfigOptions.ForModItself.HookTypeToUse.Value == ConfigOptions.ForModItself.HookType.MonoMod)
{
object obj = <>O.<0>__HealthComponent_TakeDamage_Artifactless;
if (obj == null)
{
hook_TakeDamage val = MonoMod.HealthComponent_TakeDamage_Artifactless;
<>O.<0>__HealthComponent_TakeDamage_Artifactless = val;
obj = (object)val;
}
HealthComponent.TakeDamage += (hook_TakeDamage)obj;
}
else
{
ArtifactOfTheUnchained.ArtifactHooks.MonoDetour.SetupArtifactless();
}
}
else
{
Artifact.SetupArtifact();
if (ConfigOptions.ForModItself.HookTypeToUse.Value == ConfigOptions.ForModItself.HookType.MonoMod)
{
object obj2 = <>O.<1>__HealthComponent_TakeDamage_Artifact;
if (obj2 == null)
{
hook_TakeDamage val2 = MonoMod.HealthComponent_TakeDamage_Artifact;
<>O.<1>__HealthComponent_TakeDamage_Artifact = val2;
obj2 = (object)val2;
}
HealthComponent.TakeDamage += (hook_TakeDamage)obj2;
}
else
{
ArtifactOfTheUnchained.ArtifactHooks.MonoDetour.SetupArtifact();
}
}
if (ModSupport.Starstorm2.ModIsRunning)
{
ModSupport.Starstorm2.RelicOfForceDamageSourceFix.Setup();
}
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Main.SetupLanguageSpecificStrings));
}
}
}
namespace ArtifactOfTheUnchained.ArtifactHooks
{
internal static class HookMethods
{
internal static void HealthComponent_TakeDamage(DamageInfo damageInfo)
{
//IL_0014: 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_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_0140: Invalid comparison between Unknown and I4
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)damageInfo.attacker == (Object)null || ((Enum)damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)67108864))
{
return;
}
if (((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased)
{
ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, ModProcTypes.ProccedBySkill);
return;
}
if (ConfigOptions.ProcNerfing.PreventAllItemChaining.Value)
{
Log.Debug(Main.NerfLoggingMessages.ProcNotFromSkillBlocked);
damageInfo.procCoefficient = 0f;
return;
}
if (damageInfo.procChainMask.mask != 0)
{
int procCountInChain = GetProcCountInChain(damageInfo.procChainMask);
if (procCountInChain > 0)
{
if (ConfigOptions.ProcNerfing.FromProc.ProcChainAmountLimit.Value == 0)
{
Log.Debug(Main.NerfLoggingMessages.ProcBlockedForZeroLimit);
damageInfo.procCoefficient = 0f;
return;
}
if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ModProcTypes.ProccedByProc))
{
NerfProcFromProc(damageInfo, procCountInChain);
return;
}
ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, ModProcTypes.ProccedByProc);
if (ModSupport.Starstorm2.ModIsRunning && ModSupport.Starstorm2.IsBetaEnabled)
{
int etherealsCount = ModSupport.Starstorm2.EtherealsCount;
if (etherealsCount > 0)
{
float num = 1f - ConfigOptions.ProcNerfing.FromProc.NerfProcDamagePerEthereal.Value * (float)etherealsCount;
damageInfo.damage *= num;
}
}
}
}
if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ModProcTypes.ProccedByEquipment))
{
NerfProcFromEquipment(damageInfo);
}
else if ((int)damageInfo.damageType.damageSource == 64)
{
ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, ModProcTypes.ProccedByEquipment);
}
else if (ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ModProcTypes.ProccedByItem))
{
if (!Main.IsAttackerBlacklisted(damageInfo.attacker))
{
NerfProcFromItem(damageInfo);
}
}
else if (!ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, ModProcTypes.ProccedByProc))
{
ProcTypeAPI.AddModdedProc(ref damageInfo.procChainMask, ModProcTypes.ProccedByItem);
}
}
private static void NerfProcFromProc(DamageInfo damageInfo, int procsInChain)
{
if (procsInChain > ConfigOptions.ProcNerfing.FromProc.ProcChainAmountLimit.Value && ConfigOptions.ProcNerfing.FromProc.ProcChainAmountLimit.Value != -1)
{
damageInfo.procCoefficient = 0f;
Log.Debug(Main.NerfLoggingMessages.ProcChainBlocked);
}
else if (ConfigOptions.ProcNerfing.FromProc.ProcChainCoefficientNerfToPercent.Value != 1f)
{
damageInfo.procCoefficient *= ConfigOptions.ProcNerfing.FromProc.ProcChainCoefficientNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcChainCoefficientNerf);
}
if (ConfigOptions.ProcNerfing.FromProc.ProcChainDamageNerfToPercent.Value != 1f)
{
damageInfo.damage *= ConfigOptions.ProcNerfing.FromProc.ProcChainDamageNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcChainDamageNerf);
}
}
private static void NerfProcFromItem(DamageInfo damageInfo)
{
if (ConfigOptions.ProcNerfing.FromItem.ProcFromItemCoefficientNerfToPercent.Value != 1f)
{
damageInfo.procCoefficient *= ConfigOptions.ProcNerfing.FromItem.ProcFromItemCoefficientNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcFromItemCoefficientNerf);
}
if (ConfigOptions.ProcNerfing.FromItem.ProcFromItemDamageNerfToPercent.Value != 1f)
{
damageInfo.damage *= ConfigOptions.ProcNerfing.FromItem.ProcFromItemDamageNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcFromItemDamageNerf);
}
}
private static void NerfProcFromEquipment(DamageInfo damageInfo)
{
if (ConfigOptions.ProcNerfing.FromEquipment.ProcFromEquipmentCoefficientNerfToPercent.Value != 1f)
{
damageInfo.procCoefficient *= ConfigOptions.ProcNerfing.FromEquipment.ProcFromEquipmentCoefficientNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcFromEquipmentDamageNerf);
}
if (ConfigOptions.ProcNerfing.FromEquipment.ProcFromEquipmentDamageNerfToPercent.Value != 1f)
{
damageInfo.damage *= ConfigOptions.ProcNerfing.FromEquipment.ProcFromEquipmentDamageNerfToPercent.Value;
Log.Debug(Main.NerfLoggingMessages.ProcFromEquipmentCoefficientNerf);
}
}
internal static int GetProcCountInChain(ProcChainMask procChainMask)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0008: 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_0021: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
int num = 0;
for (ProcType val = (ProcType)0; (int)val < 28; val = (ProcType)(val + 1))
{
if (((ProcChainMask)(ref procChainMask)).HasProc(val) && !ModProcTypes.FakeProcTypes.Contains(val))
{
num++;
}
}
BitArray moddedMask = ProcTypeAPI.GetModdedMask(procChainMask);
for (int i = 0; i < moddedMask.Count; i++)
{
if (moddedMask.Get(i))
{
num++;
}
}
num = RemoveMarkProcsFromProcCount(procChainMask, num);
Log.Debug($"numberOfProcsInChain is {num}");
return num;
}
private static int RemoveMarkProcsFromProcCount(ProcChainMask procChainMask, int numberOfProcsInChain)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (ProcTypeAPI.HasModdedProc(procChainMask, ModProcTypes.ProccedByEquipment))
{
numberOfProcsInChain--;
}
if (ProcTypeAPI.HasModdedProc(procChainMask, ModProcTypes.ProccedByItem))
{
numberOfProcsInChain--;
}
if (ProcTypeAPI.HasModdedProc(procChainMask, ModProcTypes.ProccedByProc))
{
numberOfProcsInChain--;
}
return numberOfProcsInChain;
}
}
[MonoDetourTargets(typeof(HealthComponent))]
internal static class MonoDetour
{
internal static void SetupArtifact()
{
TakeDamageProcess.Postfix(HealthComponent_TakeDamageProcess_Artifact);
}
private static void HealthComponent_TakeDamageProcess_Artifact(HealthComponent self, ref DamageInfo damageInfo)
{
if (Main.IsArtifactEnabled)
{
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: true);
HookMethods.HealthComponent_TakeDamage(damageInfo);
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: false);
}
}
internal static void SetupArtifactless()
{
TakeDamageProcess.Postfix(HealthComponent_TakeDamageProcess_Artifactless);
}
private static void HealthComponent_TakeDamageProcess_Artifactless(HealthComponent self, ref DamageInfo damageInfo)
{
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: true);
HookMethods.HealthComponent_TakeDamage(damageInfo);
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: false);
}
}
internal static class MonoMod
{
internal static void HealthComponent_TakeDamage_Artifact(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
if (!Main.IsArtifactEnabled)
{
orig.Invoke(self, damageInfo);
return;
}
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: true);
HookMethods.HealthComponent_TakeDamage(damageInfo);
orig.Invoke(self, damageInfo);
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: false);
}
internal static void HealthComponent_TakeDamage_Artifactless(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: true);
HookMethods.HealthComponent_TakeDamage(damageInfo);
orig.Invoke(self, damageInfo);
Log.DebugDamageInfo(damageInfo, loggingBeforeChanges: false);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}