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 FairerScavs v1.0.0
plugins/FairerScavs.dll
Decompiled 7 hours agousing 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.ScavMonster; using HG.Reflection; using Mdh.EntityStates.ScavMonster.GrantItem; using Mdh.RoR2.HealthComponent; using Microsoft.CodeAnalysis; using MiscFixes.Modules; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoMod.Cil; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LordVGames.FairerScavs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LordVGames.FairerScavs")] [assembly: AssemblyTitle("FairerScavs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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.EntityStates.ScavMonster.GrantItem { internal static class GrantPickupServer { public delegate void PrefixSignature(GrantItem self, ref PickupIndex pickupIndex, ref int countToGrant); public delegate void PostfixSignature(GrantItem self, ref PickupIndex pickupIndex, ref int countToGrant); 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() { Type typeFromHandle = typeof(GrantItem); MethodInfo method = typeFromHandle.GetMethod("GrantPickupServer", (BindingFlags)(-1), null, new Type[2] { typeof(PickupIndex), typeof(int) }, null); if ((object)method == null) { throw new MissingMethodException("EntityStates.ScavMonster.GrantItem", "GrantPickupServer"); } return method; } } internal static class OnEnter { } internal static class OnSerialize { } internal static class OnDeserialize { } internal static class _ctor { } } 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() { Type typeFromHandle = typeof(HealthComponent); MethodInfo method = typeFromHandle.GetMethod("TakeDamageProcess", (BindingFlags)(-1), null, new Type[1] { typeof(DamageInfo) }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.HealthComponent", "TakeDamageProcess"); } return method; } } 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() { Type typeFromHandle = typeof(HealthComponent); MethodInfo method = typeFromHandle.GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.HealthComponent", "Init"); } return method; } } internal static class get_killingDamageTypeExt { } internal static class set_killingDamageTypeExt { } internal static class SetBarrier { } internal static class get_recentlyTookDamage { } internal static class get_killingDamageType { } internal static class set_killingDamageType { } internal static class get_alive { } internal static class get_fullHealth { } internal static class get_fullShield { } internal static class get_fullBarrier { } internal static class get_combinedHealth { } internal static class get_fullCombinedHealth { } internal static class get_combinedHealthFraction { } internal static class get_healthFraction { } internal static class get_missingCombinedHealth { } internal static class get_lastHitTime { } internal static class set_lastHitTime { } internal static class get_lastHealTime { } internal static class set_lastHealTime { } internal static class get_lastHitAttacker { } internal static class set_lastHitAttacker { } internal static class get_timeSinceLastHit { } internal static class get_timeSinceLastHeal { } internal static class get_godMode { } internal static class set_godMode { } internal static class get_potionReserve { } internal static class set_potionReserve { } internal static class get_isInFrozenState { } internal static class set_isInFrozenState { } internal static class get_distributeDamage { } internal static class set_distributeDamage { } internal static class get_isHealthLow { } internal static class IsHealthBelowThreshold_System_Single { } internal static class IsHealthBelowThreshold_System_Single_System_Single { } internal static class GetHealthAtThreshold { } internal static class add_onCharacterHealServer { } internal static class remove_onCharacterHealServer { } internal static class OnValidate { } internal static class Heal { } internal static class UsePotion { } internal static class HealFraction { } internal static class GetNormalizedHealth { } internal static class CmdHealFull { } internal static class RechargeShieldFull { } internal static class CmdRechargeShieldFull { } internal static class RechargeShield { } internal static class AddBarrier { } internal static class AddCharge { } internal static class CmdAddBarrier { } internal static class AddBarrierAuthority { } internal static class CmdForceShieldRegen { } internal static class ForceShieldRegen { } internal static class Die { } internal static class TakeDamageForce_RoR2_DamageInfo_System_Boolean_System_Boolean { } internal static class TakeDamageForce_UnityEngine_Vector3_System_Boolean_System_Boolean { } internal static class TakeDamageForce_RoR2_PhysForceInfo { } internal static class CmdTakeDamageForce { } internal static class TakeDamageForceAuthority { } internal static class TakeDamage { } internal static class ProcParry { } internal static class GetShieldBoosterDamage { } internal static class CheckElectrocutionSpread { } internal static class DoWarp { } internal static class TriggerOneShotProtection { } internal static class SerializedSuicide { } internal static class Suicide { } internal static class AddOnIncomingDamageServerReceiver { } internal static class RemoveOnIncomingDamageServerReceiver { } internal static class AddOnTakeDamageServerReceiver { } internal static class RemoveOnTakeDamageServerReceiver { } internal static class UpdateLastHitTime { } internal static class Awake { } internal static class OnDestroy { } internal static class FixedUpdate { } internal static class ManagedFixedUpdate { } internal static class StartDeath { } internal static class ReviveCharacterInvisibly { } internal static class GetBarrierDecayRate { } internal static class ServerFixedUpdate { } internal static class SendDamageDealt { } internal static class HandleDamageDealt { } internal static class SendHeal { } internal static class HandleHeal { } internal static class OnInventoryChanged { } internal static class GetHealthBarValues { } internal static class _ctor { } internal static class _cctor { } internal static class _TakeDamageProcess_g__DoJuggle_126_1 { } internal static class _TakeDamageProcess_g__LocalCheckRoll_126_0 { } internal static class UNetVersion { } internal static class get_Networkhealth { } internal static class set_Networkhealth { } internal static class get_Networkshield { } internal static class set_Networkshield { } internal static class get_NetworkechoDamage { } internal static class set_NetworkechoDamage { } internal static class get_Network_killingDamageTypeExt { } internal static class set_Network_killingDamageTypeExt { } internal static class get_Networkbarrier { } internal static class set_Networkbarrier { } internal static class get_NetworkmagnetiCharge { } internal static class set_NetworkmagnetiCharge { } internal static class get_Network_killingDamageType { } internal static class set_Network_killingDamageType { } internal static class get_NetworkdestroyModelOnDeath { } internal static class set_NetworkdestroyModelOnDeath { } internal static class InvokeCmdCmdHealFull { } internal static class InvokeCmdCmdRechargeShieldFull { } internal static class InvokeCmdCmdAddBarrier { } internal static class InvokeCmdCmdForceShieldRegen { } internal static class InvokeCmdCmdTakeDamageForce { } internal static class CallCmdHealFull { } internal static class CallCmdRechargeShieldFull { } internal static class CallCmdAddBarrier { } internal static class CallCmdForceShieldRegen { } internal static class CallCmdTakeDamageForce { } internal static class OnSerialize { } internal static class OnDeserialize { } internal static class PreStartClient { } internal static class AssetReferences { internal static class Resolve { } internal static class __c { internal static class _cctor { } internal static class _ctor { } internal static class _Resolve_b__22_0 { } internal static class _Resolve_b__22_1 { } internal static class _Resolve_b__22_2 { } internal static class _Resolve_b__22_3 { } internal static class _Resolve_b__22_4 { } internal static class _Resolve_b__22_5 { } internal static class _Resolve_b__22_6 { } internal static class _Resolve_b__22_7 { } internal static class _Resolve_b__22_8 { } internal static class _Resolve_b__22_9 { } internal static class _Resolve_b__22_10 { } internal static class _Resolve_b__22_11 { } internal static class _Resolve_b__22_12 { } internal static class _Resolve_b__22_13 { } internal static class _Resolve_b__22_14 { } internal static class _Resolve_b__22_15 { } internal static class _Resolve_b__22_16 { } internal static class _Resolve_b__22_17 { } internal static class _Resolve_b__22_18 { } internal static class _Resolve_b__22_19 { } internal static class _Resolve_b__22_20 { } internal static class _Resolve_b__22_21 { } } } internal static class HealMessage { internal static class _ctor { } internal static class Serialize { } internal static class Deserialize { } } internal static class ItemCounts { internal static class _ctor { } internal static class _ctor_RoR2_Inventory { } } internal static class HealthBarValues { internal static class _ctor { } } internal static class RepeatHealComponent { internal static class FixedUpdate { } internal static class AddReserve { } internal static class _ctor { } } internal static class __c__DisplayClass126_0 { internal static class _ctor { } } internal static class __c__DisplayClass126_1 { internal static class _ctor { } } } 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(Type? targetType = null) : Attribute(), IMonoDetourTargets { public Type? TargetType { get; } = targetType; public bool IncludeNestedTypes { get; set; } = true; public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [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")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace FairerScavs { public static class ConfigOptions { internal static class FindItemSkill { private const string _sectionName = "Find item skill"; public static ConfigEntry<float> StockCount; public static ConfigEntry<bool> RemoveRecharge; public static ConfigEntry<float> MaxHealthUsagePercent; public static ConfigEntry<bool> MakeFoundItemsTemporary; internal static void BindConfigOptions(ConfigFile config) { StockCount = Extensions.BindOptionSteppedSlider(config, "Find item skill", "Stock count", "The max amount of times a scavenger can find items in it's bag. Set to -1 for no change.", 3f, 1f, -1f, 100f, (ConfigFlags)1); RemoveRecharge = Extensions.BindOption<bool>(config, "Find item skill", "No skill recharge", "Should the skill be unable to recharge?", true, (ConfigFlags)1); MaxHealthUsagePercent = Extensions.BindOptionSteppedSlider(config, "Find item skill", "Usable below this percent hp", "Should the Scavengers find items skill only be usable below a certain health percentage? Vanilla is at 50%.", 0.5f, 0.01f, 0.01f, 100f, (ConfigFlags)0); MakeFoundItemsTemporary = Extensions.BindOption<bool>(config, "Find item skill", "Make found items temporary", "Should the items obtained from the Scavengers find items skill all be temporary?", true, (ConfigFlags)0); } } internal static class AllScavsAreBosses { private const string _sectionName = "Boss health bars"; public static ConfigEntry<bool> MakeAllScavsBosses; public static ConfigEntry<bool> LetAPRoundsWorkOnScavengers; internal static void BindConfigOptions(ConfigFile config) { MakeAllScavsBosses = Extensions.BindOption<bool>(config, "Boss health bars", "Each scav has a boss bar", "Should every scavenger have their own boss bar when spawned? This is meant to be used alongside the ShowBossInventory mod so you can see every scavengers inventory.", true, (ConfigFlags)0); LetAPRoundsWorkOnScavengers = Extensions.BindOption<bool>(config, "Boss health bars", "Should AP rounds work", "Every scavenger having a boss bar would mean they all take the damage increase from armor piercing rounds. Disable this if you want armor piercing rounds to not work on scavengers (includes ones from the teleporter!)", true, (ConfigFlags)0); } } internal static void BindAllConfigOptions(ConfigFile config) { AllScavsAreBosses.BindConfigOptions(config); FindItemSkill.BindConfigOptions(config); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object 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); } } internal static class Main { internal static void LogILInstructions(this ILWeaver w) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Enumerator<Instruction> enumerator = w.Instructions.GetEnumerator(); try { while (enumerator.MoveNext()) { Instruction current = enumerator.Current; Log.Warning(current); } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } internal static bool IsBodyAScavenger(CharacterBody body) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_001d: 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_002f: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) if (body.bodyIndex != BodyPrefabs.ScavBody.bodyIndex && body.bodyIndex != BodyPrefabs.ScavLunar1Body.bodyIndex && body.bodyIndex != BodyPrefabs.ScavLunar2Body.bodyIndex && body.bodyIndex != BodyPrefabs.ScavLunar3Body.bodyIndex) { return body.bodyIndex == BodyPrefabs.ScavLunar4Body.bodyIndex; } return true; } } [BepInPlugin("LordVGames.FairerScavs", "FairerScavs", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Id = "LordVGames.FairerScavs"; public static string Name => "FairerScavs"; public static string Version => "1.0.0"; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); ConfigOptions.BindAllConfigOptions(((BaseUnityPlugin)this).Config); MonoDetourManager.InvokeHookInitializers(typeof(Plugin).Assembly); } } } namespace FairerScavs.FindItemsSkill { [MonoDetourTargets(typeof(GrantItem))] internal static class MakeFoundItemsTemporary { [CompilerGenerated] private static class <>O { public static Manipulator <0>__GiveTempInsteadOfPermanent; } private static readonly AssetReferenceT<ExpansionDef> _dlc3AssetReference = new AssetReferenceT<ExpansionDef>(RoR2_DLC3.DLC3_asset); internal static ExpansionDef Dlc3; [MonoDetourHookInitialize] private static void Setup() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown AsyncOperationHandle<ExpansionDef> val = AssetAsyncReferenceManager<ExpansionDef>.LoadAsset(_dlc3AssetReference, (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<ExpansionDef> handle) { Dlc3 = handle.Result; }; object obj = <>O.<0>__GiveTempInsteadOfPermanent; if (obj == null) { Manipulator val2 = GiveTempInsteadOfPermanent; <>O.<0>__GiveTempInsteadOfPermanent = val2; obj = (object)val2; } GrantPickupServer.ILHook((Manipulator)obj); } private static bool CanItemsBecomeTemporary() { if (ConfigOptions.FindItemSkill.MakeFoundItemsTemporary.Value) { return Run.instance.IsExpansionEnabled(Dlc3); } return false; } private static void GiveTempInsteadOfPermanent(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition inventoryVariable = default(VariableDefinition); w.DeclareVariable(typeof(Inventory), ref inventoryVariable); VariableDefinition itemIndexVariable = default(VariableDefinition); w.DeclareVariable(typeof(ItemIndex), ref itemIndexVariable); VariableDefinition itemStackCountVariable = default(VariableDefinition); w.DeclareVariable(typeof(int), ref itemStackCountVariable); Instruction startOfSkip = null; Instruction endOfSkip = null; w.MatchRelaxed(new Predicate<Instruction>[4] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_inventory") && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GiveItemPermanent") }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2] { w.Create(OpCodes.Stloc, inventoryVariable), w.Create(OpCodes.Ldloc, inventoryVariable) })) .CurrentToNext() .InsertAfterCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2] { w.Create(OpCodes.Stloc, itemIndexVariable), w.Create(OpCodes.Ldloc, itemIndexVariable) })) .CurrentToNext() .InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[6] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, itemStackCountVariable)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, itemStackCountVariable)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<Inventory, ItemIndex, int>>((Action<Inventory, ItemIndex, int>)delegate(Inventory inventory, ItemIndex itemIndex, int stacks) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (CanItemsBecomeTemporary()) { for (int i = 0; i < stacks; i++) { inventory.GiveItemTemp(itemIndex, 1f); } } })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, inventoryVariable)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, itemIndexVariable)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, itemStackCountVariable)) })) .MatchRelaxed(new Predicate<Instruction>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ((VariableReference)inventoryVariable).Index) && w.SetInstructionTo(ref startOfSkip, x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ((VariableReference)itemIndexVariable).Index), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ((VariableReference)itemStackCountVariable).Index), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GiveItemPermanent") && w.SetInstructionTo(ref endOfSkip, x) }) .ThrowIfFailure() .InsertBranchOverIfTrue(startOfSkip, endOfSkip, (IEnumerable<Instruction>)w.CreateDelegateCall<Func<bool>>((Func<bool>)(() => CanItemsBecomeTemporary()))); } } [MonoDetourTargets(null)] internal static class ScavSkillEdit { private static readonly AssetReferenceT<SkillDef> _sitSkillDefReference = new AssetReferenceT<SkillDef>(RoR2_Base_Scav.Sit_asset); [MonoDetourHookInitialize] internal static void MakeFindItemSkillFairer() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (ConfigOptions.FindItemSkill.StockCount.Value < 0f) { return; } AsyncOperationHandle<SkillDef> val = AssetAsyncReferenceManager<SkillDef>.LoadAsset(_sitSkillDefReference, (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<SkillDef> handle) { SkillDef result = handle.Result; int num = (int)ConfigOptions.FindItemSkill.StockCount.Value; if (num > -1) { result.baseMaxStock = num; } if (ConfigOptions.FindItemSkill.RemoveRecharge.Value) { result.baseRechargeInterval = -1f; result.rechargeStock = 0; } }; CharacterMaster.onStartGlobal += CharacterMaster_onStartGlobal; } private static void CharacterMaster_onStartGlobal(CharacterMaster characterMaster) { BaseAI val = default(BaseAI); if (((Object)characterMaster).name != "ScavMaster(Clone)" || !((Component)characterMaster).TryGetComponent<BaseAI>(ref val) || val.skillDrivers.Length < 1) { return; } AISkillDriver[] skillDrivers = val.skillDrivers; foreach (AISkillDriver val2 in skillDrivers) { if (!(val2.customName != "Sit")) { val2.maxUserHealthFraction = ConfigOptions.FindItemSkill.MaxHealthUsagePercent.Value; } } } } } namespace FairerScavs.AllScavsBosses { [MonoDetourTargets(typeof(HealthComponent))] internal static class CanAPRoundsWork { [CompilerGenerated] private static class <>O { public static Manipulator <0>__CheckForBossScavs; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: 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_001b: Expected O, but got Unknown object obj = <>O.<0>__CheckForBossScavs; if (obj == null) { Manipulator val = CheckForBossScavs; <>O.<0>__CheckForBossScavs = val; obj = (object)val; } TakeDamageProcess.ILHook((Manipulator)obj); } private static void CheckForBossScavs(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); ILLabel skipItemEffect = w.DefineLabel(); w.MatchRelaxed(new Predicate<Instruction>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_isBoss"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref skipItemEffect) && w.SetCurrentTo(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[3] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Func<HealthComponent, bool>>((Func<HealthComponent, bool>)((HealthComponent healthComponent) => (Object)(object)healthComponent == (Object)null || (Object)(object)healthComponent.body == (Object)null || !Main.IsBodyAScavenger(healthComponent.body) || ConfigOptions.AllScavsAreBosses.LetAPRoundsWorkOnScavengers.Value))), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Brfalse, (object)skipItemEffect)) })); } } [MonoDetourTargets(null)] internal static class MakeAllScavsBosses { private static readonly AssetReferenceT<GameObject> _bossCombatSquadReference = new AssetReferenceT<GameObject>(RoR2_Base_Core.BossCombatSquad_prefab); private static GameObject _bossCombatSquad; [MonoDetourHookInitialize] private static void Setup() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_bossCombatSquadReference, (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> handle) { _bossCombatSquad = handle.Result; }; CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private static void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (ConfigOptions.AllScavsAreBosses.MakeAllScavsBosses.Value && !((Object)(object)body == (Object)null) && !body.isPlayerControlled && Main.IsBodyAScavenger(body)) { GameObject obj = Object.Instantiate<GameObject>(_bossCombatSquad); CombatSquad val = ((obj != null) ? obj.GetComponent<CombatSquad>() : null); if (Object.op_Implicit((Object)(object)val)) { val.AddMember(body.master); } NetworkServer.Spawn(((Component)val).gameObject); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }