using System; 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 HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("RandomExtractionAmount")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ExtractionPointRandomizer")] [assembly: AssemblyTitle("ExtractionPointRandomizer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } 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 ExtractionPointRandomizer { [BepInPlugin("benji.extractionpointrandomizer", "Extraction Point Randomizer", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry MinExtractionPoints; public static ConfigEntry MaxExtractionPoints; public static ConfigEntry HaulGoalMultiplier; internal static int TargetCount = -1; internal static Plugin Instance { get; private set; } internal static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown Instance = this; MinExtractionPoints = ((BaseUnityPlugin)this).Config.Bind("Extraction Points", "Minimum", 1, new ConfigDescription("Minimum antal extraction points per level", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); MaxExtractionPoints = ((BaseUnityPlugin)this).Config.Bind("Extraction Points", "Maximum", 3, new ConfigDescription("Maximum antal extraction points per level", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); HaulGoalMultiplier = ((BaseUnityPlugin)this).Config.Bind("Rewards", "Haul Goal Multiplier", 0.33f, new ConfigDescription("Multiplikator for haul goal (penge man skal samle). Standard: 0.33 (1/3)", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 2f), Array.Empty())); Harmony val = new Harmony("benji.extractionpointrandomizer"); val.PatchAll(); Log.LogInfo((object)$"ExtractionPointRandomizer loaded! Min={MinExtractionPoints.Value}, Max={MaxExtractionPoints.Value}, HaulGoalMultiplier={HaulGoalMultiplier.Value}"); } } [HarmonyPatch(typeof(ExtractionPoint), "Start")] public class ExtractionPointStartPatch { private static void Postfix(ExtractionPoint __instance) { //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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown if (!SemiFunc.RunIsLevel()) { return; } int num = Plugin.MinExtractionPoints.Value; int value = Plugin.MaxExtractionPoints.Value; if (num > value) { num = value; } if (Plugin.TargetCount == -1) { Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; int hashCode = name.GetHashCode(); Random random = new Random(hashCode); Plugin.TargetCount = random.Next(num, value + 1); Plugin.Log.LogInfo((object)$"[ExtractionPointRandomizer] Scene: {name}, Seed: {hashCode}, Mål: {Plugin.TargetCount} extraction points"); } if (RoundDirector.instance.extractionPoints <= Plugin.TargetCount) { return; } Plugin.Log.LogInfo((object)"[ExtractionPointRandomizer] Deaktiverer ekstra extraction point"); RoundDirector instance = RoundDirector.instance; instance.extractionPoints--; RoundDirector.instance.extractionPointList.Remove(((Component)__instance).gameObject); foreach (Transform item in ((Component)__instance).transform) { Transform val = item; ((Component)val).gameObject.SetActive(false); } ((Component)__instance).gameObject.SetActive(false); } } [HarmonyPatch(typeof(ExtractionPoint), "HaulGoalSetRPC")] public class HaulGoalPatch { private static void Prefix(ref int value) { if (SemiFunc.RunIsLevel()) { float value2 = Plugin.HaulGoalMultiplier.Value; int num = Mathf.Max(1, (int)((float)value * value2)); Plugin.Log.LogInfo((object)$"[ExtractionPointRandomizer] HaulGoal multipliceret: {value} * {value2} -> {num}"); value = num; } } } [HarmonyPatch(typeof(RoundDirector), "Start")] public class RoundDirectorStartPatch { private static void Postfix() { Plugin.TargetCount = -1; Plugin.Log.LogInfo((object)"[ExtractionPointRandomizer] Nyt level — TargetCount nulstillet"); } } }