Decompiled source of konnomod v1.0.0
BepinEx/plugins/1nsider-BetterChaosPool/NoVolcanicEgg.dll
Decompiled 11 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using R2API.Utils; using RoR2; [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("NoVolcanicEgg")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoVolcanicEgg")] [assembly: AssemblyTitle("NoVolcanicEgg")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ExamplePlugin; internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("1nsider.NoChaoticVolcanic", "NoChaoticVolcanic", "1.0.0")] [R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })] public class RemoveEgg : BaseUnityPlugin { public const string PluginGUID = "1nsider.NoChaoticVolcanic"; public const string PluginAuthor = "1nsider"; public const string PluginName = "NoChaoticVolcanic"; public const string PluginVersion = "1.0.0"; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); } public void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0053: Unknown result type (might be due to invalid IL or missing references) if (EquipmentCatalog.randomTriggerEquipmentList.Contains(EquipmentCatalog.FindEquipmentIndex("FireBallDash"))) { EquipmentCatalog.randomTriggerEquipmentList.Remove(EquipmentCatalog.FindEquipmentIndex("FireBallDash")); } if (EquipmentCatalog.randomTriggerEquipmentList.Contains(EquipmentCatalog.FindEquipmentIndex("Gateway"))) { EquipmentCatalog.randomTriggerEquipmentList.Remove(EquipmentCatalog.FindEquipmentIndex("Gateway")); } } }
BepinEx/plugins/Amadare-RailCharges/RailCharges.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Railgunner.Scope; using HG.BlendableTypes; using HG.GeneralSerializer; using MonoMod.RuntimeDetour; using On.EntityStates.Railgunner.Scope; using On.RoR2; using On.RoR2.CameraModes; using On.RoR2.CharacterAI; using RailCharges.Configuration; using RailCharges.Internals; using RailCharges.Patches; using RailCharges.Patches.BackupMagCharges; using RailCharges.Resources; using RoR2; using RoR2.CameraModes; using RoR2.CharacterAI; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("RailCharges")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Displays available charges count for Railgunner with Backup Magazines")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyInformationalVersion("0.2.1")] [assembly: AssemblyProduct("RailCharges")] [assembly: AssemblyTitle("RailCharges")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.1.0")] [module: UnverifiableCode] namespace RailCharges { public class CurrentPlayerTracker { private static PlayerCharacterMasterController cachedCurrentMaster; public static CharacterBody CurrentPlayerBody { get { PlayerCharacterMasterController obj = cachedCurrentMaster; CharacterBody val = ((obj != null) ? obj.master.GetBody() : null); if (Object.op_Implicit((Object)(object)val)) { return val; } cachedCurrentMaster = ((IEnumerable<PlayerCharacterMasterController>)PlayerCharacterMasterController.instances).FirstOrDefault((Func<PlayerCharacterMasterController, bool>)((PlayerCharacterMasterController c) => ((NetworkBehaviour)c.networkUser).isLocalPlayer)); PlayerCharacterMasterController obj2 = cachedCurrentMaster; val = ((obj2 != null) ? obj2.master.GetBody() : null); if (!Object.op_Implicit((Object)(object)val)) { RailChargesPlugin.Log.LogInfo((object)"Local player body found!"); } return val; } } public static void Init() { } } public static class Helpers { public static T GetPrefabFromEntityStateConfiguration<T>(string assetName, string prefabFieldName) where T : Object { //IL_000e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) return (T)(object)Addressables.LoadAssetAsync<EntityStateConfiguration>((object)assetName).WaitForCompletion().serializedFieldsCollection.serializedFields.First((SerializedField sf) => sf.fieldName == prefabFieldName).fieldValue.objectValue; } public static void Exec(Action action, Action after) { try { action(); after(); } catch (Exception ex) { RailChargesPlugin.Log.LogError((object)ex); } } public static bool Raycast(CharacterBody characterBody, Ray ray, out RaycastHit hitInfo) { //IL_0006: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return Util.CharacterRaycast(((Component)characterBody).gameObject, ray, ref hitInfo, 1000f, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)), (QueryTriggerInteraction)0); } } [BepInPlugin("RailCharges", "RailCharges", "0.2.1")] public class RailChargesPlugin : BaseUnityPlugin { public static ManualLogSource Log; public static PluginConfig PluginConfig; public static CameraNudgeManager CameraNudgeManager; public static List<IPatch> Patches = new List<IPatch>(); private DetourModManager detourModManager; private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginConfig = PluginConfig.Load(((BaseUnityPlugin)this).Config); detourModManager = new DetourModManager(); CurrentPlayerTracker.Init(); CameraNudgeManager = new CameraNudgeManager(); SetupPatches(); ResourceManager.Init(); SceneManager.sceneLoaded += OnSceneManagerOnsceneLoaded; if (Object.op_Implicit((Object)(object)Stage.instance)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Stage is running - patching"); PatchAssets(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RailCharges is loaded!"); } private void SetupPatches() { Patches = new List<IPatch> { new LightReticleChange(), new FasterWindup(), new CameraScopeParametersOverride(), new DisableBoostedIndicator() }; if (PluginConfig.DisplayBackupMagazineCharges) { Patches.Add(new BackupMagChargesPatch()); } if (PluginConfig.AngularCompensation) { Patches.Add(new AngularCompensationPatch(CameraNudgeManager)); } } private void OnSceneManagerOnsceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { PatchAssets(); } public void PatchAssets() { foreach (IPatch patch in Patches) { try { patch.Patch(PluginConfig); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error during patching: {arg}"); } } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneManagerOnsceneLoaded; detourModManager.Unload(typeof(RailChargesPlugin).Assembly); foreach (IPatch patch in Patches) { if (patch is IDisposable disposable) { disposable.Dispose(); } } } private void LoggerOnLogEvent(object sender, LogEventArgs e) { Chat.AddMessage(e.Data?.ToString() ?? ""); } } public static class PluginInfo { public const string PLUGIN_GUID = "RailCharges"; public const string PLUGIN_NAME = "RailCharges"; public const string PLUGIN_VERSION = "0.2.1"; } } namespace RailCharges.Resources { public class ResourceManager { private static Dictionary<string, Object> dict = new Dictionary<string, Object>(); public static void Init() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RailCharges.Resources.railcharges"); AssetBundle val = AssetBundle.LoadFromStream(stream); dict["reticle"] = (Object)(object)val.LoadAsset<Sprite>("Assets/icons/reticle.png"); val.Unload(false); } public static T Get<T>(string name) where T : Object { if (dict.TryGetValue(name, out var value)) { return (T)(object)value; } return default(T); } } } namespace RailCharges.Patches { public class AngularCompensationPatch : IPatch, IDisposable { private readonly CameraNudgeManager cameraNudgeManager; private PluginConfig config; public static CameraRigController CameraRigController => ((Component)((Component)Camera.main).gameObject.transform.parent).GetComponent<CameraRigController>(); public AngularCompensationPatch(CameraNudgeManager cameraNudgeManager) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown this.cameraNudgeManager = cameraNudgeManager; BaseScopeState.StartScopeParamsOverride += new hook_StartScopeParamsOverride(OnBaseScopeStateOnStartScopeParamsOverride); BaseScopeState.EndScopeParamsOverride += (hook_EndScopeParamsOverride)delegate(orig_EndScopeParamsOverride orig, BaseScopeState self, float transitionDuration) { OnBaseScopeStateOnEndScopeParamsOverride(orig, self, transitionDuration); }; } private void OnBaseScopeStateOnStartScopeParamsOverride(orig_StartScopeParamsOverride orig, BaseScopeState self, float transitionDuration) { Helpers.Exec(delegate { orig.Invoke(self, transitionDuration); }, delegate { if (config.AngularCompensation && self is WindUpScopeHeavy && ((NetworkBehaviour)((EntityState)self).characterBody.master.playerCharacterMasterController.networkUser).isLocalPlayer) { OnEnteringScope(((EntityState)self).characterBody); } }); } private void OnBaseScopeStateOnEndScopeParamsOverride(orig_EndScopeParamsOverride orig, BaseScopeState self, float transitionDuration) { Helpers.Exec(delegate { orig.Invoke(self, transitionDuration); }, delegate { if (config.AngularCompensation && self is BaseWindDown && ((NetworkBehaviour)((EntityState)self).characterBody.master.playerCharacterMasterController.networkUser).isLocalPlayer) { OnExitingScope(((EntityState)self).characterBody); } }); } public void Patch(PluginConfig config) { this.config = config; } private void OnEnteringScope(CharacterBody body) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) cameraNudgeManager.Cancel(); RailChargesPlugin.Log.LogInfo((object)"Entering scope"); Transform transform = ((Component)Camera.main).transform; Ray ray = default(Ray); ((Ray)(ref ray))..ctor(transform.position, transform.forward); if (Helpers.Raycast(body, ray, out var hitInfo)) { RailChargesPlugin.Log.LogInfo((object)("Raycast hit " + ((Object)((Component)((RaycastHit)(ref hitInfo)).collider).gameObject).name)); Vector3 val = CameraRigController.target.transform.position + new Vector3(0f, 0.5f, 0f); Quaternion val2 = Quaternion.LookRotation(((RaycastHit)(ref hitInfo)).point - val); RailChargesPlugin.Log.LogInfo((object)((Quaternion)(ref val2)).eulerAngles); CameraNudgeManager obj = cameraNudgeManager; float x = ((Quaternion)(ref val2)).eulerAngles.x; Quaternion rotation = transform.rotation; obj.Set(new Vector2(0f, AngleDifference(x, ((Quaternion)(ref rotation)).eulerAngles.x)), FasterWindup.WindupDuration); } } private void OnExitingScope(CharacterBody characterBody) { //IL_0025: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0082: Unknown result type (might be due to invalid IL or missing references) //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) cameraNudgeManager.Cancel(); RailChargesPlugin.Log.LogInfo((object)"Exiting scope"); Transform transform = ((Component)Camera.main).transform; CharacterCameraParamsData basic = CharacterCameraParamsData.basic; Ray ray = default(Ray); ((Ray)(ref ray))..ctor(transform.position, transform.forward); if (Helpers.Raycast(characterBody, ray, out var hitInfo)) { Vector3 val = transform.position + transform.rotation * basic.idealLocalCameraPos.value + new Vector3(0f, basic.pivotVerticalOffset.value, 0f); Quaternion val2 = Quaternion.LookRotation(((RaycastHit)(ref hitInfo)).point - val); CameraNudgeManager obj = cameraNudgeManager; float x = ((Quaternion)(ref val2)).eulerAngles.x; Quaternion rotation = transform.rotation; obj.Set(new Vector2(0f, AngleDifference(x, ((Quaternion)(ref rotation)).eulerAngles.x)), 0.01f); } } public static float AngleDifference(float angle1, float angle2) { float num = (angle2 - angle1 + 180f) % 360f - 180f; if (!(num < -180f)) { return num; } return num + 360f; } public void Dispose() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown BaseScopeState.StartScopeParamsOverride -= new hook_StartScopeParamsOverride(OnBaseScopeStateOnStartScopeParamsOverride); BaseScopeState.EndScopeParamsOverride -= (hook_EndScopeParamsOverride)delegate(orig_EndScopeParamsOverride orig, BaseScopeState self, float transitionDuration) { OnBaseScopeStateOnEndScopeParamsOverride(orig, self, transitionDuration); }; } } public class CameraScopeParametersOverride : IPatch { public void Patch(PluginConfig config) { OverrideScopeCameraParameters(config); } private void OverrideScopeCameraParameters(PluginConfig config) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Helpers.GetPrefabFromEntityStateConfiguration<CharacterCameraParams>("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Scope.WindUpScopeHeavy.asset", "cameraParams").data.fov = new BlendableFloat { value = config.ScopeFov, alpha = 1f }; } } public class DisableBoostedIndicator : IPatch, IDisposable { public void Patch(PluginConfig config) { if (config.DisabledBoostedIndicator) { Transform overlayPrefab = GetOverlayPrefab(); for (int i = 0; i < overlayPrefab.childCount; i++) { ((Component)overlayPrefab.GetChild(i)).gameObject.SetActive(false); } RailChargesPlugin.Log.LogError((object)"Disabled boost UI element."); } } public void Dispose() { Transform overlayPrefab = GetOverlayPrefab(); for (int i = 0; i < overlayPrefab.childCount; i++) { ((Component)overlayPrefab.GetChild(i)).gameObject.SetActive(true); } } private Transform GetOverlayPrefab() { return Helpers.GetPrefabFromEntityStateConfiguration<GameObject>("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Reload.Boosted.asset", "overlayPrefab").transform; } } public class FasterWindup : IPatch { public static float WindupDuration = 0.1f; private PluginConfig config; public FasterWindup() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown BaseWindUp.OnEnter += new hook_OnEnter(BaseWindUpOnOnEnter); } private void BaseWindUpOnOnEnter(orig_OnEnter orig, BaseWindUp self) { if (config.WindUpDurationOverride != self.baseDuration) { self.baseDuration = config.WindUpDurationOverride; WindupDuration = self.baseDuration; } orig.Invoke(self); } public void Patch(PluginConfig config) { this.config = config; } } public interface IPatch { void Patch(PluginConfig config); } public class LightReticleChange : IPatch { public void Patch(PluginConfig config) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if (config.Crosshair == CrosshairType.Unchanged && !config.RemoveOuterRectangle) { return; } GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerCrosshair.prefab").WaitForCompletion(); Transform val2 = val.transform.Find("Scaler"); if (!Object.op_Implicit((Object)(object)val2)) { RailChargesPlugin.Log.LogError((object)"Cannot find Scaler - light scope wasn't patched!"); return; } CrosshairController component = val.GetComponent<CrosshairController>(); RectTransform scaler = (RectTransform)val2; if (config.RemoveOuterRectangle) { RemoveOuterRectangle(scaler); } switch (config.Crosshair) { case CrosshairType.X: CreateXCrosshair(scaler, component); break; case CrosshairType.SameAsScope: CreatePlusCrosshair(scaler, component); break; case CrosshairType.Remove: CreateNoRectangleCrosshair(scaler, component); break; case CrosshairType.Unchanged: return; } RailChargesPlugin.Log.LogInfo((object)"Scope reticles patched!"); } private static void RemoveOuterRectangle(RectTransform scaler) { Transform val = ((Transform)scaler).parent.Find("Flavor, Ready"); if (!Object.op_Implicit((Object)(object)val)) { RailChargesPlugin.Log.LogWarning((object)"Cannot find outer rectangle to remove!"); return; } for (int i = 0; i < val.childCount; i++) { ((Component)val.GetChild(i)).gameObject.SetActive(false); } RailChargesPlugin.Log.LogInfo((object)"Outer rectangle removed"); } public static void CreatePlusCrosshair(RectTransform scaler, CrosshairController controller) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) DestroyExistingCrosshair(scaler); Transform val = Object.Instantiate<Transform>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerScopeCrosshairHeavy.prefab").WaitForCompletion().transform.Find("Available")); ((Component)val).transform.SetParent((Transform)(object)scaler); List<GameObject> list = new List<GameObject>(4); for (int i = 0; i < val.childCount; i++) { GameObject gameObject = ((Component)val.GetChild(i)).gameObject; if (((Object)gameObject).name == "Image") { list.Add(gameObject); } } List<SpritePosition> list2 = new List<SpritePosition>(); int[][] array = new int[4][] { new int[2] { 1, 0 }, new int[2] { -1, 0 }, new int[2] { 0, 1 }, new int[2] { 0, -1 } }; for (int j = 0; j < array.Length; j++) { int num = array[j][0]; int num2 = array[j][1]; GameObject val2 = list[j]; list2.Add(new SpritePosition { target = (RectTransform)val2.transform, zeroPosition = val2.transform.position + new Vector3((float)(-15 * num), (float)(-15 * num2)), onePosition = val2.transform.position + new Vector3((float)(50 * num), (float)(50 * num2)) }); val2.transform.SetParent((Transform)(object)scaler); } controller.spriteSpreadPositions = list2.ToArray(); } private static void CreateXCrosshair(RectTransform scaler, CrosshairController controller) { DestroyExistingCrosshair(scaler); CreateCustomReticles(scaler, controller); } private static void DestroyExistingCrosshair(RectTransform scaler) { for (int i = 0; i < ((Transform)scaler).childCount; i++) { Object.Destroy((Object)(object)((Component)((Transform)scaler).GetChild(i)).gameObject); } } private static void CreateNoRectangleCrosshair(RectTransform scaler, CrosshairController controller) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < ((Transform)scaler).childCount; i++) { ((Graphic)((Component)((Transform)scaler).GetChild(i)).gameObject.GetComponent<Image>()).color = Color.clear; } } public static void CreateCustomReticles(RectTransform scaler, CrosshairController controller) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) List<SpritePosition> list = new List<SpritePosition>(); int[] array = new int[2] { -1, 1 }; int[] array2 = array; foreach (int num in array2) { int[] array3 = array; foreach (int num2 in array3) { GameObject val = CreateReticle(15 * num, 15 * num2); list.Add(new SpritePosition { target = (RectTransform)val.transform, zeroPosition = new Vector3((float)(15 * num), (float)(15 * num2)), onePosition = new Vector3((float)(50 * num), (float)(50 * num2)) }); val.transform.SetParent((Transform)(object)scaler); } } controller.spriteSpreadPositions = list.ToArray(); } private static GameObject CreateReticle(int x, int y) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject($"Reticle_{x}_{y}"); Image obj = val.AddComponent<Image>(); obj.sprite = ResourceManager.Get<Sprite>("reticle"); ((Graphic)obj).color = new Color(1f, 1f, 1f, 0.5f); RectTransform val2 = (RectTransform)val.transform; val2.anchoredPosition = new Vector2((float)x, (float)y); val2.sizeDelta = new Vector2(15f, 15f); if (x != y) { ((Transform)val2).localRotation = Quaternion.Euler(0f, 180f, 0f); } return val; } } } namespace RailCharges.Patches.BackupMagCharges { public class BackupMagChargesPatch : IPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnSkillActivated <>9__0_0; internal void <Patch>b__0_0(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill) { try { orig.Invoke(self, skill); if (self.hasEffectiveAuthority && skill.skillNameToken == "RAILGUNNER_SNIPE_HEAVY_NAME" && ((NetworkBehaviour)self.master.playerCharacterMasterController.networkUser).isLocalPlayer) { ScopeTracker.UpdateCharges(self.skillLocator.primary); } } catch (Exception ex) { RailChargesPlugin.Log.LogError((object)ex); } } } public void Patch(PluginConfig config) { //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_0028: Expected O, but got Unknown if (!config.DisplayBackupMagazineCharges) { return; } object obj = <>c.<>9__0_0; if (obj == null) { hook_OnSkillActivated val = delegate(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill) { try { orig.Invoke(self, skill); if (self.hasEffectiveAuthority && skill.skillNameToken == "RAILGUNNER_SNIPE_HEAVY_NAME" && ((NetworkBehaviour)self.master.playerCharacterMasterController.networkUser).isLocalPlayer) { ScopeTracker.UpdateCharges(self.skillLocator.primary); } } catch (Exception ex) { RailChargesPlugin.Log.LogError((object)ex); } }; <>c.<>9__0_0 = val; obj = (object)val; } CharacterBody.OnSkillActivated += (hook_OnSkillActivated)obj; PatchPrefab(Helpers.GetPrefabFromEntityStateConfiguration<GameObject>("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Scope.ActiveScopeHeavy.asset", "crosshairOverridePrefab")); RailChargesPlugin.Log.LogInfo((object)"Heavy crosshair prefab patched!"); } public static void PatchPrefab(GameObject prefab) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Component component = prefab.GetComponent(typeof(ScopeTracker).FullName); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } prefab.AddComponent<ScopeTracker>(); GameObject val = new GameObject("charges"); HGTextMeshProUGUI obj = val.AddComponent<HGTextMeshProUGUI>(); ((TMP_Text)obj).alpha = 0.1f; ((TMP_Text)obj).fontSize = 30f; RectTransform val2 = (RectTransform)val.transform; val2.anchoredPosition = new Vector2(50f, 0f); val2.offsetMin = new Vector2(5f, 0f); val2.offsetMax = new Vector2(95f, 0f); Transform parent = prefab.transform.Find("Available"); ((Transform)val2).SetParent(parent); } } public class ScopeTracker : MonoBehaviour { public static HGTextMeshProUGUI LastTextMesh; private HGTextMeshProUGUI textMesh; private void Start() { Transform obj = ((Component)this).gameObject.transform.Find("Available/charges"); LastTextMesh = ((obj != null) ? ((Component)obj).GetComponent<HGTextMeshProUGUI>() : null); textMesh = LastTextMesh; if (!Object.op_Implicit((Object)(object)LastTextMesh)) { RailChargesPlugin.Log.LogError((object)"Failed to find text mesh"); return; } if (!Object.op_Implicit((Object)(object)CurrentPlayerTracker.CurrentPlayerBody)) { RailChargesPlugin.Log.LogError((object)"Player body not found"); return; } UpdateCharges(CurrentPlayerTracker.CurrentPlayerBody.skillLocator.secondary); SetReadyStatus(isReady: true); } private void Update() { if (Object.op_Implicit((Object)(object)LastTextMesh) && Object.op_Implicit((Object)(object)CurrentPlayerTracker.CurrentPlayerBody)) { SetReadyStatus(CurrentPlayerTracker.CurrentPlayerBody.skillLocator.primary.CanExecute()); } } private void OnDestroy() { if ((Object)(object)LastTextMesh == (Object)(object)textMesh) { LastTextMesh = null; } } public static void UpdateCharges(GenericSkill skill) { if (!Object.op_Implicit((Object)(object)LastTextMesh)) { RailChargesPlugin.Log.LogInfo((object)"UpdateCharges: no LastTextMesh"); } else if (skill.maxStock == 1) { ((TMP_Text)LastTextMesh).text = ""; } else { ((TMP_Text)LastTextMesh).text = $"{skill.stock}"; } } public static void SetReadyStatus(bool isReady) { if (Object.op_Implicit((Object)(object)LastTextMesh)) { ((TMP_Text)LastTextMesh).alpha = (isReady ? 0.5f : 0.1f); } } } } namespace RailCharges.Internals { public class CameraNudgeManager { public class Nudge { public Vector2 Delta { get; set; } public Vector2 Progress { get; set; } public float Elapsed { get; set; } public float Duration { get; set; } public bool IsDone => Elapsed >= Duration; public Vector2 Tick(float deltaTime) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Elapsed += deltaTime; float num = Mathf.Clamp01(Elapsed / Duration); Vector2 val = Vector2.Lerp(Vector2.zero, Delta, num); Vector2 result = val - Progress; Progress = val; return result; } } private Nudge nudge; public CameraNudgeManager() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown CameraModeBase.CollectLookInput += new hook_CollectLookInput(CameraModeBaseOnCollectLookInput); } private void CameraModeBaseOnCollectLookInput(orig_CollectLookInput orig, CameraModeBase self, ref CameraModeContext context, out CollectLookInputResult result) { //IL_001b: 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_0035: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, ref context, ref result); if (nudge != null) { ref Vector2 lookInput = ref result.lookInput; lookInput += nudge.Tick(Time.deltaTime); if (nudge.IsDone) { RailChargesPlugin.Log.LogInfo((object)$"Nudge finished @{nudge.Elapsed}"); Cancel(); } } } public void Set(Vector2 delta, float duration) { //IL_0007: 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_0039: Unknown result type (might be due to invalid IL or missing references) nudge = new Nudge { Delta = delta, Elapsed = 0f, Progress = Vector2.zero, Duration = duration }; RailChargesPlugin.Log.LogInfo((object)$"Nudge was set {delta} {duration:00.00}"); } public void Cancel() { nudge = null; } } public class FadingOverrideManager { public class FadeOverride { public CharacterModel Model { get; set; } public float Target { get; set; } public float TransitionTime { get; set; } public float StartValue { get; set; } public float Elapsed { get; set; } public void Update(float deltaTime) { if (Object.op_Implicit((Object)(object)Model)) { Elapsed += deltaTime; float num = Mathf.Clamp(Elapsed, 0f, TransitionTime); Model.fade = Mathf.Lerp(StartValue, Target, num / TransitionTime); } } } private FadeOverride Override; public FadingOverrideManager() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown CharacterModel.RefreshObstructorsForCamera += new hook_RefreshObstructorsForCamera(CharacterModelOnRefreshObstructorsForCamera); } private void CharacterModelOnRefreshObstructorsForCamera(orig_RefreshObstructorsForCamera orig, CameraRigController camerarigcontroller) { try { orig.Invoke(camerarigcontroller); if (Override != null) { Override.Update(Time.deltaTime); } } catch (Exception ex) { RailChargesPlugin.Log.LogError((object)ex); } } public void SetOverride(CharacterModel model, float targetOverride, float transitionTime) { Override = new FadeOverride { Target = targetOverride, StartValue = model.fade, TransitionTime = transitionTime, Model = model }; } public void RemoveOverride() { Override = null; } } } namespace RailCharges.Internals.Debug { public class DebugCubes { private static Dictionary<Color, GameObject> cubes = new Dictionary<Color, GameObject>(); public static void Clear() { foreach (GameObject value in cubes.Values) { Object.Destroy((Object)(object)value); } cubes.Clear(); } public static void SetPosition(Color color, Vector3 position, float size = 0.1f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) GetOrCreateCube(color, size).transform.position = position; } public static GameObject GetOrCreateCube(Color color, float size = 0.1f) { //IL_0005: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (cubes.TryGetValue(color, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } value = CreateDebugCube($"debug_cube_{color}", color, size); cubes[color] = value; return value; } private static GameObject CreateDebugCube(string name, Color color, float size = 0.1f) { //IL_0018: 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) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = name; obj.GetComponent<Renderer>().material.color = color; obj.layer = LayerMask.NameToLayer("Ignore Raycast"); obj.transform.localScale = new Vector3(size, size, size); return obj; } } public class DisableAI { [CompilerGenerated] private static class <>O { public static hook_FixedUpdate <0>__BaseAIOnFixedUpdate; } public static bool Disabled { get; set; } public static void Init() { //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>__BaseAIOnFixedUpdate; if (obj == null) { hook_FixedUpdate val = BaseAIOnFixedUpdate; <>O.<0>__BaseAIOnFixedUpdate = val; obj = (object)val; } BaseAI.FixedUpdate += (hook_FixedUpdate)obj; } private static void BaseAIOnFixedUpdate(orig_FixedUpdate orig, BaseAI self) { if (!Disabled) { orig.Invoke(self); } } } } namespace RailCharges.Configuration { public static class ConfigFileExtensions { public static BindCollection BindCollection(this ConfigFile config, string section = null) { return new BindCollection(config, section); } } public class BindCollection { private readonly ConfigFile config; public string Section { get; private set; } public List<ConfigEntryBase> Bindings { get; } = new List<ConfigEntryBase>(); private Dictionary<ConfigEntryBase, Action> UpdateCallbacks { get; } = new Dictionary<ConfigEntryBase, Action>(); public event Action OnChanged; public BindCollection(ConfigFile config, string section) { this.config = config; Section = section; this.config.SettingChanged += OnSettingChanged; } private void OnSettingChanged(object sender, SettingChangedEventArgs e) { if (UpdateCallbacks.TryGetValue(e.ChangedSetting, out var value)) { value(); this.OnChanged?.Invoke(); } } public BindCollection Bind(Action<BindCollection> registrar) { registrar(this); return this; } public BindCollection Bind<TValue>(string key, string description, Action<TValue> set, TValue defaultValue = default(TValue)) { ConfigEntry<TValue> binding = config.Bind<TValue>(Section, key, defaultValue, description); set(binding.Value); Bindings.Add((ConfigEntryBase)(object)binding); UpdateCallbacks.Add((ConfigEntryBase)(object)binding, delegate { set(binding.Value); }); return this; } public BindCollection Bind<TValue>(string key, ConfigDescription configDescription, Action<TValue> set, TValue defaultValue = default(TValue)) { ConfigEntry<TValue> binding = config.Bind<TValue>(Section, key, defaultValue, configDescription); set(binding.Value); Bindings.Add((ConfigEntryBase)(object)binding); UpdateCallbacks.Add((ConfigEntryBase)(object)binding, delegate { set(binding.Value); }); return this; } } public enum CrosshairType { Unchanged, X, SameAsScope, Remove } public class PluginConfig { public bool DisplayBackupMagazineCharges { get; set; } public float ScopeFov { get; set; } public float WindUpDurationOverride { get; set; } public CrosshairType Crosshair { get; set; } public bool RemoveOuterRectangle { get; set; } public bool DisabledBoostedIndicator { get; set; } public bool AngularCompensation { get; set; } public static PluginConfig Load(ConfigFile config) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown PluginConfig pluginConfig = new PluginConfig(); config.BindCollection("Rail Charges").Bind("Display Charges", "Display number of Backup Magazine charges in scope mode", delegate(bool v) { pluginConfig.DisplayBackupMagazineCharges = v; }, defaultValue: true).Bind("WindUp duration override", "Modify how long animation for entering scope mode will take. Default game value is 0.1.", delegate(float v) { pluginConfig.WindUpDurationOverride = v; }, 0.1f) .Bind("Scope FOV override", "Set FOV for scope mode. Lower value - greater zoom. Default game value is 30.", delegate(float v) { pluginConfig.ScopeFov = v; }, 30f) .Bind("Crosshair", new ConfigDescription("Crosshair in normal mode", (AcceptableValueBase)(object)new AcceptableValueList<string>(Enum.GetNames(typeof(CrosshairType))), Array.Empty<object>()), delegate(string v) { pluginConfig.Crosshair = ParseEnum<CrosshairType>(v); }, CrosshairType.Unchanged.ToString()) .Bind("Remove Outer Rectangle", "Disable outer yellow rectangle in non-scope view.", delegate(bool v) { pluginConfig.RemoveOuterRectangle = v; }, defaultValue: false) .Bind("Disable Boosted Indicator", "Disable boosted indicator for boosted shot after successful reload.", delegate(bool v) { pluginConfig.DisabledBoostedIndicator = v; }, defaultValue: false) .Bind("Angular Compensation", "Compensate camera rotation to retain targeting when entering scope mode. If disabled, scope will be aiming a little bit lower than in normal mode as in original. (Experimental)", delegate(bool v) { pluginConfig.AngularCompensation = v; }, defaultValue: false); return pluginConfig; } private static T ParseEnum<T>(string name) where T : struct { Enum.TryParse<T>(name, out var result); return result; } } }
BepinEx/plugins/BasilPanda-RemoveAllyCap/RemoveAllyCap.dll
Decompiled 11 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using RoR2; 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("RoR2RemoveAllyCap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoR2RemoveAllyCap")] [assembly: AssemblyTitle("RoR2RemoveAllyCap")] [assembly: AssemblyVersion("1.0.0.0")] namespace RoR2RemoveAllyCap; [HarmonyPatch(typeof(MasterSummon), "Perform")] internal class Patches { private static bool Prefix(MasterSummon __instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) __instance.ignoreTeamMemberLimit = RAC.RemoveCap.Value; TeamIndex val = ((!__instance.teamIndexOverride.HasValue) ? TeamComponent.GetObjectTeam(__instance.summonerBodyObject) : __instance.teamIndexOverride.Value); TeamDef teamDef = TeamCatalog.GetTeamDef(val); if (teamDef != null) { teamDef.softCharacterLimit = (int)RAC.ConfigToFloat(RAC.AllyCountCap.Value); } return true; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Basil.RemoveAllyCap", "RemoveAllyCap", "1.0.5")] public class RAC : BaseUnityPlugin { public static ConfigEntry<bool> RemoveCap; public static ConfigEntry<string> AllyCountCap; public void InitConfig() { RemoveCap = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RemoveCap", true, "Removes the default ally cap if true and sets it to theoretically infinity."); AllyCountCap = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "AllyCountCap", "20", "Sets the max number of allies you can have. This will only work if RemoveCap is set to false."); } public static float ConfigToFloat(string configline) { if (float.TryParse(configline, out var result)) { return result; } return 1f; } public void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown InitConfig(); try { Harmony val = new Harmony("RAC"); val.PatchAll(); } catch (Exception ex) { Debug.Log((object)("Overall Patcher " + ex.Message)); } } }
BepinEx/plugins/BetterPing-PingItemDescription/PingItemDescription.dll
Decompiled 11 months 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 Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.UI; using RoR2.UI.LogBook; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("PingItemDescription")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PingItemDescription")] [assembly: AssemblyTitle("PingItemDescription")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PingItemDescription { internal class ItemStats { private static LogBookController logbook; private void foo() { } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } internal class ChatCommand { public string Name { get; set; } public Func<string[], string> Handler { get; set; } internal ChatCommand(string name, Func<string[], string> handler) { Name = name; Handler = handler; } } public class PIDCommand { private static PingItemDescriptionConfig _config; private static string commandPrefix = "PID"; private static readonly Dictionary<string, ChatCommand> _chatCommands = new List<ChatCommand> { new ChatCommand("TOGGLE", ShowDescription), new ChatCommand("OTHERS", ShowDescriptionOther), new ChatCommand("TIME", SetDescriptionTime), new ChatCommand("HIDDEN", ShowHidden) }.ToDictionary((ChatCommand rec) => rec.Name); public PIDCommand(PingItemDescription plugin) { _config = plugin.GetConfig(); } private static string ShowDescription(string[] args) { _config.EnableMod.Value = !_config.EnableMod.Value; if (!_config.EnableMod.Value) { return "PingItemDescription disabled."; } return "PingItemDescription enabled."; } private static string ShowHidden(string[] args) { _config.SeeQuestionMarkDescription.Value = !_config.SeeQuestionMarkDescription.Value; if (!_config.SeeQuestionMarkDescription.Value) { return "Ping description of question marks are now hidden."; } return "Ping description of question marks are now shown."; } private static string ShowDescriptionOther(string[] args) { _config.ShowPingDescriptionFromOtherPlayers.Value = !_config.ShowPingDescriptionFromOtherPlayers.Value; if (!_config.ShowPingDescriptionFromOtherPlayers.Value) { return "Ping description of other players are now hidden."; } return "Ping description of other players will be shown."; } private static string SetDescriptionTime(string[] args) { if (args.Length < 1 || args.Length > 2) { return "Requires 1 number argument"; } if (int.TryParse(args[1], out var result)) { if (result >= 1 && result <= 60) { _config.DefaultDescriptionTime.Value = result; string text = ((result == 1) ? " second" : " seconds"); return "Ping descriptions will be shown for " + result + text; } return "Value must be between 1 and 60 seconds"; } return "Requires 1 number argument. Input: " + args; } public void Console_RunCmd(orig_RunCmd orig, Console self, CmdSender sender, string concommandName, List<string> userArgs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, sender, concommandName, userArgs); if ((Object)(object)Run.instance == (Object)null || !concommandName.Equals("say", StringComparison.InvariantCultureIgnoreCase)) { return; } string text = userArgs.FirstOrDefault(); if (string.IsNullOrWhiteSpace(text) || !text.StartsWith("/")) { return; } string[] source = text.Split(new char[1] { ' ' }); string text2 = source.FirstOrDefault().Substring(1); string[] array = source.Skip(1).ToArray(); if (text2.ToUpper().Equals(commandPrefix)) { if (!_chatCommands.TryGetValue(array[0].ToUpperInvariant(), out var value)) { Chat.AddMessage("PingItemDescription: Command not found: " + array[0]); } string text3 = value.Handler(array); if (!string.IsNullOrWhiteSpace(text3)) { Chat.AddMessage(text3); } } } } public class PingIndicator { private static PingItemDescriptionConfig _config; public PingIndicator(PingItemDescription plugin) { _config = plugin.GetConfig(); } public void rebuild(orig_RebuildPing orig, PingIndicator self) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!_config.EnableMod.Value) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(firstLocalUser.cachedMaster); if ((self.pingOwner.GetComponent<PlayerCharacterMasterController>().GetDisplayName().Equals(firstLocalUser.cachedMasterController.GetDisplayName()) || _config.ShowPingDescriptionFromOtherPlayers.Value) && (int)self.pingType == 2) { ShopTerminalBehavior component = self.pingTarget.GetComponent<ShopTerminalBehavior>(); GenericPickupController component2 = self.pingTarget.GetComponent<GenericPickupController>(); PickupDropletController component3 = self.pingTarget.GetComponent<PickupDropletController>(); if (Object.op_Implicit((Object)(object)component2)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(component2.pickupIndex); checkItems(notificationQueueForMaster, pickupDef.itemIndex, pickupDef.equipmentIndex, pickupDef.artifactIndex); } if (Object.op_Implicit((Object)(object)component) && (!component.hidden || (component.hidden && _config.SeeQuestionMarkDescription.Value))) { PickupDef pickupDef2 = PickupCatalog.GetPickupDef(component.CurrentPickupIndex()); checkItems(notificationQueueForMaster, pickupDef2.itemIndex, pickupDef2.equipmentIndex, pickupDef2.artifactIndex); } if (Object.op_Implicit((Object)(object)component3)) { PickupDef pickupDef3 = PickupCatalog.GetPickupDef(component3.pickupIndex); checkItems(notificationQueueForMaster, pickupDef3.itemIndex, pickupDef3.equipmentIndex, pickupDef3.artifactIndex); } } } private void checkItems(CharacterMasterNotificationQueue notificationQueueForMaster, ItemIndex itemIndex, EquipmentIndex equipmentIndex, ArtifactIndex artifactIndex) { //IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef(artifactIndex); notificationQueueForMaster.notifications.Clear(); if ((Object)(object)itemDef != (Object)null) { Language.GetString(itemDef.descriptionToken); notificationQueueForMaster.PushNotification(new NotificationInfo((object)itemDef, (TransformationInfo)null), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)equipmentDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)equipmentDef, (TransformationInfo)null), (float)_config.DefaultDescriptionTime.Value); } else if ((Object)(object)artifactDef != (Object)null) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)artifactDef, (TransformationInfo)null), (float)_config.DefaultDescriptionTime.Value); } } } [BepInPlugin("Red.PingItemDescription", "PingItemDescription", "1.0.4")] public class PingItemDescription : BaseUnityPlugin { public const string PluginGUID = "Red.PingItemDescription"; public const string PluginAuthor = "Red"; public const string PluginName = "PingItemDescription"; public const string PluginVersion = "1.0.4"; private static PingItemDescriptionConfig _config; public PingItemDescriptionConfig GetConfig() { return _config; } public PingItemDescription() { _config = new PingItemDescriptionConfig(((BaseUnityPlugin)this).Config); } public void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); PingIndicator pingIndicator = new PingIndicator(this); PIDCommand pIDCommand = new PIDCommand(this); PingIndicator.RebuildPing += new hook_RebuildPing(pingIndicator.rebuild); Console.RunCmd += new hook_RunCmd(pIDCommand.Console_RunCmd); Log.LogInfo("Awake done."); } } public class PingItemDescriptionConfig { public ConfigEntry<bool> EnableMod { get; set; } public ConfigEntry<bool> SeeQuestionMarkDescription { get; set; } public ConfigEntry<bool> ShowPingDescriptionFromOtherPlayers { get; set; } public ConfigEntry<int> DefaultDescriptionTime { get; set; } public PingItemDescriptionConfig(ConfigFile configfile) { EnableMod = configfile.Bind<bool>("General", "EnableMod", true, "Enable Mod"); ShowPingDescriptionFromOtherPlayers = configfile.Bind<bool>("General", "ShowPingDescriptionFromOtherPlayers", false, "Show ping description of other players"); DefaultDescriptionTime = configfile.Bind<int>("General", "DefaultDescriptionTime", 5, "Time in seconds how long item descriptions should be shown after a ping"); SeeQuestionMarkDescription = configfile.Bind<bool>("General", "SeeQuestionMarkDescription", false, "If true you can see the description of the question mark item in the multishop "); } } }
BepinEx/plugins/Bubbet-SkipIntro/SkipIntroCutscene.dll
Decompiled 11 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using RoR2; [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("SkipIntroCutscene")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SkipIntroCutscene")] [assembly: AssemblyTitle("SkipIntroCutscene")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SkipIntroCutscene; [HarmonyPatch] public static class HarmonyPatches { [HarmonyPrefix] [HarmonyPatch(typeof(SplashScreenController), "Start")] public static void SetConsoleCommandValues() { Console.instance.SubmitCmd((NetworkUser)null, "set_scene title", false); } } [BepInPlugin("bubbet.skipintrocutscene", "Skip Intro Cutscene", "1.0.0")] public class SkipIntroCutscenePlugin : BaseUnityPlugin { public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); new PatchClassProcessor(val, typeof(HarmonyPatches)).Patch(); } }
BepinEx/plugins/Chen-ChensHelpers/ChensHelpers.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Chen.Helpers.CollectionHelpers; using Chen.Helpers.GeneralHelpers; using Chen.Helpers.LogHelpers; using Chen.Helpers.UnityHelpers; using On.RoR2.Networking; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.ContentManagement; using RoR2.Networking; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ChensHelpers")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2")] [assembly: AssemblyProduct("ChensHelpers")] [assembly: AssemblyTitle("ChensHelpers")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/cheeeeeeeeeen/RoR2-ChensHelpers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] namespace Chen.Helpers { [BepInPlugin("com.Chen.ChensHelpers", "ChensHelpers", "1.1.2")] [BepInDependency("com.bepis.r2api", "4.3.5")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [R2APISubmoduleDependency(new string[] { "SoundAPI", "NetworkingAPI" })] public class HelperPlugin : BaseUnityPlugin { public const string ModVer = "1.1.2"; public const string ModName = "ChensHelpers"; public const string ModGuid = "com.Chen.ChensHelpers"; internal static Log Log { get; private set; } private void Awake() { Log = new Log(((BaseUnityPlugin)this).Logger); NetworkingAPI.RegisterMessageType<MinionExtensions.SyncOwner>(); } } } namespace Chen.Helpers.UnityHelpers { public static class Extensions { public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component { T val = gameObject.GetComponent<T>(); if (!Object.op_Implicit((Object)(object)val)) { val = gameObject.AddComponent<T>(); } return val; } public static T GetOrAddComponent<T>(this Component component) where T : Component { return component.gameObject.GetOrAddComponent<T>(); } public static T GetOrAddComponent<T>(this GameObject gameObject, Action<T> action) where T : Component { T orAddComponent = gameObject.GetOrAddComponent<T>(); action(orAddComponent); return orAddComponent; } public static T GetOrAddComponent<T>(this Component component, Action<T> action) where T : Component { return component.gameObject.GetOrAddComponent(action); } public static T GetOrAddComponent<T>(this GameObject gameObject, Action<T> getAction, Action<T> addAction) where T : Component { T val = gameObject.GetComponent<T>(); if (Object.op_Implicit((Object)(object)val)) { getAction(val); } else { val = gameObject.AddComponent<T>(); addAction(val); } return val; } public static T GetOrAddComponent<T>(this Component component, Action<T> getAction, Action<T> addAction) where T : Component { return component.gameObject.GetOrAddComponent(getAction, addAction); } public static List<T> DeepCopyComponentsFrom<T>(this GameObject targetGameObject, GameObject sourceGameObject) where T : Component { List<T> list = new List<T>(); T[] components = sourceGameObject.GetComponents<T>(); T[] array = components; foreach (T originalComponent in array) { T item = originalComponent.DeepCopy(targetGameObject); list.Add(item); } return list; } public static List<T> DeepCopyComponentsTo<T>(this GameObject sourceGameObject, GameObject targetGameObject) where T : Component { return targetGameObject.DeepCopyComponentsFrom<T>(sourceGameObject); } public static T DeepCopy<T>(this T originalComponent, GameObject targetGameObject) where T : Component { T val = targetGameObject.AddComponent<T>(); FieldInfo[] fields = typeof(T).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(originalComponent)); } return val; } } public abstract class ListProcessor<T> : MonoBehaviour { protected List<T> processList = new List<T>(); private float intervalTimer; private readonly List<T> failedItems = new List<T>(); protected abstract bool repeatUntilSuccess { get; set; } protected abstract float processInterval { get; set; } public virtual bool Add(T item) { return processList.ConditionalAdd(item, (T listItem) => item.Equals(listItem)); } protected abstract bool Process(T item); protected virtual void OnSuccess(T item) { } protected virtual void OnFailure(T item) { if (repeatUntilSuccess) { failedItems.Add(item); } } protected virtual void FixedUpdate() { intervalTimer += Time.fixedDeltaTime; if (!(intervalTimer >= processInterval)) { return; } while (processList.Count > 0) { foreach (T process in processList) { if (Process(process)) { OnSuccess(process); } else { OnFailure(process); } } if (!repeatUntilSuccess) { break; } processList.Clear(); processList.AddRange(failedItems); } intervalTimer -= processInterval; } } public abstract class QueueProcessor<T> : MonoBehaviour { protected readonly Queue<T> processQueue = new Queue<T>(); private float intervalTimer; protected abstract int itemsPerFrame { get; set; } protected abstract float processInterval { get; set; } public virtual void Add(T item) { processQueue.Enqueue(item); } protected abstract bool Process(T item); protected virtual void OnSuccess(T item) { } protected virtual void OnFailure(T item) { } protected virtual void FixedUpdate() { intervalTimer += Time.fixedDeltaTime; if (!(intervalTimer >= processInterval)) { return; } for (int i = 0; i < itemsPerFrame; i++) { if (processQueue.Count <= 0) { break; } T item = processQueue.Dequeue(); if (Process(item)) { OnSuccess(item); continue; } OnFailure(item); processQueue.Enqueue(item); } intervalTimer -= processInterval; } } public class TemporaryParticleSystem : MonoBehaviour { public bool detonate; public ParticleSystem particleSystem; protected virtual void Awake() { detonate = true; particleSystem = ((Component)this).gameObject.GetComponent<ParticleSystem>(); if (!Object.op_Implicit((Object)(object)particleSystem)) { Object.Destroy((Object)(object)this); } } protected virtual void FixedUpdate() { if (detonate && !particleSystem.isEmitting) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } namespace Chen.Helpers.MathHelpers { public static class Arithmetic { public static float SafeDivide(this float dividend, float divisor, float fallbackResult = float.PositiveInfinity) { if (divisor == 0f) { return fallbackResult; } return dividend / divisor; } public static int SafeDivide(this int dividend, int divisor, int fallbackResult = 0) { if (divisor == 0) { return fallbackResult; } return dividend / divisor; } public static int Sum(this int[] numbers, Func<int, int> preProcess = null) { int num = 0; foreach (int num2 in numbers) { int num3 = preProcess?.Invoke(num2) ?? num2; num += num3; } return num; } public static float Sum(this float[] numbers, Func<float, float> preProcess = null) { float num = 0f; foreach (float num2 in numbers) { float num3 = preProcess?.Invoke(num2) ?? num2; num += num3; } return num; } public static float Average(this int[] numbers, Func<int, int> preProcess = null) { return numbers.Sum(preProcess) / numbers.Length; } public static float Average(this float[] numbers, Func<float, float> preProcess = null) { return numbers.Sum(preProcess) / (float)numbers.Length; } } public static class Percent { private static readonly int[] groupSize = new int[1] { 3 }; private static readonly NumberFormatInfo numberFormatInfo = new NumberFormatInfo { PercentPositivePattern = 1, PercentNegativePattern = 1, NegativeSign = "-", PercentSymbol = "%", PercentDecimalDigits = 0, PercentDecimalSeparator = ".", PercentGroupSeparator = "", PercentGroupSizes = groupSize, NumberNegativePattern = 1, NumberGroupSizes = groupSize, NumberGroupSeparator = "", NumberDecimalSeparator = ".", NumberDecimalDigits = 0 }; public static float ToPercent(this float number) { return number * 100f; } public static string ToPercent(this float number, uint precision) { return number.ToString($"P{precision}", numberFormatInfo); } public static float ToDecimal(this float percentage) { return percentage / 100f; } public static string ToDecimal(this float percentage, uint precision) { return percentage.ToDecimal().ToString($"N{precision}", numberFormatInfo); } } public static class Wave { public static float Sine(float phase, float frequency, float amplitude, float baseValue) { float x = GetX(phase, frequency); float y = Mathf.Sin(x * 2f * MathF.PI); return Compute(y, amplitude, baseValue); } public static float Triangle(float phase, float frequency, float amplitude, float baseValue) { float x = GetX(phase, frequency); float y = ((!(x < 0.5f)) ? (-4f * x + 3f) : (4f * x - 1f)); return Compute(y, amplitude, baseValue); } public static float Square(float phase, float frequency, float amplitude, float baseValue) { float x = GetX(phase, frequency); float y = ((!(x < 0.5f)) ? (-1f) : 1f); return Compute(y, amplitude, baseValue); } public static float Sawtooth(float phase, float frequency, float amplitude, float baseValue) { return Compute(GetX(phase, frequency), amplitude, baseValue); } public static float InvertedSawtooth(float phase, float frequency, float amplitude, float baseValue) { return Compute(1f - GetX(phase, frequency), amplitude, baseValue); } public static float Noisy(float amplitude, float baseValue) { return Compute(1f - Random.value * 2f, amplitude, baseValue); } private static float GetX(float phase, float frequency) { float num = (Time.time + phase) * frequency; return num - Mathf.Floor(num); } private static float Compute(float y, float amplitude, float baseValue) { return y * amplitude + baseValue; } } } namespace Chen.Helpers.LogHelpers { public class Log { private readonly ManualLogSource logger; public Log(ManualLogSource logger) { this.logger = logger; } public void Debug(object data) { logger.LogDebug(data); } public void Error(object data) { logger.LogError(data); } public void Info(object data) { logger.LogInfo(data); } public void Message(object data) { logger.LogMessage(data); } public void Warning(object data) { logger.LogWarning(data); } } } namespace Chen.Helpers.LogHelpers.Collections { public static class Extensions { private const string defaultToken = "%DATA%"; public static void MessageArray<T>(this Log logger, T[] data, string format = "%DATA%", string representation = "%DATA%") { GenericLogging(data, format, representation, delegate(string item) { logger.Message(item); }); } public static void MessageArray<T>(this Log logger, T[] data, Func<T, string> formatter) { GenericLogging(data, formatter, delegate(string formatted) { logger.Message(formatted); }); } public static void InfoArray<T>(this Log logger, T[] data, string format = "%DATA%", string representation = "%DATA%") { GenericLogging(data, format, representation, delegate(string item) { logger.Info(item); }); } public static void InfoArray<T>(this Log logger, T[] data, Func<T, string> formatter) { GenericLogging(data, formatter, delegate(string formatted) { logger.Info(formatted); }); } public static void WarningArray<T>(this Log logger, T[] data, string format = "%DATA%", string representation = "%DATA%") { GenericLogging(data, format, representation, delegate(string item) { logger.Warning(item); }); } public static void WarningArray<T>(this Log logger, T[] data, Func<T, string> formatter) { GenericLogging(data, formatter, delegate(string formatted) { logger.Warning(formatted); }); } public static void ErrorArray<T>(this Log logger, T[] data, string format = "%DATA%", string representation = "%DATA%") { GenericLogging(data, format, representation, delegate(string item) { logger.Error(item); }); } public static void ErrorArray<T>(this Log logger, T[] data, Func<T, string> formatter) { GenericLogging(data, formatter, delegate(string formatted) { logger.Error(formatted); }); } public static void DebugArray<T>(this Log logger, T[] data, string format = "%DATA%", string representation = "%DATA%") { GenericLogging(data, format, representation, delegate(string item) { logger.Debug(item); }); } public static void DebugArray<T>(this Log logger, T[] data, Func<T, string> formatter) { GenericLogging(data, formatter, delegate(string formatted) { logger.Debug(formatted); }); } private static void GenericLogging<T>(T[] data, string format, string token, Action<string> logAction) { for (int i = 0; i < data.Length; i++) { T val = data[i]; string text = ""; string[] array = format.Split(new string[1] { token }, StringSplitOptions.None); int num = array.Length; for (int j = 0; j < num; j++) { text += array[j]; if (j != num - 1) { text += val.ToString(); } } logAction(text); } } private static void GenericLogging<T>(T[] data, Func<T, string> formatter, Action<string> logAction) { foreach (T arg in data) { logAction(formatter(arg)); } } } } namespace Chen.Helpers.GeneralHelpers { public class AssetsManager { public struct BundleInfo : IEquatable<BundleInfo> { public string source; public BundleType type; public BundleInfo(string source, BundleType type) { this.source = source; this.type = type; } public bool Equals(BundleInfo other) { return source == other.source; } } public enum BundleType : byte { UnityAssetBundle, WWiseSoundBank } private readonly BundleInfo bundleInfo; public AssetsManager(BundleInfo bundleInfo) { this.bundleInfo = bundleInfo; } public AssetBundle Register() { using Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(bundleInfo.source); switch (bundleInfo.type) { case BundleType.UnityAssetBundle: return AssetBundle.LoadFromStream(stream); case BundleType.WWiseSoundBank: { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); SoundBanks.Add(array); return null; } default: return null; } } } public class BlastAttack : BlastAttack { public struct HitPointAndResult { public HitPoint[] hitPoints; public Result result; } public HitPointAndResult InformativeFire() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) HitPoint[] array = ((BlastAttack)this).CollectHits(); ((BlastAttack)this).HandleHits(array); HitPointAndResult result = default(HitPointAndResult); result.hitPoints = array; result.result = new Result { hitCount = array.Length }; return result; } } public static class DefaultData { public static Dictionary<string, string> ShaderReplacements = new Dictionary<string, string> { { "fake ror/hopoo games/deferred/hgstandard", "shaders/deferred/hgstandard" }, { "fake ror/hopoo games/fx/hgcloud intersection remap", "shaders/fx/hgintersectioncloudremap" }, { "fake ror/hopoo games/fx/hgcloud remap", "shaders/fx/hgcloudremap" }, { "fake ror/hopoo games/fx/hgdistortion", "shaders/fx/hgdistortion" }, { "fake ror/hopoo games/deferred/hgsnow topped", "shaders/deferred/snow topped" } }; } public static class DropletGenerator { public static void Update() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) bool keyDown = Input.GetKeyDown((KeyCode)284); bool keyDown2 = Input.GetKeyDown((KeyCode)285); bool keyDown3 = Input.GetKeyDown((KeyCode)286); bool keyDown4 = Input.GetKeyDown((KeyCode)287); bool keyDown5 = Input.GetKeyDown((KeyCode)288); bool keyDown6 = Input.GetKeyDown((KeyCode)289); bool keyDown7 = Input.GetKeyDown((KeyCode)290); if (keyDown || keyDown2 || keyDown3 || keyDown4 || keyDown5 || keyDown6 || keyDown7) { Transform transform = Instances.hostBodyObject.transform; List<PickupIndex> list = (keyDown ? Run.instance.availableTier1DropList : (keyDown2 ? Run.instance.availableTier2DropList : (keyDown3 ? Run.instance.availableTier3DropList : (keyDown4 ? Run.instance.availableEquipmentDropList : (keyDown5 ? Run.instance.availableLunarItemDropList : ((!keyDown6) ? Run.instance.availableBossDropList : Run.instance.availableLunarEquipmentDropList)))))); PickupDropletController.CreatePickupDroplet(list[Run.instance.spawnRng.RangeInt(0, list.Count)], transform.position, new Vector3(0f, -5f, 0f)); } } } public static class Extensions { public static RendererInfo[] BuildRendererInfos(this CharacterModel model, GameObject basisObject) { return model.BuildRendererInfos(basisObject, (ShadowCastingMode)1, ignoreOverlays: false); } public static RendererInfo[] BuildRendererInfos(this CharacterModel model, GameObject basisObject, ShadowCastingMode mode, bool ignoreOverlays) { //IL_0022: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = basisObject.GetComponentsInChildren<MeshRenderer>(); model.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { model.baseRendererInfos[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = mode, ignoreOverlays = ignoreOverlays }; } return model.baseRendererInfos; } public static void ReplaceModel(this GameObject originalClonedObject, GameObject replacementModel, bool debug = false) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007c: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) ModelLocator component = originalClonedObject.GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform val; if (Object.op_Implicit((Object)(object)(val = originalClonedObject.transform.Find("ModelBase")))) { Object.Destroy((Object)(object)((Component)val).gameObject); } if (Object.op_Implicit((Object)(object)(val = originalClonedObject.transform.Find("Model Base")))) { Object.Destroy((Object)(object)((Component)val).gameObject); } GameObject val2 = new GameObject("ModelBase"); val2.transform.parent = originalClonedObject.transform; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; Transform transform = replacementModel.transform; transform.parent = val2.transform; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; component.modelTransform = replacementModel.transform; component.modelBaseTransform = val2.transform; if (debug) { replacementModel.AddComponent<MaterialController>(); } } } public static void ConvertShaders(this AssetBundle assetBundle, Dictionary<string, string> replacementDictionary, string shaderPrefix) { IEnumerable<Material> enumerable = assetBundle.LoadAllAssets<Material>().Where(materialFilter); foreach (Material item in enumerable) { Shader val = Resources.Load<Shader>(replacementDictionary[((Object)item.shader).name.ToLower()]); if (Object.op_Implicit((Object)(object)val)) { item.shader = val; } } bool materialFilter(Material material) { return ((Object)material.shader).name.ToLower().StartsWith(shaderPrefix.ToLower()); } } public static void ConvertShaders(this AssetBundle assetBundle) { assetBundle.ConvertShaders(DefaultData.ShaderReplacements, "Fake RoR"); } } public abstract class GenericContentPackProvider : IContentPackProvider { protected ContentPack contentPack = new ContentPack(); public string identifier => ContentIdentifier(); public void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)delegate(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); }; } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; LoadStaticContentAsyncActions(args); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } protected abstract string ContentIdentifier(); protected abstract void LoadStaticContentAsyncActions(LoadStaticContentAsyncArgs args); } public static class Instances { public static PlayerCharacterMasterController hostPcmc { get { PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[0]; if (!Object.op_Implicit((Object)(object)val)) { HelperPlugin.Log.Debug("hostPcmc is null"); } return val; } } public static CharacterMaster hostMaster { get { CharacterMaster val = null; if (Object.op_Implicit((Object)(object)hostPcmc)) { val = hostPcmc.master; } if (!Object.op_Implicit((Object)(object)val)) { HelperPlugin.Log.Debug("hostMaster is null"); } return val; } } public static GameObject hostMasterObject { get { GameObject result = null; if (Object.op_Implicit((Object)(object)hostMaster)) { result = ((Component)hostMaster).gameObject; } return result; } } public static CharacterBody hostBody { get { CharacterBody val = null; if (Object.op_Implicit((Object)(object)hostMaster)) { val = hostMaster.GetBody(); } if (!Object.op_Implicit((Object)(object)val)) { HelperPlugin.Log.Debug("hostBody is null"); } return val; } } public static GameObject hostBodyObject { get { GameObject result = null; if (Object.op_Implicit((Object)(object)hostBody)) { result = ((Component)hostBody).gameObject; } return result; } } } public class MaterialController : MonoBehaviour { private void Start() { HelperPlugin.Log.Warning("Attached Material Controller to " + ((Object)((Component)this).gameObject).name + ". Ignore this if you are a mod developer debugging. Report otherwise."); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material val2 = null; MeshRenderer val3 = (MeshRenderer)(object)((val is MeshRenderer) ? val : null); if (val3 != null) { val2 = ((Renderer)val3).sharedMaterial; } else { SkinnedMeshRenderer val4 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); if (val4 != null) { val2 = ((Renderer)val4).sharedMaterials[0]; } } if (Object.op_Implicit((Object)(object)val2)) { GameObject gameObject = ((Component)val).gameObject; HGBaseController hGBaseController = null; switch (((Object)val2.shader).name) { case "Hopoo Games/Deferred/Standard": hGBaseController = gameObject.AddComponent<HGStandardController>(); break; case "Hopoo Games/FX/Cloud Remap": hGBaseController = gameObject.AddComponent<HGCloudRemapController>(); break; case "Hopoo Games/FX/Cloud Intersection Remap": hGBaseController = gameObject.AddComponent<HGIntersectionController>(); break; } if (Object.op_Implicit((Object)(object)hGBaseController)) { RecursivePathGeneration(gameObject); hGBaseController.Material = val2; hGBaseController.Renderer = val; HelperPlugin.Log.Warning(((object)hGBaseController).GetType().Name + " assigned to " + ((Object)gameObject).name + "."); } else { HelperPlugin.Log.Error("Shader Controller not implemented for " + ((Object)val2.shader).name + "."); } } } Object.Destroy((Object)(object)this); } private void RecursivePathGeneration(GameObject rendererGameObject, Transform parent = null) { if (Object.op_Implicit((Object)(object)parent)) { ((Object)rendererGameObject).name = ((Object)((Component)parent).gameObject).name + "." + ((Object)rendererGameObject).name; } parent = (Object.op_Implicit((Object)(object)parent) ? parent.parent : rendererGameObject.transform.parent); if (Object.op_Implicit((Object)(object)parent)) { RecursivePathGeneration(rendererGameObject, parent); } } } public class HGBaseController : MonoBehaviour { public Material Material; public Renderer Renderer; public string MaterialName; public void SetShaderKeywordBasedOnBool(bool enabled, string keyword) { if (!Object.op_Implicit((Object)(object)Material)) { HelperPlugin.Log.Error("Material field was null, cannot run shader keyword method."); } else if (enabled) { if (!Material.IsKeywordEnabled(keyword)) { Material.EnableKeyword(keyword); } } else if (Material.IsKeywordEnabled(keyword)) { Material.DisableKeyword(keyword); } } public void PutMaterialIntoMeshRenderer() { if (Object.op_Implicit((Object)(object)Material) && Object.op_Implicit((Object)(object)Renderer)) { Renderer renderer = Renderer; SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (val != null) { ((Renderer)val).sharedMaterials = (Material[])(object)new Material[1] { Material }; } Renderer renderer2 = Renderer; MeshRenderer val2 = (MeshRenderer)(object)((renderer2 is MeshRenderer) ? renderer2 : null); if (val2 != null) { ((Renderer)val2).material = Material; } } } } public class HGStandardController : HGBaseController { public enum _RampInfoEnum { TwoTone = 0, SmoothedTwoTone = 1, Unlitish = 3, Subsurface = 4, Grass = 5 } public enum _DecalLayerEnum { Default, Environment, Character, Misc } public enum _CullEnum { Off, Front, Back } public enum _PrintDirectionEnum { BottomUp = 0, TopDown = 1, BackToFront = 3 } public bool _EnableCutout; public Color _Color; public Texture _MainTex; public Vector2 _MainTexScale; public Vector2 _MainTexOffset; [Range(0f, 5f)] public float _NormalStrength; public Texture _NormalTex; public Vector2 _NormalTexScale; public Vector2 _NormalTexOffset; public Color _EmColor; public Texture _EmTex; [Range(0f, 10f)] public float _EmPower; [Range(0f, 1f)] public float _Smoothness; public bool _IgnoreDiffuseAlphaForSpeculars; public _RampInfoEnum _RampChoice; public _DecalLayerEnum _DecalLayer; [Range(0f, 1f)] public float _SpecularStrength; [Range(0.1f, 20f)] public float _SpecularExponent; public _CullEnum _Cull_Mode; public bool _EnableDither; [Range(0f, 1f)] public float _FadeBias; public bool _EnableFresnelEmission; public Texture _FresnelRamp; [Range(0.1f, 20f)] public float _FresnelPower; public Texture _FresnelMask; [Range(0f, 20f)] public float _FresnelBoost; public bool _EnablePrinting; [Range(-25f, 25f)] public float _SliceHeight; [Range(0f, 10f)] public float _PrintBandHeight; [Range(0f, 1f)] public float _PrintAlphaDepth; public Texture _PrintAlphaTexture; public Vector2 _PrintAlphaTextureScale; public Vector2 _PrintAlphaTextureOffset; [Range(0f, 10f)] public float _PrintColorBoost; [Range(0f, 4f)] public float _PrintAlphaBias; [Range(0f, 1f)] public float _PrintEmissionToAlbedoLerp; public _PrintDirectionEnum _PrintDirection; public Texture _PrintRamp; [Range(-10f, 10f)] public float _EliteBrightnessMin; [Range(-10f, 10f)] public float _EliteBrightnessMax; public bool _EnableSplatmap; public bool _UseVertexColorsInstead; [Range(0f, 1f)] public float _BlendDepth; public Texture _SplatmapTex; public Vector2 _SplatmapTexScale; public Vector2 _SplatmapTexOffset; [Range(0f, 20f)] public float _SplatmapTileScale; public Texture _GreenChannelTex; public Texture _GreenChannelNormalTex; [Range(0f, 1f)] public float _GreenChannelSmoothness; [Range(-2f, 5f)] public float _GreenChannelBias; public Texture _BlueChannelTex; public Texture _BlueChannelNormalTex; [Range(0f, 1f)] public float _BlueChannelSmoothness; [Range(-2f, 5f)] public float _BlueChannelBias; public bool _EnableFlowmap; public Texture _FlowTexture; public Texture _FlowHeightmap; public Vector2 _FlowHeightmapScale; public Vector2 _FlowHeightmapOffset; public Texture _FlowHeightRamp; public Vector2 _FlowHeightRampScale; public Vector2 _FlowHeightRampOffset; [Range(-1f, 1f)] public float _FlowHeightBias; [Range(0.1f, 20f)] public float _FlowHeightPower; [Range(0.1f, 20f)] public float _FlowEmissionStrength; [Range(0f, 15f)] public float _FlowSpeed; [Range(0f, 5f)] public float _MaskFlowStrength; [Range(0f, 5f)] public float _NormalFlowStrength; [Range(0f, 10f)] public float _FlowTextureScaleFactor; public bool _EnableLimbRemoval; public void Start() { GrabMaterialValues(); } public void GrabMaterialValues() { //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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Material)) { _EnableCutout = Material.IsKeywordEnabled("CUTOUT"); _Color = Material.GetColor("_Color"); _MainTex = Material.GetTexture("_MainTex"); _MainTexScale = Material.GetTextureScale("_MainTex"); _MainTexOffset = Material.GetTextureOffset("_MainTex"); _NormalStrength = Material.GetFloat("_NormalStrength"); _NormalTex = Material.GetTexture("_NormalTex"); _NormalTexScale = Material.GetTextureScale("_NormalTex"); _NormalTexOffset = Material.GetTextureOffset("_NormalTex"); _EmColor = Material.GetColor("_EmColor"); _EmTex = Material.GetTexture("_EmTex"); _EmPower = Material.GetFloat("_EmPower"); _Smoothness = Material.GetFloat("_Smoothness"); _IgnoreDiffuseAlphaForSpeculars = Material.IsKeywordEnabled("FORCE_SPEC"); _RampChoice = (_RampInfoEnum)Material.GetFloat("_RampInfo"); _DecalLayer = (_DecalLayerEnum)Material.GetFloat("_DecalLayer"); _SpecularStrength = Material.GetFloat("_SpecularStrength"); _SpecularExponent = Material.GetFloat("_SpecularExponent"); _Cull_Mode = (_CullEnum)Material.GetFloat("_Cull"); _EnableDither = Material.IsKeywordEnabled("DITHER"); _FadeBias = Material.GetFloat("_FadeBias"); _EnableFresnelEmission = Material.IsKeywordEnabled("FRESNEL_EMISSION"); _FresnelRamp = Material.GetTexture("_FresnelRamp"); _FresnelPower = Material.GetFloat("_FresnelPower"); _FresnelMask = Material.GetTexture("_FresnelMask"); _FresnelBoost = Material.GetFloat("_FresnelBoost"); _EnablePrinting = Material.IsKeywordEnabled("PRINT_CUTOFF"); _SliceHeight = Material.GetFloat("_SliceHeight"); _PrintBandHeight = Material.GetFloat("_SliceBandHeight"); _PrintAlphaDepth = Material.GetFloat("_SliceAlphaDepth"); _PrintAlphaTexture = Material.GetTexture("_SliceAlphaTex"); _PrintAlphaTextureScale = Material.GetTextureScale("_SliceAlphaTex"); _PrintAlphaTextureOffset = Material.GetTextureOffset("_SliceAlphaTex"); _PrintColorBoost = Material.GetFloat("_PrintBoost"); _PrintAlphaBias = Material.GetFloat("_PrintBias"); _PrintEmissionToAlbedoLerp = Material.GetFloat("_PrintEmissionToAlbedoLerp"); _PrintDirection = (_PrintDirectionEnum)Material.GetFloat("_PrintDirection"); _PrintRamp = Material.GetTexture("_PrintRamp"); _EliteBrightnessMin = Material.GetFloat("_EliteBrightnessMin"); _EliteBrightnessMax = Material.GetFloat("_EliteBrightnessMax"); _EnableSplatmap = Material.IsKeywordEnabled("SPLATMAP"); _UseVertexColorsInstead = Material.IsKeywordEnabled("USE_VERTEX_COLORS"); _BlendDepth = Material.GetFloat("_Depth"); _SplatmapTex = Material.GetTexture("_SplatmapTex"); _SplatmapTexScale = Material.GetTextureScale("_SplatmapTex"); _SplatmapTexOffset = Material.GetTextureOffset("_SplatmapTex"); _SplatmapTileScale = Material.GetFloat("_SplatmapTileScale"); _GreenChannelTex = Material.GetTexture("_GreenChannelTex"); _GreenChannelNormalTex = Material.GetTexture("_GreenChannelNormalTex"); _GreenChannelSmoothness = Material.GetFloat("_GreenChannelSmoothness"); _GreenChannelBias = Material.GetFloat("_GreenChannelBias"); _BlueChannelTex = Material.GetTexture("_BlueChannelTex"); _BlueChannelNormalTex = Material.GetTexture("_BlueChannelNormalTex"); _BlueChannelSmoothness = Material.GetFloat("_BlueChannelSmoothness"); _BlueChannelBias = Material.GetFloat("_BlueChannelBias"); _EnableFlowmap = Material.IsKeywordEnabled("FLOWMAP"); _FlowTexture = Material.GetTexture("_FlowTex"); _FlowHeightmap = Material.GetTexture("_FlowHeightmap"); _FlowHeightmapScale = Material.GetTextureScale("_FlowHeightmap"); _FlowHeightmapOffset = Material.GetTextureOffset("_FlowHeightmap"); _FlowHeightRamp = Material.GetTexture("_FlowHeightRamp"); _FlowHeightRampScale = Material.GetTextureScale("_FlowHeightRamp"); _FlowHeightRampOffset = Material.GetTextureOffset("_FlowHeightRamp"); _FlowHeightBias = Material.GetFloat("_FlowHeightBias"); _FlowHeightPower = Material.GetFloat("_FlowHeightPower"); _FlowEmissionStrength = Material.GetFloat("_FlowEmissionStrength"); _FlowSpeed = Material.GetFloat("_FlowSpeed"); _MaskFlowStrength = Material.GetFloat("_FlowMaskStrength"); _NormalFlowStrength = Material.GetFloat("_FlowNormalStrength"); _FlowTextureScaleFactor = Material.GetFloat("_FlowTextureScaleFactor"); _EnableLimbRemoval = Material.IsKeywordEnabled("LIMBREMOVAL"); MaterialName = ((Object)Material).name; } } public void Update() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Material)) { if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer)) { GrabMaterialValues(); PutMaterialIntoMeshRenderer(); } SetShaderKeywordBasedOnBool(_EnableCutout, "CUTOUT"); Material.SetColor("_Color", _Color); if (Object.op_Implicit((Object)(object)_MainTex)) { Material.SetTexture("_MainTex", _MainTex); Material.SetTextureScale("_MainTex", _MainTexScale); Material.SetTextureOffset("_MainTex", _MainTexOffset); } else { Material.SetTexture("_MainTex", (Texture)null); } Material.SetFloat("_NormalStrength", _NormalStrength); if (Object.op_Implicit((Object)(object)_NormalTex)) { Material.SetTexture("_NormalTex", _NormalTex); Material.SetTextureScale("_NormalTex", _NormalTexScale); Material.SetTextureOffset("_NormalTex", _NormalTexOffset); } else { Material.SetTexture("_NormalTex", (Texture)null); } Material.SetColor("_EmColor", _EmColor); if (Object.op_Implicit((Object)(object)_EmTex)) { Material.SetTexture("_EmTex", _EmTex); } else { Material.SetTexture("_EmTex", (Texture)null); } Material.SetFloat("_EmPower", _EmPower); Material.SetFloat("_Smoothness", _Smoothness); SetShaderKeywordBasedOnBool(_IgnoreDiffuseAlphaForSpeculars, "FORCE_SPEC"); Material.SetFloat("_RampInfo", Convert.ToSingle(_RampChoice)); Material.SetFloat("_DecalLayer", Convert.ToSingle(_DecalLayer)); Material.SetFloat("_SpecularStrength", _SpecularStrength); Material.SetFloat("_SpecularExponent", _SpecularExponent); Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode)); SetShaderKeywordBasedOnBool(_EnableDither, "DITHER"); Material.SetFloat("_FadeBias", _FadeBias); SetShaderKeywordBasedOnBool(_EnableFresnelEmission, "FRESNEL_EMISSION"); if (Object.op_Implicit((Object)(object)_FresnelRamp)) { Material.SetTexture("_FresnelRamp", _FresnelRamp); } else { Material.SetTexture("_FresnelRamp", (Texture)null); } Material.SetFloat("_FresnelPower", _FresnelPower); if (Object.op_Implicit((Object)(object)_FresnelMask)) { Material.SetTexture("_FresnelMask", _FresnelMask); } else { Material.SetTexture("_FresnelMask", (Texture)null); } Material.SetFloat("_FresnelBoost", _FresnelBoost); SetShaderKeywordBasedOnBool(_EnablePrinting, "PRINT_CUTOFF"); Material.SetFloat("_SliceHeight", _SliceHeight); Material.SetFloat("_SliceBandHeight", _PrintBandHeight); Material.SetFloat("_SliceAlphaDepth", _PrintAlphaDepth); if (Object.op_Implicit((Object)(object)_PrintAlphaTexture)) { Material.SetTexture("_SliceAlphaTex", _PrintAlphaTexture); Material.SetTextureScale("_SliceAlphaTex", _PrintAlphaTextureScale); Material.SetTextureOffset("_SliceAlphaTex", _PrintAlphaTextureOffset); } else { Material.SetTexture("_SliceAlphaTex", (Texture)null); } Material.SetFloat("_PrintBoost", _PrintColorBoost); Material.SetFloat("_PrintBias", _PrintAlphaBias); Material.SetFloat("_PrintEmissionToAlbedoLerp", _PrintEmissionToAlbedoLerp); Material.SetFloat("_PrintDirection", Convert.ToSingle(_PrintDirection)); if (Object.op_Implicit((Object)(object)_PrintRamp)) { Material.SetTexture("_PrintRamp", _PrintRamp); } else { Material.SetTexture("_PrintRamp", (Texture)null); } Material.SetFloat("_EliteBrightnessMin", _EliteBrightnessMin); Material.SetFloat("_EliteBrightnessMax", _EliteBrightnessMax); SetShaderKeywordBasedOnBool(_EnableSplatmap, "SPLATMAP"); SetShaderKeywordBasedOnBool(_UseVertexColorsInstead, "USE_VERTEX_COLORS"); Material.SetFloat("_Depth", _BlendDepth); if (Object.op_Implicit((Object)(object)_SplatmapTex)) { Material.SetTexture("_SplatmapTex", _SplatmapTex); Material.SetTextureScale("_SplatmapTex", _SplatmapTexScale); Material.SetTextureOffset("_SplatmapTex", _SplatmapTexOffset); } else { Material.SetTexture("_SplatmapTex", (Texture)null); } Material.SetFloat("_SplatmapTileScale", _SplatmapTileScale); if (Object.op_Implicit((Object)(object)_GreenChannelTex)) { Material.SetTexture("_GreenChannelTex", _GreenChannelTex); } else { Material.SetTexture("_GreenChannelTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_GreenChannelNormalTex)) { Material.SetTexture("_GreenChannelNormalTex", _GreenChannelNormalTex); } else { Material.SetTexture("_GreenChannelNormalTex", (Texture)null); } Material.SetFloat("_GreenChannelSmoothness", _GreenChannelSmoothness); Material.SetFloat("_GreenChannelBias", _GreenChannelBias); if (Object.op_Implicit((Object)(object)_BlueChannelTex)) { Material.SetTexture("_BlueChannelTex", _BlueChannelTex); } else { Material.SetTexture("_BlueChannelTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_BlueChannelNormalTex)) { Material.SetTexture("_BlueChannelNormalTex", _BlueChannelNormalTex); } else { Material.SetTexture("_BlueChannelNormalTex", (Texture)null); } Material.SetFloat("_BlueChannelSmoothness", _BlueChannelSmoothness); Material.SetFloat("_BlueChannelBias", _BlueChannelBias); SetShaderKeywordBasedOnBool(_EnableFlowmap, "FLOWMAP"); if (Object.op_Implicit((Object)(object)_FlowTexture)) { Material.SetTexture("_FlowTex", _FlowTexture); } else { Material.SetTexture("_FlowTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_FlowHeightmap)) { Material.SetTexture("_FlowHeightmap", _FlowHeightmap); Material.SetTextureScale("_FlowHeightmap", _FlowHeightmapScale); Material.SetTextureOffset("_FlowHeightmap", _FlowHeightmapOffset); } else { Material.SetTexture("_FlowHeightmap", (Texture)null); } if (Object.op_Implicit((Object)(object)_FlowHeightRamp)) { Material.SetTexture("_FlowHeightRamp", _FlowHeightRamp); Material.SetTextureScale("_FlowHeightRamp", _FlowHeightRampScale); Material.SetTextureOffset("_FlowHeightRamp", _FlowHeightRampOffset); } else { Material.SetTexture("_FlowHeightRamp", (Texture)null); } Material.SetFloat("_FlowHeightBias", _FlowHeightBias); Material.SetFloat("_FlowHeightPower", _FlowHeightPower); Material.SetFloat("_FlowEmissionStrength", _FlowEmissionStrength); Material.SetFloat("_FlowSpeed", _FlowSpeed); Material.SetFloat("_FlowMaskStrength", _MaskFlowStrength); Material.SetFloat("_FlowNormalStrength", _NormalFlowStrength); Material.SetFloat("_FlowTextureScaleFactor", _FlowTextureScaleFactor); SetShaderKeywordBasedOnBool(_EnableLimbRemoval, "LIMBREMOVAL"); } } } public class HGCloudRemapController : HGBaseController { public enum _CullEnum { Off, Front, Back } public enum _ZTestEnum { Disabled, Never, Less, Equal, LessEqual, Greater, NotEqual, GreaterEqual, Always } public Color _Tint; public bool _DisableRemapping; public Texture _MainTex; public Vector2 _MainTexScale; public Vector2 _MainTexOffset; public Texture _RemapTex; public Vector2 _RemapTexScale; public Vector2 _RemapTexOffset; [Range(0f, 2f)] public float _SoftFactor; [Range(1f, 20f)] public float _BrightnessBoost; [Range(0f, 20f)] public float _AlphaBoost; [Range(0f, 1f)] public float _AlphaBias; public bool _UseUV1; public bool _FadeWhenNearCamera; [Range(0f, 1f)] public float _FadeCloseDistance; public _CullEnum _Cull_Mode; public _ZTestEnum _ZTest_Mode; [Range(-10f, 10f)] public float _DepthOffset; public bool _CloudRemapping; public bool _DistortionClouds; [Range(-2f, 2f)] public float _DistortionStrength; public Texture _Cloud1Tex; public Vector2 _Cloud1TexScale; public Vector2 _Cloud1TexOffset; public Texture _Cloud2Tex; public Vector2 _Cloud2TexScale; public Vector2 _Cloud2TexOffset; public Vector4 _CutoffScroll; public bool _VertexColors; public bool _LuminanceForVertexAlpha; public bool _LuminanceForTextureAlpha; public bool _VertexOffset; public bool _FresnelFade; public bool _SkyboxOnly; [Range(-20f, 20f)] public float _FresnelPower; [Range(0f, 3f)] public float _VertexOffsetAmount; public void Start() { GrabMaterialValues(); } public void GrabMaterialValues() { //IL_001c: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Material)) { _Tint = Material.GetColor("_TintColor"); _DisableRemapping = Material.IsKeywordEnabled("DISABLEREMAP"); _MainTex = Material.GetTexture("_MainTex"); _MainTexScale = Material.GetTextureScale("_MainTex"); _MainTexOffset = Material.GetTextureOffset("_MainTex"); _RemapTex = Material.GetTexture("_RemapTex"); _RemapTexScale = Material.GetTextureScale("_RemapTex"); _RemapTexOffset = Material.GetTextureOffset("_RemapTex"); _SoftFactor = Material.GetFloat("_InvFade"); _BrightnessBoost = Material.GetFloat("_Boost"); _AlphaBoost = Material.GetFloat("_AlphaBoost"); _AlphaBias = Material.GetFloat("_AlphaBias"); _UseUV1 = Material.IsKeywordEnabled("USE_UV1"); _FadeWhenNearCamera = Material.IsKeywordEnabled("FADECLOSE"); _FadeCloseDistance = Material.GetFloat("_FadeCloseDistance"); _Cull_Mode = (_CullEnum)Material.GetFloat("_Cull"); _ZTest_Mode = (_ZTestEnum)Material.GetFloat("_ZTest"); _DepthOffset = Material.GetFloat("_DepthOffset"); _CloudRemapping = Material.IsKeywordEnabled("USE_CLOUDS"); _DistortionClouds = Material.IsKeywordEnabled("CLOUDOFFSET"); _DistortionStrength = Material.GetFloat("_DistortionStrength"); _Cloud1Tex = Material.GetTexture("_Cloud1Tex"); _Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex"); _Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex"); _Cloud2Tex = Material.GetTexture("_Cloud2Tex"); _Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex"); _Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex"); _CutoffScroll = Material.GetVector("_CutoffScroll"); _VertexColors = Material.IsKeywordEnabled("VERTEXCOLOR"); _LuminanceForVertexAlpha = Material.IsKeywordEnabled("VERTEXALPHA"); _LuminanceForTextureAlpha = Material.IsKeywordEnabled("CALCTEXTUREALPHA"); _VertexOffset = Material.IsKeywordEnabled("VERTEXOFFSET"); _FresnelFade = Material.IsKeywordEnabled("FRESNEL"); _SkyboxOnly = Material.IsKeywordEnabled("SKYBOX_ONLY"); _FresnelPower = Material.GetFloat("_FresnelPower"); _VertexOffsetAmount = Material.GetFloat("_OffsetAmount"); MaterialName = ((Object)Material).name; } } public void Update() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Material)) { if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer)) { GrabMaterialValues(); PutMaterialIntoMeshRenderer(); } Material.SetColor("_TintColor", _Tint); SetShaderKeywordBasedOnBool(_DisableRemapping, "DISABLEREMAP"); if (Object.op_Implicit((Object)(object)_MainTex)) { Material.SetTexture("_MainTex", _MainTex); Material.SetTextureScale("_MainTex", _MainTexScale); Material.SetTextureOffset("_MainTex", _MainTexOffset); } else { Material.SetTexture("_MainTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_RemapTex)) { Material.SetTexture("_RemapTex", _RemapTex); Material.SetTextureScale("_RemapTex", _RemapTexScale); Material.SetTextureOffset("_RemapTex", _RemapTexOffset); } else { Material.SetTexture("_RemapTex", (Texture)null); } Material.SetFloat("_InvFade", _SoftFactor); Material.SetFloat("_Boost", _BrightnessBoost); Material.SetFloat("_AlphaBoost", _AlphaBoost); Material.SetFloat("_AlphaBias", _AlphaBias); SetShaderKeywordBasedOnBool(_UseUV1, "USE_UV1"); SetShaderKeywordBasedOnBool(_FadeWhenNearCamera, "FADECLOSE"); Material.SetFloat("_FadeCloseDistance", _FadeCloseDistance); Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode)); Material.SetFloat("_ZTest", Convert.ToSingle(_ZTest_Mode)); Material.SetFloat("_DepthOffset", _DepthOffset); SetShaderKeywordBasedOnBool(_CloudRemapping, "USE_CLOUDS"); SetShaderKeywordBasedOnBool(_DistortionClouds, "CLOUDOFFSET"); Material.SetFloat("_DistortionStrength", _DistortionStrength); if (Object.op_Implicit((Object)(object)_Cloud1Tex)) { Material.SetTexture("_Cloud1Tex", _Cloud1Tex); Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale); Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset); } else { Material.SetTexture("_Cloud1Tex", (Texture)null); } if (Object.op_Implicit((Object)(object)_Cloud2Tex)) { Material.SetTexture("_Cloud2Tex", _Cloud2Tex); Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale); Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset); } else { Material.SetTexture("_Cloud2Tex", (Texture)null); } Material.SetVector("_CutoffScroll", _CutoffScroll); SetShaderKeywordBasedOnBool(_VertexColors, "VERTEXCOLOR"); SetShaderKeywordBasedOnBool(_LuminanceForVertexAlpha, "VERTEXALPHA"); SetShaderKeywordBasedOnBool(_LuminanceForTextureAlpha, "CALCTEXTUREALPHA"); SetShaderKeywordBasedOnBool(_VertexOffset, "VERTEXOFFSET"); SetShaderKeywordBasedOnBool(_FresnelFade, "FRESNEL"); SetShaderKeywordBasedOnBool(_SkyboxOnly, "SKYBOX_ONLY"); Material.SetFloat("_FresnelPower", _FresnelPower); Material.SetFloat("_OffsetAmount", _VertexOffsetAmount); } } } public class HGIntersectionController : HGBaseController { public enum _SrcBlendFloatEnum { Zero, One, DstColor, SrcColor, OneMinusDstColor, SrcAlpha, OneMinusSrcColor, DstAlpha, OneMinusDstAlpha, SrcAlphaSaturate, OneMinusSrcAlpha } public enum _DstBlendFloatEnum { Zero, One, DstColor, SrcColor, OneMinusDstColor, SrcAlpha, OneMinusSrcColor, DstAlpha, OneMinusDstAlpha, SrcAlphaSaturate, OneMinusSrcAlpha } public enum _CullEnum { Off, Front, Back } public _SrcBlendFloatEnum _Source_Blend_Mode; public _DstBlendFloatEnum _Destination_Blend_Mode; public Color _Tint; public Texture _MainTex; public Vector2 _MainTexScale; public Vector2 _MainTexOffset; public Texture _Cloud1Tex; public Vector2 _Cloud1TexScale; public Vector2 _Cloud1TexOffset; public Texture _Cloud2Tex; public Vector2 _Cloud2TexScale; public Vector2 _Cloud2TexOffset; public Texture _RemapTex; public Vector2 _RemapTexScale; public Vector2 _RemapTexOffset; public Vector4 _CutoffScroll; [Range(0f, 30f)] public float _SoftFactor; [Range(0.1f, 20f)] public float _SoftPower; [Range(0f, 5f)] public float _BrightnessBoost; [Range(0.1f, 20f)] public float _RimPower; [Range(0f, 5f)] public float _RimStrength; [Range(0f, 20f)] public float _AlphaBoost; [Range(0f, 20f)] public float _IntersectionStrength; public _CullEnum _Cull_Mode; public bool _FadeFromVertexColorsOn; public bool _EnableTriplanarProjectionsForClouds; public void Start() { GrabMaterialValues(); } public void GrabMaterialValues() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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) if (Object.op_Implicit((Object)(object)Material)) { _Source_Blend_Mode = (_SrcBlendFloatEnum)Material.GetFloat("_SrcBlendFloat"); _Destination_Blend_Mode = (_DstBlendFloatEnum)Material.GetFloat("_DstBlendFloat"); _Tint = Material.GetColor("_TintColor"); _MainTex = Material.GetTexture("_MainTex"); _MainTexScale = Material.GetTextureScale("_MainTex"); _MainTexOffset = Material.GetTextureOffset("_MainTex"); _Cloud1Tex = Material.GetTexture("_Cloud1Tex"); _Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex"); _Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex"); _Cloud2Tex = Material.GetTexture("_Cloud2Tex"); _Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex"); _Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex"); _RemapTex = Material.GetTexture("_RemapTex"); _RemapTexScale = Material.GetTextureScale("_RemapTex"); _RemapTexOffset = Material.GetTextureOffset("_RemapTex"); _CutoffScroll = Material.GetVector("_CutoffScroll"); _SoftFactor = Material.GetFloat("_InvFade"); _SoftPower = Material.GetFloat("_SoftPower"); _BrightnessBoost = Material.GetFloat("_Boost"); _RimPower = Material.GetFloat("_RimPower"); _RimStrength = Material.GetFloat("_RimStrength"); _AlphaBoost = Material.GetFloat("_AlphaBoost"); _IntersectionStrength = Material.GetFloat("_IntersectionStrength"); _Cull_Mode = (_CullEnum)Material.GetFloat("_Cull"); _FadeFromVertexColorsOn = Material.IsKeywordEnabled("FADE_FROM_VERTEX_COLORS"); _EnableTriplanarProjectionsForClouds = Material.IsKeywordEnabled("TRIPLANAR"); MaterialName = ((Object)Material).name; } } public void Update() { //IL_008d: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Material)) { if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer)) { GrabMaterialValues(); PutMaterialIntoMeshRenderer(); } Material.SetFloat("_SrcBlendFloat", Convert.ToSingle(_Source_Blend_Mode)); Material.SetFloat("_DstBlendFloat", Convert.ToSingle(_Destination_Blend_Mode)); Material.SetColor("_TintColor", _Tint); if (Object.op_Implicit((Object)(object)_MainTex)) { Material.SetTexture("_MainTex", _MainTex); Material.SetTextureScale("_MainTex", _MainTexScale); Material.SetTextureOffset("_MainTex", _MainTexOffset); } else { Material.SetTexture("_MainTex", (Texture)null); } if (Object.op_Implicit((Object)(object)_Cloud1Tex)) { Material.SetTexture("_Cloud1Tex", _Cloud1Tex); Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale); Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset); } else { Material.SetTexture("_Cloud1Tex", (Texture)null); } if (Object.op_Implicit((Object)(object)_Cloud2Tex)) { Material.SetTexture("_Cloud2Tex", _Cloud2Tex); Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale); Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset); } else { Material.SetTexture("_Cloud2Tex", (Texture)null); } if (Object.op_Implicit((Object)(object)_RemapTex)) { Material.SetTexture("_RemapTex", _RemapTex); Material.SetTextureScale("_RemapTex", _RemapTexScale); Material.SetTextureOffset("_RemapTex", _RemapTexOffset); } else { Material.SetTexture("_RemapTex", (Texture)null); } Material.SetVector("_CutoffScroll", _CutoffScroll); Material.SetFloat("_InvFade", _SoftFactor); Material.SetFloat("_SoftPower", _SoftPower); Material.SetFloat("_Boost", _BrightnessBoost); Material.SetFloat("_RimPower", _RimPower); Material.SetFloat("_RimStrength", _RimStrength); Material.SetFloat("_AlphaBoost", _AlphaBoost); Material.SetFloat("_IntersectionStrength", _IntersectionStrength); Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode)); SetShaderKeywordBasedOnBool(_FadeFromVertexColorsOn, "FADE_FROM_VERTEX_COLORS"); SetShaderKeywordBasedOnBool(_EnableTriplanarProjectionsForClouds, "TRIPLANAR"); } } } public static class MinionExtensions { internal class SyncOwner : INetMessage, ISerializableObject { private NetworkInstanceId minionNetId; private NetworkInstanceId ownerNetId; private bool useQueue; public SyncOwner() { } public SyncOwner(NetworkInstanceId minionNetId, NetworkInstanceId ownerNetId, bool useQueue) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) this.minionNetId = minionNetId; this.ownerNetId = ownerNetId; this.useQueue = useQueue; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) writer.Write(minionNetId); writer.Write(ownerNetId); writer.Write(useQueue); } public void Deserialize(NetworkReader reader) { //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_000e: 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) minionNetId = reader.ReadNetworkId(); ownerNetId = reader.ReadNetworkId(); useQueue = reader.ReadBoolean(); } public void OnReceived() { //IL_0039: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { return; } if (useQueue) { OwnershipSyncer orAddComponent = ((Component)Run.instance).gameObject.GetOrAddComponent<OwnershipSyncer>(); orAddComponent.Add(new OwnershipSyncer.OwnerMinionPair(minionNetId, ownerNetId)); return; } GameObject val = Util.FindNetworkObject(minionNetId); GameObject val2 = Util.FindNetworkObject(ownerNetId); if (!Object.op_Implicit((Object)(object)val)) { HelperPlugin.Log.Warning("SyncOwner: minionObject or ownerObject is null."); } if (!Object.op_Implicit((Object)(object)val2)) { HelperPlugin.Log.Warning("SyncOwner: ownerObject is null."); } if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) { ProcessAssignment(val, val2, "SyncOwner"); } } } internal class OwnershipSyncer : QueueProcessor<OwnershipSyncer.OwnerMinionPair> { internal struct OwnerMinionPair { public NetworkInstanceId minionNetId; public NetworkInstanceId ownerNetId; public OwnerMinionPair(NetworkInstanceId minionNetId, NetworkInstanceId ownerNetId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) this.minionNetId = minionNetId; this.ownerNetId = ownerNetId; } } protected override int itemsPerFrame { get; set; } = 1; protected override float processInterval { get; set; } protected override bool Process(OwnerMinionPair pair) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(pair.minionNetId); GameObject val2 = Util.FindNetworkObject(pair.ownerNetId); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } ProcessAssignment(val, val2, "OwnershipSyncer"); return true; } protected override void FixedUpdate() { base.FixedUpdate(); if (processQueue.Count <= 0) { Object.Destroy((Object)(object)this); } } } public static void LoopMinions(this CharacterMaster ownerOrMinion, Action<CharacterMaster> logic) { MinionOwnership minionOwnership = ownerOrMinion.minionOwnership; if (!Object.op_Implicit((Object)(object)minionOwnership)) { return; } MinionOwnership[] array = Object.FindObjectsOfType<MinionOwnership>(); MinionOwnership[] array2 = array; foreach (MinionOwnership val in array2) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.ownerMaster)) { bool flag = !Object.op_Implicit((Object)(object)minionOwnership.ownerMaster) && (Object)(object)val.ownerMaster == (Object)(object)ownerOrMinion; bool flag2 = Object.op_Implicit((Object)(object)minionOwnership.ownerMaster) && (Object)(object)val.ownerMaster == (Object)(object)minionOwnership.ownerMaster; if (flag || flag2) { CharacterMaster component = ((Component)val).GetComponent<CharacterMaster>(); logic(component); } } } } public static List<T> GetAllMinionComponents<T>(this CharacterMaster ownerOrMinion) where T : Component { List<T> list = new List<T>(); ownerOrMinion.LoopMinions(delegate(CharacterMaster minion) { T component = ((Component)minion).gameObject.GetComponent<T>(); if (Object.op_Implicit((Object)(object)component)) { list.Add(component); } }); return list; } public static void AssignOwner(this CharacterMaster minion, CharacterMaster newOwner, bool transmit = false, bool useQueue = false) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { minion.minionOwnership.SetOwner(newOwner); if (transmit) { NetworkIdentity component = ((Component)minion).gameObject.GetComponent<NetworkIdentity>(); NetworkIdentity component2 = ((Component)newOwner).gameObject.GetComponent<NetworkIdentity>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2)) { HelperPlugin.Log.Warning("AssignOwner with transmit: NetworkIdentity is missing."); } else { NetMessageExtensions.Send((INetMessage)(object)new SyncOwner(component.netId, component2.netId, useQueue), (NetworkDestination)1); } } } else { NetworkIdentity component3 = ((Component)newOwner).gameObject.GetComponent<NetworkIdentity>(); if (!Object.op_Implicit((Object)(object)component3)) { HelperPlugin.Log.Warning("AssignOwner: Network Identity is missing!"); return; } minion.minionOwnership.ownerMasterId = component3.netId; MinionGroup.SetMinionOwner(minion.minionOwnership, component3.netId); } } internal static void ProcessAssignment(GameObject minionObject, GameObject ownerObject, string caller) { CharacterMaster component = minionObject.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component)) { HelperPlugin.Log.Warning(caller + ": minion is null."); } CharacterMaster component2 = ownerObject.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component2)) { HelperPlugin.Log.Warning(caller + ": owner is null."); } if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) { component.AssignOwner(component2); } } } public static class MultiplayerTest { private const string defaultEnableMessage = "Multiplayer Testing is enabled! If you see this message, report this as a bug to the mod developer!"; private const string defaultDisableMessage = "Multiplayer Testing disabled."; private static void OnClientConnect(orig_OnClientConnect orig, NetworkManagerSystem self, NetworkConnection conn) { } private static void Enable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown NetworkManagerSystem.OnClientConnect += new hook_OnClientConnect(OnClientConnect); } private static void Disable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown NetworkManagerSystem.OnClientConnect -= new hook_OnClientConnect(OnClientConnect); } public static void Enable(ManualLogSource logger, string message = "Multiplayer Testing is enabled! If you see this message, report this as a bug to the mod developer!") { if (logger != null) { logger.LogWarning((object)message); } Enable(); } public static void Enable(Log logger, string message = "Multiplayer Testing is enabled! If you see this message, report this as a bug to the mod developer!") { logger?.Warning(message); Enable(); } public static void Disable(ManualLogSource logger, string message = "Multiplayer Testing disabled.") { if (logger != null) { logger.LogWarning((object)message); } Disable(); } public static void Disable(Log logger, string message = "Multiplayer Testing disabled.") { logger?.Warning(message); Disable(); } } public class SoundPlayer { public struct EventPosterKey { public KeyCode key; public List<uint> eventIds; public EventPosterKey(KeyCode key, params uint[] eventIds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) this.key = key; this.eventIds = new List<uint>(); this.eventIds.AddRange(eventIds); } } private readonly Dictionary<KeyCode, List<uint>> keybinds = new Dictionary<KeyCode, List<uint>>(); public SoundPlayer(params EventPosterKey[] eventPosterKeys) { foreach (EventPosterKey eventPosterKey in eventPosterKeys) { RegisterKeybind(eventPosterKey); } } public void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<KeyCode, List<uint>> keybind in keybinds) { if (!Input.GetKeyDown(keybind.Key)) { continue; } foreach (uint item in keybind.Value) { AkSoundEngine.PostEvent(item, Instances.hostBodyObject); } } } public void RegisterKeybind(EventPosterKey eventPosterKey) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) keybinds[eventPosterKey.key] = eventPosterKey.eventIds; } public void RegisterKeybind(KeyCode key, params uint[] eventIds) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) keybinds[key] = eventIds.ToList(); } } } namespace Chen.Helpers.CollectionHelpers { public static class Extensions { public static bool ConditionalAdd<T>(this List<T> list, T value, Func<T, bool> condition) { if (list.Exists((T item) => condition(item))) { return false; } list.Add(value); return true; } public static bool ConditionalAddRange<T>(this List<T> list, T[] data, Func<T, T, bool> condition) { bool flag = true; foreach (T datum in data) { bool flag2 = list.ConditionalAdd(datum, (T item) => condition(item, datum)); if (flag && !flag2) { flag = false; } } return flag; } public static bool ConditionalRemove<T>(this List<T> list, T value) { if (!list.Contains(value)) { return false; } list.Remove(value); return true; } public static bool Contains<T>(this T[] array, T value) { for (int i = 0; i < array.Length; i++) { T val = array[i]; if (val.Equals(value)) { return true; } } return false; } public static List<T> ToList<T>(this T[] array) { List<T> list = new List<T>(); list.AddRange(array); return list; } } }
BepinEx/plugins/Chen-ChensMineLimitChanger/ChensMineLimitChanger.dll
Decompiled 11 months agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Chen.Helpers.LogHelpers; using HarmonyLib; using R2API; using R2API.Utils; using RoR2; using RoR2.Skills; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("ChensMineLimitChanger.Tests")] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ChensMineLimitChanger")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.0.4.0")] [assembly: AssemblyInformationalVersion("2.0.4")] [assembly: AssemblyProduct("ChensMineLimitChanger")] [assembly: AssemblyTitle("ChensMineLimitChanger")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.4.0")] [module: UnverifiableCode] namespace Chen.MineLimitChanger { [BepInPlugin("com.Chen.ChensMineLimitChanger", "ChensMineLimitChanger", "2.0.4")] [BepInDependency("com.bepis.r2api", "4.2.1")] [BepInDependency("com.Chen.ChensHelpers", "1.1.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ModPlugin : BaseUnityPlugin { public const string ModVer = "2.0.4"; public const string ModName = "ChensMineLimitChanger"; public const string ModGuid = "com.Chen.ChensMineLimitChanger"; private const string PressureMinesDescToken = "CHENSMINELIMITCHANGER_PRESSURE_MINES_DESC"; private const string SpiderMinesDescToken = "CHENSMINELIMITCHANGER_SPIDER_MINES_DESC"; private const string TurretDescToken = "TURRETCOUNTCHANGER_TURRET_COUNT_DESC"; private static Log Log; private static ConfigFile config; private static int pressureMinesCount = 10; private static int spiderMinesCount = 4; private static int turretCount = 2; public static int turretFieldCount = turretCount; public static int pressureMinesFieldCount = pressureMinesCount; public static int spiderMinesFieldCount = spiderMinesCount; public static bool lysateCellIncrement = false; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown Log = new Log(((BaseUnityPlugin)this).Logger); config = new ConfigFile(Path.Combine(Paths.ConfigPath, "com.Chen.ChensMineLimitChanger.cfg"), true); pressureMinesCount = config.Bind<int>("Main", "Pressure Mines Count", pressureMinesCount, "Changes the storage of the Pressure Mines.").Value; spiderMinesCount = config.Bind<int>("Main", "Spider Mines Count", spiderMinesCount, "Changes the storage of the Spider Mines.").Value; turretCount = config.Bind<int>("Main", "Turret Count", turretCount, "Changes the storage of the base Turret.").Value; pressureMinesFieldCount = config.Bind<int>("Main", "Pressure Mines Field Limit", pressureMinesFieldCount, "Changes the field limit of Pressure Mines.").Value; spiderMinesFieldCount = config.Bind<int>("Main", "Spider Mines Field Limit", spiderMinesFieldCount, "Changes the field limit of Spider Mines.").Value; turretFieldCount = config.Bind<int>("Main", "Turret Field Limit", turretFieldCount, "Changes the field limit of turrets.").Value; lysateCellIncrement = config.Bind<bool>("Main", "Lysate Cell Mechanics", lysateCellIncrement, "Set to true if you want the number of turrets on field to also increase by the number of Lysate Cells held. Set to false to only increase by turret field count by 1 if any Lysate Cells are held.").Value; Harmony val = new Harmony("com.pudy248.TurretCountChanger"); Log.Message((object)"Harmony Patch com.pudy248.TurretCountChanger initialized."); val.PatchAll(); Log.Message((object)$"Changed, by logic, Pressure Mines Field Limit to {pressureMinesFieldCount}."); Log.Message((object)$"Changed, by logic, Spider Mines Field Limit to {spiderMinesFieldCount}."); Log.Message((object)$"Changed, by logic, Turrets Field Limit to {turretFieldCount}."); SkillDef val2 = Resources.Load<SkillDef>("skilldefs/engibody/EngiBodyPlaceMine"); if (val2.baseMaxStock == pressureMinesCount) { Log.Message((object)$"Vanilla has the same Pressure Mines Count as the one in config ({pressureMinesCount}). Skipping."); } else { val2.skillDescriptionToken = "CHENSMINELIMITCHANGER_PRESSURE_MINES_DESC"; val2.baseMaxStock = pressureMinesCount; LanguageAPI.Add("CHENSMINELIMITCHANGER_PRESSURE_MINES_DESC", BuildPressureMinesDescription()); Log.Message((object)$"Changed Pressure Mines Count to {pressureMinesCount}."); } SkillDef val3 = Resources.Load<SkillDef>("skilldefs/engibody/EngiBodyPlaceSpiderMine"); if (val3.baseMaxStock == spiderMinesCount) { Log.Message((object)$"Vanilla has the same Spider Mines Count as the one in config ({spiderMinesCount}). Skipping."); } else { val3.skillDescriptionToken = "CHENSMINELIMITCHANGER_SPIDER_MINES_DESC"; val3.baseMaxStock = spiderMinesCount; LanguageAPI.Add("CHENSMINELIMITCHANGER_SPIDER_MINES_DESC", BuildSpiderMinesDescription()); Log.Message((object)$"Changed Spider Mines Count to {spiderMinesCount}."); } SkillDef val4 = Resources.Load<SkillDef>("skilldefs/engibody/EngiBodyPlaceTurret"); if (val4.baseMaxStock == turretCount) { Log.Message((object)$"Vanilla has the same Turret Count as the one in config ({turretCount}). Skipping."); return; } val4.skillDescriptionToken = "TURRETCOUNTCHANGER_TURRET_COUNT_DESC"; val4.baseMaxStock = turretCount; LanguageAPI.Add("TURRETCOUNTCHANGER_TURRET_COUNT_DESC", BuildTurretDescription()); Log.Message((object)$"Changed Turret Count to {turretCount}."); } private string BuildPressureMinesDescription() { return "Place a two-stage mine that deals <style=cIsDamage>300% damage</style>, or <style=cIsDamage>900% damage</style> if fully armed." + $" Can store up to {pressureMinesCount}." + $" Can place up to {pressureMinesFieldCount}."; } private string BuildSpiderMinesDescription() { return "Place a robot mine that deals <style=cIsDamage>600% damage</style> when an enemy walks nearby." + $" Can store up to {spiderMinesCount}." + $" Can place up to {spiderMinesFieldCount}."; } private string BuildTurretDescription() { return "Place a turret that inherits all your items. Fires a cannon for 100% damage." + $" Can store up to {turretCount}." + $" Can place up to {turretFieldCount}."; } internal static bool DebugCheck() { return false; } } } namespace Chen.MineLimitChanger.Patches { [HarmonyPatch(typeof(CharacterMaster), "GetDeployableSameSlotLimit")] internal class TurretCountChanger { private static void Postfix(CharacterMaster __instance, ref int __result, DeployableSlot slot) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)__instance)) { return; } if ((int)slot != 0) { if ((int)slot != 1) { if ((int)slot == 5) { __result = ModPlugin.spiderMinesFieldCount + __instance.inventory.GetItemCount(Items.SecondarySkillMagazine); } return; } int itemCount = __instance.inventory.GetItemCount(Items.EquipmentMagazineVoid); __result = ModPlugin.turretFieldCount; if (ModPlugin.lysateCellIncrement) { __result += itemCount; } else if (itemCount > 0) { __result++; } } else { __result = ModPlugin.pressureMinesFieldCount + __instance.inventory.GetItemCount(Items.SecondarySkillMagazine); } } } }
BepinEx/plugins/DestroyedClone-DoshDrop/DoshDrop/ShareYourMoney.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ShareYourMoney")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for Risk of Rain 2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShareYourMoney")] [assembly: AssemblyTitle("ShareYourMoney")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace ShareYourMoney { [BepInPlugin("com.DestroyedClone.DoshDrop", "Dosh Drop", "1.0.5")] [BepInDependency("com.bepis.r2api", "4.3.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class DoshDropPlugin : BaseUnityPlugin { public class DoshDrop_InputCheckerComponent : MonoBehaviour { public LocalUser userLocalUser; private bool wasPressed = false; public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) bool flag = KeyboardShortcutExtensions.IsPressedInclusive(cfgCDropKey.Value); if (!flag || !wasPressed) { if (!flag) { wasPressed = false; } if (!userLocalUser.isUIFocused && flag) { ReleaseMoneyAuthority(userLocalUser.cachedMaster); wasPressed = true; } } } } internal static ManualLogSource _logger; public static ConfigEntry<KeyboardShortcut> cfgCDropKey; public static ConfigEntry<bool> cfgCLanguageSwap; public static ConfigEntry<float> cfgSPercentToDrop; public static ConfigEntry<bool> cfgSPreventModUseOnStageEnd; public static ConfigEntry<bool> cfgSRefundOnStageEnd; public static int baseChestCost = 25; public static bool SGlobalPreventMoneyDrops = false; public static PluginInfo PInfo { get; private set; } public void Awake() { PInfo = ((BaseUnityPlugin)this).Info; } public void Start() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown _logger = ((BaseUnityPlugin)this).Logger; DoshContent.LoadResources(); DoshContent.CreateObjects(); cfgCDropKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Client", "Keybind", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Button to press to drop money"); cfgCLanguageSwap = ((BaseUnityPlugin)this).Config.Bind<bool>("Client", "English (England)", true, "Renames the English translation for Money to a more regionally appropriate term."); cfgSPercentToDrop = ((BaseUnityPlugin)this).Config.Bind<float>("Server", "Amount to Drop", 0.5f, "Drop money equivalent to this percentage of the cost of a small chest."); cfgSPreventModUseOnStageEnd = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "Prevent On Stage End", true, "If true, then money will be prevented from being dropped on ending the stage."); cfgSRefundOnStageEnd = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "Refund Drops On Stage End", true, "If true, then money will get refunded to owners upon ending the stage."); CharacterBody.onBodyStartGlobal += AddInputTrackerToCharacter; SetupLanguage(); SceneExitController.SetState += new hook_SetState(RefundMoneyDropsOnSceneExit); Stage.onServerStageBegin += OnStageBegin_ResetPreventMoneyDrops; OutsideInteractableLocker.LockPurchasable += new hook_LockPurchasable(PreventInteractionLockPrefab); CommandHelper.AddToConsoleWhenReady(); ModCompat.Initialize(); } public bool CharacterBodyIsLocalUser(CharacterBody body) { return (Object)(object)LocalUserManager.GetFirstLocalUser().cachedMaster == (Object)(object)body.master; } private void AddInputTrackerToCharacter(CharacterBody body) { if (body.isPlayerControlled && Object.op_Implicit((Object)(object)body.master) && CharacterBodyIsLocalUser(body)) { DoshDrop_InputCheckerComponent doshDrop_InputCheckerComponent = ((Component)body).gameObject.AddComponent<DoshDrop_InputCheckerComponent>(); doshDrop_InputCheckerComponent.userLocalUser = LocalUserManager.GetFirstLocalUser(); } } public static void SetupLanguage() { string text = "DC_DOSH_PICKUP"; LanguageAPI.Add(text, cfgCLanguageSwap.Value ? "Dosh" : "Money"); LanguageAPI.Add(text, "Geld", "de"); LanguageAPI.Add(text, "Dinero", "es-419"); LanguageAPI.Add(text, cfgCLanguageSwap.Value ? "Fric" : "Argent", "FR"); LanguageAPI.Add(text, "Soldi", "IT"); LanguageAPI.Add(text, "お金", "ja"); LanguageAPI.Add(text, "돈", "ko"); LanguageAPI.Add(text, "Dinheiro", "pt-BR"); LanguageAPI.Add(text, "Деньги", "RU"); LanguageAPI.Add(text, "Para", "tr"); LanguageAPI.Add(text, "钱", "zh-CN"); } private void PreventInteractionLockPrefab(orig_LockPurchasable orig, OutsideInteractableLocker self, PurchaseInteraction purchaseInteraction) { if (!Object.op_Implicit((Object)(object)((Component)purchaseInteraction).GetComponent<DoshContent.MoneyPickupMarker>())) { orig.Invoke(self, purchaseInteraction); } } private void OnStageBegin_ResetPreventMoneyDrops(Stage obj) { SGlobalPreventMoneyDrops = false; } private void RefundMoneyDropsOnSceneExit(orig_SetState orig, SceneExitController self, ExitState newState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 bool flag = newState != self.exitState; orig.Invoke(self, newState); if (!flag) { return; } ExitState exitState = self.exitState; ExitState val = exitState; if ((int)val != 0) { if ((int)val == 1) { if (cfgSPreventModUseOnStageEnd.Value) { SGlobalPreventMoneyDrops = true; } if (cfgSRefundOnStageEnd.Value) { RefundMoneyPackPickups(); } } else if (cfgSPreventModUseOnStageEnd.Value) { SGlobalPreventMoneyDrops = true; } } else { SGlobalPreventMoneyDrops = false; } } private static void RefundMoneyPackPickups() { foreach (DoshContent.ModifiedMoneyPickup item in new List<DoshContent.ModifiedMoneyPickup>(DoshContent.ModifiedMoneyPickup.instancesList)) { if (Object.op_Implicit((Object)(object)item)) { item.Refund(); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCDropMoney(ConCommandArgs args) { if (!Object.op_Implicit((Object)(object)Run.instance)) { Debug.Log((object)"doshdrop: Can't drop any dosh without being in a run!"); return; } if (!Object.op_Implicit((Object)(object)((ConCommandArgs)(ref args)).TryGetSenderBody())) { Debug.Log((object)"doshdrop: Can't drop any dosh without a body!"); return; } int goldReward = 0; if (((ConCommandArgs)(ref args)).Count > 0) { int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0); if (!num.HasValue) { Debug.Log((object)"doshdrop: Couldn't parse the the value as an integer."); return; } if (num.Value < 0) { Debug.Log((object)"doshdrop: Can't drop negative money!"); return; } goldReward = num.Value; } Server_ReleaseMoney(((ConCommandArgs)(ref args)).senderMaster, (uint)goldReward); } public static void Server_ReleaseMoney(CharacterMaster master, uint goldReward = 0u) { //IL_00bd: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { _logger.LogWarning((object)"DoshDrop.Server_ReleaseMoney called on client!"); return; } if (goldReward == 0) { goldReward = (uint)Mathf.CeilToInt((float)Run.instance.GetDifficultyScaledCost(baseChestCost) * cfgSPercentToDrop.Value * 1f); } if (!Object.op_Implicit((Object)(object)master)) { return; } CharacterBody body = master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } if (goldReward > master.money) { goldReward = master.money; } if (goldReward != 0) { GameObject val = Object.Instantiate<GameObject>(DoshContent.ShareMoneyPack); val.transform.position = body.corePosition; DoshContent.ModifiedMoneyPickup componentInChildren = val.GetComponentInChildren<DoshContent.ModifiedMoneyPickup>(); componentInChildren.goldReward = (int)goldReward; componentInChildren.owner = body; Rigidbody component = val.GetComponent<Rigidbody>(); Vector3 val2; if (Object.op_Implicit((Object)(object)body.inputBank)) { Ray aimRay = body.inputBank.GetAimRay(); val2 = ((Ray)(ref aimRay)).direction; val.transform.position = ((Ray)(ref aimRay)).origin; } else { val2 = ((Component)body).gameObject.transform.forward; } component.velocity = Vector3.up * 5f + val2 * 20f; NetworkServer.Spawn(val); master.money = (uint)Mathf.Max(0f, (float)(master.money - goldReward)); } } public static void ReleaseMoneyAuthority(CharacterMaster characterMaster, uint moneyAmount = 0u) { if (Object.op_Implicit((Object)(object)Console.instance)) { Console.instance.SubmitCmd(((Component)characterMaster).GetComponent<PlayerCharacterMasterController>().networkUser, $"doshdrop {moneyAmount}", false); } } public static void CallCmdReleaseMoney(CharacterMaster characterMaster, uint moneyToDrop = 0u) { if (Object.op_Implicit((Object)(object)Console.instance)) { Console.instance.SubmitCmd(((Component)characterMaster).GetComponent<PlayerCharacterMasterController>().networkUser, "doshdrop", false); } } } public class DoshContent : IContentPackProvider { public class MoneyPickupMarker : MonoBehaviour { } public class ModifiedMoneyPickup : MonoBehaviour { public static readonly List<ModifiedMoneyPickup> instancesList = new List<ModifiedMoneyPickup>(); public PurchaseInteraction purchaseInteraction; [Tooltip("The base object to destroy when this pickup is consumed.")] public GameObject baseObject; [Tooltip("The team filter object which determines who can pick up this pack.")] public TeamFilter teamFilter; public GameObject pickupEffectPrefab; private bool alive = true; public int goldReward; private float age = 0f; private readonly float durationBeforeOwnerPickup = 3f; public CharacterBody owner; private bool ownerCanPickup = false; private bool allowPickup = true; private void OnEnable() { instancesList.Add(this); } private void OnDisable() { instancesList.Remove(this); } private void Start() { if (NetworkServer.active) { purchaseInteraction.Networkcost = goldReward; } } public void Refund() { ConsumePickup(owner.master); } private void FixedUpdate() { age += Time.fixedDeltaTime; if (age > durationBeforeOwnerPickup) { ownerCanPickup = true; } } private void OnTriggerStay(Collider other) { if (NetworkServer.active && alive && allowPickup) { CharacterBody component = ((Component)other).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.isPlayerControlled && Object.op_Implicit((Object)(object)component.master) && ((ownerCanPickup && (Object)(object)component == (Object)(object)owner) || (Object)(object)component != (Object)(object)owner)) { ConsumePickup(component.master, showEffect: true); } } } private void ConsumePickup(CharacterMaster collectorMaster, bool showEffect = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_004a: Unknown result type (might be due to invalid IL or missing references) allowPickup = false; alive = false; Vector3 position = ((Component)this).transform.position; if (Object.op_Implicit((Object)(object)collectorMaster)) { collectorMaster.GiveMoney((uint)goldReward); } if (Object.op_Implicit((Object)(object)pickupEffectPrefab) && showEffect) { EffectManager.SimpleEffect(pickupEffectPrefab, position, Quaternion.identity, true); } Object.Destroy((Object)(object)baseObject); } } internal static ContentPack contentPack = new ContentPack(); public static AssetBundle mainAssetBundle; public const string bundleName = "bigbluecash"; public const string assetBundleFolder = "AssetBundles"; public static List<GameObject> networkedObjectPrefabs = new List<GameObject>(); public static GameObject ShareMoneyPack; public static GameObject moneyAsset; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(DoshDropPlugin.PInfo.Location), "AssetBundles", "bigbluecash"); public string identifier => "DoshDrop.content"; public static void LoadResources() { mainAssetBundle = AssetBundle.LoadFromFile(AssetBundlePath); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray()); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } public static void CreateObjects() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0184: Unknown result type (might be due to invalid IL or missing references) moneyAsset = mainAssetBundle.LoadAsset<GameObject>("Assets/bigbluecash/BBC.prefab"); GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BonusGoldPackOnKill/BonusMoneyPack.prefab").WaitForCompletion(), "ShareMoneyPack", true); MoneyPickup component = ((Component)val.transform.Find("PackTrigger")).GetComponent<MoneyPickup>(); ModifiedMoneyPickup modifiedMoneyPickup = ((Component)component).gameObject.AddComponent<ModifiedMoneyPickup>(); modifiedMoneyPickup.baseObject = component.baseObject; modifiedMoneyPickup.pickupEffectPrefab = component.pickupEffectPrefab; modifiedMoneyPickup.teamFilter = component.teamFilter; Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)val.GetComponent<VelocityRandomOnStart>()); ((Component)val.transform.Find("GravityTrigger")).gameObject.SetActive(false); val.GetComponentInChildren<MeshFilter>().sharedMesh = moneyAsset.GetComponentInChildren<MeshFilter>().sharedMesh; MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(); RendererSetMaterialsExtension.SetMaterials((Renderer)(object)componentInChildren, new List<Material> { ((Renderer)moneyAsset.GetComponentInChildren<MeshRenderer>()).material }); ((Component)componentInChildren).transform.localScale = Vector3.one * 9f; Object.Destroy((Object)(object)((Component)val.transform.Find("Display/Mesh/Particle System")).gameObject); PurchaseInteraction val2 = val.AddComponent<PurchaseInteraction>(); val2.contextToken = "Pickup dosh?"; val2.costType = (CostTypeIndex)1; val2.displayNameToken = "DC_DOSH_PICKUP"; val2.setUnavailableOnTeleporterActivated = false; val2.automaticallyScaleCostWithDifficulty = false; val2.lockGameObject = null; ((Component)val2).gameObject.AddComponent<MoneyPickupMarker>(); PingInfoProvider val3 = val.AddComponent<PingInfoProvider>(); val3.pingIconOverride = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texRuleBonusStartingMoney.png").WaitForCompletion(); modifiedMoneyPickup.purchaseInteraction = val2; networkedObjectPrefabs.Add(val); ShareMoneyPack = val; } } public static class ModCompat { public static void Initialize() { if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RiskOfOptionsCompat() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown ModSettingsManager.SetModDescription("Allows players to drop their dosh.", "com.DestroyedClone.DoshDrop", "Dosh Drop"); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(DoshDropPlugin.cfgCDropKey)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DoshDropPlugin.cfgCLanguageSwap)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(DoshDropPlugin.cfgSPercentToDrop, new StepSliderConfig { min = 0.01f, max = 1f, increment = 0.01f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DoshDropPlugin.cfgSPreventModUseOnStageEnd)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DoshDropPlugin.cfgSRefundOnStageEnd)); DoshDropPlugin.cfgCLanguageSwap.SettingChanged += CfgCLanguageSwap_SettingChanged; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void CfgCLanguageSwap_SettingChanged(object sender, EventArgs e) { DoshDropPlugin.SetupLanguage(); } } }
BepinEx/plugins/DestroyedClone-GoldChestForAll/GoldChestForAll.dll
Decompiled 11 months agousing 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 HG.Reflection; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("GoldChestForAll")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for Risk of Rain 2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GoldChestForAll")] [assembly: AssemblyTitle("GoldChestForAll")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace GoldChestForAll { [BepInPlugin("com.DestroyedClone.GoldChestForAll", "GoldChestForAll", "1.0.11")] public class GCFAPlugin : BaseUnityPlugin { public static ConfigEntry<float> cfgCostMultiplier { get; set; } public static ConfigEntry<bool> CfgIntent { get; set; } public void Start() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown cfgCostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Default", "Gold Chest Cost Multiplier", 1f, "Multiply the costs of gold chests. Intended for balance, but you can just set it to '1' if you want it unchanged."); CfgIntent = ((BaseUnityPlugin)this).Config.Bind<bool>("Default", "Only Abyssal Depths and Sundered Grove", true, "If true, then only the guaranteed chest on Sundered Grove and Abyssal Depths will have its amount increased."); ChestBehavior.ItemDrop += new hook_ItemDrop(DuplicateDrops); if (cfgCostMultiplier.Value != 1f) { PurchaseInteraction.Awake += new hook_Awake(MultiplyChestCost); } } private bool IsValidScene(Transform chestTransform) { if (CfgIntent.Value) { bool flag = Object.op_Implicit((Object)(object)chestTransform.parent) && ((Object)chestTransform.parent).name == "HOLDER: Newt Statues and Preplaced Chests"; bool flag2 = Object.op_Implicit((Object)(object)chestTransform.parent) && Object.op_Implicit((Object)(object)chestTransform.parent.parent) && ((Object)chestTransform.parent.parent).name == "GROUP: Large Treasure Chests"; return flag2 || flag; } return true; } private void MultiplyChestCost(orig_Awake orig, PurchaseInteraction self) { if (NetworkServer.active && IsValidScene(((Component)self).transform)) { ChestBehavior component = ((Component)self).GetComponent<ChestBehavior>(); if (Object.op_Implicit((Object)(object)component) && component.tier3Chance == 1f) { int networkcost = (int)Mathf.Ceil((float)self.cost * cfgCostMultiplier.Value); self.Networkcost = networkcost; } } orig.Invoke(self); } private void DuplicateDrops(orig_ItemDrop orig, ChestBehavior self) { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (self.tier3Chance != 1f || self.dropPickup == PickupIndex.none || self.dropPickup == PickupIndex.none || !IsValidScene(((Component)self).transform)) { orig.Invoke(self); return; } if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void RoR2.ChestBehavior::ItemDrop()' called on client"); return; } int num = ((Run.instance.participatingPlayerCount == 0) ? 1 : Run.instance.participatingPlayerCount); float num2 = 360f / (float)num; Vector3 val = Vector3.up * self.dropUpVelocityStrength + self.dropTransform.forward * self.dropForwardVelocityStrength; Quaternion val2 = Quaternion.AngleAxis(num2, Vector3.up); int num3 = 0; while (num3 < num) { PickupDropletController.CreatePickupDroplet(self.dropPickup, self.dropTransform.position + Vector3.up * 1.5f, val); num3++; val = val2 * val; } self.dropPickup = PickupIndex.none; } } }
BepinEx/plugins/Evaisa-FallenFriends/FallenFriends.dll
Decompiled 11 months agousing System; using System.Collections; 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 On.RoR2; using RoR2; using UnityEngine; using UnityEngine.Networking; [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("Evaisa")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FallenFriends")] [assembly: AssemblyTitle("FallenFriends")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Evaisa.FallenFriends; [BepInPlugin("com.evaisa.fallenfriends", "Fallen Friends", "6.0.1")] public class FallenFriends : BaseUnityPlugin { public class RespawnClass { public PlayerCharacterMasterController player; public string prefab_name; public Vector3 position; public Quaternion rotation; public RespawnClass(PlayerCharacterMasterController player, string prefab_name, Vector3 position, Quaternion rotation) { //IL_0017: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) this.player = player; this.prefab_name = prefab_name; this.position = position; this.rotation = rotation; } } public enum PlayerType { DronePlayers, NonDronePlayers } public static ConfigEntry<bool> alwaysRespawn; public static ConfigEntry<bool> UnlimitedRespawns; public static ConfigEntry<bool> PickupItems; public static HashSet<CharacterMaster> fallenPlayers = new HashSet<CharacterMaster>(); public static Dictionary<CharacterMaster, string> oldPrefabs = new Dictionary<CharacterMaster, string>(); public static Dictionary<CharacterMaster, string> lastPrefab = new Dictionary<CharacterMaster, string>(); public static bool gameHasEnded = false; public Random rnd = new Random(); private const string ModVer = "6.0.1"; private const string ModName = "Fallen Friends"; private const string ModGuid = "com.evaisa.fallenfriends"; public static FallenFriends instance; public static bool debug = false; public FallenFriends() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown alwaysRespawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RespawnWithoutAllies", false, "Respawn players as drones if they do not own any allies."); UnlimitedRespawns = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "UnlimitedRespawns", false, "Respawn any amount of times instead of the default only 1 respawn per stage."); PickupItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "AllowItemPickup", false, "Allow players controlling drones to pick up items."); Run.Start += new hook_Start(Run_Start); GenericPickupController.BodyHasPickupPermission += new hook_BodyHasPickupPermission(GenericPickupController_BodyHasPickupPermission); PurchaseInteraction.CanBeAffordedByInteractor += new hook_CanBeAffordedByInteractor(PurchaseInteraction_CanBeAffordedByInteractor); CharacterMaster.Respawn += new hook_Respawn(CharacterMaster_Respawn); CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); GlobalEventManager.OnPlayerCharacterDeath += new hook_OnPlayerCharacterDeath(GlobalEventManager_OnPlayerCharacterDeath); Stage.RespawnCharacter += new hook_RespawnCharacter(Stage_RespawnCharacter); } private bool PurchaseInteraction_CanBeAffordedByInteractor(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator) { if (Object.op_Implicit((Object)(object)((Component)activator).GetComponent<CharacterBody>())) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if ((Object)(object)component.master != (Object)null && fallenPlayers.Contains(component.master) && !PickupItems.Value) { return false; } } return orig.Invoke(self, activator); } private bool GenericPickupController_BodyHasPickupPermission(orig_BodyHasPickupPermission orig, CharacterBody body) { if ((Object)(object)body.master != (Object)null && fallenPlayers.Contains(body.master)) { return false; } return orig.Invoke(body); } private void Run_Start(orig_Start orig, Run self) { fallenPlayers.Clear(); oldPrefabs.Clear(); gameHasEnded = false; orig.Invoke(self); } public void setOldPrefab(CharacterMaster player) { if (oldPrefabs.ContainsKey(player)) { oldPrefabs[player] = ((Object)player.bodyPrefab).name; } else { oldPrefabs.Add(player, ((Object)player.bodyPrefab).name); } Print<string>(player.playerCharacterMasterController.GetDisplayName() + "'s body prefab has been stored!"); } private CharacterBody CharacterMaster_Respawn(orig_Respawn orig, CharacterMaster self, Vector3 footPosition, Quaternion rotation) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)self).GetComponent<PlayerCharacterMasterController>() != (Object)null && !fallenPlayers.Contains(self)) { if (oldPrefabs.ContainsKey(self)) { self.bodyPrefab = BodyCatalog.FindBodyPrefab(oldPrefabs[self]); Print<string>(((Component)self).GetComponent<PlayerCharacterMasterController>().GetDisplayName() + "'s body prefab has been reset!"); } else { setOldPrefab(self); } } CharacterBody result = orig.Invoke(self, footPosition, rotation); if ((Object)(object)((Component)self).GetComponent<PlayerCharacterMasterController>() != (Object)null && fallenPlayers.Contains(self) && lastPrefab.ContainsKey(self) && ((Object)self.bodyPrefab).name != lastPrefab[self]) { fallenPlayers.Remove(self); } return result; } private void Stage_RespawnCharacter(orig_RespawnCharacter orig, Stage self, CharacterMaster characterMaster) { PlayerCharacterMasterController component = ((Component)characterMaster).GetComponent<PlayerCharacterMasterController>(); if (Object.op_Implicit((Object)(object)component) && fallenPlayers.Contains(characterMaster) && oldPrefabs.ContainsKey(characterMaster)) { fallenPlayers.Remove(characterMaster); characterMaster.bodyPrefab = BodyCatalog.FindBodyPrefab(oldPrefabs[characterMaster]); Print<string>(((Component)characterMaster).GetComponent<PlayerCharacterMasterController>().GetDisplayName() + " was returned to their original prefab."); } orig.Invoke(self, characterMaster); } private void GlobalEventManager_OnPlayerCharacterDeath(orig_OnPlayerCharacterDeath orig, GlobalEventManager self, DamageReport damageReport, NetworkUser victimNetworkUser) { if ((Object)(object)victimNetworkUser.master != (Object)null && !fallenPlayers.Contains(victimNetworkUser.master)) { orig.Invoke(self, damageReport, victimNetworkUser); } } public Dictionary<PlayerType, List<PlayerCharacterMasterController>> getOtherPlayers(PlayerCharacterMasterController self) { Dictionary<PlayerType, List<PlayerCharacterMasterController>> dictionary = new Dictionary<PlayerType, List<PlayerCharacterMasterController>>(); dictionary.Add(PlayerType.DronePlayers, new List<PlayerCharacterMasterController>()); dictionary.Add(PlayerType.NonDronePlayers, new List<PlayerCharacterMasterController>()); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if ((Object)(object)instance != (Object)(object)self && instance.master.hasBody) { if (fallenPlayers.Contains(instance.master)) { dictionary[PlayerType.DronePlayers].Add(instance); } else { dictionary[PlayerType.NonDronePlayers].Add(instance); } } } return dictionary; } private void CharacterMaster_OnBodyDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body) { //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) if (body.isPlayerControlled && self.inventory.GetItemCount(Items.ExtraLife) <= 0 && self.inventory.GetItemCount(Items.ExtraLifeVoid) <= 0 && !self.IsExtraLifePendingServer()) { PlayerCharacterMasterController component = ((Component)self).GetComponent<PlayerCharacterMasterController>(); if ((Object)(object)component != (Object)null) { Dictionary<PlayerType, List<PlayerCharacterMasterController>> otherPlayers = getOtherPlayers(component); List<PlayerCharacterMasterController> list = otherPlayers[PlayerType.NonDronePlayers]; List<PlayerCharacterMasterController> list2 = otherPlayers[PlayerType.DronePlayers]; if (list.Count == 0 && !debug) { foreach (PlayerCharacterMasterController item in list2) { if (NetworkServer.active) { Print<string>("Killing player: " + item.GetDisplayName()); item.master.TrueKill(); } } Print<string>("Game should end now!"); gameHasEnded = true; } PlayerCharacterMasterController component2 = ((Component)self).GetComponent<PlayerCharacterMasterController>(); if ((Object)(object)component2 != (Object)null) { Print<string>("Checking if player should take over ally."); if (self.inventory.GetItemCount(Items.ExtraLife) <= 0 && !gameHasEnded) { Print<string>("Game has not ended and gameover is allowed."); if (!fallenPlayers.Contains(self) || UnlimitedRespawns.Value) { List<CharacterMaster> list3 = CharacterMaster.readOnlyInstancesList.Where(delegate(CharacterMaster x) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 CharacterBody body2 = x.GetBody(); return (Object)(object)body2 != (Object)null && !body2.isPlayerControlled && (int)x.teamIndex == 1 && ((Object)x.bodyPrefab).name != "Turret1Body" && ((Object)x.bodyPrefab).name != "SniperDecoy" && ((Object)x.bodyPrefab).name != "LemurianMonsterMaster" && ((Object)x.bodyPrefab).name != "SquidTurretBody" && (Object)(object)((Component)x).gameObject.GetComponent<MasterSuicideOnTimer>() == (Object)null; }).Cast<CharacterMaster>().ToList(); if (!alwaysRespawn.Value && list3.Count != 0) { CharacterMaster val = list3[rnd.Next(0, list3.Count)]; if (val.hasBody) { Print<string>("Trying to respawn " + component2.GetDisplayName()); string name = ((Object)val.bodyPrefab).name; Vector3 footPosition = val.GetBody().footPosition; Quaternion rotation = val.GetBodyObject().transform.rotation; if (NetworkServer.active) { val.TrueKill(); } fallenPlayers.Add(self); ((MonoBehaviour)this).StartCoroutine("RespawnAs", (object)new RespawnClass(component2, name, footPosition, rotation)); } } else { List<string> list4 = new List<string>(); Print<string>("Trying to respawn " + component2.GetDisplayName()); list4.Add("MissileDroneBody"); string prefab_name = list4[rnd.Next(0, list4.Count)]; Vector3 footPosition2 = self.GetBody().footPosition; Quaternion rotation2 = self.GetBodyObject().transform.rotation; fallenPlayers.Add(self); ((MonoBehaviour)this).StartCoroutine("RespawnAs", (object)new RespawnClass(component2, prefab_name, footPosition2, rotation2)); } } } } } } if (!debug) { orig.Invoke(self, body); } } private IEnumerator RespawnAs(RespawnClass obj) { yield return (object)new WaitForSeconds(2f); PlayerCharacterMasterController player = obj.player; string prefab_name = obj.prefab_name; Vector3 position = obj.position; Quaternion rotation = obj.rotation; GameObject prefab = BodyCatalog.FindBodyPrefab(prefab_name); if (!((Object)(object)player != (Object)null)) { yield break; } if (NetworkServer.active && Object.op_Implicit((Object)(object)player.master)) { player.master.bodyPrefab = prefab; if (lastPrefab.ContainsKey(player.master)) { lastPrefab[player.master] = ((Object)player.master.bodyPrefab).name; } else { lastPrefab.Add(player.master, ((Object)player.master.bodyPrefab).name); } player.master.Respawn(position, rotation); } Print<string>(player.GetDisplayName() + " has been respawned as " + prefab_name + "!"); } public static void Print<T>(params T[] toPrint) { string text = "[Fallen Friends]: "; for (int i = 0; i < toPrint.Length; i++) { T val = toPrint[i]; text += val.ToString(); } Debug.Log((object)text); } }
BepinEx/plugins/Fr4nsson-MultiplayerPause/MultiplayerPause.dll
Decompiled 11 months agousing 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 HarmonyLib; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("MultiplayerPause")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MultiplayerPause")] [assembly: AssemblyTitle("MultiplayerPause")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace MultiplayerPause; [BepInPlugin("0.fr4nsson.MultiplayerPause", "MultiplayerPause", "1.0.2")] public class MultiplayerPause : BaseUnityPlugin { public static ConfigEntry<bool> IsEnable; private static Harmony _hi; private static GameObject _pauseNotification; public void Awake() { IsEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Global", "IsEnable", true, "Set this to true to enable this mod."); if (IsEnable.Value) { _hi = Harmony.CreateAndPatchAll(typeof(MultiplayerPause), (string)null); } } public void Update() { if (!IsRunActive() && Time.timeScale == 0f) { Time.timeScale = 1f; } if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)112) && IsRunActive()) { Console.instance.RunClientCmd(LocalUserManager.readOnlyLocalUsersList[0].currentNetworkUser, "say", new string[1] { "pause" }); } } public void OnDestroy() { Harmony hi = _hi; if (hi != null) { hi.UnpatchSelf(); } } public static bool IsRunActive() { if (Object.op_Implicit((Object)(object)Run.instance) && Run.instance.fixedTime > 0f) { return true; } return false; } [HarmonyPatch(typeof(UserChatMessage), "ConstructChatString")] [HarmonyPrefix] private static void Chat_UserChatMessage_ConstructChatString_Patch(ref string ___text, ref GameObject ___sender, ref bool __runOriginal) { __runOriginal = true; if (IsRunActive() && ___text.ToLower().StartsWith("pause") && ___text.ToLower().EndsWith("pause")) { __runOriginal = false; if (Time.timeScale == 1f) { Time.timeScale = 0f; _pauseNotification = InstantiatePauseNotification(___sender.GetComponent<NetworkUser>()); return; } Time.timeScale = 1f; _pauseNotification.GetComponent<UIJuice>().transitionDuration = 0.4f; _pauseNotification.GetComponent<UIJuice>().destroyOnEndOfTransition = true; _pauseNotification.GetComponent<UIJuice>().TransitionAlphaFadeOut(); } } private static GameObject InstantiatePauseNotification(NetworkUser sender) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) AchievementNotificationPanel component = LegacyResourcesAPI.Load<GameObject>("Prefabs/UI/AchievementNotificationPanel").GetComponent<AchievementNotificationPanel>(); ((Object)component).name = "MultiplayerPauseNotification"; Canvas component2 = LocalUserManager.readOnlyLocalUsersList[0].cameraRigController.hud.mainContainer.GetComponent<Canvas>(); ((Behaviour)((Component)((Component)((Component)((Component)((Component)component).transform.Find("DisableDuringSwiping")).transform.Find("DisplayArea")).transform.Find("UnlockedImagePanel")).transform.Find("BG")).GetComponent<Image>()).enabled = false; ((Behaviour)component.achievementIconImage).enabled = false; ((TMP_Text)component.achievementName).text = "<style=cIsDamage>" + sender.userName + "</style> paused the game."; ((Graphic)component.achievementName).color = Color.white; ((Graphic)((Component)((Component)component).transform.Find("Backdrop")).GetComponent<Image>()).color = new Color(0.8227f, 0.6931f, 0.346f, 1f); ((TMP_Text)component.achievementDescription).text = "Type <style=cIsDamage>pause</style> in chat or press <style=cIsDamage>CTRL</style> + <style=cIsDamage>P</style> to unpause again."; ((Component)component).GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f); ((Component)component).GetComponent<RectTransform>().offsetMax = new Vector2(16f, 0f); ((Component)component).GetComponent<RectTransform>().offsetMin = new Vector2(-16f, -200f); ((Component)component).GetComponent<RectTransform>().pivot = new Vector2(0.5f, 3f); ((Component)component).GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f); UIJuice component3 = ((Component)component).GetComponent<UIJuice>(); component3.transitionDuration = 0.4f; component3.panningMagnitude = 0f; return ((Component)Object.Instantiate<AchievementNotificationPanel>(component, ((Component)component2).transform)).gameObject; } }
BepinEx/plugins/Griff-Drone_Repair_Kit/DroneRepairKit.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using DroneMod.Modules; using DroneMod.Modules.Items; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.ContentManagement; using RoR2.Hologram; using RoR2.Orbs; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [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("DroneRepairKit")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DroneRepairKit")] [assembly: AssemblyTitle("DroneRepairKit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class DronePurchaseOrb : Orb { public Transform targetTransform; public float overrideDuration = 0.3f; public float scale = 0.5f; public PurchaseInteraction targetInteraction; public Interactor interactorComponent; public override void Begin() { //IL_000e: 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_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown ((Orb)this).duration = overrideDuration; EffectData val = new EffectData { scale = scale, origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(((Component)targetTransform).gameObject); EffectManager.SpawnEffect(DroneRepairKit.orbEffect, val, true); } public override void OnArrival() { if (Object.op_Implicit((Object)(object)targetInteraction)) { targetInteraction.Networkcost = 0; interactorComponent.AttemptInteraction(((Component)targetInteraction).gameObject); } } } public class DroneRepairKitPurchaseEffect : MonoBehaviour { public PositionIndicator indicator; private void OnEnable() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) GameObject val = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/PositionIndicators/PoiPositionIndicator"), ((Component)this).transform.position, ((Component)this).transform.rotation); indicator = val.GetComponent<PositionIndicator>(); indicator.insideViewObject.GetComponent<SpriteRenderer>().sprite = Assets.repairIcon; indicator.transform.localScale = new Vector3(0.35f, 0.35f, 0.35f); indicator.insideViewObject.transform.localPosition = new Vector3(0f, -0.2f, 0f); indicator.targetTransform = ((Component)this).GetComponent<HologramProjector>().hologramPivot; } private void OnDisable() { if (Object.op_Implicit((Object)(object)indicator)) { Object.Destroy((Object)(object)((Component)indicator).gameObject); } indicator = null; } private void FixedUpdate() { if (!DroneRepairKit.activeEffects.Contains(this)) { Object.Destroy((Object)(object)this); } } } public class DroneRepairOrb : Orb { public float healValue; public float overrideDuration = 0.3f; public float scale = 0.5f; public override void Begin() { //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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)base.target)) { ((Orb)this).duration = overrideDuration; EffectData val = new EffectData { scale = scale, origin = base.origin, genericFloat = ((Orb)this).duration }; val.SetHurtBoxReference(base.target); EffectManager.SpawnEffect(DroneRepairKit.orbEffect, val, true); } } public override void OnArrival() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.target)) { HealthComponent healthComponent = base.target.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.HealFraction(1f, default(ProcChainMask)); } } } } namespace DroneMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Griff.DroneRepairKit", "Drone Repair Kit", "1.1.5")] [R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "ItemAPI", "EffectAPI" })] public class DronePlugin : BaseUnityPlugin { public const string MODUID = "com.Griff.DroneRepairKit"; public const string MODNAME = "Drone Repair Kit"; public const string MODVERSION = "1.1.5"; public const string developerPrefix = "GRIFF"; public static DronePlugin instance; public static ConfigEntry<int> MyConfigEntry { get; set; } private void Awake() { instance = this; Assets.Initialize(); Config.ReadConfig(); DroneRepairKit.Initialize(); new ContentPacks().Initialize(); Hook(); } private void Hook() { } } } namespace DroneMod.Modules { internal static class Assets { internal static AssetBundle mainAssetBundle; internal static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); internal static List<EffectDef> effectDefs = new List<EffectDef>(); internal static GameObject droneRepairKitPrefab; internal static GameObject droneRepairKitDisplayPrefab; internal static Sprite droneRepairKitSprite; internal static Sprite repairIcon; internal static Shader hotpoo = Resources.Load<Shader>("Shaders/Deferred/HGStandard"); internal static Material commandoMat; internal static Material drkMat; private static string[] assetNames = new string[0]; private const string assetbundleName = "DroneAssetBundle"; internal static void Initialize() { bool flag = false; LoadAssetBundle(); LoadSoundbank(); PopulateAssets(); } internal static void LoadAssetBundle() { if ((Object)(object)mainAssetBundle == (Object)null) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DroneRepairKit.DroneAssetBundle"); mainAssetBundle = AssetBundle.LoadFromStream(stream); } assetNames = mainAssetBundle.GetAllAssetNames(); } internal static void LoadSoundbank() { } internal static void PopulateAssets() { if (!Object.op_Implicit((Object)(object)mainAssetBundle)) { Debug.LogError((object)"There is no AssetBundle to load assets from."); return; } droneRepairKitPrefab = mainAssetBundle.LoadAsset<GameObject>("mdlDRK"); ConvertAllRenderersToHopooShader(droneRepairKitPrefab); droneRepairKitDisplayPrefab = mainAssetBundle.LoadAsset<GameObject>("mdlDRK"); ConvertAllRenderersToHopooShader(droneRepairKitDisplayPrefab); ItemDisplaySetup(droneRepairKitDisplayPrefab); droneRepairKitSprite = mainAssetBundle.LoadAsset<Sprite>("texDRKIcon"); repairIcon = mainAssetBundle.LoadAsset<Sprite>("texRepairIcon"); } public static void SetHopooShader() { } public static RendererInfo[] ItemDisplaySetup(GameObject obj) { //IL_0025: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ItemDisplay val = droneRepairKitDisplayPrefab.AddComponent<ItemDisplay>(); MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } val.rendererInfos = array; return array; } private static GameObject CreateTracer(string originalTracerName, string newTracerName) { if ((Object)(object)Resources.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; AddNewEffectDef(val); return val; } internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; networkSoundEventDefs.Add(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).material)) { ((Renderer)val).material.shader = hotpoo; } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).material)) { ((Renderer)val2).material.shader = hotpoo; } } } internal static RendererInfo[] SetupRendererInfos(GameObject obj) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_004a: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } return array; } internal static Texture LoadCharacterIcon(string characterName) { return mainAssetBundle.LoadAsset<Texture>("tex" + characterName + "Icon"); } internal static GameObject LoadCrosshair(string crosshairName) { if ((Object)(object)Resources.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null) { return Resources.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return Resources.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); } private static GameObject LoadEffect(string resourceName) { return LoadEffect(resourceName, "", parentToTransform: false); } private static GameObject LoadEffect(string resourceName, string soundName) { return LoadEffect(resourceName, soundName, parentToTransform: false); } private static GameObject LoadEffect(string resourceName, bool parentToTransform) { return LoadEffect(resourceName, "", parentToTransform); } private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) bool flag = false; for (int i = 0; i < assetNames.Length; i++) { if (assetNames[i].Contains(resourceName.ToLower())) { flag = true; i = assetNames.Length; } } if (!flag) { Debug.LogError((object)("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle")); return null; } GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName); val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; AddNewEffectDef(val, soundName); return val; } private static void AddNewEffectDef(GameObject effectPrefab) { AddNewEffectDef(effectPrefab, ""); } private static void AddNewEffectDef(GameObject effectPrefab, string soundName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown EffectDef item = new EffectDef(); effectPrefab.GetComponent<EffectComponent>().soundName = soundName; effectDefs.Add(item); } public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)commandoMat)) { commandoMat = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial; } Material val = Object.Instantiate<Material>(commandoMat); Material val2 = mainAssetBundle.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val2)) { Debug.LogError((object)("Failed to load material: " + materialName + " - Check to see that the name in your Unity project matches the one in this code")); return commandoMat; } ((Object)val).name = materialName; val.SetColor("_Color", val2.GetColor("_Color")); val.SetTexture("_MainTex", val2.GetTexture("_MainTex")); val.SetColor("_EmColor", emissionColor); val.SetFloat("_EmPower", emission); val.SetTexture("_EmTex", val2.GetTexture("_EmissionMap")); val.SetFloat("_NormalStrength", normalStrength); return val; } public static Material CreateMaterial(string materialName) { return CreateMaterial(materialName, 0f); } public static Material CreateMaterial(string materialName, float emission) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return CreateMaterial(materialName, emission, Color.white); } public static Material CreateMaterial(string materialName, float emission, Color emissionColor) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return CreateMaterial(materialName, emission, emissionColor, 0f); } } public static class Config { public static ConfigEntry<bool> HealSquidTurrets { get; set; } public static ConfigEntry<bool> BuyNearbyDrones { get; set; } public static void ReadConfig() { HealSquidTurrets = ((BaseUnityPlugin)DronePlugin.instance).Config.Bind<bool>("Config", "HealSquidTurrets", true, "Allows the Drone Repair Kit to heal squid turrets"); BuyNearbyDrones = ((BaseUnityPlugin)DronePlugin.instance).Config.Bind<bool>("Config", "BuyNearbyDrones", true, "Allows the Drone Repair Kit to purchase nearby broken drones on use"); } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public string identifier => "com.Griff.DroneRepairKit"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.effectDefs.Add(Assets.effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(Assets.networkSoundEventDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } internal static class Helpers { internal const string agilePrefix = "<style=cIsUtility>Agile.</style> "; internal static string ScepterDescription(string desc) { return "\n<color=#d299ff>SCEPTER: " + desc + "</color>"; } public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } internal static class ArrayHelper { public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } } namespace DroneMod.Modules.Items { internal static class DroneRepairKit { public static EquipmentIndex index; internal static string itemLangTokenName = "DRONE_REPAIR_KIT"; internal static string itemName = "Drone Repair Kit"; internal static string itemPickupDesc = "Heals all friendly drones. Repairs nearby broken drones."; internal static string itemFullDesc = "Repairs all friendly robotic minions to <style=cIsHealing>full health</style>. Nearby broken robots are also <style=cIsUtility>repaired</style>."; internal static string itemLore = "<style=cMono>REPAIR FAILED: STATIC INTERFERENCE DETECTED</style>\n<style=cMono>INTERCEPTING LOG FROM DAMAGED COMPONENT(S)...</style>\n\n<mspace=0.6em>INTERNAL SYSTEM STATUS... TESTING DATA\nSTATUS MDP ][ . LED Upper End\nSTATUS SBC ][ . Before End\nSTATUS ETR ][ . LED Lower End\nSTATUS ESP ][ . Before End\nLine Error\nLine Error\nLine Error LED M. Start\n\nPiston Overrun + ][ PROTOCOL_I FAILED\nPiston Overrun - ][ PROTOCOL_II FAILED\nPressure Servo ][ PROTOCOL_III FAILED\nPressure Hydr. ][ PROTOCOL_IV FAILED\nOil Pollution ][ PROTOCOL_V FAILED\nOverload ][ ........................\nOVERLOAD ][ WAITING APPROVAL FOR P_VI...\nProt Shield + ][ SET VALUE OVERTURN COMMAND\n\n PROTOCOL_VI ENGAGED...\n>Eradicate. >BUTCHER >MASSACRE\n>Dispatch >TO THE SWORD >DESTROY\n>ERASE. >ANNIHILATE >MAIM\n>EXECUTE >SLAUGHTER >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n>MOW THEM DOWN >MOW THEM DOWN >MOW THEM DOWN\n\n2.16-21.01.03/2.7-28.08.02/2.11-03.12.96"; internal static GameObject orbEffect; internal static float travelTime = 0.3f; internal static SphereSearch sphereSearch; internal static List<PurchaseInteraction> dronesToPurchase; internal static List<DroneRepairKitPurchaseEffect> activeEffects; internal static List<DroneRepairKitPurchaseEffect> newActiveEffects; internal static List<Collider> foundColliders; internal static Sprite indicator; internal static GameObject squidTurretPrefab; internal static void Initialize() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) CreateLang(); CreateItem(); CreateOrbEffect(); CreatePurchaseEffect(); squidTurretPrefab = Resources.Load<GameObject>("prefabs/characterbodies/squidturretbody"); sphereSearch = new SphereSearch(); sphereSearch.mask = CommonMasks.interactable; sphereSearch.queryTriggerInteraction = (QueryTriggerInteraction)2; sphereSearch.radius = 10f; dronesToPurchase = new List<PurchaseInteraction>(); activeEffects = new List<DroneRepairKitPurchaseEffect>(); newActiveEffects = new List<DroneRepairKitPurchaseEffect>(); foundColliders = new List<Collider>(); } internal static void CreateItem() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown EquipmentDef val = ScriptableObject.CreateInstance<EquipmentDef>(); val.cooldown = 30f; ((Object)val).name = "ITEM_" + itemLangTokenName; val.nameToken = "ITEM_" + itemLangTokenName + "_NAME"; val.pickupToken = "ITEM_" + itemLangTokenName + "_PICKUP"; val.descriptionToken = "ITEM_" + itemLangTokenName + "_DESCRIPTION"; val.loreToken = "ITEM_" + itemLangTokenName + "_LORE"; val.pickupIconSprite = Assets.droneRepairKitSprite; val.pickupModelPrefab = Assets.droneRepairKitPrefab; val.canDrop = true; val.enigmaCompatible = true; val.isBoss = false; val.isLunar = false; CustomEquipment val2 = new CustomEquipment(val, CreateItemDisplayRules()); ItemAPI.Add(val2); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); EquipmentCatalog.Init += new hook_Init(EquipmentSlot_Init); Hooks(); } internal static void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EquipmentSlot.FixedUpdate += new hook_FixedUpdate(EquipmentSlot_FixedUpdate); } internal static void EquipmentSlot_FixedUpdate(orig_FixedUpdate orig, EquipmentSlot self) { orig.Invoke(self); FixedUpdate(self); } internal static void EquipmentSlot_Init(orig_Init orig) { orig.Invoke(); GetEquipmentIndex(); } internal static bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { //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) if (equipmentDef.equipmentIndex == index) { return Fire(self); } return orig.Invoke(self, equipmentDef); } internal static void CreateLang() { LanguageAPI.Add("ITEM_" + itemLangTokenName + "_NAME", itemName); LanguageAPI.Add("ITEM_" + itemLangTokenName + "_PICKUP", itemPickupDesc); LanguageAPI.Add("ITEM_" + itemLangTokenName + "_DESCRIPTION", itemFullDesc); LanguageAPI.Add("ITEM_" + itemLangTokenName + "_LORE", itemLore); } internal static void CreatePurchaseEffect() { indicator = Resources.Load<Sprite>("textures/miscicons/texWIPIcon.png"); } internal static void FixedUpdate(EquipmentSlot self) { //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_005d: Unknown result type (might be due to invalid IL or missing references) if (!Config.BuyNearbyDrones.Value || self.equipmentIndex != index || !IsLocalPlayer(self.characterBody)) { return; } activeEffects.Clear(); if (self.stock <= 0) { return; } List<Collider> list = SearchForEntities(((Component)self).transform.position); for (int i = 0; i < list.Count; i++) { GameObject entity = ((Component)list[i]).GetComponent<EntityLocator>().entity; PurchaseInteraction component = entity.GetComponent<PurchaseInteraction>(); if (!PurchaseInteractionIsValidTarget(component)) { continue; } SummonMasterBehavior component2 = entity.GetComponent<SummonMasterBehavior>(); if (Object.op_Implicit((Object)(object)component2) && IsDroneMaster(component2.masterPrefab)) { DroneRepairKitPurchaseEffect droneRepairKitPurchaseEffect = ((Component)component).GetComponent<DroneRepairKitPurchaseEffect>(); if (!Object.op_Implicit((Object)(object)droneRepairKitPurchaseEffect)) { droneRepairKitPurchaseEffect = entity.AddComponent<DroneRepairKitPurchaseEffect>(); } else { ((Behaviour)droneRepairKitPurchaseEffect).enabled = true; } activeEffects.Add(droneRepairKitPurchaseEffect); } } } internal static List<Collider> SearchForEntities(Vector3 origin) { //IL_0011: 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) foundColliders.Clear(); sphereSearch.origin = origin; sphereSearch.ClearCandidates(); sphereSearch.RefreshCandidates(); sphereSearch.FilterCandidatesByColliderEntities(); sphereSearch.FilterCandidatesByDistinctColliderEntities(); sphereSearch.GetColliders(foundColliders); return foundColliders; } internal static void CreateOrbEffect() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0088: 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) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) GameObject val = Resources.Load<GameObject>("Prefabs/Effects/Orbeffects/InfusionOrbEffect"); orbEffect = PrefabAPI.InstantiateClone(val, "DroneRepairOrbEffect", false); ParticleSystem[] componentsInChildren = orbEffect.GetComponentsInChildren<ParticleSystem>(); ParticleSystem val2 = componentsInChildren[0]; MainModule main = val2.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)210, (byte)40, byte.MaxValue))); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = false; ParticleSystem val3 = componentsInChildren[1]; main = val3.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)200, (byte)0, (byte)10))); TrailRenderer componentInChildren = orbEffect.GetComponentInChildren<TrailRenderer>(); ((Renderer)componentInChildren).materials[0].SetTexture("_RemapTex", Assets.mainAssetBundle.LoadAsset<Texture>("texRampDroneRepair")); ((Renderer)componentInChildren).materials[0].SetColor("_TintColor", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)210, (byte)40, byte.MaxValue))); OrbEffect componentInChildren2 = orbEffect.GetComponentInChildren<OrbEffect>(); componentInChildren2.onArrival = null; ContentAddition.AddEffect(orbEffect); } internal static void GetEquipmentIndex() { //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) index = EquipmentCatalog.FindEquipmentIndex("ITEM_" + itemLangTokenName); } internal static bool IsDrone(CharacterBody body) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (Config.HealSquidTurrets.Value && Object.op_Implicit((Object)(object)body.master) && (Object)(object)body.master.bodyPrefab != (Object)null) { flag = body.master.bodyPrefab == squidTurretPrefab; } return ((Enum)body.bodyFlags).HasFlag((Enum)(object)(BodyFlags)2) || flag; } internal static bool IsDroneMaster(GameObject masterPrefab) { CharacterMaster component = masterPrefab.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody component2 = component.bodyPrefab.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component2)) { return IsDrone(component2); } } return false; } internal static bool ContainsInsensitive(string element, string str) { return str.IndexOf(element, StringComparison.CurrentCultureIgnoreCase) >= 0; } internal static List<MinionGroup> GetAllMinionsOfTeam(TeamIndex team) { //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) List<MinionGroup> list = new List<MinionGroup>(); for (int i = 0; i < MinionGroup.instancesList.Count; i++) { MinionGroup val = MinionGroup.instancesList[i]; if (val.resolvedOwnerMaster.teamIndex == team) { list.Add(val); } } return list; } internal static bool HealDronesInMinionGroups(List<MinionGroup> groups, Vector3 origin) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) bool result = false; foreach (MinionGroup group in groups) { for (int i = 0; i < group.members.Length; i++) { if (!Object.op_Implicit((Object)(object)group.members[i])) { continue; } CharacterMaster component = ((Component)group.members[i]).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && IsDrone(body)) { DroneRepairOrb droneRepairOrb = new DroneRepairOrb(); ((Orb)droneRepairOrb).origin = origin; ((Orb)droneRepairOrb).target = body.mainHurtBox; droneRepairOrb.overrideDuration = travelTime; OrbManager.instance.AddOrb((Orb)(object)droneRepairOrb); result = true; } } } } return result; } internal static bool BuyDrones(Vector3 origin, Interactor interactor) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Config.BuyNearbyDrones.Value) { bool result = false; foreach (PurchaseInteraction item in dronesToPurchase) { DronePurchaseOrb dronePurchaseOrb = new DronePurchaseOrb(); ((Orb)dronePurchaseOrb).origin = origin; dronePurchaseOrb.targetTransform = ((Component)item).transform; dronePurchaseOrb.targetInteraction = item; dronePurchaseOrb.interactorComponent = interactor; dronePurchaseOrb.overrideDuration = travelTime; OrbManager.instance.AddOrb((Orb)(object)dronePurchaseOrb); result = true; } return result; } return false; } internal static Vector3 GetItemLocationOnPlayer(CharacterBody body) { //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) ModelLocator component = ((Component)body).GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform modelTransform = component.modelTransform; if (Object.op_Implicit((Object)(object)modelTransform)) { CharacterModel component2 = ((Component)modelTransform).GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component2)) { ChildLocator component3 = ((Component)modelTransform).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component3)) { DisplayRuleGroup equipmentDisplayRuleGroup = component2.itemDisplayRuleSet.GetEquipmentDisplayRuleGroup(index); if (equipmentDisplayRuleGroup.rules.Length != 0) { ItemDisplayRule val = equipmentDisplayRuleGroup.rules[0]; Transform val2 = component3.FindChild(val.childName); if (Object.op_Implicit((Object)(object)val2)) { return val2.TransformPoint(val.localPos); } } } } } } return body.transform.position; } internal static void GetPurchasableDrones(Vector3 origin) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) dronesToPurchase.Clear(); List<Collider> list = SearchForEntities(origin); for (int i = 0; i < list.Count; i++) { GameObject entity = ((Component)list[i]).GetComponent<EntityLocator>().entity; PurchaseInteraction component = entity.GetComponent<PurchaseInteraction>(); if (PurchaseInteractionIsValidTarget(component)) { SummonMasterBehavior component2 = entity.GetComponent<SummonMasterBehavior>(); if (Object.op_Implicit((Object)(object)component2) && IsDroneMaster(component2.masterPrefab)) { dronesToPurchase.Add(component); } } } } internal static bool Fire(EquipmentSlot self) { //IL_000e: 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_0014: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) bool flag = false; TeamIndex teamIndex = self.characterBody.master.teamIndex; List<MinionGroup> allMinionsOfTeam = GetAllMinionsOfTeam(teamIndex); Vector3 itemLocationOnPlayer = GetItemLocationOnPlayer(self.characterBody); bool flag2 = HealDronesInMinionGroups(allMinionsOfTeam, itemLocationOnPlayer); Interactor component = ((Component)self).GetComponent<Interactor>(); if (Object.op_Implicit((Object)(object)component)) { GetPurchasableDrones(((Component)self).transform.position); flag = BuyDrones(itemLocationOnPlayer, component); } return flag2 || flag; } public static bool IsLocalPlayer(CharacterBody body) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && Object.op_Implicit((Object)(object)firstLocalUser.cachedBody)) { return (Object)(object)firstLocalUser.cachedBody == (Object)(object)body; } return false; } public static bool PurchaseInteractionIsValidTarget(PurchaseInteraction purchaseInteraction) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 return Object.op_Implicit((Object)(object)purchaseInteraction) && (int)purchaseInteraction.costType == 1 && purchaseInteraction.cost > 0 && purchaseInteraction.available; } public static ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_001c: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07da: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_0916: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRuleDict val = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); val.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Pelvis", localPos = new Vector3(0.2175f, -0.0045f, 0.0175f), localAngles = new Vector3(354.8298f, 351.071f, 153.6583f), localScale = new Vector3(0.5746f, 0.5746f, 0.5746f) } }); val.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Chest", localPos = new Vector3(0.0956f, -0.0106f, -0.0883f), localAngles = new Vector3(0.503f, 233.7094f, 19.314f), localScale = new Vector3(0.6248f, 0.6248f, 0.6248f) } }); val.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Stomach", localPos = new Vector3(-0.0091f, -0.0117f, -0.1759f), localAngles = new Vector3(355.0262f, 273.2364f, 330.1859f), localScale = new Vector3(0.5275f, 0.5275f, 0.5275f) } }); val.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Chest", localPos = new Vector3(0.0203f, 2.481f, -1.8894f), localAngles = new Vector3(0f, 269.7144f, 0f), localScale = new Vector3(5.6187f, 5.6187f, 5.6187f) } }); val.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "HandL", localPos = new Vector3(0.0065f, 0.2228f, -0.0402f), localAngles = new Vector3(345.6203f, 277.8958f, 184.3216f), localScale = new Vector3(0.7765f, 0.7765f, 0.7765f) } }); val.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "HandR", localPos = new Vector3(0.1008f, 0.1789f, 0.07f), localAngles = new Vector3(330.0713f, 320.1326f, 127.2136f), localScale = new Vector3(0.6837f, 0.6837f, 0.6837f) } }); val.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "HandR", localPos = new Vector3(-0.0335f, 0.2721f, 0.0097f), localAngles = new Vector3(16.8619f, 262.9659f, 183.4921f), localScale = new Vector3(1.0563f, 1.0563f, 1.0563f) } }); val.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Chest", localPos = new Vector3(0.9371f, 0.2736f, 0.0983f), localAngles = new Vector3(359.6563f, 336.6284f, 0.1811f), localScale = new Vector3(1.4669f, 1.4669f, 1.4669f) } }); val.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "MechHandL", localPos = new Vector3(0.0041f, 0.3987f, 0.0199f), localAngles = new Vector3(358.7781f, 243.1165f, 177.5913f), localScale = new Vector3(1f, 1f, 1f) } }); val.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Head", localPos = new Vector3(-0.0551f, 4.8142f, -1.3362f), localAngles = new Vector3(357.288f, 270.7567f, 242.4885f), localScale = new Vector3(9.2674f, 9.2674f, 9.2674f) } }); val.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "HandR", localPos = new Vector3(0.0179f, 0.2291f, 0.0129f), localAngles = new Vector3(0f, 180f, 184.8434f), localScale = new Vector3(0.9067f, 0.9067f, 0.9067f) } }); val.Add("mdlEquipmentDrone", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "GunBarrelBase", localPos = new Vector3(0.0341f, 0.007f, 1.7296f), localAngles = new Vector3(270.9818f, 179.9671f, 180.0324f), localScale = new Vector3(2.9993f, 2.9993f, 2.9993f) } }); val.Add("mdlScav", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "HandL", localPos = new Vector3(0.5963f, 3.8427f, -0.1165f), localAngles = new Vector3(339.1429f, 250.7157f, 179.9168f), localScale = new Vector3(8.5009f, 8.5009f, 8.5009f) } }); val.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Backpack", localPos = new Vector3(-0.00407f, -0.23882f, -0.11795f), localAngles = new Vector3(0f, 268.3469f, 0f), localScale = new Vector3(0.69334f, 0.69334f, 0.69334f) } }); val.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { limbMask = (LimbFlags)0, ruleType = (ItemDisplayRuleType)0, followerPrefab = Assets.droneRepairKitDisplayPrefab, childName = "Hand", localPos = new Vector3(-0.16408f, 0.14606f, 0.03928f), localAngles = new Vector3(344.7978f, 17.61715f, 202.9038f), localScale = new Vector3(1f, 1f, 1f) } }); return val; } } }
BepinEx/plugins/HIFU-BetterJumpPads/BetterJumpPads.dll
Decompiled 11 months agousing 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.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.Networking; 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.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("BetterJumpPads")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterJumpPads")] [assembly: AssemblyTitle("BetterJumpPads")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterJumpPads { [BepInPlugin("HIFU.BetterJumpPads", "BetterJumpPads", "1.2.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.BetterJumpPads"; public const string PluginAuthor = "HIFU"; public const string PluginName = "BetterJumpPads"; public const string PluginVersion = "1.2.0"; public ManualLogSource BJPLogger; public static AssetBundle betterraincoaticon; public static BuffDef fallDamageRemoval; public void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown BJPLogger = ((BaseUnityPlugin)this).Logger; fallDamageRemoval = ScriptableObject.CreateInstance<BuffDef>(); fallDamageRemoval.isDebuff = false; fallDamageRemoval.isHidden = true; fallDamageRemoval.isCooldown = false; fallDamageRemoval.canStack = false; ((Object)fallDamageRemoval).name = "Fall Damage Removal"; ContentAddition.AddBuffDef(fallDamageRemoval); JumpVolume.OnTriggerStay += new hook_OnTriggerStay(JumpVolume_OnTriggerStay1); JumpVolume.OnTriggerStay += new Manipulator(JumpVolume_OnTriggerStay); SceneDirector.Start += new hook_Start(SceneDirector_Start); HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage); CharacterMotor.OnLanded += new hook_OnLanded(CharacterMotor_OnLanded); } private void CharacterMotor_OnLanded(orig_OnLanded orig, CharacterMotor self) { orig.Invoke(self); CharacterBody body = self.body; if (Object.op_Implicit((Object)(object)body) && NetworkServer.active && body.HasBuff(fallDamageRemoval)) { body.RemoveBuff(fallDamageRemoval); } } private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 if ((damageInfo.damageType & 0x200000) > 0 && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(fallDamageRemoval)) { damageInfo.damage = 0f; } orig.Invoke(self, damageInfo); } private void JumpVolume_OnTriggerStay1(orig_OnTriggerStay orig, JumpVolume self, Collider other) { orig.Invoke(self, other); CharacterBody component = ((Component)other).GetComponent<CharacterBody>(); if (NetworkServer.active && Object.op_Implicit((Object)(object)component) && !component.HasBuff(fallDamageRemoval)) { component.AddBuff(fallDamageRemoval); } } private void SceneDirector_Start(orig_Start orig, SceneDirector 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) Scene activeScene = SceneManager.GetActiveScene(); ApplyJumpPadChanges(((Scene)(ref activeScene)).name); orig.Invoke(self); } private void ApplyJumpPadChanges(string sceneName) { //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_082a: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) if (sceneName == null) { return; } switch (sceneName.Length) { case 11: switch (sceneName[2]) { case 'c': if (sceneName == "ancientloft") { JumpVolume component9 = ((Component)GameObject.Find("AncientLoft_Geyser (1)").transform.GetChild(0)).GetComponent<JumpVolume>(); component9.jumpVelocity = new Vector3(-40.8797f, 59.0024f, 6.0314f); JumpVolume component10 = ((Component)GameObject.Find("AncientLoft_Geyser").transform.GetChild(0)).GetComponent<JumpVolume>(); component10.jumpVelocity = new Vector3(-50.912f, 27.0073f, -50.3548f); } break; case 'o': if (sceneName == "snowyforest") { Transform transform5 = GameObject.Find("HOLDER: Geysers").transform; JumpVolume component11 = ((Component)transform5.GetChild(0).GetChild(2)).GetComponent<JumpVolume>(); component11.jumpVelocity = new Vector3(-9.5988f, 47.1578f, -9.6674f); JumpVolume component12 = ((Component)transform5.GetChild(2).GetChild(2)).GetComponent<JumpVolume>(); component12.jumpVelocity = new Vector3(-25.7586f, 45.8282f, -1.8743f); } break; case 'l': if (sceneName == "sulfurpools") { Transform transform4 = GameObject.Find("HOLDER: Geysers").transform; JumpVolume component7 = ((Component)transform4.GetChild(5).GetChild(2)).GetComponent<JumpVolume>(); component7.jumpVelocity = new Vector3(-15.6221f, 30.876f, 45.2898f); JumpVolume component8 = ((Component)transform4.GetChild(3).GetChild(2)).GetComponent<JumpVolume>(); component8.jumpVelocity = new Vector3(5.9332f, 40.0777f, -33.4413f); } break; } break; case 10: switch (sceneName[0]) { case 'f': if (sceneName == "frozenwall") { JumpVolume component5 = ((Component)GameObject.Find("PERMUTATION: Human Fan").transform.GetChild(2).GetChild(0).GetChild(0)).GetComponent<JumpVolume>(); component5.jumpVelocity = new Vector3(2.2689f, 46.7217f, 13.1013f); } break; case 'r': if (sceneName == "rootjungle") { Transform transform2 = GameObject.Find("HOLDER: Jump Pads").transform; Transform transform3 = GameObject.Find("HOLDER: Randomization").transform; JumpVolume component3 = ((Component)transform2.GetChild(1).GetChild(0)).GetComponent<JumpVolume>(); component3.jumpVelocity = new Vector3(-30f, 67f, 0.9657f); JumpVolume component4 = ((Component)transform3.GetChild(2).GetChild(0).GetChild(2) .GetChild(0)).GetComponent<JumpVolume>(); component4.jumpVelocity = new Vector3(30.5242f, 57.02f, -45.692f); } break; } break; case 9: switch (sceneName[0]) { case 's': if (sceneName == "skymeadow") { Transform transform10 = GameObject.Find("HOLDER: Jump Pads").transform; JumpVolume component28 = ((Component)transform10.GetChild(0).GetChild(2)).GetComponent<JumpVolume>(); component28.jumpVelocity = new Vector3(10.8445f, 70.7327f, 50.4467f); GameObject val = GameObject.Find("HOLDER: Randomization"); JumpVolume component29 = ((Component)val.transform.GetChild(4).GetChild(0).GetChild(3) .GetChild(2)).GetComponent<JumpVolume>(); component29.jumpVelocity = new Vector3(-140.6104f, 20.6631f, -33.7556f); JumpVolume component30 = ((Component)transform10.GetChild(4).GetChild(2)).GetComponent<JumpVolume>(); component30.jumpVelocity = new Vector3(-45.5706f, 20.4607f, 115.4046f); JumpVolume component31 = ((Component)transform10.GetChild(3).GetChild(2)).GetComponent<JumpVolume>(); component31.jumpVelocity = new Vector3(-48.1144f, 43.5799f, 6.7542f); JumpVolume component32 = ((Component)val.transform.GetChild(0).GetChild(2).GetChild(0) .GetChild(2)).GetComponent<JumpVolume>(); component32.jumpVelocity = new Vector3(-65f, 66f, -4.60673f); JumpVolume component33 = ((Component)val.transform.GetChild(0).GetChild(1).GetChild(2) .GetChild(2)).GetComponent<JumpVolume>(); component33.jumpVelocity = new Vector3(-35f, 65f, -12f); } break; case 'v': if (sceneName == "voidstage") { Transform transform9 = GameObject.Find("HOLDER: Geysers").transform; JumpVolume component21 = ((Component)transform9.GetChild(2).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component21.jumpVelocity = new Vector3(-11.56456f, 35f, 60f); JumpVolume component22 = ((Component)transform9.GetChild(0).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component22.jumpVelocity = new Vector3(11.98292f, 15f, -60f); JumpVolume component23 = ((Component)transform9.GetChild(3).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component23.jumpVelocity = new Vector3(70f, 22f, 32.141f); JumpVolume component24 = ((Component)transform9.GetChild(1).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component24.jumpVelocity = new Vector3(-3.829206f, 85f, -50f); JumpVolume component25 = ((Component)transform9.GetChild(6).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component25.jumpVelocity = new Vector3(-12.05236f, 55f, -45f); JumpVolume component26 = ((Component)transform9.GetChild(5).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component26.jumpVelocity = new Vector3(-30f, 35f, -60f); JumpVolume component27 = ((Component)transform9.GetChild(4).GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component27.jumpVelocity = new Vector3(19.65478f, 25f, 75f); } break; } break; case 13: switch (sceneName[0]) { case 's': if (sceneName == "shipgraveyard") { Transform transform7 = GameObject.Find("HOLDER: Jump Pads").transform; JumpVolume component17 = ((Component)transform7.GetChild(0).GetChild(2)).GetComponent<JumpVolume>(); component17.jumpVelocity = new Vector3(-11.1291f, 55.3482f, -40.5845f); JumpVolume component18 = ((Component)transform7.GetChild(1).GetChild(2)).GetComponent<JumpVolume>(); component18.jumpVelocity = new Vector3(2.9656f, 45.0318f, 13.4763f); } break; case 'w': if (sceneName == "wispgraveyard") { Transform transform8 = GameObject.Find("ENTIRE SCENE HOLDER").transform; JumpVolume component19 = ((Component)transform8.GetChild(4).GetChild(2).GetChild(0) .GetChild(0) .GetChild(2)).GetComponent<JumpVolume>(); component19.jumpVelocity = new Vector3(65.3068f, 46.1934f, -2.5635f); JumpVolume component20 = ((Component)transform8.GetChild(4).GetChild(3).GetChild(4) .GetChild(12) .GetChild(0) .GetChild(6) .GetChild(2)).GetComponent<JumpVolume>(); component20.jumpVelocity = new Vector3(-65.2731f, 0.442f, 7.7863f); } break; case 'a': if (sceneName == "artifactworld") { Transform transform6 = GameObject.Find("HOLDER: Geysers").transform; JumpVolume component13 = ((Component)transform6.GetChild(3).GetChild(0)).GetComponent<JumpVolume>(); component13.jumpVelocity = new Vector3(0f, 20f, -40f); JumpVolume component14 = ((Component)transform6.GetChild(4).GetChild(0)).GetComponent<JumpVolume>(); component14.jumpVelocity = new Vector3(0f, 5f, 45f); JumpVolume component15 = ((Component)transform6.GetChild(2).GetChild(0)).GetComponent<JumpVolume>(); component15.jumpVelocity = new Vector3(60f, 0f, 0f); JumpVolume component16 = ((Component)transform6.GetChild(1).GetChild(0)).GetComponent<JumpVolume>(); component16.jumpVelocity = new Vector3(15f, 40f, -11f); } break; } break; case 14: if (sceneName == "dampcavesimple") { JumpVolume component6 = ((Component)GameObject.Find("HOLDER: Geyser").transform.GetChild(2).GetChild(2)).GetComponent<JumpVolume>(); component6.jumpVelocity = new Vector3(45.2695f, 50.4077f, 35.7247f); } break; case 12: if (sceneName == "golemplains2") { Transform transform = GameObject.Find("HOLDER: Jump Pads").transform; JumpVolume component = ((Component)transform.GetChild(1).GetChild(2)).GetComponent<JumpVolume>(); component.jumpVelocity = new Vector3(38.2099f, 64.9923f, -5.1331f); JumpVolume component2 = ((Component)transform.GetChild(0).GetChild(2)).GetComponent<JumpVolume>(); component2.jumpVelocity = new Vector3(-13.4416f, 44.981f, 8.4832f); } break; } } private void JumpVolume_OnTriggerStay(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1) })) { val.Index += 1; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int useless) => 0)); } else { BJPLogger.LogError((object)"Failed to apply Jump Pad hook"); } } } }
BepinEx/plugins/HIFU-HIFUArtificerTweaks/HIFUArtificerTweaks.dll
Decompiled 11 months 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 System.Text.RegularExpressions; using ArtificerExtended.Passive; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Mage; using EntityStates.Mage.Weapon; using HIFUArtificerTweaks.Projectiles; using HIFUArtificerTweaks.Skilldefs; using HIFUArtificerTweaks.Skills; using HarmonyLib; using IL.EntityStates.Mage; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Mage; using On.EntityStates.Mage.Weapon; using R2API; using RoR2; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; [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 = ".NET Standard 2.0")] [assembly: AssemblyCompany("HIFUArtificerTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HIFUArtificerTweaks")] [assembly: AssemblyTitle("HIFUArtificerTweaks")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HIFUArtificerTweaks { public static class AddUtility { public static void Create() { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion(); SkillLocator component = val.GetComponent<SkillLocator>(); SkillFamily skillFamily = component.utility.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val2 = new Variant { skillDef = FlamewallSD.sd, unlockableName = "" }; ((Variant)(ref val2)).viewableNode = new Node(FlamewallSD.nameToken, false, (Node)null); variants[num] = val2; } } public class ConfigManager { internal static bool ConfigChanged; internal static bool VersionChanged; public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods() where x.Name == "Bind" select x).First(); methodInfo = methodInfo.MakeGenericMethod(typeof(T)); object[] parameters = new object[3] { (object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name), entry.DefaultValue, (object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>()) }; ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters); if (Main._preVersioning) { entry.BoxedValue = entry.DefaultValue; } if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged) { entry.BoxedValue = entry.DefaultValue; val.BoxedValue = val.DefaultValue; } return default(T); } private static bool ConfigEqual(object a, object b) { if (a.Equals(b)) { return true; } if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001) { return true; } return false; } } [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("HIFU.HIFUArtificerTweaks", "HIFUArtificerTweaks", "1.1.6")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.HIFUArtificerTweaks"; public const string PluginAuthor = "HIFU"; public const string PluginName = "HIFUArtificerTweaks"; public const string PluginVersion = "1.1.6"; public static ConfigFile HATConfig; public static ConfigFile HATBackupConfig; public static bool aeLoaded; public static ManualLogSource HATLogger; public static ConfigEntry<float> flamewallDamage; public static ConfigEntry<float> flamewallSpeed; public static ConfigEntry<float> flamewallProcCoeff; public static AssetBundle hifuartificertweaks; public static bool _preVersioning; public static ConfigEntry<bool> enableAutoConfig { get; set; } public static ConfigEntry<string> latestVersion { get; set; } public void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown HATLogger = ((BaseUnityPlugin)this).Logger; HATConfig = ((BaseUnityPlugin)this).Config; aeLoaded = Chainloader.PluginInfos.ContainsKey("com.Borbo.ArtificerExtended"); hifuartificertweaks = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("HIFUArtificerTweaks.dll", "hifuartificertweaks")); HATBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFUArtificerTweaks.Backup.cfg", true); HATBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :"); enableAutoConfig = HATConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFUArtificerTweaks from syncing config whenever a new version is found."); _preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HATConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version"); latestVersion = HATConfig.Bind<string>("Config", "Latest Version", "1.1.6", "DO NOT CHANGE THIS"); if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.6")) { latestVersion.Value = "1.1.6"; ConfigManager.VersionChanged = true; HATLogger.LogInfo((object)"Config Autosync Enabled."); } flamewallDamage = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Damage", 0.65f, "Decimal. Default is 0.65"); flamewallSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Speed Multiplier", 1.3f, "Default is 1.3"); flamewallProcCoeff = ((BaseUnityPlugin)this).Config.Bind<float>(": Utility :: Flamewall", "Proc Coefficient", 0.15f, "Default is 0.15"); WallOfInfernoProjectile.Create(); FlamewallSD.Create(); AddUtility.Create(); IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase)) select type; HATLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+=="); foreach (Type item in enumerable) { TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item); if (ValidateTweak(tweakBase)) { tweakBase.Init(); } } IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(MiscBase)) select type; HATLogger.LogInfo((object)"==+----------------==MISC==----------------+=="); foreach (Type item2 in enumerable2) { MiscBase miscBase = (MiscBase)Activator.CreateInstance(item2); if (ValidateMisc(miscBase)) { miscBase.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; } public bool ValidateMisc(MiscBase mb) { if (mb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(mb.Name, "Enable?", true, "Vanilla is false").Value) { return true; } return false; } private void WITHINDESTRUCTIONMYFUCKINGBELOVED() { } } public abstract class MiscBase { public abstract string Name { get; } public virtual bool isEnabled { get; } = true; public T ConfigOption<T>(T value, string name, string description) { ConfigEntry<T> val = Main.HATConfig.Bind<T>(Name, name, value, description); ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HATBackupConfig, name); return val.Value; } public abstract void Hooks(); public string d(float f) { return f * 100f + "%"; } public virtual void Init() { Hooks(); Main.HATLogger.LogInfo((object)("Added " + Name)); } } public abstract class MiscBase<T> : MiscBase where T : MiscBase<T> { public static T instance { get; set; } public MiscBase() { if (instance != null) { throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice"); } instance = this as T; } } public abstract class TweakBase { public bool done = false; public abstract string Name { get; } public abstract string SkillToken { get; } public abstract string DescText { get; } public virtual bool isEnabled { get; } = true; public T ConfigOption<T>(T value, string name, string description) { ConfigEntry<T> val = Main.HATConfig.Bind<T>(Name, name, value, description); ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HATBackupConfig, name); if (!done) { ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallDamage, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallDamage).Definition.Key); ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallSpeed, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallSpeed).Definition.Key); ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)Main.flamewallProcCoeff, Main.HATBackupConfig, ((ConfigEntryBase)Main.flamewallProcCoeff).Definition.Key); done = true; } return val.Value; } public abstract void Hooks(); public string d(float f) { return f * 100f + "%"; } public virtual void Init() { Hooks(); string text = "MAGE_" + SkillToken.ToUpper() + "_DESCRIPTION"; LanguageAPI.Add(text, DescText); Main.HATLogger.LogInfo((object)("Added " + Name)); } } public abstract class TweakBase<T> : TweakBase where T : TweakBase<T> { public static T instance { get; set; } public TweakBase() { if (instance != null) { throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice"); } instance = this as T; } } } namespace HIFUArtificerTweaks.Skills { public class CastNanoSpear : TweakBase { public static float minDamage; public static float maxDamage; public static float castTime; public override string Name => ": Secondary :: Cast Nano-Spear"; public override string SkillToken => "secondary_ice"; public override string DescText => "<style=cIsUtility>Freezing</style>. Charge up a <style=cIsDamage>piercing</style> nano-spear that deals <style=cIsDamage>" + d(minDamage) + "-" + d(maxDamage) + "</style> damage."; public override void Init() { minDamage = ConfigOption(4f, "Minimum Damage", "Decimal. Vanilla is 4"); maxDamage = ConfigOption(16f, "Maximum Damage", "Decimal. Vanilla is 12"); castTime = ConfigOption(1.3f, "Max Charge Time", "Vanilla is 2"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter); BaseThrowBombState.OnEnter += new hook_OnEnter(BaseThrowBombState_OnEnter); } private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self) { if (self is ChargeIcebomb) { self.baseDuration = castTime; } orig.Invoke(self); } private void BaseThrowBombState_OnEnter(orig_OnEnter orig, BaseThrowBombState self) { if (self is ThrowIcebomb) { self.minDamageCoefficient = minDamage; self.maxDamageCoefficient = maxDamage; } orig.Invoke(self); } } public class ChargedNanoBomb : TweakBase { public static float minDamage; public static float maxDamage; public static float castTime; public override string Name => ": Secondary :: Charged Nano-Bomb"; public override string SkillToken => "secondary_lightning"; public override string DescText => "<style=cIsDamage>Stunning</style>. Charge up a <style=cIsDamage>exploding</style> nano-bomb that deals <style=cIsDamage>" + d(minDamage) + "-" + d(maxDamage) + "</style> damage."; public override void Init() { minDamage = ConfigOption(4f, "Minimum Damage", "Decimal. Vanilla is 4"); maxDamage = ConfigOption(20f, "Maximum Damage", "Decimal. Vanilla is 20"); castTime = ConfigOption(2f, "Max Charge Time", "Vanilla is 2"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter); BaseThrowBombState.OnEnter += new hook_OnEnter(BaseThrowBombState_OnEnter); } private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self) { if (self is ChargeNovabomb) { self.baseDuration = castTime; } orig.Invoke(self); } private void BaseThrowBombState_OnEnter(orig_OnEnter orig, BaseThrowBombState self) { if (self is ThrowNovabomb) { self.minDamageCoefficient = minDamage; self.maxDamageCoefficient = maxDamage; } orig.Invoke(self); } } public class Flamethrower : TweakBase { public static float Damage; public static float BurnChance; public static float Range; public override string Name => ": Special : Flamethrower"; public override string SkillToken => "special_fire"; public override string DescText => "<style=cIsDamage>Ignite</style>. Burn all enemies in front of you for <style=cIsDamage>" + d(Damage + Damage / (1f / (BurnChance / 100f))) + " damage</style>."; public override void Init() { Damage = ConfigOption(20f, "Damage", "Decimal. Vanilla is 20"); BurnChance = ConfigOption(100f, "Ignite Chance", "Decimal. Vanilla is 50"); Range = ConfigOption(20f, "Range", "Vanilla is 20"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Flamethrower.OnEnter += new hook_OnEnter(Flamethrower_OnEnter); } private void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self) { Flamethrower.ignitePercentChance = BurnChance; Flamethrower.totalDamageCoefficient = Damage; self.maxDistance = Range; orig.Invoke(self); } } public class FlamewallState : BaseSkillState { public float duration = 2f; public float timer; public float interval = 0.25f; public float speedMultiplier = Main.flamewallSpeed.Value; private Vector3 idealDirection; public GameObject wallPrefab = WallOfInfernoProjectile.prefab; public SkillLocator sl; public override void OnEnter() { //IL_003e: 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_00f3: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); sl = ((Component)((EntityState)this).characterBody).GetComponent<SkillLocator>(); if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank)) { idealDirection = ((EntityState)this).inputBank.aimDirection; idealDirection.y = 0f; } if (Object.op_Implicit((Object)(object)sl) && sl.special.skillNameToken == "MAGE_SPECIAL_FIRE_NAME") { sl.special.skillDef.canceledFromSprinting = false; sl.special.skillDef.cancelSprintingOnActivation = false; } UpdateDirection(); } if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator)) { ((EntityState)this).modelLocator.normalizeToFloor = true; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = idealDirection; } if (Main.aeLoaded) { SkillCast(); } ((EntityState)this).characterBody.SetAimTimer(duration + 1f); ((EntityState)this).PlayAnimation("Gesture, Additive", "PrepWall", "PrepWall.playbackRate", duration); AkSoundEngine.PostEvent(2855368448u, ((EntityState)this).gameObject); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public void SkillCast() { GameObject gameObject = ((Component)((EntityState)this).outer).gameObject; if (AltArtiPassive.instanceLookup.TryGetValue(gameObject, out var value)) { value.SkillCast((BatchHandle)null); } } private void UpdateDirection() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_003b: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank)) { Vector2 val = Util.Vector3XZToVector2XY(((EntityState)this).inputBank.moveVector); if (val != Vector2.zero) { ((Vector2)(ref val)).Normalize(); Vector3 val2 = new Vector3(val.x, 0f, val.y); idealDirection = ((Vector3)(ref val2)).normalized; } } } private Vector3 GetIdealVelocity() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0027: 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) return ((EntityState)this).characterDirection.forward * ((EntityState)this).characterBody.moveSpeed * speedMultiplier; } public override void FixedUpdate() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //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_0130: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); timer += Time.fixedDeltaTime; if (!((EntityState)this).isAuthority) { return; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.isSprinting = true; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.moveVector = idealDirection; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.disableAirControlUntilCollision) { CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.rootMotion += GetIdealVelocity() * Time.fixedDeltaTime; } } UpdateDirection(); if (((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } else if (timer >= interval) { Vector3 up = Vector3.up; FireProjectileInfo val = default(FireProjectileInfo); val.projectilePrefab = wallPrefab; val.position = ((EntityState)this).characterBody.corePosition; val.rotation = Util.QuaternionSafeLookRotation(up); val.owner = ((EntityState)this).gameObject; val.damage = ((BaseState)this).damageStat; val.force = 0f; val.damageColorIndex = (DamageColorIndex)0; val.crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master); FireProjectileInfo val2 = val; ProjectileManager.instance.FireProjectile(val2); Util.PlaySound(Flamethrower.endAttackSoundString, ((EntityState)this).gameObject); timer = 0f; } } public override void OnExit() { //IL_0064: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnExit(); if (!((EntityState)this).outer.destroying && Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).PlayAnimation("Gesture, Additive", "FireWall"); } if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.disableAirControlUntilCollision) { CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += GetIdealVelocity(); } if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator)) { ((EntityState)this).modelLocator.normalizeToFloor = false; } if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)sl) && sl.special.skillNameToken == "MAGE_SPECIAL_FIRE_NAME") { sl.special.skillDef.canceledFromSprinting = true; sl.special.skillDef.cancelSprintingOnActivation = true; } AkSoundEngine.PostEvent(561188827u, ((EntityState)this).gameObject); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: 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) return (InterruptPriority)2; } } public class IonSurge : TweakBase { public static float AoE; public static float Cooldown; public static float Damage; public static float dashSpeed; public static float Duration; public static bool ScaleWithSpeed; public override string Name => ": Special :: Ion Surge"; public override string SkillToken => "special_lightning"; public override string DescText => "<style=cIsDamage>Stunning</style>. Soar and dash, dealing <style=cIsDamage>" + d(Damage) + " damage</style> in a large area."; public override void Init() { AoE = ConfigOption(14f, "Area of Effect", "Vanilla is 14"); Cooldown = ConfigOption(5f, "Cooldown", "Vanilla is 8"); Damage = ConfigOption(8f, "Damage", "Decimal. Vanilla is 8"); dashSpeed = ConfigOption(3.5f, "Dash Speed Multiplier", "Default is 3.5"); Duration = ConfigOption(0.3f, "Duration", "This affects height. Vanilla is 1.66"); ScaleWithSpeed = ConfigOption(value: false, "Make Height scale with Movement Speed?", "Vanilla is true"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown FlyUpState.OnEnter += new hook_OnEnter(FlyUpState_OnEnter); if (!ScaleWithSpeed) { FlyUpState.HandleMovements += new Manipulator(FlyUpState_HandleMovements); } Changes(); } private void FlyUpState_HandleMovements(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<BaseState>(x, "moveSpeedStat") })) { int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<float, float>>((Func<float, float>)((float orig) => 10.15f)); } else { Main.HATLogger.LogError((object)"Failed to IL hook Ion Surge Handle Movements"); } } private void FlyUpState_OnEnter(orig_OnEnter orig, FlyUpState self) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) FlyUpState.blastAttackRadius = AoE; FlyUpState.blastAttackDamageCoefficient = Damage; FlyUpState.duration = Duration; orig.Invoke(self); if (((EntityState)self).isAuthority) { Vector3 val = ((((EntityState)self).inputBank.moveVector == Vector3.zero) ? Vector3.zero : ((Vector3)(ref ((EntityState)self).inputBank.moveVector)).normalized); Vector3 velocity = ((Vector3)(ref val)).normalized * dashSpeed * ((BaseState)self).moveSpeedStat; ((BaseCharacterController)((EntityState)self).characterMotor).Motor.ForceUnground(); ((EntityState)self).characterMotor.velocity = velocity; } } private void Changes() { //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) SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFlyUp.asset").WaitForCompletion(); val.baseRechargeInterval = Cooldown; } } public class PlasmaBolt : TweakBase { public static float AoE; public static float Damage; public override string Name => ": Primary :: Plasma Bolt"; public override string SkillToken => "primary_lightning"; public override string DescText => "Fire a bolt for <style=cIsDamage>" + d(Damage) + " damage</style> that <style=cIsDamage>explodes</style> in a medium area. Hold up to 4.</style>"; public override void Init() { AoE = ConfigOption(6f, "Area of Effect", "Vanilla is 6"); Damage = ConfigOption(3f, "Damage", "Decimal. Vanilla is 2.8"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown FireFireBolt.OnEnter += new hook_OnEnter(FireFireBolt_OnEnter); Changes(); } private void FireFireBolt_OnEnter(orig_OnEnter orig, FireFireBolt self) { if (self is FireLightningBolt) { self.damageCoefficient = Damage; } orig.Invoke(self); } public static void Changes() { //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) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageLightningboltBasic.prefab").WaitForCompletion(); ((ProjectileExplosion)val.GetComponent<ProjectileImpactExplosion>()).blastRadius = AoE; } } public class Snapfreeze : TweakBase { public static float damage; public static float lifetime; public override string Name => ": Utility : Snapfreeze"; public override string SkillToken => "utility_ice"; public override string DescText => "<style=cIsUtility>Freezing</style>. Create a barrier that hurts enemies for <style=cIsDamage>" + d(damage) + " damage</style>."; public override void Init() { lifetime = ConfigOption(0.35f, "Lifetime", "Vanilla is 0.3. Wall Count = 40 * lifetime"); damage = ConfigOption(1.2f, "Damage", "Decimal. Vanilla is 1"); base.Init(); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PrepWall.OnEnter += new hook_OnEnter(PrepWall_OnEnter); Changes(); } private void PrepWall_OnEnter(orig_OnEnter orig, PrepWall self) { PrepWall.damageCoefficient = damage; orig.Invoke(self); } private void Changes() { //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) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageIcewallWalkerProjectile.prefab").WaitForCompletion(); ProjectileCharacterController component = val.GetComponent<ProjectileCharacterController>(); component.lifetime = lifetime; } } } namespace HIFUArtificerTweaks.Skilldefs { public static class FlamewallSD { public static SkillDef sd; public static string nameToken = "HAT_UTILITY_FIRE_NAME"; public static void Create() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion(); EntityStateMachine val2 = val.AddComponent<EntityStateMachine>(); val2.customName = "Wall"; val2.initialStateType = new SerializableEntityStateType(typeof(Idle)); val2.mainStateType = new SerializableEntityStateType(typeof(Idle)); sd = ScriptableObject.CreateInstance<SkillDef>(); sd.activationState = new SerializableEntityStateType(typeof(FlamewallState)); sd.activationStateMachineName = "Wall"; sd.interruptPriority = (InterruptPriority)1; sd.baseRechargeInterval = 12f; sd.baseMaxStock = 1; sd.rechargeStock = 1; sd.requiredStock = 1; sd.stockToConsume = 1; sd.resetCooldownTimerOnUse = false; sd.fullRestockOnAssign = true; sd.dontAllowPastMaxStocks = false; sd.beginSkillCooldownOnSkillEnd = true; sd.cancelSprintingOnActivation = false; sd.canceledFromSprinting = false; sd.isCombatSkill = true; sd.mustKeyPress = false; sd.icon = Main.hifuartificertweaks.LoadAsset<Sprite>("Assets/Flamewall.png"); sd.skillNameToken = nameToken; sd.skillDescriptionToken = "HAT_UTILITY_FIRE_DESCRIPTION"; sd.keywordTokens = new string[2] { "KEYWORD_IGNITE", "KEYWORD_AGILE" }; LanguageAPI.Add("HAT_UTILITY_FIRE_NAME", "Flamewall"); LanguageAPI.Add("HAT_UTILITY_FIRE_DESCRIPTION", "<style=cIsUtility>Agile</style>. <style=cIsDamage>Ignite</style>. Rush forward, summoning pillars of fire in your wake that deal <style=cIsDamage>" + Main.flamewallDamage.Value * 100f + "% damage per second</style>."); ContentAddition.AddSkillDef(sd); } } } namespace HIFUArtificerTweaks.Projectiles { public static class WallOfInfernoProjectile { public static GameObject prefab; public static float damage = Main.flamewallDamage.Value; public static float procCoeff = Main.flamewallProcCoeff.Value; public static void Create() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElementalRings/FireTornado.prefab").WaitForCompletion(), "WallOfInfernoPillar"); prefab.transform.eulerAngles = new Vector3(0f, 0f, 90f); Object.Destroy((Object)(object)prefab.GetComponent<SphereCollider>()); CapsuleCollider val = prefab.AddComponent<CapsuleCollider>(); ((Collider)val).isTrigger = false; val.center = new Vector3(0f, 0f, 0f); val.radius = 1f; val.height = 1f; Transform child = prefab.transform.GetChild(0); ((Component)child).transform.localScale = new Vector3(8.5f, 8.5f, 20f); ((Component)child).transform.localPosition = new Vector3(0f, 0f, 8f); Rigidbody component = prefab.GetComponent<Rigidbody>(); component.collisionDetectionMode = (CollisionDetectionMode)1; component.useGravity = true; component.freezeRotation = true; ConstantForce val2 = prefab.AddComponent<ConstantForce>(); val2.force = new Vector3(0f, -2500f, 0f); ProjectileStickOnImpact val3 = prefab.AddComponent<ProjectileStickOnImpact>(); val3.ignoreCharacters = true; val3.ignoreWorld = false; val3.alignNormals = false; ProjectileSimple component2 = prefab.GetComponent<ProjectileSimple>(); component2.lifetime = 7f; ProjectileDamage component3 = prefab.GetComponent<ProjectileDamage>(); component3.damageType = (DamageType)128; ProjectileOverlapAttack component4 = prefab.GetComponent<ProjectileOverlapAttack>(); component4.damageCoefficient = damage; component4.resetInterval = 1f; component4.overlapProcCoefficient = procCoeff; ProjectileController component5 = prefab.GetComponent<ProjectileController>(); GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Mage/MageFirePillarGhost.prefab").WaitForCompletion(), "WallOfInfernoPillarGhost", false); Transform child2 = val4.transform.GetChild(0); child2.localScale = new Vector3(2.5f, 4f, 2.5f); ParticleSystem component6 = ((Component)child2).GetComponent<ParticleSystem>(); VelocityOverLifetimeModule velocityOverLifetime = component6.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).speedModifier = MinMaxCurve.op_Implicit(0.5f); Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.7f), new GradientAlphaKey(1f, 0.9f), new GradientAlphaKey(0f, 1f) }); ColorOverLifetimeModule colorOverLifetime = component6.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val5); val4.transform.eulerAngles = new Vector3(0f, 0f, 90f); DestroyOnTimer val6 = val4.AddComponent<DestroyOnTimer>(); val6.duration = 7f; component5.ghostPrefab = val4; ContentAddition.AddProjectile(prefab); } } }
BepinEx/plugins/HIFU-LookStraightDown/LookStraightDown.dll
Decompiled 11 months agousing 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 HG.BlendableTypes; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; [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 = ".NET Standard 2.0")] [assembly: AssemblyCompany("LookStraightDown")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LookStraightDown")] [assembly: AssemblyTitle("LookStraightDown")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LookStraightDown { [BepInPlugin("HIFU.LookStraightDown", "LookStraightDown", "1.0.1")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.LookStraightDown"; public const string PluginAuthor = "HIFU"; public const string PluginName = "LookStraightDown"; public const string PluginVersion = "1.0.1"; public static ManualLogSource LSDLogger; public static ConfigEntry<float> minPitch { get; set; } public static ConfigEntry<float> maxPitch { get; set; } public void Awake() { //IL_0065: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown LSDLogger = ((BaseUnityPlugin)this).Logger; minPitch = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Pitch", -90f, "The minimum Y angle the camera can be positioned at. Vanilla is -70. Values below -179 probably crash the game"); maxPitch = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Pitch", 90f, "The maximum Y angle the camera can be positioned at. Vanilla is 70. Values above 179 probably crash the game"); CharacterCameraParamsData.basic.minPitch = BlendableFloat.op_Implicit(minPitch.Value); CharacterCameraParamsData.basic.maxPitch = BlendableFloat.op_Implicit(maxPitch.Value); CameraTargetParams.Awake += new hook_Awake(CameraTargetParams_Awake); } private void CameraTargetParams_Awake(orig_Awake orig, CameraTargetParams self) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) self.cameraParams.data.minPitch = BlendableFloat.op_Implicit(minPitch.Value); self.cameraParams.data.maxPitch = BlendableFloat.op_Implicit(maxPitch.Value); orig.Invoke(self); } } }
BepinEx/plugins/jiejasonliu-Reconsume/Reconsume.dll
Decompiled 11 months agousing System; 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; using EntityStates.Scrapper; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Scrapper; using On.RoR2; using RoR2; 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("Reconsume")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Reconsume")] [assembly: AssemblyTitle("Reconsume")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Reconsume; public sealed class CommonConfigData { public bool RefillOnStage; public bool CanScrap; public CommonConfigData(bool RefillOnStage, bool CanScrap) { this.RefillOnStage = RefillOnStage; this.CanScrap = CanScrap; } public CommonConfigData(ConfigEntry<bool> RefillOnStageEntry, ConfigEntry<bool> CanScrapEntry) { RefillOnStage = RefillOnStageEntry.Value; CanScrap = CanScrapEntry.Value; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.jiejasonliu.Reconsume", "Reconsume", "1.0.1")] public class Reconsume : BaseUnityPlugin { protected Dictionary<ItemDef, ItemDef> candidateItems; protected Dictionary<ItemDef, CommonConfigData> candidateItemsConfigData; protected static ConfigEntry<bool> RefillPowerElixir; protected static ConfigEntry<bool> ScrapConsumedPowerElixir; protected static ConfigEntry<float> HealStrengthPowerElixir; protected static ConfigEntry<bool> RefillDelicateWatch; protected static ConfigEntry<bool> ScrapConsumedDelicateWatch; protected static ConfigEntry<bool> RefillDiosBestFriend; protected static ConfigEntry<bool> ScrapConsumedDiosBestFriend; public void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); SetupConfiguration(); Run.Start += new hook_Start(Init_CandidateItems); SceneDirector.PopulateScene += new hook_PopulateScene(StageRestore_CandidateItems); ScrappingToIdle.OnEnter += new hook_OnEnter(DropScrap_CandidateItems); PickupPickerController.SetOptionsFromInteractor += new Manipulator(IL_ScrapperWhiteList_CandidateItems); HealthComponent.UpdateLastHitTime += new Manipulator(IL_AlterHealStrength_PowerElixir); Log.LogInfo("Reconsume::Awake() done."); } private void SetupConfiguration() { RefillPowerElixir = ((BaseUnityPlugin)this).Config.Bind<bool>("PowerElixir", "RefillPowerElixir", true, "Restore power elixir at the beginning of each stage"); ScrapConsumedPowerElixir = ((BaseUnityPlugin)this).Config.Bind<bool>("PowerElixir", "ScrapConsumedPowerElixir", true, "Allow scrapping consumed power elixirs"); HealStrengthPowerElixir = ((BaseUnityPlugin)this).Config.Bind<float>("PowerElixir", "HealStrengthPowerElixir", 0.25f, "Heal strength of power elixir (vanilla default is 0.75)"); RefillDelicateWatch = ((BaseUnityPlugin)this).Config.Bind<bool>("DelicateWatch", "RefillDelicateWatch", true, "Restore delicate watch at the beginning of each stage"); ScrapConsumedDelicateWatch = ((BaseUnityPlugin)this).Config.Bind<bool>("DelicateWatch", "ScrapConsumedDelicateWatch", true, "Allow scrapping consumed delicate watches"); RefillDiosBestFriend = ((BaseUnityPlugin)this).Config.Bind<bool>("DiosBestFriend", "RefillDiosBestFriend", false, "Restore dio's best friend at the beginning of each stage"); ScrapConsumedDiosBestFriend = ((BaseUnityPlugin)this).Config.Bind<bool>("DiosBestFriend", "ScrapConsumedDiosBestFriend", false, "Allow scrapping consumed dio's best friend"); } private void Init_CandidateItems(orig_Start orig, Run self) { orig.Invoke(self); candidateItems = new Dictionary<ItemDef, ItemDef> { { Items.HealingPotionConsumed, Items.HealingPotion }, { Items.FragileDamageBonusConsumed, Items.FragileDamageBonus }, { Items.ExtraLifeConsumed, Items.ExtraLife } }; candidateItemsConfigData = new Dictionary<ItemDef, CommonConfigData> { { Items.HealingPotionConsumed, new CommonConfigData(RefillPowerElixir, ScrapConsumedPowerElixir) }, { Items.FragileDamageBonusConsumed, new CommonConfigData(RefillDelicateWatch, ScrapConsumedDelicateWatch) }, { Items.ExtraLifeConsumed, new CommonConfigData(RefillDiosBestFriend, ScrapConsumedDiosBestFriend) } }; } private void StageRestore_CandidateItems(orig_PopulateScene orig, SceneDirector self) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) orig.Invoke(self); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster master = instance.master; Inventory inventory = master.inventory; List<ItemIndex> list = new List<ItemIndex>(inventory.itemAcquisitionOrder); foreach (ItemIndex item in list) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (candidateItems.TryGetValue(itemDef, out var value) && candidateItemsConfigData[itemDef].RefillOnStage) { int itemCount = inventory.GetItemCount(itemDef); inventory.RemoveItem(itemDef, itemCount); inventory.GiveItem(value, itemCount); } } } } private void DropScrap_CandidateItems(orig_OnEnter orig, ScrappingToIdle self) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected I4, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); foreach (KeyValuePair<ItemDef, ItemDef> candidateItem in candidateItems) { ItemDef key = candidateItem.Key; ItemDef value = candidateItem.Value; ItemIndex lastScrappedItemIndex = ((ScrapperBaseState)self).scrapperController.lastScrappedItemIndex; if (lastScrappedItemIndex == key.itemIndex) { PickupIndex val = PickupIndex.none; ItemTier tier = value.tier; ItemTier val2 = tier; switch ((int)val2) { case 0: val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapWhite"); break; case 1: val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapGreen"); break; case 2: val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapRed"); break; case 4: val = PickupCatalog.FindPickupIndex("ItemIndex.ScrapYellow"); break; } if (val != PickupIndex.none) { self.foundValidScrap = true; Transform val3 = ((BaseState)self).FindModelChild(ScrappingToIdle.muzzleString); PickupDropletController.CreatePickupDroplet(val, val3.position, Vector3.up * ScrappingToIdle.dropUpVelocityStrength + val3.forward * ScrappingToIdle.dropForwardVelocityStrength); ScrapperController scrapperController = ((ScrapperBaseState)self).scrapperController; scrapperController.itemsEaten -= 1; } } } } private void IL_ScrapperWhiteList_CandidateItems(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[3] { (Instruction c) => ILPatternMatchingExt.MatchLdarg(c, 0), (Instruction c) => ILPatternMatchingExt.MatchLdloc(c, 2), (Instruction c) => ILPatternMatchingExt.MatchCallvirt(c, "System.Collections.Generic.List`1<RoR2.PickupPickerController/Option>", "ToArray") }); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc_2); val.EmitDelegate<Action<Interactor, List<Option>>>((Action<Interactor, List<Option>>)delegate(Interactor activator, List<Option> optionList) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)activator)) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { Inventory inventory = component.inventory; List<ItemIndex> list = new List<ItemIndex>(inventory.itemAcquisitionOrder); foreach (ItemIndex item in list) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (candidateItems.TryGetValue(itemDef, out var _) && candidateItemsConfigData[itemDef].CanScrap) { optionList.Add(new Option { available = true, pickupIndex = PickupCatalog.FindPickupIndex(item) }); } } } } }); } private void IL_AlterHealStrength_PowerElixir(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = default(int); val.GotoNext(new Func<Instruction, bool>[4] { (Instruction c) => ILPatternMatchingExt.MatchLdarg(c, 0), (Instruction c) => ILPatternMatchingExt.MatchLdcR4(c, 0.75f), (Instruction c) => ILPatternMatchingExt.MatchLdloca(c, ref num), (Instruction c) => ILPatternMatchingExt.MatchInitobj(c, "RoR2.ProcChainMask") }); val.Index += 1; val.Remove(); float value = HealStrengthPowerElixir.Value; val.Emit(OpCodes.Ldc_R4, value); } }
BepinEx/plugins/JohnEdwa-RTAutoSprintEx/RTAutoSprintEx.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using EntityStates; using IL.RoR2; using IL.RoR2.UI; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using Rewired; using RoR2; 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("RTAutoSprintEx")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RTAutoSprintEx")] [assembly: AssemblyTitle("RTAutoSprintEx")] [assembly: AssemblyVersion("1.0.0.0")] namespace RTAutoSprintEx; [BepInPlugin("com.johnedwa.RTAutoSprintEx", "RTAutoSprintEx", "2.1")] public class RTAutoSprintEx : BaseUnityPlugin { private static bool RT_enabled = true; private static bool RT_visuals = true; internal HashSet<string> stateSprintDisableList = new HashSet<string>(); internal HashSet<string> stateAnimationDelayList = new HashSet<string>(); public static ConfigFile conf; public static ConfigEntry<bool> SprintInAnyDirection { get; set; } public static ConfigEntry<bool> HoldSprintToWalk { get; set; } public static ConfigEntry<bool> DisableSprintingCrosshair { get; set; } public static ConfigEntry<bool> DisableFOVChange { get; set; } public static ConfigEntry<bool> DisableSpeedlines { get; set; } public static ConfigEntry<int> CustomFOV { get; set; } public static ConfigEntry<double> SprintFOVMultiplier { get; set; } public static ConfigEntry<bool> DisableAutoSprinting { get; set; } public static ConfigEntry<bool> DisableVisualChanges { get; set; } public static ConfigEntry<string> EntityStatesSprintingDisabled { get; set; } public static ConfigEntry<string> EntityStatesSprintingDelay { get; set; } public void RT_SprintDisableMessage(string state) { stateSprintDisableList.Add(state); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Received RT_SprintDisableMessage for " + state)); } public void RT_AnimationDelayMessage(string state) { stateAnimationDelayList.Add(state); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Received RT_AnimationDelayMessage for " + state)); } private bool RT_RegisterAnimationDelay(string state) { return stateAnimationDelayList.Add(state); } private bool RT_RegisterSprintDisable(string state) { return stateSprintDisableList.Add(state); } private double SprintDelayTime(CharacterBody targetBody) { float num = 0f; EntityStateMachine[] components = ((Component)targetBody).GetComponents<EntityStateMachine>(); EntityStateMachine[] array = components; foreach (EntityStateMachine val in array) { EntityState state = val.state; if (state == null) { return num; } if (stateAnimationDelayList.Contains(((object)state).ToString())) { try { num = state.GetInstanceField<float>("duration"); } catch { } return num; } } return num; } private bool ShouldSprintBeDisabledOnThisBody(CharacterBody targetBody) { EntityStateMachine[] components = ((Component)targetBody).GetComponents<EntityStateMachine>(); bool result = false; EntityStateMachine[] array = components; foreach (EntityStateMachine val in array) { EntityState state = val.state; if (state == null) { return false; } if (stateSprintDisableList.Contains(((object)state).ToString())) { result = true; } } return result; } public void Awake() { //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown double RT_timer = 0.0; double RT_animationCancelDelay = 0.15; bool RT_isSprinting = false; bool RT_animationCancel = false; bool RT_walkToggle = false; SetupConfiguration(); RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWield"); RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWieldBase"); RT_RegisterSprintDisable("EntityStates.Toolbot.ToolbotDualWieldStart"); RT_RegisterSprintDisable("EntityStates.Toolbot.FireNailgun"); RT_RegisterSprintDisable("EntityStates.Toolbot.AimStunDrone"); RT_RegisterAnimationDelay("EntityStates.Toolbot.FireGrenadeLauncher"); RT_RegisterSprintDisable("EntityStates.Mage.Weapon.Flamethrower"); RT_RegisterSprintDisable("EntityStates.Mage.Weapon.PrepWall"); RT_RegisterAnimationDelay("EntityStates.Mage.Weapon.FireFireBolt"); RT_RegisterAnimationDelay("EntityStates.Mage.Weapon.FireLaserbolt"); RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.BasePrepSidearmRevolverState"); RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.PrepSidearmResetRevolver"); RT_RegisterSprintDisable("EntityStates.Bandit2.Weapon.PrepSidearmSkullRevolver"); RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.Bandit2FirePrimaryBase"); RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.FireShotgun2"); RT_RegisterAnimationDelay("EntityStates.Bandit2.Weapon.Bandit2FireRifle"); RT_RegisterSprintDisable("EntityStates.Engi.EngiMissilePainter.Paint"); RT_RegisterAnimationDelay("EntityStates.Engi.EngiWeapon.FireMines"); RT_RegisterAnimationDelay("EntityStates.Engi.EngiWeapon.FireSeekerGrenades"); RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortar"); RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortar2"); RT_RegisterSprintDisable("EntityStates.Treebot.Weapon.AimMortarRain"); RT_RegisterAnimationDelay("EntityStates.Treebot.Weapon.FireSyringe"); RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupAirstrike"); RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupAirstrikeAlt"); RT_RegisterSprintDisable("EntityStates.Captain.Weapon.SetupSupplyDrop"); RT_RegisterAnimationDelay("EntityStates.Croco.Slash"); RT_RegisterAnimationDelay("EntityStates.Commando.CommandoWeapon.FirePistol2"); RT_RegisterAnimationDelay("EntityStates.Loader.SwingComboFist"); RT_RegisterAnimationDelay("EntityStates.VoidSurvivor.Weapon.FireHandBeam"); RT_RegisterAnimationDelay("EntityStates.VoidSurvivor.Weapon.ChargeCorruptHandBeam"); RT_RegisterSprintDisable("EntityStates.VoidSurvivor.Weapon.FireCorruptHandBeam"); RT_RegisterAnimationDelay("EntityStates.Railgunner.Weapon.FirePistol"); RT_RegisterSprintDisable("EntityStates.Railgunner.Scope.WindUpScopeLight"); RT_RegisterSprintDisable("EntityStates.Railgunner.Scope.ActiveScopeLight"); RT_RegisterSprintDisable("EntityStates.Railgunner.Scope.WindUpScopeHeavy"); RT_RegisterSprintDisable("EntityStates.Railgunner.Scope.ActiveScopeHeavy"); PlayerCharacterMasterController.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, PlayerCharacterMasterController self) { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (RT_enabled) { InputBankTest instanceField = self.GetInstanceField<InputBankTest>("bodyInputs"); if (Object.op_Implicit((Object)(object)instanceField) && Object.op_Implicit((Object)(object)self.networkUser) && self.networkUser.localUser != null && !self.networkUser.localUser.isUIFocused) { CharacterBody instanceField2 = self.GetInstanceField<CharacterBody>("body"); if (Object.op_Implicit((Object)(object)instanceField2)) { Player inputPlayer = self.networkUser.localUser.inputPlayer; RT_isSprinting = instanceField2.isSprinting; if (!RT_isSprinting) { RT_timer += Time.deltaTime; if (RT_timer >= 0.05) { if (!RT_animationCancel) { RT_timer = 0.0 - SprintDelayTime(instanceField2); } if (RT_timer >= 0.0) { RT_isSprinting = !ShouldSprintBeDisabledOnThisBody(instanceField2); RT_animationCancel = false; RT_timer = 0.0; } } } else { RT_timer = 0.0; } if (!HoldSprintToWalk.Value && inputPlayer.GetButtonDown("Sprint") && !ShouldSprintBeDisabledOnThisBody(instanceField2)) { RT_walkToggle = !RT_walkToggle; } else if (inputPlayer.GetButton("Sprint")) { if (RT_isSprinting && HoldSprintToWalk.Value) { RT_isSprinting = false; } if (!RT_isSprinting && ShouldSprintBeDisabledOnThisBody(instanceField2)) { RT_isSprinting = true; } RT_timer = 0.0; } if (!RT_animationCancel && RT_timer < 0.0 - RT_animationCancelDelay && !inputPlayer.GetButton("PrimarySkill") && !inputPlayer.GetButton("SecondarySkill") && !inputPlayer.GetButton("SpecialSkill") && !inputPlayer.GetButton("UtilitySkill")) { RT_timer = 0.0 - RT_animationCancelDelay; RT_animationCancel = true; } if (RT_isSprinting && !SprintInAnyDirection.Value) { Vector3 aimDirection = instanceField.aimDirection; aimDirection.y = 0f; ((Vector3)(ref aimDirection)).Normalize(); Vector3 moveVector = instanceField.moveVector; moveVector.y = 0f; ((Vector3)(ref moveVector)).Normalize(); if ((instanceField2.bodyFlags & 0x20) == 0 && Vector3.Dot(aimDirection, moveVector) < self.GetInstanceField<float>("sprintMinAimMoveDot")) { RT_isSprinting = false; } } if (HoldSprintToWalk.Value && RT_walkToggle) { RT_walkToggle = false; } if (!RT_walkToggle) { ((ButtonState)(ref instanceField.sprint)).PushState(RT_isSprinting); } } } } }; CameraRigController.Update += (hook_Update)delegate(orig_Update orig, CameraRigController self) { orig.Invoke(self); if (RT_visuals) { if (CustomFOV.Value >= 1 && CustomFOV.Value <= 180) { self.baseFov = CustomFOV.Value; } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"CustomFOV value out of range!"); } } }; CrosshairManager.UpdateCrosshair += (Manipulator)delegate(ILContext il) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (RT_visuals) { ILCursor val2 = new ILCursor(il); if (DisableSprintingCrosshair.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Disabling sprinting crosshair:"); try { val2.Index = 0; val2.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_isSprinting") }); val2.Emit(OpCodes.Ldc_I4, 0); val2.Emit(OpCodes.And); } catch (Exception ex2) { Debug.LogError((object)ex2); } } } }; CameraRigController.SetSprintParticlesActive += (Manipulator)delegate(ILContext il) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (DisableSpeedlines.Value) { ILCursor val = new ILCursor(il); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Disabling Speedlines:"); try { val.Index = 0; val.Emit(OpCodes.Ret); } catch (Exception ex) { Debug.LogError((object)ex); } } }; } private void SetupConfiguration() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown string text = Paths.ConfigPath + "\\com.johnedwa.RTAutoSprintEx.cfg"; conf = new ConfigFile(text, true); HoldSprintToWalk = conf.Bind<bool>("1) Movement", "HoldSprintToWalk", true, new ConfigDescription("Walk by holding down the sprint key. If disabled, makes the Sprint key toggle AutoSprinting functionality on and off.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); SprintInAnyDirection = conf.Bind<bool>("1) Movement", "SprintInAnyDirection", false, new ConfigDescription("Cheat, Allows you to sprint in any direction. Please don't use in multiplayer.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); DisableSprintingCrosshair = conf.Bind<bool>("2) Visual", "DisableSprintingCrosshair", true, new ConfigDescription("Disables the useless special sprinting chevron crosshair.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); CustomFOV = conf.Bind<int>("2) Visual", "FOVValue", 60, new ConfigDescription("Sets a custom (vertical) FOV. Game default 60V is roughly 90H.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 180), Array.Empty<object>())); SprintFOVMultiplier = conf.Bind<double>("2) Visual", "SprintFOVMultiplier", 1.3, new ConfigDescription("Sets the sprinting FOV multiplier. Set to 1 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<double>(0.1, 2.0), Array.Empty<object>())); DisableSpeedlines = conf.Bind<bool>("2) Visual", "DisableSpeedlines", false, new ConfigDescription("Disables the speedlines effect shown when sprinting.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); DisableAutoSprinting = conf.Bind<bool>("3) Misc", "DisabledAutoSprinting", false, new ConfigDescription("Disable the AutoSprinting part of the mod.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); DisableVisualChanges = conf.Bind<bool>("3) Misc", "DisableVisualChanges", false, new ConfigDescription("Disable the FOV and visual changes of the mod.", (AcceptableValueBase)(object)new AcceptableValueList<bool>(new bool[2] { true, false }), Array.Empty<object>())); RT_enabled = !DisableAutoSprinting.Value; RT_visuals = !DisableVisualChanges.Value; if (!RT_enabled && !RT_visuals) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"DisabledAutoSprinting and DisableVisualChanges both True, the mod literally does nothing now."); } } } public static class Utils { internal static bool TryParseBool(string input, out bool result) { if (bool.TryParse(input, out result)) { return true; } if (int.TryParse(input, out var result2)) { result = result2 > 0; return true; } return false; } internal static T GetInstanceField<T>(this object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = instance.GetType().GetField(fieldName, bindingAttr); return (T)field.GetValue(instance); } internal static void SetInstanceField<T>(this object instance, string fieldName, T value) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = instance.GetType().GetField(fieldName, bindingAttr); field.SetValue(instance, value); } }
BepinEx/plugins/Judgy-WaterTweaker/WaterTweaker.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("WaterTweaker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WaterTweaker")] [assembly: AssemblyTitle("WaterTweaker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace WaterTweaker; internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } public static class RiskOfOptionsCompat { private static bool? _enabled; public static bool Enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _enabled.Value; } } public static void AddOptionStepSlider(ConfigEntry<float> configEntry, float min, float max, float increment, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntry, new StepSliderConfig { min = min, max = max, increment = increment, name = name }), "Judgy.WaterTweaker", "WaterTweaker"); } public static void AddOptionCheckbox(ConfigEntry<bool> configEntry, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry, new CheckBoxConfig { name = name }), "Judgy.WaterTweaker", "WaterTweaker"); } public static void SetModDescription(string desc) { ModSettingsManager.SetModDescription(desc, "Judgy.WaterTweaker", "WaterTweaker"); } } [BepInPlugin("Judgy.WaterTweaker", "WaterTweaker", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WaterTweakerPlugin : BaseUnityPlugin { public const string PluginGUID = "Judgy.WaterTweaker"; public const string PluginAuthor = "Judgy"; public const string PluginName = "WaterTweaker"; public const string PluginVersion = "1.2.0"; private const string MapWetlandName = "foggyswamp"; private bool tryApplyTweaksAgain; private int applyAttempts; public static ConfigEntry<float> ConfigWetlandWaterOpacity { get; set; } public static ConfigEntry<bool> ConfigWetlandWaterPP { get; set; } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); ConfigWetlandWaterOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("WaterTweaker", "WetlandWaterOpacity", 1f, "Sets the Opacity of the water in Wetland Aspect (between 0.0 and 1.0)."); ConfigWetlandWaterOpacity.SettingChanged += OnWaterSettingsChanged; ConfigWetlandWaterPP = ((BaseUnityPlugin)this).Config.Bind<bool>("WaterTweaker", "WetlandPostProcessing", true, "Enables Post Processing effects when the camera goes underwater in Wetland Aspect."); ConfigWetlandWaterPP.SettingChanged += OnWaterSettingsChanged; if (RiskOfOptionsCompat.Enabled) { RiskOfOptionsCompat.AddOptionStepSlider(ConfigWetlandWaterOpacity, 0f, 1f, 0.1f, "Wetland Water Opacity"); RiskOfOptionsCompat.AddOptionCheckbox(ConfigWetlandWaterPP, "Wetland Post Processing"); RiskOfOptionsCompat.SetModDescription("Allows you to tweak the graphics settings of Wetland Aspect's water."); } SceneManager.activeSceneChanged += OnActiveSceneChanged; Log.LogInfo("Awake done."); } public void Update() { if (tryApplyTweaksAgain) { if (TryApplyTweaksWetland() || applyAttempts >= 60) { tryApplyTweaksAgain = false; applyAttempts = 0; } else { applyAttempts++; } } } private bool TryApplyTweaksWetland() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) IEnumerable<GameObject> enumerable = from obj in Resources.FindObjectsOfTypeAll<GameObject>() where ((Object)obj).name.StartsWith("water plane", StringComparison.OrdinalIgnoreCase) select obj; Log.LogInfo($"Applying Wetland Water Tweaks to {enumerable.Count()} objects."); foreach (GameObject item in enumerable) { Transform val = item.transform.Find("PP"); if (!Object.op_Implicit((Object)(object)val)) { return false; } ((Component)val).gameObject.SetActive(ConfigWetlandWaterPP.Value); MeshRenderer component = item.GetComponent<MeshRenderer>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } Color color = ((Renderer)component).material.color; ((Renderer)component).material.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(ConfigWetlandWaterOpacity.Value)); } return true; } private void OnWaterSettingsChanged(object sender, EventArgs e) { //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) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.StartsWith("foggyswamp") && !TryApplyTweaksWetland()) { tryApplyTweaksAgain = true; } } private void OnActiveSceneChanged(Scene oldScene, Scene newScene) { if (((Scene)(ref newScene)).name.StartsWith("foggyswamp") && !TryApplyTweaksWetland()) { tryApplyTweaksAgain = true; } } private void DEBUG_GoToWetlandMap() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) IEnumerable<SceneDef> source = ((IEnumerable<SceneDef>)(object)SceneCatalog.allSceneDefs).Where((SceneDef def) => def.cachedName == "foggyswamp"); if (source.Any()) { Run.instance.AdvanceStage(source.First()); } } } [BepInPlugin("Judgy.WaterTweaker_R2API", "WaterTweaker_R2API", "1.0.0")] [R2APISubmoduleDependency(new string[] { "CommandHelper" })] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WaterTweaker_R2APIPlugin : BaseUnityPlugin { public const string PluginGUID = "Judgy.WaterTweaker_R2API"; public const string PluginAuthor = "Judgy"; public const string PluginName = "WaterTweaker_R2API"; public const string PluginVersion = "1.0.0"; public void Awake() { CommandHelper.AddToConsoleWhenReady(); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Awake done."); } [ConCommand(commandName = "watertweaker_opacity", helpText = "Set Opacity of the water in Wetland Aspect. Value must be between 0.0 and 1.0. args[0]=(float)value")] private static void CommandOpacity(ConCommandArgs args) { string text = ((ConCommandArgs)(ref args)).TryGetArgString(0); if (!string.IsNullOrWhiteSpace(text)) { if (float.TryParse(text.Trim().Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { if (result >= 0f && result <= 1f) { WaterTweakerPlugin.ConfigWetlandWaterOpacity.Value = result; Debug.Log((object)("Water Opacity set to " + result.ToString(CultureInfo.InvariantCulture))); } else { Debug.LogError((object)"Opacity value out of bounds ! Must be between 0.0 and 1.0"); } } else { Debug.LogError((object)"Couldn't parse new value as float."); } } else { Debug.Log((object)("Current Water Opacity Value: `" + WaterTweakerPlugin.ConfigWetlandWaterOpacity.Value.ToString(CultureInfo.InvariantCulture) + "`.")); } } [ConCommand(commandName = "watertweaker_pp", helpText = "Enables Post processing effects when the camera is under water in Wetland Aspect. Value must be `true`, `false`, `0` or `1`. args[0]=(bool)value")] private static void CommandPP(ConCommandArgs args) { string text = ((ConCommandArgs)(ref args)).TryGetArgString(0); if (!string.IsNullOrWhiteSpace(text)) { if (TryParseBool(text.Trim().ToLower(), out var result)) { WaterTweakerPlugin.ConfigWetlandWaterPP.Value = result; Debug.Log((object)("Water Post Processing effects now " + (result ? "enabled." : "disabled."))); } else { Debug.LogError((object)"Couldn't parse new value as bool. Value must be `true`, `false`, `0` or `1`"); } } else { Debug.Log((object)$"Post processing effects enabled : `{WaterTweakerPlugin.ConfigWetlandWaterPP.Value}`."); } } internal static bool TryParseBool(string input, out bool result) { if (bool.TryParse(input, out result)) { return true; } if (int.TryParse(input, out var result2)) { result = result2 > 0; return true; } return false; } }
BepinEx/plugins/kking117-WarBannerBuff/WarBannerBuff.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates.DeepVoidPortalBattery; using EntityStates.Missions.Arena.NullWard; using EntityStates.Missions.BrotherEncounter; using EntityStates.Missions.Moon; using On.EntityStates.DeepVoidPortalBattery; using On.EntityStates.Missions.Arena.NullWard; using On.EntityStates.Missions.BrotherEncounter; using On.EntityStates.Missions.Moon; using On.RoR2; using R2API; using RoR2; using RoR2.ContentManagement; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using WarBannerBuff.Components; using WarBannerBuff.ItemChanges; using WarBannerBuff.Modules; [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("WarBannerBuff")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WarBannerBuff")] [assembly: AssemblyTitle("WarBannerBuff")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace WarBannerBuff { [BepInPlugin("com.kking117.WarBannerBuff", "WarBannerBuff", "5.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MainPlugin : BaseUnityPlugin { public const string MODUID = "com.kking117.WarBannerBuff"; public const string MODNAME = "WarBannerBuff"; public const string MODTOKEN = "KKING117_WARBANNERBUFF_"; public const string MODVERSION = "5.1.0"; internal static ManualLogSource ModLogger; public static float RecoveryTick; public static float HealBase; public static float HealLevel; public static float HealMin; public static float RechargeBase; public static float RechargeLevel; public static float RechargeMin; public static float RegenBonus; public static float DamageBonus; public static float CritBonus; public static float ArmorBonus; public static float AttackBonus; public static float MoveBonus; public static float VoidBanner; public static float PillarBanner; public static float DeepVoidBanner; public static float BossBanner; public static float FocusBanner; public static bool Merge_Enable; public static float Merge_MinOverlap; public static float Merge_FuseMult; public void Awake() { ModLogger = ((BaseUnityPlugin)this).Logger; ReadConfig(); WarBanner.Begin(); new ContentPacks().Initialize(); } public void ReadConfig() { RecoveryTick = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Tick Interval", 0f, "Delay in seconds between each heal/recharge tick. (0 or less disables this feature)").Value; HealBase = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Heal Max Health", 0.0025f, "Heal this % amount of health based on their total health. (0.01 = 1%)").Value; HealLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Heal Level Health", 0.25f, "Heal this flat amount of health per level.").Value; HealMin = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Minimum Heal", 1f, "The minimum amount of healing to gain.").Value; RechargeBase = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Recharge Max Shield", 0f, "Recharge this % amount of shield based on their total shield. (0.01 = 1%)").Value; RechargeLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Recharge Level Shield", 0f, "Recharge this flat amount of shield per level.").Value; RechargeMin = ((BaseUnityPlugin)this).Config.Bind<float>("Healing and Recharge", "Minimum Recharge", 0f, "The minimum amount of recharge to gain.").Value; AttackBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Attack Speed Bonus", 0.3f, "Attack Speed bonus from Warbanners.").Value; MoveBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Move Speed Bonus", 0.3f, "Movement Speed bonus from Warbanners.").Value; DamageBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Damage Bonus", 2f, "Damage bonus from Warbanners. (Scales with level)").Value; CritBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Crit Bonus", 10f, "Crit bonus from Warbanners.").Value; ArmorBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Armor Bonus", 0f, "Armor bonus from Warbanners.").Value; RegenBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Stat Bonuses", "Regen Bonus", 3f, "Regen bonus from Warbanners. (Scales with level)").Value; BossBanner = ((BaseUnityPlugin)this).Config.Bind<float>("Placement Events", "Mithrix Phase Banners", 1f, "Players equipped with Warbanners will place one down at the start of Mithrix's phases. (Except the item steal phase.) (X = Banner radius multiplier for banners placed from this.) (0.0 or less disables this.)").Value; PillarBanner = ((BaseUnityPlugin)this).Config.Bind<float>("Placement Events", "Moon Pillar Banners", 0.75f, "Players equipped with Warbanners will place one down at the start of a Moon Pillar event. (X = Banner radius multiplier for banners placed from this.) (0.0 or less disables this.)").Value; DeepVoidBanner = ((BaseUnityPlugin)this).Config.Bind<float>("Placement Events", "Deep Void Signal Banners", 0.75f, "Players equipped with Warbanners will place one down at the start of a Deep Void Signal event. (X = Banner radius multiplier for banners placed from this.) (0.0 or less disables this.)").Value; VoidBanner = ((BaseUnityPlugin)this).Config.Bind<float>("Placement Events", "Void Cell Banners", 0.5f, "Players equipped with Warbanners will place one down at the start of a Void Cell event. (X = Banner radius multiplier for banners placed from this.) (0.0 or less disables this.)").Value; FocusBanner = ((BaseUnityPlugin)this).Config.Bind<float>("Placement Events", "Focus Banners", 1f, "Players equipped with Warbanners will place one down when activating the Focus in Simulacrum. (X = Banner radius multiplier for banners placed from this.) (0.0 or less disables this.)").Value; Merge_Enable = ((BaseUnityPlugin)this).Config.Bind<bool>("Banner Merging", "Enable", true, "Allow banner merging? (May cause stutters when banners are placed.)").Value; Merge_MinOverlap = ((BaseUnityPlugin)this).Config.Bind<float>("Banner Merging", "Minimum Overlap", 0.25f, "Minimum amount of overlap that banners need to merge. Values closer to 0 makes the requirement less strict. (Accepts 0-1)").Value; Merge_FuseMult = ((BaseUnityPlugin)this).Config.Bind<float>("Banner Merging", "Merge Multiplier", 0.5f, "How much radius to take from the smaller banners when merging.").Value; } } } namespace WarBannerBuff.Modules { public static class Buffs { internal static List<BuffDef> buffDefs = new List<BuffDef>(); internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool isCooldown) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.isCooldown = isCooldown; ((Object)val).name = ((Object)val).name; buffDefs.Add(val); return val; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public string identifier => "com.kking117.WarBannerBuff"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.buffDefs.Add(Buffs.buffDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } } namespace WarBannerBuff.ItemChanges { public class WarBanner { public static float OverlapDistanceMult; public static BuffDef ModdedBuff = Buffs.Warbanner; public static GameObject BannerWard = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/WardOnLevel/WarbannerWard.prefab").WaitForCompletion(); public static GameObject BuffVFX = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/WardOnLevel/WarbannerBuffEffect.prefab").WaitForCompletion(); private static string BannerWard_RefName = "(Clone)"; private static float NextRecover = 1f; public static void Begin() { ClampConfig(); CreateBuff(); UpdateText(); Hooks(); } private static void ClampConfig() { MainPlugin.Merge_FuseMult = Math.Max(0f, MainPlugin.Merge_MinOverlap); MainPlugin.Merge_FuseMult = Math.Min(1f, MainPlugin.Merge_MinOverlap); OverlapDistanceMult = 1f - MainPlugin.Merge_FuseMult; } private static void CreateBuff() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ModdedBuff = Buffs.AddNewBuff("WarBanner(Modded)", Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/WardOnLevel/bdWarbanner.asset").WaitForCompletion().iconSprite, Color.yellow, canStack: false, isDebuff: false, isCooldown: false); BannerWard.GetComponent<BuffWard>().buffDef = ModdedBuff; CharacterBody.UpdateAllTemporaryVisualEffects += new hook_UpdateAllTemporaryVisualEffects(CharacterBody_UpdateAllTemporaryVisualEffects); BannerWard_RefName = ((Object)BannerWard).name + BannerWard_RefName; } private static void Hooks() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown if (MainPlugin.RecoveryTick > 0f) { Run.Start += new hook_Start(Run_Start); Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate); HealthComponent.FixedUpdate += new hook_FixedUpdate(HealthComponent_FixedUpdate); } RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsHook); if (MainPlugin.BossBanner > 0f) { Phase1.OnEnter += new hook_OnEnter(Phase1_OnEnter); Phase2.OnEnter += new hook_OnEnter(Phase2_OnEnter); Phase3.OnEnter += new hook_OnEnter(Phase3_OnEnter); } if (MainPlugin.PillarBanner > 0f) { MoonBatteryActive.OnEnter += new hook_OnEnter(MoonBatteryActive_OnEnter); } if (MainPlugin.VoidBanner > 0f) { Active.OnEnter += new hook_OnEnter(NullWardActive_OnEnter); } if (MainPlugin.DeepVoidBanner > 0f) { BaseDeepVoidPortalBatteryState.OnEnter += new hook_OnEnter(DeepVoidPortal_OnEnter); } if (MainPlugin.FocusBanner > 0f) { InfiniteTowerRun.OnSafeWardActivated += new hook_OnSafeWardActivated(InfiniteTowerRun_OnSafeWardActivated); } if (MainPlugin.Merge_Enable) { BuffWard.Start += new hook_Start(BuffWard_Start); } } private static void UpdateText() { string text = "Drop a Warbanner on level up or starting the Teleporter event. Grants allies"; string text2 = "On <style=cIsUtility>level up</style> or starting the <style=cIsUtility>Teleporter event</style>, drop a banner that strengthens all allies within <style=cIsUtility>16m</style> <style=cStack>(+8m per stack)</style>. Grants"; List<string> list = new List<string>(); List<string> list2 = new List<string>(); if (MainPlugin.RegenBonus > 0f) { list.Add(" regen"); list2.Add(" <style=cIsHealing>regen</style>"); } if (MainPlugin.DamageBonus > 0f) { list.Add(" damage"); list2.Add(" <style=cIsDamage>damage</style>"); } if (MainPlugin.CritBonus > 0f) { list.Add(" crit chance"); list2.Add(" <style=cIsDamage>crit chance</style>"); } if (MainPlugin.AttackBonus > 0f) { list.Add(" attack speed"); list2.Add(" <style=cIsDamage>attack speed</style>"); } if (MainPlugin.MoveBonus > 0f) { list.Add(" movement speed"); list2.Add(" <style=cIsUtility>movement speed</style>"); } if (MainPlugin.ArmorBonus > 0f) { list.Add(" armor"); list2.Add(" <style=cIsHealing>armor</style>"); } for (int i = 0; i < list.Count; i++) { if (i == list.Count - 1) { text += " and"; text2 += " and"; } else if (i > 0) { text += ","; text2 += ","; } text += list[i]; text2 += list2[i]; } text += "."; text2 += "."; LanguageAPI.Add("ITEM_WARDONLEVEL_PICKUP", text); LanguageAPI.Add("ITEM_WARDONLEVEL_DESC", text2); } private static void RecalculateStatsHook(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(ModdedBuff)) { float num = sender.level - 1f; args.critAdd += MainPlugin.CritBonus; args.armorAdd += MainPlugin.ArmorBonus; args.baseDamageAdd += MainPlugin.DamageBonus * (1f + num * 0.2f); args.attackSpeedMultAdd += MainPlugin.AttackBonus; args.moveSpeedMultAdd += MainPlugin.MoveBonus; args.baseRegenAdd += MainPlugin.RegenBonus * (1f + num * 0.2f); } } private static void Run_Start(orig_Start orig, Run self) { orig.Invoke(self); NextRecover = 1f; } private static void Run_FixedUpdate(orig_FixedUpdate orig, Run self) { orig.Invoke(self); if (MainPlugin.RecoveryTick > 0f) { if (NextRecover <= 0f) { NextRecover += MainPlugin.RecoveryTick; } NextRecover -= Time.fixedDeltaTime; } } private static void HealthComponent_FixedUpdate(orig_FixedUpdate orig, HealthComponent self) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(ModdedBuff) && NextRecover <= 0f) { float num = CalculateHeal(self); if (num > 0f) { self.Heal(num, default(ProcChainMask), true); } num = CalculateRecharge(self); if (num > 0f) { self.RechargeShield(num); } } } private static float CalculateHeal(HealthComponent self) { float num = 0f; if (Object.op_Implicit((Object)(object)self.body)) { num = self.fullHealth * MainPlugin.HealBase; float num2 = self.body.level - 1f; num += MainPlugin.HealLevel * num2; if (num < MainPlugin.HealMin) { num = MainPlugin.HealMin; } } return num; } private static float CalculateRecharge(HealthComponent self) { float num = 0f; if (Object.op_Implicit((Object)(object)self.body)) { num = self.fullShield * MainPlugin.RechargeBase; float num2 = self.body.level - 1f; num += MainPlugin.RechargeLevel * num2; if (num < MainPlugin.RechargeMin) { num = MainPlugin.RechargeMin; } } return num; } private static void Phase1_OnEnter(orig_OnEnter orig, Phase1 self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.BossBanner); } private static void Phase2_OnEnter(orig_OnEnter orig, Phase2 self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.BossBanner); } private static void Phase3_OnEnter(orig_OnEnter orig, Phase3 self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.BossBanner); } private static void MoonBatteryActive_OnEnter(orig_OnEnter orig, MoonBatteryActive self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.PillarBanner); } private static void NullWardActive_OnEnter(orig_OnEnter orig, Active self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.VoidBanner); } private static void DeepVoidPortal_OnEnter(orig_OnEnter orig, BaseDeepVoidPortalBatteryState self) { orig.Invoke(self); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.DeepVoidBanner); } private static void InfiniteTowerRun_OnSafeWardActivated(orig_OnSafeWardActivated orig, InfiniteTowerRun self, InfiniteTowerSafeWardController safeWard) { orig.Invoke(self, safeWard); SpawnTeamWarBanners((TeamIndex)1, MainPlugin.FocusBanner); } private static void BuffWard_Start(orig_Start orig, BuffWard self) { orig.Invoke(self); TryMergeWithWard(self); } private static void SpawnTeamWarBanners(TeamIndex team, float sizemult) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !(sizemult > 0f)) { return; } ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(team); for (int i = 0; i < teamMembers.Count; i++) { CharacterBody body = teamMembers[i].body; if (!Object.op_Implicit((Object)(object)body)) { continue; } HealthComponent healthComponent = body.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive && Object.op_Implicit((Object)(object)body.inventory)) { int itemCount = body.inventory.GetItemCount(Items.WardOnLevel); if (itemCount > 0) { GameObject val = Object.Instantiate<GameObject>(BannerWard, ((Component)teamMembers[i]).transform.position, Quaternion.identity); val.GetComponent<TeamFilter>().teamIndex = team; val.GetComponent<BuffWard>().Networkradius = (8f + 8f * (float)itemCount) * sizemult; NetworkServer.Spawn(val); } } } } private static void TryMergeWithWard(BuffWard thisbuffWard) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) if (!NetworkServer.active || !(((Object)((Component)thisbuffWard).gameObject).name == BannerWard_RefName) || thisbuffWard.expires) { return; } TeamIndex teamIndex = thisbuffWard.teamFilter.teamIndex; List<BuffWard> list = new List<BuffWard>(); BuffWard val = thisbuffWard; BuffWard[] array = Object.FindObjectsOfType<BuffWard>(); foreach (BuffWard val2 in array) { if ((Object)(object)val2 != (Object)(object)thisbuffWard && !val2.expires && ((Object)val2).name == ((Object)thisbuffWard).name && val2.invertTeamFilter == thisbuffWard.invertTeamFilter && val2.teamFilter.teamIndex == teamIndex && IsWardInRange(val2, thisbuffWard)) { list.Add(val2); if (val2.radius > val.radius) { val = val2; } } } MainPlugin.ModLogger.LogInfo((object)("Found " + list.Count + " other banners to merge with.")); if (list.Count <= 0) { return; } float radius = val.radius; float num = 0f; if ((Object)(object)thisbuffWard != (Object)(object)val) { num += thisbuffWard.radius; } foreach (BuffWard item in list) { if ((Object)(object)item != (Object)(object)val) { num += item.radius; } item.expires = true; Object.Destroy((Object)(object)((Component)item).gameObject); } thisbuffWard.radius = radius + num * MainPlugin.Merge_FuseMult; TryMergeWithWard(thisbuffWard); } private static bool IsWardInRange(BuffWard target, BuffWard searcher) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) float num = searcher.radius * OverlapDistanceMult; float num2 = target.radius * OverlapDistanceMult; float num3 = Vector3.Distance(((Component)target).gameObject.transform.position, ((Component)searcher).gameObject.transform.position); if (num3 - num2 <= num) { return true; } if (num3 - num <= num2) { return true; } return false; } private static void CharacterBody_UpdateAllTemporaryVisualEffects(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) orig.Invoke(self); if (self.HasBuff(ModdedBuff) && !self.HasBuff(Buffs.Warbanner)) { WarBannerBuffVFX warBannerBuffVFX = ((Component)self).GetComponent<WarBannerBuffVFX>(); if ((Object)(object)warBannerBuffVFX == (Object)null) { warBannerBuffVFX = ((Component)self).gameObject.AddComponent<WarBannerBuffVFX>(); } if ((Object)(object)warBannerBuffVFX.effect == (Object)null) { GameObject val = Object.Instantiate<GameObject>(BuffVFX, self.corePosition, Quaternion.identity); warBannerBuffVFX.effect = val.GetComponent<TemporaryVisualEffect>(); warBannerBuffVFX.effect.parentTransform = self.coreTransform; warBannerBuffVFX.effect.visualState = (VisualState)0; warBannerBuffVFX.effect.healthComponent = self.healthComponent; warBannerBuffVFX.effect.radius = self.radius; LocalCameraEffect component = val.GetComponent<LocalCameraEffect>(); if (Object.op_Implicit((Object)(object)component)) { component.targetCharacter = ((Component)self).gameObject; } } } else { WarBannerBuffVFX component2 = ((Component)self).GetComponent<WarBannerBuffVFX>(); if ((Object)(object)component2 != (Object)null) { component2.effect.visualState = (VisualState)1; } } } } } namespace WarBannerBuff.Components { public class WarBannerBuffVFX : MonoBehaviour { public TemporaryVisualEffect effect; } }
BepinEx/plugins/konomiyu-FreeNewtAltars/FreeNewtAltars.dll
Decompiled 11 months agousing System; 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 On.RoR2; using RoR2; 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("FreeNewtAltars")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FreeNewtAltars")] [assembly: AssemblyTitle("FreeNewtAltars")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ExamplePlugin { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } } namespace FreeNewtAltars { [BepInPlugin("konomiyu.FreeNewtAltars", "FreeNewtAltars", "1.1.0")] public class FreeNewtAltars : BaseUnityPlugin { public const string PluginGUID = "konomiyu.FreeNewtAltars"; public const string PluginAuthor = "konomiyu"; public const string PluginName = "FreeNewtAltars"; public const string PluginVersion = "1.1.0"; private static ConfigEntry<int> NewtAltarPrice; private static ConfigEntry<int> MinimumStageCount; private static ConfigEntry<bool> StageMode; private static ConfigEntry<bool> After; public void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown ((BaseUnityPlugin)this).Config.Bind<int>("", "NewtAltarPrice", 0, new ConfigDescription("Determines the price of newt altars", (AcceptableValueBase)null, Array.Empty<object>())); ((BaseUnityPlugin)this).Config.Remove(new ConfigDefinition("", "NewtAltarPrice")); NewtAltarPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Price", "NewtAltarPrice", 0, new ConfigDescription("Determines the price of newt altars", (AcceptableValueBase)null, Array.Empty<object>())); StageMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage", "UseStage", false, new ConfigDescription("Determines if the mod is active before/after a set stage", (AcceptableValueBase)null, Array.Empty<object>())); MinimumStageCount = ((BaseUnityPlugin)this).Config.Bind<int>("Stage", "Stage", 5, (ConfigDescription)null); After = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage", "Before/After", true, new ConfigDescription("false = before\ntrue = after", (AcceptableValueBase)null, Array.Empty<object>())); SceneDirector.Start += new hook_Start(SceneDirector_Start); } private static void SceneDirector_Start(orig_Start orig, SceneDirector self) { orig.Invoke(self); AdjustNewtPrice(); } private static void AdjustNewtPrice() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) int num = Run.instance.stageClearCount + 1; if (StageMode.Value && ((num <= MinimumStageCount.Value && After.Value) || (num > MinimumStageCount.Value && !After.Value))) { return; } List<PurchaseInteraction> instancesList = InstanceTracker.GetInstancesList<PurchaseInteraction>(); foreach (PurchaseInteraction item in instancesList) { if (((Object)item).name.StartsWith("NewtStatue")) { item.cost = NewtAltarPrice.Value; if (NewtAltarPrice.Value == 0) { item.costType = (CostTypeIndex)0; } } } } } }
BepinEx/plugins/MagnusMagnuson-BazaarPrinter/BazaarPrinter.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BazaarPrinter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BazaarPrinter")] [assembly: AssemblyTitle("BazaarPrinter")] [assembly: AssemblyVersion("1.0.0.0")] namespace BazaarPrinter; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.MagnusMagnuson.BazaarPrinter", "BazaarPrinter", "0.3.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class BazaarPrinter : BaseUnityPlugin { private Random r = new Random(); private Dictionary<int, PrinterInfo> printerPosAndRot = new Dictionary<int, PrinterInfo>(); private string[] duplicators = new string[4] { "iscDuplicator", "iscDuplicatorLarge", "iscDuplicatorMilitary", "iscDuplicatorWild" }; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ModConfig.InitConfig(((BaseUnityPlugin)this).Config); BazaarController.Awake += new hook_Awake(BazaarController_Start); } private void BazaarController_Start(orig_Awake orig, BazaarController self) { orig.Invoke(self); if (NetworkServer.active) { SpawnPrinters(); } } private void FillPrinterInfo() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) List<int> list = new List<int> { 0, 1, 2, 3 }; List<int> list2 = new List<int>(); while (list.Count > 0) { int index = r.Next(list.Count); list2.Add(list[index]); list.RemoveAt(index); } PrinterInfo printerInfo = new PrinterInfo(); printerInfo.position = new Vector3(-133.3f, -25.7f, -17.9f); printerInfo.rotation = new Vector3(0f, 72.6f, 0f); printerPosAndRot.Add(list2[0], printerInfo); printerInfo = new PrinterInfo(); printerInfo.position = new Vector3(-71.3f, -24.7f, -29.2f); printerInfo.rotation = new Vector3(0f, 291f, 0f); printerPosAndRot.Add(list2[1], printerInfo); printerInfo = new PrinterInfo(); printerInfo.position = new Vector3(-143.8f, -24.7f, -23.6f); printerInfo.rotation = new Vector3(0f, 61f, 0f); printerPosAndRot.Add(list2[2], printerInfo); printerInfo = new PrinterInfo(); printerInfo.position = new Vector3(-110.7f, -26.7f, -46.4f); printerInfo.rotation = new Vector3(0f, 32.2f, 0f); printerPosAndRot.Add(list2[3], printerInfo); } private void SpawnPrinters() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0035: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) printerPosAndRot.Clear(); FillPrinterInfo(); for (int i = 0; i < ModConfig.printerCount.Value; i++) { string randomDuplicator = GetRandomDuplicator(); SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/" + randomDuplicator); DirectorPlacementRule val2 = new DirectorPlacementRule(); val2.placementMode = (PlacementMode)0; val.DoSpawn(printerPosAndRot[i].position, Quaternion.identity, new DirectorSpawnRequest(val, val2, Run.instance.runRNG)).spawnedInstance.transform.eulerAngles = printerPosAndRot[i].rotation; } } private string GetRandomDuplicator() { double num = ModConfig.tier1Chance.Value + ModConfig.tier2Chance.Value + ModConfig.tier3Chance.Value + ModConfig.tierBossChance.Value; double num2 = r.NextDouble() * num; if (num2 <= (double)ModConfig.tier1Chance.Value) { return duplicators[0]; } if (num2 <= (double)(ModConfig.tier1Chance.Value + ModConfig.tier2Chance.Value)) { return duplicators[1]; } if (num2 <= (double)(ModConfig.tier1Chance.Value + ModConfig.tier2Chance.Value + ModConfig.tier3Chance.Value)) { return duplicators[2]; } return duplicators[3]; } } internal class PrinterInfo { public Vector3 position; public Vector3 rotation; } internal class ModConfig { public static ConfigEntry<int> printerCount; public static ConfigEntry<float> tier1Chance; public static ConfigEntry<float> tier2Chance; public static ConfigEntry<float> tier3Chance; public static ConfigEntry<float> tierBossChance; public static void InitConfig(ConfigFile config) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown printerCount = config.Bind<int>("Config", "printerCount", 1, new ConfigDescription("Set how many 3D Printers should spawn in the bazaar. Maximum is 4", (AcceptableValueBase)null, Array.Empty<object>())); printerCount.Value = Math.Abs(printerCount.Value); if (printerCount.Value > 4) { printerCount.Value = 4; } tier1Chance = config.Bind<float>("Config", "tier1Chance", 0.7f, new ConfigDescription("Set how likely it is for a bazaar 3D Printer to be tier 1", (AcceptableValueBase)null, Array.Empty<object>())); tier1Chance.Value = Math.Abs(tier1Chance.Value); tier2Chance = config.Bind<float>("Config", "tier2Chance", 0.2f, new ConfigDescription("Set how likely it is for a bazaar 3D Printer to be tier 2", (AcceptableValueBase)null, Array.Empty<object>())); tier2Chance.Value = Math.Abs(tier2Chance.Value); tier3Chance = config.Bind<float>("Config", "tier3Chance", 0.05f, new ConfigDescription("Set how likely it is for a bazaar 3D Printer to be tier 3", (AcceptableValueBase)null, Array.Empty<object>())); tier3Chance.Value = Math.Abs(tier3Chance.Value); tierBossChance = config.Bind<float>("Config", "tierBossChance", 0.05f, new ConfigDescription("Set how likely it is for a bazaar 3D Printer to be boss tier", (AcceptableValueBase)null, Array.Empty<object>())); tierBossChance.Value = Math.Abs(tierBossChance.Value); } }
BepinEx/plugins/MagnusMagnuson-BiggerBazaar/BiggerBazaar.dll
Decompiled 11 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using Mono.Cecil.Cil; using MonoMod.Utils; using On.EntityStates.CaptainSupplyDrop; using On.RoR2; using R2API.Utils; using RoR2; using ShareSuite; using Unity; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BiggerBazaar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BiggerBazaar")] [assembly: AssemblyTitle("BiggerBazaar")] [assembly: AssemblyVersion("1.0.0.0")] namespace BiggerBazaar; internal class Bazaar : MonoBehaviour { private List<BazaarItem> bazaarItems = new List<BazaarItem>(); private List<GameObject> displayItems = new List<GameObject>(); private List<Vector3> bazaarItemPositions = new List<Vector3>(); private List<Vector3> bazaarItemRotations = new List<Vector3>(); private List<BazaarPlayer> bazaarPlayers = new List<BazaarPlayer>(); private readonly Random r = new Random(); private int bazaarItemAmount = ((ModConfig.chestAmount.Value >= 1 && ModConfig.chestAmount.Value <= 6) ? ModConfig.chestAmount.Value : 6); private GameObject moneyLunarPod; private Vector3 moneyPodPosition = new Vector3(-118.9f, -23.4f, -45.4f); public bool isUsingexperimentalScaling; private int priceScaledLunarPodBaseCost; private Dictionary<ItemTier, float> tierRatio = new Dictionary<ItemTier, float>(); private BarrelInteraction barrelInteraction; public float CurrentDifficultyCoefficient { get; set; } public Bazaar() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) FillBazaarItemPositionsAndRotations(); } private void SpawnBazaarItemAt(Vector3 position, Vector3 rotation, PickupTier pickupTier, int cost, BiggerBazaar biggerBazaar) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) SpawnCard val = ((ModConfig.chestCostType.Value != 0) ? Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscLunarChest") : Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscChest1")); DirectorPlacementRule val2 = new DirectorPlacementRule(); val2.placementMode = (PlacementMode)0; GameObject spawnedInstance = val.DoSpawn(position, Quaternion.Euler(new Vector3(0f, 0f, 0f)), new DirectorSpawnRequest(val, val2, Run.instance.runRNG)).spawnedInstance; spawnedInstance.transform.eulerAngles = rotation; List<PickupIndex> availableItems = GetAvailableItems(pickupTier); int index = r.Next(availableItems.Count); PickupIndex val3 = availableItems[index]; GameObject val4 = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/NetworkedObjects/GenericPickup"), position, Quaternion.identity); ((Component)val4.GetComponent<GenericPickupController>()).transform.Translate(-2f, 4f, -3f, (Space)0); displayItems.Add(val4); NetworkServer.Spawn(val4); GenericPickupController component = val4.GetComponent<GenericPickupController>(); val4.GetComponent<GenericPickupController>().NetworkpickupIndex = PickupIndex.none; ((MonoBehaviour)biggerBazaar).StartCoroutine(DelayPickupIndexSetupForDisplayItems(component, val3)); PurchaseInteraction component2 = spawnedInstance.GetComponent<PurchaseInteraction>(); if (ModConfig.chestCostType.Value == 1) { component2.costType = (CostTypeIndex)3; component2.Networkcost = cost; } else if (cost == -1) { if (ModConfig.nextLevelChestPriceScaling.Value) { component2.Networkcost = Run.instance.GetDifficultyScaledCost(component2.cost); component2.Networkcost = (int)((float)component2.Networkcost * ModConfig.GetTierUnitConfig(pickupTier).cost); } else { component2.Networkcost = GetDifficultyScaledCostFromItemTier(component2.cost); component2.Networkcost = (int)((float)component2.Networkcost * ModConfig.GetTierUnitConfig(pickupTier).cost); } } else { component2.Networkcost = GetDifficultyScaledCost(cost); } BazaarItem bazaarItem = new BazaarItem(); bazaarItem.chestBehavior = spawnedInstance.GetComponent<ChestBehavior>(); bazaarItem.genericPickupController = val4.GetComponent<GenericPickupController>(); bazaarItem.pickupIndex = val3; bazaarItem.purchaseCount = 0; bazaarItem.maxPurchases = ModConfig.GetTierUnitConfig(pickupTier).maxChestPurchases; bazaarItems.Add(bazaarItem); } private IEnumerator DelayPickupIndexSetupForDisplayItems(GenericPickupController gpc_, PickupIndex rPickupIndex) { //IL_000e: 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) yield return (object)new WaitForSeconds(2f); gpc_.NetworkpickupIndex = rPickupIndex; } private List<PickupIndex> GetAvailableItems(PickupTier pickupTier) { return pickupTier switch { PickupTier.Tier1 => Run.instance.availableTier1DropList, PickupTier.Tier2 => Run.instance.availableTier2DropList, PickupTier.Tier3 => Run.instance.availableTier3DropList, PickupTier.Boss => Run.instance.availableBossDropList, PickupTier.Lunar => Run.instance.availableLunarItemDropList, PickupTier.Equipment => Run.instance.availableEquipmentDropList, PickupTier.LunarEquipment => Run.instance.availableLunarEquipmentDropList, _ => null, }; } private void SpawnMoneyLunarPod(Vector3 moneyPodPosition) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscLunarChest"); DirectorPlacementRule val2 = new DirectorPlacementRule(); val2.placementMode = (PlacementMode)0; moneyLunarPod = val.DoSpawn(moneyPodPosition, Quaternion.identity, new DirectorSpawnRequest(val, val2, Run.instance.runRNG)).spawnedInstance; PurchaseInteraction component = moneyLunarPod.GetComponent<PurchaseInteraction>(); component.costType = (CostTypeIndex)3; component.Networkcost = 1; displayItems.Add(moneyLunarPod); } private void FillBazaarItemPositionsAndRotations() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) bazaarItemPositions.Add(new Vector3(-99.1f, -26f, -54.6f)); bazaarItemPositions.Add(new Vector3(-95f, -26.2f, -57.7f)); bazaarItemPositions.Add(new Vector3(-90.9f, -26f, -60.7f)); bazaarItemPositions.Add(new Vector3(-86.5f, -26.2f, -63.8f)); bazaarItemPositions.Add(new Vector3(-82.3f, -25f, -67f)); bazaarItemPositions.Add(new Vector3(-78f, -24.7f, -70.3f)); bazaarItemRotations.Add(new Vector3(0f, 34.4f, 0f)); bazaarItemRotations.Add(new Vector3(0f, 35.2f, 0f)); bazaarItemRotations.Add(new Vector3(0f, 36f, 0f)); bazaarItemRotations.Add(new Vector3(0f, 37.4f, 0f)); bazaarItemRotations.Add(new Vector3(0f, 38.2f, 0f)); bazaarItemRotations.Add(new Vector3(0f, 37.2f, 0f)); } private List<PickupTier> PickRandomWeightedBazaarItemTiers(int bazaarItemAmount) { TierContainer tierContainer = new TierContainer(); List<PickupTier> list = new List<PickupTier>(); if (tierContainer.totalRarity == 0f) { return null; } for (int i = 0; i < bazaarItemAmount; i++) { double num = r.NextDouble() * (double)tierContainer.totalRarity; foreach (TemporaryTierUnit tierUnit in tierContainer.tierUnits) { if (num <= (double)tierUnit.rarity) { list.Add(tierUnit.pickupTier); break; } num -= (double)tierUnit.rarity; } } return list; } internal void ShareSuiteMoneyFix(Interactor activator, int money) { barrelInteraction.goldReward = money; barrelInteraction.expReward = 0u; barrelInteraction.OnInteractionBegin(activator); barrelInteraction.Networkopened = false; } private int GetDifficultyScaledCostFromItemTier(int baseCost) { return (int)((double)baseCost * (double)Mathf.Pow(CurrentDifficultyCoefficient, 1.25f)); } internal bool PlayerHasTierPurchasesLeft(PickupTier pickupTier, BazaarPlayer bazaarPlayer) { switch (pickupTier) { case PickupTier.Tier1: if (ModConfig.maxPlayerPurchasesTier1.Value == -1 || bazaarPlayer.tier1Purchases < ModConfig.maxPlayerPurchasesTier1.Value) { return true; } break; case PickupTier.Tier2: if (ModConfig.maxPlayerPurchasesTier2.Value == -1 || bazaarPlayer.tier2Purchases < ModConfig.maxPlayerPurchasesTier2.Value) { return true; } break; case PickupTier.Tier3: if (ModConfig.maxPlayerPurchasesTier3.Value == -1 || bazaarPlayer.tier3Purchases < ModConfig.maxPlayerPurchasesTier3.Value) { return true; } break; case PickupTier.Boss: if (ModConfig.maxPlayerPurchasesTierBoss.Value == -1 || bazaarPlayer.tierBossPurchases < ModConfig.maxPlayerPurchasesTierBoss.Value) { return true; } break; case PickupTier.Lunar: if (ModConfig.maxPlayerPurchasesTierLunar.Value == -1 || bazaarPlayer.tierLunarPurchases < ModConfig.maxPlayerPurchasesTierLunar.Value) { return true; } break; case PickupTier.Equipment: if (ModConfig.maxPlayerPurchasesTierEquipment.Value == -1 || bazaarPlayer.tierEquipmentPurchases < ModConfig.maxPlayerPurchasesTierEquipment.Value) { return true; } break; case PickupTier.LunarEquipment: if (ModConfig.maxPlayerPurchasesTierLunarEquipment.Value == -1 || bazaarPlayer.tierLunarEquipmentPurchases < ModConfig.maxPlayerPurchasesTierLunarEquipment.Value) { return true; } break; } return false; } private int GetDifficultyScaledCost(int baseCost) { return (int)((double)baseCost * (double)Mathf.Pow(CurrentDifficultyCoefficient, 1.25f)); } private uint GetDifficultyUnscaledCost(uint cost) { return (uint)((double)cost / (double)Mathf.Pow(CurrentDifficultyCoefficient, 1.25f)); } private void CreateBazaarPlayers() { for (int i = 0; i < PlayerCharacterMasterController.instances.Count; i++) { PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[i]; BazaarPlayer item; if (!ModConfig.disableTransferMoney.Value) { item = new BazaarPlayer(val.networkUser, val.master.money); val.master.money = 0u; } else { item = new BazaarPlayer(val.networkUser, 0u); } bazaarPlayers.Add(item); } } public bool IsDisplayItem(GameObject gameObject) { if (displayItems.Contains(gameObject)) { return true; } return false; } public void ResetBazaarPlayers() { bazaarPlayers.Clear(); CreateBazaarPlayers(); } public List<BazaarItem> GetBazaarItems() { return bazaarItems; } public int GetBazaarItemAmount() { return bazaarItemAmount; } public bool IsChestStillAvailable(BazaarItem bazaarItem) { if (bazaarItem.maxPurchases == -1 || bazaarItem.purchaseCount < bazaarItem.maxPurchases) { return true; } return false; } public bool IsMoneyLunarPodAvailable() { return (Object)(object)moneyLunarPod != (Object)null; } public bool IsMoneyLunarPod(GameObject gameObject) { if ((Object)(object)moneyLunarPod != (Object)null && (Object)(object)gameObject == (Object)(object)((Component)moneyLunarPod.GetComponent<PurchaseInteraction>()).gameObject) { return true; } return false; } public bool IsMoneyLunarPod(Vector3 PodPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = PodPosition - moneyPodPosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; float num = 3f; if (sqrMagnitude < num * num) { return true; } return false; } public bool PlayerHasPurchasesLeft(BazaarPlayer bazaarPlayer) { if (ModConfig.maxPlayerPurchases.Value > -1 && bazaarPlayer.chestPurchases >= ModConfig.maxPlayerPurchases.Value) { return false; } return true; } public BazaarPlayer GetBazaarPlayer(NetworkUser networkUser) { for (int i = 0; i < bazaarPlayers.Count; i++) { if ((Object)(object)bazaarPlayers[i].networkUser == (Object)(object)networkUser) { return bazaarPlayers[i]; } } return null; } public int GetLunarCoinExchangeMoney() { if (!isUsingexperimentalScaling) { return GetDifficultyScaledCost(ModConfig.lunarCoinWorth.Value); } return GetDifficultyScaledCost(priceScaledLunarPodBaseCost); } public List<BazaarPlayer> GetBazaarPlayers() { return bazaarPlayers; } private void ClearBazaarItems() { displayItems.Clear(); bazaarItems.Clear(); } public void StartBazaar(BiggerBazaar biggerBazaar) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_012a: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) isUsingexperimentalScaling = false; if (!ModConfig.disableTransferMoney.Value) { for (int i = 0; i < PlayerCharacterMasterController.instances.Count; i++) { int num = 0; while (num < bazaarPlayers.Count) { if (!((Object)(object)bazaarPlayers[num].networkUser == (Object)(object)PlayerCharacterMasterController.instances[i].networkUser)) { num++; continue; } goto IL_004c; } continue; IL_004c: if (!ModConfig.IsShareSuiteMoneySharing()) { PlayerCharacterMasterController.instances[i].master.money = bazaarPlayers[num].money; continue; } ((MonoBehaviour)biggerBazaar).StartCoroutine(TriggerInteractorBarrelInteraction(PlayerCharacterMasterController.instances[i].master, (int)bazaarPlayers[num].money)); break; } } if (ModConfig.isShareSuiteLoaded) { SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscBarrel1"); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(200f, 200f, 200f); DirectorPlacementRule val3 = new DirectorPlacementRule(); val3.placementMode = (PlacementMode)0; GameObject spawnedInstance = val.DoSpawn(val2, Quaternion.identity, new DirectorSpawnRequest(val, val3, Run.instance.runRNG)).spawnedInstance; barrelInteraction = spawnedInstance.GetComponent<BarrelInteraction>(); } ClearBazaarItems(); List<PickupTier> list = PickRandomWeightedBazaarItemTiers(bazaarItemAmount); if (!AreAnyItemsAvailable() || list == null) { return; } if (ModConfig.chestCostType.Value == 1) { for (int j = 0; j < list.Count; j++) { SpawnBazaarItemAt(bazaarItemPositions[j], bazaarItemRotations[j], list[j], ModConfig.GetTierUnitConfig(list[j]).costLunar, biggerBazaar); } } else { for (int k = 0; k < list.Count; k++) { SpawnBazaarItemAt(bazaarItemPositions[k], bazaarItemRotations[k], list[k], -1, biggerBazaar); } } if (ModConfig.maxLunarExchanges.Value != 0) { SpawnMoneyLunarPod(moneyPodPosition); } } [MethodImpl(MethodImplOptions.NoInlining)] private int GetShareSuiteSharedMoneyValue() { return MoneySharingHooks.SharedMoneyValue; } public static bool AreAnyItemsAvailable() { return Run.instance.availableTier1DropList.Count + Run.instance.availableTier2DropList.Count + Run.instance.availableTier3DropList.Count + Run.instance.availableBossDropList.Count + Run.instance.availableLunarItemDropList.Count + Run.instance.availableEquipmentDropList.Count + Run.instance.availableLunarEquipmentDropList.Count != 0; } public IEnumerator TriggerInteractorBarrelInteraction(CharacterMaster master, int money) { yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)master.GetBody() != (Object)null)); yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)master.GetBody()).gameObject.GetComponentInChildren<Interactor>() != (Object)null)); MoneySharingHooks.AddMoneyExternal(money); } public void CalcDifficultyCoefficient() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Run instance = Run.instance; float runStopwatch = instance.GetRunStopwatch(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(instance.selectedDifficulty); float num = Mathf.Floor(runStopwatch * (1f / 60f)); float num2 = (float)instance.participatingPlayerCount * 0.3f; float num3 = 0.7f + num2; float num4 = Mathf.Pow((float)instance.participatingPlayerCount, 0.2f); float num5 = 0.046f * difficultyDef.scalingValue * num4; _ = difficultyDef.scalingValue; float num6 = Mathf.Pow(1.15f, (float)instance.stageClearCount); CurrentDifficultyCoefficient = (num3 + num5 * num) * num6; } } internal class BazaarItem { public GenericPickupController genericPickupController; public ChestBehavior chestBehavior; public PickupIndex pickupIndex; public int purchaseCount; public int maxPurchases; } internal class BazaarPlayer { public uint money; public NetworkUser networkUser; public int lunarExchanges; public int chestPurchases; public int tier1Purchases; public int tier2Purchases; public int tier3Purchases; public int tierBossPurchases; public int tierLunarPurchases; public int tierEquipmentPurchases; public int tierLunarEquipmentPurchases; public BazaarPlayer(NetworkUser networkUser, uint money) { this.money = money; this.networkUser = networkUser; lunarExchanges = 0; chestPurchases = 0; tier1Purchases = 0; tier2Purchases = 0; tier3Purchases = 0; tierBossPurchases = 0; tierLunarPurchases = 0; tierEquipmentPurchases = 0; tierLunarEquipmentPurchases = 0; } internal void IncreaseTierPurchase(PickupTier pickupTier) { switch (pickupTier) { case PickupTier.Tier1: tier1Purchases++; break; case PickupTier.Tier2: tier2Purchases++; break; case PickupTier.Tier3: tier3Purchases++; break; case PickupTier.Boss: tierBossPurchases++; break; case PickupTier.Lunar: tierLunarPurchases++; break; case PickupTier.Equipment: tierEquipmentPurchases++; break; case PickupTier.LunarEquipment: tierLunarEquipmentPurchases++; break; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.MagnusMagnuson.BiggerBazaar", "BiggerBazaar", "1.13.13")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class BiggerBazaar : BaseUnityPlugin { private Bazaar bazaar; private void Start() { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Key == "com.funkfrog_sipondo.sharesuite") { ModConfig.SetShareSuiteReference(pluginInfo.Value.Instance); } else if (pluginInfo.Key == "com.Varna.EphemeralCoins") { ModConfig.SetEphemeralCoinsReference(pluginInfo.Value.Instance); } } } public void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown ModConfig.InitConfig(((BaseUnityPlugin)this).Config); bazaar = new Bazaar(); SceneExitController.Begin += new hook_Begin(SceneExitController_Begin); Run.AdvanceStage += new hook_AdvanceStage(Run_AdvanceStage); SceneDirector.Start += new hook_Start(SceneDirector_Start); PickupDisplay.SetPickupIndex += new hook_SetPickupIndex(PickupDisplay_SetPickupIndex); ChestBehavior.Open += new hook_Open(ChestBehavior_Open); ChestBehavior.PickFromList += new hook_PickFromList(ChestBehavior_PickFromList); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); GenericPickupController.AttemptGrant += new hook_AttemptGrant(GenericPickupController_AttemptGrant); FireworkLauncher.FireMissile += new hook_FireMissile(FireworkLauncher_FireMissile); BazaarController.SetUpSeerStations += new hook_SetUpSeerStations(BazaarController_SetUpSeerStations); HackingMainState.PurchaseInteractionIsValidTarget += new hook_PurchaseInteractionIsValidTarget(HackingMainState_PurchaseInteractionIsValidTarget); } private bool HackingMainState_PurchaseInteractionIsValidTarget(orig_PurchaseInteractionIsValidTarget orig, PurchaseInteraction purchaseInteraction) { if (isCurrentStageBazaar()) { return false; } return orig.Invoke(purchaseInteraction); } private void SceneExitController_Begin(orig_Begin orig, SceneExitController self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)self.destinationScene) && self.destinationScene.baseSceneName.Contains("bazaar") && !SceneInfo.instance.sceneDef.baseSceneName.Contains("bazaar")) { bazaar.ResetBazaarPlayers(); } orig.Invoke(self); } private void Run_AdvanceStage(orig_AdvanceStage orig, Run self, SceneDef nextScene) { if (!SceneExitController.isRunning && nextScene.baseSceneName == "bazaar") { bazaar.ResetBazaarPlayers(); } orig.Invoke(self, nextScene); } private void SceneDirector_Start(orig_Start orig, SceneDirector self) { if (NetworkServer.active) { if (isCurrentStageBazaar()) { ArtifactDef val = ArtifactCatalog.FindArtifactDef("Sacrifice"); bool flag = false; if (RunArtifactManager.instance.IsArtifactEnabled(val)) { if (!ModConfig.sacrificeArtifactAllowChests.Value) { orig.Invoke(self); } flag = true; RunArtifactManager.instance.SetArtifactEnabledServer(val, false); } if (Run.instance.stageClearCount == 0) { bazaar.ResetBazaarPlayers(); bazaar.CalcDifficultyCoefficient(); } bazaar.StartBazaar(this); if (flag) { RunArtifactManager.instance.SetArtifactEnabledServer(val, true); } if (ModConfig.BroadcastShopSettings.Value) { ((MonoBehaviour)this).StartCoroutine(BroadcastShopSettings()); } } else { bazaar.CurrentDifficultyCoefficient = Run.instance.difficultyCoefficient; } } orig.Invoke(self); } private void PickupDisplay_SetPickupIndex(orig_SetPickupIndex orig, PickupDisplay self, PickupIndex newPickupIndex, bool newHidden) { //IL_005d: 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) if (NetworkServer.active && isCurrentStageBazaar()) { List<BazaarItem> bazaarItems = bazaar.GetBazaarItems(); for (int i = 0; i < bazaarItems.Count; i++) { if ((Object)(object)bazaarItems[i].genericPickupController.pickupDisplay == (Object)(object)self) { orig.Invoke(self, bazaarItems[i].pickupIndex, newHidden); return; } } } orig.Invoke(self, newPickupIndex, newHidden); } private void ChestBehavior_Open(orig_Open orig, ChestBehavior self) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && isCurrentStageBazaar()) { bool flag = false; if (!ModConfig.isShareSuiteLoaded || !ModConfig.isShareSuiteActive()) { if (!ModConfig.AddItemsDirectlyToInventory.Value) { flag = true; } } else if (ModConfig.ShareSuiteItemSharingEnabled.Value) { flag = true; } if (flag) { List<BazaarItem> bazaarItems = bazaar.GetBazaarItems(); for (int i = 0; i < bazaar.GetBazaarItemAmount(); i++) { if (((object)bazaarItems[i].chestBehavior).Equals((object?)self)) { PickupDropletController.CreatePickupDroplet(bazaarItems[i].pickupIndex, ((Component)self).transform.position + Vector3.up * 1.5f, Vector3.up * 20f + ((Component)self).transform.forward * 2f); bazaarItems[i].purchaseCount++; if (bazaar.IsChestStillAvailable(bazaarItems[i])) { ((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(true); } return; } } } } orig.Invoke(self); } private void ChestBehavior_PickFromList(orig_PickFromList orig, ChestBehavior self, List<PickupIndex> dropList) { //IL_0045: 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) if (NetworkServer.active && isCurrentStageBazaar()) { foreach (BazaarItem bazaarItem in bazaar.GetBazaarItems()) { if ((Object)(object)bazaarItem.chestBehavior == (Object)(object)self) { List<PickupIndex> list = new List<PickupIndex> { bazaarItem.pickupIndex }; orig.Invoke(self, list); return; } } if (bazaar.IsMoneyLunarPod(((Component)self).gameObject)) { List<PickupIndex> list2 = new List<PickupIndex> { PickupIndex.none }; orig.Invoke(self, list2); return; } } orig.Invoke(self, dropList); } private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Invalid comparison between Unknown and I4 //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Expected O, but got Unknown //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) int num2; List<BazaarItem> bazaarItems; CharacterMaster master2; int num3; if (isCurrentStageBazaar()) { NetworkUser val = Util.LookUpBodyNetworkUser(((Component)activator).gameObject); BazaarPlayer bazaarPlayer = bazaar.GetBazaarPlayer(val); if (!self.CanBeAffordedByInteractor(activator)) { return; } if (bazaar.IsMoneyLunarPodAvailable() && bazaar.IsMoneyLunarPod(((Component)self).gameObject)) { if (bazaarPlayer.lunarExchanges < ModConfig.maxLunarExchanges.Value || ModConfig.infiniteLunarExchanges) { bazaarPlayer.lunarExchanges++; int lunarCoinExchangeMoney = bazaar.GetLunarCoinExchangeMoney(); if (!ModConfig.IsShareSuiteMoneySharing()) { CharacterMaster master = ((Component)activator).GetComponent<CharacterBody>().master; master.money += (uint)lunarCoinExchangeMoney; } else { AddMoneyToShareSuitePool(lunarCoinExchangeMoney); } if (Object.op_Implicit((Object)(object)ModConfig.EphemeralCoins) && ModConfig.EphemeralCoins.GetPropertyValue<bool>("artifactEnabled")) { ModConfig.EphemeralCoins.InvokeMethod("takeCoinsFromUser", val, (uint)self.cost); } else { val.DeductLunarCoins((uint)self.cost); } int num = (int)((double)ModConfig.lunarCoinWorth.Value * (double)bazaar.CurrentDifficultyCoefficient); GameObject obj = Resources.Load<GameObject>("Prefabs/Effects/CoinEmitter"); EffectManager.SpawnEffect(obj, new EffectData { origin = ((Component)self).transform.position, genericFloat = num }, true); EffectManager.SpawnEffect(obj, new EffectData { origin = ((Component)self).transform.position, genericFloat = num }, true); Util.PlaySound("Play_UI_coin", ((Component)self).gameObject); } return; } num2 = -1; bazaarItems = bazaar.GetBazaarItems(); for (int i = 0; i < bazaarItems.Count; i++) { if ((Object)(object)bazaarItems[i].chestBehavior == (Object)null || !((object)((Component)bazaarItems[i].chestBehavior).GetComponent<PurchaseInteraction>()).Equals((object?)self)) { continue; } if (!bazaar.PlayerHasPurchasesLeft(bazaarPlayer)) { return; } PickupTier pickupTier = PickupIndexToPickupTier(bazaarItems[i].pickupIndex); if (!bazaar.PlayerHasTierPurchasesLeft(pickupTier, bazaarPlayer)) { return; } if ((Object)(object)ModConfig.ShareSuite != (Object)null && ModConfig.ShareSuiteTotalPurchaseSharing.Value) { bazaar.GetBazaarPlayers().ForEach(delegate(BazaarPlayer x) { x.chestPurchases++; }); } else { bazaarPlayer.chestPurchases++; } bazaarPlayer.IncreaseTierPurchase(pickupTier); num2 = i; break; } if (((ModConfig.isShareSuiteActive() && !ModConfig.ShareSuiteItemSharingEnabled.Value) || (!ModConfig.isShareSuiteActive() && ModConfig.AddItemsDirectlyToInventory.Value)) && num2 != -1) { master2 = ((Component)activator).GetComponent<CharacterBody>().master; if ((int)PickupCatalog.GetPickupDef(bazaarItems[num2].pickupIndex).equipmentIndex != -1) { num3 = 1; } else { num3 = 0; if (num3 == 0) { master2.inventory.GiveItem(PickupCatalog.GetPickupDef(bazaarItems[num2].pickupIndex).itemIndex, 1); goto IL_03b5; } } if ((ModConfig.isShareSuiteActive() && !ModConfig.isShareSuiteEquipmentSharing()) || (!ModConfig.isShareSuiteActive() && ModConfig.AddItemsDirectlyToInventory.Value)) { PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(master2.inventory.GetEquipmentIndex()), ((Component)master2.GetBody()).gameObject.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + ((Component)self).transform.forward * 2f); } master2.inventory.SetEquipmentIndex(PickupCatalog.GetPickupDef(bazaarItems[num2].pickupIndex).equipmentIndex); goto IL_03b5; } } orig.Invoke(self, activator); return; IL_03b5: if (ModConfig.chestCostType.Value == 1) { Util.LookUpBodyNetworkUser(master2.GetBody()).DeductLunarCoins((uint)self.cost); } else if (!ModConfig.IsShareSuiteMoneySharing()) { master2.money -= (uint)self.cost; } else { AddMoneyToShareSuitePool(-self.cost); } bazaarItems[num2].purchaseCount++; if (!bazaar.IsChestStillAvailable(bazaarItems[num2])) { ((Component)self).GetComponent<PurchaseInteraction>().SetAvailable(false); } Vector3 position = ((Component)self).transform.position; position.y -= 1f; EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = position, rotation = Quaternion.identity, scale = 0.01f, color = Color32.op_Implicit(Color.yellow) }, true); if (num3 == 0) { PurchaseInteraction.CreateItemTakenOrb(((Component)self).gameObject.transform.position, ((Component)((Component)activator).GetComponent<CharacterBody>()).gameObject, PickupCatalog.GetPickupDef(bazaarItems[num2].pickupIndex).itemIndex); } else { PurchaseInteraction.CreateItemTakenOrb(((Component)self).gameObject.transform.position, ((Component)((Component)activator).GetComponent<CharacterBody>()).gameObject, PickupCatalog.GetPickupDef(bazaarItems[num2].pickupIndex).itemIndex); } } private void AddMoneyToShareSuitePool(int money) { MoneySharingHooks.AddMoneyExternal(money); } private void GenericPickupController_AttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { if (!NetworkServer.active) { return; } if (isCurrentStageBazaar()) { if (!bazaar.IsDisplayItem(((Component)self).gameObject)) { orig.Invoke(self, body); } } else { orig.Invoke(self, body); } } private void FireworkLauncher_FireMissile(orig_FireMissile orig, FireworkLauncher self) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { if (isCurrentStageBazaar() && bazaar.IsMoneyLunarPod(((Component)self).gameObject.transform.position)) { self.remaining = 0; } else { orig.Invoke(self); } } } private bool isCurrentStageBazaar() { if ((Object)(object)SceneCatalog.mostRecentSceneDef == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("bazaar")) { return true; } return false; } private bool GenericPickupController_OnSerialize(orig_OnSerialize orig, GenericPickupController self, NetworkWriter writer, bool forceAll) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && isCurrentStageBazaar()) { List<BazaarItem> bazaarItems = bazaar.GetBazaarItems(); for (int i = 0; i < bazaarItems.Count; i++) { if (!((Object)(object)bazaarItems[i].genericPickupController == (Object)(object)self)) { continue; } if (forceAll) { GeneratedNetworkCode._WritePickupIndex_None(writer, bazaarItems[i].pickupIndex); writer.Write(self.Recycled); return true; } bool flag = false; if ((((Component)self).GetComponent<NetworkBehaviour>().GetFieldValue<uint>("m_SyncVarDirtyBits") & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((Component)self).GetComponent<NetworkBehaviour>().GetFieldValue<uint>("m_SyncVarDirtyBits")); flag = true; } GeneratedNetworkCode._WritePickupIndex_None(writer, bazaarItems[i].pickupIndex); } if ((((Component)self).GetComponent<NetworkBehaviour>().GetFieldValue<uint>("m_SyncVarDirtyBits") & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((Component)self).GetComponent<NetworkBehaviour>().GetFieldValue<uint>("m_SyncVarDirtyBits")); flag = true; } writer.Write(self.Recycled); } if (!flag) { writer.WritePackedUInt32(((Component)self).GetComponent<NetworkBehaviour>().GetFieldValue<uint>("m_SyncVarDirtyBits")); } return flag; } } return orig.Invoke(self, writer, forceAll); } private void BazaarController_SetUpSeerStations(orig_SetUpSeerStations orig, BazaarController self) { orig.Invoke(self); if (ModConfig.modifyOriginalBazaar.Value) { SeerStationController[] seerStations = self.seerStations; for (int i = 0; i < seerStations.Length; i++) { ((Component)seerStations[i]).GetComponent<PurchaseInteraction>().Networkcost = ModConfig.seerLunarCost.Value; } ((MonoBehaviour)this).StartCoroutine(delayedPriceChangeLunarShop()); } } private IEnumerator delayedPriceChangeLunarShop() { yield return (object)new WaitForSeconds(2f); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>()) { if (((Object)instances).name.StartsWith("LunarShopTerminal") && instances.cost == 2) { instances.Networkcost = ModConfig.lunarBudLunarCost.Value; } } } private PickupTier PickupIndexToPickupTier(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0052: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0029: 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_0044: Expected I4, but got Unknown if ((int)PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex == -1 && 0 == 0) { ItemTier tier = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickupIndex).itemIndex).tier; return (int)tier switch { 0 => PickupTier.Tier1, 1 => PickupTier.Tier2, 2 => PickupTier.Tier3, 4 => PickupTier.Boss, 3 => PickupTier.Lunar, _ => PickupTier.None, }; } if (EquipmentCatalog.GetEquipmentDef(PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex).isLunar) { return PickupTier.LunarEquipment; } return PickupTier.Equipment; } private IEnumerator BroadcastShopSettings() { yield return (object)new WaitForSeconds(2f); if (!Bazaar.AreAnyItemsAvailable()) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "No items available to spawn for Bigger Bazaar" }); yield break; } string text = ""; bool flag = false; string text2 = ""; if (ModConfig.maxChestPurchasesTier1.Value != -1) { flag = true; text2 = text2 + "<color=#FFFFFF>Tier1: " + ModConfig.maxChestPurchasesTier1.Value + "</color>"; } if (ModConfig.maxChestPurchasesTier2.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#08EB00>Tier2: " + ModConfig.maxChestPurchasesTier2.Value + "</color>"; } if (ModConfig.maxChestPurchasesTier3.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#FF0000>Tier3: " + ModConfig.maxChestPurchasesTier3.Value + "</color>"; } if (ModConfig.maxChestPurchasesTierBoss.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#EEF50B>Boss: " + ModConfig.maxChestPurchasesTierBoss.Value + "</color>"; } if (ModConfig.maxChestPurchasesTierLunar.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#5175DD>Lunar: " + ModConfig.maxChestPurchasesTierLunar.Value + "</color>"; } if (ModConfig.maxChestPurchasesTierEquipment.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#EC7E17>Equipment: " + ModConfig.maxChestPurchasesTierEquipment.Value + "</color>"; } if (ModConfig.maxChestPurchasesTierLunarEquipment.Value != -1) { if (flag) { text2 += ", "; } flag = true; text2 = text2 + "<color=#5175DD>Lunar Equipment: " + ModConfig.maxChestPurchasesTierLunarEquipment.Value + "</color>"; } if (flag) { text = text + "\nBazaar stock per chest by tier:\n" + text2 + "."; } bool flag2 = false; if (ModConfig.maxPlayerPurchases.Value != -1) { flag2 = true; text = ((!((Object)(object)ModConfig.ShareSuite != (Object)null) || !ModConfig.ShareSuiteTotalPurchaseSharing.Value) ? (text + "\nYou can buy a total of " + ModConfig.maxPlayerPurchases.Value + " items.") : (text + "\nYour party can buy a total of " + ModConfig.maxPlayerPurchases.Value + " items.")); } bool flag3 = false; string text3 = ""; if (ModConfig.maxPlayerPurchasesTier1.Value > 0) { flag3 = true; text3 = text3 + "<color=#FFFFFF>" + ModConfig.maxPlayerPurchasesTier1.Value + " Tier1</color>"; } if (ModConfig.maxPlayerPurchasesTier2.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#08EB00>" + ModConfig.maxPlayerPurchasesTier2.Value + " Tier2</color>"; } if (ModConfig.maxPlayerPurchasesTier3.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#FF0000>" + ModConfig.maxPlayerPurchasesTier3.Value + " Tier3</color>"; } if (ModConfig.maxPlayerPurchasesTierBoss.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#EEF50B>" + ModConfig.maxPlayerPurchasesTierBoss.Value + " Boss</color>"; } if (ModConfig.maxPlayerPurchasesTierLunar.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#5175DD>" + ModConfig.maxPlayerPurchasesTierLunar.Value + " Lunar</color>"; } if (ModConfig.maxPlayerPurchasesTierEquipment.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#EC7E17>" + ModConfig.maxPlayerPurchasesTierEquipment.Value + " Equipment</color>"; } if (ModConfig.maxPlayerPurchasesTierLunarEquipment.Value > 0) { if (flag3) { text3 += ", "; } flag3 = true; text3 = text3 + "<color=#5175DD>" + ModConfig.maxPlayerPurchasesTierLunarEquipment.Value + " Lunar Equipment</color>"; } if (flag3) { text3 = "\nYou can only buy up to " + text3 + " items."; text += text3; } text = "--Bazaar Restrictions--<color=#BCBCBC><size=16px>" + text + "</size></color>"; if (flag2 || flag3 || flag) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = text }); } } } internal class ModConfig { public struct TierUnitConfig { public float rarity; public float cost; public int costLunar; public int maxChestPurchases; } public static ConfigEntry<int> lunarCoinWorth; public static ConfigEntry<int> maxLunarExchanges; public static ConfigEntry<int> chestAmount; public static ConfigEntry<int> chestCostType; public static ConfigEntry<float> tier1Cost; public static ConfigEntry<float> tier2Cost; public static ConfigEntry<float> tier3Cost; public static ConfigEntry<float> tierBossCost; public static ConfigEntry<float> tierLunarCost; public static ConfigEntry<float> tierEquipmentCost; public static ConfigEntry<float> tierLunarEquipmentCost; public static ConfigEntry<float> tier1Rarity; public static ConfigEntry<float> tier2Rarity; public static ConfigEntry<float> tier3Rarity; public static ConfigEntry<float> tierBossRarity; public static ConfigEntry<float> tierLunarRarity; public static ConfigEntry<float> tierEquipmentRarity; public static ConfigEntry<float> tierLunarEquipmentRarity; public static ConfigEntry<int> maxChestPurchasesTier1; public static ConfigEntry<int> maxChestPurchasesTier2; public static ConfigEntry<int> maxChestPurchasesTier3; public static ConfigEntry<int> maxChestPurchasesTierBoss; public static ConfigEntry<int> maxChestPurchasesTierLunar; public static ConfigEntry<int> maxChestPurchasesTierEquipment; public static ConfigEntry<int> maxChestPurchasesTierLunarEquipment; public static ConfigEntry<int> maxPlayerPurchases; public static ConfigEntry<int> maxPlayerPurchasesTier1; public static ConfigEntry<int> maxPlayerPurchasesTier2; public static ConfigEntry<int> maxPlayerPurchasesTier3; public static ConfigEntry<int> maxPlayerPurchasesTierBoss; public static ConfigEntry<int> maxPlayerPurchasesTierLunar; public static ConfigEntry<int> maxPlayerPurchasesTierEquipment; public static ConfigEntry<int> maxPlayerPurchasesTierLunarEquipment; public static ConfigEntry<bool> BroadcastShopSettings; public static ConfigEntry<bool> AddItemsDirectlyToInventory; public static ConfigEntry<bool> ShareSuiteItemSharingEnabled; public static ConfigEntry<bool> ShareSuiteTotalPurchaseSharing; public static ConfigEntry<bool> sacrificeArtifactAllowChests; public static bool infiniteLunarExchanges = false; public static bool isShareSuiteLoaded; public static ConfigEntry<bool> modifyOriginalBazaar; public static ConfigEntry<int> seerLunarCost; public static ConfigEntry<int> lunarBudLunarCost; public static ConfigEntry<int> tier1CostLunar; public static ConfigEntry<int> tier2CostLunar; public static ConfigEntry<int> tier3CostLunar; public static ConfigEntry<int> tierBossCostLunar; public static ConfigEntry<int> tierLunarCostLunar; public static ConfigEntry<int> tierEquipmentCostLunar; public static ConfigEntry<int> tierLunarEquipmentCostLunar; public static ConfigEntry<bool> disableTransferMoney; public static ConfigEntry<bool> nextLevelChestPriceScaling; public static ConfigEntry<int> configNumber; public static BaseUnityPlugin ShareSuite; public static BaseUnityPlugin EphemeralCoins; public static Dictionary<PickupTier, TierUnitConfig> tierConfigs = new Dictionary<PickupTier, TierUnitConfig>(); private static readonly int CurrentVersionNumber = 2; public static void InitConfig(ConfigFile config) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Expected O, but got Unknown //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Expected O, but got Unknown //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Expected O, but got Unknown //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Expected O, but got Unknown //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Expected O, but got Unknown //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Expected O, but got Unknown //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Expected O, but got Unknown //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Expected O, but got Unknown //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Expected O, but got Unknown //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Expected O, but got Unknown //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Expected O, but got Unknown //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Expected O, but got Unknown //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Expected O, but got Unknown //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Expected O, but got Unknown //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Expected O, but got Unknown //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Expected O, but got Unknown //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Expected O, but got Unknown //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Expected O, but got Unknown //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Expected O, but got Unknown //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Expected O, but got Unknown //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Expected O, but got Unknown //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Expected O, but got Unknown //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Expected O, but got Unknown //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Expected O, but got Unknown //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Expected O, but got Unknown //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Expected O, but got Unknown chestCostType = config.Bind<int>("0. Config", "chestCostType", 0, new ConfigDescription("Set the chests cost type to either gold (0) or lunar coins (1).", (AcceptableValueBase)null, Array.Empty<object>())); BroadcastShopSettings = config.Bind<bool>("0. Config", "BroadcastShopSettings", true, new ConfigDescription("Lets everyone know how many things they can purchase on bazaar entry.", (AcceptableValueBase)null, Array.Empty<object>())); lunarCoinWorth = config.Bind<int>("0. Config", "lunarCoinWorth", 50, new ConfigDescription("Conversion rate for Lunar Coins to Money. Conversion rate automatically scales with difficulty, meaning if you set this at the base price of a medium chest (50), you will always get enough money to buy a tier 2 item. (Reference: Small chest = 25, Medium Chest = 50, Legendary Chest = 400)\nIf you change the item tier prices, you might have to adjust this value.", (AcceptableValueBase)null, Array.Empty<object>())); maxLunarExchanges = config.Bind<int>("0. Config", "maxLunarExchanges", 3, new ConfigDescription("Sets how many Lunar Coin exchanges for money are allowed per player. A value of 0 will never allow an exchange. A value of -1 allows infinite exchanges.", (AcceptableValueBase)null, Array.Empty<object>())); if (maxLunarExchanges.Value == -1) { infiniteLunarExchanges = true; } chestAmount = config.Bind<int>("0. Config", "chestAmount", 6, new ConfigDescription("Adjust the amount of chests spawned. Minimum amount is 1, maximum amount is 6", (AcceptableValueBase)null, Array.Empty<object>())); AddItemsDirectlyToInventory = config.Bind<bool>("0. Config", "AddItemsDirectlyToInventory", false, new ConfigDescription("Adds bought items directly to your inventory instead of dropping them on the floor. This works just like ShareSuiteItemSharingEnabled when using ShareSuite, but is a seperate option for when not using ShareSuite.", (AcceptableValueBase)null, Array.Empty<object>())); tier1Cost = config.Bind<float>("1. TierCost", "tier1ChestCostMulti", 1f, new ConfigDescription("Set the base cost multiplier for tier 1 items (white). This scales automatically with difficulty and player amount.\nA value of 1 means that these items will cost as much as a small chest in the prior stage (the one you opened the shop portal in) \n(Default value: 1)", (AcceptableValueBase)null, Array.Empty<object>())); tier2Cost = config.Bind<float>("1. TierCost", "tier2ChestCostMulti", 2f, new ConfigDescription("Set the base cost multiplier for tier 2 items (green). This scales automatically with difficulty and player amount.\nA value of 2 means that these items will cost as much as a medium chest in the prior stage (the one you opened the shop portal in) \n(Default value: 2)", (AcceptableValueBase)null, Array.Empty<object>())); tier3Cost = config.Bind<float>("1. TierCost", "tier3ChestCostMulti", 16f, new ConfigDescription("Set the base cost multiplier for tier 3 items (red). This scales automatically with difficulty and player amount.\nA value of 16 means that these items will cost as much as a legendary chest in the prior stage (the one you opened the shop portal in) \n(Default value: 16)", (AcceptableValueBase)null, Array.Empty<object>())); tierBossCost = config.Bind<float>("1. TierCost", "tierBossCostMulti", 24f, new ConfigDescription("Set the base cost multiplier for boss tier items (yellow). This scales automatically with difficulty and player amount. (Default value: 24, untested)", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarCost = config.Bind<float>("1. TierCost", "tierLunarCostMulti", 16f, new ConfigDescription("Set the base cost multiplier for lunar tier items (blue). This scales automatically with difficulty and player amount. (Default value: 16, untested)", (AcceptableValueBase)null, Array.Empty<object>())); tierEquipmentCost = config.Bind<float>("1. TierCost", "tierEquipmentCostMulti", 8f, new ConfigDescription("Set the base cost multiplier for equipment tier items (orange). This scales automatically with difficulty and player amount. (Default value: 8, untested)", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarEquipmentCost = config.Bind<float>("1. TierCost", "tierLunarEquipmentCostMulti", 16f, new ConfigDescription("Set the base cost multiplier for lunar equipment tier items (blue). This scales automatically with difficulty and player amount. (Default value: 16, untested)", (AcceptableValueBase)null, Array.Empty<object>())); tier1Rarity = config.Bind<float>("2. TierRarity", "tier1Rarity", 0.55f, new ConfigDescription("Set the rarity of items/equipment for each tier. Higher value compared to the other tiers means that tier is more likely to appear (weighted random).\nDoes not need to add up to 1. Values are relative.\nSet a tier rarity to 0 if you don't want any items of that tier to appear.\n(Default values: 0.55, 0.3, 0.15, 0, 0, 0, 0)\n", (AcceptableValueBase)null, Array.Empty<object>())); tier2Rarity = config.Bind<float>("2. TierRarity", "tier2Rarity", 0.3f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); tier3Rarity = config.Bind<float>("2. TierRarity", "tier3Rarity", 0.15f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); tierBossRarity = config.Bind<float>("2. TierRarity", "tierBossRarity", 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarRarity = config.Bind<float>("2. TierRarity", "tierLunarRarity", 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); tierEquipmentRarity = config.Bind<float>("2. TierRarity", "tierEquipmentRarity", 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarEquipmentRarity = config.Bind<float>("2. TierRarity", "tierLunarEquipmentRarity", 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTier1 = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTier1", 3, new ConfigDescription("How often you can buy an item before a chest of this tier runs out/becomes unavailable.\nSet -1 for infinite purchases.\n\nTier 1", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTier2 = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTier2", 2, new ConfigDescription("Tier 2", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTier3 = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTier3", 1, new ConfigDescription("Tier 3", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTierBoss = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTierBoss", 1, new ConfigDescription("Tier Boss", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTierLunar = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTierLunar", 1, new ConfigDescription("Tier Lunar", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTierEquipment = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTierEquipment", 1, new ConfigDescription("Tier Equipment", (AcceptableValueBase)null, Array.Empty<object>())); maxChestPurchasesTierLunarEquipment = config.Bind<int>("3. ChestPurchaseLimits", "maxChestPurchasesTierLunarEquipment", 1, new ConfigDescription("Tier Lunar Equipment", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchases = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchases", 3, new ConfigDescription("This sets how many total purchases a player is allowed to make per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTier1 = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTier1", -1, new ConfigDescription("This sets how many tier 1 (white) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTier2 = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTier2", -1, new ConfigDescription("This sets how many tier 2 (green) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTier3 = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTier3", -1, new ConfigDescription("This sets how many tier 3 (red) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTierBoss = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTierBoss", -1, new ConfigDescription("This sets how many boss tier (yellow) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTierLunar = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTierLunar", -1, new ConfigDescription("This sets how many lunar tier (blue) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTierEquipment = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTierEquipment", -1, new ConfigDescription("This sets how many equipment (orange) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); maxPlayerPurchasesTierLunarEquipment = config.Bind<int>("4. PlayerPurchaseLimits", "maxPlayerPurchasesTierLunarEquipment", -1, new ConfigDescription("This sets how many lunar equipment (blue) items a player can buy in total, per bazaar visit. Set this to -1 for unlimited.", (AcceptableValueBase)null, Array.Empty<object>())); tier1CostLunar = config.Bind<int>("5. LunarModePricing", "tier1ChestCostLunar", 1, new ConfigDescription("Sets how many lunar coins a tier 1 (white) item costs", (AcceptableValueBase)null, Array.Empty<object>())); tier2CostLunar = config.Bind<int>("5. LunarModePricing", "tier2ChestCostLunar", 2, new ConfigDescription("Sets how many lunar coins a tier 2 (green) item costs", (AcceptableValueBase)null, Array.Empty<object>())); tier3CostLunar = config.Bind<int>("5. LunarModePricing", "tier3ChestCostLunar", 3, new ConfigDescription("Sets how many lunar coins a tier 3 (red) item costs", (AcceptableValueBase)null, Array.Empty<object>())); tierBossCostLunar = config.Bind<int>("5. LunarModePricing", "tierBossCostLunar", 5, new ConfigDescription("Sets how many lunar coins a boss (yellow) item costs", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarCostLunar = config.Bind<int>("5. LunarModePricing", "tierLunarCostLunar", 3, new ConfigDescription("Sets how many lunar coins a lunar (blue) item costs", (AcceptableValueBase)null, Array.Empty<object>())); tierEquipmentCostLunar = config.Bind<int>("5. LunarModePricing", "tierEquipmentCostLunar", 3, new ConfigDescription("Sets how many lunar coins equipment (orange) costs", (AcceptableValueBase)null, Array.Empty<object>())); tierLunarEquipmentCostLunar = config.Bind<int>("5. LunarModePricing", "tierLunarEquipmentCostLunar", 3, new ConfigDescription("Sets how many lunar coins lunar equipment (blue) costs", (AcceptableValueBase)null, Array.Empty<object>())); ShareSuiteItemSharingEnabled = config.Bind<bool>("6. ShareSuite", "ShareSuiteItemSharingEnabled", true, new ConfigDescription("This option is only relevant if you are using ShareSuite, otherwise ignore. \nSetting this to false, will disable item sharing for Bigger Bazaar items and put items directly into the buyers inventory. Set to true if you want the item to drop on the floor and use ShareSuite's item sharing rules.", (AcceptableValueBase)null, Array.Empty<object>())); ShareSuiteTotalPurchaseSharing = config.Bind<bool>("6. ShareSuite", "ShareSuiteTotalPurchaseSharing", true, new ConfigDescription("This option is only relevant if you are using ShareSuite, otherwise ignore. \nSets the total amount of available purchases (maxPlayerPurchases in this config) to count for the whole party, rather than individual players.\nThis makes sense if you're sharing money and items.", (AcceptableValueBase)null, Array.Empty<object>())); isShareSuiteLoaded = IsShareSuiteLoaded(); sacrificeArtifactAllowChests = config.Bind<bool>("7. Sacrifice Artifact", "sacrificeArtifactAllowChests", true, new ConfigDescription("Prevents the Sacrifice Artifact from removing the chests in the bazaar.", (AcceptableValueBase)null, Array.Empty<object>())); modifyOriginalBazaar = config.Bind<bool>("8. Original Bazaar Modifications", "modifyOriginalBazaar", false, new ConfigDescription("If enabled, you can change the lunar cost of seer stations and lunar pods.", (AcceptableValueBase)null, Array.Empty<object>())); seerLunarCost = config.Bind<int>("8. Original Bazaar Modifications", "seerLunarCost", 3, new ConfigDescription("Set the lunar cost for seer stations.", (AcceptableValueBase)null, Array.Empty<object>())); lunarBudLunarCost = config.Bind<int>("8. Original Bazaar Modifications", "lunarBudLunarCost", 2, new ConfigDescription("Set the lunar cost for lunar buds.", (AcceptableValueBase)null, Array.Empty<object>())); disableTransferMoney = config.Bind<bool>("9. Other", "disableTransferMoney", false, new ConfigDescription("If set to true, no money will be transfered to the bazaar.", (AcceptableValueBase)null, Array.Empty<object>())); nextLevelChestPriceScaling = config.Bind<bool>("9. Other", "nextLevelChestPriceScaling", false, new ConfigDescription("If set to true, chest prices will be calculated based on how much things cost in the next stage, rather than the previous.", (AcceptableValueBase)null, Array.Empty<object>())); configNumber = config.Bind<int>("z_config version", "config version", 0, new ConfigDescription("No need to touch this", (AcceptableValueBase)null, Array.Empty<object>())); CreateTierConfigs(); if (configNumber.Value == 1) { UpdateTierCostToMulti(config); } if (configNumber.Value < CurrentVersionNumber) { DeleteOldEntries(config); } } private static void UpdateTierCostToMulti(ConfigFile config) { Dictionary<ConfigDefinition, string> obj = (Dictionary<ConfigDefinition, string>)typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(config); new List<KeyValuePair<ConfigDefinition, string>>(); foreach (KeyValuePair<ConfigDefinition, string> item in obj) { if (item.Key.Section == "1. TierCost") { switch (item.Key.Key) { case "tier1ChestCost": tier1Cost.Value = int.Parse(item.Value) / 25; break; case "tier2ChestCost": tier2Cost.Value = int.Parse(item.Value) / 25; break; case "tier3ChestCost": tier3Cost.Value = int.Parse(item.Value) / 25; break; case "tierBossCost": tierBossCost.Value = int.Parse(item.Value) / 25; break; case "tierLunarCost": tierLunarCost.Value = int.Parse(item.Value) / 25; break; case "tierEquipmentCost": tierEquipmentCost.Value = int.Parse(item.Value) / 25; break; case "tierLunarEquipmentCost": tierLunarEquipmentCost.Value = int.Parse(item.Value) / 25; break; } config.Save(); } } } private static void DeleteOldEntries(ConfigFile config) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(config); List<KeyValuePair<ConfigDefinition, string>> list = new List<KeyValuePair<ConfigDefinition, string>>(); foreach (KeyValuePair<ConfigDefinition, string> item in dictionary) { if (item.Key.Section == "Config" || item.Key.Section == "PlayerPurchaseLimits") { list.Add(item); } } dictionary.Clear(); foreach (KeyValuePair<ConfigDefinition, string> item2 in list) { dictionary.Add(new ConfigDefinition("z_backup_config (delete if you dont need it)", item2.Key.Key), item2.Value); } configNumber.Value = CurrentVersionNumber; config.Save(); } internal static bool isShareSuiteActive() { if (isShareSuiteLoaded) { return ShareSuite.GetFieldValue<ConfigEntry<bool>>("ModIsEnabled").Value; } return false; } private static bool IsShareSuiteLoaded() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i].FullName.StartsWith("ShareSuite")) { return true; } } return false; } internal static void SetShareSuiteReference(BaseUnityPlugin ShareSuiteInstance) { ShareSuite = ShareSuiteInstance; IsShareSuiteMoneySharing(); } internal static void SetEphemeralCoinsReference(BaseUnityPlugin EphemeralCoinsInstance) { EphemeralCoins = EphemeralCoinsInstance; } public static bool IsShareSuiteMoneySharing() { bool result = false; if ((Object)(object)ShareSuite != (Object)null) { if (!isShareSuiteActive()) { return false; } if (PlayerCharacterMasterController.instances.Count == 1 && !ShareSuite.GetFieldValue<ConfigEntry<bool>>("OverrideMultiplayerCheck").Value) { return false; } result = ShareSuite.GetFieldValue<ConfigEntry<bool>>("MoneyIsShared").Value; } return result; } public static bool isShareSuiteEquipmentSharing() { bool result = false; if ((Object)(object)ShareSuite != (Object)null) { if (!isShareSuiteActive()) { return false; } result = ShareSuite.GetFieldValue<ConfigEntry<bool>>("EquipmentShared").Value; } return result; } private static void CreateTierConfigs() { TierUnitConfig tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tier1Cost.Value; tierUnitConfig.costLunar = tier1CostLunar.Value; tierUnitConfig.rarity = tier1Rarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTier1.Value; TierUnitConfig value = tierUnitConfig; tierConfigs.Add(PickupTier.Tier1, value); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tier2Cost.Value; tierUnitConfig.costLunar = tier2CostLunar.Value; tierUnitConfig.rarity = tier2Rarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTier2.Value; TierUnitConfig value2 = tierUnitConfig; tierConfigs.Add(PickupTier.Tier2, value2); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tier3Cost.Value; tierUnitConfig.costLunar = tier3CostLunar.Value; tierUnitConfig.rarity = tier3Rarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTier3.Value; TierUnitConfig value3 = tierUnitConfig; tierConfigs.Add(PickupTier.Tier3, value3); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tierBossCost.Value; tierUnitConfig.costLunar = tierBossCostLunar.Value; tierUnitConfig.rarity = tierBossRarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTierBoss.Value; TierUnitConfig value4 = tierUnitConfig; tierConfigs.Add(PickupTier.Boss, value4); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tierLunarCost.Value; tierUnitConfig.costLunar = tierLunarCostLunar.Value; tierUnitConfig.rarity = tierLunarRarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTierLunar.Value; TierUnitConfig value5 = tierUnitConfig; tierConfigs.Add(PickupTier.Lunar, value5); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tierEquipmentCost.Value; tierUnitConfig.costLunar = tierEquipmentCostLunar.Value; tierUnitConfig.rarity = tierEquipmentRarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTierEquipment.Value; TierUnitConfig value6 = tierUnitConfig; tierConfigs.Add(PickupTier.Equipment, value6); tierUnitConfig = default(TierUnitConfig); tierUnitConfig.cost = tierLunarEquipmentCost.Value; tierUnitConfig.costLunar = tierLunarEquipmentCostLunar.Value; tierUnitConfig.rarity = tierLunarEquipmentRarity.Value; tierUnitConfig.maxChestPurchases = maxChestPurchasesTierLunarEquipment.Value; TierUnitConfig value7 = tierUnitConfig; tierConfigs.Add(PickupTier.LunarEquipment, value7); } public static TierUnitConfig GetTierUnitConfig(PickupTier pickupTier) { return tierConfigs[pickupTier]; } } public enum PickupTier { Tier1, Tier2, Tier3, Lunar, Boss, Equipment, LunarEquipment, None } public static class Reflection { private delegate T GetDelegate<out T>(object instance); private delegate void SetDelegate<in T>(object instance, T value); private delegate void SetDelegateRef<TInstance, in TValue>(ref TInstance instance, TValue value) where TInstance : struct; private delegate T GetDelegateRef<TInstance, out T>(ref TInstance instance) where TInstance : struct; private const BindingFlags AllFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly ConcurrentDictionary<(Type T, string name), FieldInfo> FieldCache = new ConcurrentDictionary<(Type, string), FieldInfo>(); private static readonly ConcurrentDictionary<FieldInfo, Delegate> FieldGetDelegateCache = new ConcurrentDictionary<FieldInfo, Delegate>(); private static readonly ConcurrentDictionary<FieldInfo, Delegate> FieldSetDelegateCache = new ConcurrentDictionary<FieldInfo, Delegate>(); private static readonly ConcurrentDictionary<(Type T, string name), PropertyInfo> PropertyCache = new ConcurrentDictionary<(Type, string), PropertyInfo>(); private static readonly ConcurrentDictionary<PropertyInfo, Delegate> PropertyGetDelegateCache = new ConcurrentDictionary<PropertyInfo, Delegate>(); private static readonly ConcurrentDictionary<PropertyInfo, Delegate> PropertySetDelegateCache = new ConcurrentDictionary<PropertyInfo, Delegate>(); private static readonly ConcurrentDictionary<(Type T, string name), MethodInfo> MethodCache = new ConcurrentDictionary<(Type, string), MethodInfo>(); private static readonly ConcurrentDictionary<(Type T, string name, Type[] argumentTypes), MethodInfo> OverloadedMethodCache = new ConcurrentDictionary<(Type, string, Type[]), MethodInfo>(); private static readonly ConcurrentDictionary<MethodInfo, FastReflectionDelegate> DelegateCache = new ConcurrentDictionary<MethodInfo, FastReflectionDelegate>(); private static readonly ConcurrentDictionary<(Type T, Type[] argumentTypes), ConstructorInfo> ConstructorCache = new ConcurrentDictionary<(Type, Type[]), ConstructorInfo>(); private static readonly ConcurrentDictionary<(Type T, string name), Type> NestedTypeCache = new ConcurrentDictionary<(Type, string), Type>(); private static TValue GetOrAddOnNull<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dict, TKey key, Func<TKey, TValue> factory) { if (dict.TryGetValue(key, out var value) && value != null) { return value; } return dict[key] = factory(key); } public static FieldInfo GetFieldCached<T>(string name) { return typeof(T).GetFieldCached(name); } public static FieldInfo GetFieldCached(this Type T, string name) { return FieldCache.GetOrAddOnNull((T, name), ((Type T, string name) x) => x.T.GetFieldFull(x.name) ?? throw new Exception("Could not find FieldInfo on " + T.FullName + " with the name " + name)); } public static TReturn GetFieldValue<TReturn>(this object instance, string fieldName) { return instance.GetType().GetFieldCached(fieldName).GetFieldGetDelegate<TReturn>()(instance); } public static TReturn GetFieldValue<TReturn>(this Type staticType, string fieldName) { return staticType.GetFieldCached(fieldName).GetFieldGetDelegate<TReturn>()(null); } public static void SetFieldValue<TValue>(this object instance, string fieldName, TValue value) { instance.GetType().GetFieldCached(fieldName).GetFieldSetDelegate<TValue>()(instance, value); } public static void SetFieldValue<TValue>(this Type staticType, string fieldName, TValue value) { staticType.GetFieldCached(fieldName).GetFieldSetDelegate<TValue>()(null, value); } public static void SetStructFieldValue<TInstance, TValue>(this ref TInstance instance, string fieldName, TValue value) where TInstance : struct { typeof(TInstance).GetFieldCached(fieldName).GetFieldSetDelegateRef<TInstance, TValue>()(ref instance, value); } private static FieldInfo GetFieldFull(this Type T, string name) { while (T != null) { FieldInfo field = T.GetField(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } T = T.BaseType; } return null; } private static T GetMemberFull<T>(this Type type, string name) where T : MemberInfo { while (type != null) { MemberInfo[] member = type.GetMember(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (member != null) { return (T)member.First(); } type = type.BaseType; } return null; } private static GetDelegate<TReturn> GetFieldGetDelegate<TReturn>(this FieldInfo field) { return Extensions.CastDelegate<GetDelegate<TReturn>>(FieldGetDelegateCache.GetOrAdd(field, (FieldInfo x) => x.CreateGetDelegate<TReturn>())); } private static SetDelegate<TValue> GetFieldSetDelegate<TValue>(this FieldInfo field) { return Extensions.CastDelegate<SetDelegate<TValue>>(FieldSetDelegateCache.GetOrAdd(field, (FieldInfo x) => x.CreateSetDelegate<TValue>())); } private static SetDelegateRef<TInstance, TValue> GetFieldSetDelegateRef<TInstance, TValue>(this FieldInfo field) where TInstance : struct { return Extensions.CastDelegate<SetDelegateRef<TInstance, TValue>>(FieldSetDelegateCache.GetOrAdd(field, (FieldInfo x) => x.CreateSetDelegateRef<TInstance, TValue>())); } public static PropertyInfo GetPropertyCached<T>(string name) { return typeof(T).GetPropertyCached(name); } public static PropertyInfo GetPropertyCached(this Type T, string name) { return PropertyCache.GetOrAddOnNull((T, name), ((Type T, string name) x) => x.T.GetProperty(x.name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); } public static TReturn GetPropertyValue<TReturn>(this object instance, string propName) { return instance.GetType().GetPropertyCached(propName).GetPropertyGetDelegate<TReturn>()(instance); } public static TReturn GetPropertyValue<TReturn>(this Type staticType, string propName) { return staticType.GetPropertyCached(propName).GetPropertyGetDelegate<TReturn>()(null); } public static void SetPropertyValue<TValue>(this object instance, string propName, TValue value) { PropertyInfo propertyCached = instance.GetType().GetPropertyCached(propName); if ((object)propertyCached != null) { propertyCached.GetPropertySetDelegate<TValue>()(instance, value); } } public static void SetPropertyValue<TValue>(this Type staticType, string propName, TValue value) { PropertyInfo propertyCached = staticType.GetPropertyCached(propName); if ((object)propertyCached != null) { propertyCached.GetPropertySetDelegate<TValue>()(null, value); } } public static void SetStructPropertyValue<TInstance, TValue>(this ref TInstance instance, string propName, TValue value) where TInstance : struct { typeof(TInstance).GetPropertyCached(propName).GetPropertySetDelegateRef<TInstance, TValue>()(ref instance, value); } public static TValue GetStructPropertyValue<TInstance, TValue>(this ref TInstance instance, string propName) where TInstance : struct { return typeof(TInstance).GetPropertyCached(propName).GetPropertyGetDelegateRef<TInstance, TValue>()(ref instance); } private static GetDelegate<TReturn> GetPropertyGetDelegate<TReturn>(this PropertyInfo property) { return Extensions.CastDelegate<GetDelegate<TReturn>>(PropertyGetDelegateCache.GetOrAdd(property, (PropertyInfo prop) => prop.CreateGetDelegate<TReturn>())); } private static GetDelegateRef<TInstance, TReturn> GetPropertyGetDelegateRef<TInstance, TReturn>(this PropertyInfo property) where TInstance : struct { return Extensions.CastDelegate<GetDelegateRef<TInstance, TReturn>>(PropertyGetDelegateCache.GetOrAdd(property, (PropertyInfo prop) => prop.CreateGetDelegate<TInstance, TReturn>())); } private static SetDelegate<TValue> GetPropertySetDelegate<TValue>(this PropertyInfo property) { return Extensions.CastDelegate<SetDelegate<TValue>>(PropertySetDelegateCache.GetOrAdd(property, (PropertyInfo prop) => prop.CreateSetDelegate<TValue>())); } private static SetDelegateRef<TInstance, TValue> GetPropertySetDelegateRef<TInstance, TValue>(this PropertyInfo property) where TInstance : struct { return Extensions.CastDelegate<SetDelegateRef<TInstance, TValue>>(PropertySetDelegateCache.GetOrAdd(property, (PropertyInfo prop) => prop.CreateSetDelegateRef<TInstance, TValue>())); } public static MethodInfo GetMethodCached<T>(string name) { return typeof(T).GetMethodCached(name); } public static MethodInfo GetMethodCached(this Type T, string name) { return MethodCache.GetOrAddOnNull((T, name), ((Type T, string name) x) => x.T.GetMethod(x.name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new Exception("Could not find MethodInfo on " + T.FullName + " with the name " + name)); } public static MethodInfo GetMethodWithConstructedGenericParameter(this Type T, string name, Type genericTypeDefinition) { return T.GetMethods().First(delegate(MethodInfo method) { if (method.Name != name) { return false; } Type parameterType = method.GetParameters().First().ParameterType; if (!parameterType.IsConstructedGenericType) { return false; } Type type = parameterType.GetGenericArguments().First(); return parameterType == genericTypeDefinition.MakeGenericType(type); }); } public static MethodInfo GetMethodCached<T>(string name, Type[] argumentTypes) { return typeof(T).GetMethodCached(name, argumentTypes); } public static MethodInfo GetMethodCached(this Type T, string name, Type[] argumentTypes) { return OverloadedMethodCache.GetOrAddOnNull((T, name, argumentTypes), ((Type T, string name, Type[] argumentTypes) x) => x.T.GetMethod(x.name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, x.argumentTypes, null) ?? throw new Exception("Could not find MethodInfo on " + T.FullName + " with the name " + name + " and arguments: " + string.Join(",", argumentTypes.Select((Type a) => a.FullName)))); } public static TReturn InvokeMethod<TReturn>(this object instance, string methodName) { return instance.InvokeMethod<TReturn>(methodName, null); } public static TReturn InvokeMethod<TReturn>(this Type staticType, string methodName) { return staticType.InvokeMethod<TReturn>(methodName, null); } public static void InvokeMethod(this object instance, string methodName) { instance.InvokeMethod<object>(methodName); } public static void InvokeMethod(this Type staticType, string methodName) { staticType.InvokeMethod<object>(methodName); } public static TReturn InvokeMethod<TReturn>(this object instance, string methodName, params object[] methodParams) { return (TReturn)(((methodParams == null) ? instance.GetType().GetMethodCached(methodName) : instance.GetType().GetMethodCached(methodName, methodParams.Select((object x) => x.GetType()).ToArray())) ?? throw new Exception($"Could not find method on type {instance.GetType()} with the name of {methodName} with the arguments specified.")).GetMethodDelegateCached().Invoke(instance, methodParams); } public static TReturn InvokeMethod<TReturn>(this Type staticType, string methodName, params object[] methodParams) { return (TReturn)(((methodParams == null) ? staticType.GetMethodCached(methodName) : staticType.GetMethodCached(methodName, methodParams.Select((object x) => x.GetType()).ToArray())) ?? throw new Exception($"Could not find method on type {staticType} with the name of {methodName} with the arguments specified.")).GetMethodDelegateCached().Invoke((object)null, methodParams); } public static void InvokeMethod(this object instance, string methodName, params object[] methodParams) { instance.InvokeMethod<object>(methodName, methodParams); } public static void InvokeMethod(this Type staticType, string methodName, params object[] methodParams) { staticType.InvokeMethod<object>(methodName, methodParams); } private static FastReflectionDelegate GetMethodDelegateCached(this MethodInfo methodInfo) { return DelegateCache.GetOrAdd(methodInfo, (Func<MethodInfo, FastReflectionDelegate>)((MethodInfo method) => method.GenerateCallDelegate())); } public static ConstructorInfo GetConstructorCached<T>(Type[] argumentTypes) { return typeof(T).GetConstructorCached(argumentTypes); } public static ConstructorInfo GetConstructorCached(this Type T, Type[] argumentTypes) { return ConstructorCache.GetOrAddOnNull((T, argumentTypes), ((Type T, Type[] argumentTypes) x) => x.T.GetConstructor(x.argumentTypes) ?? throw new Exception("Could not find ConstructorInfo on " + T.FullName + " with the arguments " + string.Join(",", argumentTypes.Select((Type a) => a.FullName)))); } public static Type GetNestedType<T>(string name) { return typeof(T).GetNestedTypeCached(name); } public static Type GetNestedTypeCached<T>(string name) { return typeof(T).GetNestedTypeCached(name); } public static Type GetNestedTypeCached(this Type T, string name) { return NestedTypeCache.GetOrAddOnNull((T, name), ((Type T, string name) x) => x.T.GetNestedType(x.name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new Exception("Could not find nested Type on " + T.FullName + " with the name " + name)); } public static object Instantiate(this Type type) { return Activator.CreateInstance(type, nonPublic: true); } public static object Instantiate(this Type type, params object[] constructorArguments) { return type.GetConstructorCached(constructorArguments.Select((object x) => x.GetType()).ToArray()).Invoke(constructorArguments); } public static object InstantiateGeneric<TClass>(this Type typeArgument) { return typeof(TClass).MakeGenericType(typeArgument).Instantiate(); } public static object InstantiateGeneric<TClass>(this Type[] typeArgument) { return typeof(TClass).MakeGenericType(typeArgument).Instantiate(); } public static IList InstantiateList(this Type type) { return (IList)typeof(List<>).MakeGenericType(type).Instantiate(); } private static GetDelegate<TReturn> CreateGetDelegate<TReturn>(this FieldInfo field) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_008e: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } if (!typeof(TReturn).IsAssignableFrom(field.FieldType)) { throw new Exception($"Field type {field.FieldType} does not match the requested type {typeof(TReturn)}."); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} Getter", typeof(TReturn), new Type[1] { typeof(object) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); if (field.DeclaringType.GetTypeInfo().IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Unbox_Any, field.DeclaringType); } } Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Ldfld : OpCodes.Ldsfld, field); iLProcessor.Emit(OpCodes.Ret); return (GetDelegate<TReturn>)val.Generate().CreateDelegate(typeof(GetDelegate<TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegate<TValue> CreateSetDelegate<TValue>(this FieldInfo field) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } if (!field.FieldType.IsAssignableFrom(typeof(TValue))) { throw new Exception($"Value type type {typeof(TValue)} does not match the requested type {field.FieldType}."); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} Setter", typeof(void), new Type[2] { typeof(object), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Stfld : OpCodes.Stsfld, field); iLProcessor.Emit(OpCodes.Ret); return (SetDelegate<TValue>)val.Generate().CreateDelegate(typeof(SetDelegate<TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegateRef<TInstance, TValue> CreateSetDelegateRef<TInstance, TValue>(this FieldInfo field) where TInstance : struct { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d1: Unknown result type (might be due to invalid IL or missing references) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } if (field.FieldType != typeof(TValue)) { throw new Exception($"Value type type {typeof(TValue)} does not match the requested type {field.FieldType}."); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} SetterByRef", typeof(void), new Type[2] { typeof(TInstance).MakeByRefType(), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Stfld : OpCodes.Stsfld, field); iLProcessor.Emit(OpCodes.Ret); return (SetDelegateRef<TInstance, TValue>)val.Generate().CreateDelegate(typeof(SetDelegateRef<TInstance, TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static GetDelegate<TReturn> CreateGetDelegate<TReturn>(this PropertyInfo property) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } if (!typeof(TReturn).IsAssignableFrom(property.PropertyType)) { throw new Exception($"Field type {property.PropertyType} does not match the requested type {typeof(TReturn)}."); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} Getter", typeof(TReturn), new Type[1] { typeof(object) }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (!getMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)getMethod); iLProcessor.Emit(OpCodes.Ret); return (GetDelegate<TReturn>)val.Generate().CreateDelegate(typeof(GetDelegate<TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static GetDelegateRef<TInstance, TReturn> CreateGetDelegate<TInstance, TReturn>(this PropertyInfo property) where TInstance : struct { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } if (!typeof(TReturn).IsAssignableFrom(property.PropertyType)) { throw new Exception($"Field type {property.PropertyType} does not match the requested type {typeof(TReturn)}."); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} Getter", typeof(TReturn), new Type[1] { typeof(TInstance).MakeByRefType() }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (!getMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)getMethod); iLProcessor.Emit(OpCodes.Ret); return (GetDelegateRef<TInstance, TReturn>)val.Generate().CreateDelegate(typeof(GetDelegateRef<TInstance, TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegate<TValue> CreateSetDelegate<TValue>(this PropertyInfo property) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ae: Unknown result type (might
BepinEx/plugins/MagnusMagnuson-ScannerPlusOne/ScannerPlusOne.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using R2API.Utils; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ScannerPlusOne")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ScannerPlusOne")] [assembly: AssemblyTitle("ScannerPlusOne")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScannerPlusOne; public static class Reflection { private static readonly BindingFlags _defaultFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; public static TReturn GetFieldValue<TReturn>(this object instance, string fieldName) { return (TReturn)instance.GetType().GetField(fieldName, _defaultFlags | BindingFlags.Instance).GetValue(instance); } public static TReturn GetFieldValue<TClass, TReturn>(string fieldName) { return typeof(TClass).GetFieldValue<TReturn>(fieldName); } public static TReturn GetFieldValue<TReturn>(this Type type, string fieldName) { return (TReturn)type.GetField(fieldName, _defaultFlags | BindingFlags.Static).GetValue(null); } public static void SetFieldValue(this object instance, string fieldName, object value) { instance.GetType().GetField(fieldName, _defaultFlags | BindingFlags.Instance).SetValue(instance, value); } public static void SetFieldValue<TClass>(string fieldName, object value) { typeof(TClass).SetFieldValue(fieldName, value); } public static void SetFieldValue(this Type type, string fieldName, object value) { type.GetField(fieldName, _defaultFlags | BindingFlags.Static).SetValue(null, value); } public static TReturn GetPropertyValue<TReturn>(this object instance, string propName) { return (TReturn)instance.GetType().GetProperty(propName, _defaultFlags | BindingFlags.Instance).GetValue(instance); } public static TReturn GetPropertyValue<TClass, TReturn>(string propName) { return typeof(TClass).GetPropertyValue<TReturn>(propName); } public static TReturn GetPropertyValue<TReturn>(this Type type, string propName) { return (TReturn)type.GetProperty(propName, _defaultFlags | BindingFlags.Static).GetValue(null); } public static void SetPropertyValue(this object instance, string propName, object value) { instance.GetType().GetProperty(propName, _defaultFlags | BindingFlags.Instance).SetValue(instance, value); } public static void SetPropertyValue<TClass>(string propName, object value) { typeof(TClass).SetPropertyValue(propName, value); } public static void SetPropertyValue(this Type type, string propName, object value) { type.GetProperty(propName, _defaultFlags | BindingFlags.Static).SetValue(null, value); } public static TReturn InvokeMethod<TReturn>(this object instance, string methodName, params object[] methodParams) { return (TReturn)instance.GetType().GetMethod(methodName, _defaultFlags | BindingFlags.Instance).Invoke(instance, methodParams); } public static TReturn InvokeMethod<TClass, TReturn>(string methodName, params object[] methodParams) { return typeof(TClass).InvokeMethod<TReturn>(methodName, methodParams); } public static TReturn InvokeMethod<TReturn>(this Type type, string methodName, params object[] methodParams) { return (TReturn)type.GetMethod(methodName, _defaultFlags | BindingFlags.Static).Invoke(null, methodParams); } public static void InvokeMethod(this object instance, string methodName, params object[] methodParams) { instance.InvokeMethod<object>(methodName, methodParams); } public static void InvokeMethod<TClass>(string methodName, params object[] methodParams) { InvokeMethod<TClass, object>(methodName, methodParams); } public static void InvokeMethod(this Type type, string methodName, params object[] methodParams) { InvokeMethod<object>(methodName, methodParams); } public static Type GetNestedType<TParent>(string name) { return GetNestedType(typeof(TParent), name); } public static Type GetNestedType(this Type parentType, string name) { return parentType.GetNestedType(name, BindingFlags.Public | BindingFlags.NonPublic); } public static object Instantiate(this Type type) { return Activator.CreateInstance(type, nonPublic: true); } public static object InstantiateGeneric<TClass>(Type typeArgument) { return typeof(TClass).InstantiateGeneric(typeArgument); } public static object InstantiateGeneric(this Type genericType, Type typeArgument) { return genericType.MakeGenericType(typeArgument).Instantiate(); } public static object InstantiateGeneric<TClass>(Type[] typeArguments) { return typeof(TClass).InstantiateGeneric(typeArguments); } public static object InstantiateGeneric(this Type genericType, Type[] typeArguments) { return genericType.MakeGenericType(typeArguments).Instantiate(); } public static IList InstantiateList(this Type type) { return (IList)typeof(List<>).MakeGenericType(type).Instantiate(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.MagnusMagnuson.ScannerPlusOne", "ScannerPlusOne", "2.7.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ScannerPlusOne : BaseUnityPlugin { private List<PendingRevealInteractable> interactableList = new List<PendingRevealInteractable>(); public static ConfigWrapper<bool> UseScannerChat; public static ConfigWrapper<bool> UseScannerIcons; public static ConfigWrapper<bool> ShowQuestionMarks; public static ConfigWrapper<int> IconTransparency; public static ConfigWrapper<bool> ShowBarrels; public static ConfigWrapper<string> BarrelColor; public static ConfigWrapper<bool> ShowChests; public static ConfigWrapper<string> ChestColor; public static ConfigWrapper<bool> ShowEquipment; public static ConfigWrapper<string> EquipmentColor; public static ConfigWrapper<bool> ShowLunarChests; public static ConfigWrapper<string> LunarChestColor; public static ConfigWrapper<bool> ShowShrines; public static ConfigWrapper<string> ShrineColor; public static ConfigWrapper<bool> ShowChanceShrines; public static ConfigWrapper<string> ChanceShrineColor; public static ConfigWrapper<bool> ShowIndividualShrines; public static ConfigWrapper<bool> ShowBloodShrines; public static ConfigWrapper<string> BloodShrineColor; public static ConfigWrapper<bool> ShowCombatShrines; public static ConfigWrapper<string> CombatShrineColor; public static ConfigWrapper<bool> ShowMountainShrines; public static ConfigWrapper<string> MountainShrineColor; public static ConfigWrapper<bool> ShowGoldShrines; public static ConfigWrapper<string> GoldShrineColor; public static ConfigWrapper<bool> ShowWoodShrines; public static ConfigWrapper<string> WoodShrineColor; public static ConfigWrapper<bool> ShowOrderShrines; public static ConfigWrapper<string> OrderShrineColor; public static ConfigWrapper<bool> ShowCleanseShrines; public static ConfigWrapper<string> CleanseShrineColor; public static ConfigWrapper<bool> ShowDrones; public static ConfigWrapper<string> DroneColor; public static ConfigWrapper<bool> ShowTurrets; public static ConfigWrapper<string> TurretColor; public static ConfigWrapper<bool> ShowDuplicator; public static ConfigWrapper<string> DuplicatorColor; public static ConfigWrapper<bool> ShowCategoryChestDamage; public static ConfigWrapper<string> CategoryChestDamageColor; public static ConfigWrapper<bool> ShowCategoryChestHealing; public static ConfigWrapper<string> CategoryChestHealingColor; public static ConfigWrapper<bool> ShowCategoryChestUtility; public static ConfigWrapper<string> CategoryChestUtilityColor; public static ConfigWrapper<bool> ShowRusty; public static ConfigWrapper<string> RustyColor; public static ConfigWrapper<bool> ShowNewtAltar; public static ConfigWrapper<string> NewtAltarColor; public static ConfigWrapper<bool> ShowTeleporter; public static ConfigWrapper<string> TeleporterColor; public static ConfigWrapper<bool> ShowScrapper; public static ConfigWrapper<string> ScrapperColor; public static ConfigWrapper<string> VoidChestColor; public static ConfigWrapper<string> VoidBarrelColor; public static ConfigWrapper<bool> LegacyMode; public static ConfigWrapper<bool> ShowBarrelsChat; public static ConfigWrapper<bool> ShowChestsChat; public static ConfigWrapper<bool> ShowEquipmentChat; public static ConfigWrapper<bool> ShowLunarChestsChat; public static ConfigWrapper<bool> ShowShrinesChat; public static ConfigWrapper<bool> ShowIndividualShrinesChat; public static ConfigWrapper<bool> ShowChanceShrinesChat; public static ConfigWrapper<bool> ShowBloodShrinesChat; public static ConfigWrapper<bool> ShowCombatShrinesChat; public static ConfigWrapper<bool> ShowMountainShrinesChat; public static ConfigWrapper<bool> ShowGoldShrinesChat; public static ConfigWrapper<bool> ShowWoodShrinesChat; public static ConfigWrapper<bool> ShowOrderShrinesChat; public static ConfigWrapper<bool> ShowCleanseShrinesChat; public static ConfigWrapper<bool> ShowDronesAndTurretsChat; public static ConfigWrapper<bool> ShowDuplicatorChat; public static ConfigWrapper<bool> ShowCategoryChestDamageChat; public static ConfigWrapper<bool> ShowCategoryChestHealingChat; public static ConfigWrapper<bool> ShowCategoryChestUtilityChat; public static ConfigWrapper<bool> ShowRustyChat; public static ConfigWrapper<bool> ShowNewtAltarChat; public static ConfigWrapper<bool> ShowScrapperChat; public void InitConfig() { UseScannerChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("1. Turn on/off components", "UseScannerChat", "The scanner tells you in the chat how many gold purchaseables (chests, equipment barrels and chance shrines) and lunar chests are left.", true); UseScannerIcons = ((BaseUnityPlugin)this).Config.Wrap<bool>("1. Turn on/off components", "UseScannerIcons", "Instead of question marks, the scanner reveals what kind of interactable (e.g. chest, duplicator, teleporter etc) there really are.", true); ShowQuestionMarks = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowQuestionMarks", "If this is turned on, hidden scanner icons will not simply be gone, but instead appear as question marks.", true); IconTransparency = ((BaseUnityPlugin)this).Config.Wrap<int>("3. ScannerIcons", "IconTransparency", "Determine the transparency of the scanner icons. Valid values range from 0 to 255. O being fully transparent and 255 being fully opaque.", 122); ShowBarrels = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowBarrels", "Whether money barrels should show up on the scanner.", false); BarrelColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "BarrelColor", "Color for the money barrel icon (chest) that shows up on the scanner.", "#05cea5"); ShowChests = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowChests", "Whether money chests should show up on the scanner.", true); ChestColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "ChestColor", "Color for the chest icon (chest) that shows up on the scanner.", "#f9da0c"); ShowEquipment = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowEquipment", "Whether equipment barrels should show up on the scanner.", true); EquipmentColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "EquipmentColor", "Color for the equipment barrel icon (chest) that shows up on the scanner.", "#ff8019"); ShowLunarChests = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowLunarChests", "Whether lunar chests should show up on the scanner.", true); LunarChestColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "LunarChestColor", "Color for the lunar chest icon (chest) that shows up on the scanner.", "#1822ad"); ShowShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowShrines", "Whether shrines should show up on the scanner.", true); ShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "ShrineColor", "Color for the shrine icon (shrine) that shows up on the scanner.", "#6d523b"); ShowIndividualShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowIndividualShrines", "Whether shrines should use individual config when showing up on the scanner.", true); ShowChanceShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowChanceShrines", "(Only matters if ShowIndividualShrines is set to true) Whether chance shrines should show up on the scanner.", true); ChanceShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "ChanceShrineColor", "Color for the chance shrine icon (shrine) that shows up on the scanner.", "#c4f743"); ShowBloodShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowBloodShrines", "(Only matters if ShowIndividualShrines is set to true) Whether blood shrines should show up on the scanner.", true); BloodShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "BloodShrineColor", "Color for the blood shrine icon (shrine) that shows up on the scanner.", "#f76363"); ShowCombatShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowCombatShrines", "(Only matters if ShowIndividualShrines is set to true) Whether combat shrines should show up on the scanner.", true); CombatShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "CombatShrineColor", "Color for the combat shrine icon (shrine) that shows up on the scanner.", "#fab8ff"); ShowMountainShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowMountainShrines", "(Only matters if ShowIndividualShrines is set to true) Whether mountain shrines should show up on the scanner.", true); MountainShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "MountainShrineColor", "Color for the mountain shrine icon (shrine) that shows up on the scanner.", "#4dc3ff"); ShowGoldShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowGoldShrines", "(Only matters if ShowIndividualShrines is set to true) Whether gold shrines should show up on the scanner.", true); GoldShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "GoldShrineColor", "Color for the gold shrine icon (shrine) that shows up on the scanner.", "#b5b507"); ShowWoodShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowWoodShrines", "(Only matters if ShowIndividualShrines is set to true) Whether wood shrines should show up on the scanner.", true); WoodShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "WoodShrineColor", "Color for the wood shrine icon (shrine) that shows up on the scanner.", "#006e0d"); ShowOrderShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowOrderShrines", "(Only matters if ShowIndividualShrines is set to true) Whether order shrines should show up on the scanner.", true); OrderShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "OrderShrineColor", "Color for the order shrine icon (shrine) that shows up on the scanner.", "#dbf7ff"); ShowCleanseShrines = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowCleanseShrines", "(Only matters if ShowIndividualShrines is set to true) Whether cleansing pool should show up on the scanner.", true); CleanseShrineColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "CleanseShrineColor", "Color for the cleansing pool icon (shrine) that shows up on the scanner.", "#0033cc"); ShowDrones = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowDrones", "Whether drones should show up on the scanner.", true); DroneColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "DroneColor", "Color for the drone icon (drone) that shows up on the scanner.", "#005919"); ShowTurrets = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowTurrets", "Whether turrets should show up on the scanner.", true); TurretColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "TurretColor", "Color for the turret icon (drone) that shows up on the scanner.", "#005919"); ShowDuplicator = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowDuplicator", "Whether duplicators should show up on the scanner.", true); DuplicatorColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "DuplicatorColor", "Color for the duplicator icon (chest) that shows up on the scanner.", "#538daa"); ShowScrapper = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowScrapper", "Whether scrappers should show up on the scanner.", true); ScrapperColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "ScrapperColor", "Color for the scrapper icon (bag) that shows up on the scanner.", "#48f542"); ShowCategoryChestDamage = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowCategoryChestDamage", "Whether the new Damage Chest should show up on the scanner.", true); CategoryChestDamageColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "CategoryChestDamageColor", "Color for the new Damage Chest that shows up on the scanner.", "#8a3226"); ShowCategoryChestHealing = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowCategoryChestHealing", "Whether the new Healing Chest should show up on the scanner.", true); CategoryChestHealingColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "CategoryChestHealingColor", "Color for the new Healing Chest that shows up on the scanner.", "#2e9348"); ShowCategoryChestUtility = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowCategoryChestUtility", "Whether the new Utility Chest should show up on the scanner.", true); CategoryChestUtilityColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "CategoryChestUtilityColor", "Color for the new Utility Chest that shows up on the scanner.", "#843e87"); ShowRusty = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowRusty", "Whether Rusty Boxes should show up on the scanner.", true); RustyColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "RustyColor", "Color for the Rusty Lockbox icon (chest) that shows up on the scanner.", "#eaeaea"); ShowNewtAltar = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowNewtAltar", "Whether newt altars should show up on the scanner.", false); NewtAltarColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "NewtAltarColor", "Color for the newt altar icon (teleporter icon, because too many chest icons and it basically is a teleporter) that shows up on the scanner.", "#1139ff"); ShowTeleporter = ((BaseUnityPlugin)this).Config.Wrap<bool>("3. ScannerIcons", "ShowTeleporter", "Whether the teleporter should show up on the scanner.", true); TeleporterColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "TeleporterColor", "Color for the Teleporter icon (teleporter) that shows up on the scanner.", "#590808"); VoidChestColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "VoidChestColor", "Color for the void chest icon (chest) that shows up on the scanner.", "#964092"); VoidBarrelColor = ((BaseUnityPlugin)this).Config.Wrap<string>("3. ScannerIcons", "VoidBarrelColor", "Color for the void money barrel icon (chest) that shows up on the scanner.", "#964092"); LegacyMode = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "LegacyMode", "Whether to use the Scanner's chat message settings from before v2.0.0", false); ShowBarrelsChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowBarrelsChat", "Whether to add money barrels to the scanner chat notification.", false); ShowChestsChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowChestsChat", "Whether to add chests to the scanner chat notification.", true); ShowEquipmentChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowEquipmentChat", "Whether to add equipment barrels to the scanner chat notification.", true); ShowLunarChestsChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowLunarChestsChat", "Whether to add lunar chests to the scanner chat notification.", false); ShowShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowShrinesChat", "Whether to add shrines to the scanner chat notification.", true); ShowIndividualShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowIndividualShrinesChat", "Whether to list the individual shrine types, rather than summing them up, in the chat notification.", true); ShowChanceShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowChanceShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add chance shrines to the scanner chat notification.", true); ShowBloodShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowBloodShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add blood shrines to the scanner chat notification.", true); ShowCombatShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowCombatShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add combat shrines to the scanner chat notification.", true); ShowMountainShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowMountainShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add mountain shrines to the scanner chat notification.", true); ShowGoldShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowGoldShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add gold shrines to the scanner chat notification.", true); ShowWoodShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowWoodShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add wood shrines to the scanner chat notification.", true); ShowOrderShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowOrderShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add order shrines to the scanner chat notification.", true); ShowCleanseShrinesChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowCleanseShrinesChat", "(Only matters if you set ShowIndividualShrinesChat to true) Whether to add cleansing pool to the scanner chat notification.", true); ShowDronesAndTurretsChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowDronesAndTurretsChat", "Whether to add drones and turrets to the scanner chat notification.", true); ShowDuplicatorChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowDuplicatorChat", "Whether to add duplicators to the scanner chat notification.", false); ShowScrapperChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowScrapperChat", "Whether to add scrappers to the scanner chat notification.", false); ShowCategoryChestDamageChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowCategoryChestDamageChat", "Whether to add the new Damage Chest to the scanner chat notification.", true); ShowCategoryChestHealingChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowCategoryChestHealingChat", "Whether to add the new Healing Chest to the scanner chat notification.", true); ShowCategoryChestUtilityChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowCategoryChestUtilityChat", "Whether to add the new Utility Chest to the scanner chat notification.", true); ShowRustyChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowRustyChat", "Whether to add rusty lockbox to the scanner chat notification.", false); ShowNewtAltarChat = ((BaseUnityPlugin)this).Config.Wrap<bool>("2. ScannerChat", "ShowNewtAltarChat", "Whether to add newt altars to the scanner chat notification.", false); } public void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown InitConfig(); ChestRevealer.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, ChestRevealer self) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) FixedTimeStamp fieldValue = self.GetFieldValue<FixedTimeStamp>("nextPulse"); if (((FixedTimeStamp)(ref fieldValue)).hasPassed) { self.SetFieldValue("nextPulse", FixedTimeStamp.now + self.pulseInterval); ChatTreasureInfo cti = new ChatTreasureInfo(); interactableList = new List<PendingRevealInteractable>(); Vector3 footPosition = CameraRigController.readOnlyInstancesList[0].targetBody.footPosition; Type[] array = (from t in typeof(ChestRevealer).Assembly.GetTypes() where typeof(IInteractable).IsAssignableFrom(t) select t).ToArray(); string text = ""; int num = 0; for (int i = 0; i < array.Length; i++) { foreach (MonoBehaviour item2 in InstanceTracker.FindInstancesEnumerable(array[i])) { if (((IInteractable)item2).ShouldShowOnScanner()) { string text2 = ((object)(IInteractable)item2).ToString().ToLower(); text = text + text2.Split(new char[1] { ' ' })[0] + " "; num++; if (num == 5) { num = 0; text += "\n"; } if (UseScannerChat.Value) { if (LegacyMode.Value) { addTreasureInfoLegacy(cti, text2); } else { addTreasureInfo(cti, text2); } } if (UseScannerIcons.Value) { PendingRevealInteractable.ItemType itemType = PendingRevealInteractable.GetItemType(text2); if (skipInstance(itemType, text2)) { if (ShowQuestionMarks.Value) { addQuestionMark(self, ((Component)item2).transform); } } else { Vector3 val = ((Component)item2).transform.position - footPosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; _ = self.radius; _ = self.radius; float num2 = 1f / self.pulseTravelSpeed; float num3 = Mathf.Sqrt(sqrMagnitude) * num2; PendingRevealInteractable item = new PendingRevealInteractable(((Component)item2).gameObject, FixedTimeStamp.now + num3, itemType); interactableList.Add(item); } } } } } if (UseScannerIcons.Value) { Pulse(self, array); } else { self.Pulse(); } if (UseScannerChat.Value) { printChatTreasureInfo(cti); } } }; ChestRevealer.StaticFixedUpdate += (hook_StaticFixedUpdate)delegate(orig_StaticFixedUpdate orig) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); if (CameraRigController.readOnlyInstancesList.Count > 0) { CharacterBody targetBody = CameraRigController.readOnlyInstancesList[0].targetBody; if (Object.op_Implicit((Object)(object)targetBody)) { _ = targetBody.footPosition; interactableList.Sort(); while (interactableList.Count > 0) { PendingRevealInteractable pendingRevealInteractable = interactableList[0]; if (!((FixedTimeStamp)(ref pendingRevealInteractable.time)).hasPassed) { break; } if (Object.op_Implicit((Object)(object)pendingRevealInteractable.gameObject)) { createPingIndicator(pendingRevealInteractable); } interactableList.RemoveAt(0); } } } }; } private bool skipSpecificShrine(string item) { if (item.Contains("chance")) { return !ShowChanceShrines.Value; } if (item.Contains("blood")) { return !ShowBloodShrines.Value; } if (item.Contains("combat")) { return !ShowChanceShrines.Value; } if (item.Contains("boss")) { return !ShowMountainShrines.Value; } if (item.Contains("gold")) { return !ShowGoldShrines.Value; } if (item.Contains("healing")) { return !ShowWoodShrines.Value; } if (item.Contains("restack")) { return !ShowOrderShrines.Value; } if (item.Contains("cleanse")) { return !ShowCleanseShrines.Value; } return true; } private void addQuestionMark(ChestRevealer self, Transform revealableTransform) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_007e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)self).transform.position; _ = self.radius; _ = self.radius; float num = 1f / self.pulseTravelSpeed; Vector3 val = revealableTransform.position - position; float num2 = Mathf.Sqrt(((Vector3)(ref val)).sqrMagnitude) * num; object obj = Activator.CreateInstance(typeof(ChestRevealer).GetNestedType("PendingReveal", BindingFlags.NonPublic), nonPublic: true); obj.SetFieldValue("gameObject", ((Component)revealableTransform).gameObject); obj.SetFieldValue("time", FixedTimeStamp.now + num2); obj.SetFieldValue("duration", self.revealDuration); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; typeof(ChestRevealer).GetField("pendingReveals", bindingAttr).GetValue(null).InvokeMethod("Add", obj); } private void addTreasureInfo(ChatTreasureInfo cti, string item) { if (item.Contains("voidtriple")) { cti.voidmultishopCount++; return; } if (item.Contains("multi")) { cti.multishopCount++; return; } switch (PendingRevealInteractable.GetItemType(item)) { case PendingRevealInteractable.ItemType.Barrel: cti.moneyBarrelsCount++; break; case PendingRevealInteractable.ItemType.ItemChest: cti.itemTreasureCount++; break; case PendingRevealInteractable.ItemType.EquipmentChest: cti.equipmentTreasureCount++; break; case PendingRevealInteractable.ItemType.Drone: cti.dronesCount++; break; case PendingRevealInteractable.ItemType.Turret: cti.turretsCount++; break; case PendingRevealInteractable.ItemType.LunarChest: cti.lunarTreasureCount++; break; case PendingRevealInteractable.ItemType.Rusty: cti.rustyCount++; break; case PendingRevealInteractable.ItemType.Shrine: cti.shrineCount++; if (ShowIndividualShrinesChat.Value) { countSpecificShrine(cti, item); } break; case PendingRevealInteractable.ItemType.Duplicator: cti.duplicatorCount++; break; case PendingRevealInteractable.ItemType.CategoryChestDamage: cti.damageChestCount++; break; case PendingRevealInteractable.ItemType.CategoryChestHealing: cti.healingChestCount++; break; case PendingRevealInteractable.ItemType.CategoryChestUtility: cti.utilityChestCount++; break; case PendingRevealInteractable.ItemType.NewtAltar: cti.newtAltarCount++; break; case PendingRevealInteractable.ItemType.Scrapper: cti.scrapperCount++; break; case PendingRevealInteractable.ItemType.VoidChest: cti.itemTreasureCount++; break; case PendingRevealInteractable.ItemType.VoidBarrel: cti.moneyBarrelsCount++; break; case PendingRevealInteractable.ItemType.Multi: case PendingRevealInteractable.ItemType.Teleporter: case PendingRevealInteractable.ItemType.Invalid: break; } } private void countSpecificShrine(ChatTreasureInfo cti, string item) { if (item.Contains("chance")) { cti.chanceShrineCount++; } else if (item.Contains("blood")) { cti.bloodShrineCount++; } else if (item.Contains("combat")) { cti.combatShrineCount++; } else if (item.Contains("boss")) { cti.mountainShrineCount++; } else if (item.Contains("gold")) { cti.goldShrineCount++; } else if (item.Contains("healing")) { cti.woodShrineCount++; } else if (item.Contains("restack")) { cti.orderShrineCount++; } else if (item.Contains("cleanse")) { cti.cleanseShrineCount++; } } private bool skipInstance(PendingRevealInteractable.ItemType itemType, string item) { switch (itemType) { case PendingRevealInteractable.ItemType.Barrel: return !ShowBarrels.Value; case PendingRevealInteractable.ItemType.VoidBarrel: return !ShowBarrels.Value; case PendingRevealInteractable.ItemType.ItemChest: return !ShowChests.Value; case PendingRevealInteractable.ItemType.VoidChest: return !ShowChests.Value; case PendingRevealInteractable.ItemType.EquipmentChest: return !ShowEquipment.Value; case PendingRevealInteractable.ItemType.Drone: return !ShowDrones.Value; case PendingRevealInteractable.ItemType.Turret: return !ShowTurrets.Value; case PendingRevealInteractable.ItemType.LunarChest: return !ShowLunarChests.Value; case PendingRevealInteractable.ItemType.Multi: return !ShowChests.Value; case PendingRevealInteractable.ItemType.Rusty: return !ShowRusty.Value; case PendingRevealInteractable.ItemType.Shrine: if (ShowShrines.Value && ShowIndividualShrines.Value) { return skipSpecificShrine(item); } return !ShowShrines.Value; case PendingRevealInteractable.ItemType.Duplicator: return !ShowDuplicator.Value; case PendingRevealInteractable.ItemType.Scrapper: return !ShowScrapper.Value; case PendingRevealInteractable.ItemType.CategoryChestDamage: return !ShowCategoryChestDamage.Value; case PendingRevealInteractable.ItemType.CategoryChestHealing: return !ShowCategoryChestHealing.Value; case PendingRevealInteractable.ItemType.CategoryChestUtility: return !ShowCategoryChestUtility.Value; case PendingRevealInteractable.ItemType.NewtAltar: return !ShowNewtAltar.Value; case PendingRevealInteractable.ItemType.Teleporter: return !ShowTeleporter.Value; case PendingRevealInteractable.ItemType.Invalid: return true; default: return true; } } private void createPingIndicator(PendingRevealInteractable pending) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //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_003c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) NetworkIdentity component = pending.gameObject.GetComponent<NetworkIdentity>(); PingInfo val = default(PingInfo); val.active = true; val.targetNetworkIdentity = component; val.origin = ((Component)component).transform.TransformPoint(((Component)component).transform.position); PingInfo val2 = val; PingIndicator component2 = ((GameObject)Object.Instantiate(Resources.Load("Prefabs/PingIndicator"))).GetComponent<PingIndicator>(); component2.pingOwner = ((Component)CharacterMaster.readOnlyInstancesList.First()).gameObject; component2.SetFieldValue("pingDuration", 1f); component2.pingOrigin = val2.origin; component2.pingTarget = ((PingInfo)(ref val2)).targetGameObject; RebuildPingOwn(component2); } public void RebuildPingOwn(PingIndicator pingIndicator) { //IL_0032: 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_00c9: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) pingIndicator.positionIndicator.targetTransform = (Object.op_Implicit((Object)(object)pingIndicator.pingTarget) ? pingIndicator.pingTarget.transform : null); pingIndicator.positionIndicator.defaultPosition = ((Component)this).transform.position; IDisplayNameProvider componentInParent = ((Component)this).GetComponentInParent<IDisplayNameProvider>(); pingIndicator.SetFieldValue("pingType", (object)(PingType)2); ((Behaviour)pingIndicator.pingObjectScaleCurve).enabled = false; ((Behaviour)pingIndicator.pingObjectScaleCurve).enabled = true; GameObject[] defaultPingGameObjects = pingIndicator.defaultPingGameObjects; defaultPingGameObjects = pingIndicator.interactablePingGameObjects; for (int i = 0; i < defaultPingGameObjects.Length; i++) { defaultPingGameObjects[i].SetActive(false); } if (Object.op_Implicit((Object)(object)pingIndicator.pingTarget)) { pingIndicator.pingTarget.GetComponent<ModelLocator>(); if (componentInParent != null) { pingIndicator.SetFieldValue("pingType", (object)(PingType)2); } } if (Object.op_Implicit((Object)(MonoBehaviour)componentInParent)) { Util.GetBestBodyName(((Component)(MonoBehaviour)componentInParent).gameObject); } ((Behaviour)pingIndicator.pingText).enabled = false; if ((int)pingIndicator.GetFieldValue<PingType>("pingType") == 2) { pingIndicator.SetFieldValue("pingColor", pingIndicator.interactablePingColor); pingIndicator.SetFieldValue("pingDuration", 10f); pingIndicator.SetFieldValue("pingTargetPurchaseInteraction", pingIndicator.pingTarget.GetComponent<PurchaseInteraction>()); Sprite sprite = Resources.Load<Sprite>("Textures/MiscIcons/texInventoryIconOutlined"); SpriteRenderer component = pingIndicator.interactablePingGameObjects[0].GetComponent<SpriteRenderer>(); component.color = Color32.op_Implicit(new Color32((byte)206, (byte)6, (byte)166, (byte)122)); pingIndicator.pingTarget.GetComponent<ShopTerminalBehavior>(); string text = ((Object)pingIndicator.pingTarget.gameObject).name.ToLower(); switch (PendingRevealInteractable.GetItemType(text)) { case PendingRevealInteractable.ItemType.Barrel: component.color = getColorFromHex(BarrelColor.Value); break; case PendingRevealInteractable.ItemType.VoidBarrel: component.color = getColorFromHex(VoidBarrelColor.Value); break; case PendingRevealInteractable.ItemType.ItemChest: component.color = getColorFromHex(ChestColor.Value); break; case PendingRevealInteractable.ItemType.VoidChest: component.color = getColorFromHex(VoidChestColor.Value); break; case PendingRevealInteractable.ItemType.EquipmentChest: component.color = getColorFromHex(EquipmentColor.Value); break; case PendingRevealInteractable.ItemType.Drone: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texDroneIconOutlined"); component.color = getColorFromHex(DroneColor.Value); break; case PendingRevealInteractable.ItemType.Turret: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texDroneIconOutlined"); component.color = getColorFromHex(TurretColor.Value); break; case PendingRevealInteractable.ItemType.LunarChest: component.color = getColorFromHex(LunarChestColor.Value); break; case PendingRevealInteractable.ItemType.Rusty: component.color = getColorFromHex(RustyColor.Value); break; case PendingRevealInteractable.ItemType.Shrine: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texShrineIconOutlined"); if (!ShowIndividualShrines.Value) { component.color = getColorFromHex(ShrineColor.Value); } else { component.color = getColorFromHex(getSpecificShrineColor(text)); } break; case PendingRevealInteractable.ItemType.Duplicator: component.color = getColorFromHex(DuplicatorColor.Value); break; case PendingRevealInteractable.ItemType.CategoryChestDamage: component.color = getColorFromHex(CategoryChestDamageColor.Value); break; case PendingRevealInteractable.ItemType.CategoryChestHealing: component.color = getColorFromHex(CategoryChestHealingColor.Value); break; case PendingRevealInteractable.ItemType.CategoryChestUtility: component.color = getColorFromHex(CategoryChestUtilityColor.Value); break; case PendingRevealInteractable.ItemType.NewtAltar: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texTeleporterIconOutlined"); component.color = getColorFromHex(NewtAltarColor.Value); break; case PendingRevealInteractable.ItemType.Teleporter: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texTeleporterIconOutlined"); component.color = getColorFromHex(TeleporterColor.Value); break; case PendingRevealInteractable.ItemType.Scrapper: sprite = Resources.Load<Sprite>("Textures/MiscIcons/texLootIconOutlined"); component.color = getColorFromHex(ScrapperColor.Value); break; } defaultPingGameObjects = pingIndicator.interactablePingGameObjects; for (int j = 0; j < defaultPingGameObjects.Length; j++) { defaultPingGameObjects[j].SetActive(true); } component.sprite = sprite; } pingIndicator.SetFieldValue("fixedTimer", pingIndicator.GetFieldValue<float>("pingDuration")); } private string getSpecificShrineColor(string interactableName) { if (interactableName.Contains("chance")) { return ChanceShrineColor.Value; } if (interactableName.Contains("blood")) { return BloodShrineColor.Value; } if (interactableName.Contains("combat")) { return CombatShrineColor.Value; } if (interactableName.Contains("boss")) { return MountainShrineColor.Value; } if (interactableName.Contains("gold")) { return GoldShrineColor.Value; } if (interactableName.Contains("healing")) { return WoodShrineColor.Value; } if (interactableName.Contains("restack")) { return OrderShrineColor.Value; } if (interactableName.Contains("cleanse")) { return CleanseShrineColor.Value; } return "#ff9900"; } public void Pulse(ChestRevealer self, Type[] arr) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown Vector3 position = ((Component)self).transform.position; _ = self.radius; _ = self.radius; _ = 1f / self.pulseTravelSpeed; EffectManager.SpawnEffect(self.pulseEffectPrefab, new EffectData { origin = position, scale = self.radius * self.pulseEffectScale }, false); } private Color getColorFromHex(string hexColor) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ((Color)(ref result))..ctor(0f, 0f, 0f, 1f); if (!hexColor.StartsWith("#")) { hexColor = "#" + hexColor; } ColorUtility.TryParseHtmlString(hexColor, ref result); result.a = (float)IconTransparency.Value / 255f; return result; } private void addTreasureInfoLegacy(ChatTreasureInfo cti, string purchaseable) { if (purchaseable.StartsWith("chest") || purchaseable.StartsWith("voidchest") || purchaseable.Contains("shrinechance") || purchaseable.Contains("goldchest") || purchaseable.Contains("casino")) { cti.goldTreasureCount++; } else if (purchaseable.Contains("lunarchest")) { cti.lunarTreasureCount++; } else if (purchaseable.Contains("multishop")) { cti.multishopCount++; } else if (purchaseable.Contains("voidtriple")) { cti.voidmultishopCount++; } else if (purchaseable.Contains("equipment")) { cti.goldTreasureCount++; cti.equipmentTreasureCount++; } } private void printChatTreasureInfo(ChatTreasureInfo cti) { if (LegacyMode.Value) { if (cti.multishopCount + cti.voidmultishopCount != 0) { cti.goldTreasureCount += cti.multishopCount / 3 + cti.voidmultishopCount; } Chat.AddMessage(constructTreasuresLeftStringLegacy(cti.goldTreasureCount, cti.equipmentTreasureCount, cti.lunarTreasureCount)); } else { if (cti.multishopCount + cti.voidmultishopCount != 0) { cti.multishopCount = cti.multishopCount / 3 + cti.voidmultishopCount; } Chat.AddMessage(constructTreasuresLeftString(cti)); } } private string constructTreasuresLeftString(ChatTreasureInfo cti) { string text = ""; string text2 = ""; if (ShowBarrelsChat.Value && cti.moneyBarrelsCount != 0) { text = ((cti.moneyBarrelsCount != 1) ? "s" : ""); text2 = text2 + "<color=" + BarrelColor.Value + ">" + cti.moneyBarrelsCount + " money barrel" + text + "</color> left.\n"; } if (ShowChestsChat.Value && (cti.itemTreasureCount != 0 || cti.multishopCount != 0)) { text = ((cti.itemTreasureCount != 1) ? "s" : ""); string text3 = ((cti.multishopCount != 1) ? "s" : ""); bool flag = true; if (cti.itemTreasureCount != 0) { text2 = text2 + "<color=" + ChestColor.Value + ">" + cti.itemTreasureCount + " chest" + text + "</color>"; flag = false; } if (cti.multishopCount != 0) { string text4 = ((cti.itemTreasureCount == 0) ? "" : " and "); text2 = text2 + text4 + "<color=" + ChestColor.Value + ">" + cti.multishopCount + " multishop" + text3 + "</color>"; flag = false; } if (!flag) { text2 += " left.\n"; } } if (ShowEquipmentChat.Value && cti.equipmentTreasureCount != 0) { text = ((cti.equipmentTreasureCount != 1) ? "s" : ""); text2 = text2 + "<color=" + EquipmentColor.Value + ">" + cti.equipmentTreasureCount + " equipment barrel" + text + "</color> left.\n"; } if (ShowLunarChestsChat.Value && cti.lunarTreasureCount != 0) { text = ((cti.lunarTreasureCount != 1) ? "s" : ""); text2 = text2 + "<color=" + LunarChestColor.Value + ">" + cti.lunarTreasureCount + " lunar chest" + text + "</color> left.\n"; } if (!ShowIndividualShrinesChat.Value) { if (ShowShrinesChat.Value && cti.shrineCount != 0) { text = ((cti.shrineCount != 1) ? "s" : ""); text2 = text2 + "<color=" + ShrineColor.Value + ">" + cti.shrineCount + " shrine" + text + "</color> left.\n"; } } else if (ShowShrinesChat.Value && cti.shrineCount != 0) { bool flag2 = false; if (ShowChanceShrinesChat.Value && cti.chanceShrineCount != 0) { text = ((cti.chanceShrineCount != 1) ? "s" : ""); text2 = text2 + "<color=" + ChanceShrineColor.Value + ">" + cti.chanceShrineCount + " chance shrine" + text + "</color>"; flag2 = true; } if (ShowBloodShrinesChat.Value && cti.bloodShrineCount != 0) { text = ((cti.bloodShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + BloodShrineColor.Value + ">" + cti.bloodShrineCount + " blood shrine" + text + "</color>"; flag2 = true; } if (ShowCombatShrinesChat.Value && cti.combatShrineCount != 0) { text = ((cti.combatShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + CombatShrineColor.Value + ">" + cti.combatShrineCount + " combat shrine" + text + "</color>"; flag2 = true; } if (ShowMountainShrinesChat.Value && cti.mountainShrineCount != 0) { text = ((cti.mountainShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + MountainShrineColor.Value + ">" + cti.mountainShrineCount + " mountain shrine" + text + "</color>"; flag2 = true; } if (ShowGoldShrinesChat.Value && cti.goldShrineCount != 0) { text = ((cti.goldShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + GoldShrineColor.Value + ">" + cti.goldShrineCount + " gold shrine" + text + "</color>"; flag2 = true; } if (ShowWoodShrinesChat.Value && cti.woodShrineCount != 0) { text = ((cti.woodShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + WoodShrineColor.Value + ">" + cti.woodShrineCount + " wood shrine" + text + "</color>"; flag2 = true; } if (ShowOrderShrinesChat.Value && cti.orderShrineCount != 0) { text = ((cti.orderShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + OrderShrineColor.Value + ">" + cti.orderShrineCount + " order shrine" + text + "</color>"; flag2 = true; } if (ShowCleanseShrinesChat.Value && cti.cleanseShrineCount != 0) { text = ((cti.cleanseShrineCount != 1) ? "s" : ""); if (flag2) { text2 += ", "; } text2 = text2 + "<color=" + CleanseShrineColor.Value + ">" + cti.cleanseShrineCount + " cleansing pool" + text + "</color>"; flag2 = true; } if (flag2) { text2 += " left.\n"; } } if (ShowDronesAndTurretsChat.Value && (cti.dronesCount != 0 || cti.turretsCount != 0)) { text = ((cti.dronesCount != 1) ? "s" : ""); string text5 = ((cti.turretsCount != 1) ? "s" : ""); text2 = text2 + "<color=" + DroneColor.Value + ">" + cti.dronesCount + " drone" + text + "</color> and <color=" + TurretColor.Value + ">" + cti.turretsCount + " turret" + text5 + "</color> left.\n"; } bool flag3 = false; if ((ShowDuplicatorChat.Value || ShowScrapperChat.Value) && (cti.duplicatorCount != 0 || cti.scrapperCount != 0)) { if (ShowDuplicatorChat.Value && cti.duplicatorCount != 0) { text = ((cti.duplicatorCount != 1) ? "s" : ""); text2 = text2 + "<color=" + DuplicatorColor.Value + ">" + cti.duplicatorCount + " duplicator" + text + "</color>"; flag3 = true; } if (ShowScrapperChat.Value && cti.scrapperCount != 0) { text = ((cti.scrapperCount != 1) ? "s" : ""); if (flag3) { text2 += ", "; } text2 = text2 + "<color=" + ScrapperColor.Value + ">" + cti.scrapperCount + " scrapper" + text + "</color>"; flag3 = true; } if (flag3) { text2 += ".\n"; } } flag3 = false; if (ShowCategoryChestDamageChat.Value && cti.damageChestCount != 0) { text = ((cti.damageChestCount != 1) ? "s" : ""); text2 = text2 + "<color=" + CategoryChestDamageColor.Value + ">" + cti.damageChestCount + " damage Chest" + text + "</color>"; flag3 = true; } if (ShowCategoryChestHealingChat.Value && cti.healingChestCount != 0) { text = ((cti.healingChestCount != 1) ? "s" : ""); if (flag3) { text2 += ", "; } text2 = text2 + "<color=" + CategoryChestHealingColor.Value + ">" + cti.healingChestCount + " healing Chest" + text + "</color>"; flag3 = true; } if (ShowCategoryChestUtilityChat.Value && cti.utilityChestCount != 0) { text = ((cti.utilityChestCount != 1) ? "s" : ""); if (flag3) { text2 += ", "; } text2 = text2 + "<color=" + CategoryChestUtilityColor.Value + ">" + cti.utilityChestCount + " utility Chest" + text + "</color>"; flag3 = true; } if (flag3) { text2 += " left.\n"; } if (ShowRustyChat.Value && cti.rustyCount != 0) { text = ((cti.rustyCount != 1) ? "s" : ""); text2 = text2 + "<color=" + RustyColor.Value + ">" + cti.rustyCount + " rusty lockbox" + text + "</color> left.\n"; } if (ShowNewtAltarChat.Value && cti.newtAltarCount != 0) { text = ((cti.newtAltarCount != 1) ? "s" : ""); text2 = text2 + "<color=" + NewtAltarColor.Value + ">" + cti.newtAltarCount + " newt altar" + text + "</color> left.\n"; } text2 = ((text2.Length != 0) ? text2[..text2.LastIndexOf("\n")] : (text2 + "There's nothing left you want.")); return "<color=#8296ae>" + text2 + "</color>"; } private string constructTreasuresLeftStringLegacy(int goldTreasureCount, int equipmentTreasureCount, int lunarTreasureCount) { string text = "<color=#8296ae>"; if (goldTreasureCount == 0) { text += "No <color=#827e3d>gold</color> treasures"; } else { text = text + "<color=#dbd451>" + goldTreasureCount + " gold</color> treasure"; if (goldTreasureCount > 1) { text += "s"; } } text += " left"; if (equipmentTreasureCount > 0) { text = text + " (of those <color=#ff7f00>" + equipmentTreasureCount + " equipment</color> barrel"; if (equipmentTreasureCount > 1) { text += "s"; } text += ")"; } text += "."; if (lunarTreasureCount > 0) { text = text + "\n<color=#5d60cc>" + lunarTreasureCount + " lunar</color> treasure"; if (lunarTreasureCount > 1) { text += "s"; } text += " left."; } return text + "</color>"; } } public class ChatTreasureInfo { public int goldTreasureCount; public int equipmentTreasureCount; public int lunarTreasureCount; public int multishopCount; public int voidmultishopCount; public int itemTreasureCount; public int dronesCount; public int turretsCount; public int moneyBarrelsCount; public int shrineCount; public int newtAltarCount; public int duplicatorCount; public int damageChestCount; public int healingChestCount; public int utilityChestCount; public int rustyCount; public int chanceShrineCount; public int bloodShrineCount; public int combatShrineCount; public int mountainShrineCount; public int goldShrineCount; public int woodShrineCount; public int orderShrineCount; public int cleanseShrineCount; public int scrapperCount; public ChatTreasureInfo() { goldTreasureCount = 0; equipmentTreasureCount = 0; lunarTreasureCount = 0; multishopCount = 0; voidmultishopCount = 0; itemTreasureCount = 0; dronesCount = 0; turretsCount = 0; moneyBarrelsCount = 0; shrineCount = 0; newtAltarCount = 0; duplicatorCount = 0; scrapperCount = 0; damageChestCount = 0; healingChestCount = 0; utilityChestCount = 0; rustyCount = 0; chanceShrineCount = 0; bloodShrineCount = 0; combatShrineCount = 0; mountainShrineCount = 0; goldShrineCount = 0; woodShrineCount = 0; orderShrineCount = 0; cleanseShrineCount = 0; } } public class PendingRevealInteractable : IComparable<PendingRevealInteractable> { public enum ItemType { Barrel, ItemChest, EquipmentChest, LunarChest, Multi, Rusty, Shrine, Drone, Turret, Duplicator, CategoryChestDamage, CategoryChestHealing, CategoryChestUtility, Teleporter, NewtAltar, Invalid, Scrapper, VoidChest, VoidBarrel } public GameObject gameObject; public FixedTimeStamp time; public ItemType itemType; public PendingRevealInteractable(GameObject gameObject, FixedTimeStamp time, ItemType itemType) { //IL_000e: 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) this.gameObject = gameObject; this.time = time; this.itemType = itemType; } public int CompareTo(PendingRevealInteractable other) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ((FixedTimeStamp)(ref time)).CompareTo(other.time); } internal static ItemType GetItemType(string item) { if (item.StartsWith("chest") || item.StartsWith("voidchest") || item.Contains("goldchest") || item.Contains("multishop") || item.Contains("casino")) { return ItemType.ItemChest; } if (item.Contains("lunarchest")) { return ItemType.LunarChest; } if (item.Contains("drone")) { return ItemType.Drone; } if (item.Contains("turret")) { return ItemType.Turret; } if (item.Contains("equipment")) { return ItemType.EquipmentChest; } if (item.Contains("shrine")) { return ItemType.Shrine; } if (item.StartsWith("barrel") || item.StartsWith("voidcoinbarrel")) { return ItemType.Barrel; } if (item.Contains("duplicator")) { return ItemType.Duplicator; } if (item.Contains("categorychestdamage")) { return ItemType.CategoryChestDamage; } if (item.Contains("categorychesthealing")) { return ItemType.CategoryChestHealing; } if (item.Contains("categorychestutility")) { return ItemType.CategoryChestUtility; } if (item.Contains("lockbox")) { return ItemType.Rusty; } if (item.Contains("newt")) { return ItemType.NewtAltar; } if (item.Contains("teleporter")) { return ItemType.Teleporter; } if (item.Contains("scrapper")) { return ItemType.Scrapper; } return ItemType.Invalid; } }
BepinEx/plugins/MagnusMagnuson-ShrineOfDio/ShrineOfDio.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.EntityStates.CaptainSupplyDrop; using On.RoR2; using R2API.Utils; using RoR2; using RoR2.Hologram; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ShrineOfDio")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShrineOfDio")] [assembly: AssemblyTitle("ShrineOfDio")] [assembly: AssemblyVersion("1.0.0.0")] namespace ShrineOfDio; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.MagnusMagnuson.ShrineOfDio", "ShrineOfDio", "1.6.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ShrineOfDio : BaseUnityPlugin { public static ConfigEntry<bool> UseBalancedMode; public static ConfigEntry<int> ResurrectionCost; public static ConfigEntry<bool> AllowDuringTeleporterCharge; public static ConfigEntry<bool> AllowHacking; public const int UNINITIALIZED = -2; public const int BALANCED_MODE = -1; public int clientCost = -2; public bool isBalancedMode; private HashSet<NetworkUser> isDead = new HashSet<NetworkUser>(); public void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown InitConfig(); HackingMainState.PurchaseInteractionIsValidTarget += new hook_PurchaseInteractionIsValidTarget(HackingMainState_PurchaseInteractionIsValidTarget); OutsideInteractableLocker.LockPurchasable += new hook_LockPurchasable(OutsideInteractableLocker_LockPurchasable); SceneDirector.PlaceTeleporter += (hook_PlaceTeleporter)delegate(orig_PlaceTeleporter orig, SceneDirector self) { orig.Invoke(self); if (!RoR2Application.isInSinglePlayer) { SpawnShrineOfDio(self); } }; ShrineHealingBehavior.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, ShrineHealingBehavior self) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown orig.Invoke(self); if (!NetworkServer.active && clientCost == -2) { int cost = Reflection.GetFieldValue<PurchaseInteraction>((object)self, "purchaseInteraction").cost; if (cost != clientCost) { clientCost = cost; if (clientCost == -1) { isBalancedMode = true; } else { isBalancedMode = false; } Type[] array = (from t in typeof(ChestRevealer).Assembly.GetTypes() where typeof(IInteractable).IsAssignableFrom(t) select t).ToArray(); for (int i = 0; i < array.Length; i++) { foreach (MonoBehaviour item in InstanceTracker.FindInstancesEnumerable(array[i])) { if (((IInteractable)item).ShouldShowOnScanner() && ((object)(IInteractable)item).ToString().ToLower().Contains("shrinehealing")) { UpdateShrineDisplay(((Component)item).GetComponentInParent<ShrineHealingBehavior>()); } } } } } }; Stage.Start += (hook_Start)delegate(orig_Start orig, Stage self) { orig.Invoke(self); if (!RoR2Application.isInSinglePlayer && NetworkServer.active) { isDead.Clear(); } }; ShrineHealingBehavior.Awake += (hook_Awake)delegate(orig_Awake orig, ShrineHealingBehavior self) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!RoR2Application.isInSinglePlayer) { PurchaseInteraction fieldValue = Reflection.GetFieldValue<PurchaseInteraction>((object)self, "purchaseInteraction"); fieldValue.contextToken = "Offer to the Shrine of Dio"; fieldValue.displayNameToken = "Shrine of Dio"; self.costMultiplierPerPurchase = 1f; if (NetworkServer.active) { isBalancedMode = UseBalancedMode.Value; if (UseBalancedMode.Value) { fieldValue.costType = (CostTypeIndex)0; fieldValue.cost = -1; ((Component)fieldValue).GetComponent<HologramProjector>().displayDistance = 0f; ((Component)self).GetComponent<HologramProjector>().displayDistance = 0f; } else { fieldValue.costType = (CostTypeIndex)1; fieldValue.cost = ResurrectionCost.Value; } } else { clientCost = -2; } } }; ShrineHealingBehavior.AddShrineStack += (hook_AddShrineStack)delegate(orig_AddShrineStack orig, ShrineHealingBehavior self, Interactor interactor) { //IL_0039: 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_0094: 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_00a5: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00eb: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0153: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (!RoR2Application.isInSinglePlayer) { if (NetworkServer.active) { PlayerCharacterMasterController randomDeadCharacter = GetRandomDeadCharacter(); isDead.Remove(randomDeadCharacter.networkUser); randomDeadCharacter.master.Respawn(randomDeadCharacter.master.deathFootPosition, ((Component)randomDeadCharacter.master).transform.rotation); string baseToken = "<color=#beeca1>" + ((Component)interactor).GetComponent<CharacterBody>().GetUserName() + "</color> resurrected <color=#beeca1>" + randomDeadCharacter.networkUser.userName + "</color>"; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = baseToken }); EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/HippoRezEffect"), new EffectData { origin = randomDeadCharacter.master.GetBody().footPosition, rotation = ((Component)randomDeadCharacter.master).gameObject.transform.rotation }, true); Reflection.SetFieldValue<bool>((object)self, "waitingForRefresh", true); Reflection.SetFieldValue<float>((object)self, "refreshTimer", 2f); EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = ((Component)self).transform.position, rotation = Quaternion.identity, scale = 1f, color = Color32.op_Implicit(Color.green) }, true); CharacterBody component2 = ((Component)interactor).GetComponent<CharacterBody>(); if (UseBalancedMode.Value) { PurchaseInteraction component3 = ((Component)self).GetComponent<PurchaseInteraction>(); PurchaseInteraction.CreateItemTakenOrb(component2.corePosition, ((Component)component3).gameObject, Items.ExtraLife.itemIndex); component2.inventory.RemoveItem(Items.ExtraLife, 1); component2.inventory.GiveItem(Items.ExtraLifeConsumed, 1); } } } else { orig.Invoke(self, interactor); } }; CharacterMaster.OnBodyDeath += (hook_OnBodyDeath)delegate(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody masterbody) { orig.Invoke(self, masterbody); if (!RoR2Application.isInSinglePlayer && NetworkServer.active && masterbody.isPlayerControlled) { PlayerCharacterMasterController component = ((Component)self).GetComponent<PlayerCharacterMasterController>(); if (!isDead.Contains(component.networkUser)) { isDead.Add(component.networkUser); } } }; PurchaseInteraction.CanBeAffordedByInteractor += (hook_CanBeAffordedByInteractor)delegate(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor interactor) { if (!RoR2Application.isInSinglePlayer) { if (self.displayNameToken.Contains("Shrine of Dio") || self.displayNameToken.Contains("SHRINE_HEALING")) { if (isBalancedMode) { if (((Component)interactor).GetComponent<CharacterBody>().inventory.GetItemCount(Items.ExtraLife) > 0 && IsAnyoneDead()) { return true; } return false; } if (IsAnyoneDead()) { return orig.Invoke(self, interactor); } return false; } return orig.Invoke(self, interactor); } return orig.Invoke(self, interactor); }; } private bool HackingMainState_PurchaseInteractionIsValidTarget(orig_PurchaseInteractionIsValidTarget orig, PurchaseInteraction purchaseInteraction) { if (purchaseInteraction.displayNameToken.Equals("Shrine of Dio")) { return AllowHacking.Value; } return orig.Invoke(purchaseInteraction); } private void OutsideInteractableLocker_LockPurchasable(orig_LockPurchasable orig, OutsideInteractableLocker self, PurchaseInteraction purchaseInteraction) { if (!AllowDuringTeleporterCharge.Value || (!purchaseInteraction.displayNameToken.Equals("Shrine of Dio") && !purchaseInteraction.displayNameToken.Contains("SHRINE_HEALING"))) { orig.Invoke(self, purchaseInteraction); } } private void InitConfig() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown UseBalancedMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "UseBalancedMode", false, new ConfigDescription("Setting this to true will only allow you to resurrect other players for one of your Dio's Best Friend. Turning this off will allow you to instead use gold.", (AcceptableValueBase)null, Array.Empty<object>())); ResurrectionCost = ((BaseUnityPlugin)this).Config.Bind<int>("Config", "ResurrectionCost", 300, new ConfigDescription("[Only active if you set UseBalancedMode to false] Cost for a resurrection. Scales with difficulty but doesn't increase each usage. Regular Chest cost is 25, Golden/Legendary Chest is 400. Default is 300.", (AcceptableValueBase)null, Array.Empty<object>())); AllowDuringTeleporterCharge = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "AllowDuringTeleporterCharge", false, new ConfigDescription("Allows the Shrine of Dio to be used while the teleporter charges/prevents lock.", (AcceptableValueBase)null, Array.Empty<object>())); AllowHacking = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "AllowHacking", true, new ConfigDescription("Allows Captain to hack the Shrine of Dio.", (AcceptableValueBase)null, Array.Empty<object>())); } private void UpdateShrineDisplay(ShrineHealingBehavior self) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) PurchaseInteraction fieldValue = Reflection.GetFieldValue<PurchaseInteraction>((object)self, "purchaseInteraction"); if (clientCost == -1) { fieldValue.costType = (CostTypeIndex)0; fieldValue.cost = -1; ((Component)fieldValue).GetComponent<HologramProjector>().displayDistance = 0f; ((Component)self).GetComponent<HologramProjector>().displayDistance = 0f; } else { fieldValue.costType = (CostTypeIndex)1; fieldValue.cost = clientCost; } } private int GetDifficultyScaledCost(int baseCost) { return (int)((double)baseCost * (double)Mathf.Pow(Run.instance.difficultyCoefficient, 1.25f)); } private PlayerCharacterMasterController GetRandomDeadCharacter() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) List<PlayerCharacterMasterController> list = new List<PlayerCharacterMasterController>(); foreach (NetworkUser item in isDead) { if (item.master.playerCharacterMasterController.isConnected && (item.master.IsDeadAndOutOfLivesServer() || (Object)(object)item.master.bodyPrefab != (Object)(object)BodyCatalog.GetBodyPrefab(item.NetworkbodyIndexPreference))) { list.Add(item.master.playerCharacterMasterController); } } int index = new Random().Next(list.Count); return list[index]; } private bool IsAnyoneDead() { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected && (!Object.op_Implicit((Object)(object)instance.master.GetBody()) || !instance.master.GetBody().healthComponent.alive || isNonSurvivor(instance))) { return true; } } return false; } private bool isNonSurvivor(PlayerCharacterMasterController enumerator) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (enumerator.master.hasBody && !((Object)enumerator.networkUser.GetCurrentBody()).name.Split(new char[1] { '(' })[0].Equals(((Object)BodyCatalog.GetBodyPrefab(enumerator.networkUser.NetworkbodyIndexPreference)).name)) { return true; } return false; } public void SpawnShrineOfDio(SceneDirector self) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown Xoroshiro128Plus val = new Xoroshiro128Plus(Reflection.GetFieldValue<Xoroshiro128Plus>((object)self, "rng").nextUlong); if (SceneInfo.instance.countsAsStage) { SpawnCard val2 = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscShrineHealing"); GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val2, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, val)); if (!UseBalancedMode.Value) { val3.GetComponent<PurchaseInteraction>().Networkcost = GetDifficultyScaledCost(ResurrectionCost.Value); } } } }
BepinEx/plugins/Moffein-Bosses_Drop_Items/BossesDropItems.dll
Decompiled 11 months agousing System; 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 ArtifactOfPotential; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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("BossesDropItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BossesDropItems")] [assembly: AssemblyTitle("BossesDropItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BossesDropItems { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Moffein.BossesDropItems", "Bosses Drop Items", "1.3.0")] public class BossesDropItems : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Init <>9__24_0; public static hook_LoadGameModes <>9__24_1; public static hook_DropRewards <>9__24_2; public static hook_TakeDamage <>9__24_3; internal void <Awake>b__24_0(orig_Init orig) { //IL_000d: 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_001c: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); LunarGolemBodyIndex = BodyCatalog.FindBodyIndex("LunarGolemBody"); LunarExploderBodyIndex = BodyCatalog.FindBodyIndex("LunarExploderBody"); LunarWispBodyIndex = BodyCatalog.FindBodyIndex("LunarWispBody"); ElectricWormBodyIndex = BodyCatalog.FindBodyIndex("ElectricWormBody"); } internal void <Awake>b__24_1(orig_LoadGameModes orig) { //IL_000d: 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) orig.Invoke(); SimulacrumIndex = GameModeCatalog.FindGameModeIndex("InfiniteTowerRun"); } internal void <Awake>b__24_2(orig_DropRewards orig, BossGroup self) { if (self.forceTier3Reward) { orig.Invoke(self); } } internal void <Awake>b__24_3(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Invalid comparison between Unknown and I4 //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) bool alive = self.alive; bool flag = Object.op_Implicit((Object)(object)self.body) && self.body.isBoss; bool flag2 = !sacrificeOnly || RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Sacrifice.artifactIndex); orig.Invoke(self, damageInfo); if (!(NetworkServer.active && flag2 && alive) || self.alive || !Object.op_Implicit((Object)(object)((Component)self).gameObject) || !Object.op_Implicit((Object)(object)self.body) || (!self.body.isChampion && (!(!self.body.isChampion && flag) || !hordeDropsItems || Run.instance.gameModeIndex == SimulacrumIndex)) || !Object.op_Implicit((Object)(object)self.body.teamComponent) || (int)self.body.teamComponent.teamIndex != 2 || (flag && !teleBossDropsItems) || (!lunarChimerasDropItems && (self.body.bodyIndex == LunarWispBodyIndex || self.body.bodyIndex == LunarGolemBodyIndex || self.body.bodyIndex == LunarExploderBodyIndex))) { return; } DeathRewards component = ((Component)self).gameObject.GetComponent<DeathRewards>(); PickupIndex bossPickup = (Object.op_Implicit((Object)(object)component) ? PickupCatalog.FindPickupIndex(component.bossPickup.pickupName) : PickupIndex.none); DropItem(self.body, bossPickup, guaranteeTeleGreen && flag && self.body.isChampion, 0f); if ((self.body.isChampion && self.body.isElite) || self.body.bodyIndex == ElectricWormBodyIndex) { int num = 0; if (Object.op_Implicit((Object)(object)self.body.master)) { num += Mathf.RoundToInt((float)self.body.master.inventory.GetItemCount(Items.BoostHp) / 10f); } if (self.body.bodyIndex == ElectricWormBodyIndex) { num += overloadingWormBonus; } if (self.body.isElite) { num = Math.Max(num, minEliteBossDrops); } num = Math.Min(maxExtraDrops, num); for (int i = 0; i < num; i++) { DropItem(self.body, bossPickup, guaranteeTeleGreen && flag && self.body.isChampion, 15f); } } } } public static float blankChance = 0f; public static float whiteChance = 60f; public static float greenChance = 30f; public static float redChance = 3f; public static float yellowChance = 7f; public static int minEliteBossDrops = 3; public static int maxExtraDrops = 7; public static bool guaranteeTeleGreen = true; public static bool teleBossDropsItems = true; public static bool hordeDropsItems = true; public static bool lunarChimerasDropItems = false; public static bool enableTeleDrops = true; public static bool sacrificeOnly = false; public static int overloadingWormBonus = 4; public static bool artifactPotentialLoaded = false; private static BodyIndex LunarGolemBodyIndex; private static BodyIndex LunarWispBodyIndex; private static BodyIndex LunarExploderBodyIndex; private static BodyIndex ElectricWormBodyIndex; private static GameModeIndex SimulacrumIndex; public static PickupDropTable tier1Drops = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier1Item.asset").WaitForCompletion(); public static PickupDropTable tier2Drops = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier2Item.asset").WaitForCompletion(); public static PickupDropTable tier3Drops = Addressables.LoadAssetAsync<PickupDropTable>((object)"RoR2/Base/Common/dtTier3Item.asset").WaitForCompletion(); public static GameObject potentialPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/OptionPickup/OptionPickup.prefab").WaitForCompletion(); public void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0075: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00aa: Expected O, but got Unknown //IL_00c4: 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_00df: Expected O, but got Unknown //IL_00df: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0114: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0149: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_017e: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01b3: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01e8: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_0221: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_025a: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_0293: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02cc: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Expected O, but got Unknown //IL_0305: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown artifactPotentialLoaded = Chainloader.PluginInfos.ContainsKey("zombieseatflesh7.ArtifactOfPotential"); sacrificeOnly = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Sacrifice Only"), false, new ConfigDescription("Only drop items if the Artifact of Sacrifice is enabled.", (AcceptableValueBase)null, Array.Empty<object>())).Value; enableTeleDrops = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Enable Teleporter Drops"), true, new ConfigDescription("Teleporters drop items for all players when all bosses are killed.", (AcceptableValueBase)null, Array.Empty<object>())).Value; teleBossDropsItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Teleporter Bosses Drop Items"), false, new ConfigDescription("Allows Teleporter Bosses to drop items when killed.", (AcceptableValueBase)null, Array.Empty<object>())).Value; hordeDropsItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Horde of Many Drops Items"), false, new ConfigDescription("Allows Horde of Many Bosses to drop items when killed.", (AcceptableValueBase)null, Array.Empty<object>())).Value; guaranteeTeleGreen = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Guaranteed Green from Tele Bosses"), false, new ConfigDescription("Guarantees that Teleporter Bosses will drop only Green-tier items or better. Does not apply to Horde of Many.", (AcceptableValueBase)null, Array.Empty<object>())).Value; maxExtraDrops = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Drop Settings", "Max Extra Drops"), 0, new ConfigDescription("Maximum amount of extra items Elite Bosses can drop. Regular Elite Bosses will attempt to drop 3 extra items, while Tier 2 Elite Bosses will attempt to drop 17.", (AcceptableValueBase)null, Array.Empty<object>())).Value; minEliteBossDrops = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Drop Settings", "Min Extra Elite Boss Drops"), 0, new ConfigDescription("Minimum amount of extra items Elite Bosses can drop.", (AcceptableValueBase)null, Array.Empty<object>())).Value; overloadingWormBonus = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Drop Settings", "Overloading Worm Extra Boss Drops"), 0, new ConfigDescription("Extra item drops from Overloading Worms.", (AcceptableValueBase)null, Array.Empty<object>())).Value; lunarChimerasDropItems = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Drop Settings", "Lunar Chimeras Drop Items"), false, new ConfigDescription("Makes Lunar Chimeras able to drop items when they show up as bosses during Mitchell Phase 2.", (AcceptableValueBase)null, Array.Empty<object>())).Value; blankChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Item Tier Settings", "Blank Chance"), 0f, new ConfigDescription("Chance for bosses to drop no items.", (AcceptableValueBase)null, Array.Empty<object>())).Value; whiteChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Item Tier Settings", "White Chance"), 60f, new ConfigDescription("Chance for bosses to drop a white item.", (AcceptableValueBase)null, Array.Empty<object>())).Value; greenChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Item Tier Settings", "Green Chance"), 30f, new ConfigDescription("Chance for bosses to drop a green item.", (AcceptableValueBase)null, Array.Empty<object>())).Value; redChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Item Tier Settings", "Red Chance"), 3f, new ConfigDescription("Chance for bosses to drop a red item.", (AcceptableValueBase)null, Array.Empty<object>())).Value; yellowChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Item Tier Settings", "Yellow Chance"), 7f, new ConfigDescription("Chance for bosses to drop their corresponding boss item if they have one.", (AcceptableValueBase)null, Array.Empty<object>())).Value; object obj = <>c.<>9__24_0; if (obj == null) { hook_Init val = delegate(orig_Init orig) { //IL_000d: 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_001c: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); LunarGolemBodyIndex = BodyCatalog.FindBodyIndex("LunarGolemBody"); LunarExploderBodyIndex = BodyCatalog.FindBodyIndex("LunarExploderBody"); LunarWispBodyIndex = BodyCatalog.FindBodyIndex("LunarWispBody"); ElectricWormBodyIndex = BodyCatalog.FindBodyIndex("ElectricWormBody"); }; <>c.<>9__24_0 = val; obj = (object)val; } BodyCatalog.Init += (hook_Init)obj; object obj2 = <>c.<>9__24_1; if (obj2 == null) { hook_LoadGameModes val2 = delegate(orig_LoadGameModes orig) { //IL_000d: 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) orig.Invoke(); SimulacrumIndex = GameModeCatalog.FindGameModeIndex("InfiniteTowerRun"); }; <>c.<>9__24_1 = val2; obj2 = (object)val2; } GameModeCatalog.LoadGameModes += (hook_LoadGameModes)obj2; if (!enableTeleDrops) { object obj3 = <>c.<>9__24_2; if (obj3 == null) { hook_DropRewards val3 = delegate(orig_DropRewards orig, BossGroup self) { if (self.forceTier3Reward) { orig.Invoke(self); } }; <>c.<>9__24_2 = val3; obj3 = (object)val3; } BossGroup.DropRewards += (hook_DropRewards)obj3; } object obj4 = <>c.<>9__24_3; if (obj4 == null) { hook_TakeDamage val4 = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Invalid comparison between Unknown and I4 //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) bool alive = self.alive; bool flag = Object.op_Implicit((Object)(object)self.body) && self.body.isBoss; bool flag2 = !sacrificeOnly || RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Sacrifice.artifactIndex); orig.Invoke(self, damageInfo); if (NetworkServer.active && flag2 && alive && !self.alive && Object.op_Implicit((Object)(object)((Component)self).gameObject) && Object.op_Implicit((Object)(object)self.body) && (self.body.isChampion || (!self.body.isChampion && flag && hordeDropsItems && Run.instance.gameModeIndex != SimulacrumIndex)) && Object.op_Implicit((Object)(object)self.body.teamComponent) && (int)self.body.teamComponent.teamIndex == 2 && (!flag || teleBossDropsItems) && (lunarChimerasDropItems || (self.body.bodyIndex != LunarWispBodyIndex && self.body.bodyIndex != LunarGolemBodyIndex && self.body.bodyIndex != LunarExploderBodyIndex))) { DeathRewards component = ((Component)self).gameObject.GetComponent<DeathRewards>(); PickupIndex bossPickup = (Object.op_Implicit((Object)(object)component) ? PickupCatalog.FindPickupIndex(component.bossPickup.pickupName) : PickupIndex.none); DropItem(self.body, bossPickup, guaranteeTeleGreen && flag && self.body.isChampion, 0f); if ((self.body.isChampion && self.body.isElite) || self.body.bodyIndex == ElectricWormBodyIndex) { int num = 0; if (Object.op_Implicit((Object)(object)self.body.master)) { num += Mathf.RoundToInt((float)self.body.master.inventory.GetItemCount(Items.BoostHp) / 10f); } if (self.body.bodyIndex == ElectricWormBodyIndex) { num += overloadingWormBonus; } if (self.body.isElite) { num = Math.Max(num, minEliteBossDrops); } num = Math.Min(maxExtraDrops, num); for (int i = 0; i < num; i++) { DropItem(self.body, bossPickup, guaranteeTeleGreen && flag && self.body.isChampion, 15f); } } } }; <>c.<>9__24_3 = val4; obj4 = (object)val4; } HealthComponent.TakeDamage += (hook_TakeDamage)obj4; } private static void DropItem(CharacterBody victimBody, PickupIndex bossPickup, bool greenMinimum, float randomOffset) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Invalid comparison between Unknown and I4 //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Invalid comparison between Unknown and I4 //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) bool flag = false; ItemTier val = (ItemTier)5; float num = whiteChance + greenChance + redChance + yellowChance + blankChance; if (!greenMinimum && Util.CheckRoll(100f * blankChance / num, 0f, (CharacterMaster)null)) { return; } num -= blankChance; List<PickupIndex> list; if (!greenMinimum && Util.CheckRoll(100f * whiteChance / num, 0f, (CharacterMaster)null)) { list = Run.instance.availableTier1DropList; val = (ItemTier)0; } else { num -= whiteChance; if (Util.CheckRoll(100f * greenChance / num, 0f, (CharacterMaster)null)) { list = Run.instance.availableTier2DropList; val = (ItemTier)1; } else { num -= greenChance; if (Util.CheckRoll(100f * redChance / num, 0f, (CharacterMaster)null)) { list = Run.instance.availableTier3DropList; val = (ItemTier)2; } else if (bossPickup != PickupIndex.none) { list = new List<PickupIndex> { bossPickup }; flag = true; } else { list = Run.instance.availableTier2DropList; val = (ItemTier)1; } } } int index = Run.instance.treasureRng.RangeInt(0, list.Count); PickupIndex val2 = list[index]; if (flag || !IsPotentialArtifactActive()) { PickupDropletController.CreatePickupDroplet(val2, victimBody.transform.position, new Vector3(Random.Range(0f, randomOffset), 20f, Random.Range(0f, randomOffset))); return; } ItemTier val3 = val; ItemTier val4 = val3; PickupDropTable val5 = (((int)val4 == 1) ? tier2Drops : (((int)val4 != 2) ? tier1Drops : tier3Drops)); Option[] array = PickupPickerController.GenerateOptionsFromDropTable(3, val5, Run.instance.treasureRng); if (array.Length != 0) { bool flag2 = false; Option[] array2 = array; foreach (Option val6 in array2) { if (val6.pickupIndex == val2) { flag2 = true; break; } } if (!flag2) { array[0].pickupIndex = val2; } CreatePickupInfo val7 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val7)).pickupIndex = PickupCatalog.FindPickupIndex(val); val7.pickerOptions = array; val7.rotation = Quaternion.identity; val7.prefabOverride = potentialPrefab; PickupDropletController.CreatePickupDroplet(val7, victimBody.transform.position, Vector3.up * 20f); } else { PickupDropletController.CreatePickupDroplet(val2, victimBody.transform.position, new Vector3(Random.Range(0f, randomOffset), 20f, Random.Range(0f, randomOffset))); } } public static bool IsPotentialArtifactActive() { bool result = false; if (artifactPotentialLoaded) { result = IsPotentialArtifactActiveInternal(); } return result; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool IsPotentialArtifactActiveInternal() { return Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(PotentialArtifact.Potential); } } } namespace R2API.Utils { [AttributeUsage(AttributeTargets.Assembly)] public class ManualNetworkRegistrationAttribute : Attribute { } }
BepinEx/plugins/Moffein-ItemStats/ItemStats.dll
Decompiled 11 months agousing System; 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 On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; [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("ItemStats")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItemStats")] [assembly: AssemblyTitle("ItemStats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ItemStats { [BepInPlugin("com.Moffein.ItemStats", "ItemStats", "1.3.1")] public class ItemStats : BaseUnityPlugin { public static List<ItemDef> IgnoredItems = new List<ItemDef>(); public static List<EquipmentDef> IgnoredEquipment = new List<EquipmentDef>(); public static bool pingDetails = true; public static bool pingDetailsVerbose = false; public static float pingDetailsDuration = 3f; public static bool pingNotif = true; public static bool pingChat = false; public static bool detailedHover = true; public static bool detailedPickup = true; public void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown ReadConfig(); if (detailedHover) { ItemIcon.SetItemIndex += new hook_SetItemIndex(ItemIcon_SetItemIndex); EquipmentIcon.Update += new hook_Update(EquipmentIcon_Update); } if (detailedPickup) { GenericNotification.SetItem += new hook_SetItem(GenericNotification_SetItem); GenericNotification.SetEquipment += new hook_SetEquipment(GenericNotification_SetEquipment); } if (pingDetails) { PingerController.SetCurrentPing += new hook_SetCurrentPing(PingerController_SetCurrentPing); } } public void ReadConfig() { detailedHover = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Detailed Hover", true, "Show full item description when hovering over the item icon.").Value; detailedPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Detailed Pickup", true, "Show full item description when picking up the item.").Value; pingDetailsDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Ping Details - Notification Duration", 3f, "How long the item notification lasts for.").Value; pingDetails = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details", true, "Pinging an item shows its description.").Value; pingNotif = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Notification", true, "Item description shows as a notification on the HUD.").Value; pingChat = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Chat Message", false, "Item description shows as a chat message.").Value; pingDetailsVerbose = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Ping Details - Show as Chat Message - Show Full Description", false, "Chat messages show the full item description.").Value; if (!pingChat && !pingNotif) { pingDetails = false; } } private void PingerController_SetCurrentPing(orig_SetCurrentPing orig, PingerController self, PingInfo newPingInfo) { //IL_0003: 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_00b5: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown orig.Invoke(self, newPingInfo); if (!((NetworkBehaviour)self).hasAuthority || !Object.op_Implicit((Object)(object)((PingInfo)(ref newPingInfo)).targetGameObject)) { return; } PickupDef val = null; GenericPickupController component = ((PingInfo)(ref newPingInfo)).targetGameObject.GetComponent<GenericPickupController>(); if (Object.op_Implicit((Object)(object)component)) { val = PickupCatalog.GetPickupDef(component.pickupIndex); } else { ShopTerminalBehavior component2 = ((PingInfo)(ref newPingInfo)).targetGameObject.GetComponent<ShopTerminalBehavior>(); if (Object.op_Implicit((Object)(object)component2) && !component2.pickupIndexIsHidden && !component2.Networkhidden && Object.op_Implicit((Object)(object)component2.pickupDisplay)) { val = PickupCatalog.GetPickupDef(component2.pickupIndex); } } if (val == null) { return; } ItemDef itemDef = ItemCatalog.GetItemDef(val.itemIndex); if (Object.op_Implicit((Object)(object)itemDef)) { if (pingChat) { Chat.AddMessage((ChatMessageBase)new SimpleChatMessage { baseToken = ((pingDetailsVerbose && !IgnoredItems.Contains(itemDef)) ? itemDef.descriptionToken : itemDef.pickupToken) }); } if (pingNotif) { CharacterMaster component3 = ((Component)self).gameObject.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component3)) { PushItemNotificationDuration(component3, itemDef.itemIndex, pingDetailsDuration); } } return; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.equipmentIndex); if (!Object.op_Implicit((Object)(object)equipmentDef)) { return; } if (pingChat) { Chat.AddMessage((ChatMessageBase)new SimpleChatMessage { baseToken = ((pingDetailsVerbose && !IgnoredEquipment.Contains(equipmentDef)) ? equipmentDef.descriptionToken : equipmentDef.pickupToken) }); } if (pingNotif) { CharacterMaster component4 = ((Component)self).gameObject.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component4)) { PushEquipmentNotificationDuration(component4, equipmentDef.equipmentIndex, pingDetailsDuration); } } } public static void GenericNotification_SetItem(orig_SetItem orig, GenericNotification self, ItemDef itemDef) { orig.Invoke(self, itemDef); if (!IgnoredItems.Contains(itemDef)) { if (!Language.IsTokenInvalid(itemDef.descriptionToken)) { self.descriptionText.token = itemDef.descriptionToken; } else { self.descriptionText.token = itemDef.pickupToken; } } } private void GenericNotification_SetEquipment(orig_SetEquipment orig, GenericNotification self, EquipmentDef equipmentDef) { orig.Invoke(self, equipmentDef); if (!IgnoredEquipment.Contains(equipmentDef)) { if (!Language.IsTokenInvalid(equipmentDef.descriptionToken)) { self.descriptionText.token = equipmentDef.descriptionToken; } else { self.descriptionText.token = equipmentDef.pickupToken; } } } public static void ItemIcon_SetItemIndex(orig_SetItemIndex orig, ItemIcon self, ItemIndex newItemIndex, int newItemCount) { //IL_0003: 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) orig.Invoke(self, newItemIndex, newItemCount); ItemDef itemDef = ItemCatalog.GetItemDef(newItemIndex); if (Object.op_Implicit((Object)(object)itemDef) && Object.op_Implicit((Object)(object)self.tooltipProvider) && !IgnoredItems.Contains(itemDef)) { if (!Language.IsTokenInvalid(itemDef.descriptionToken)) { self.tooltipProvider.overrideBodyText = Language.GetString(itemDef.descriptionToken); } else { self.tooltipProvider.overrideBodyText = itemDef.pickupToken; } } } private void EquipmentIcon_Update(orig_Update orig, EquipmentIcon self) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!self.hasEquipment || !Object.op_Implicit((Object)(object)self.tooltipProvider) || !Object.op_Implicit((Object)(object)self.targetEquipmentSlot)) { return; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(self.targetEquipmentSlot.equipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef) && !IgnoredEquipment.Contains(equipmentDef)) { if (!Language.IsTokenInvalid(equipmentDef.descriptionToken)) { self.tooltipProvider.overrideBodyText = Language.GetString(equipmentDef.descriptionToken); } else { self.tooltipProvider.overrideBodyText = Language.GetString(equipmentDef.pickupToken); } } } public static void PushItemNotificationDuration(CharacterMaster characterMaster, ItemIndex itemIndex, float duration) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_004a: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (!((NetworkBehaviour)characterMaster).hasAuthority) { Debug.LogError((object)("Can't PushItemNotification for " + Util.GetBestMasterName(characterMaster) + " because they aren't local.")); return; } CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(characterMaster); if (Object.op_Implicit((Object)(object)notificationQueueForMaster) && (int)itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!((Object)(object)itemDef == (Object)null) && !itemDef.hidden) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)ItemCatalog.GetItemDef(itemIndex), (TransformationInfo)null), duration); } } } public static void PushEquipmentNotificationDuration(CharacterMaster characterMaster, EquipmentIndex equipmentIndex, float duration) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown if (!((NetworkBehaviour)characterMaster).hasAuthority) { Debug.LogError((object)("Can't PushEquipmentNotification for " + Util.GetBestMasterName(characterMaster) + " because they aren't local.")); return; } CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(characterMaster); if (Object.op_Implicit((Object)(object)notificationQueueForMaster) && (int)equipmentIndex != -1) { notificationQueueForMaster.PushNotification(new NotificationInfo((object)EquipmentCatalog.GetEquipmentDef(equipmentIndex), (TransformationInfo)null), duration); } } } } namespace R2API.Utils { [AttributeUsage(AttributeTargets.Assembly)] public class ManualNetworkRegistrationAttribute : Attribute { } }
BepinEx/plugins/Moffein-SnapfreezeDefense/SnapfreezeDefense.dll
Decompiled 11 months agousing 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.Bootstrap; using EntityStates; using EntityStates.EngiTurret.EngiTurretWeapon; using EntityStates.GolemMonster; using EntityStates.TitanMonster; using On.EntityStates.EngiTurret.EngiTurretWeapon; using On.EntityStates.GolemMonster; using On.EntityStates.TitanMonster; using On.RoR2; using R2API; using R2API.Utils; using RiskyMod.Survivors; using RiskyMod.Survivors.Mage; using RiskyMod.Survivors.Mage.SkillTweaks; using RoR2; using RoR2.Projectile; using SnapfreezeDefense.Components; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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("SnapfreezeDefense")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SnapfreezeDefense")] [assembly: AssemblyTitle("SnapfreezeDefense")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SnapfreezeDefense { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Moffein.SnapfreezeDefense", "SnapfreezeDefense", "1.0.0")] [R2APISubmoduleDependency(new string[] { "PrefabAPI", "ContentAddition" })] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class SnapfreezeDefense : BaseUnityPlugin { public static GameObject modifiedIceWallPillarProjectile; public static GameObject modifiedIceWallWalkerProjectile; public void Awake() { bool flag = true; if (Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod")) { flag = !RiskyModAppliedFix(); } if (!flag) { Debug.LogError((object)"SnapfreezeDefense: RiskyMod already applied change. Code will not be run."); return; } BuildProjectile(); DefenseMatrixManager.Initialize(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private bool RiskyModAppliedFix() { return SurvivorsCore.enabled && MageCore.enabled && IceWallDefense.enabled; } private void BuildProjectile() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_00ae: Unknown result type (might be due to invalid IL or missing references) DefenseMatrixManager.enabled = true; modifiedIceWallPillarProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageIcewallPillarProjectile.prefab").WaitForCompletion(), "StandaloneRiskyModIceWallPillarProjectile", true); modifiedIceWallPillarProjectile.AddComponent<IceWallDefenseComponent>(); ContentAddition.AddProjectile(modifiedIceWallPillarProjectile); modifiedIceWallWalkerProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageIcewallWalkerProjectile.prefab").WaitForCompletion(), "StandaloneRiskyModIceWallWalkerProjectile", true); ProjectileMageFirewallWalkerController component = modifiedIceWallWalkerProjectile.GetComponent<ProjectileMageFirewallWalkerController>(); if (Object.op_Implicit((Object)(object)component)) { component.firePillarPrefab = modifiedIceWallPillarProjectile; } ContentAddition.AddProjectile(modifiedIceWallWalkerProjectile); SetEntityStateField("EntityStates.Mage.Weapon.PrepWall", "projectilePrefab", (Object)(object)modifiedIceWallWalkerProjectile); GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/OmniImpactVFXFrozen.prefab").WaitForCompletion(), "StandaloneRiskyModIceWallDeletionEffect", false); EffectComponent component2 = val.GetComponent<EffectComponent>(); component2.soundName = "Play_captain_drone_zap"; ContentAddition.AddEffect(val); IceWallDefenseComponent.projectileDeletionEffectPrefab = val; } private bool SetEntityStateField(string entityStateName, string fieldName, Object newObject) { EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName); for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++) { if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject; return true; } } return false; } } public static class DefenseMatrixManager { public class DefenseMatrixInfo { public Collider[] colliders; public TeamIndex teamIndex; public DefenseMatrixInfo(Collider[] colliders, TeamIndex teamIndex) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) this.colliders = colliders; this.teamIndex = teamIndex; } public void EnableColliders() { for (int i = 0; i < colliders.Length; i++) { colliders[i].enabled = true; } } public void DisableColliders() { for (int i = 0; i < colliders.Length; i++) { colliders[i].enabled = false; } } } private static class Hooks { public static Vector3 FireBeam_GetBeamEndPoint(orig_GetBeamEndPoint orig, FireBeam 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_0008: Unknown result type (might be due to invalid IL or missing references) //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_0017: 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_001f: 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) TeamIndex team = ((BaseState)self).GetTeam(); EnableMatrices(team); Vector3 result = orig.Invoke(self); DisableMatrices(team); return result; } public static void ChargeMegaLaser_FixedUpdate(orig_FixedUpdate orig, ChargeMegaLaser 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) TeamIndex team = ((BaseState)self).GetTeam(); EnableMatrices(team); orig.Invoke(self); DisableMatrices(team); } public static void FireMegaLaser_FixedUpdate(orig_FixedUpdate orig, FireMegaLaser 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) TeamIndex team = ((BaseState)self).GetTeam(); EnableMatrices(team); orig.Invoke(self); DisableMatrices(team); } public static void ChargeLaser_Update(orig_Update orig, ChargeLaser 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) TeamIndex team = ((BaseState)self).GetTeam(); EnableMatrices(team); orig.Invoke(self); DisableMatrices(team); } public static void DefenseMatrixBlockGolemLaserFire(orig_OnEnter orig, FireLaser 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) TeamIndex team = ((BaseState)self).GetTeam(); if (((EntityState)self).isAuthority) { EnableMatrices(team); } orig.Invoke(self); if (((EntityState)self).isAuthority) { DisableMatrices(team); } } public static void CheckHostileDefenseMatrices(orig_Fire orig, BulletAttack self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_002f: Unknown result type (might be due to invalid IL or missing references) TeamIndex attackerTeam = (TeamIndex)(-1); if (Object.op_Implicit((Object)(object)self.owner)) { TeamComponent component = self.owner.GetComponent<TeamComponent>(); if (Object.op_Implicit((Object)(object)component)) { attackerTeam = component.teamIndex; } } EnableMatrices(attackerTeam); orig.Invoke(self); DisableMatrices(attackerTeam); } public static void ClearDefenseMatrixListOnStageStart(Stage obj) { ClearList(); } } private static List<DefenseMatrixInfo> activeDefenseMatrices = new List<DefenseMatrixInfo>(); public static bool enabled = false; private static bool initialized = false; internal static void Initialize() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (enabled && !initialized) { initialized = true; Stage.onStageStartGlobal += Hooks.ClearDefenseMatrixListOnStageStart; BulletAttack.Fire += new hook_Fire(Hooks.CheckHostileDefenseMatrices); FireLaser.OnEnter += new hook_OnEnter(Hooks.DefenseMatrixBlockGolemLaserFire); ChargeLaser.Update += new hook_Update(Hooks.ChargeLaser_Update); ChargeMegaLaser.FixedUpdate += new hook_FixedUpdate(Hooks.ChargeMegaLaser_FixedUpdate); FireMegaLaser.FixedUpdate += new hook_FixedUpdate(Hooks.FireMegaLaser_FixedUpdate); FireBeam.GetBeamEndPoint += new hook_GetBeamEndPoint(Hooks.FireBeam_GetBeamEndPoint); } } public static void ClearList() { activeDefenseMatrices.Clear(); } public static DefenseMatrixInfo AddMatrix(DefenseMatrixInfo defenseMatrixInfo) { if (defenseMatrixInfo != null && defenseMatrixInfo.colliders != null && defenseMatrixInfo.colliders.Length != 0) { activeDefenseMatrices.Add(defenseMatrixInfo); return defenseMatrixInfo; } return null; } public static void RemoveMatrix(DefenseMatrixInfo defenseMatrixInfo) { activeDefenseMatrices.Remove(defenseMatrixInfo); } public static void EnableMatrices(TeamIndex attackerTeam) { //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) foreach (DefenseMatrixInfo activeDefenseMatrix in activeDefenseMatrices) { if (activeDefenseMatrix.teamIndex != attackerTeam) { activeDefenseMatrix.EnableColliders(); } } } public static void DisableMatrices(TeamIndex attackerTeam) { //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) foreach (DefenseMatrixInfo activeDefenseMatrix in activeDefenseMatrices) { if (activeDefenseMatrix.teamIndex != attackerTeam) { activeDefenseMatrix.DisableColliders(); } } } } } namespace SnapfreezeDefense.Components { public class IceWallDefenseComponent : MonoBehaviour { public static GameObject projectileDeletionEffectPrefab; private GameObject matrixObject; private DefenseMatrixManager.DefenseMatrixInfo defenseMatrixInfo; private BoxCollider collider; private TeamFilter tf; public void Start() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)matrixObject)) { return; } tf = ((Component)this).GetComponent<TeamFilter>(); if (Object.op_Implicit((Object)(object)tf) && (int)tf.teamIndex != -1 && Object.op_Implicit((Object)(object)((Component)this).transform)) { GameObject val = new GameObject { layer = LayerIndex.entityPrecise.intVal }; BoxCollider val2 = val.AddComponent<BoxCollider>(); val2.size = new Vector3(2.5f, 2.5f, 7f); ((Collider)val2).enabled = false; val.transform.localPosition = ((Component)this).transform.localPosition; val.transform.localRotation = ((Component)this).transform.localRotation; val.transform.localScale = ((Component)this).transform.localScale; matrixObject = val; collider = matrixObject.GetComponent<BoxCollider>(); if (Object.op_Implicit((Object)(object)collider)) { defenseMatrixInfo = new DefenseMatrixManager.DefenseMatrixInfo((Collider[])(object)new Collider[1] { (Collider)collider }, tf.teamIndex); DefenseMatrixManager.AddMatrix(defenseMatrixInfo); } } } public void FixedUpdate() { if (NetworkServer.active && Object.op_Implicit((Object)(object)tf) && Object.op_Implicit((Object)(object)collider)) { DeleteProjectile(); } } public void DeleteProjectile() { //IL_000d: 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_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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) List<ProjectileController> list = new List<ProjectileController>(); Vector3 size = collider.size; Vector3 position = ((Component)collider).transform.position; Quaternion rotation = ((Component)collider).transform.rotation; LayerIndex projectile = LayerIndex.projectile; Collider[] array = Physics.OverlapBox(position, size, rotation, LayerMask.op_Implicit(((LayerIndex)(ref projectile)).mask)); Collider[] array2 = array; foreach (Collider val in array2) { ProjectileController componentInParent = ((Component)val).GetComponentInParent<ProjectileController>(); if (Object.op_Implicit((Object)(object)componentInParent) && !componentInParent.cannotBeDeleted && (!Object.op_Implicit((Object)(object)componentInParent.teamFilter) || componentInParent.teamFilter.teamIndex != tf.teamIndex)) { bool flag = false; ProjectileSimple component = ((Component)componentInParent).gameObject.GetComponent<ProjectileSimple>(); ProjectileCharacterController component2 = ((Component)componentInParent).gameObject.GetComponent<ProjectileCharacterController>(); if ((!Object.op_Implicit((Object)(object)component) || (Object.op_Implicit((Object)(object)component) && component.desiredForwardSpeed == 0f)) && !Object.op_Implicit((Object)(object)component2)) { flag = true; } if (!flag) { list.Add(componentInParent); } } } int count = list.Count; for (int j = 0; j < count; j++) { GameObject gameObject = ((Component)list[j]).gameObject; if (Object.op_Implicit((Object)(object)gameObject)) { if (Object.op_Implicit((Object)(object)gameObject.transform) && Object.op_Implicit((Object)(object)projectileDeletionEffectPrefab)) { EffectManager.SimpleEffect(projectileDeletionEffectPrefab, gameObject.transform.position, default(Quaternion), true); } Object.Destroy((Object)(object)gameObject); } } } public void OnDestroy() { if (defenseMatrixInfo != null) { DefenseMatrixManager.RemoveMatrix(defenseMatrixInfo); } if (Object.op_Implicit((Object)(object)matrixObject)) { Object.Destroy((Object)(object)matrixObject); } } } }
BepinEx/plugins/NotTsunami-ShowDeathCause/ShowDeathCause.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using RoR2; using RoR2.UI; using TMPro; 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("ShowDeathCause")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShowDeathCause")] [assembly: AssemblyTitle("ShowDeathCause")] [assembly: AssemblyVersion("1.0.0.0")] namespace ShowDeathCause; [BepInPlugin("dev.tsunami.ShowDeathCause", "ShowDeathCause", "3.0.1")] public class ShowDeathCause : BaseUnityPlugin { [HarmonyPatch] public class HarmonyPatches { [HarmonyPostfix] [HarmonyPatch(typeof(GameEndReportPanelController), "SetPlayerInfo")] public static void PatchEndGamePanel(GameEndReportPanelController __instance) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 if (_damageReport != null) { string text; if (_damageReport.isFallDamage) { text = "SDC_GENERIC_PREFIX_DEATH"; _attacker = Language.GetString("SDC_KILLER_FALL_DAMAGE"); __instance.killerBodyPortraitImage.texture = (Texture)(object)Artifacts.weakAssKneesArtifactDef.smallIconSelectedSprite.texture; } else if (!IsVoidFogAttacker(_damageReport)) { text = (_damageReport.isFriendlyFire ? "SDC_GENERIC_PREFIX_DEATH_FRIENDLY" : (((_damageReport.damageInfo.damageType & 0x10000) <= 0) ? "SDC_GENERIC_PREFIX_DEATH" : "SDC_GENERIC_PREFIX_DEATH_VOID")); } else { text = "SDC_GENERIC_PREFIX_DEATH"; _attacker = Language.GetString("SDC_KILLER_VOID_FOG"); __instance.killerBodyPortraitImage.texture = (Texture)(object)Buffs.VoidFogMild.iconSprite.texture; } ((TMP_Text)__instance.killerBodyLabel).text = Language.GetStringFormatted(text, new object[2] { _attacker, _damageTaken }); } } } private static DamageReport _damageReport; private static string _damageTaken; private static string _attacker; public static string GetAttacker(DamageReport damageReport) { if (Object.op_Implicit((Object)(object)damageReport.attackerMaster)) { return Object.op_Implicit((Object)(object)damageReport.attackerMaster.playerCharacterMasterController) ? damageReport.attackerMaster.playerCharacterMasterController.networkUser.userName : Util.GetBestBodyName(((Component)damageReport.attackerBody).gameObject); } return Object.op_Implicit((Object)(object)damageReport.attacker) ? Util.GetBestBodyName(damageReport.attacker) : "???"; } public static bool IsVoidFogAttacker(DamageReport damageReport) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0013: 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) DamageInfo damageInfo = damageReport.damageInfo; return (int)damageInfo.damageColorIndex == 9 && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)2) && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)64) && (Object)(object)damageInfo.attacker == (Object)null && (Object)(object)damageInfo.inflictor == (Object)null; } public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); new PatchClassProcessor(val, typeof(HarmonyPatches)).Patch(); Language.onCurrentLanguageChanged += delegate { List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); if (!Language.currentLanguage.TokenIsRegistered("SDC_KILLER_FALL_DAMAGE")) { if (Language.currentLanguageName == "en") { list.Add(new KeyValuePair<string, string>("SDC_KILLER_FALL_DAMAGE", "<color=#964B00>Fall Damage</color>")); list.Add(new KeyValuePair<string, string>("SDC_KILLER_VOID_FOG", "<color=#753f8a>Void Fog</color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage)</color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH_FRIENDLY", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage) <color=#32a852>(FF)</color></color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH_VOID", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage) <color=#FF8000>(Jail)</color></color>")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_VOID_FOG", "<color=#00FF80>{0}</color> died to <color=#753f8a>void fog</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FALL_DAMAGE", "<color=#00FF80>{0}</color> died to <color=#964B00>fall damage</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FRIENDLY", "<color=#32a852>FRIENDLY FIRE!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FRIENDLY_CRIT", "<color=#32a852>FRIENDLY FIRE!</color> <color=#FF0000>CRITICAL HIT!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH", "<color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_CRIT", "<color=#FF0000>CRITICAL HIT!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_VOID", "<color=#621e7d>JAILED!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color>.")); } else { list.Add(new KeyValuePair<string, string>("SDC_KILLER_FALL_DAMAGE", "<color=#964B00>Fall Damage</color>")); list.Add(new KeyValuePair<string, string>("SDC_KILLER_VOID_FOG", "<color=#753f8a>Void Fog</color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage)</color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH_FRIENDLY", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage) <color=#32a852>(FF)</color></color>")); list.Add(new KeyValuePair<string, string>("SDC_GENERIC_PREFIX_DEATH_VOID", "<color=#FFFFFF>Killed By:</color> <color=#FFFF80>{0}</color> <color=#FFFFFF>({1} damage) <color=#FF8000>(Jail)</color></color>")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_VOID_FOG", "<color=#00FF80>{0}</color> died to <color=#753f8a>void fog</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FALL_DAMAGE", "<color=#00FF80>{0}</color> died to <color=#964B00>fall damage</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FRIENDLY", "<color=#32a852>FRIENDLY FIRE!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_FRIENDLY_CRIT", "<color=#32a852>FRIENDLY FIRE!</color> <color=#FF0000>CRITICAL HIT!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH", "<color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_CRIT", "<color=#FF0000>CRITICAL HIT!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color> ({2} damage taken).")); list.Add(new KeyValuePair<string, string>("SDC_PLAYER_DEATH_VOID", "<color=#621e7d>JAILED!</color> <color=#00FF80>{0}</color> killed by <color=#FF8000>{1}</color>.")); } Language.currentLanguage.SetStringsByTokens((IEnumerable<KeyValuePair<string, string>>)list); } }; GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 if (damageReport != null && damageReport.victimBody.isPlayerControlled && Object.op_Implicit((Object)(object)damageReport.victimBody)) { string bestMasterName = Util.GetBestMasterName(damageReport.victimMaster); _damageReport = damageReport; _damageTaken = $"{damageReport.damageInfo.damage:F2}"; _attacker = GetAttacker(damageReport); string baseToken = (damageReport.isFallDamage ? "SDC_PLAYER_DEATH_FALL_DAMAGE" : (IsVoidFogAttacker(damageReport) ? "SDC_PLAYER_DEATH_VOID_FOG" : (damageReport.isFriendlyFire ? (damageReport.damageInfo.crit ? "SDC_PLAYER_DEATH_FRIENDLY_CRIT" : "SDC_PLAYER_DEATH_FRIENDLY") : (((damageReport.damageInfo.damageType & 0x10000) <= 0) ? (damageReport.damageInfo.crit ? "SDC_PLAYER_DEATH_CRIT" : "SDC_PLAYER_DEATH") : "SDC_PLAYER_DEATH_VOID")))); SimpleChatMessage val2 = new SimpleChatMessage(); val2.baseToken = baseToken; val2.paramTokens = new string[3] { bestMasterName, _attacker, _damageTaken }; Chat.SendBroadcastChat((ChatMessageBase)(object)val2); } }; } }
BepinEx/plugins/OkIGotIt-Fresh_Bison_Steak/Fresh_Bison_Steak.dll
Decompiled 11 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Chalice of Newts Vitamins")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Chalice of Newts Vitamins")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a15a3d6a-6ae9-46e1-99bc-007f149c9fc0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Fresh_Bison_Steak; [BepInPlugin("com.OkIGotIt.Fresh_Bison_Steak", "Fresh_Bison_Steak", "1.0.4")] public class Fresh_Bison_Steak : BaseUnityPlugin { public void Awake() { GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)report.attackerBody)) { int itemCount = report.attackerBody.inventory.GetItemCount(ItemCatalog.FindItemIndex("FlatHealth")); if (itemCount > 0) { report.attackerBody.AddTimedBuff(Buffs.MeatRegenBoost, 3f * (float)itemCount); } } } }
BepinEx/plugins/Pipman3000-TeleporterShowRedux/TeleporterShowRedux.dll
Decompiled 11 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("TeleporterShowRedux")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TeleporterShowRedux")] [assembly: AssemblyTitle("TeleporterShowRedux")] [assembly: AssemblyVersion("1.0.0.0")] namespace TeleporterShowRedux; public class TeleShown : INetMessage, ISerializableObject { public static void Send() { NetMessageExtensions.Send((INetMessage)(object)new TeleShown(), (NetworkDestination)1); } public void Deserialize(NetworkReader reader) { } public void OnReceived() { TeleShowRedux instance = TeleShowRedux.Instance; if (!instance.IsMarked) { instance.ShowTele(); } } public void Serialize(NetworkWriter writer) { } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Pipman3000.TeleShowRedux", "TeleporterShowRedux", "1.0.4")] [R2APISubmoduleDependency(new string[] { "NetworkingAPI" })] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class TeleShowRedux : BaseUnityPlugin { private const string VERSION_STRING = "1.0.4"; private const string PLUGIN_GUID = "com.Pipman3000.TeleShowRedux"; private const string PLUGIN_NAME = "TeleporterShowRedux"; private GameObject _teleIndicator; public static ConfigEntry<float> MinDist { get; set; } public static ConfigEntry<bool> DiscoverEnabled { get; set; } public static ConfigEntry<bool> CanPing { get; set; } public static ConfigEntry<bool> AlwaysShow { get; set; } public static TeleShowRedux Instance { get; private set; } public bool IsMarked { get; private set; } public TeleShowRedux() { Instance = this; } public void ShowTele() { if (Object.op_Implicit((Object)(object)_teleIndicator)) { _teleIndicator.SetActive(true); } IsMarked = true; ((Behaviour)this).enabled = false; } public void Awake() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown DiscoverEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Discover Enabled", true, "Whether or not you can 'discover' the teleporter by getting close to it."); MinDist = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Distance", 50f, "How close does the player have to be to 'discover' the teleporter (Must be >0)."); CanPing = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Ping Enabled", true, "Whether or not you can ping the teleporter to mark it."); AlwaysShow = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Always Show", false, "Whether or not the teleporter's location is always shown."); NetworkingAPI.RegisterMessageType<TeleShown>(); TeleporterInteraction.Awake += new hook_Awake(TeleporterInteraction_Awake); TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(TeleporterInteraction_OnInteractionBegin); if (CanPing.Value) { PingerController.AttemptPing += new hook_AttemptPing(PingerController_AttemptPing); } ((Behaviour)this).enabled = DiscoverEnabled.Value && MinDist.Value > 0f; } private void TeleporterInteraction_Awake(orig_Awake orig, TeleporterInteraction self) { //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) orig.Invoke(self); _teleIndicator = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/PositionIndicators/TeleporterChargingPositionIndicator"), ((Component)self).transform.position, Quaternion.identity); _teleIndicator.GetComponent<PositionIndicator>().targetTransform = ((Component)self).transform; _teleIndicator.GetComponent<ChargeIndicatorController>().isCharged = true; _teleIndicator.SetActive(AlwaysShow.Value); IsMarked = false; ((Behaviour)this).enabled = DiscoverEnabled.Value && MinDist.Value > 0f; } private void TeleporterInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { if (Object.op_Implicit((Object)(object)_teleIndicator)) { IsMarked = true; ((Behaviour)this).enabled = false; Object.Destroy((Object)(object)_teleIndicator); } orig.Invoke(self, activator); } private void PingerController_AttemptPing(orig_AttemptPing orig, PingerController self, Ray aimRay, GameObject bodyObj) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_004d: Unknown result type (might be due to invalid IL or missing references) if (!IsMarked) { LayerIndex val = LayerIndex.world; int num = LayerMask.op_Implicit(((LayerIndex)(ref val)).mask); val = LayerIndex.defaultLayer; int num2 = num | LayerMask.op_Implicit(((LayerIndex)(ref val)).mask); val = LayerIndex.pickups; RaycastHit val2 = default(RaycastHit); if (Util.CharacterRaycast(bodyObj, aimRay, ref val2, 1000f, LayerMask.op_Implicit(num2 | LayerMask.op_Implicit(((LayerIndex)(ref val)).mask)), (QueryTriggerInteraction)2)) { GameObject gameObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; if (Object.op_Implicit((Object)(object)gameObject)) { NetworkIdentity val3 = gameObject.GetComponentInParent<NetworkIdentity>(); if (!Object.op_Implicit((Object)(object)val3)) { Transform parent = gameObject.transform.parent; EntityLocator val4 = (Object.op_Implicit((Object)(object)parent) ? ((Component)parent).GetComponentInChildren<EntityLocator>() : gameObject.GetComponent<EntityLocator>()); if (Object.op_Implicit((Object)(object)val4)) { val3 = val4.entity.GetComponent<NetworkIdentity>(); } } if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent<TeleporterInteraction>())) { ShowTele(); TeleShown.Send(); } } } } orig.Invoke(self, aimRay, bodyObj); } public void Update() { //IL_003f: 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) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); TeleporterInteraction instance = TeleporterInteraction.instance; if (!IsMarked && Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)((Component)instance).transform) && firstLocalUser != null && Object.op_Implicit((Object)(object)firstLocalUser.cachedBody) && Vector3.Distance(firstLocalUser.cachedBody.footPosition, ((Component)instance).transform.position) < MinDist.Value) { ShowTele(); TeleShown.Send(); } } }
BepinEx/plugins/prodzpod-Hypercrit2/NotHypercrit.dll
Decompiled 11 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterUI; using EntityStates; using EntityStates.Huntress.HuntressWeapon; using IL.EntityStates.Huntress.HuntressWeapon; using IL.RoR2; using IL.RoR2.Orbs; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using Moonstorm.Starstorm2; using MysticsItems; using MysticsItems.Items; using On.EntityStates.Huntress.HuntressWeapon; using On.RoR2; using R2API; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.Orbs; using UnityEngine; using UnityEngine.Networking; [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 = ".NET Standard 2.0")] [assembly: AssemblyCompany("NotHypercrit")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NotHypercrit")] [assembly: AssemblyTitle("NotHypercrit")] [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 NotHypercrit { public static class BleedExtension { public static float GetBleedDamage(this CharacterBody body) { if (!Bleed.bleedDamage.ContainsKey(body)) { Bleed.bleedDamage.Add(body, 1f); } return Bleed.bleedDamage[body]; } public static CharacterBody SetBleedDamage(this CharacterBody body, float value) { if (!Bleed.bleedDamage.ContainsKey(body)) { Bleed.bleedDamage.Add(body, value); } else { Bleed.bleedDamage[body] = value; } return body; } public static float GetCollapseDamage(this CharacterBody body) { if (!Bleed.collapseDamage.ContainsKey(body)) { Bleed.collapseDamage.Add(body, 1f); } return Bleed.collapseDamage[body]; } public static CharacterBody SetCollapseDamage(this CharacterBody body, float value) { if (!Bleed.collapseDamage.ContainsKey(body)) { Bleed.collapseDamage.Add(body, value); } else { Bleed.collapseDamage[body] = value; } return body; } } public class Bleed { public class InflictHyperbleedInfo : Main.AdditionalProcInfo { public GameObject attacker; public DotIndex dotIndex; public new void Deserialize(NetworkReader reader) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) base.Deserialize(reader); dotIndex = (DotIndex)reader.ReadInt32(); } public new void Serialize(NetworkWriter writer) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown base.Serialize(writer); writer.Write((int)dotIndex); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Run> <>9__6_0; public static hook_Start <>9__6_1; public static StatHookEventHandler <>9__6_2; public static Func<Instruction, bool> <>9__6_8; public static Func<Instruction, bool> <>9__6_9; public static Func<Instruction, bool> <>9__6_10; public static Action<DamageInfo> <>9__6_6; public static Func<Instruction, bool> <>9__6_11; public static Func<Instruction, bool> <>9__6_12; public static Func<Instruction, bool> <>9__6_13; public static Action<DamageInfo> <>9__6_7; public static Manipulator <>9__6_3; public static Func<Instruction, bool> <>9__6_14; public static Func<Instruction, bool> <>9__6_15; public static Func<Instruction, bool> <>9__6_16; public static Action<OnDotInflictedServerGlobalDelegate, DotController> <>9__6_17; public static Manipulator <>9__6_4; public static Func<Instruction, bool> <>9__6_19; public static Action<DamageDealtMessage, TeamComponent> <>9__6_20; public static Manipulator <>9__6_5; public static hook_InflictDot_refInflictDotInfo <>9__7_0; public static Func<Instruction, bool> <>9__7_5; public static Func<Instruction, bool> <>9__7_6; public static Manipulator <>9__7_1; public static hook_GetLocalizedStringByToken <>9__7_2; public static hook_RecalculateStats <>9__7_7; public static Action <>9__7_3; public static Func<Instruction, bool> <>9__7_8; public static Func<Instruction, bool> <>9__7_9; public static Func<float, float> <>9__7_10; public static Manipulator <>9__7_4; internal void <Patch>b__6_0(Run run) { bleedDamage.Clear(); } internal void <Patch>b__6_1(orig_Start orig, CharacterBody self) { self.GetBleedDamage(); self.GetCollapseDamage(); orig.Invoke(self); } internal void <Patch>b__6_2(CharacterBody self, StatHookEventArgs args) { bleedDamage[self] = 1f; collapseDamage[self] = 1f; } internal void <Patch>b__6_3(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = -1; if (Main.BleedEnable.Value && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance") }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component2 = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component2)) { InflictHyperbleedInfo item2 = RollHyperbleed((DotIndex)0, component2.GetBleedDamage() - 1f, component2); inflictHyperBleedInfos.Add(item2); } } }); } if (!Main.CollapseEnable.Value || !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid") }) || !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 19) }) || !val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { return; } val.Emit(OpCodes.Ldarg, 1); val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component.GetCollapseDamage() - 1f, component); inflictHyperBleedInfos.Add(item); } } }); } internal bool <Patch>b__6_8(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance"); } internal bool <Patch>b__6_9(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 5); } internal bool <Patch>b__6_10(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc"); } internal void <Patch>b__6_6(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { InflictHyperbleedInfo item = RollHyperbleed((DotIndex)0, component.GetBleedDamage() - 1f, component); inflictHyperBleedInfos.Add(item); } } } internal bool <Patch>b__6_11(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid"); } internal bool <Patch>b__6_12(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 19); } internal bool <Patch>b__6_13(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc"); } internal void <Patch>b__6_7(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component.GetCollapseDamage() - 1f, component); inflictHyperBleedInfos.Add(item); } } } internal void <Patch>b__6_4(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke") }); val.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) }); val.Remove(); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke") }); val.Remove(); val.EmitDelegate<Action<OnDotInflictedServerGlobalDelegate, DotController>>((Action<OnDotInflictedServerGlobalDelegate, DotController>)delegate(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController 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_0035: 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_004f: Invalid comparison between Unknown and I4 <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0 { attacker = lastInfo.attackerObject, dotIndex = lastInfo.dotIndex }; if (Object.op_Implicit((Object)(object)CS$<>8__locals0.attacker) && (((int)CS$<>8__locals0.dotIndex == 0 && Main.BleedEnable.Value) || ((int)CS$<>8__locals0.dotIndex == 8 && Main.CollapseEnable.Value))) { InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)CS$<>8__locals0.attacker && x.dotIndex == CS$<>8__locals0.dotIndex); if (inflictHyperbleedInfo != null) { if (inflictedServerGlobal != null) { for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++) { inflictedServerGlobal.Invoke(self, ref lastInfo); } } inflictHyperBleedInfos.Remove(inflictHyperbleedInfo); } } }); } internal bool <Patch>b__6_14(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke"); } internal bool <Patch>b__6_15(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <Patch>b__6_16(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke"); } internal void <Patch>b__6_17(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController 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_0035: 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_004f: Invalid comparison between Unknown and I4 <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0 { attacker = lastInfo.attackerObject, dotIndex = lastInfo.dotIndex }; if (!Object.op_Implicit((Object)(object)CS$<>8__locals0.attacker) || (((int)CS$<>8__locals0.dotIndex != 0 || !Main.BleedEnable.Value) && ((int)CS$<>8__locals0.dotIndex != 8 || !Main.CollapseEnable.Value))) { return; } InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)CS$<>8__locals0.attacker && x.dotIndex == CS$<>8__locals0.dotIndex); if (inflictHyperbleedInfo == null) { return; } if (inflictedServerGlobal != null) { for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++) { inflictedServerGlobal.Invoke(self, ref lastInfo); } } inflictHyperBleedInfos.Remove(inflictHyperbleedInfo); } internal void <Patch>b__6_5(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Pop); val.Remove(); val.Emit(OpCodes.Ldloc_0); val.Emit(OpCodes.Ldloc_2); val.EmitDelegate<Action<DamageDealtMessage, TeamComponent>>((Action<DamageDealtMessage, TeamComponent>)delegate(DamageDealtMessage msg, TeamComponent team) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected I4, but got F4 //IL_0268: Expected F4, but got I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_025d->IL025d: Incompatible stack types: I4 vs F4 //IL_025d->IL025d: Incompatible stack types: F4 vs I4 //IL_025d->IL025d: Incompatible stack types: O vs I4 //IL_0257->IL025d: Incompatible stack types: I4 vs O //IL_0257->IL025d: Incompatible stack types: I4 vs F4 //IL_0257->IL025d: Incompatible stack types: F4 vs I4 //IL_0257->IL025d: Incompatible stack types: O vs I4 if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker)) { CharacterBody component = msg.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = msg.victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) { float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage); float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1)); if (num > 0f && inverseDamage > 0f) { float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1); Color val2 = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2); if ((int)team.teamIndex == -1) { val2 *= Color.gray; } if ((int)team.teamIndex == 2) { val2 *= new Color(0.5568628f, 0.2941177f, 0.6039216f); } ParticleSystem ps = DamageNumberManager.instance.ps; EmitParams val3 = default(EmitParams); ((EmitParams)(ref val3)).position = msg.position; ((EmitParams)(ref val3)).startColor = Color32.op_Implicit(val2); ((EmitParams)(ref val3)).applyShapeToPosition = true; ps.Emit(val3, 1); DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f); DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); return; } } } object obj = DamageNumberManager.instance; float num3 = msg.damage; Vector3 position = msg.position; int num4 = (msg.crit ? 1 : 0); int num5; if (Object.op_Implicit((Object)(object)team)) { obj = team.teamIndex; num3 = num4; num4 = (int)num3; num5 = (int)obj; } else { num5 = -1; obj = num5; num3 = num4; num4 = (int)num3; num5 = (int)obj; } ((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj, msg.damageColorIndex); }); } internal bool <Patch>b__6_19(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber"); } internal void <Patch>b__6_20(DamageDealtMessage msg, TeamComponent team) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected I4, but got F4 //IL_0268: Expected F4, but got I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_025d->IL025d: Incompatible stack types: I4 vs F4 //IL_025d->IL025d: Incompatible stack types: F4 vs I4 //IL_025d->IL025d: Incompatible stack types: O vs I4 //IL_0257->IL025d: Incompatible stack types: I4 vs O //IL_0257->IL025d: Incompatible stack types: I4 vs F4 //IL_0257->IL025d: Incompatible stack types: F4 vs I4 //IL_0257->IL025d: Incompatible stack types: O vs I4 if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker)) { CharacterBody component = msg.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = msg.victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) { float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage); float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1)); if (num > 0f && inverseDamage > 0f) { float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1); Color val = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2); if ((int)team.teamIndex == -1) { val *= Color.gray; } if ((int)team.teamIndex == 2) { val *= new Color(0.5568628f, 0.2941177f, 0.6039216f); } ParticleSystem ps = DamageNumberManager.instance.ps; EmitParams val2 = default(EmitParams); ((EmitParams)(ref val2)).position = msg.position; ((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val); ((EmitParams)(ref val2)).applyShapeToPosition = true; ps.Emit(val2, 1); DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f); DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); return; } } } object obj = DamageNumberManager.instance; float num3 = msg.damage; Vector3 position = msg.position; int num4 = (msg.crit ? 1 : 0); int num5; if (Object.op_Implicit((Object)(object)team)) { obj = team.teamIndex; num3 = num4; num4 = (int)num3; num5 = (int)obj; } else { num5 = -1; obj = num5; num3 = num4; num4 = (int)num3; num5 = (int)obj; } ((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj, msg.damageColorIndex); } internal void <PatchStack>b__7_0(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo info) { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 if (NetworkServer.active) { GameObject attackerObject = info.attackerObject; DotIndex dotIndex = info.dotIndex; if (Object.op_Implicit((Object)(object)attackerObject)) { if (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value)) { info.damageMultiplier *= HyperbleedMultiplier(attackerObject, dotIndex); } if ((Object)(object)info.victimObject != (Object)null) { CharacterBody component = info.victimObject.GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null) { if ((int)info.dotIndex == 0) { info.damageMultiplier *= Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component.GetBuffCount(Buffs.Bleeding) + 1); } else if ((int)info.dotIndex == 8) { info.damageMultiplier *= Main.Calc(Main.CollapseStackMode.Value, Main.CollapseStackBase.Value, Main.CollapseStackMult.Value, Main.CollapseStackDecay.Value, component.GetBuffCount(Buffs.Fracture) + 1); } } } } } lastInfo = info; orig.Invoke(ref info); } internal void <PatchStack>b__7_1(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount") }); val.Index += 2; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4, 0); } internal bool <PatchStack>b__7_5(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode"); } internal bool <PatchStack>b__7_6(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount"); } internal string <PatchStack>b__7_2(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "ITEM_BLEEDONHITANDEXPLODE_DESC") { string text = "Gain <style=cIsDamage>5%</style> critical chance. Gain <style=cIsDamage>Bleed chance</style> equal to your <style=cIsDamage>Critical chance</style>. <style=cIsDamage>Bleeding</style> enemies <style=cIsDamage>explode</style> on death for <style=cIsDamage>400%</style> <style=cStack>(+400% per stack)</style> damage"; if (!Main.Mods("Hayaku.VanillaRebalance")) { text += ", plus an additional <style=cIsDamage>15%</style> <style=cStack>(+15% per stack)</style> of their maximum health"; } return text + "."; } return orig.Invoke(self, token); } internal void <PatchStack>b__7_3() { //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_001f: Expected O, but got Unknown object obj = <>9__7_7; if (obj == null) { hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null)) { if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0) { self.bleedChance += self.crit; } if (Main.HyperbolicBleed.Value) { self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance); } } }; <>9__7_7 = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; } internal void <PatchStack>b__7_7(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null)) { if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0) { self.bleedChance += self.crit; } if (Main.HyperbolicBleed.Value) { self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance); } } } internal void <PatchStack>b__7_4(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 24), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) }); val.Index += 2; val.EmitDelegate<Func<float, float>>((Func<float, float>)((float chance) => 10f - 10f / (1f + 0.011111f * chance))); } internal bool <PatchStack>b__7_8(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, 24); } internal bool <PatchStack>b__7_9(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal float <PatchStack>b__7_10(float chance) { return 10f - 10f / (1f + 0.011111f * chance); } } [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public GameObject attacker; public DotIndex dotIndex; internal bool <Patch>b__18(InflictHyperbleedInfo x) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex; } } public static List<InflictHyperbleedInfo> inflictHyperBleedInfos = new List<InflictHyperbleedInfo>(); public static InflictHyperbleedInfo lastNetworkedBleedInfo = null; public static Dictionary<CharacterBody, float> bleedDamage = new Dictionary<CharacterBody, float>(); public static Dictionary<CharacterBody, float> collapseDamage = new Dictionary<CharacterBody, float>(); public static InflictDotInfo lastInfo; public static void Patch() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0094: 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: Expected O, but got Unknown //IL_00b9: 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_00c4: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown Main.Log.LogDebug((object)"The Spirit of TheMysticSword Burns Alight..."); Run.onRunStartGlobal += delegate { bleedDamage.Clear(); }; object obj = <>c.<>9__6_1; if (obj == null) { hook_Start val = delegate(orig_Start orig, CharacterBody self) { self.GetBleedDamage(); self.GetCollapseDamage(); orig.Invoke(self); }; <>c.<>9__6_1 = val; obj = (object)val; } CharacterBody.Start += (hook_Start)obj; object obj2 = <>c.<>9__6_2; if (obj2 == null) { StatHookEventHandler val2 = delegate(CharacterBody self, StatHookEventArgs args) { bleedDamage[self] = 1f; collapseDamage[self] = 1f; }; <>c.<>9__6_2 = val2; obj2 = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2; object obj3 = <>c.<>9__6_3; if (obj3 == null) { Manipulator val3 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) ILCursor val10 = new ILCursor(il); int num6 = -1; if (Main.BleedEnable.Value && val10.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance") }) && val10.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5) }) && val10.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { val10.Emit(OpCodes.Ldarg_1); val10.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component4 = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component4)) { InflictHyperbleedInfo item2 = RollHyperbleed((DotIndex)0, component4.GetBleedDamage() - 1f, component4); inflictHyperBleedInfos.Add(item2); } } }); } if (Main.CollapseEnable.Value && val10.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid") }) && val10.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 19) }) && val10.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { val10.Emit(OpCodes.Ldarg, 1); val10.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo info) { if (Object.op_Implicit((Object)(object)info.attacker)) { CharacterBody component3 = info.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component3)) { InflictHyperbleedInfo item = RollHyperbleed((DotIndex)8, component3.GetCollapseDamage() - 1f, component3); inflictHyperBleedInfos.Add(item); } } }); } }; <>c.<>9__6_3 = val3; obj3 = (object)val3; } GlobalEventManager.OnHitEnemy += (Manipulator)obj3; object obj4 = <>c.<>9__6_4; if (obj4 == null) { Manipulator val4 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val9 = new ILCursor(il); val9.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke") }); val9.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) }); val9.Remove(); val9.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OnDotInflictedServerGlobalDelegate>(x, "Invoke") }); val9.Remove(); val9.EmitDelegate<Action<OnDotInflictedServerGlobalDelegate, DotController>>((Action<OnDotInflictedServerGlobalDelegate, DotController>)delegate(OnDotInflictedServerGlobalDelegate inflictedServerGlobal, DotController 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_0035: 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_004f: Invalid comparison between Unknown and I4 GameObject attacker = lastInfo.attackerObject; DotIndex dotIndex = lastInfo.dotIndex; if (Object.op_Implicit((Object)(object)attacker) && (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value))) { InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex); if (inflictHyperbleedInfo != null) { if (inflictedServerGlobal != null) { for (int i = 0; i < inflictHyperbleedInfo.numProcs; i++) { inflictedServerGlobal.Invoke(self, ref lastInfo); } } inflictHyperBleedInfos.Remove(inflictHyperbleedInfo); } } }); }; <>c.<>9__6_4 = val4; obj4 = (object)val4; } DotController.InflictDot_refInflictDotInfo += (Manipulator)obj4; if (!Main.BleedEnable.Value || Main.BleedColor.Value <= 1) { return; } object obj5 = <>c.<>9__6_5; if (obj5 == null) { Manipulator val5 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) ILCursor val6 = new ILCursor(il); val6.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DamageNumberManager>(x, "SpawnDamageNumber") }); val6.Emit(OpCodes.Pop); val6.Emit(OpCodes.Pop); val6.Emit(OpCodes.Pop); val6.Emit(OpCodes.Pop); val6.Emit(OpCodes.Pop); val6.Emit(OpCodes.Pop); val6.Remove(); val6.Emit(OpCodes.Ldloc_0); val6.Emit(OpCodes.Ldloc_2); val6.EmitDelegate<Action<DamageDealtMessage, TeamComponent>>((Action<DamageDealtMessage, TeamComponent>)delegate(DamageDealtMessage msg, TeamComponent team) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected I4, but got F4 //IL_0268: Expected F4, but got I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_025d->IL025d: Incompatible stack types: I4 vs F4 //IL_025d->IL025d: Incompatible stack types: F4 vs I4 //IL_025d->IL025d: Incompatible stack types: O vs I4 //IL_0257->IL025d: Incompatible stack types: I4 vs O //IL_0257->IL025d: Incompatible stack types: I4 vs F4 //IL_0257->IL025d: Incompatible stack types: F4 vs I4 //IL_0257->IL025d: Incompatible stack types: O vs I4 if ((int)msg.damageColorIndex == 2 && Object.op_Implicit((Object)(object)msg.victim) && Object.op_Implicit((Object)(object)msg.attacker)) { CharacterBody component = msg.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = msg.victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) { float num = msg.damage / ((float)component2.GetBuffCount(Buffs.Bleeding) * 0.2f * component.baseDamage); float inverseDamage = GetInverseDamage(num / Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component2.GetBuffCount(Buffs.Bleeding) + 1)); if (num > 0f && inverseDamage > 0f) { float num2 = (inverseDamage - 1f) % (float)Main.BleedColor.Value / (float)(Main.BleedColor.Value - 1); Color val7 = Color.HSVToRGB(0f, 71f / 120f, 0.75f - 0.5f * num2); if ((int)team.teamIndex == -1) { val7 *= Color.gray; } if ((int)team.teamIndex == 2) { val7 *= new Color(0.5568628f, 0.2941177f, 0.6039216f); } ParticleSystem ps = DamageNumberManager.instance.ps; EmitParams val8 = default(EmitParams); ((EmitParams)(ref val8)).position = msg.position; ((EmitParams)(ref val8)).startColor = Color32.op_Implicit(val7); ((EmitParams)(ref val8)).applyShapeToPosition = true; ps.Emit(val8, 1); DamageNumberManager.instance.ps.GetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); DamageNumberManager.instance.customData[DamageNumberManager.instance.customData.Count - 1] = new Vector4(1f, 0f, msg.damage, msg.crit ? 1f : 0f); DamageNumberManager.instance.ps.SetCustomParticleData(DamageNumberManager.instance.customData, (ParticleSystemCustomData)0); return; } } } object obj6 = DamageNumberManager.instance; float num3 = msg.damage; Vector3 position = msg.position; int num4 = (msg.crit ? 1 : 0); int num5; if (Object.op_Implicit((Object)(object)team)) { obj6 = team.teamIndex; num3 = num4; num4 = (int)num3; num5 = (int)obj6; } else { num5 = -1; obj6 = num5; num3 = num4; num4 = (int)num3; num5 = (int)obj6; } ((DamageNumberManager)num5).SpawnDamageNumber((float)num4, position, (byte)(int)num3 != 0, (TeamIndex)obj6, msg.damageColorIndex); }); }; <>c.<>9__6_5 = val5; obj5 = (object)val5; } HealthComponent.HandleDamageDealt += (Manipulator)obj5; } public static void PatchStack() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006e: 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: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown object obj = <>c.<>9__7_0; if (obj == null) { hook_InflictDot_refInflictDotInfo val = delegate(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo info) { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 if (NetworkServer.active) { GameObject attackerObject = info.attackerObject; DotIndex dotIndex = info.dotIndex; if (Object.op_Implicit((Object)(object)attackerObject)) { if (((int)dotIndex == 0 && Main.BleedEnable.Value) || ((int)dotIndex == 8 && Main.CollapseEnable.Value)) { info.damageMultiplier *= HyperbleedMultiplier(attackerObject, dotIndex); } if ((Object)(object)info.victimObject != (Object)null) { CharacterBody component = info.victimObject.GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null) { if ((int)info.dotIndex == 0) { info.damageMultiplier *= Main.Calc(Main.BleedStackMode.Value, Main.BleedStackBase.Value, Main.BleedStackMult.Value, Main.BleedStackDecay.Value, component.GetBuffCount(Buffs.Bleeding) + 1); } else if ((int)info.dotIndex == 8) { info.damageMultiplier *= Main.Calc(Main.CollapseStackMode.Value, Main.CollapseStackBase.Value, Main.CollapseStackMult.Value, Main.CollapseStackDecay.Value, component.GetBuffCount(Buffs.Fracture) + 1); } } } } } lastInfo = info; orig.Invoke(ref info); }; <>c.<>9__7_0 = val; obj = (object)val; } DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)obj; if (Main.LamerShatterspleen.Value) { object obj2 = <>c.<>9__7_1; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val7 = new ILCursor(il); val7.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitAndExplode"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount") }); val7.Index += 2; val7.Emit(OpCodes.Pop); val7.Emit(OpCodes.Ldc_I4, 0); }; <>c.<>9__7_1 = val2; obj2 = (object)val2; } GlobalEventManager.OnHitEnemy += (Manipulator)obj2; object obj3 = <>c.<>9__7_2; if (obj3 == null) { hook_GetLocalizedStringByToken val3 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "ITEM_BLEEDONHITANDEXPLODE_DESC") { string text = "Gain <style=cIsDamage>5%</style> critical chance. Gain <style=cIsDamage>Bleed chance</style> equal to your <style=cIsDamage>Critical chance</style>. <style=cIsDamage>Bleeding</style> enemies <style=cIsDamage>explode</style> on death for <style=cIsDamage>400%</style> <style=cStack>(+400% per stack)</style> damage"; if (!Main.Mods("Hayaku.VanillaRebalance")) { text += ", plus an additional <style=cIsDamage>15%</style> <style=cStack>(+15% per stack)</style> of their maximum health"; } return text + "."; } return orig.Invoke(self, token); }; <>c.<>9__7_2 = val3; obj3 = (object)val3; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj3; } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //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_001f: Expected O, but got Unknown object obj5 = <>c.<>9__7_7; if (obj5 == null) { hook_RecalculateStats val6 = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null)) { if (Main.LamerShatterspleen.Value && self.inventory.GetItemCount(Items.BleedOnHitAndExplode) > 0) { self.bleedChance += self.crit; } if (Main.HyperbolicBleed.Value) { self.bleedChance = 100f - 10000f / (100f + 1.111111f * self.bleedChance); } } }; <>c.<>9__7_7 = val6; obj5 = (object)val6; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj5; }); if (!Main.HyperbolicCollapse.Value) { return; } object obj4 = <>c.<>9__7_4; if (obj4 == null) { Manipulator val4 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val5 = new ILCursor(il); val5.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 24), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) }); val5.Index += 2; val5.EmitDelegate<Func<float, float>>((Func<float, float>)((float chance) => 10f - 10f / (1f + 0.011111f * chance))); }; <>c.<>9__7_4 = val4; obj4 = (object)val4; } GlobalEventManager.OnHitEnemy += (Manipulator)obj4; } public static float HyperbleedMultiplier(GameObject attacker, DotIndex dotIndex) { //IL_000e: 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) InflictHyperbleedInfo inflictHyperbleedInfo = inflictHyperBleedInfos.FirstOrDefault((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex); if (inflictHyperbleedInfo != null && inflictHyperbleedInfo != null) { return inflictHyperbleedInfo.damageMult; } return 1f; } public static InflictHyperbleedInfo RollHyperbleed(DotIndex dotIndex, float damage, CharacterBody body, bool forceSingleBleed = false) { //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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Invalid comparison between Unknown and I4 //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Invalid comparison between Unknown and I4 InflictHyperbleedInfo inflictHyperbleedInfo = new InflictHyperbleedInfo(); if (Object.op_Implicit((Object)(object)body)) { inflictHyperbleedInfo.attacker = ((Component)body).gameObject; inflictHyperbleedInfo.dotIndex = dotIndex; inflictHyperbleedInfo.totalChance = body.bleedChance; float effectiveCount = GetEffectiveCount(body.bleedChance, body, (int)dotIndex == 8, forceSingleBleed); inflictHyperbleedInfo.num = ((((int)dotIndex == 0) ? Main.BleedFraction.Value : Main.CollapseFraction.Value) ? ((int)effectiveCount) : (Mathf.FloorToInt(effectiveCount) + (Util.CheckRoll(effectiveCount % 1f * 100f, body.master) ? 1 : 0))); if (inflictHyperbleedInfo.num == 0) { inflictHyperbleedInfo.damageMult = 1f; } else if ((int)dotIndex == 0) { inflictHyperbleedInfo.damageMult = Main.Calc(Main.BleedMode.Value, Main.BleedBase.Value + damage, Main.BleedMult.Value + (Main.BleedDamageBonus.Value ? damage : 0f), Main.BleedDecay.Value, effectiveCount); } else if ((int)dotIndex == 8) { inflictHyperbleedInfo.damageMult = Main.Calc(Main.CollapseMode.Value, Main.CollapseBase.Value + damage, Main.CollapseMult.Value + (Main.CollapseDamageBonus.Value ? damage : 0f), Main.CollapseDecay.Value, effectiveCount); } float num = 0f; if (inflictHyperbleedInfo.num != 0) { if ((int)dotIndex == 0) { num = Main.Calc(Main.BleedProcMode.Value, Main.BleedProcBase.Value, Main.BleedProcMult.Value, Main.BleedProcDecay.Value, effectiveCount); } else if ((int)dotIndex == 8) { num = Main.Calc(Main.CollapseProcMode.Value, Main.CollapseProcBase.Value, Main.CollapseProcMult.Value, Main.CollapseProcDecay.Value, effectiveCount); } } inflictHyperbleedInfo.numProcs = (int)num + (Util.CheckRoll(num % 1f * 100f, 0f, (CharacterMaster)null) ? 1 : 0); } return inflictHyperbleedInfo; } public static float GetDamage(float chance, float damage, CharacterBody body, bool collapse = false) { if (!collapse) { return Main.Calc(Main.BleedMode.Value, Main.BleedBase.Value + damage, Main.BleedMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.BleedDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body))); } return Main.Calc(Main.CollapseMode.Value, Main.CollapseBase.Value + damage, Main.CollapseMult.Value + (Main.CollapseDamageBonus.Value ? damage : 0f), Main.CollapseDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body, collapse: true))); } public static float GetEffectiveCount(InflictHyperbleedInfo aci) { if (Main.BleedFraction.Value) { float num = aci.totalChance / 100f; if (num < 1f) { num = 0f; } return num; } return aci.num; } public static float GetEffectiveCount(float chance, CharacterBody body, bool collapse = false, bool forceSingleBleed = false) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, (chance - (float)(forceSingleBleed ? 100 : 0)) / 100f); if ((collapse ? Main.CollapseCap.Value : Main.BleedCap.Value) >= 0f) { num = Mathf.Min(num, collapse ? Main.CollapseCap.Value : Main.BleedCap.Value); } if (((Main.BleedFraction.Value && !collapse) || (Main.CollapseFraction.Value && collapse)) && Main.Mods("com.themysticsword.mysticsitems") && (Object)(object)((body != null) ? body.inventory : null) != (Object)null && num > 0f) { num += 0.01f * (float)body.inventory.GetItemCount(ItemCatalog.FindItemIndex("MysticsItems_ScratchTicket")); } if (num <= 0f) { return 0f; } if (!(collapse ? Main.CollapseFraction.Value : Main.BleedFraction.Value)) { return Mathf.FloorToInt(num) + (Util.CheckRoll(num % 1f * 100f, body.master) ? 1 : 0); } return num; } public static float GetInverseDamage(float mult) { switch (Main.BleedMode.Value) { case Main.CritStackingMode.Linear: if (Main.BleedMult.Value == 0f) { return 0f; } return (mult - Main.BleedBase.Value) / Main.BleedMult.Value + 1f; case Main.CritStackingMode.Exponential: if (Main.BleedBase.Value == 0f || Main.BleedMult.Value == 1f || Main.BleedMult.Value <= 0f) { return 0f; } return Mathf.Log(mult / Main.BleedBase.Value, Main.BleedMult.Value) + 1f; case Main.CritStackingMode.Hyperbolic: if (Main.BleedBase.Value == mult || Main.BleedMult.Value * Main.BleedDecay.Value / (mult - Main.BleedBase.Value) - Main.BleedDecay.Value == 0f) { return 0f; } return (Main.BleedMult.Value - Main.BleedDecay.Value) / (Main.BleedMult.Value * Main.BleedDecay.Value / (mult - Main.BleedBase.Value) - Main.BleedDecay.Value); case Main.CritStackingMode.Asymptotic: if (Main.BleedMult.Value == 0f) { return 0f; } return (0f - Mathf.Log(1f - (mult - Main.BleedBase.Value) / Main.BleedMult.Value, 2f)) * Main.BleedDecay.Value + 1f; default: Main.Log.LogError((object)"Invalid Mode??"); return 0f; } } } public class Crit { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__2_11; public static Func<Instruction, bool> <>9__2_12; public static Func<Instruction, bool> <>9__2_13; public static Func<Instruction, bool> <>9__2_14; public static Func<Instruction, bool> <>9__2_15; public static Func<float, CharacterBody, HealthComponent, DamageInfo, float> <>9__2_9; public static Manipulator <>9__2_0; public static Func<Instruction, bool> <>9__2_16; public static Action<DamageDealtMessage, DamageReport> <>9__2_17; public static Manipulator <>9__2_1; public static hook_Serialize <>9__2_2; public static hook_Deserialize <>9__2_3; public static hook_OnCrit <>9__2_4; public static Func<Instruction, bool> <>9__2_18; public static Func<Color, Color> <>9__2_19; public static Manipulator <>9__2_5; public static hook_OnEnter <>9__2_6; public static Func<Instruction, bool> <>9__2_20; public static Action<GenericDamageOrb, FireSeekingArrow> <>9__2_21; public static Manipulator <>9__2_7; public static Func<Instruction, bool> <>9__2_22; public static Action<DamageInfo, GenericDamageOrb> <>9__2_23; public static Manipulator <>9__2_8; public static hook_RecalculateStats <>9__3_0; public static StatHookEventHandler <>9__4_0; public static hook_GetLocalizedStringByToken <>9__4_1; public static Func<ItemIndex, bool> <>9__5_2; public static hook_RecalculateStats <>9__5_0; public static hook_GetLocalizedStringByToken <>9__5_1; internal void <Patch>b__2_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.damageInfoIndex = -1; ILLabel val2 = default(ILLabel); int num = default(int); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref CS$<>8__locals0.damageInfoIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier") }) || CS$<>8__locals0.damageInfoIndex == -1) { return; } val.Emit(OpCodes.Ldloc_1); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, CS$<>8__locals0.damageInfoIndex); val.EmitDelegate<Func<float, CharacterBody, HealthComponent, DamageInfo, float>>((Func<float, CharacterBody, HealthComponent, DamageInfo, float>)delegate(float orig, CharacterBody self, HealthComponent self2, DamageInfo info) { if (!Object.op_Implicit((Object)(object)self)) { return orig; } Main.AdditionalProcInfo value = null; if (!critInfoAttachments.TryGetValue(info, out value)) { value = RollHypercrit(orig - 2f, self, self2.body); critInfoAttachments.Add(info, value); } return Mathf.Max(orig, value.damageMult); }); } internal bool <Patch>b__2_11(Instruction x) { return ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit"); } internal bool <Patch>b__2_12(Instruction x) { ILLabel val = default(ILLabel); return ILPatternMatchingExt.MatchBrfalse(x, ref val); } internal bool <Patch>b__2_13(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdloc(x, ref num); } internal bool <Patch>b__2_14(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, 1); } internal bool <Patch>b__2_15(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier"); } internal float <Patch>b__2_9(float orig, CharacterBody self, HealthComponent self2, DamageInfo info) { if (!Object.op_Implicit((Object)(object)self)) { return orig; } Main.AdditionalProcInfo value = null; if (!critInfoAttachments.TryGetValue(info, out value)) { value = RollHypercrit(orig - 2f, self, self2.body); critInfoAttachments.Add(info, value); } return Mathf.Max(orig, value.damageMult); } internal void <Patch>b__2_1(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<DamageDealtMessage, DamageReport>>((Action<DamageDealtMessage, DamageReport>)delegate(DamageDealtMessage msg, DamageReport report) { TryPassHypercrit(report.damageInfo, msg); }); } internal bool <Patch>b__2_16(Instruction x) { return ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x); } internal void <Patch>b__2_17(DamageDealtMessage msg, DamageReport report) { TryPassHypercrit(report.damageInfo, msg); } internal void <Patch>b__2_2(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer) { orig.Invoke(self, writer); if (!critInfoAttachments.TryGetValue(self, out var value)) { value = new Main.AdditionalProcInfo(); } value.Serialize(writer); } internal void <Patch>b__2_3(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader) { orig.Invoke(self, reader); Main.AdditionalProcInfo additionalProcInfo = new Main.AdditionalProcInfo(); additionalProcInfo.Deserialize(reader); critInfoAttachments.Add(self, additionalProcInfo); lastNetworkedCritInfo = additionalProcInfo; } internal void <Patch>b__2_4(orig_OnCrit orig, GlobalEventManager self, CharacterBody body, DamageInfo damageInfo, CharacterMaster master, float procCoefficient, ProcChainMask procChainMask) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) critInfoAttachments.TryGetValue(damageInfo, out var value); if (value != null && value.numProcs > 1) { int numProcs = value.numProcs; value.numProcs = 0; for (int i = 0; i < numProcs; i++) { orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask); } } else { orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask); } } internal void <Patch>b__2_5(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor") }); val.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color origColor) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) if (Crit.lastNetworkedCritInfo == null) { return origColor; } Main.AdditionalProcInfo lastNetworkedCritInfo = Crit.lastNetworkedCritInfo; Crit.lastNetworkedCritInfo = null; float effectiveCount = GetEffectiveCount(lastNetworkedCritInfo); if (effectiveCount == 0f) { return origColor; } float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value; return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f); }); } internal bool <Patch>b__2_18(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor"); } internal Color <Patch>b__2_19(Color origColor) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) if (Crit.lastNetworkedCritInfo == null) { return origColor; } Main.AdditionalProcInfo lastNetworkedCritInfo = Crit.lastNetworkedCritInfo; Crit.lastNetworkedCritInfo = null; float effectiveCount = GetEffectiveCount(lastNetworkedCritInfo); if (effectiveCount == 0f) { return origColor; } float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value; return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f); } internal void <Patch>b__2_6(orig_OnEnter orig, FireFlurrySeekingArrow self) { orig.Invoke(self); Main.AdditionalProcInfo additionalProcInfo = RollHypercrit(((EntityState)self).characterBody.critMultiplier - 2f, ((EntityState)self).characterBody); if (additionalProcInfo.num > 1) { additionalProcInfo.damageMult *= 6f / (float)(3 + 3 * additionalProcInfo.num); } critInfoAttachments.Add(self, additionalProcInfo); ((FireSeekingArrow)self).isCrit = additionalProcInfo.num > 0; ((FireSeekingArrow)self).maxArrowCount = 3 + additionalProcInfo.num * 3; ((FireSeekingArrow)self).arrowReloadDuration = ((FireSeekingArrow)self).baseArrowReloadDuration * (3f / (float)((FireSeekingArrow)self).maxArrowCount) / ((BaseState)self).attackSpeedStat; } internal void <Patch>b__2_7(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<GenericDamageOrb, FireSeekingArrow>>((Action<GenericDamageOrb, FireSeekingArrow>)delegate(GenericDamageOrb orb, FireSeekingArrow self) { TryPassHypercrit(self, orb); }); } internal bool <Patch>b__2_20(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, 0); } internal void <Patch>b__2_21(GenericDamageOrb orb, FireSeekingArrow self) { TryPassHypercrit(self, orb); } internal void <Patch>b__2_8(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<DamageInfo, GenericDamageOrb>>((Action<DamageInfo, GenericDamageOrb>)delegate(DamageInfo di, GenericDamageOrb orb) { TryPassHypercrit(orb, di); }); } internal bool <Patch>b__2_22(Instruction x) { return ILPatternMatchingExt.MatchNewobj<DamageInfo>(x); } internal void <Patch>b__2_23(DamageInfo di, GenericDamageOrb orb) { TryPassHypercrit(orb, di); } internal void <PatchHyperbolic>b__3_0(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && Main.HyperbolicCrit.Value) { self.crit = 100f - 10000f / (100f + 1.111111f * self.crit); } } internal void <LaserScopeRework>b__4_0(CharacterBody self, StatHookEventArgs args) { if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && self.inventory.GetItemCount(Items.CritDamage) > 0) { args.critAdd += Main.LaserScope.Value; } } internal string <LaserScopeRework>b__4_1(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "ITEM_CRITDAMAGE_DESC") { return $"Gain <style=cIsDamage>{Main.LaserScope.Value}% critical chance</style>. " + orig.Invoke(self, token); } return orig.Invoke(self, token); } internal bool <MoonglassesRework>b__5_2(ItemIndex x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ((Object)ItemCatalog.GetItemDef(x)).name == "MysticsItems_Moonglasses"; } internal void <MoonglassesRework>b__5_0(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)((self != null) ? self.inventory : null) != (Object)null)) { return; } int itemCount = self.inventory.GetItemCount(Items.MysticsItems_Moonglasses); if (itemCount != 0) { self.crit *= Mathf.Pow(2f, (float)itemCount); self.crit -= Main.Moonglasses.Value * (float)itemCount; if (self.crit < 0f && self.inventory.GetItemCount(Items.ConvertCritChanceToCritDamage) > 0) { Chat.AddMessage("Hypercrit makes crit chance past 100 give a chance to do a hit that is your crit damage +100%. So in a scenario where your crit is 101% and crit damage is x2, mean your actual crit damage will be x2 in 100% cases and x3 in 1% cases. So to put it simply from x2 to x3.\r\nNow negative crit would work like this. Let's say you have -50% chance and x3.5 crit damage. Obviously no way for you to proc crits randomly, but could give a change to deal \"negative crit\" in other ways, that is -100% from you crit damage for every -100% crit chance past 0. So your crit damage range would be from x2.5 to x3.5.\r\nAt the least I was hoping that negative would work with survivors that can't have chance and instead get it converted to crit damage. Like railgunner."); self.master.TrueKill(); } self.crit = Mathf.Max(0f, self.crit); } } internal string <MoonglassesRework>b__5_1(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_PICKUP") { return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_PICKUP"); } if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_DESC") { return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_DESC"); } return orig.Invoke(self, token); } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public int damageInfoIndex; internal bool <Patch>b__10(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, ref damageInfoIndex); } } public static ConditionalWeakTable<object, Main.AdditionalProcInfo> critInfoAttachments = new ConditionalWeakTable<object, Main.AdditionalProcInfo>(); public static Main.AdditionalProcInfo lastNetworkedCritInfo = null; public static void Patch() { //IL_0025: 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_0030: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0094: 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: Expected O, but got Unknown //IL_00b9: 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_00c4: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown Main.Log.LogDebug((object)"The Spirit of ThinkInvis Embraces You..."); object obj = <>c.<>9__2_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) ILCursor val14 = new ILCursor(il); int damageInfoIndex = -1; ILLabel val15 = default(ILLabel); int num2 = default(int); if (val14.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref damageInfoIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "crit"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val15), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_critMultiplier") }) && damageInfoIndex != -1) { val14.Emit(OpCodes.Ldloc_1); val14.Emit(OpCodes.Ldarg_0); val14.Emit(OpCodes.Ldarg, damageInfoIndex); val14.EmitDelegate<Func<float, CharacterBody, HealthComponent, DamageInfo, float>>((Func<float, CharacterBody, HealthComponent, DamageInfo, float>)delegate(float orig, CharacterBody self, HealthComponent self2, DamageInfo info) { if (!Object.op_Implicit((Object)(object)self)) { return orig; } Main.AdditionalProcInfo value3 = null; if (!critInfoAttachments.TryGetValue(info, out value3)) { value3 = RollHypercrit(orig - 2f, self, self2.body); critInfoAttachments.Add(info, value3); } return Mathf.Max(orig, value3.damageMult); }); } }; <>c.<>9__2_0 = val; obj = (object)val; } HealthComponent.TakeDamage += (Manipulator)obj; object obj2 = <>c.<>9__2_1; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: 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) ILCursor val13 = new ILCursor(il); val13.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x) }); val13.Emit(OpCodes.Dup); val13.Emit(OpCodes.Ldarg_0); val13.EmitDelegate<Action<DamageDealtMessage, DamageReport>>((Action<DamageDealtMessage, DamageReport>)delegate(DamageDealtMessage msg, DamageReport report) { TryPassHypercrit(report.damageInfo, msg); }); }; <>c.<>9__2_1 = val2; obj2 = (object)val2; } HealthComponent.SendDamageDealt += (Manipulator)obj2; object obj3 = <>c.<>9__2_2; if (obj3 == null) { hook_Serialize val3 = delegate(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer) { orig.Invoke(self, writer); if (!critInfoAttachments.TryGetValue(self, out var value2)) { value2 = new Main.AdditionalProcInfo(); } value2.Serialize(writer); }; <>c.<>9__2_2 = val3; obj3 = (object)val3; } DamageDealtMessage.Serialize += (hook_Serialize)obj3; object obj4 = <>c.<>9__2_3; if (obj4 == null) { hook_Deserialize val4 = delegate(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader) { orig.Invoke(self, reader); Main.AdditionalProcInfo additionalProcInfo2 = new Main.AdditionalProcInfo(); additionalProcInfo2.Deserialize(reader); critInfoAttachments.Add(self, additionalProcInfo2); lastNetworkedCritInfo = additionalProcInfo2; }; <>c.<>9__2_3 = val4; obj4 = (object)val4; } DamageDealtMessage.Deserialize += (hook_Deserialize)obj4; object obj5 = <>c.<>9__2_4; if (obj5 == null) { hook_OnCrit val5 = delegate(orig_OnCrit orig, GlobalEventManager self, CharacterBody body, DamageInfo damageInfo, CharacterMaster master, float procCoefficient, ProcChainMask procChainMask) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) critInfoAttachments.TryGetValue(damageInfo, out var value); if (value != null && value.numProcs > 1) { int numProcs = value.numProcs; value.numProcs = 0; for (int i = 0; i < numProcs; i++) { orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask); } } else { orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask); } }; <>c.<>9__2_4 = val5; obj5 = (object)val5; } GlobalEventManager.OnCrit += (hook_OnCrit)obj5; object obj6 = <>c.<>9__2_5; if (obj6 == null) { Manipulator val6 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val12 = new ILCursor(il); val12.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(DamageColor), "FindColor") }); val12.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color origColor) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) if (lastNetworkedCritInfo == null) { return origColor; } Main.AdditionalProcInfo aci = lastNetworkedCritInfo; lastNetworkedCritInfo = null; float effectiveCount = GetEffectiveCount(aci); if (effectiveCount == 0f) { return origColor; } float num = 1f / 6f - (effectiveCount - 1f) / (float)Main.CritColor.Value; return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f); }); }; <>c.<>9__2_5 = val6; obj6 = (object)val6; } DamageNumberManager.SpawnDamageNumber += (Manipulator)obj6; if (!Main.Flurry.Value) { return; } object obj7 = <>c.<>9__2_6; if (obj7 == null) { hook_OnEnter val7 = delegate(orig_OnEnter orig, FireFlurrySeekingArrow self) { orig.Invoke(self); Main.AdditionalProcInfo additionalProcInfo = RollHypercrit(((EntityState)self).characterBody.critMultiplier - 2f, ((EntityState)self).characterBody); if (additionalProcInfo.num > 1) { additionalProcInfo.damageMult *= 6f / (float)(3 + 3 * additionalProcInfo.num); } critInfoAttachments.Add(self, additionalProcInfo); ((FireSeekingArrow)self).isCrit = additionalProcInfo.num > 0; ((FireSeekingArrow)self).maxArrowCount = 3 + additionalProcInfo.num * 3; ((FireSeekingArrow)self).arrowReloadDuration = ((FireSeekingArrow)self).baseArrowReloadDuration * (3f / (float)((FireSeekingArrow)self).maxArrowCount) / ((BaseState)self).attackSpeedStat; }; <>c.<>9__2_6 = val7; obj7 = (object)val7; } FireFlurrySeekingArrow.OnEnter += (hook_OnEnter)obj7; object obj8 = <>c.<>9__2_7; if (obj8 == null) { Manipulator val8 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val11 = new ILCursor(il); val11.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0) }); val11.Emit(OpCodes.Dup); val11.Emit(OpCodes.Ldarg_0); val11.EmitDelegate<Action<GenericDamageOrb, FireSeekingArrow>>((Action<GenericDamageOrb, FireSeekingArrow>)delegate(GenericDamageOrb orb, FireSeekingArrow self) { TryPassHypercrit(self, orb); }); }; <>c.<>9__2_7 = val8; obj8 = (object)val8; } FireSeekingArrow.FireOrbArrow += (Manipulator)obj8; object obj9 = <>c.<>9__2_8; if (obj9 == null) { Manipulator val9 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: 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) ILCursor val10 = new ILCursor(il); val10.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); val10.Emit(OpCodes.Dup); val10.Emit(OpCodes.Ldarg_0); val10.EmitDelegate<Action<DamageInfo, GenericDamageOrb>>((Action<DamageInfo, GenericDamageOrb>)delegate(DamageInfo di, GenericDamageOrb orb) { TryPassHypercrit(orb, di); }); }; <>c.<>9__2_8 = val9; obj9 = (object)val9; } GenericDamageOrb.OnArrival += (Manipulator)obj9; } public static void PatchHyperbolic() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__3_0; if (obj == null) { hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && Main.HyperbolicCrit.Value) { self.crit = 100f - 10000f / (100f + 1.111111f * self.crit); } }; <>c.<>9__3_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; } public static void LaserScopeRework() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown object obj = <>c.<>9__4_0; if (obj == null) { StatHookEventHandler val = delegate(CharacterBody self, StatHookEventArgs args) { if (!((Object)(object)self == (Object)null) && !((Object)(object)self.inventory == (Object)null) && self.inventory.GetItemCount(Items.CritDamage) > 0) { args.critAdd += Main.LaserScope.Value; } }; <>c.<>9__4_0 = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>c.<>9__4_1; if (obj2 == null) { hook_GetLocalizedStringByToken val2 = (orig_GetLocalizedStringByToken orig, Language self, string token) => (token == "ITEM_CRITDAMAGE_DESC") ? ($"Gain <style=cIsDamage>{Main.LaserScope.Value}% critical chance</style>. " + orig.Invoke(self, token)) : orig.Invoke(self, token); <>c.<>9__4_1 = val2; obj2 = (object)val2; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2; } public static void MoonglassesRework() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown if (General.disabledItems.Keys.Any((ItemIndex x) => ((Object)ItemCatalog.GetItemDef(x)).name == "MysticsItems_Moonglasses")) { return; } object obj = <>c.<>9__5_0; if (obj == null) { hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if ((Object)(object)((self != null) ? self.inventory : null) != (Object)null) { int itemCount = self.inventory.GetItemCount(Items.MysticsItems_Moonglasses); if (itemCount != 0) { self.crit *= Mathf.Pow(2f, (float)itemCount); self.crit -= Main.Moonglasses.Value * (float)itemCount; if (self.crit < 0f && self.inventory.GetItemCount(Items.ConvertCritChanceToCritDamage) > 0) { Chat.AddMessage("Hypercrit makes crit chance past 100 give a chance to do a hit that is your crit damage +100%. So in a scenario where your crit is 101% and crit damage is x2, mean your actual crit damage will be x2 in 100% cases and x3 in 1% cases. So to put it simply from x2 to x3.\r\nNow negative crit would work like this. Let's say you have -50% chance and x3.5 crit damage. Obviously no way for you to proc crits randomly, but could give a change to deal \"negative crit\" in other ways, that is -100% from you crit damage for every -100% crit chance past 0. So your crit damage range would be from x2.5 to x3.5.\r\nAt the least I was hoping that negative would work with survivors that can't have chance and instead get it converted to crit damage. Like railgunner."); self.master.TrueKill(); } self.crit = Mathf.Max(0f, self.crit); } } }; <>c.<>9__5_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; object obj2 = <>c.<>9__5_1; if (obj2 == null) { hook_GetLocalizedStringByToken val2 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "ITEM_MYSTICSITEMS_MOONGLASSES_PICKUP") { return orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_PICKUP"); } return (token == "ITEM_MYSTICSITEMS_MOONGLASSES_DESC") ? orig.Invoke(self, "ITEM_HYPERCRIT_MOONGLASSES_DESC") : orig.Invoke(self, token); }; <>c.<>9__5_1 = val2; obj2 = (object)val2; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj2; LanguageAPI.Add("ITEM_HYPERCRIT_MOONGLASSES_PICKUP", "Increase Critical Strike damage... <color=#FF7F7F>BUT reduce Critical Strike chance.</color>"); LanguageAPI.Add("ITEM_HYPERCRIT_MOONGLASSES_DESC", "Increase Critical Strike damage by <style=cIsDamage>{CritDamageIncrease}% <style=cStack>(+{CritDamageIncreasePerStack}% per stack)</style></style>. <style=cIsUtility>reduce Critical Strike chance by {0}% <style=cStack>(+{0}% per stack)</style> for each stack.</style>".Replace("{0}", Main.Moonglasses.Value.ToString()).Replace("{CritDamageIncrease}", ((object)Moonglasses.critDamageIncrease).ToString()).Replace("{CritDamageIncreasePerStack}", ((object)Moonglasses.critDamageIncreasePerStack).ToString())); } public static bool TryGetHypercrit(object target, ref Main.AdditionalProcInfo aci) { return critInfoAttachments.TryGetValue(target, out aci); } private static bool TryPassHypercrit(object from, object to) { Main.AdditionalProcInfo value; bool flag = critInfoAttachments.TryGetValue(from, out value); if (flag) { critInfoAttachments.Add(to, value); } return flag; } private static bool TryPassHypercrit(object from, object to, out Main.AdditionalProcInfo aci) { bool flag = critInfoAttachments.TryGetValue(from, out aci); if (flag) { critInfoAttachments.Add(to, aci); } return flag; } public static Main.AdditionalProcInfo RollHypercrit(float damage, CharacterBody body, CharacterBody body2 = null) { Main.AdditionalProcInfo additionalProcInfo = new Main.AdditionalProcInfo(); if (Object.op_Implicit((Object)(object)body)) { additionalProcInfo.totalChance = body.crit; float num = GetEffectiveCount(body.crit, body); if ((Object)(object)body2 != (Object)null && Main.Mods("com.TeamMoonstorm.Starstorm2-Nightly") && NeedlesCompat(body2)) { num += 1f; } additionalProcInfo.num = (Main.CritFraction.Value ? (Mathf.FloorToInt(num) + (Util.CheckRoll(num % 1f * 100f, body.master) ? 1 : 0)) : ((int)num)); if (additionalProcInfo.num == 0) { additionalProcInfo.damageMult = 1f; } else { additionalProcInfo.damageMult = Main.Calc(Main.CritMode.Value, Main.CritBase.Value + damage, Main.CritMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.CritDecay.Value, num); } float num2 = 0f; if (additionalProcInfo.num != 0) { num2 = Main.Calc(Main.CritProcMode.Value, Main.CritProcBase.Value, Main.CritProcMult.Value, Main.CritProcDecay.Value, num); } additionalProcInfo.numProcs = (int)num2 + (Util.CheckRoll(num2 % 1f * 100f, 0f, (CharacterMaster)null) ? 1 : 0); } return additionalProcInfo; } public static float GetDamage(float chance, float damage, CharacterBody body) { return Main.Calc(Main.CritMode.Value, Main.CritBase.Value + damage, Main.CritMult.Value + (Main.CritDamageBonus.Value ? damage : 0f), Main.CritDecay.Value, Mathf.Max(1f, GetEffectiveCount(chance + (100f - chance % 100f), body))); } public static float GetEffectiveCount(Main.AdditionalProcInfo aci) { if (Main.CritFraction.Value) { float num = aci.totalChance / 100f; if (num < 1f) { num = 0f; } return num; } return aci.num; } public static float GetEffectiveCount(float chance, CharacterBody body, bool forceSingleCrit = false) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, (chance - (float)(forceSingleCrit ? 100 : 0)) / 100f); if (Main.CritCap.Value >= 0f) { num = Mathf.Min(num, Main.CritCap.Value); } if (Main.CritFraction.Value && Main.Mods("com.themysticsword.mysticsitems") && (Object)(object)((body != null) ? body.inventory : null) != (Object)null && num > 0f) { num += 0.01f * (float)body.inventory.GetItemCount(ItemCatalog.FindItemIndex("MysticsItems_ScratchTicket")); } if (num <= 0f) { return 0f; } if (!Main.CritFraction.Value) { return Mathf.FloorToInt(num) + (Util.CheckRoll(num % 1f * 100f, body.master) ? 1 : 0); } return num; } public static bool NeedlesCompat(CharacterBody body) { return body.HasBuff(Buffs.BuffNeedle); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("prodzpod.Hypercrit2", "Hypercrit2", "1.2.6")] [NetworkCompatibility(/*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.*/)] public class Main : BaseUnityPlugin { public enum CritStackingMode { Linear, Exponential, Hyperbolic, Asymptotic } public class AdditionalProcInfo : ISerializableObject { public float totalChance = 0f; public int num = 0; public float damageMult = 1f; public int numProcs = 0; public void Deserialize(NetworkReader reader) { totalChance = reader.ReadSingle(); num = reader.ReadInt32(); numProcs = reader.ReadInt32(); damageMult = reader.ReadSingle(); } public void Serialize(NetworkWriter writer) { writer.Write(totalChance); writer.Write(num); writer.Write(numProcs); writer.Write(damageMult); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static StatHookEventHandler <>9__64_0; public static DisplayCallback <>9__68_0; public static DisplayCallback <>9__68_1; public static DisplayCallback <>9__68_2; public static DisplayCallback <>9__68_3; public static DisplayCallback <>9__68_4; public static DisplayCallback <>9__68_5; public static DisplayCallback <>9__68_6; public static DisplayCallback <>9__68_7; public static DisplayCallback <>9__68_8; public static DisplayCallback <>9__68_9; public static Comparison<string> <>9__68_10; internal void <Awake>b__64_0(CharacterBody self, StatHookEventArgs args) { self.baseCrit = BaseCritChance.Value * 100f; self.bleedChance += BaseBleedChance.Value * 100f; } internal string <BetterUICompat>b__6
BepinEx/plugins/RiskofThunder-HookGenPatcher/MMHOOK/MMHOOK_Assembly-CSharp.dll
Decompiled 11 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Net; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using EntityStates; using EntityStates.AI; using EntityStates.AI.Walker; using EntityStates.AncientWispMonster; using EntityStates.ArchWispMonster; using EntityStates.ArtifactShell; using EntityStates.Assassin.Weapon; using EntityStates.Bandit2; using EntityStates.Bandit2.Weapon; using EntityStates.Barrel; using EntityStates.BeetleGuardMonster; using EntityStates.BeetleMonster; using EntityStates.BeetleQueenMonster; using EntityStates.Bell; using EntityStates.Bell.BellWeapon; using EntityStates.Bison; using EntityStates.BrotherHaunt; using EntityStates.BrotherMonster; using EntityStates.BrotherMonster.Weapon; using EntityStates.Captain.Weapon; using EntityStates.CaptainDefenseMatrixItem; using EntityStates.CaptainSupplyDrop; using EntityStates.ClayBoss; using EntityStates.ClayBoss.ClayBossWeapon; using EntityStates.ClayBruiser.Weapon; using EntityStates.ClayBruiserMonster; using EntityStates.ClaymanMonster; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using EntityStates.Croco; using EntityStates.Destructible; using EntityStates.Drone; using EntityStates.Drone.DroneWeapon; using EntityStates.Duplicator; using EntityStates.Emote; using EntityStates.Engi.EngiBubbleShield; using EntityStates.Engi.EngiMissilePainter; using EntityStates.Engi.EngiWallShield; using EntityStates.Engi.EngiWeapon; using EntityStates.Engi.Mine; using EntityStates.Engi.MineDeployer; using EntityStates.Engi.SpiderMine; using EntityStates.EngiTurret; using EntityStates.EngiTurret.EngiTurretWeapon; using EntityStates.Fauna; using EntityStates.GameOver; using EntityStates.GlobalSkills.LunarDetonator; using EntityStates.GlobalSkills.LunarNeedle; using EntityStates.GlobalSkills.WoundSlash; using EntityStates.GoldGat; using EntityStates.GolemMonster; using EntityStates.GrandParent; using EntityStates.GrandParentBoss; using EntityStates.GrandParentSun; using EntityStates.GravekeeperBoss; using EntityStates.GravekeeperMonster.Weapon; using EntityStates.GreaterWispMonster; using EntityStates.HAND; using EntityStates.HAND.Weapon; using EntityStates.Headstompers; using EntityStates.Heretic; using EntityStates.Heretic.Weapon; using EntityStates.HermitCrab; using EntityStates.Huntress; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Huntress.Weapon; using EntityStates.ImpBossMonster; using EntityStates.ImpMonster; using EntityStates.ImpMonster.Weapon; using EntityStates.Interactables.GoldBeacon; using EntityStates.Interactables.MSObelisk; using EntityStates.Interactables.StoneGate; using EntityStates.Jellyfish; using EntityStates.JellyfishMonster; using EntityStates.LaserTurbine; using EntityStates.LemurianBruiserMonster; using EntityStates.LemurianMonster; using EntityStates.Loader; using EntityStates.LockedMage; using EntityStates.LunarExploderMonster; using EntityStates.LunarExploderMonster.Weapon; using EntityStates.LunarGolem; using EntityStates.LunarTeleporter; using EntityStates.LunarWisp; using EntityStates.Mage; using EntityStates.Mage.Weapon; using EntityStates.MagmaWorm; using EntityStates.Merc; using EntityStates.Merc.Weapon; using EntityStates.MiniMushroom; using EntityStates.Missions.Arena.NullWard; using EntityStates.Missions.ArtifactWorld.TrialController; using EntityStates.Missions.BrotherEncounter; using EntityStates.Missions.Goldshores; using EntityStates.Missions.LunarScavengerEncounter; using EntityStates.Missions.Moon; using EntityStates.Missions.SuperRoboBallEncounter; using EntityStates.MoonElevator; using EntityStates.NewtMonster; using EntityStates.NullifierMonster; using EntityStates.Paladin; using EntityStates.Paladin.PaladinWeapon; using EntityStates.ParentEgg; using EntityStates.ParentMonster; using EntityStates.ParentPod; using EntityStates.Pot.PotWeapon; using EntityStates.Pounder; using EntityStates.QuestVolatileBattery; using EntityStates.RoboBallBoss; using EntityStates.RoboBallBoss.Weapon; using EntityStates.RoboBallMini; using EntityStates.RoboBallMini.Weapon; using EntityStates.RoboCratePod; using EntityStates.ScavBackpack; using EntityStates.ScavMonster; using EntityStates.Scrapper; using EntityStates.SiphonItem; using EntityStates.Sniper.Scope; using EntityStates.Sniper.SniperWeapon; using EntityStates.SpectatorSkills; using EntityStates.Squid; using EntityStates.Squid.DeathState; using EntityStates.Squid.SquidWeapon; using EntityStates.SurvivorPod; using EntityStates.SurvivorPod.BatteryPanel; using EntityStates.TeleporterHealNovaController; using EntityStates.TimedChest; using EntityStates.TitanMonster; using EntityStates.Toolbot; using EntityStates.Treebot; using EntityStates.Treebot.TreebotFlower; using EntityStates.Treebot.UnlockInteractable; using EntityStates.Treebot.Weapon; using EntityStates.Turret1; using EntityStates.UrchinTurret; using EntityStates.UrchinTurret.Weapon; using EntityStates.VagrantMonster; using EntityStates.VagrantMonster.Weapon; using EntityStates.VagrantNovaItem; using EntityStates.Vulture; using EntityStates.Vulture.Weapon; using EntityStates.Wisp1Monster; using Facepunch.Steamworks; using Generics.Dynamics; using HG; using JBooth.VertexPainterPro; using KinematicCharacterController; using LeTai.Asset.TranslucentImage; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using On; using On.EntityStates; using On.EntityStates.AI; using On.EntityStates.AI.Walker; using On.EntityStates.AncientWispMonster; using On.EntityStates.ArchWispMonster; using On.EntityStates.ArtifactShell; using On.EntityStates.Assassin.Weapon; using On.EntityStates.Bandit2; using On.EntityStates.Bandit2.Weapon; using On.EntityStates.Barrel; using On.EntityStates.BeetleGuardMonster; using On.EntityStates.BeetleMonster; using On.EntityStates.BeetleQueenMonster; using On.EntityStates.Bell; using On.EntityStates.Bell.BellWeapon; using On.EntityStates.Bison; using On.EntityStates.BrotherHaunt; using On.EntityStates.BrotherMonster; using On.EntityStates.BrotherMonster.Weapon; using On.EntityStates.Captain.Weapon; using On.EntityStates.CaptainDefenseMatrixItem; using On.EntityStates.CaptainSupplyDrop; using On.EntityStates.ClayBoss; using On.EntityStates.ClayBoss.ClayBossWeapon; using On.EntityStates.ClayBruiser.Weapon; using On.EntityStates.ClayBruiserMonster; using On.EntityStates.ClaymanMonster; using On.EntityStates.Commando; using On.EntityStates.Commando.CommandoWeapon; using On.EntityStates.Croco; using On.EntityStates.Destructible; using On.EntityStates.Drone; using On.EntityStates.Drone.DroneWeapon; using On.EntityStates.Duplicator; using On.EntityStates.Emote; using On.EntityStates.Engi.EngiBubbleShield; using On.EntityStates.Engi.EngiMissilePainter; using On.EntityStates.Engi.EngiWallShield; using On.EntityStates.Engi.EngiWeapon; using On.EntityStates.Engi.Mine; using On.EntityStates.Engi.MineDeployer; using On.EntityStates.Engi.SpiderMine; using On.EntityStates.EngiTurret; using On.EntityStates.EngiTurret.EngiTurretWeapon; using On.EntityStates.Fauna; using On.EntityStates.GameOver; using On.EntityStates.GlobalSkills.LunarDetonator; using On.EntityStates.GlobalSkills.LunarNeedle; using On.EntityStates.GlobalSkills.WoundSlash; using On.EntityStates.GoldGat; using On.EntityStates.GolemMonster; using On.EntityStates.GrandParent; using On.EntityStates.GrandParentBoss; using On.EntityStates.GrandParentSun; using On.EntityStates.GravekeeperBoss; using On.EntityStates.GravekeeperMonster.Weapon; using On.EntityStates.GreaterWispMonster; using On.EntityStates.HAND; using On.EntityStates.HAND.Weapon; using On.EntityStates.Headstompers; using On.EntityStates.Heretic; using On.EntityStates.Heretic.Weapon; using On.EntityStates.HermitCrab; using On.EntityStates.Huntress; using On.EntityStates.Huntress.HuntressWeapon; using On.EntityStates.Huntress.Weapon; using On.EntityStates.ImpBossMonster; using On.EntityStates.ImpMonster; using On.EntityStates.ImpMonster.Weapon; using On.EntityStates.Interactables.GoldBeacon; using On.EntityStates.Interactables.MSObelisk; using On.EntityStates.Interactables.StoneGate; using On.EntityStates.Jellyfish; using On.EntityStates.JellyfishMonster; using On.EntityStates.LaserTurbine; using On.EntityStates.LemurianBruiserMonster; using On.EntityStates.LemurianMonster; using On.EntityStates.Loader; using On.EntityStates.LockedMage; using On.EntityStates.LunarExploderMonster; using On.EntityStates.LunarExploderMonster.Weapon; using On.EntityStates.LunarGolem; using On.EntityStates.LunarTeleporter; using On.EntityStates.LunarWisp; using On.EntityStates.Mage; using On.EntityStates.Mage.Weapon; using On.EntityStates.MagmaWorm; using On.EntityStates.Merc; using On.EntityStates.Merc.Weapon; using On.EntityStates.MiniMushroom; using On.EntityStates.Missions.Arena.NullWard; using On.EntityStates.Missions.ArtifactWorld.TrialController; using On.EntityStates.Missions.BrotherEncounter; using On.EntityStates.Missions.Goldshores; using On.EntityStates.Missions.LunarScavengerEncounter; using On.EntityStates.Missions.Moon; using On.EntityStates.Missions.SuperRoboBallEncounter; using On.EntityStates.MoonElevator; using On.EntityStates.NewtMonster; using On.EntityStates.NullifierMonster; using On.EntityStates.Paladin; using On.EntityStates.Paladin.PaladinWeapon; using On.EntityStates.ParentEgg; using On.EntityStates.ParentMonster; using On.EntityStates.ParentPod; using On.EntityStates.Pot.PotWeapon; using On.EntityStates.Pounder; using On.EntityStates.QuestVolatileBattery; using On.EntityStates.RoboBallBoss; using On.EntityStates.RoboBallBoss.Weapon; using On.EntityStates.RoboBallMini; using On.EntityStates.RoboBallMini.Weapon; using On.EntityStates.RoboCratePod; using On.EntityStates.ScavBackpack; using On.EntityStates.ScavMonster; using On.EntityStates.Scrapper; using On.EntityStates.SiphonItem; using On.EntityStates.Sniper.Scope; using On.EntityStates.Sniper.SniperWeapon; using On.EntityStates.SpectatorSkills; using On.EntityStates.Squid; using On.EntityStates.Squid.DeathState; using On.EntityStates.Squid.SquidWeapon; using On.EntityStates.SurvivorPod; using On.EntityStates.SurvivorPod.BatteryPanel; using On.EntityStates.TeleporterHealNovaController; using On.EntityStates.TimedChest; using On.EntityStates.TitanMonster; using On.EntityStates.Toolbot; using On.EntityStates.Treebot; using On.EntityStates.Treebot.TreebotFlower; using On.EntityStates.Treebot.UnlockInteractable; using On.EntityStates.Treebot.Weapon; using On.EntityStates.Turret1; using On.EntityStates.UrchinTurret; using On.EntityStates.UrchinTurret.Weapon; using On.EntityStates.VagrantMonster; using On.EntityStates.VagrantMonster.Weapon; using On.EntityStates.VagrantNovaItem; using On.EntityStates.Vulture; using On.EntityStates.Vulture.Weapon; using On.EntityStates.Wisp1Monster; using On.Generics.Dynamics; using On.JBooth.VertexPainterPro; using On.KinematicCharacterController; using On.LeTai.Asset.TranslucentImage; using On.Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Achievements; using On.RoR2.Achievements.Artifacts; using On.RoR2.Achievements.Bandit2; using On.RoR2.Achievements.Captain; using On.RoR2.Achievements.Commando; using On.RoR2.Achievements.Croco; using On.RoR2.Achievements.Engi; using On.RoR2.Achievements.Huntress; using On.RoR2.Achievements.Loader; using On.RoR2.Achievements.Mage; using On.RoR2.Achievements.Merc; using On.RoR2.Achievements.Toolbot; using On.RoR2.Achievements.Treebot; using On.RoR2.Artifacts; using On.RoR2.Audio; using On.RoR2.CharacterAI; using On.RoR2.CharacterSpeech; using On.RoR2.ConVar; using On.RoR2.ContentManagement; using On.RoR2.DirectionalSearch; using On.RoR2.DispatachableEffects; using On.RoR2.EntityLogic; using On.RoR2.Hologram; using On.RoR2.Items; using On.RoR2.Mecanim; using On.RoR2.Modding; using On.RoR2.Navigation; using On.RoR2.Networking; using On.RoR2.Orbs; using On.RoR2.PostProcess; using On.RoR2.PostProcessing; using On.RoR2.Projectile; using On.RoR2.RemoteGameBrowser; using On.RoR2.Skills; using On.RoR2.Social; using On.RoR2.Stats; using On.RoR2.UI; using On.RoR2.UI.LogBook; using On.RoR2.UI.MainMenu; using On.RoR2.UI.SkinControllers; using On.RoR2.WwiseUtils; using On.SteamAPIValidator; using On.System.Runtime.CompilerServices; using On.ThreeEyedGames; using On.Unity; using On.UnityEngine.Rendering.PostProcessing; using Rewired; using Rewired.Integration.UnityUI; using RoR2; using RoR2.Achievements; using RoR2.Achievements.Artifacts; using RoR2.Achievements.Bandit2; using RoR2.Achievements.Captain; using RoR2.Achievements.Commando; using RoR2.Achievements.Croco; using RoR2.Achievements.Engi; using RoR2.Achievements.Huntress; using RoR2.Achievements.Loader; using RoR2.Achievements.Mage; using RoR2.Achievements.Merc; using RoR2.Achievements.Toolbot; using RoR2.Achievements.Treebot; using RoR2.Artifacts; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.CharacterSpeech; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.DirectionalSearch; using RoR2.DispatachableEffects; using RoR2.EntityLogic; using RoR2.Hologram; using RoR2.Items; using RoR2.Mecanim; using RoR2.Modding; using RoR2.Navigation; using RoR2.Networking; using RoR2.Orbs; using RoR2.PostProcess; using RoR2.PostProcessing; using RoR2.Projectile; using RoR2.RemoteGameBrowser; using RoR2.Skills; using RoR2.Social; using RoR2.Stats; using RoR2.UI; using RoR2.UI.LogBook; using RoR2.UI.MainMenu; using RoR2.UI.SkinControllers; using RoR2.WwiseUtils; using TMPro; using ThreeEyedGames; using Unity; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zio; [assembly: AssemblyVersion("0.0.0.0")] namespace On.Microsoft.CodeAnalysis { public static class EmbeddedAttribute { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(Attribute self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, Attribute self); public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL.Microsoft.CodeAnalysis { public static class EmbeddedAttribute { public static event Manipulator ctor { add { HookEndpointManager.Modify<On.Microsoft.CodeAnalysis.EmbeddedAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.Microsoft.CodeAnalysis.EmbeddedAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On.System.Runtime.CompilerServices { public static class IsReadOnlyAttribute { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(Attribute self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, Attribute self); public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL.System.Runtime.CompilerServices { public static class IsReadOnlyAttribute { public static event Manipulator ctor { add { HookEndpointManager.Modify<On.System.Runtime.CompilerServices.IsReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.System.Runtime.CompilerServices.IsReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class CameraDepthMode { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDisable(CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDisable(orig_OnDisable orig, CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(CameraDepthMode self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, CameraDepthMode self); public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnDisable OnDisable { add { HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class CameraDepthMode { public static event Manipulator Start { add { HookEndpointManager.Modify<On.CameraDepthMode.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CameraDepthMode.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.CameraDepthMode.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CameraDepthMode.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnDisable { add { HookEndpointManager.Modify<On.CameraDepthMode.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CameraDepthMode.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.CameraDepthMode.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CameraDepthMode.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class FogControl { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Update(FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Update(orig_Update orig, FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_init(FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_init(orig_init orig, FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(FogControl self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, FogControl self); public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Update Update { add { HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_init init { add { HookEndpointManager.Add<hook_init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class FogControl { public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.FogControl.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FogControl.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Start { add { HookEndpointManager.Modify<On.FogControl.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FogControl.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Update { add { HookEndpointManager.Modify<On.FogControl.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FogControl.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator init { add { HookEndpointManager.Modify<On.FogControl.hook_init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FogControl.hook_init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.FogControl.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FogControl.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class UnderWaterFog { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(UnderWaterFog self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, UnderWaterFog self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool orig_CheckResources(UnderWaterFog self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool hook_CheckResources(orig_CheckResources orig, UnderWaterFog self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnRenderImage(UnderWaterFog self, RenderTexture source, RenderTexture destination); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnRenderImage(orig_OnRenderImage orig, UnderWaterFog self, RenderTexture source, RenderTexture destination); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_CustomGraphicsBlit(RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_CustomGraphicsBlit(orig_CustomGraphicsBlit orig, RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(UnderWaterFog self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, UnderWaterFog self); public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CheckResources CheckResources { add { HookEndpointManager.Add<hook_CheckResources>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CheckResources>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnRenderImage OnRenderImage { add { HookEndpointManager.Add<hook_OnRenderImage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnRenderImage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CustomGraphicsBlit CustomGraphicsBlit { add { HookEndpointManager.Add<hook_CustomGraphicsBlit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CustomGraphicsBlit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class UnderWaterFog { public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.UnderWaterFog.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.UnderWaterFog.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CheckResources { add { HookEndpointManager.Modify<On.UnderWaterFog.hook_CheckResources>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.UnderWaterFog.hook_CheckResources>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnRenderImage { add { HookEndpointManager.Modify<On.UnderWaterFog.hook_OnRenderImage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.UnderWaterFog.hook_OnRenderImage>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CustomGraphicsBlit { add { HookEndpointManager.Modify<On.UnderWaterFog.hook_CustomGraphicsBlit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.UnderWaterFog.hook_CustomGraphicsBlit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.UnderWaterFog.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.UnderWaterFog.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class MirrorReflection { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDisable(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDisable(orig_OnDisable orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_setMaterial(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_setMaterial(orig_setMaterial orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Camera orig_CreateReflectionCameraFor(MirrorReflection self, Camera cam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Camera hook_CreateReflectionCameraFor(orig_CreateReflectionCameraFor orig, MirrorReflection self, Camera cam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_SetStandardCameraParameter(MirrorReflection self, Camera cam, LayerMask mask); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_SetStandardCameraParameter(orig_SetStandardCameraParameter orig, MirrorReflection self, Camera cam, LayerMask mask); [EditorBrowsable(EditorBrowsableState.Never)] public delegate RenderTexture orig_CreateTextureFor(MirrorReflection self, Camera cam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate RenderTexture hook_CreateTextureFor(orig_CreateTextureFor orig, MirrorReflection self, Camera cam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_RenderHelpCameras(MirrorReflection self, Camera currentCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_RenderHelpCameras(orig_RenderHelpCameras orig, MirrorReflection self, Camera currentCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_LateUpdate(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_LateUpdate(orig_LateUpdate orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_WaterTileBeingRendered(MirrorReflection self, Transform tr, Camera currentCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_WaterTileBeingRendered(orig_WaterTileBeingRendered orig, MirrorReflection self, Transform tr, Camera currentCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnWillRenderObject(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnWillRenderObject(orig_OnWillRenderObject orig, MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_RenderReflectionFor(MirrorReflection self, Camera cam, Camera reflectCamera); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_RenderReflectionFor(orig_RenderReflectionFor orig, MirrorReflection self, Camera cam, Camera reflectCamera); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_SaneCameraSettings(MirrorReflection self, Camera helperCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_SaneCameraSettings(orig_SaneCameraSettings orig, MirrorReflection self, Camera helperCam); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Matrix4x4 orig_CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Matrix4x4 hook_CalculateObliqueMatrix(orig_CalculateObliqueMatrix orig, Matrix4x4 projection, Vector4 clipPlane); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Matrix4x4 orig_CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Matrix4x4 hook_CalculateReflectionMatrix(orig_CalculateReflectionMatrix orig, Matrix4x4 reflectionMat, Vector4 plane); [EditorBrowsable(EditorBrowsableState.Never)] public delegate float orig_Sgn(float a); [EditorBrowsable(EditorBrowsableState.Never)] public delegate float hook_Sgn(orig_Sgn orig, float a); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Vector4 orig_CameraSpacePlane(MirrorReflection self, Camera cam, Vector3 pos, Vector3 normal, float sideSign); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Vector4 hook_CameraSpacePlane(orig_CameraSpacePlane orig, MirrorReflection self, Camera cam, Vector3 pos, Vector3 normal, float sideSign); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(MirrorReflection self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, MirrorReflection self); public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnDisable OnDisable { add { HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_setMaterial setMaterial { add { HookEndpointManager.Add<hook_setMaterial>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_setMaterial>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CreateReflectionCameraFor CreateReflectionCameraFor { add { HookEndpointManager.Add<hook_CreateReflectionCameraFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CreateReflectionCameraFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_SetStandardCameraParameter SetStandardCameraParameter { add { HookEndpointManager.Add<hook_SetStandardCameraParameter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_SetStandardCameraParameter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CreateTextureFor CreateTextureFor { add { HookEndpointManager.Add<hook_CreateTextureFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CreateTextureFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_RenderHelpCameras RenderHelpCameras { add { HookEndpointManager.Add<hook_RenderHelpCameras>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_RenderHelpCameras>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_LateUpdate LateUpdate { add { HookEndpointManager.Add<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_WaterTileBeingRendered WaterTileBeingRendered { add { HookEndpointManager.Add<hook_WaterTileBeingRendered>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_WaterTileBeingRendered>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnWillRenderObject OnWillRenderObject { add { HookEndpointManager.Add<hook_OnWillRenderObject>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnWillRenderObject>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_RenderReflectionFor RenderReflectionFor { add { HookEndpointManager.Add<hook_RenderReflectionFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_RenderReflectionFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_SaneCameraSettings SaneCameraSettings { add { HookEndpointManager.Add<hook_SaneCameraSettings>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_SaneCameraSettings>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CalculateObliqueMatrix CalculateObliqueMatrix { add { HookEndpointManager.Add<hook_CalculateObliqueMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CalculateObliqueMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CalculateReflectionMatrix CalculateReflectionMatrix { add { HookEndpointManager.Add<hook_CalculateReflectionMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CalculateReflectionMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Sgn Sgn { add { HookEndpointManager.Add<hook_Sgn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Sgn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_CameraSpacePlane CameraSpacePlane { add { HookEndpointManager.Add<hook_CameraSpacePlane>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_CameraSpacePlane>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class MirrorReflection { public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.MirrorReflection.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnDisable { add { HookEndpointManager.Modify<On.MirrorReflection.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Start { add { HookEndpointManager.Modify<On.MirrorReflection.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator setMaterial { add { HookEndpointManager.Modify<On.MirrorReflection.hook_setMaterial>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_setMaterial>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CreateReflectionCameraFor { add { HookEndpointManager.Modify<On.MirrorReflection.hook_CreateReflectionCameraFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_CreateReflectionCameraFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator SetStandardCameraParameter { add { HookEndpointManager.Modify<On.MirrorReflection.hook_SetStandardCameraParameter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_SetStandardCameraParameter>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CreateTextureFor { add { HookEndpointManager.Modify<On.MirrorReflection.hook_CreateTextureFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_CreateTextureFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator RenderHelpCameras { add { HookEndpointManager.Modify<On.MirrorReflection.hook_RenderHelpCameras>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_RenderHelpCameras>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator LateUpdate { add { HookEndpointManager.Modify<On.MirrorReflection.hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_LateUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator WaterTileBeingRendered { add { HookEndpointManager.Modify<On.MirrorReflection.hook_WaterTileBeingRendered>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_WaterTileBeingRendered>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnWillRenderObject { add { HookEndpointManager.Modify<On.MirrorReflection.hook_OnWillRenderObject>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_OnWillRenderObject>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator RenderReflectionFor { add { HookEndpointManager.Modify<On.MirrorReflection.hook_RenderReflectionFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_RenderReflectionFor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator SaneCameraSettings { add { HookEndpointManager.Modify<On.MirrorReflection.hook_SaneCameraSettings>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_SaneCameraSettings>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CalculateObliqueMatrix { add { HookEndpointManager.Modify<On.MirrorReflection.hook_CalculateObliqueMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_CalculateObliqueMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CalculateReflectionMatrix { add { HookEndpointManager.Modify<On.MirrorReflection.hook_CalculateReflectionMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_CalculateReflectionMatrix>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Sgn { add { HookEndpointManager.Modify<On.MirrorReflection.hook_Sgn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_Sgn>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator CameraSpacePlane { add { HookEndpointManager.Modify<On.MirrorReflection.hook_CameraSpacePlane>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_CameraSpacePlane>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.MirrorReflection.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.MirrorReflection.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class NGSS_ContactShadows { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_AddCommandBuffers(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_AddCommandBuffers(orig_AddCommandBuffers orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_RemoveCommandBuffers(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_RemoveCommandBuffers(orig_RemoveCommandBuffers orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Init(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Init(orig_Init orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool orig_IsNotSupported(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool hook_IsNotSupported(orig_IsNotSupported orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDisable(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDisable(orig_OnDisable orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnApplicationQuit(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnApplicationQuit(orig_OnApplicationQuit orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnPreRender(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnPreRender(orig_OnPreRender orig, NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(NGSS_ContactShadows self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, NGSS_ContactShadows self); public static event hook_AddCommandBuffers AddCommandBuffers { add { HookEndpointManager.Add<hook_AddCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_AddCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_RemoveCommandBuffers RemoveCommandBuffers { add { HookEndpointManager.Add<hook_RemoveCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_RemoveCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Init Init { add { HookEndpointManager.Add<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_IsNotSupported IsNotSupported { add { HookEndpointManager.Add<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnDisable OnDisable { add { HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnApplicationQuit OnApplicationQuit { add { HookEndpointManager.Add<hook_OnApplicationQuit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnApplicationQuit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnPreRender OnPreRender { add { HookEndpointManager.Add<hook_OnPreRender>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnPreRender>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class NGSS_ContactShadows { public static event Manipulator AddCommandBuffers { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_AddCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_AddCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator RemoveCommandBuffers { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_RemoveCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_RemoveCommandBuffers>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Init { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator IsNotSupported { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnDisable { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnApplicationQuit { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_OnApplicationQuit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_OnApplicationQuit>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnPreRender { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_OnPreRender>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_OnPreRender>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.NGSS_ContactShadows.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_ContactShadows.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class NGSS_Directional { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDisable(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDisable(orig_OnDisable orig, NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Init(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Init(orig_Init orig, NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool orig_IsNotSupported(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool hook_IsNotSupported(orig_IsNotSupported orig, NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Update(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Update(orig_Update orig, NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(NGSS_Directional self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, NGSS_Directional self); public static event hook_OnDisable OnDisable { add { HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Init Init { add { HookEndpointManager.Add<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_IsNotSupported IsNotSupported { add { HookEndpointManager.Add<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Update Update { add { HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class NGSS_Directional { public static event Manipulator OnDisable { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Init { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator IsNotSupported { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Update { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.NGSS_Directional.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Directional.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class NGSS_Local { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDisable(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDisable(orig_OnDisable orig, NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnEnable(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnEnable(orig_OnEnable orig, NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Init(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Init(orig_Init orig, NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool orig_IsNotSupported(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool hook_IsNotSupported(orig_IsNotSupported orig, NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Update(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Update(orig_Update orig, NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_SetProperties(NGSS_Local self, bool setLocalAndGlobalProperties); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_SetProperties(orig_SetProperties orig, NGSS_Local self, bool setLocalAndGlobalProperties); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(NGSS_Local self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, NGSS_Local self); public static event hook_OnDisable OnDisable { add { HookEndpointManager.Add<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_OnEnable OnEnable { add { HookEndpointManager.Add<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Init Init { add { HookEndpointManager.Add<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_IsNotSupported IsNotSupported { add { HookEndpointManager.Add<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Update Update { add { HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_SetProperties SetProperties { add { HookEndpointManager.Add<hook_SetProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_SetProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class NGSS_Local { public static event Manipulator OnDisable { add { HookEndpointManager.Modify<On.NGSS_Local.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_OnDisable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator OnEnable { add { HookEndpointManager.Modify<On.NGSS_Local.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_OnEnable>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Init { add { HookEndpointManager.Modify<On.NGSS_Local.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_Init>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator IsNotSupported { add { HookEndpointManager.Modify<On.NGSS_Local.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_IsNotSupported>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Update { add { HookEndpointManager.Modify<On.NGSS_Local.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator SetProperties { add { HookEndpointManager.Modify<On.NGSS_Local.hook_SetProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_SetProperties>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.NGSS_Local.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.NGSS_Local.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class ReadOnlyAttribute { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(ReadOnlyAttribute self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, ReadOnlyAttribute self); public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class ReadOnlyAttribute { public static event Manipulator ctor { add { HookEndpointManager.Modify<On.ReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.ReadOnlyAttribute.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class CubicBezier3 { [EditorBrowsable(EditorBrowsableState.Never)] public delegate CubicBezier3 orig_FromVelocities(Vector3 p0, Vector3 v0, Vector3 p1, Vector3 v1); [EditorBrowsable(EditorBrowsableState.Never)] public delegate CubicBezier3 hook_FromVelocities(orig_FromVelocities orig, Vector3 p0, Vector3 v0, Vector3 p1, Vector3 v1); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Vector3 orig_Evaluate(ref CubicBezier3 self, float t); [EditorBrowsable(EditorBrowsableState.Never)] public delegate Vector3 hook_Evaluate(orig_Evaluate orig, ref CubicBezier3 self, float t); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ToVertices_Vector3Array(ref CubicBezier3 self, Vector3[] results); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ToVertices_Vector3Array(orig_ToVertices_Vector3Array orig, ref CubicBezier3 self, Vector3[] results); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ToVertices_Vector3Array_int_int(ref CubicBezier3 self, Vector3[] results, int spanStart, int spanLength); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ToVertices_Vector3Array_int_int(orig_ToVertices_Vector3Array_int_int orig, ref CubicBezier3 self, Vector3[] results, int spanStart, int spanLength); [EditorBrowsable(EditorBrowsableState.Never)] public delegate float orig_ApproximateLength(ref CubicBezier3 self, int samples); [EditorBrowsable(EditorBrowsableState.Never)] public delegate float hook_ApproximateLength(orig_ApproximateLength orig, ref CubicBezier3 self, int samples); public static event hook_FromVelocities FromVelocities { add { HookEndpointManager.Add<hook_FromVelocities>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_FromVelocities>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Evaluate Evaluate { add { HookEndpointManager.Add<hook_Evaluate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Evaluate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ToVertices_Vector3Array ToVertices_Vector3Array { add { HookEndpointManager.Add<hook_ToVertices_Vector3Array>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ToVertices_Vector3Array>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ToVertices_Vector3Array_int_int ToVertices_Vector3Array_int_int { add { HookEndpointManager.Add<hook_ToVertices_Vector3Array_int_int>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ToVertices_Vector3Array_int_int>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ApproximateLength ApproximateLength { add { HookEndpointManager.Add<hook_ApproximateLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ApproximateLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class CubicBezier3 { public static event Manipulator FromVelocities { add { HookEndpointManager.Modify<On.CubicBezier3.hook_FromVelocities>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CubicBezier3.hook_FromVelocities>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Evaluate { add { HookEndpointManager.Modify<On.CubicBezier3.hook_Evaluate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CubicBezier3.hook_Evaluate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ToVertices_Vector3Array { add { HookEndpointManager.Modify<On.CubicBezier3.hook_ToVertices_Vector3Array>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CubicBezier3.hook_ToVertices_Vector3Array>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ToVertices_Vector3Array_int_int { add { HookEndpointManager.Modify<On.CubicBezier3.hook_ToVertices_Vector3Array_int_int>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CubicBezier3.hook_ToVertices_Vector3Array_int_int>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ApproximateLength { add { HookEndpointManager.Modify<On.CubicBezier3.hook_ApproximateLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.CubicBezier3.hook_ApproximateLength>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class ElectricEffect { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(ElectricEffect self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, ElectricEffect self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Update(ElectricEffect self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Update(orig_Update orig, ElectricEffect self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(ElectricEffect self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, ElectricEffect self); public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Update Update { add { HookEndpointManager.Add<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class ElectricEffect { public static event Manipulator Start { add { HookEndpointManager.Modify<On.ElectricEffect.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.ElectricEffect.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator Update { add { HookEndpointManager.Modify<On.ElectricEffect.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.ElectricEffect.hook_Update>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.ElectricEffect.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.ElectricEffect.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class FocusedConvergenceAnimator { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(FocusedConvergenceAnimator self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, FocusedConvergenceAnimator self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_FixedUpdate(FocusedConvergenceAnimator self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_FixedUpdate(orig_FixedUpdate orig, FocusedConvergenceAnimator self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(FocusedConvergenceAnimator self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, FocusedConvergenceAnimator self); public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_FixedUpdate FixedUpdate { add { HookEndpointManager.Add<hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class FocusedConvergenceAnimator { public static event Manipulator Start { add { HookEndpointManager.Modify<On.FocusedConvergenceAnimator.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FocusedConvergenceAnimator.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator FixedUpdate { add { HookEndpointManager.Modify<On.FocusedConvergenceAnimator.hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FocusedConvergenceAnimator.hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.FocusedConvergenceAnimator.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.FocusedConvergenceAnimator.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class GrandparentEnergyFXController { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_FixedUpdate(GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_FixedUpdate(orig_FixedUpdate orig, GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_TurnOffFX(GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_TurnOffFX(orig_TurnOffFX orig, GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_TurnOnFX(GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_TurnOnFX(orig_TurnOnFX orig, GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(GrandparentEnergyFXController self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, GrandparentEnergyFXController self); public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_FixedUpdate FixedUpdate { add { HookEndpointManager.Add<hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_TurnOffFX TurnOffFX { add { HookEndpointManager.Add<hook_TurnOffFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_TurnOffFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_TurnOnFX TurnOnFX { add { HookEndpointManager.Add<hook_TurnOnFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_TurnOnFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_ctor ctor { add { HookEndpointManager.Add<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } } } namespace IL { public static class GrandparentEnergyFXController { public static event Manipulator Start { add { HookEndpointManager.Modify<On.GrandparentEnergyFXController.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.GrandparentEnergyFXController.hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator FixedUpdate { add { HookEndpointManager.Modify<On.GrandparentEnergyFXController.hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.GrandparentEnergyFXController.hook_FixedUpdate>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator TurnOffFX { add { HookEndpointManager.Modify<On.GrandparentEnergyFXController.hook_TurnOffFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.GrandparentEnergyFXController.hook_TurnOffFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator TurnOnFX { add { HookEndpointManager.Modify<On.GrandparentEnergyFXController.hook_TurnOnFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.GrandparentEnergyFXController.hook_TurnOnFX>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } public static event Manipulator ctor { add { HookEndpointManager.Modify<On.GrandparentEnergyFXController.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } remove { HookEndpointManager.Unmodify<On.GrandparentEnergyFXController.hook_ctor>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)(object)value); } } } } namespace On { public static class MaulingRock { [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnStartServer(MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnStartServer(orig_OnStartServer orig, MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_Start(MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_Start(orig_Start orig, MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_FixedUpdate(MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_FixedUpdate(orig_FixedUpdate orig, MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_ctor(MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_ctor(orig_ctor orig, MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_UNetVersion(MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_UNetVersion(orig_UNetVersion orig, MaulingRock self); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool orig_OnSerialize(MaulingRock self, NetworkWriter writer, bool forceAll); [EditorBrowsable(EditorBrowsableState.Never)] public delegate bool hook_OnSerialize(orig_OnSerialize orig, MaulingRock self, NetworkWriter writer, bool forceAll); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void orig_OnDeserialize(MaulingRock self, NetworkReader reader, bool initialState); [EditorBrowsable(EditorBrowsableState.Never)] public delegate void hook_OnDeserialize(orig_OnDeserialize orig, MaulingRock self, NetworkReader reader, bool initialState); public static event hook_OnStartServer OnStartServer { add { HookEndpointManager.Add<hook_OnStartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_OnStartServer>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } } public static event hook_Start Start { add { HookEndpointManager.Add<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value); } remove { HookEndpointManager.Remove<hook_Start>(MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), (Delegate)value);
BepinEx/plugins/RiskofThunder-R2API_Addressables/R2API.Addressables/R2API.Addressables.dll
Decompiled 11 months 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 System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HG.Reflection; using Microsoft.CodeAnalysis; using R2API.AutoVersionGen; using RoR2; using RoR2.ExpansionManagement; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Addressables")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("R2API.Addressables")] [assembly: AssemblyTitle("R2API.Addressables")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] [BepInPlugin("com.bepis.r2api.addressables", "R2API.Addressables", "1.0.3")] public sealed class AddressablesPlugin : BaseUnityPlugin { public const string PluginGUID = "com.bepis.r2api.addressables"; public const string PluginName = "R2API.Addressables"; public const string PluginVersion = "1.0.3"; internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.AddressReferencedAssets { [Serializable] public class AddressReferencedAsset<T> : AddressReferencedAsset where T : Object { [SerializeField] private T _asset; [SerializeField] private string _address; [SerializeField] [HideInInspector] private bool _useDirectReference; public T Asset { get { if (!Object.op_Implicit((Object)(object)_asset) && !AddressReferencedAsset.Initialized && CanLoadFromCatalog) { string name = GetType().Name; MethodBase method = new StackTrace().GetFrame(1).GetMethod(); AddressablesPlugin.Logger.LogWarning((object)($"Assembly {Assembly.GetCallingAssembly()} is trying to access an {name} before AddressReferencedAssets have initialized! This can cause issues as {name} can load the asset from Catalogs within the game." + "\n Consider using AddressReferencedAssets.OnAddressReferencedAssetsLoaded for running code that depends on AddressableAssets! (Method: " + method.DeclaringType.FullName + "." + method.Name + "()")); Load(); } else if (IsValidForLoadingWithAddress()) { LoadFromAddress(); } return _asset; } set { _asset = value; _address = (Object.op_Implicit((Object)(object)_asset) ? string.Empty : _address); _useDirectReference = Object.op_Implicit((Object)(object)_asset); } } public bool AssetExists => Object.op_Implicit((Object)(object)_asset); public string Address { get { return _address; } set { _address = value; _asset = default(T); _useDirectReference = false; if (RoR2Application.loadFinished) { Load(); } } } public bool IsInvalid { get { if (!Object.op_Implicit((Object)(object)_asset)) { if (!string.IsNullOrEmpty(_address)) { return string.IsNullOrWhiteSpace(_address); } return true; } return false; } } public bool UseDirectReference => _useDirectReference; public virtual bool CanLoadFromCatalog { get; } private bool IsValidForLoadingWithAddress() { if (!Object.op_Implicit((Object)(object)_asset)) { return !string.IsNullOrEmpty(_address); } return false; } protected sealed override async Task LoadAssetAsync() { if (IsValidForLoadingWithAddress()) { await LoadAsync(); } } protected virtual void Load() { LoadFromAddress(); } protected virtual async Task LoadAsync() { await LoadFromAddressAsync(); } protected async Task LoadFromAddressAsync() { _asset = await Addressables.LoadAssetAsync<T>((object)_address).Task; } protected void LoadFromAddress() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _asset = Addressables.LoadAssetAsync<T>((object)_address).WaitForCompletion(); } public static implicit operator bool(AddressReferencedAsset<T> addressReferencedAsset) { return Object.op_Implicit((Object)(object)((addressReferencedAsset != null) ? addressReferencedAsset.Asset : default(T))); } public static implicit operator T(AddressReferencedAsset<T> addressReferencedAsset) { if (addressReferencedAsset == null) { return default(T); } return addressReferencedAsset.Asset; } public static implicit operator AddressReferencedAsset<T>(string address) { return new AddressReferencedAsset<T>(address); } public static implicit operator AddressReferencedAsset<T>(T asset) { return new AddressReferencedAsset<T>(asset); } public AddressReferencedAsset(T asset) { SetHooks(); _asset = asset; _useDirectReference = true; AddressReferencedAsset.instances.Add(this); } public AddressReferencedAsset(string address) { SetHooks(); _address = address; _useDirectReference = false; AddressReferencedAsset.instances.Add(this); } public AddressReferencedAsset() { SetHooks(); AddressReferencedAsset.instances.Add(this); } ~AddressReferencedAsset() { AddressReferencedAsset.instances.Remove(this); if (AddressReferencedAsset.instances.Count == 0) { UnsetHooks(); } } } public abstract class AddressReferencedAsset { protected static readonly HashSet<AddressReferencedAsset> instances = new HashSet<AddressReferencedAsset>(); private static bool _initialized; public static bool Initialized => _initialized; public static event Action OnAddressReferencedAssetsLoaded; protected void SetHooks() { if (RoR2Application.loadFinished) { LoadReferencesAsync(); return; } RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(LoadReferencesAsync)); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LoadReferencesAsync)); } protected void UnsetHooks() { if (!RoR2Application.loadFinished) { RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(LoadReferencesAsync)); } } private static async void LoadReferencesAsync() { foreach (AddressReferencedAsset instance in instances) { try { await instance.LoadAssetAsync(); } catch (Exception ex) { AddressablesPlugin.Logger.LogError((object)ex); } } _initialized = true; AddressReferencedAsset.OnAddressReferencedAssetsLoaded?.Invoke(); } protected abstract Task LoadAssetAsync(); } [Serializable] public class AddressReferencedBuffDef : AddressReferencedAsset<BuffDef> { public override bool CanLoadFromCatalog => true; protected override async Task LoadAsync() { BuffIndex val = BuffCatalog.FindBuffIndex(base.Address); if ((int)val != -1) { base.Asset = BuffCatalog.GetBuffDef(val); } else { await LoadFromAddressAsync(); } } protected override void Load() { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffIndex val = BuffCatalog.FindBuffIndex(base.Address); if ((int)val != -1) { base.Asset = BuffCatalog.GetBuffDef(val); } else { LoadFromAddress(); } } public static implicit operator bool(AddressReferencedBuffDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator BuffDef(AddressReferencedBuffDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedBuffDef(string address) { return new AddressReferencedBuffDef(address); } public static implicit operator AddressReferencedBuffDef(BuffDef asset) { return new AddressReferencedBuffDef(asset); } public AddressReferencedBuffDef() { } public AddressReferencedBuffDef(BuffDef def) : base(def) { } public AddressReferencedBuffDef(string addressOrName) : base(addressOrName) { } } [Serializable] public class AddressReferencedEliteDef : AddressReferencedAsset<EliteDef> { public override bool CanLoadFromCatalog => true; protected override async Task LoadAsync() { EliteDef val = ((IEnumerable<EliteDef>)EliteCatalog.eliteDefs).FirstOrDefault((Func<EliteDef, bool>)((EliteDef x) => ((Object)x).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val != (Object)null) { base.Asset = val; } else { await LoadFromAddressAsync(); } } protected override void Load() { EliteDef val = ((IEnumerable<EliteDef>)EliteCatalog.eliteDefs).FirstOrDefault((Func<EliteDef, bool>)((EliteDef x) => ((Object)x).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val != (Object)null) { base.Asset = val; } else { LoadFromAddress(); } } public static implicit operator bool(AddressReferencedEliteDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator EliteDef(AddressReferencedEliteDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedEliteDef(string address) { return new AddressReferencedEliteDef(address); } public static implicit operator AddressReferencedEliteDef(EliteDef asset) { return new AddressReferencedEliteDef(asset); } public AddressReferencedEliteDef() { } public AddressReferencedEliteDef(EliteDef def) : base(def) { } public AddressReferencedEliteDef(string addressOrName) : base(addressOrName) { } } [Serializable] public class AddressReferencedEquipmentDef : AddressReferencedAsset<EquipmentDef> { public override bool CanLoadFromCatalog => true; protected override async Task LoadAsync() { EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(base.Address); if ((int)val != -1) { base.Asset = EquipmentCatalog.GetEquipmentDef(val); } else { await LoadFromAddressAsync(); } } protected override void Load() { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(base.Address); if ((int)val != -1) { base.Asset = EquipmentCatalog.GetEquipmentDef(val); } else { LoadFromAddress(); } } public static implicit operator bool(AddressReferencedEquipmentDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator EquipmentDef(AddressReferencedEquipmentDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedEquipmentDef(string address) { return new AddressReferencedEquipmentDef(address); } public static implicit operator AddressReferencedEquipmentDef(EquipmentDef asset) { return new AddressReferencedEquipmentDef(asset); } public AddressReferencedEquipmentDef() { } public AddressReferencedEquipmentDef(EquipmentDef def) : base(def) { } public AddressReferencedEquipmentDef(string addressOrName) : base(addressOrName) { } } [Serializable] public class AddressReferencedExpansionDef : AddressReferencedAsset<ExpansionDef> { public override bool CanLoadFromCatalog => true; protected override async Task LoadAsync() { ExpansionDef val = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef ed) => ((Object)ed).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val != (Object)null) { base.Asset = val; } await LoadFromAddressAsync(); } protected override void Load() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ExpansionDef val = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef ed) => ((Object)ed).name.Equals(base.Address, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val != (Object)null) { base.Asset = val; } LoadFromAddress(); } public static implicit operator bool(AddressReferencedExpansionDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator ExpansionDef(AddressReferencedExpansionDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedExpansionDef(string address) { return new AddressReferencedExpansionDef(address); } public static implicit operator AddressReferencedExpansionDef(ExpansionDef asset) { return new AddressReferencedExpansionDef(asset); } public AddressReferencedExpansionDef() { } public AddressReferencedExpansionDef(ExpansionDef def) : base(def) { } public AddressReferencedExpansionDef(string addressOrName) : base(addressOrName) { } } [Serializable] public class AddressReferencedItemDef : AddressReferencedAsset<ItemDef> { public override bool CanLoadFromCatalog => true; protected override async Task LoadAsync() { ItemIndex val = ItemCatalog.FindItemIndex(base.Address); if ((int)val != -1) { base.Asset = ItemCatalog.GetItemDef(val); } else { await LoadFromAddressAsync(); } } protected override void Load() { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(base.Address); if ((int)val != -1) { base.Asset = ItemCatalog.GetItemDef(val); } else { LoadFromAddress(); } } public static implicit operator bool(AddressReferencedItemDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator ItemDef(AddressReferencedItemDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedItemDef(string address) { return new AddressReferencedItemDef(address); } public static implicit operator AddressReferencedItemDef(ItemDef asset) { return new AddressReferencedItemDef(asset); } public AddressReferencedItemDef() { } public AddressReferencedItemDef(ItemDef def) : base(def) { } public AddressReferencedItemDef(string addressOrName) : base(addressOrName) { } } [Serializable] public class AddressReferencedPrefab : AddressReferencedAsset<GameObject> { public static implicit operator bool(AddressReferencedPrefab addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator GameObject(AddressReferencedPrefab addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedPrefab(string address) { return new AddressReferencedPrefab(address); } public static implicit operator AddressReferencedPrefab(GameObject asset) { return new AddressReferencedPrefab(asset); } public AddressReferencedPrefab() { } public AddressReferencedPrefab(GameObject gameObject) : base(gameObject) { } public AddressReferencedPrefab(string address) : base(address) { } } [Serializable] public class AddressReferencedSpawnCard : AddressReferencedAsset<SpawnCard> { public static implicit operator bool(AddressReferencedSpawnCard addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator SpawnCard(AddressReferencedSpawnCard addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedSpawnCard(string address) { return new AddressReferencedSpawnCard(address); } public static implicit operator AddressReferencedSpawnCard(SpawnCard asset) { return new AddressReferencedSpawnCard(asset); } public AddressReferencedSpawnCard() { } public AddressReferencedSpawnCard(SpawnCard spawnCard) : base(spawnCard) { } public AddressReferencedSpawnCard(string address) : base(address) { } } [Serializable] public class AddressReferencedUnlockableDef : AddressReferencedAsset<UnlockableDef> { protected override async Task LoadAsync() { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(base.Address); if (Object.op_Implicit((Object)(object)unlockableDef)) { base.Asset = unlockableDef; } else { await LoadFromAddressAsync(); } } protected override void Load() { UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(base.Address); if (Object.op_Implicit((Object)(object)unlockableDef)) { base.Asset = unlockableDef; } else { LoadFromAddress(); } } public static implicit operator bool(AddressReferencedUnlockableDef addressReferencedAsset) { return Object.op_Implicit((Object)(object)addressReferencedAsset?.Asset); } public static implicit operator UnlockableDef(AddressReferencedUnlockableDef addressReferencedAsset) { return addressReferencedAsset?.Asset; } public static implicit operator AddressReferencedUnlockableDef(string address) { return new AddressReferencedUnlockableDef(address); } public static implicit operator AddressReferencedUnlockableDef(UnlockableDef asset) { return new AddressReferencedUnlockableDef(asset); } public AddressReferencedUnlockableDef() { } public AddressReferencedUnlockableDef(UnlockableDef def) : base(def) { } public AddressReferencedUnlockableDef(string addressOrName) : base(addressOrName) { } } }
BepinEx/plugins/RiskofThunder-R2API_ArtifactCode/R2API.ArtifactCode/R2API.ArtifactCode.dll
Decompiled 11 months 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.Cryptography; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HG; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.AutoVersionGen; using R2API.ScriptableObjects; using RoR2; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.ArtifactCode")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.ArtifactCode")] [assembly: AssemblyTitle("R2API.ArtifactCode")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class ArtifactCodeAPI { public static class CompoundValues { public const int Empty = 11; public const int Square = 7; public const int Circle = 1; public const int Triangle = 3; public const int Diamond = 5; } [CompilerGenerated] private static class <>O { public static hook_OnStartClient <0>__AddCompounds; public static hook_Awake <1>__AddCodes; public static hook_PerformActionServer <2>__Print; } public const string PluginGUID = "com.bepis.r2api.artifactcode"; public const string PluginName = "R2API.ArtifactCode"; private static readonly List<(ArtifactDef, Sha256HashAsset)> artifactCodes = new List<(ArtifactDef, Sha256HashAsset)>(); private static readonly List<ArtifactCompoundDef> artifactCompounds = new List<ArtifactCompoundDef>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__AddCompounds; if (obj == null) { hook_OnStartClient val = AddCompounds; <>O.<0>__AddCompounds = val; obj = (object)val; } PortalDialerButtonController.OnStartClient += (hook_OnStartClient)obj; object obj2 = <>O.<1>__AddCodes; if (obj2 == null) { hook_Awake val2 = AddCodes; <>O.<1>__AddCodes = val2; obj2 = (object)val2; } PortalDialerController.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__Print; if (obj3 == null) { hook_PerformActionServer val3 = Print; <>O.<2>__Print = val3; obj3 = (object)val3; } PortalDialerController.PerformActionServer += (hook_PerformActionServer)obj3; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__AddCompounds; if (obj == null) { hook_OnStartClient val = AddCompounds; <>O.<0>__AddCompounds = val; obj = (object)val; } PortalDialerButtonController.OnStartClient -= (hook_OnStartClient)obj; object obj2 = <>O.<1>__AddCodes; if (obj2 == null) { hook_Awake val2 = AddCodes; <>O.<1>__AddCodes = val2; obj2 = (object)val2; } PortalDialerController.Awake -= (hook_Awake)obj2; object obj3 = <>O.<2>__Print; if (obj3 == null) { hook_PerformActionServer val3 = Print; <>O.<2>__Print = val3; obj3 = (object)val3; } PortalDialerController.PerformActionServer -= (hook_PerformActionServer)obj3; _hooksEnabled = false; } private static void AddCompounds(orig_OnStartClient orig, PortalDialerButtonController self) { foreach (ArtifactCompoundDef artifactCompound in artifactCompounds) { ArtifactCompoundDef current = artifactCompound; if (CheckForDuplicateCompoundValue(current, self.digitDefs)) { ArtifactCodePlugin.Logger.LogWarning((object)$"A compound with the value of {current.value} has already been added to the portal dialer button controller. Ignoring entry."); continue; } ArrayUtils.ArrayAppend<ArtifactCompoundDef>(ref self.digitDefs, ref current); ArtifactCodePlugin.Logger.LogInfo((object)$"Added compound to portal dialer button with value of {current.value}"); orig.Invoke(self); } } private static void AddCodes(orig_Awake orig, PortalDialerController self) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown PortalDialerController self2 = self; foreach (var artifactCode in artifactCodes) { var (artifactDef, val) = artifactCode; if ((int)artifactDef.artifactIndex == -1) { ArtifactCodePlugin.Logger.LogWarning((object)("ArtifactDef of name " + artifactDef.cachedName + " has an index of -1! ignoring entry.")); continue; } if (CheckIfCodeIsUsed(val, self2.actions)) { ArtifactCodePlugin.Logger.LogWarning((object)("A code with the values of " + ((Object)val).name + " has already been added to the portal dialer controller. ignoring entry.")); continue; } DialedAction val2 = default(DialedAction); val2.hashAsset = val; val2.action = new UnityEvent(); val2.action.AddListener(new UnityAction(Wrapper)); ArrayUtils.ArrayAppend<DialedAction>(ref self2.actions, ref val2); ArtifactCodePlugin.Logger.LogInfo((object)("Added code for " + artifactDef.cachedName)); void Wrapper() { self2.OpenArtifactPortalServer(artifactDef); } } orig.Invoke(self2); } private static bool Print(orig_PerformActionServer orig, PortalDialerController self, byte[] sequence) { //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) Sha256Hash result = self.GetResult(sequence); ArtifactCodePlugin.Logger.LogInfo((object)("Inputted Artifact Code:\n_00_07: " + result._00_07 + "\n_08_15: " + result._08_15 + "\n_16_23: " + result._16_23 + "\n_24_31: " + result._24_31)); return orig.Invoke(self, sequence); } private static bool CheckIfCodeIsUsed(Sha256HashAsset hashAsset, DialedAction[] dialedActions) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Sha256Hash hash = hashAsset.value; return dialedActions.Any((DialedAction dialedAction) => ((Sha256Hash)(ref dialedAction.hashAsset.value)).Equals(hash)); } private static bool CheckForDuplicateCompoundValue(ArtifactCompoundDef compoundDef, ArtifactCompoundDef[] compoundDefs) { ArtifactCompoundDef compoundDef2 = compoundDef; return compoundDefs.Any((ArtifactCompoundDef compound) => compound.value == compoundDef2.value); } public static void AddCode(ArtifactDef? artifactDef, Sha256HashAsset? sha256HashAsset) { SetHooks(); artifactCodes.Add((artifactDef, sha256HashAsset)); } public static void AddCode(ArtifactDef? artifactDef, ArtifactCode? artifactCode) { SetHooks(); artifactCode.Start(); artifactCodes.Add((artifactDef, artifactCode.hashAsset)); } public static void AddCode(ArtifactDef? artifactDef, ulong code_00_07, ulong code_08_15, ulong code_16_23, ulong code_24_31) { SetHooks(); Sha256HashAsset val = ScriptableObject.CreateInstance<Sha256HashAsset>(); val.value._00_07 = code_00_07; val.value._08_15 = code_08_15; val.value._16_23 = code_16_23; val.value._24_31 = code_24_31; artifactCodes.Add((artifactDef, val)); } public static void AddCode(ArtifactDef? artifactDef, IEnumerable<int> CompoundValues) { SetHooks(); ArtifactCode artifactCode = ScriptableObject.CreateInstance<ArtifactCode>(); artifactCode.ArtifactCompounds = (List<int>)CompoundValues; AddCode(artifactDef, artifactCode); } public static bool AddCompound(ArtifactCompoundDef artifactCompoundDef) { SetHooks(); artifactCompounds.Add(artifactCompoundDef); return true; } public static bool AddCompound(int compoundValue, Material compoundDecalMaterial, GameObject compoundModelPrefab) { SetHooks(); ArtifactCompoundDef obj = ScriptableObject.CreateInstance<ArtifactCompoundDef>(); obj.value = compoundValue; obj.decalMaterial = compoundDecalMaterial; obj.modelPrefab = compoundModelPrefab; return AddCompound(obj); } } [BepInPlugin("com.bepis.r2api.artifactcode", "R2API.ArtifactCode", "1.0.1")] public sealed class ArtifactCodePlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { ArtifactCodeAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.ScriptableObjects { [CreateAssetMenu(fileName = "ArtifactCode", menuName = "R2API/ArtifactCodeAPI/ArtifactCode", order = 0)] public class ArtifactCode : ScriptableObject { private const string constant = "For a list of accepted vanilla compound values, check ArtifactCodeAPI.CompoundValues"; [Header("For a list of accepted vanilla compound values, check ArtifactCodeAPI.CompoundValues")] [Tooltip("Compound values that represent the top 3 compounds.\nFor a list of accepted vanilla compound values, check ArtifactCodeAPI.CompoundValues")] public Vector3Int topRow; [Tooltip("Compound values that represent the middle 3 compounds.\nFor a list of accepted vanilla compound values, check ArtifactCodeAPI.CompoundValues")] public Vector3Int middleRow; [Tooltip("Compounds values that represent the bottom 3 compounds.\nFor a list of accepted vanilla compound values, check ArtifactCodeAPI.CompoundValues")] public Vector3Int bottomRow; [Obsolete("The artifact compounds list is obsolete, please use the topRow, middleRow and bottomRow Vector3Int.")] [HideInInspector] public List<int> ArtifactCompounds = new List<int>(); private int[] artifactSequence; private SHA256 hasher; [HideInInspector] public Sha256HashAsset hashAsset; internal void Start() { //IL_0066: 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) hasher = SHA256.Create(); if (ArtifactCompounds.Count > 0) { ArtifactCodePlugin.Logger.LogWarning((object)("Artifact Code of name " + ((Object)this).name + " is using the deprecated ArtifactCompounds list.")); artifactSequence = CreateSequenceFromList(); hashAsset = CreateHashAsset(CreateHash()); } else { artifactSequence = CreateSequenceFromVectors(); hashAsset = CreateHashAsset(CreateHash()); } } private int[] CreateSequenceFromList() { return new List<int> { ArtifactCompounds[2], ArtifactCompounds[5], ArtifactCompounds[8], ArtifactCompounds[1], ArtifactCompounds[7], ArtifactCompounds[4], ArtifactCompounds[0], ArtifactCompounds[3], ArtifactCompounds[6] }.ToArray(); } private int[] CreateSequenceFromVectors() { return new List<int> { ((Vector3Int)(ref topRow)).z, ((Vector3Int)(ref middleRow)).z, ((Vector3Int)(ref bottomRow)).z, ((Vector3Int)(ref topRow)).y, ((Vector3Int)(ref bottomRow)).y, ((Vector3Int)(ref middleRow)).y, ((Vector3Int)(ref topRow)).x, ((Vector3Int)(ref middleRow)).x, ((Vector3Int)(ref bottomRow)).x }.ToArray(); } private Sha256Hash CreateHash() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) byte[] array = new byte[artifactSequence.Length]; for (int i = 0; i < array.Length; i++) { array[i] = (byte)artifactSequence[i]; } return Sha256Hash.FromBytes(hasher.ComputeHash(array), 0); } private Sha256HashAsset CreateHashAsset(Sha256Hash hash) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Sha256HashAsset obj = ScriptableObject.CreateInstance<Sha256HashAsset>(); obj.value._00_07 = hash._00_07; obj.value._08_15 = hash._08_15; obj.value._16_23 = hash._16_23; obj.value._24_31 = hash._24_31; return obj; } } }
BepinEx/plugins/RiskofThunder-R2API_CommandHelper/R2API.CommandHelper/R2API.CommandHelper.dll
Decompiled 11 months 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.AutoVersionGen; using RoR2; using RoR2.ConVar; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.CommandHelper")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.CommandHelper")] [assembly: AssemblyTitle("R2API.CommandHelper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.Utils { [Obsolete("Add [assembly: HG.Reflection.SearchableAttribute.OptInAttribute] to your assembly instead")] [AutoVersion] public class CommandHelper { [CompilerGenerated] private static class <>O { public static hook_InitConVars <0>__ConsoleReady; } public const string PluginGUID = "com.bepis.r2api.commandhelper"; public const string PluginName = "R2API.CommandHelper"; private static readonly Queue<Assembly> Assemblies = new Queue<Assembly>(); private static Console _console; private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static void AddToConsoleWhenReady() { SetHooks(); Assembly callingAssembly = Assembly.GetCallingAssembly(); Assemblies.Enqueue(callingAssembly); HandleCommandsConvars(); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__ConsoleReady; if (obj == null) { hook_InitConVars val = ConsoleReady; <>O.<0>__ConsoleReady = val; obj = (object)val; } Console.InitConVars += (hook_InitConVars)obj; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__ConsoleReady; if (obj == null) { hook_InitConVars val = ConsoleReady; <>O.<0>__ConsoleReady = val; obj = (object)val; } Console.InitConVars -= (hook_InitConVars)obj; _hooksEnabled = false; } private static void ConsoleReady(orig_InitConVars orig, Console self) { orig.Invoke(self); _console = self; HandleCommandsConvars(); } private static void HandleCommandsConvars() { if (!((Object)(object)_console == (Object)null)) { while (Assemblies.Count > 0) { Assembly assembly = Assemblies.Dequeue(); RegisterCommands(assembly); RegisterConVars(assembly); } } } private static void RegisterCommands(Assembly assembly) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f2: Expected O, but got Unknown if (assembly == null) { return; } Type[] source = default(Type[]); Reflection.GetTypesSafe(assembly, ref source); try { Dictionary<string, ConCommand> concommandCatalog = _console.concommandCatalog; foreach (MethodInfo item in source.SelectMany((Type t) => from m in t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where ((MemberInfo)m).GetCustomAttribute<ConCommandAttribute>() != null select m)) { if (!item.IsStatic) { CommandHelperPlugin.Logger.LogError((object)("ConCommand defined as " + item.Name + " in " + assembly.FullName + " could not be registered. ConCommands must be static methods.")); continue; } foreach (ConCommandAttribute customAttribute in ((MemberInfo)item).GetCustomAttributes<ConCommandAttribute>()) { ConCommand value = new ConCommand { flags = customAttribute.flags, helpText = customAttribute.helpText, action = (ConCommandDelegate)Delegate.CreateDelegate(typeof(ConCommandDelegate), item) }; concommandCatalog[customAttribute.commandName.ToLower()] = value; } } } catch (Exception arg) { CommandHelperPlugin.Logger.LogError((object)string.Format("{0} failed to scan the assembly called {1}. Exception : {2}", "CommandHelper", assembly.FullName, arg)); } } private static void RegisterConVars(Assembly assembly) { //IL_011f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if (assembly == null) { return; } Type[] array = default(Type[]); Reflection.GetTypesSafe(assembly, ref array); try { List<BaseConVar> list = new List<BaseConVar>(); Type[] array2 = array; foreach (Type type in array2) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType.IsSubclassOf(typeof(BaseConVar))) { if (fieldInfo.IsStatic) { _console.RegisterConVarInternal((BaseConVar)fieldInfo.GetValue(null)); list.Add((BaseConVar)fieldInfo.GetValue(null)); } else if (type.GetCustomAttribute<CompilerGeneratedAttribute>() == null) { CommandHelperPlugin.Logger.LogError((object)("ConVar defined as " + type.Name + " in " + assembly.FullName + ". " + fieldInfo.Name + " could not be registered. ConVars must be static fields.")); } } } } foreach (BaseConVar item in list) { if ((item.flags & 0x10) != 0) { item.defaultValue = item.GetString(); } else if (item.defaultValue != null) { item.SetString(item.defaultValue); } } } catch (Exception arg) { CommandHelperPlugin.Logger.LogError((object)string.Format("{0} failed to scan the assembly called {1}. Exception : {2}", "CommandHelper", assembly.FullName, arg)); } } } [BepInPlugin("com.bepis.r2api.commandhelper", "R2API.CommandHelper", "1.0.1")] public sealed class CommandHelperPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { CommandHelper.UnsetHooks(); } } }
BepinEx/plugins/RiskofThunder-R2API_ContentManagement/R2API.ContentManagement/R2API.ContentManagement.dll
Decompiled 11 months agousing System; using System.Collections; 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.Bootstrap; using BepInEx.Logging; using EntityStates; using HG; using HG.Reflection; using Microsoft.CodeAnalysis; using On.RoR2.ContentManagement; using R2API.AutoVersionGen; using R2API.ContentManagement; using R2API.MiscHelpers; using R2API.ScriptableObjects; using R2API.Utils; using RoR2; using RoR2.Audio; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Networking; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("R2API.Items")] [assembly: InternalsVisibleTo("R2API.Elites")] [assembly: InternalsVisibleTo("R2API.Unlockable")] [assembly: InternalsVisibleTo("R2API.TempVisualEffect")] [assembly: InternalsVisibleTo("R2API.Loadout")] [assembly: InternalsVisibleTo("R2API.Sound")] [assembly: InternalsVisibleTo("R2API.Stages")] [assembly: InternalsVisibleTo("R2API.Prefab")] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.ContentManagement")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+1ae7204eca2526ad93f15cced92e9dc10e5ae1a4")] [assembly: AssemblyProduct("R2API.ContentManagement")] [assembly: AssemblyTitle("R2API.ContentManagement")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { public static class ContentAddition { public static bool AddBody(GameObject bodyPrefab) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<CharacterBody>()) { if (!HasComponent<CharacterBody>(bodyPrefab)) { RejectContent(bodyPrefab, callingAssembly, "BodyPrefab", "but it has no CharacterBody component!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)bodyPrefab); return true; } RejectContent(bodyPrefab, callingAssembly, "BodyPrefab", "but the BodyCatalog has already initialized!"); return false; } public static bool AddMaster(GameObject masterPrefab) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<CharacterMaster>()) { if (!HasComponent<CharacterMaster>(masterPrefab)) { RejectContent(masterPrefab, callingAssembly, "MasterPrefab", "but it has no CharacterMaster component!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)masterPrefab); return true; } RejectContent(masterPrefab, callingAssembly, "MasterPrefab", "but the MasterCatalog has already initialized!"); return false; } public static bool AddProjectile(GameObject projectilePrefab) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ProjectileController>()) { if (!HasComponent<ProjectileController>(projectilePrefab)) { RejectContent(projectilePrefab, callingAssembly, "ProjectilePrefab", "but it has no ProjectileController component!"); return false; } if (!Object.op_Implicit((Object)(object)projectilePrefab.GetComponent<ProjectileController>().ghostPrefab)) { ContentManagementPlugin.Logger.LogWarning((object)$"Projectile {projectilePrefab} has no ghost prefab assigned! is this intentional?"); } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)projectilePrefab); return true; } RejectContent(projectilePrefab, callingAssembly, "ProjectilePrefab", "but the ProjectileCatalog has already initialized!"); return false; } public static bool AddGameMode(GameObject gameModePrefab) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<Run>()) { if (!HasComponent<Run>(gameModePrefab)) { RejectContent(gameModePrefab, callingAssembly, "GameMode", "but it has no Run component!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)gameModePrefab); return true; } RejectContent(gameModePrefab, callingAssembly, "GameMode", "but the GameModeCatalog has already initialized!"); return false; } public static bool AddNetworkedObject(GameObject networkedObject) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<NetworkIdentity>()) { if (!HasComponent<NetworkIdentity>(networkedObject)) { RejectContent(networkedObject, callingAssembly, "NetworkedObject", "but it has no NetworkIdentity component!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)networkedObject); return true; } RejectContent(networkedObject, callingAssembly, "NetworkedObject", "but the GameNetworkManager has already networked all the prefabs!"); return false; } public static bool AddEffect(GameObject effectPrefab) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EffectComponent>()) { if (!HasComponent<EffectComponent>(effectPrefab)) { RejectContent(effectPrefab, callingAssembly, "EffectPrefab", "but it has no EffectComponent component!"); return false; } if (!HasComponent<VFXAttributes>(effectPrefab)) { ContentManagementPlugin.Logger.LogWarning((object)string.Format("Effect {0} has no {1} component! is this intentional?", effectPrefab, "VFXAttributes")); } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)effectPrefab); return true; } RejectContent(effectPrefab, callingAssembly, "EffectPrefab", "but the EffectCatalog has already initialized!"); return false; } public static bool AddSkillDef(SkillDef skillDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<SkillDef>()) { if (((SerializableEntityStateType)(ref skillDef.activationState)).stateType == null) { RejectContent(skillDef, callingAssembly, "SkillDef", "but it's activation state type is null!"); return false; } if (string.IsNullOrEmpty(skillDef.activationStateMachineName) || string.IsNullOrWhiteSpace(skillDef.activationStateMachineName)) { RejectContent(skillDef, callingAssembly, "SkillDef", "but it's activation state machine name is Null, Whitespace or Empty!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)skillDef); return true; } RejectContent(skillDef, callingAssembly, "SkillDef", "but the SkillCatalog has already initialized!"); return false; } public static bool AddSkillFamily(SkillFamily skillFamily) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<SkillFamily>()) { if (skillFamily.variants.Any((Variant v) => (Object)(object)v.skillDef == (Object)null)) { RejectContent(skillFamily, callingAssembly, "SkillFamily", "but one of it's variant's skillDefs is null!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)skillFamily); return true; } RejectContent(skillFamily, callingAssembly, "SkillFamily", "but the SkillCatalog has already initialized!"); return false; } public static bool AddSceneDef(SceneDef sceneDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<SceneDef>()) { ContentManagementPlugin.Logger.LogInfo((object)("Assembly " + callingAssembly.GetName().Name + " is trying to add a SceneDef, R2API does not support weaving of Scenes, Use RainOfStages instead for weaving SceneDefs.")); R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)sceneDef); return true; } RejectContent(sceneDef, callingAssembly, "SceneDef", "but the SceneCatalog has already initialized!"); return false; } public static bool AddItemDef(ItemDef itemDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ItemDef>()) { ContentManagementPlugin.Logger.LogInfo((object)(string.Format("Assembly {0} is adding an {1} via {2}.{3}()", callingAssembly.GetName().Name, itemDef, "ContentAddition", "AddItemDef") + "The assembly should ideally add them via ItemAPI so that they can use ItemAPI's IDRS systems, adding anyways.")); R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)itemDef); return true; } RejectContent(itemDef, callingAssembly, "ItemDef", "but the ItemCatalog has already initialized!"); return false; } public static bool AddItemTierDef(ItemTierDef itemTierDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ItemTierDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)itemTierDef); return true; } RejectContent(itemTierDef, callingAssembly, "ItemTierDef", "but the ItemTierCatalog has already initialized!"); return false; } public static bool AddItemRelationshipProvider(ItemRelationshipProvider itemRelationshipProvider) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ItemRelationshipProvider>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)itemRelationshipProvider); return true; } RejectContent(itemRelationshipProvider, callingAssembly, "ItemRelationshipProvider", "but the ItemCatalog has already initialized!"); return false; } public static bool AddItemRelationshipType(ItemRelationshipType itemRelationshipType) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ItemRelationshipType>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)itemRelationshipType); return true; } RejectContent(itemRelationshipType, callingAssembly, "ItemRelationshipType", "but the ItemCatalog has already initialized!"); return false; } public static bool AddEquipmentDef(EquipmentDef equipmentDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EquipmentDef>()) { ContentManagementPlugin.Logger.LogInfo((object)(string.Format("Assembly {0} is adding an {1} via {2}.{3}()", callingAssembly.GetName().Name, equipmentDef, "ContentAddition", "AddEquipmentDef") + "The assembly should ideally add them via ItemAPI so that they can use ItemAPI's IDRS systems, adding anyways.")); R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)equipmentDef); return true; } RejectContent(equipmentDef, callingAssembly, "EquipmentDef", "but the EquipmnetCatalog has already initialized!"); return false; } public static bool AddBuffDef(BuffDef buffDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<BuffDef>()) { if (Object.op_Implicit((Object)(object)buffDef.eliteDef) && Object.op_Implicit((Object)(object)buffDef.eliteDef.eliteEquipmentDef) && (Object)(object)buffDef.eliteDef.eliteEquipmentDef.passiveBuffDef != (Object)(object)buffDef) { ContentManagementPlugin.Logger.LogWarning((object)$"Assembly {callingAssembly.GetName().Name} is adding an {buffDef} which has an eliteDef assigned, but said eliteDef's equipmentDef's passiveBuffDef is not {buffDef}! is this intentional?"); } if (Object.op_Implicit((Object)(object)buffDef.startSfx) && (string.IsNullOrEmpty(buffDef.startSfx.eventName) || string.IsNullOrWhiteSpace(buffDef.startSfx.eventName))) { ContentManagementPlugin.Logger.LogWarning((object)$"Assembly {callingAssembly.GetName().Name} is adding an {buffDef} that has a startSFX, but the startSFX's NetworkedSoundEventDef's eventName is Null, Empty or Whitespace! is this intentional?"); } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)buffDef); return true; } RejectContent(buffDef, callingAssembly, "BuffDef", "but the BuffCatalog has already initialized!"); return false; } public static bool AddEliteDef(EliteDef eliteDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EliteDef>()) { ContentManagementPlugin.Logger.LogInfo((object)(string.Format("Assembly {0} is adding an {1} via {2}.{3}()", callingAssembly.GetName().Name, eliteDef, "ContentAddition", "AddEliteDef") + "The assembly should ideally add them via EliteAPI so that they can use EliteAPI's elite tier systems, adding anyways.")); R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)eliteDef); return true; } RejectContent(eliteDef, callingAssembly, "EliteDef", "but the EliteCatalog has already initialized!"); return false; } public static bool AddUnlockableDef(UnlockableDef unlockableDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<UnlockableDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)unlockableDef); return true; } RejectContent(unlockableDef, callingAssembly, "UnlockableDef", "but the UnlockableCatalog has already initialized"); return false; } public static bool AddSurvivorDef(SurvivorDef survivorDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<SurvivorDef>()) { if (!Object.op_Implicit((Object)(object)survivorDef.bodyPrefab)) { RejectContent(survivorDef, callingAssembly, "SurvivorDef", "but it's bodyPrefab is not assigned!"); return false; } if (!Object.op_Implicit((Object)(object)survivorDef.bodyPrefab.GetComponent<CharacterBody>())) { RejectContent(survivorDef, callingAssembly, "SurvivorDef", "but it's bodyPrefab does not have a CharacterBody component!"); return false; } if (!Object.op_Implicit((Object)(object)survivorDef.displayPrefab)) { ContentManagementPlugin.Logger.LogWarning((object)$"Assembly {callingAssembly.GetName().Name} is adding an {survivorDef} that does not have a displayPrefab! is this intentional?"); } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)survivorDef); return true; } RejectContent(survivorDef, callingAssembly, "SurvivorDef", "but the SurvivorCatalog has already initialized!"); return false; } public static bool AddArtifactDef(ArtifactDef artifactDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ArtifactDef>()) { if ((Object)(object)artifactDef.smallIconDeselectedSprite == (Object)null || (Object)(object)artifactDef.smallIconSelectedSprite == (Object)null) { RejectContent(artifactDef, callingAssembly, "ArtifactDef", "but one of it's icons are null! this is not allowed!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)artifactDef); return true; } RejectContent(artifactDef, callingAssembly, "ArtifactDef", "but the ArtifactCatalog has already initialized!"); return false; } public static bool AddSurfaceDef(SurfaceDef surfaceDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<SurfaceDef>()) { if ((Object)(object)surfaceDef.impactEffectPrefab == (Object)null || (Object)(object)surfaceDef.footstepEffectPrefab == (Object)null) { RejectContent(surfaceDef, callingAssembly, "SurfaceDef", "but one of it's effect prefabs are null! this is not allowed!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)surfaceDef); return true; } RejectContent(surfaceDef, callingAssembly, "SurfaceDef", "but the SurfaceDefCatalog has already initialized!"); return false; } public static bool AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<NetworkSoundEventDef>()) { if (string.IsNullOrEmpty(networkSoundEventDef.eventName) || string.IsNullOrWhiteSpace(networkSoundEventDef.eventName)) { RejectContent(networkSoundEventDef, callingAssembly, "NetworkSoundEventDef", "but it's eventName is Null, Empty or Whitespace!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)networkSoundEventDef); return true; } RejectContent(networkSoundEventDef, callingAssembly, "NetworkSoundEventDef", "but the NetworkSoundEventCatalog has already initialized!"); return false; } public static bool AddMusicTrackDef(MusicTrackDef musicTrackDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<MusicTrackDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)musicTrackDef); return true; } RejectContent(musicTrackDef, callingAssembly, "MusicTrackDef", "but the MusicTrackCatalog has already initialized!"); return false; } public static bool AddGameEndingDef(GameEndingDef gameEndingDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<GameEndingDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)gameEndingDef); return true; } RejectContent(gameEndingDef, callingAssembly, "GameEndingDef", "but the GameEndingCatalog has already initalized!"); return false; } public static bool AddEntityStateConfiguration(EntityStateConfiguration entityStateConfiguration) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EntityStateConfiguration>()) { Type type = Type.GetType(entityStateConfiguration.targetType.assemblyQualifiedName); if (!type.IsSubclassOf(typeof(EntityState))) { RejectContent(entityStateConfiguration, callingAssembly, "EntityStateConfiguration", "but it's targetType (" + type.Name + ") is not a type that derives from EntityState!"); return false; } if (type.IsAbstract) { RejectContent(entityStateConfiguration, callingAssembly, "EntityStateConfiguration", "but it's targetType (" + type.Name + ") is abstract!"); return false; } R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)entityStateConfiguration); return true; } RejectContent(entityStateConfiguration, callingAssembly, "EntityStateConfiguration", "but the EntityStateCatalog has already initialized!"); return false; } public static bool AddExpansionDef(ExpansionDef expansionDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<ExpansionDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)expansionDef); return true; } RejectContent(expansionDef, callingAssembly, "ExpansionDef", "But the ExpansionCatalog has already initialized!"); return false; } public static bool AddEntitlementDef(EntitlementDef entitlementDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EntitlementDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)entitlementDef); return true; } RejectContent(entitlementDef, callingAssembly, "EntitlementDef", "But the EntitlementCatalog has already initialized!"); return false; } public static bool AddMiscPickupDef(MiscPickupDef miscPickupDef) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<MiscPickupDef>()) { R2APIContentManager.HandleContentAddition(callingAssembly, (Object)(object)miscPickupDef); return true; } RejectContent(miscPickupDef, callingAssembly, "MiscPickupDef", "But the MiscPickupCatalog has already initailized!"); return false; } public static SerializableEntityStateType AddEntityState<T>(out bool wasAdded) where T : EntityState { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return AddEntityState(typeof(T), out wasAdded); } public static SerializableEntityStateType AddEntityState(Type entityStateType, out bool wasAdded) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Assembly callingAssembly = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability<EntityState>()) { if (entityStateType.IsAbstract) { RejectContent(entityStateType, callingAssembly, "EntityStateType", "but the entity state type is marked as abstract!"); wasAdded = false; return default(SerializableEntityStateType); } if (!typeof(EntityState).IsAssignableFrom(entityStateType)) { RejectContent(entityStateType, callingAssembly, "EntityStateType", "but the provided entity state type does not inherit from EntityState!"); wasAdded = false; return default(SerializableEntityStateType); } wasAdded = true; R2APIContentManager.HandleEntityState(callingAssembly, entityStateType); return new SerializableEntityStateType(entityStateType); } RejectContent(entityStateType, callingAssembly, "EntityStateType", "but the EntityStateCatalog has already initialized!"); wasAdded = false; return default(SerializableEntityStateType); } private static void RejectContent(object content, Assembly assembly, string contentType, string problem) { try { throw new InvalidOperationException($"Assembly {assembly.GetName().Name} is trying to add a {content} as a {contentType}, {problem}"); } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } private static bool HasComponent<T>(GameObject obj) where T : Component { return Object.op_Implicit((Object)(object)obj.GetComponent<T>()); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.ScriptableObjects { [CreateAssetMenu(fileName = "new R2APISerializableContentPack", menuName = "R2API/R2APISerializableContentPack", order = 0)] public class R2APISerializableContentPack : ScriptableObject { [Header("Prefabs")] [Tooltip("Prefabs with a CharacterBody component")] public GameObject[] bodyPrefabs = Array.Empty<GameObject>(); [Tooltip("Prefabs with a CharacterMaster component")] public GameObject[] masterPrefabs = Array.Empty<GameObject>(); [Tooltip("Prefabs with a ProjectileController component")] public GameObject[] projectilePrefabs = Array.Empty<GameObject>(); [Tooltip("Prefabs with a component that inherits from \"Run\"")] public GameObject[] gameModePrefabs = Array.Empty<GameObject>(); [Tooltip("Prefabs with an EffectComponent component")] public GameObject[] effectPrefabs = Array.Empty<GameObject>(); [Tooltip("Prefabs with a NetworkIdentity component that dont apply to the arrays above")] public GameObject[] networkedObjectPrefabs = Array.Empty<GameObject>(); [Space(5f)] [Header("Scriptable Objects")] public SkillDef[] skillDefs = Array.Empty<SkillDef>(); public SkillFamily[] skillFamilies = Array.Empty<SkillFamily>(); public SceneDef[] sceneDefs = Array.Empty<SceneDef>(); public ItemDef[] itemDefs = Array.Empty<ItemDef>(); public ItemTierDef[] itemTierDefs = Array.Empty<ItemTierDef>(); public ItemRelationshipProvider[] itemRelationshipProviders = Array.Empty<ItemRelationshipProvider>(); public ItemRelationshipType[] itemRelationshipTypes = Array.Empty<ItemRelationshipType>(); public EquipmentDef[] equipmentDefs = Array.Empty<EquipmentDef>(); public BuffDef[] buffDefs = Array.Empty<BuffDef>(); public EliteDef[] eliteDefs = Array.Empty<EliteDef>(); public UnlockableDef[] unlockableDefs = Array.Empty<UnlockableDef>(); public SurvivorDef[] survivorDefs = Array.Empty<SurvivorDef>(); public ArtifactDef[] artifactDefs = Array.Empty<ArtifactDef>(); public SurfaceDef[] surfaceDefs = Array.Empty<SurfaceDef>(); public NetworkSoundEventDef[] networkSoundEventDefs = Array.Empty<NetworkSoundEventDef>(); public MusicTrackDef[] musicTrackDefs = Array.Empty<MusicTrackDef>(); public GameEndingDef[] gameEndingDefs = Array.Empty<GameEndingDef>(); public MiscPickupDef[] miscPickupDefs = Array.Empty<MiscPickupDef>(); [Space(5f)] [Header("EntityState Related")] public EntityStateConfiguration[] entityStateConfigurations = Array.Empty<EntityStateConfiguration>(); [Tooltip("Types inheriting from EntityState")] public SerializableEntityStateType[] entityStateTypes = Array.Empty<SerializableEntityStateType>(); [Space(5f)] [Header("Expansion Related")] public ExpansionDef[] expansionDefs = Array.Empty<ExpansionDef>(); public EntitlementDef[] entitlementDefs = Array.Empty<EntitlementDef>(); private ContentPack contentPack; private ContentPack CreateContentPackPrivate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown EnsureNoFieldsAreNull(); ContentPack val = new ContentPack(); val.bodyPrefabs.Add(bodyPrefabs); val.masterPrefabs.Add(masterPrefabs); val.projectilePrefabs.Add(projectilePrefabs); val.gameModePrefabs.Add(gameModePrefabs); val.effectDefs.Add(((IEnumerable<GameObject>)effectPrefabs).Select((Func<GameObject, EffectDef>)((GameObject go) => new EffectDef(go))).ToArray()); val.networkedObjectPrefabs.Add(networkedObjectPrefabs); val.skillDefs.Add(skillDefs); val.skillFamilies.Add(skillFamilies); val.sceneDefs.Add(sceneDefs); val.itemDefs.Add(itemDefs); val.itemTierDefs.Add(itemTierDefs); val.itemRelationshipTypes.Add(itemRelationshipTypes); val.equipmentDefs.Add(equipmentDefs); val.buffDefs.Add(buffDefs); val.eliteDefs.Add(eliteDefs); val.unlockableDefs.Add(unlockableDefs); val.survivorDefs.Add(survivorDefs); val.artifactDefs.Add(artifactDefs); val.surfaceDefs.Add(surfaceDefs); val.networkSoundEventDefs.Add(networkSoundEventDefs); val.musicTrackDefs.Add(musicTrackDefs); val.gameEndingDefs.Add(gameEndingDefs); val.miscPickupDefs.Add(miscPickupDefs); val.entityStateConfigurations.Add(entityStateConfigurations); List<Type> list = new List<Type>(); for (int i = 0; i < entityStateTypes.Length; i++) { Type stateType = ((SerializableEntityStateType)(ref entityStateTypes[i])).stateType; if (stateType != null) { list.Add(stateType); continue; } Debug.LogWarning((object)("SerializableContentPack \"" + ((Object)this).name + "\" could not resolve type with name \"" + ((SerializableEntityStateType)(ref entityStateTypes[i])).typeName + "\". The type will not be available in the content pack.")); } val.entityStateTypes.Add(list.ToArray()); val.expansionDefs.Add(expansionDefs); val.entitlementDefs.Add(entitlementDefs); return val; } public ContentPack GetOrCreateContentPack() { if (contentPack != null) { return contentPack; } contentPack = CreateContentPackPrivate(); return contentPack; } private void EnsureNoFieldsAreNull() { RemoveNullFields<GameObject>(ref bodyPrefabs); RemoveNullFields<GameObject>(ref masterPrefabs); RemoveNullFields<GameObject>(ref projectilePrefabs); RemoveNullFields<GameObject>(ref gameModePrefabs); RemoveNullFields<GameObject>(ref effectPrefabs); RemoveNullFields<GameObject>(ref networkedObjectPrefabs); RemoveNullFields<SkillDef>(ref skillDefs); RemoveNullFields<SkillFamily>(ref skillFamilies); RemoveNullFields<SceneDef>(ref sceneDefs); RemoveNullFields<ItemDef>(ref itemDefs); RemoveNullFields<ItemTierDef>(ref itemTierDefs); RemoveNullFields<ItemRelationshipProvider>(ref itemRelationshipProviders); RemoveNullFields<ItemRelationshipType>(ref itemRelationshipTypes); RemoveNullFields<EquipmentDef>(ref equipmentDefs); RemoveNullFields<BuffDef>(ref buffDefs); RemoveNullFields<EliteDef>(ref eliteDefs); RemoveNullFields<UnlockableDef>(ref unlockableDefs); RemoveNullFields<SurvivorDef>(ref survivorDefs); RemoveNullFields<ArtifactDef>(ref artifactDefs); RemoveNullFields<SurfaceDef>(ref surfaceDefs); RemoveNullFields<NetworkSoundEventDef>(ref networkSoundEventDefs); RemoveNullFields<GameEndingDef>(ref gameEndingDefs); RemoveNullFields<MusicTrackDef>(ref musicTrackDefs); RemoveNullFields<MiscPickupDef>(ref miscPickupDefs); RemoveNullFields<EntityStateConfiguration>(ref entityStateConfigurations); RemoveNullFields<SerializableEntityStateType>(ref entityStateTypes); RemoveNullFields<ExpansionDef>(ref expansionDefs); RemoveNullFields<EntitlementDef>(ref entitlementDefs); static void RemoveNullFields<T>(ref T[] array) where T : notnull { IEnumerable<T> source = array.Where((T obj) => obj != null); array = source.ToArray(); } } } } namespace R2API.ContentManagement { internal static class CatalogBlockers { private static Dictionary<Type, bool> CanAddContentToCatalog = new Dictionary<Type, bool> { { typeof(CharacterBody), true }, { typeof(CharacterMaster), true }, { typeof(ProjectileController), true }, { typeof(Run), true }, { typeof(NetworkIdentity), true }, { typeof(EffectComponent), true }, { typeof(SkillDef), true }, { typeof(SkillFamily), true }, { typeof(SceneDef), true }, { typeof(ItemDef), true }, { typeof(ItemTierDef), true }, { typeof(ItemRelationshipProvider), true }, { typeof(ItemRelationshipType), true }, { typeof(EquipmentDef), true }, { typeof(BuffDef), true }, { typeof(EliteDef), true }, { typeof(UnlockableDef), true }, { typeof(SurvivorDef), true }, { typeof(ArtifactDef), true }, { typeof(SurfaceDef), true }, { typeof(NetworkSoundEventDef), true }, { typeof(MusicTrackDef), true }, { typeof(GameEndingDef), true }, { typeof(EntityStateConfiguration), true }, { typeof(EntityState), true }, { typeof(ExpansionDef), true }, { typeof(EntitlementDef), true }, { typeof(MiscPickupDef), true } }; internal static bool GetAvailability<T>() { Type typeFromHandle = typeof(T); if (CanAddContentToCatalog.ContainsKey(typeFromHandle)) { return CanAddContentToCatalog[typeFromHandle]; } return false; } private static void SetAvailability<T>(bool availability) { Type typeFromHandle = typeof(T); if (CanAddContentToCatalog.ContainsKey(typeFromHandle)) { CanAddContentToCatalog[typeFromHandle] = availability; } } [SystemInitializer(new Type[] { typeof(BodyCatalog) })] private static void BlockBodies() { SetAvailability<CharacterBody>(availability: false); } [SystemInitializer(new Type[] { typeof(MasterCatalog) })] private static void BlockMasters() { SetAvailability<CharacterMaster>(availability: false); } [SystemInitializer(new Type[] { typeof(ProjectileCatalog) })] private static void BlockProjectiles() { SetAvailability<ProjectileController>(availability: false); } [SystemInitializer(new Type[] { typeof(GameModeCatalog) })] private static void BlockGameModes() { SetAvailability<Run>(availability: false); } [SystemInitializer(new Type[] { typeof(NetworkManagerSystem) })] private static void BlockNetworkedPrefabs() { SetAvailability<NetworkIdentity>(availability: false); } [SystemInitializer(new Type[] { typeof(SkillCatalog) })] private static void BlockSkills() { SetAvailability<SkillDef>(availability: false); } [SystemInitializer(new Type[] { typeof(SkillCatalog) })] private static void BlockSkillFamilies() { SetAvailability<SkillFamily>(availability: false); } [SystemInitializer(new Type[] { typeof(SceneCatalog) })] private static void BlockScenes() { SetAvailability<SceneDef>(availability: false); } [SystemInitializer(new Type[] { typeof(ItemCatalog) })] private static void BlockItems() { SetAvailability<ItemDef>(availability: false); } [SystemInitializer(new Type[] { typeof(ItemTierCatalog) })] private static void BlockItemTiers() { SetAvailability<ItemTierDef>(availability: false); } [SystemInitializer(new Type[] { typeof(ItemCatalog) })] private static void BlockItemRelationshipProviders() { SetAvailability<ItemRelationshipProvider>(availability: false); } [SystemInitializer(new Type[] { typeof(ItemCatalog) })] private static void BlockItemRelationshipTypes() { SetAvailability<ItemRelationshipType>(availability: false); } [SystemInitializer(new Type[] { typeof(EquipmentCatalog) })] private static void BlockEquipments() { SetAvailability<EquipmentDef>(availability: false); } [SystemInitializer(new Type[] { typeof(BuffCatalog) })] private static void BlockBuffs() { SetAvailability<BuffDef>(availability: false); } [SystemInitializer(new Type[] { typeof(EliteCatalog) })] private static void BlockElites() { SetAvailability<EliteDef>(availability: false); } [SystemInitializer(new Type[] { typeof(UnlockableCatalog) })] private static void BlockUnlockables() { SetAvailability<UnlockableDef>(availability: false); } [SystemInitializer(new Type[] { typeof(SurvivorCatalog) })] private static void BlockSurvivors() { SetAvailability<SurvivorDef>(availability: false); } [SystemInitializer(new Type[] { typeof(ArtifactCatalog) })] private static void BlockArtifacts() { SetAvailability<ArtifactDef>(availability: false); } [SystemInitializer(new Type[] { typeof(EffectCatalog) })] private static void BlockEffects() { SetAvailability<EffectComponent>(availability: false); } [SystemInitializer(new Type[] { typeof(SurfaceDefCatalog) })] private static void BlockSurfaceDefs() { SetAvailability<SurfaceDef>(availability: false); } [SystemInitializer(new Type[] { typeof(NetworkSoundEventCatalog) })] private static void BlockNetworkSoundEvent() { SetAvailability<NetworkSoundEventDef>(availability: false); } [SystemInitializer(new Type[] { typeof(MusicTrackCatalog) })] private static void BlockMusicTracks() { SetAvailability<MusicTrackDef>(availability: false); } [SystemInitializer(new Type[] { typeof(GameEndingCatalog) })] private static void BlockGameEndings() { SetAvailability<GameEndingDef>(availability: false); } [SystemInitializer(new Type[] { typeof(EntityStateCatalog) })] private static void BlockEntityStateConfigurations() { SetAvailability<EntityStateConfiguration>(availability: false); } [SystemInitializer(new Type[] { typeof(ExpansionCatalog) })] private static void BlockExpansionDefs() { SetAvailability<ExpansionDef>(availability: false); } [SystemInitializer(new Type[] { typeof(EntitlementCatalog) })] private static void BlockEntitlementDefs() { SetAvailability<EntitlementDef>(availability: false); } [SystemInitializer(new Type[] { typeof(MiscPickupCatalog) })] private static void BlockMiscPickupDefs() { SetAvailability<MiscPickupDef>(availability: false); } [SystemInitializer(new Type[] { typeof(EntityStateCatalog) })] private static void BlockEntityStates() { SetAvailability<EntityState>(availability: false); } } [BepInPlugin("com.bepis.r2api.content_management", "R2API.ContentManagement", "1.0.3")] internal sealed class ContentManagementPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; R2APIContentPackProvider.Init(); } private void OnDestroy() { R2APIContentManager.UnsetHooks(); } } public struct ManagedSerializableContentPack { public R2APISerializableContentPack serializableContentPack; public bool AutoCreateIContentPackProvider { get; } public Assembly AssemblyThatCreatedContentPack { get; } internal ManagedSerializableContentPack(R2APISerializableContentPack serializableContentPack, bool autoCreateIContentPackProvider, Assembly assemblyThatCreatedContentPack) { this.serializableContentPack = serializableContentPack; AutoCreateIContentPackProvider = autoCreateIContentPackProvider; AssemblyThatCreatedContentPack = assemblyThatCreatedContentPack; } } public struct ManagedReadOnlyContentPack { internal ContentPack _contentPack; internal R2APIGenericContentPack contentPackProvider; public ReadOnlyContentPack ContentPack { get; } public string Identifier => _contentPack.identifier; public Assembly TiedAssembly { get; } public bool HasAutoCreatedIContentPackProvider { get; } internal ManagedReadOnlyContentPack(R2APISerializableContentPack scp, bool autoCreateIContentPackProvider, Assembly assemblyThatCreatedContentPack) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) _contentPack = scp.GetOrCreateContentPack(); _contentPack.identifier = ((Object)scp).name; ContentPack = new ReadOnlyContentPack(_contentPack); TiedAssembly = assemblyThatCreatedContentPack; if (autoCreateIContentPackProvider) { HasAutoCreatedIContentPackProvider = true; contentPackProvider = new R2APIGenericContentPack(_contentPack); } else { HasAutoCreatedIContentPackProvider = false; contentPackProvider = null; } } } [AutoVersion] public static class R2APIContentManager { [CompilerGenerated] private static class <>O { public static hook_SetContentPacks <0>__EnsureUniqueNames; } public const string PluginGUID = "com.bepis.r2api.content_management"; public const string PluginName = "R2API.ContentManagement"; private static ReadOnlyArray<ManagedReadOnlyContentPack> _managedContentPacks = ReadOnlyArray<ManagedReadOnlyContentPack>.op_Implicit((ManagedReadOnlyContentPack[])null); public static Action OnContentPacksCreated; private static bool _contentPacksCreated = false; private static readonly Dictionary<string, ManagedSerializableContentPack> BepInModNameToSerializableContentPack = new Dictionary<string, ManagedSerializableContentPack>(); private static readonly Dictionary<Assembly, string> AssemblyToBepInModName = new Dictionary<Assembly, string>(); private static readonly Dictionary<ContentPack, Assembly> ContentPackToAssembly = new Dictionary<ContentPack, Assembly>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.3"; public static bool Loaded => true; public static ReadOnlyArray<ManagedReadOnlyContentPack> ManagedContentPacks { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SetHooks(); if (!_contentPacksCreated) { ContentManagementPlugin.Logger.LogError((object)"Cannot return ContentPacks when they havent been created!"); return ReadOnlyArray<ManagedReadOnlyContentPack>.op_Implicit((ManagedReadOnlyContentPack[])null); } return _managedContentPacks; } } public static void AddPreExistingSerializableContentPack(R2APISerializableContentPack contentPack, bool createIContentPackProvider = true) { SetHooks(); try { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (!AssemblyToBepInModName.ContainsKey(callingAssembly)) { Type[] source = default(Type[]); Reflection.GetTypesSafe(callingAssembly, ref source); Type type = source.Where((Type t) => ((MemberInfo)t).GetCustomAttribute<BepInPlugin>() != null).FirstOrDefault(); if (type != null) { BepInPlugin customAttribute = ((MemberInfo)type).GetCustomAttribute<BepInPlugin>(); if (customAttribute != null) { AssemblyToBepInModName.Add(callingAssembly, customAttribute.Name); } } } if (AssemblyToBepInModName.TryGetValue(callingAssembly, out string value)) { ((Object)contentPack).name = value; if (!BepInModNameToSerializableContentPack.ContainsKey(value)) { BepInModNameToSerializableContentPack.Add(value, new ManagedSerializableContentPack(contentPack, createIContentPackProvider, callingAssembly)); ContentManagementPlugin.Logger.LogInfo((object)("Added Pre-Existing SerializableContentPack from mod " + value)); return; } throw new InvalidOperationException("The Mod " + value + " already has a Serializable Content Pack assigned to it!"); } throw new NullReferenceException($"The assembly {callingAssembly} does not have a class that has a BepInPlugin attribute! Cannot assign Serializable Content Pack for {value}!"); } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } public static R2APISerializableContentPack ReserveSerializableContentPack() { return GetOrCreateSerializableContentPack(Assembly.GetCallingAssembly()); } public static Assembly GetAssemblyFromContentPack(ContentPack contentPack) { SetHooks(); if (ContentPackToAssembly.TryGetValue(contentPack, out Assembly value)) { return value; } return null; } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__EnsureUniqueNames; if (obj == null) { hook_SetContentPacks val = EnsureUniqueNames; <>O.<0>__EnsureUniqueNames = val; obj = (object)val; } ContentManager.SetContentPacks += (hook_SetContentPacks)obj; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__EnsureUniqueNames; if (obj == null) { hook_SetContentPacks val = EnsureUniqueNames; <>O.<0>__EnsureUniqueNames = val; obj = (object)val; } ContentManager.SetContentPacks -= (hook_SetContentPacks)obj; _hooksEnabled = false; } private static void EnsureUniqueNames(orig_SetContentPacks orig, List<ReadOnlyContentPack> newContentPacks) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (newContentPacks.Count > 1) { IEnumerable<PropertyInfo> allAssetCollectionPropertiesOfAReadOnlyContentPack = GetAllAssetCollectionPropertiesOfAReadOnlyContentPack(); for (int i = 0; i < newContentPacks.Count - 1; i++) { for (int j = i + 1; j < newContentPacks.Count; j++) { ReadOnlyContentPack val = newContentPacks[i]; ReadOnlyContentPack val2 = newContentPacks[j]; bool isFirstContentPackVanilla = val.IsVanillaContentPack(); bool isSecondContentPackVanilla = val2.IsVanillaContentPack(); foreach (PropertyInfo item in allAssetCollectionPropertiesOfAReadOnlyContentPack) { IEnumerable<Object> enumerable = ((IEnumerable)item.GetValue(val)).Cast<Object>(); IEnumerable<Object> enumerable2 = ((IEnumerable)item.GetValue(val2)).Cast<Object>(); int firstAssetIndex = 0; foreach (Object item2 in enumerable) { int secondAssetIndex = 0; foreach (Object item3 in enumerable2) { if (item2 != item3) { ChangeAssetNameIfNeeded(val, item2, ref firstAssetIndex, val2, item3, ref secondAssetIndex, isFirstContentPackVanilla, isSecondContentPackVanilla); } else { ContentManagementPlugin.Logger.LogError((object)$"The exact same asset {item2} is being added by two different content packs : {((ReadOnlyContentPack)(ref val)).identifier} and {((ReadOnlyContentPack)(ref val2)).identifier}"); } } } } } } } orig.Invoke(newContentPacks); } private static void ChangeAssetNameIfNeeded(ReadOnlyContentPack firstContentPack, Object firstAsset, ref int firstAssetIndex, ReadOnlyContentPack secondContentPack, Object secondAsset, ref int secondAssetIndex, bool isFirstContentPackVanilla, bool isSecondContentPackVanilla) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (firstAsset.name.Equals(secondAsset.name, StringComparison.InvariantCulture)) { if (isFirstContentPackVanilla) { ChangeAssetName(secondContentPack, ref secondAssetIndex, secondAsset, firstContentPack); } else if (isSecondContentPackVanilla) { ChangeAssetName(firstContentPack, ref firstAssetIndex, firstAsset, secondContentPack); } } } private static bool IsVanillaContentPack(this ReadOnlyContentPack contentPack) { return ((ReadOnlyContentPack)(ref contentPack)).identifier.StartsWith("RoR2."); } private static void ChangeAssetName(ReadOnlyContentPack changingContentPack, ref int assetIndex, Object changingAsset, ReadOnlyContentPack notChangingContentPack) { string text = $"{((ReadOnlyContentPack)(ref changingContentPack)).identifier}_{changingAsset.name}_{assetIndex++}"; ContentManagementPlugin.Logger.LogWarning((object)("Asset name from " + ((ReadOnlyContentPack)(ref changingContentPack)).identifier + " is conflicting with " + ((ReadOnlyContentPack)(ref notChangingContentPack)).identifier + ". Old name : " + changingAsset.name + ", new name : " + text)); changingAsset.name = text; } private static IEnumerable<PropertyInfo> GetAllAssetCollectionPropertiesOfAReadOnlyContentPack() { return from p in typeof(ReadOnlyContentPack).GetProperties((BindingFlags)(-1)) where p.PropertyType.GenericTypeArguments.Length != 0 && (p.PropertyType.GenericTypeArguments[0].IsSubclassOf(typeof(Object)) || typeof(Object) == p.PropertyType.GenericTypeArguments[0]) select p; } internal static void HandleContentAddition(Assembly assembly, Object content) { SetHooks(); R2APISerializableContentPack orCreateSerializableContentPack = GetOrCreateSerializableContentPack(assembly); if (!Object.op_Implicit((Object)(object)orCreateSerializableContentPack)) { return; } try { bool flag = false; GameObject val = (GameObject)(object)((content is GameObject) ? content : null); if (val == null) { SkillDef val2 = (SkillDef)(object)((content is SkillDef) ? content : null); if (val2 == null) { SkillFamily val3 = (SkillFamily)(object)((content is SkillFamily) ? content : null); if (val3 == null) { SceneDef val4 = (SceneDef)(object)((content is SceneDef) ? content : null); if (val4 == null) { ItemDef val5 = (ItemDef)(object)((content is ItemDef) ? content : null); if (val5 == null) { ItemTierDef val6 = (ItemTierDef)(object)((content is ItemTierDef) ? content : null); if (val6 == null) { ItemRelationshipProvider val7 = (ItemRelationshipProvider)(object)((content is ItemRelationshipProvider) ? content : null); if (val7 == null) { ItemRelationshipType val8 = (ItemRelationshipType)(object)((content is ItemRelationshipType) ? content : null); if (val8 == null) { EquipmentDef val9 = (EquipmentDef)(object)((content is EquipmentDef) ? content : null); if (val9 == null) { BuffDef val10 = (BuffDef)(object)((content is BuffDef) ? content : null); if (val10 == null) { EliteDef val11 = (EliteDef)(object)((content is EliteDef) ? content : null); if (val11 == null) { UnlockableDef val12 = (UnlockableDef)(object)((content is UnlockableDef) ? content : null); if (val12 == null) { SurvivorDef val13 = (SurvivorDef)(object)((content is SurvivorDef) ? content : null); if (val13 == null) { ArtifactDef val14 = (ArtifactDef)(object)((content is ArtifactDef) ? content : null); if (val14 == null) { SurfaceDef val15 = (SurfaceDef)(object)((content is SurfaceDef) ? content : null); if (val15 == null) { NetworkSoundEventDef val16 = (NetworkSoundEventDef)(object)((content is NetworkSoundEventDef) ? content : null); if (val16 == null) { MusicTrackDef val17 = (MusicTrackDef)(object)((content is MusicTrackDef) ? content : null); if (val17 == null) { GameEndingDef val18 = (GameEndingDef)(object)((content is GameEndingDef) ? content : null); if (val18 == null) { EntityStateConfiguration val19 = (EntityStateConfiguration)(object)((content is EntityStateConfiguration) ? content : null); if (val19 == null) { ExpansionDef val20 = (ExpansionDef)(object)((content is ExpansionDef) ? content : null); if (val20 == null) { EntitlementDef val21 = (EntitlementDef)(object)((content is EntitlementDef) ? content : null); if (val21 == null) { MiscPickupDef val22 = (MiscPickupDef)(object)((content is MiscPickupDef) ? content : null); if (val22 != null) { AddSafe<MiscPickupDef>(ref orCreateSerializableContentPack.miscPickupDefs, val22, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<EntitlementDef>(ref orCreateSerializableContentPack.entitlementDefs, val21, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ExpansionDef>(ref orCreateSerializableContentPack.expansionDefs, val20, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<EntityStateConfiguration>(ref orCreateSerializableContentPack.entityStateConfigurations, val19, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<GameEndingDef>(ref orCreateSerializableContentPack.gameEndingDefs, val18, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<MusicTrackDef>(ref orCreateSerializableContentPack.musicTrackDefs, val17, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<NetworkSoundEventDef>(ref orCreateSerializableContentPack.networkSoundEventDefs, val16, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<SurfaceDef>(ref orCreateSerializableContentPack.surfaceDefs, val15, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ArtifactDef>(ref orCreateSerializableContentPack.artifactDefs, val14, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<SurvivorDef>(ref orCreateSerializableContentPack.survivorDefs, val13, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<UnlockableDef>(ref orCreateSerializableContentPack.unlockableDefs, val12, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<EliteDef>(ref orCreateSerializableContentPack.eliteDefs, val11, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<BuffDef>(ref orCreateSerializableContentPack.buffDefs, val10, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<EquipmentDef>(ref orCreateSerializableContentPack.equipmentDefs, val9, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ItemRelationshipType>(ref orCreateSerializableContentPack.itemRelationshipTypes, val8, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ItemRelationshipProvider>(ref orCreateSerializableContentPack.itemRelationshipProviders, val7, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ItemTierDef>(ref orCreateSerializableContentPack.itemTierDefs, val6, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<ItemDef>(ref orCreateSerializableContentPack.itemDefs, val5, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<SceneDef>(ref orCreateSerializableContentPack.sceneDefs, val4, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<SkillFamily>(ref orCreateSerializableContentPack.skillFamilies, val3, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { AddSafe<SkillDef>(ref orCreateSerializableContentPack.skillDefs, val2, ((Object)orCreateSerializableContentPack).name); flag = true; } } else { HandleGameObject(val, orCreateSerializableContentPack); flag = true; } if (!flag) { throw new ArgumentException($"The content {content.name} ({((object)content).GetType()}) is not supported by the ContentManager! \n" + "If you think this is an Error and it should be supported, please file a bug report."); } } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } internal static void HandleEntityState(Assembly assembly, Type type) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) SetHooks(); R2APISerializableContentPack orCreateSerializableContentPack = GetOrCreateSerializableContentPack(assembly); if (Object.op_Implicit((Object)(object)orCreateSerializableContentPack)) { AddSafeType(ref orCreateSerializableContentPack.entityStateTypes, new SerializableEntityStateType(type), ((Object)orCreateSerializableContentPack).name); } } private static void HandleGameObject(GameObject go, R2APISerializableContentPack scp) { try { bool flag = false; bool flag2 = false; if (Object.op_Implicit((Object)(object)go.GetComponent<CharacterBody>())) { AddSafe<GameObject>(ref scp.bodyPrefabs, go, ((Object)scp).name); flag = true; flag2 = true; } if (Object.op_Implicit((Object)(object)go.GetComponent<CharacterMaster>())) { AddSafe<GameObject>(ref scp.masterPrefabs, go, ((Object)scp).name); flag = true; flag2 = true; } if (Object.op_Implicit((Object)(object)go.GetComponent<ProjectileController>())) { AddSafe<GameObject>(ref scp.projectilePrefabs, go, ((Object)scp).name); flag = true; flag2 = true; } if (Object.op_Implicit((Object)(object)go.GetComponent<Run>())) { AddSafe<GameObject>(ref scp.gameModePrefabs, go, ((Object)scp).name); flag = true; flag2 = true; } if (!flag && Object.op_Implicit((Object)(object)go.GetComponent<NetworkIdentity>())) { AddSafe<GameObject>(ref scp.networkedObjectPrefabs, go, ((Object)scp).name); flag2 = true; } if (Object.op_Implicit((Object)(object)go.GetComponent<EffectComponent>())) { AddSafe<GameObject>(ref scp.effectPrefabs, go, ((Object)scp).name); flag2 = true; } if (!flag2) { throw new ArgumentException($"The GameObject {((Object)go).name} ({((object)go).GetType()}) does not have any components that are supported by the ContentManager! \n" + "If you think this is an Error and it should be supported, please file a bug report."); } } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } internal static void CreateContentPacks() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!_contentPacksCreated) { ContentManagementPlugin.Logger.LogInfo((object)$"Generating a total of {BepInModNameToSerializableContentPack.Values.Count} ContentPacks..."); List<ManagedReadOnlyContentPack> list = new List<ManagedReadOnlyContentPack>(); string text = default(string); ManagedSerializableContentPack managedSerializableContentPack = default(ManagedSerializableContentPack); foreach (KeyValuePair<string, ManagedSerializableContentPack> item in BepInModNameToSerializableContentPack) { KeyValuePairExtensions.Deconstruct<string, ManagedSerializableContentPack>(item, ref text, ref managedSerializableContentPack); ManagedSerializableContentPack managedSerializableContentPack2 = managedSerializableContentPack; list.Add(new ManagedReadOnlyContentPack(managedSerializableContentPack2.serializableContentPack, managedSerializableContentPack2.AutoCreateIContentPackProvider, managedSerializableContentPack2.AssemblyThatCreatedContentPack)); ContentPackToAssembly.Add(managedSerializableContentPack2.serializableContentPack.GetOrCreateContentPack(), managedSerializableContentPack2.AssemblyThatCreatedContentPack); } _contentPacksCreated = true; _managedContentPacks = new ReadOnlyArray<ManagedReadOnlyContentPack>(list.ToArray()); if (OnContentPacksCreated == null) { return; } Delegate[] invocationList = OnContentPacksCreated.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action action = (Action)invocationList[i]; try { action(); } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } return; } throw new InvalidOperationException("The Content Pack collection has already been created!"); } internal static R2APISerializableContentPack GetOrCreateSerializableContentPack(Assembly assembly) { if (!AssemblyToBepInModName.TryGetValue(assembly, out string value)) { string location = assembly.Location; value = Chainloader.PluginInfos.FirstOrDefault((KeyValuePair<string, PluginInfo> x) => location == x.Value.Location).Key; if (value == null) { ContentManagementPlugin.Logger.LogWarning((object)("The assembly " + assembly.FullName + " is not a loaded BepInEx plugin, falling back to looking for attribute in assembly")); try { Type[] source = default(Type[]); Reflection.GetTypesSafe(assembly, ref source); value = source.Select((Type x) => ((MemberInfo)x).GetCustomAttribute<BepInPlugin>()).First((BepInPlugin x) => x != null).GUID; } catch { ContentManagementPlugin.Logger.LogWarning((object)"Assembly did not have a BepInPlugin attribute or couldn't load its types, falling back to assembly name"); value = assembly.GetName().Name; } } AssemblyToBepInModName[assembly] = value; } if (!BepInModNameToSerializableContentPack.ContainsKey(value)) { R2APISerializableContentPack r2APISerializableContentPack = ScriptableObject.CreateInstance<R2APISerializableContentPack>(); ((Object)r2APISerializableContentPack).name = value; BepInModNameToSerializableContentPack.Add(value, new ManagedSerializableContentPack(r2APISerializableContentPack, autoCreateIContentPackProvider: true, assembly)); ContentManagementPlugin.Logger.LogInfo((object)("Created a SerializableContentPack for mod " + value)); } return BepInModNameToSerializableContentPack[value].serializableContentPack; } private static void AddSafe<T>(ref T[] assetArray, T asset, string identifier) where T : Object { if (!assetArray.Contains(asset)) { ArrayUtils.ArrayAppend<T>(ref assetArray, ref asset); } else { ContentManagementPlugin.Logger.LogWarning((object)$"Cannot add {asset} to content pack {identifier} because the asset has already been added to it's corresponding array!"); } } private static void AddSafeType<T>(ref T[] assetArray, T asset, string identifier) { if (!assetArray.Contains(asset)) { ArrayUtils.ArrayAppend<T>(ref assetArray, ref asset); } else { ContentManagementPlugin.Logger.LogWarning((object)$"Cannot add {asset} to content pack {identifier} because the asset has already been added to it's corresponding array!"); } } } internal class R2APIGenericContentPack : IContentPackProvider { private ContentPack contentPack; private bool logged; public string identifier => contentPack.identifier; internal R2APIGenericContentPack(ContentPack finalizedContentPack) { contentPack = finalizedContentPack; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { LogContentsFromContentPack(); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { args.ReportProgress(1f); yield break; } private void LogContentsFromContentPack() { if (!logged) { logged = true; List<string> list = new List<string>(); list.Add("Content added from " + contentPack.identifier + ":"); list.AddRange(contentPack.bodyPrefabs.assetInfos.Select((AssetInfo<GameObject> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.masterPrefabs.assetInfos.Select((AssetInfo<GameObject> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.projectilePrefabs.assetInfos.Select((AssetInfo<GameObject> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.gameModePrefabs.assetInfos.Select((AssetInfo<GameObject> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.networkedObjectPrefabs.assetInfos.Select((AssetInfo<GameObject> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.skillDefs.assetInfos.Select((AssetInfo<SkillDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.skillFamilies.assetInfos.Select((AssetInfo<SkillFamily> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.sceneDefs.assetInfos.Select((AssetInfo<SceneDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.itemDefs.assetInfos.Select((AssetInfo<ItemDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.itemTierDefs.assetInfos.Select((AssetInfo<ItemTierDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.itemRelationshipProviders.assetInfos.Select((AssetInfo<ItemRelationshipProvider> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.itemRelationshipTypes.assetInfos.Select((AssetInfo<ItemRelationshipType> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.equipmentDefs.assetInfos.Select((AssetInfo<EquipmentDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.buffDefs.assetInfos.Select((AssetInfo<BuffDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.eliteDefs.assetInfos.Select((AssetInfo<EliteDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.unlockableDefs.assetInfos.Select((AssetInfo<UnlockableDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.survivorDefs.assetInfos.Select((AssetInfo<SurvivorDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.artifactDefs.assetInfos.Select((AssetInfo<ArtifactDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.effectDefs.assetInfos.Select((AssetInfo<EffectDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.surfaceDefs.assetInfos.Select((AssetInfo<SurfaceDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.networkSoundEventDefs.assetInfos.Select((AssetInfo<NetworkSoundEventDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.musicTrackDefs.assetInfos.Select((AssetInfo<MusicTrackDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.gameEndingDefs.assetInfos.Select((AssetInfo<GameEndingDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.entityStateConfigurations.assetInfos.Select((AssetInfo<EntityStateConfiguration> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.entityStateTypes.assetInfos.Select((AssetInfo<Type> ai) => ai.assetName + " (" + ai.asset.GetType().Name + ")")); list.AddRange(contentPack.expansionDefs.assetInfos.Select((AssetInfo<ExpansionDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.entitlementDefs.assetInfos.Select((AssetInfo<EntitlementDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); list.AddRange(contentPack.miscPickupDefs.assetInfos.Select((AssetInfo<MiscPickupDef> ai) => ai.assetName + " (" + ((object)ai.asset).GetType().Name + ")")); ContentManagementPlugin.Logger.LogDebug((object)string.Join("\n", list)); } } } internal class R2APIContentPackProvider { [CompilerGenerated] private static class <>O { public static CollectContentPackProvidersDelegate <0>__AddCustomContent; } internal static Action WhenAddingContentPacks; internal static void Init() { //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>__AddCustomContent; if (obj == null) { CollectContentPackProvidersDelegate val = AddCustomContent; <>O.<0>__AddCustomContent = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } private static void AddCustomContent(AddContentPackProviderDelegate addContentPackProvider) { //IL_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (WhenAddingContentPacks != null) { Delegate[] invocationList = WhenAddingContentPacks.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action action = (Action)invocationList[i]; try { action(); } catch (Exception ex) { ContentManagementPlugin.Logger.LogError((object)ex); } } } R2APIContentManager.CreateContentPacks(); Enumerator<ManagedReadOnlyContentPack> enumerator = R2APIContentManager.ManagedContentPacks.GetEnumerator(); try { while (enumerator.MoveNext()) { ManagedReadOnlyContentPack current = enumerator.Current; if (current.HasAutoCreatedIContentPackProvider) { try { addContentPackProvider.Invoke((IContentPackProvider)(object)current.contentPackProvider); } catch (Exception ex2) { ContentManagementPlugin.Logger.LogError((object)ex2); } } } } finally { ((IDisposable)enumerator).Dispose(); } } } }
BepinEx/plugins/RiskofThunder-R2API_Core/R2API.Core/R2API.Core.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HG.Reflection; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.Utils; using On.RoR2; using R2API.AutoVersionGen; using R2API.Utils; using RoR2; using RoR2.Networking; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: InternalsVisibleTo("R2API.Items")] [assembly: InternalsVisibleTo("R2API.ContentManagement")] [assembly: InternalsVisibleTo("R2API.ArtifactCode")] [assembly: InternalsVisibleTo("R2API.Difficulty")] [assembly: InternalsVisibleTo("R2API.Elites")] [assembly: InternalsVisibleTo("R2API.RecalculateStats")] [assembly: InternalsVisibleTo("R2API.Prefab")] [assembly: InternalsVisibleTo("R2API.Language")] [assembly: InternalsVisibleTo("R2API.Unlockable")] [assembly: InternalsVisibleTo("R2API.TempVisualEffect")] [assembly: InternalsVisibleTo("R2API.SceneAsset")] [assembly: InternalsVisibleTo("R2API.Orb")] [assembly: InternalsVisibleTo("R2API.Loadout")] [assembly: InternalsVisibleTo("R2API.Dot")] [assembly: InternalsVisibleTo("R2API.DamageType")] [assembly: InternalsVisibleTo("R2API.Sound")] [assembly: InternalsVisibleTo("R2API.Director")] [assembly: InternalsVisibleTo("R2API.Deployable")] [assembly: InternalsVisibleTo("R2API.LobbyConfig")] [assembly: InternalsVisibleTo("R2API.Networking")] [assembly: InternalsVisibleTo("R2API.CommandHelper")] [assembly: InternalsVisibleTo("R2API.Colors")] [assembly: InternalsVisibleTo("R2API.Rules")] [assembly: InternalsVisibleTo("R2API.Skins")] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Core")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("5.0.11.0")] [assembly: AssemblyInformationalVersion("5.0.11")] [assembly: AssemblyProduct("R2API.Core")] [assembly: AssemblyTitle("R2API.Core")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("5.0.11.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NativeIntegerAttribute : Attribute { public readonly bool[] TransformFlags; public NativeIntegerAttribute() { TransformFlags = new bool[1] { true }; } public NativeIntegerAttribute(bool[] P_0) { TransformFlags = 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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { public class Notification : MonoBehaviour { public GameObject? RootObject { get; set; } public GenericNotification? GenericNotification { get; set; } public Func<string>? GetTitle { get; set; } public Func<string>? GetDescription { get; set; } public Transform? Parent { get; set; } private void Awake() { Parent = ((Component)RoR2Application.instance.mainCanvas).transform; RootObject = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/NotificationPanel2")); GenericNotification = RootObject.GetComponent<GenericNotification>(); ((Component)GenericNotification).transform.SetParent(Parent); ((Behaviour)GenericNotification.iconImage).enabled = false; } private void Update() { if ((Object)(object)GenericNotification == (Object)null) { Object.Destroy((Object)(object)this); return; } GenericNotification.titleText.SetFieldValue("resolvedString", GetTitle()); GenericNotification.titleText.InvokeMethod("UpdateLabel"); GenericNotification.descriptionText.SetFieldValue("resolvedString", GetDescription()); GenericNotification.descriptionText.InvokeMethod("UpdateLabel"); } private void OnDestroy() { Object.Destroy((Object)(object)GenericNotification); Object.Destroy((Object)(object)RootObject); } public void SetIcon(Texture? texture) { ((Behaviour)GenericNotification.iconImage).enabled = true; GenericNotification.iconImage.texture = texture; } public void SetPosition(Vector3 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) RootObject.transform.position = position; } } [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.*/)] [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.*/)] [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.*/)] [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("com.bepis.r2api", "R2API", "5.0.11")] [AutoVersion] public class R2API : BaseUnityPlugin { public const string PluginGUID = "com.bepis.r2api"; public const string PluginName = "R2API"; private const string GameBuildId = "1.2.4.1"; internal static HashSet<string> LoadedSubmodules; private NetworkCompatibilityHandler _networkCompatibilityHandler; public const string PluginVersion = "5.0.11"; internal static ManualLogSource Logger { get; set; } public static bool DebugMode { get; private set; } internal static R2API Instance { get; private set; } internal static event EventHandler R2APIStart; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; _networkCompatibilityHandler = new NetworkCompatibilityHandler(); _networkCompatibilityHandler.BuildModList(); RoR2Application.Awake += new hook_Awake(CheckIfUsedOnRightGameVersion); } private void Start() { R2API.R2APIStart?.Invoke(this, null); } private void OnDestroy() { _networkCompatibilityHandler.CleanupModList(); } private static void DebugUpdate() { } public static void LogDebug(object debugText, [CallerMemberName] string caller = "") { Logger.LogDebug((object)(caller + " : " + debugText.ToString())); } private void CheckIfUsedOnRightGameVersion(orig_Awake orig, RoR2Application self) { orig.Invoke(self); string version = Application.version; if (!("1.2.4.1" == version)) { Logger.LogWarning((object)("This version of R2API was built for build id \"1.2.4.1\", you are running \"" + version + "\".")); Logger.LogWarning((object)"Should any problems arise, please check for a new version before reporting issues."); } } public static bool IsLoaded(string submodule) { if (LoadedSubmodules == null) { Logger.LogWarning((object)"IsLoaded called before submodules were loaded, result may not reflect actual load status."); return false; } return LoadedSubmodules.Contains(submodule); } public static bool SupportsVersion(string? version) { Version version2 = Version.Parse("5.0.11"); Version version3 = Version.Parse(version); if (version2.Major == version3.Major) { return version2.Minor <= version3.Minor; } return false; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.MiscHelpers { internal static class ILCursorExtensions { public static ILCursor EmitDel<TDel>(this ILCursor cursor, TDel func) where TDel : Delegate { cursor.EmitDelegate<TDel>(func); return cursor; } } public static class KeyValuePairExtensions { public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> kvp, out TKey key, out TValue value) { key = kvp.Key; value = kvp.Value; } } public delegate T Modifier<T>(T input); internal static class MulticastDelegateExtensions { public static T InvokeSequential<T>(this Modifier<T> func, T initialValue, bool skipErrors = false) { Delegate[] invocationList = func.GetInvocationList(); if (invocationList == null || invocationList.Length <= 1) { return func(initialValue); } foreach (Modifier<T> item in invocationList.Where((Delegate a) => a is Modifier<T>).Cast<Modifier<T>>()) { try { initialValue = item(initialValue); } catch (Exception ex) { if (!skipErrors) { throw ex; } R2API.Logger.LogError((object)ex); } } return initialValue; } public static TOut InvokeSequential<TIn, TOut>(this Func<TIn, TOut> func, TIn initialValue, Func<TOut, TIn> inBetween, bool skipErrors = false) { Delegate[] invocationList = func.GetInvocationList(); if (invocationList == null || invocationList.Length <= 1) { return func(initialValue); } TOut val = default(TOut); bool flag = true; foreach (Func<TIn, TOut> item in invocationList.Where((Delegate a) => a is Func<TIn, TOut>).Cast<Func<TIn, TOut>>()) { if (flag) { try { val = item(initialValue); flag = false; } catch (Exception ex) { if (!skipErrors) { throw ex; } R2API.Logger.LogError((object)ex); } } else { val = item(inBetween(val)); } } return val; } } } namespace R2API.Utils { public static class EnumerableExtensions { public static void ForEachTry<T>(this IEnumerable<T>? list, Action<T>? action, IDictionary<T, Exception?>? exceptions = null) { Action<T> action2 = action; IDictionary<T, Exception?> exceptions2 = exceptions; list.ToList().ForEach(delegate(T element) { try { action2(element); } catch (Exception value) { exceptions2?.Add(element, value); } }); } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] [Obsolete("All submodules are automatically loaded and this attribute is now unused.", false)] public class R2APISubmoduleDependency : Attribute { public const string AttributeObsolete = "All submodules are automatically loaded and this attribute is now unused."; public const string PropertyObsolete = "All submodules are automatically loaded and this property is now unused"; public string?[]? SubmoduleNames { get; } public R2APISubmoduleDependency(params string[] submoduleName) { SubmoduleNames = submoduleName; } } public static class CecilUtil { internal static bool IsSubTypeOf(this TypeDefinition typeDefinition, string typeFullName) { if (((MemberReference)typeDefinition).FullName == typeFullName) { return true; } TypeReference baseType = typeDefinition.BaseType; TypeDefinition val = ((baseType != null) ? baseType.Resolve() : null); while (val != null) { if (((MemberReference)val).FullName == typeFullName) { return true; } TypeReference baseType2 = val.BaseType; val = ((baseType2 != null) ? baseType2.Resolve() : null); } return false; } } public static class ChatMessage { public static void Send(string? message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "{0}"; val.paramTokens = new string[1] { message }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } public static void Send(string? message, string? messageFrom) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "{0}: {1}"; val.paramTokens = new string[2] { messageFrom, message }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } public static void SendColored(string? message, string? colorHex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "<color=" + colorHex + ">{0}</color>"; val.paramTokens = new string[1] { message }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } public static void SendColored(string? message, ColorIndex color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SendColored(message, ColorCatalog.GetColorHexString(color)); } public static void SendColored(string? message, Color color) { SendColored(message, ColorToHexString(color)); } public static void SendColored(string? message, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SendColored(message, ColorToHexString(color)); } public static void SendColored(string? message, string? colorHex, string? messageFrom) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "<color=" + colorHex + ">{0}: {1}</color>"; val.paramTokens = new string[2] { messageFrom, message }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } public static void SendColored(string? message, ColorIndex color, string? messageFrom) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SendColored(message, ColorCatalog.GetColorHexString(color), messageFrom); } public static void SendColored(string? message, Color color, string? messageFrom) { SendColored(message, ColorToHexString(color), messageFrom); } public static void SendColored(string? message, Color color, string? messageFrom) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SendColored(message, ColorToHexString(color), messageFrom); } private static string ColorToHexString(Color c) { return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"); } private static string ColorToHexString(Color c) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return "#" + ColorUtility.ToHtmlStringRGB(c); } } internal static class CompressedFlagArrayUtilities { [StructLayout(LayoutKind.Explicit)] [DebuggerDisplay("{ToString()}")] private struct FullBlockMask { [FieldOffset(3)] private byte byte0; [FieldOffset(2)] private byte byte1; [FieldOffset(1)] private byte byte2; [FieldOffset(0)] private byte byte3; [FieldOffset(0)] public uint integer; public byte this[int i] { get { if (BitConverter.IsLittleEndian) { return i switch { 0 => byte0, 1 => byte1, 2 => byte2, 3 => byte3, _ => throw new IndexOutOfRangeException(), }; } return i switch { 0 => byte3, 1 => byte2, 2 => byte1, 3 => byte0, _ => throw new IndexOutOfRangeException(), }; } set { if (BitConverter.IsLittleEndian) { switch (i) { case 0: byte0 = value; break; case 1: byte1 = value; break; case 2: byte2 = value; break; case 3: byte3 = value; break; default: throw new IndexOutOfRangeException(); } } else { switch (i) { case 0: byte3 = value; break; case 1: byte2 = value; break; case 2: byte1 = value; break; case 3: byte0 = value; break; default: throw new IndexOutOfRangeException(); } } } } public override string ToString() { return Convert.ToString(integer, 2).PadLeft(32, '0'); } } private static readonly byte[] tempBlockValues = new byte[18]; private static readonly int[] tempBlockPartValuesCounts = new int[4]; public const byte flagsPerValue = 8; public const byte valuesPerBlock = 18; public const byte flagsPerSection = 144; public const byte sectionsCount = 8; public const byte blockPartsCount = 4; private const uint fullBlockHeader = 4218992u; private const uint block1HeaderMask = 64u; private const uint block2HeaderMask = 96u; private const uint block3HeaderMask = 112u; private const uint block4HeaderMask = 120u; private const uint block1HeaderXor = 0u; private const uint block2HeaderXor = 64u; private const uint block3HeaderXor = 96u; private const uint block4HeaderXor = 112u; private const int block1HeaderSkip = 2; private const int block2HeaderSkip = 3; private const int block3HeaderSkip = 4; private const int block4HeaderSkip = 5; private const int block1HeaderValuesCount = 6; private const int block2HeaderValuesCount = 5; private const int block3HeaderValuesCount = 4; private const int block4HeaderValuesCount = 3; private const int block1HeaderOffset = -2; private const int block2HeaderOffset = 3; private const int block3HeaderOffset = 7; private const int block4HeaderOffset = 10; private const uint highestBitInByte = 128u; public static void Add(ref byte[] values, int index) { if (index < 0) { throw new ArgumentOutOfRangeException("index"); } int num = index / 8; int num2 = index - num * 8; ResizeIfNeeded(ref values, num); values[num] = (byte)(values[num] | (128u >> num2)); } public static bool Remove(ref byte[] values, int index) { if (index < 0) { return false; } int num = index / 8; if (num >= values.Length) { return false; } int num2 = index - num * 8; values[num] = (byte)(values[num] & ~(128 >>> num2)); DownsizeIfNeeded(ref values); return true; } public static bool Has(byte[] values, int index) { if (index < 0) { return false; } int num = index / 8; if (num >= values.Length) { return false; } int num2 = index - num * 8; return (values[num] & (128 >>> num2)) != 0; } public static byte[] ReadFromNetworkReader(NetworkReader reader, int maxValue) { byte[] values = Array.Empty<byte>(); byte b = reader.ReadByte(); if (b == 0) { return values; } if (maxValue <= 8) { return new byte[1] { b }; } if (maxValue <= 64) { int num = 0; for (int i = 0; i < 8; i++) { if ((b & (1 << i)) != 0) { num = i; tempBlockValues[i] = reader.ReadByte(); } else { tempBlockValues[i] = 0; } } values = new byte[num + 1]; Array.Copy(tempBlockValues, 0, values, 0, num + 1); return values; } for (int j = 0; j < 8; j++) { if ((b & (1 << j)) != 0) { ReadBlock(ref values, reader, j); } } return values; } public static void WriteToNetworkWriter(byte[] values, NetworkWriter writer, int maxValue) { int num = 0; if (maxValue <= 8) { writer.Write((byte)((values.Length != 0) ? values[0] : 0)); return; } if (maxValue <= 64) { int num2 = 0; for (int num3 = Math.Min(8, values.Length) - 1; num3 >= 0; num3--) { num <<= 1; if (values[num3] != 0) { tempBlockValues[num2++] = values[num3]; num |= 1; } } writer.Write((byte)num); for (int num4 = num2 - 1; num4 >= 0; num4--) { writer.Write(tempBlockValues[num4]); } return; } for (int i = 0; i < 8; i++) { if (!IsBlockEmpty(values, i, out var end)) { num |= 1 << i; } if (end) { break; } } writer.Write((byte)num); for (int j = 0; j < 8; j++) { if ((num & (1 << j)) > 0) { WriteBlock(values, writer, j); } } } private static void ReadBlock(ref byte[] values, NetworkReader reader, int blockIndex) { Array.Clear(tempBlockValues, 0, 18); int num = 0; int lastValueIndex = 0; byte b; do { b = reader.ReadByte(); var (num2, num3, fromIndex, valueBitesOffset) = GetMaskValues(num); while (((b & num2) ^ num3) != 0) { (num2, num3, fromIndex, valueBitesOffset) = GetMaskValues(++num); } ReadBlockValues(ref lastValueIndex, valueBitesOffset, fromIndex, 8, reader, b); } while ((b & 0x80) == 0); ResizeIfNeeded(ref values, blockIndex * 18 + lastValueIndex); Array.Copy(tempBlockValues, 0, values, blockIndex * 18, lastValueIndex + 1); } private static void ReadBlockValues(ref int lastValueIndex, int valueBitesOffset, int fromIndex, int toIndex, NetworkReader reader, byte blockByte) { for (int i = fromIndex; i < toIndex; i++) { if ((blockByte & (128u >> i)) != 0) { lastValueIndex = i + valueBitesOffset; tempBlockValues[lastValueIndex] = reader.ReadByte(); } } } private static void ResizeIfNeeded(ref byte[] values, int valueIndex) { if (valueIndex >= values.Length) { Array.Resize(ref values, valueIndex + 1); } } private static void DownsizeIfNeeded(ref byte[] value) { if (value.Length == 0 || value[value.Length - 1] != 0) { return; } for (int num = value.Length - 2; num >= 0; num--) { if (value[num] != 0) { Array.Resize(ref value, num + 1); return; } } value = Array.Empty<byte>(); } private static void WriteBlock(byte[] values, NetworkWriter writer, int blockIndex) { int blockValuesCount = 0; FullBlockMask fullBlockMask = default(FullBlockMask); PrepareBlockValues(values, blockIndex, 0, 6, ref blockValuesCount, ref fullBlockMask); tempBlockPartValuesCounts[0] = blockValuesCount; fullBlockMask.integer <<= 3; PrepareBlockValues(values, blockIndex, 6, 11, ref blockValuesCount, ref fullBlockMask); tempBlockPartValuesCounts[1] = blockValuesCount; fullBlockMask.integer <<= 4; PrepareBlockValues(values, blockIndex, 11, 15, ref blockValuesCount, ref fullBlockMask); tempBlockPartValuesCounts[2] = blockValuesCount; fullBlockMask.integer <<= 5; PrepareBlockValues(values, blockIndex, 15, 18, ref blockValuesCount, ref fullBlockMask); tempBlockPartValuesCounts[3] = blockValuesCount; int num = 0; for (int num2 = 3; num2 > 0; num2--) { if (fullBlockMask[num2] != 0) { num = num2; break; } } fullBlockMask.integer |= 4218992u; fullBlockMask[num] |= 128; int i = 0; for (int j = 0; j <= num; j++) { if (i != tempBlockPartValuesCounts[j]) { writer.Write(fullBlockMask[j]); for (; i < tempBlockPartValuesCounts[j]; i++) { writer.Write(tempBlockValues[i]); } } } } private static void PrepareBlockValues(byte[] values, int blockIndex, int fromIndex, int toIndex, ref int blockValuesCount, ref FullBlockMask fullBlockMask) { for (int i = fromIndex; i < toIndex; i++) { fullBlockMask.integer <<= 1; int num = blockIndex * 18 + i; if (num < values.Length && values[num] != 0) { fullBlockMask.integer |= 1u; tempBlockValues[blockValuesCount++] = values[num]; } } } private static bool IsBlockEmpty(byte[] values, int blockIndex, out bool end) { if (values.Length == 0 || values.Length / 18 < blockIndex) { end = true; return true; } end = false; int num = Math.Min((blockIndex + 1) * 18, values.Length); for (int i = blockIndex * 18; i < num; i++) { if (values[i] != 0) { return false; } } return true; } private static (uint mask, uint xor, int skip, int offset) GetMaskValues(int i) { return i switch { 0 => (64u, 0u, 2, -2), 1 => (96u, 64u, 3, 3), 2 => (112u, 96u, 4, 7), 3 => (120u, 112u, 5, 10), _ => throw new IndexOutOfRangeException(), }; } } public static class DirectMessage { private static NetworkUser[] GetConnectionNetworkUsers(NetworkConnection conn) { List<PlayerController> playerControllers = conn.playerControllers; NetworkUser[] array = (NetworkUser[])(object)new NetworkUser[playerControllers.Count]; for (int i = 0; i < playerControllers.Count; i++) { array[i] = playerControllers[i].gameObject.GetComponent<NetworkUser>(); } return array; } private static NetworkConnection ResolveUserToConnection(NetworkUser user) { foreach (NetworkConnection connection in NetworkServer.connections) { if (connection == null) { continue; } NetworkUser[] connectionNetworkUsers = GetConnectionNetworkUsers(connection); foreach (NetworkUser obj in connectionNetworkUsers) { if (((object)user).Equals((object?)obj)) { return connection; } } } return null; } public static void SendDirectMessage(string? message, NetworkConnection? connection) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = "{0}"; val.paramTokens = new string[1] { message }; SendDirectMessage((ChatMessageBase)(object)val, connection); } public static void SendDirectMessage(string? message, NetworkUser? user) { SendDirectMessage(message, ResolveUserToConnection(user)); } public static void SendDirectMessage(ChatMessageBase message, NetworkConnection? connection) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown NetworkWriter val = new NetworkWriter(); val.StartMessage((short)59); val.Write(message.GetTypeIndex()); val.Write((MessageBase)(object)message); val.FinishMessage(); connection.SendWriter(val, QosChannelIndex.chat.intVal); } } internal static class DirectoryUtilities { private static bool _alreadyPrintedFolderStructure; private static bool _bepinexFolderPrinted; private static readonly HashSet<string> BannedFolders = new HashSet<string> { "MonoBleedingEdge", "Risk of Rain 2_Data" }; internal static void LogFolderStructureAsTree(string directory) { if (!_alreadyPrintedFolderStructure) { WriteFolderStructure(directory); if (!_bepinexFolderPrinted) { WriteFolderStructure(Paths.BepInExRootPath); } _alreadyPrintedFolderStructure = true; } } private static void WriteFolderStructure(string directory) { R2API.Logger.LogDebug((object)""); R2API.Logger.LogDebug((object)("+ " + new DirectoryInfo(directory).Name)); string[] directories = Directory.GetDirectories(directory); for (int i = 0; i < directories.Length; i++) { WriteFolderStructureRecursively(directories[i]); } string[] files = Directory.GetFiles(directory); for (int j = 1; j <= files.Length; j++) { FileInfo fileInfo = new FileInfo(files[j - 1]); R2API.Logger.LogDebug((object)(GenerateSpaces(0) + ((j != files.Length) ? "|" : "`") + "---- " + fileInfo.Name + " (" + ParseSize(fileInfo.Length) + ")")); } } private static void WriteFolderStructureRecursively(string directory, int spaces = 0) { DirectoryInfo directoryInfo = new DirectoryInfo(directory); R2API.Logger.LogDebug((object)(GenerateSpaces(spaces) + "|---+ " + directoryInfo.Name)); if (!_bepinexFolderPrinted && Paths.BepInExRootPath == directory) { _bepinexFolderPrinted = true; } if (directoryInfo.Parent != null && (BannedFolders.Contains(directoryInfo.Name) || BannedFolders.Contains(directoryInfo.Parent.Name + "/" + directoryInfo.Name))) { R2API.Logger.LogDebug((object)(GenerateSpaces(spaces + 4) + "`---- (Folder content not shown)")); return; } string[] directories = Directory.GetDirectories(directory); for (int i = 0; i < directories.Length; i++) { WriteFolderStructureRecursively(directories[i], spaces + 4); } string[] files = Directory.GetFiles(directory); for (int j = 1; j <= files.Length; j++) { FileInfo fileInfo = new FileInfo(files[j - 1]); R2API.Logger.LogDebug((object)(GenerateSpaces(spaces + 4) + ((j != files.Length) ? "|" : "`") + "---- " + fileInfo.Name + " (" + ParseSize(fileInfo.Length) + ")")); } } private static string ParseSize(long lSize) { string[] array = new string[4] { "B", "KB", "MB", "GB" }; float num = lSize; int num2 = 0; while (num > 1024f) { num2++; num /= 1024f; } return num.ToString("F2") + array[num2]; } private static string GenerateSpaces(int spaces) { string text = ""; for (int i = 1; i <= spaces; i += 4) { text += "| "; } return text; } } public static class EmbeddedResources { private unsafe static readonly delegate*<Assembly, string, out int, out Module, nint> GetManifestResourceInternal = (delegate*<Assembly, string, out int, out Module, nint>)(void*)typeof(R2API).Assembly.GetType().GetMethod("GetManifestResourceInternal", (BindingFlags)(-1)).MethodHandle.GetFunctionPointer(); [MethodImpl(MethodImplOptions.NoInlining)] public unsafe static (nint ptr, int size) GetEmbeddedResource(string resourceName, Assembly? owningAssembly = null) { if ((object)owningAssembly == null) { owningAssembly = Assembly.GetCallingAssembly(); } int item = default(int); Module module = default(Module); return (GetManifestResourceInternal(owningAssembly, resourceName, out item, out module), item); } } public static class ManualLogSourceExtension { public static void LogBlockError(this ManualLogSource? logger, IEnumerable<string?>? lines, int width = 70) { logger.LogBlock((LogLevel)2, "ERROR", lines, width); } public static void LogBlockWarning(this ManualLogSource? logger, IEnumerable<string?>? lines, int width = 70) { logger.LogBlock((LogLevel)4, "WARNING", lines, width); } public static void LogBlock(this ManualLogSource? logger, LogLevel level, string? header, IEnumerable<string?>? lines, int width = 70) { //IL_000e: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) ManualLogSource logger2 = logger; string text = new string('*', width + 2); string text2 = CenterText("", width); logger2.Log(level, (object)text); logger2.Log(level, (object)text2); logger2.Log(level, (object)CenterText("!" + header + "!", width)); lines.ToList().ForEach(delegate(string x) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) logger2.Log(level, (object)CenterText(x, width)); }); logger2.Log(level, (object)text2); logger2.Log(level, (object)text); } public static string CenterText(string? text = "", int width = 70) { return string.Format("*{0," + (width / 2 + text.Length / 2) + "}{1," + (width / 2 - text.Length / 2) + "}*", text, " "); } } public enum CompatibilityLevel { NoNeedForSync, EveryoneMustHaveMod } public enum VersionStrictness { DifferentModVersionsAreOk, EveryoneNeedSameModVersion } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class)] public class NetworkCompatibility : Attribute { public CompatibilityLevel CompatibilityLevel { get; internal set; } public VersionStrictness VersionStrictness { get; internal set; } public NetworkCompatibility(CompatibilityLevel compatibility = CompatibilityLevel.EveryoneMustHaveMod, VersionStrictness versionStrictness = VersionStrictness.EveryoneNeedSameModVersion) { CompatibilityLevel = compatibility; VersionStrictness = versionStrictness; } } internal class NetworkCompatibilityHandler { internal const char ModGuidAndModVersionSeparator = ';'; internal readonly HashSet<string> ModList = new HashSet<string>(); internal void BuildModList() { R2API.R2APIStart += ScanPluginsForNetworkCompat; } internal void CleanupModList() { if (NetworkModCompatibilityHelper.networkModList != null && NetworkModCompatibilityHelper.networkModList.Count() > 0) { List<string> list = NetworkModCompatibilityHelper.networkModList.ToList(); list.RemoveAll(ModList.Contains); NetworkModCompatibilityHelper.networkModList = list; } } private void ScanPluginsForNetworkCompat(object? _, EventArgs __) { foreach (var (_, val2) in Chainloader.PluginInfos) { try { string gUID = val2.Metadata.GUID; Version version = val2.Metadata.Version; if (!gUID.StartsWith("com.bepis.r2api") && !val2.Dependencies.All((BepInDependency dependency) => !dependency.DependencyGUID.StartsWith("com.bepis.r2api") || (int)dependency.Flags == 2)) { TryGetNetworkCompatibility(((object)val2.Instance).GetType(), out NetworkCompatibility networkCompatibility); if (networkCompatibility.CompatibilityLevel == CompatibilityLevel.EveryoneMustHaveMod) { ModList.Add((networkCompatibility.VersionStrictness == VersionStrictness.EveryoneNeedSameModVersion) ? (gUID + ";" + version) : gUID); } } } catch (Exception ex) { R2API.Logger.LogError((object)("Exception in ScanPluginsForNetworkCompat while scanning plugin " + val2.Metadata.GUID)); R2API.Logger.LogError((object)("R2API Failed to properly scan the assembly." + Environment.NewLine + "Please make sure you are compiling against net standard 2.0 and not anything else when making a plugin for Risk of Rain 2 !" + Environment.NewLine + ex)); } } AddToNetworkModList(); R2API.R2APIStart -= ScanPluginsForNetworkCompat; } private static void TryGetNetworkCompatibility(Type baseUnityPluginType, out NetworkCompatibility networkCompatibility) { networkCompatibility = new NetworkCompatibility(); foreach (CustomAttributeData customAttribute in baseUnityPluginType.Assembly.CustomAttributes) { if (customAttribute.AttributeType == typeof(NetworkCompatibility)) { networkCompatibility.CompatibilityLevel = (CompatibilityLevel)customAttribute.ConstructorArguments[0].Value; networkCompatibility.VersionStrictness = (VersionStrictness)customAttribute.ConstructorArguments[1].Value; return; } } foreach (CustomAttributeData customAttribute2 in baseUnityPluginType.CustomAttributes) { if (customAttribute2.AttributeType == typeof(NetworkCompatibility)) { networkCompatibility.CompatibilityLevel = (CompatibilityLevel)customAttribute2.ConstructorArguments[0].Value; networkCompatibility.VersionStrictness = (VersionStrictness)customAttribute2.ConstructorArguments[1].Value; break; } } } private void AddToNetworkModList() { if (ModList.Count == 0) { return; } List<string> list = ModList.ToList(); list.Sort(StringComparer.InvariantCulture); R2API.Logger.LogInfo((object)"[NetworkCompatibility] Adding to the networkModList : "); foreach (string item in list) { R2API.Logger.LogInfo((object)item); NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append(item); } } } public static class Reflection { public delegate T GetDelegate<out T>(object? instance); public delegate void SetDelegate<in T>(object? instance, T value); public delegate void SetDelegateRef<TInstance, in TValue>(ref TInstance instance, TValue value) where TInstance : struct; public delegate T GetDelegateRef<TInstance, out T>(ref TInstance instance) where TInstance : struct; private const BindingFlags AllFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<(Type T, string name), FieldInfo> FieldCache = new Dictionary<(Type, string), FieldInfo>(); private static readonly Dictionary<(Type T, string name, Type TReturn), Delegate> FieldGetDelegateCache = new Dictionary<(Type, string, Type), Delegate>(); private static readonly Dictionary<(Type T, string name, Type TValue), Delegate> FieldSetDelegateCache = new Dictionary<(Type, string, Type), Delegate>(); private static readonly Dictionary<(Type T, string name), PropertyInfo> PropertyCache = new Dictionary<(Type, string), PropertyInfo>(); private static readonly Dictionary<(Type T, string name, Type TInstance, Type TReturn), Delegate> PropertyGetDelegateCache = new Dictionary<(Type, string, Type, Type), Delegate>(); private static readonly Dictionary<(Type T, string name, Type TInstance, Type TValue), Delegate> PropertySetDelegateCache = new Dictionary<(Type, string, Type, Type), Delegate>(); private static readonly Dictionary<(Type T, string name), MethodInfo> MethodCache = new Dictionary<(Type, string), MethodInfo>(); private static readonly Dictionary<(Type T, string name, long argumentTypesHashCode), MethodInfo> OverloadedMethodCache = new Dictionary<(Type, string, long), MethodInfo>(); private static readonly Dictionary<(Type T, string name), FastReflectionDelegate> MethodDelegateCache = new Dictionary<(Type, string), FastReflectionDelegate>(); private static readonly Dictionary<(Type T, string name, long argumentTypesHashCode), FastReflectionDelegate> OverloadedMethodDelegateCache = new Dictionary<(Type, string, long), FastReflectionDelegate>(); private static readonly Dictionary<(Type T, long argumentTypesHashCode), ConstructorInfo> ConstructorCache = new Dictionary<(Type, long), ConstructorInfo>(); private static readonly Dictionary<(Type T, string name), Type> NestedTypeCache = new Dictionary<(Type, string), Type>(); public static long CombineHashCode<T>(IEnumerable<T> enumerable) { long num = 0L; foreach (T item in enumerable) { num = num * 486187739 + EqualityComparer<T>.Default.GetHashCode(item); } return num; } public static FieldInfo GetFieldCached<T>(string? name) { return typeof(T).GetFieldCached(name); } public static FieldInfo GetFieldCached(this Type? T, string? name) { if (FieldCache.TryGetValue((T, name), out FieldInfo value)) { return value; } return FieldCache[(T, name)] = T.GetFieldFull(name); } public static TReturn GetFieldValue<TReturn>(this object? instance, string? fieldName) { return instance.GetType().GetFieldGetDelegate<TReturn>(fieldName)(instance); } public static TReturn GetFieldValue<TReturn>(this Type? staticType, string? fieldName) { return staticType.GetFieldGetDelegate<TReturn>(fieldName)(null); } public static void SetFieldValue<TValue>(this object? instance, string? fieldName, TValue value) { instance.GetType().GetFieldSetDelegate<TValue>(fieldName)(instance, value); } public static void SetFieldValue<TValue>(this Type? staticType, string? fieldName, TValue value) { staticType.GetFieldSetDelegate<TValue>(fieldName)(null, value); } public static void SetStructFieldValue<TInstance, TValue>(this ref TInstance instance, string? fieldName, TValue value) where TInstance : struct { typeof(TInstance).GetFieldSetDelegateRef<TInstance, TValue>(fieldName)(ref instance, value); } private static FieldInfo GetFieldFull(this Type T, string name) { while (T != null) { FieldInfo field = T.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } T = T.BaseType; } return null; } public static GetDelegate<TReturn> GetFieldGetDelegate<TReturn>(this Type type, string? fieldName) { if (FieldGetDelegateCache.TryGetValue((type, fieldName, typeof(TReturn)), out Delegate value)) { return (GetDelegate<TReturn>)value; } Delegate delegate2 = (FieldGetDelegateCache[(type, fieldName, typeof(TReturn))] = type.GetFieldCached(fieldName).CreateGetDelegate<TReturn>()); return (GetDelegate<TReturn>)delegate2; } public static SetDelegate<TValue> GetFieldSetDelegate<TValue>(this Type type, string? fieldName) { if (FieldSetDelegateCache.TryGetValue((type, fieldName, typeof(TValue)), out Delegate value)) { return (SetDelegate<TValue>)value; } Delegate delegate2 = (FieldSetDelegateCache[(type, fieldName, typeof(TValue))] = type.GetFieldCached(fieldName).CreateSetDelegate<TValue>()); return (SetDelegate<TValue>)delegate2; } public static SetDelegateRef<TInstance, TValue> GetFieldSetDelegateRef<TInstance, TValue>(this Type type, string? fieldName) where TInstance : struct { if (FieldSetDelegateCache.TryGetValue((type, fieldName, typeof(TValue)), out Delegate value)) { return (SetDelegateRef<TInstance, TValue>)value; } Delegate delegate2 = (FieldSetDelegateCache[(type, fieldName, typeof(TValue))] = type.GetFieldCached(fieldName).CreateSetDelegateRef<TInstance, TValue>()); return (SetDelegateRef<TInstance, TValue>)delegate2; } public static PropertyInfo GetPropertyCached<T>(string? name) { return typeof(T).GetPropertyCached(name); } public static PropertyInfo GetPropertyCached(this Type? T, string? name) { if (PropertyCache.TryGetValue((T, name), out PropertyInfo value)) { return value; } return PropertyCache[(T, name)] = T.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } public static TReturn GetPropertyValue<TReturn>(this object? instance, string? propName) { return instance.GetType().GetPropertyGetDelegate<TReturn>(propName)(instance); } public static TReturn GetPropertyValue<TReturn>(this Type? staticType, string? propName) { return staticType.GetPropertyGetDelegate<TReturn>(propName)(null); } public static void SetPropertyValue<TValue>(this object? instance, string? propName, TValue value) { instance.GetType().GetPropertySetDelegate<TValue>(propName)(instance, value); } public static void SetPropertyValue<TValue>(this Type? staticType, string? propName, TValue value) { staticType.GetPropertySetDelegate<TValue>(propName)(null, value); } public static void SetStructPropertyValue<TInstance, TValue>(this ref TInstance instance, string? propName, TValue value) where TInstance : struct { typeof(TInstance).GetPropertySetDelegateRef<TInstance, TValue>(propName)(ref instance, value); } public static TValue GetStructPropertyValue<TInstance, TValue>(this ref TInstance instance, string? propName) where TInstance : struct { return typeof(TInstance).GetPropertyGetDelegateRef<TInstance, TValue>(propName)(ref instance); } public static MethodInfo GetPropertyGetter(this Type type, string propName) { return type.GetProperty(propName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetGetMethod(nonPublic: true); } public static MethodInfo GetPropertySetter(this Type type, string propName) { return type.GetProperty(propName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetSetMethod(nonPublic: true); } public static GetDelegate<TReturn> GetPropertyGetDelegate<TReturn>(this Type type, string? propName) { if (PropertyGetDelegateCache.TryGetValue((type, propName, typeof(object), typeof(TReturn)), out Delegate value)) { return (GetDelegate<TReturn>)value; } Delegate delegate2 = (PropertyGetDelegateCache[(type, propName, typeof(object), typeof(TReturn))] = type.GetPropertyCached(propName).CreateGetDelegate<TReturn>()); return (GetDelegate<TReturn>)delegate2; } public static GetDelegateRef<TInstance, TReturn> GetPropertyGetDelegateRef<TInstance, TReturn>(this Type type, string? propName) where TInstance : struct { if (PropertyGetDelegateCache.TryGetValue((type, propName, typeof(TInstance), typeof(TReturn)), out Delegate value)) { return (GetDelegateRef<TInstance, TReturn>)value; } Delegate delegate2 = (PropertyGetDelegateCache[(type, propName, typeof(TInstance), typeof(TReturn))] = type.GetPropertyCached(propName).CreateGetDelegate<TInstance, TReturn>()); return (GetDelegateRef<TInstance, TReturn>)delegate2; } public static SetDelegate<TValue> GetPropertySetDelegate<TValue>(this Type type, string? propName) { if (PropertySetDelegateCache.TryGetValue((type, propName, typeof(object), typeof(TValue)), out Delegate value)) { return (SetDelegate<TValue>)value; } Delegate delegate2 = (PropertySetDelegateCache[(type, propName, typeof(object), typeof(TValue))] = type.GetPropertyCached(propName).CreateSetDelegate<TValue>()); return (SetDelegate<TValue>)delegate2; } private static SetDelegateRef<TInstance, TValue> GetPropertySetDelegateRef<TInstance, TValue>(this Type type, string? propName) where TInstance : struct { if (PropertySetDelegateCache.TryGetValue((type, propName, typeof(TInstance), typeof(TValue)), out Delegate value)) { return (SetDelegateRef<TInstance, TValue>)value; } Delegate delegate2 = (PropertySetDelegateCache[(type, propName, typeof(TInstance), typeof(TValue))] = type.GetPropertyCached(propName).CreateSetDelegateRef<TInstance, TValue>()); return (SetDelegateRef<TInstance, TValue>)delegate2; } public static MethodInfo GetMethodCached<T>(string? name) { return typeof(T).GetMethodCached(name); } public static MethodInfo GetMethodCached(this Type? T, string? name) { if (MethodCache.TryGetValue((T, name), out MethodInfo value)) { return value; } return MethodCache[(T, name)] = T.GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } public static MethodInfo GetMethodWithConstructedGenericParameter(this Type? T, string? name, Type? genericTypeDefinition) { string name2 = name; Type genericTypeDefinition2 = genericTypeDefinition; return T.GetMethods().First(delegate(MethodInfo method) { if (method.Name != name2) { return false; } Type parameterType = method.GetParameters().First().ParameterType; if (!parameterType.IsConstructedGenericType) { return false; } Type type = parameterType.GetGenericArguments().First(); return parameterType == genericTypeDefinition2.MakeGenericType(type); }); } public static MethodInfo GetMethodCached<T>(string? name, Type?[]? argumentTypes) { return typeof(T).GetMethodCached(name, argumentTypes); } public static MethodInfo GetMethodCached(this Type? T, string? name, Type?[]? argumentTypes) { (Type, string, long) key = (T, name, CombineHashCode(argumentTypes)); if (OverloadedMethodCache.TryGetValue(key, out MethodInfo value)) { return value; } return OverloadedMethodCache[key] = T.GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, argumentTypes, null); } public static TReturn InvokeMethod<TReturn>(this object? instance, string? methodName) { return instance.InvokeMethod<TReturn>(methodName, null); } public static TReturn InvokeMethod<TReturn>(this Type? staticType, string? methodName) { return staticType.InvokeMethod<TReturn>(methodName, null); } public static void InvokeMethod(this object? instance, string? methodName) { instance.InvokeMethod<object>(methodName); } public static void InvokeMethod(this Type? staticType, string? methodName) { staticType.InvokeMethod<object>(methodName); } public static TReturn InvokeMethod<TReturn>(this object? instance, string? methodName, params object?[]? methodParams) { if (methodParams == null) { return (TReturn)instance.GetType().GetMethodDelegateCached(methodName).Invoke(instance, methodParams); } return (TReturn)instance.GetType().GetMethodDelegateCached(methodName, methodParams.Select((object x) => x.GetType()).ToArray()).Invoke(instance, methodParams); } public static TReturn InvokeMethod<TReturn>(this Type? staticType, string? methodName, params object?[]? methodParams) { if (methodParams == null) { return (TReturn)staticType.GetMethodDelegateCached(methodName).Invoke((object)null, methodParams); } return (TReturn)staticType.GetMethodDelegateCached(methodName, methodParams.Select((object x) => x.GetType()).ToArray()).Invoke((object)null, methodParams); } public static void InvokeMethod(this object? instance, string? methodName, params object?[]? methodParams) { instance.InvokeMethod<object>(methodName, methodParams); } public static void InvokeMethod(this Type? staticType, string? methodName, params object?[]? methodParams) { staticType.InvokeMethod<object>(methodName, methodParams); } public static FastReflectionDelegate GetMethodDelegateCached(this Type type, string? methodName) { if (MethodDelegateCache.TryGetValue((type, methodName), out FastReflectionDelegate value)) { return value; } return MethodDelegateCache[(type, methodName)] = type.GetMethodCached(methodName).GenerateCallDelegate(); } public static FastReflectionDelegate GetMethodDelegateCached(this Type type, string? methodName, Type[] argumentTypes) { (Type, string, long) key = (type, methodName, CombineHashCode(argumentTypes)); if (OverloadedMethodDelegateCache.TryGetValue(key, out FastReflectionDelegate value)) { return value; } return OverloadedMethodDelegateCache[key] = type.GetMethodCached(methodName, argumentTypes).GenerateCallDelegate(); } public static ConstructorInfo GetConstructorCached<T>(Type?[]? argumentTypes) { return typeof(T).GetConstructorCached(argumentTypes); } public static ConstructorInfo GetConstructorCached(this Type? T, Type?[]? argumentTypes) { (Type, long) key = (T, CombineHashCode(argumentTypes)); if (ConstructorCache.TryGetValue(key, out ConstructorInfo value)) { return value; } return ConstructorCache[key] = T.GetConstructor(argumentTypes); } public static Type GetNestedType<T>(string? name) { return typeof(T).GetNestedTypeCached(name); } public static Type GetNestedTypeCached<T>(string? name) { return typeof(T).GetNestedTypeCached(name); } public static Type GetNestedTypeCached(this Type? T, string? name) { if (NestedTypeCache.TryGetValue((T, name), out Type value)) { return value; } return NestedTypeCache[(T, name)] = T.GetNestedType(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } public static object Instantiate(this Type? type) { return Activator.CreateInstance(type, nonPublic: true); } public static object Instantiate(this Type? type, params object?[]? constructorArguments) { return type.GetConstructorCached(constructorArguments.Select((object x) => x.GetType()).ToArray()).Invoke(constructorArguments); } public static object InstantiateGeneric<TClass>(this Type? typeArgument) { return typeof(TClass).MakeGenericType(typeArgument).Instantiate(); } public static object InstantiateGeneric<TClass>(this Type?[]? typeArgument) { return typeof(TClass).MakeGenericType(typeArgument).Instantiate(); } public static IList InstantiateList(this Type? type) { return (IList)typeof(List<>).MakeGenericType(type).Instantiate(); } private static FieldInfo ThrowIfFieldTypeCannotBeAssignedTo<T>(this FieldInfo fieldInfo) { if (!typeof(T).IsAssignableFrom(fieldInfo.FieldType)) { throw new InvalidCastException($"{fieldInfo.Name} is of type {fieldInfo.FieldType}, it cannot be assigned to the type {typeof(T)}."); } return fieldInfo; } private static PropertyInfo ThrowIfPropertyTypeCannotBeAssignedTo<T>(this PropertyInfo propertyInfo) { if (!typeof(T).IsAssignableFrom(propertyInfo.PropertyType)) { throw new InvalidCastException($"{propertyInfo.Name} is of type {propertyInfo.PropertyType}, it cannot be assigned to the type {typeof(T)}."); } return propertyInfo; } private static FieldInfo ThrowIfTCannotBeAssignedToField<T>(this FieldInfo fieldInfo) { if (!fieldInfo.FieldType.IsAssignableFrom(typeof(T))) { throw new InvalidCastException($"{fieldInfo.Name} is of type {fieldInfo.FieldType}. An instance of {typeof(T)} cannot be assigned to it."); } return fieldInfo; } private static FieldInfo ThrowIfFieldIsConst(this FieldInfo fieldInfo) { if (fieldInfo.IsLiteral && !fieldInfo.IsInitOnly) { throw new FieldAccessException("Unable to set constant field " + fieldInfo.Name + " of type " + fieldInfo.DeclaringType.FullName + "."); } return fieldInfo; } private static PropertyInfo ThrowIfTCannotBeAssignedToProperty<T>(this PropertyInfo propertyInfo) { if (!propertyInfo.PropertyType.IsAssignableFrom(typeof(T))) { throw new InvalidCastException($"{propertyInfo.Name} is of type {propertyInfo.PropertyType}. An instance of {typeof(T)} cannot be assigned to it."); } return propertyInfo; } private static PropertyInfo ThrowIfTNotEqualToPropertyType<T>(this PropertyInfo propertyInfo) { if (propertyInfo.PropertyType != typeof(T)) { throw new InvalidCastException($"{propertyInfo.Name} is of type {propertyInfo.PropertyType}. {typeof(T)} is a different type."); } return propertyInfo; } private static GetDelegate<TReturn> CreateGetDelegate<TReturn>(this FieldInfo field) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } field.ThrowIfFieldTypeCannotBeAssignedTo<TReturn>(); if (field.IsLiteral && !field.IsInitOnly) { object value = field.GetValue(null); TReturn returnValue = ((value == null) ? default(TReturn) : ((TReturn)value)); return Extensions.CastDelegate<GetDelegate<TReturn>>((Delegate)(Func<object, TReturn>)((object _) => returnValue)); } DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} Getter", typeof(TReturn), new Type[1] { typeof(object) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); if (field.DeclaringType.GetTypeInfo().IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Unbox_Any, field.DeclaringType); } } Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Ldfld : OpCodes.Ldsfld, field); if (field.FieldType.IsValueType && !typeof(TReturn).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, field.FieldType); } iLProcessor.Emit(OpCodes.Ret); return (GetDelegate<TReturn>)val.Generate().CreateDelegate(typeof(GetDelegate<TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegate<TValue> CreateSetDelegate<TValue>(this FieldInfo field) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_007d: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } field.ThrowIfTCannotBeAssignedToField<TValue>(); field.ThrowIfFieldIsConst(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} Setter", typeof(void), new Type[2] { typeof(object), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); if (!field.FieldType.IsValueType && typeof(TValue).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, typeof(TValue)); } Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Stfld : OpCodes.Stsfld, field); iLProcessor.Emit(OpCodes.Ret); return (SetDelegate<TValue>)val.Generate().CreateDelegate(typeof(SetDelegate<TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegateRef<TInstance, TValue> CreateSetDelegateRef<TInstance, TValue>(this FieldInfo field) where TInstance : struct { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (field == null) { throw new ArgumentException("Field cannot be null.", "field"); } field.ThrowIfTCannotBeAssignedToField<TValue>(); field.ThrowIfFieldIsConst(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{field} SetterByRef", typeof(void), new Type[2] { typeof(TInstance).MakeByRefType(), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); if (!field.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); if (!field.FieldType.IsValueType && typeof(TValue).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, typeof(TValue)); } Extensions.Emit(iLProcessor, (!field.IsStatic) ? OpCodes.Stfld : OpCodes.Stsfld, field); iLProcessor.Emit(OpCodes.Ret); return (SetDelegateRef<TInstance, TValue>)val.Generate().CreateDelegate(typeof(SetDelegateRef<TInstance, TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static GetDelegate<TReturn> CreateGetDelegate<TReturn>(this PropertyInfo property) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } property.ThrowIfPropertyTypeCannotBeAssignedTo<TReturn>(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} Getter", typeof(TReturn), new Type[1] { typeof(object) }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (!getMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)getMethod); if (property.PropertyType.IsValueType && !typeof(TReturn).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, property.PropertyType); } iLProcessor.Emit(OpCodes.Ret); return (GetDelegate<TReturn>)val.Generate().CreateDelegate(typeof(GetDelegate<TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static GetDelegateRef<TInstance, TReturn> CreateGetDelegate<TInstance, TReturn>(this PropertyInfo property) where TInstance : struct { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } property.ThrowIfPropertyTypeCannotBeAssignedTo<TReturn>(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} Getter", typeof(TReturn), new Type[1] { typeof(TInstance).MakeByRefType() }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (!getMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)getMethod); if (property.PropertyType.IsValueType && !typeof(TReturn).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, property.PropertyType); } iLProcessor.Emit(OpCodes.Ret); return (GetDelegateRef<TInstance, TReturn>)val.Generate().CreateDelegate(typeof(GetDelegateRef<TInstance, TReturn>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegate<TValue> CreateSetDelegate<TValue>(this PropertyInfo property) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_007e: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } property.ThrowIfTCannotBeAssignedToProperty<TValue>(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} Setter", typeof(void), new Type[2] { typeof(object), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (!setMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); if (!property.PropertyType.IsValueType && typeof(TValue).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, typeof(TValue)); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)setMethod); iLProcessor.Emit(OpCodes.Ret); return (SetDelegate<TValue>)val.Generate().CreateDelegate(typeof(SetDelegate<TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static SetDelegateRef<TInstance, TValue> CreateSetDelegateRef<TInstance, TValue>(this PropertyInfo property) where TInstance : struct { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0083: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (property == null) { throw new ArgumentException("Property cannot be null.", "property"); } property.ThrowIfTCannotBeAssignedToProperty<TValue>(); DynamicMethodDefinition val = new DynamicMethodDefinition($"{property} SetterByRef", typeof(void), new Type[2] { typeof(TInstance).MakeByRefType(), typeof(TValue) }); try { ILProcessor iLProcessor = val.GetILProcessor(); MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (!setMethod.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); } iLProcessor.Emit(OpCodes.Ldarg_1); if (!property.PropertyType.IsValueType && typeof(TValue).IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, typeof(TValue)); } Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)setMethod); iLProcessor.Emit(OpCodes.Ret); return (SetDelegateRef<TInstance, TValue>)val.Generate().CreateDelegate(typeof(SetDelegateRef<TInstance, TValue>)); } finally { ((IDisposable)val)?.Dispose(); } } private static FastReflectionDelegate GenerateCallDelegate(this MethodInfo method) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0075: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) if (method == null) { throw new ArgumentException("Method cannot be null.", "method"); } DynamicMethodDefinition val = new DynamicMethodDefinition("CallDelegate<" + method.Name + ">", typeof(object), new Type[2] { typeof(object), typeof(object[]) }); try { ILProcessor iLProcessor = val.GetILProcessor(); ParameterInfo[] parameters = method.GetParameters(); if (!method.IsStatic) { iLProcessor.Emit(OpCodes.Ldarg_0); if (method.DeclaringType.GetTypeInfo().IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Unbox_Any, method.DeclaringType); } } for (int i = 0; i < parameters.Length; i++) { Type type = parameters[i].ParameterType; bool isByRef = type.IsByRef; if (isByRef) { type = type.GetElementType(); } bool isValueType = type.GetTypeInfo().IsValueType; if (isByRef && isValueType) { iLProcessor.Emit(OpCodes.Ldarg_1); iLProcessor.EmitFast_Ldc_I4(i); } iLProcessor.Emit(OpCodes.Ldarg_1); iLProcessor.EmitFast_Ldc_I4(i); if (isByRef && !isValueType) { Extensions.Emit(iLProcessor, OpCodes.Ldelema, typeof(object)); continue; } iLProcessor.Emit(OpCodes.Ldelem_Ref); if (isValueType) { Extensions.Emit(iLProcessor, (!isByRef) ? OpCodes.Unbox_Any : OpCodes.Unbox, type); } } if (method.IsFinal || !method.IsVirtual) { Extensions.Emit(iLProcessor, OpCodes.Call, (MethodBase)method); } else { Extensions.Emit(iLProcessor, OpCodes.Callvirt, (MethodBase)method); } Type type2 = (method.IsConstructor ? method.DeclaringType : method.ReturnType); if (type2 != typeof(void)) { if (type2.GetTypeInfo().IsValueType) { Extensions.Emit(iLProcessor, OpCodes.Box, type2); } } else { iLProcessor.Emit(OpCodes.Ldnull); } iLProcessor.Emit(OpCodes.Ret); return (FastReflectionDelegate)val.Generate().CreateDelegate(typeof(FastReflectionDelegate)); } finally { ((IDisposable)val)?.Dispose(); } } public static void EmitFast_Ldc_I4(this ILProcessor? il, int value) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) switch (value) { case -1: il.Emit(OpCodes.Ldc_I4_M1); return; case 0: il.Emit(OpCodes.Ldc_I4_0); return; case 1: il.Emit(OpCodes.Ldc_I4_1); return; case 2: il.Emit(OpCodes.Ldc_I4_2); return; case 3: il.Emit(OpCodes.Ldc_I4_3); return; case 4: il.Emit(OpCodes.Ldc_I4_4); return; case 5: il.Emit(OpCodes.Ldc_I4_5); return; case 6: il.Emit(OpCodes.Ldc_I4_6); return; case 7: il.Emit(OpCodes.Ldc_I4_7); return; case 8: il.Emit(OpCodes.Ldc_I4_8); return; } if (value > -129 && value < 128) { il.Emit(OpCodes.Ldc_I4_S, (sbyte)value); } else { il.Emit(OpCodes.Ldc_I4, value); } } public static byte ReadLocalIndex(OpCode opCode, object? operand) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (opCode == OpCodes.Ldloc_0 || opCode == OpCodes.Stloc_0) { return 0; } if (opCode == OpCodes.Ldloc_1 || opCode == OpCodes.Stloc_1) { return 1; } if (opCode == OpCodes.Ldloc_2 || opCode == OpCodes.Stloc_2) { return 2; } if (opCode == OpCodes.Ldloc_3 || opCode == OpCodes.Stloc_3) { return 3; } if (opCode == OpCodes.Ldloc_S || opCode == OpCodes.Stloc_S) { return (byte)operand; } throw new Exception($"Could not read index for opcode and operand: {opCode} - {operand}"); } public static bool GetTypesSafe(Assembly assembly, out Type[] assemblyTypes) { try { assemblyTypes = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { assemblyTypes = ex.Types.Where((Type t) => t != null).ToArray(); return false; } return true; } public static FieldInfo GetNestedField(Type type, string fieldName) { Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < nestedTypes.Length; i++) { FieldInfo field = nestedTypes[i].GetField(fieldName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } } return null; } public static MethodInfo GetNestedMethod(Type type, string methodName) { Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < nestedTypes.Length; i++) { MethodInfo method = nestedTypes[i].GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { return method; } } return null; } public static void LogCursorOpcodes(ILCursor cursor) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) int index = cursor.Index; cursor.Goto(0, (MoveType)0, false); while (cursor.Next != null) { Debug.Log((object)cursor.Next.OpCode); int index2 = cursor.Index; cursor.Index = index2 + 1; cursor.Goto(cursor.Index, (MoveType)0, false); } cursor.Index = index; } public static MethodInfo GetGenericMethod(Type type, string name, Type[] parameters) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name == name)) { continue; } ParameterInfo[] parameters2 = methodInfo.GetParameters(); if (parameters2.Length != parameters.Length) { continue; } bool flag = true; for (int j = 0; j < parameters.Length; j++) { if (parameters2[j].ParameterType.Name != parameters[j].Name) { flag = false; break; } } if (flag) { return methodInfo; } } return null; } public static bool IsSameOrSubclassOf<OtherType>(this Type type) { if (!(type == typeof(OtherType))) { return type.IsSubclassOf(typeof(OtherType)); } return true; } } internal class StringUtils { internal static void ThrowIfStringIsNullOrWhiteSpace(string stringToCheck, string paramName) { if (string.IsNullOrWhiteSpace(stringToCheck)) { throw new ArgumentNullException(paramName); } } } public static class SystemInitializerInjector { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__2_1; public static Action<SystemInitializerAttribute> <>9__2_2; public static Manipulator <>9__2_0; public static Func<MethodInfo, bool> <>9__8_0; internal void <applyHooksIfNeeded>b__2_0(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo<Queue<SystemInitializerAttribute>>((Expression<Action<Queue<SystemInitializerAttribute>>>)((Queue<SystemInitializerAttribute> _) => _.Enqueue(null)))) })) { val.Emit(OpCodes.Dup); val.EmitDelegate<Action<SystemInitializerAttribute>>((Action<SystemInitializerAttribute>)delegate(SystemInitializerAttribute instance) { <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { instance = instance }; if (((SearchableAttribute)CS$<>8__locals0.instance).target is MethodInfo key && _dependenciesToInject.TryGetValue(key, out HashSet<Type> value)) { value.RemoveWhere((Type t) => CS$<>8__locals0.instance.dependencies.Contains(t)); if (value.Count != 0) { int num = CS$<>8__locals0.instance.dependencies.Length; Array.Resize(ref CS$<>8__locals0.instance.dependencies, num + value.Count); value.CopyTo(CS$<>8__locals0.instance.dependencies, num); } } }); } else { R2API.Logger.LogError((object)"SystemInitializerInjector: Failed to find IL patch location"); } } internal bool <applyHooksIfNeeded>b__2_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo<Queue<SystemInitializerAttribute>>((Expression<Action<Queue<SystemInitializerAttribute>>>)((Queue<SystemInitializerAttribute> _) => _.Enqueue(null)))); } internal void <applyHooksIfNeeded>b__2_2(SystemInitializerAttribute instance) { <>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0 { instance = instance }; if (((SearchableAttribute)CS$<>8__locals0.instance).target is MethodInfo key && _dependenciesToInject.TryGetValue(key, out HashSet<Type> value)) { value.RemoveWhere((Type t) => CS$<>8__locals0.instance.dependencies.Contains(t)); if (value.Count != 0) { int num = CS$<>8__locals0.instance.dependencies.Length; Array.Resize(ref CS$<>8__locals0.instance.dependencies, num + value.Count); value.CopyTo(CS$<>8__locals0.instance.dependencies, num); } } } internal bool <GetAllSystemInitializerMethods>b__8_0(MethodInfo m) { return ((MemberInfo)m).GetCustomAttribute<SystemInitializerAttribute>() != null; } } [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public SystemInitializerAttribute instance; internal bool <applyHooksIfNeeded>b__4(Type t) { return instance.dependencies.Contains(t); } } private static readonly Dictionary<MethodInfo, HashSet<Type>> _dependenciesToInject = new Dictionary<MethodInfo, HashSet<Type>>(); private static bool _appliedHooks = false; private static void applyHooksIfNeeded() { //IL_001c: 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_0027: Expected O, but got Unknown if (_appliedHooks) { return; } object obj = <>c.<>9__2_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)SymbolExtensions.GetMethodInfo<Queue<SystemInitializerAttribute>>((Expression<Action<Queue<SystemInitializerAttribute>>>)((Queue<SystemInitializerAttribute> _) => _.Enqueue(null)))) })) { val2.Emit(OpCodes.Dup); val2.EmitDelegate<Action<SystemInitializerAttribute>>((Action<SystemInitializerAttribute>)delegate(SystemInitializerAttribute instance) { SystemInitializerAttribute instance2 = instance; if (((SearchableAttribute)instance2).target is MethodInfo key && _dependenciesToInject.TryGetValue(key, out HashSet<Type> value)) { value.RemoveWhere((Type t) => instance2.dependencies.Contains(t)); if (value.Count != 0) { int num = instance2.dependencies.Length; Array.Resize(ref instance2.dependencies, num + value.Count); value.CopyTo(instance2.dependencies, num); } } }); } else { R2API.Logger.LogError((object)"SystemInitializerInjector: Failed to find IL patch location"); } }; <>c.<>9__2_0 = val; obj = (object)val; } SystemInitializerAttribute.Execute += (Manipulator)obj; _appliedHooks = true; } public static void InjectDependencies<T>(params Type[] dependenciesToInject) { ThrowIfSystemInitializerExecuted(); Type typeFromHandle = typeof(T); foreach (Type dependency in dependenciesToInject) { InjectDependencyInternal(typeFromHandle, dependency); } } public static void InjectDependency<T>(Type dependencyToInject) { ThrowIfSystemInitializerExecuted(); InjectDependencyInternal(typeof(T), dependencyToInject); } public static void InjectDependencies(Type typeToInject, params Type[] dependenciesToInject) { ThrowIfSystemInitializerExecuted(); foreach (Type dependency in dependenciesToInject) { InjectDependencyInternal(typeToInject, dependency); } } public static void InjectDependency(Type typeToInject, Type dependencyToInject) { ThrowIfSystemInitializerExecuted(); InjectDependencyInternal(typeToInject, dependencyToInject); } private static void InjectDependencyInternal(Type typeToInject, Type dependency) { if ((object)typeToInject == null) { throw new ArgumentNullException("typeToInject"); } if ((object)dependency == null) { throw new ArgumentNullException("dependency"); } foreach (MethodInfo allSystemInitializerMethod in GetAllSystemInitializerMethods(typeToInject)) { InjectDependencyInternal(allSystemInitializerMethod, dependency); } } private static IEnumerable<MethodInfo> GetAllSystemInitializerMethods(Type type) { return from m in type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where ((MemberInfo)m).GetCustomAttribute<SystemInitializerAttribute>() != null select m; } public static void InjectDependency(MethodInfo initializerMethod, Type dependency) { ThrowIfSystemInitializerExecuted(); InjectDependencyInternal(initializerMethod, dependency); } public static void InjectDependencies(MethodInfo initializerMethod, params Type[] dependencies) { ThrowIfSystemInitializerExecuted(); foreach (Type dependency in dependencies) { InjectDependencyInternal(initializerMethod, dependency); } } private static void InjectDependencyInternal(MethodInfo initializerMethod, Type dependency) { if ((object)dependency == null) { throw new ArgumentNullException("dependency"); } if ((object)initializerMethod == null) { throw new ArgumentNullException("initializerMethod"); } if (((MemberInfo)initializerMethod).GetCustomAttribute<SystemInitializerAttribute>() == null) { R2API.Logger.LogWarning((object)("Not injecting SystemInitializer dependency " + dependency.FullName + " into " + initializerMethod.DeclaringType.FullName + "." + initializerMethod.Name + ": Method is missing SystemInitializerAttribute")); return; } if (!_dependenciesToInject.TryGetValue(initializerMethod, out HashSet<Type> value)) { _dependenciesToInject.Add(initializerMethod, value = new HashSet<Type>()); } if (value.Add(dependency)) { applyHooksIfNeeded(); R2API.Logger.LogDebug((object)("Injecting SystemInitializer dependency " + dependency.FullName + " into " + initializerMethod.DeclaringType.FullName + "." + initializerMethod.Name)); } } private static void ThrowIfSystemInitializerExecuted() { if (SystemInitializerAttribute.hasExecuted) { throw new InvalidOperationException("Cannot inject dependencies when SystemInitializer has already been executed"); } } } }
BepinEx/plugins/RiskofThunder-R2API_DamageType/R2API.DamageType/R2API.DamageType.dll
Decompiled 11 months agousing System; 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.Logging; using IL.RoR2; using IL.RoR2.Orbs; using IL.RoR2.Projectile; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using On.RoR2; using R2API.AutoVersionGen; using R2API.Utils; using RoR2; using RoR2.Orbs; using RoR2.Projectile; using RoR2BepInExPack.Utilities; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.DamageType")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4")] [assembly: AssemblyProduct("R2API.DamageType")] [assembly: AssemblyTitle("R2API.DamageType")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class DamageAPI { public enum ModdedDamageType { } public class ModdedDamageTypeHolder { private byte[] values = Array.Empty<byte>(); public ModdedDamageTypeHolder() { SetHooks(); } public ModdedDamageTypeHolder(byte[] values) { SetHooks(); if (values.Length != 0) { this.values = values.ToArray(); } } public void Add(ModdedDamageType moddedDamageType) { CompressedFlagArrayUtilities.Add(ref values, (int)moddedDamageType); } public bool Remove(ModdedDamageType moddedDamageType) { return CompressedFlagArrayUtilities.Remove(ref values, (int)moddedDamageType); } public bool Has(ModdedDamageType moddedDamageType) { return CompressedFlagArrayUtilities.Has(values, (int)moddedDamageType); } public void CopyTo(DamageInfo damageInfo) { CopyToInternal(damageInfo); } public void CopyTo(BulletAttack bulletAttack) { CopyToInternal(bulletAttack); } public void CopyTo(DamageOrb damageOrb) { CopyToInternal(damageOrb); } public void CopyTo(GenericDamageOrb genericDamageOrb) { CopyToInternal(genericDamageOrb); } public void CopyTo(LightningOrb lightningOrb) { CopyToInternal(lightningOrb); } public void CopyTo(BlastAttack blastAttack) { CopyToInternal(blastAttack); } public void CopyTo(OverlapAttack overlapAttack) { CopyToInternal(overlapAttack); } public void CopyTo(DotStack dotStack) { CopyToInternal(dotStack); } internal void CopyToInternal(object obj) { damageTypeHolders.Remove(obj); damageTypeHolders.Add(obj, MakeCopy()); } public ModdedDamageTypeHolder MakeCopy() { SetHooks(); return new ModdedDamageTypeHolder { values = ((values.Length == 0) ? values : values.ToArray()) }; } public static ModdedDamageTypeHolder ReadFromNetworkReader(NetworkReader reader) { SetHooks(); byte[] array = CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, ModdedDamageTypeCount); if (array.Length == 0) { return null; } return new ModdedDamageTypeHolder { values = array }; } public void WriteToNetworkWriter(NetworkWriter writer) { CompressedFlagArrayUtilities.WriteToNetworkWriter(values, writer, ModdedDamageTypeCount); } } public sealed class ModdedDamageTypeHolderComponent : MonoBehaviour { [HideInInspector] [SerializeField] private byte[] values = Array.Empty<byte>(); public void Add(ModdedDamageType moddedDamageType) { CompressedFlagArrayUtilities.Add(ref values, (int)moddedDamageType); } public bool Remove(ModdedDamageType moddedDamageType) { return CompressedFlagArrayUtilities.Remove(ref values, (int)moddedDamageType); } public bool Has(ModdedDamageType moddedDamageType) { return CompressedFlagArrayUtilities.Has(values, (int)moddedDamageType); } public void CopyTo(DamageInfo damageInfo) { CopyToInternal(damageInfo); } public void CopyTo(BulletAttack bulletAttack) { CopyToInternal(bulletAttack); } public void CopyTo(DamageOrb damageOrb) { CopyToInternal(damageOrb); } public void CopyTo(GenericDamageOrb genericDamageOrb) { CopyToInternal(genericDamageOrb); } public void CopyTo(LightningOrb lightningOrb) { CopyToInternal(lightningOrb); } public void CopyTo(BlastAttack blastAttack) { CopyToInternal(blastAttack); } public void CopyTo(OverlapAttack overlapAttack) { CopyToInternal(overlapAttack); } public void CopyTo(DotStack dotStack) { CopyToInternal(dotStack); } internal void CopyToInternal(object obj) { damageTypeHolders.Remove(obj); damageTypeHolders.Add(obj, new ModdedDamageTypeHolder(values)); } public ModdedDamageTypeHolder MakeHolder() { SetHooks(); return new ModdedDamageTypeHolder(values); } } private delegate void BlastAttackDamageInfoWriteDelegate(BlastAttackDamageInfoWriteOrig orig, ref BlastAttackDamageInfo self, NetworkWriter networkWriter); private delegate void BlastAttackDamageInfoWriteOrig(ref BlastAttackDamageInfo self, NetworkWriter networkWriter); private delegate void BlastAttackDamageInfoReadDelegate(BlastAttackDamageInfoReadOrig orig, ref BlastAttackDamageInfo self, NetworkReader networkReader); private delegate void BlastAttackDamageInfoReadOrig(ref BlastAttackDamageInfo self, NetworkReader networkReader); [CompilerGenerated] private static class <>O { public static hook_Write_NetworkWriter_DamageInfo <0>__WriteDamageInfo; public static hook_ReadDamageInfo <1>__ReadDamageInfo; public static Manipulator <2>__BulletAttackDefaultHitCallbackIL; public static Manipulator <3>__DamageOrbOnArrivalIL; public static Manipulator <4>__GenericDamageOrbOnArrivalIL; public static Manipulator <5>__LightningOrbOnArrivalIL; public static Manipulator <6>__ChainGunOrbOnArrivalIL; public static Manipulator <7>__DeathProjectileFixedUpdateIL; public static Manipulator <8>__ProjectileDotZoneResetOverlapIL; public static Manipulator <9>__ProjectileExplosionDetonateServerIL; public static Manipulator <10>__ProjectileGrantOnKillOnDestroyOnDestroyIL; public static Manipulator <11>__ProjectileIntervalOverlapAttackFixedUpdateIL; public static Manipulator <12>__ProjectileOverlapAttackStartIL; public static Manipulator <13>__ProjectileOverlapAttackResetOverlapAttackIL; public static Manipulator <14>__ProjectileProximityBeamControllerUpdateServerIL; public static Manipulator <15>__ProjectileSingleTargetImpactOnProjectileImpactIL; public static Manipulator <16>__DotControllerEvaluateDotStacksForTypeIL; public static Manipulator <17>__DotControllerAddPendingDamageEntryIL; public static Manipulator <18>__BlastAttackHandleHitsIL; public static Manipulator <19>__BlastAttackPerformDamageServerIL; public static BlastAttackDamageInfoWriteDelegate <20>__BlastAttackDamageInfoWrite; public static BlastAttackDamageInfoReadDelegate <21>__BlastAttackDamageInfoRead; public static Manipulator <22>__OverlapAttackProcessHitsIL; public static Manipulator <23>__OverlapAttackPerformDamageIL; public static hook_Serialize <24>__OverlapAttackMessageSerialize; public static hook_Deserialize <25>__OverlapAttackMessageDeserialize; public static Manipulator <26>__GlobalEventManagerOnHitAllIL; public static Manipulator <27>__HealthComponentSendDamageDealtIL; public static hook_Serialize <28>__DamageDealtMessageSerialize; public static hook_Deserialize <29>__DamageDealtMessageDeserialize; public static Manipulator <30>__ContactDamageFireOverlapsIL; public static Manipulator <31>__DelayBlastDetonateIL; } public const string PluginGUID = "com.bepis.r2api.damagetype"; public const string PluginName = "R2API.DamageType"; private static readonly FixedConditionalWeakTable<object, ModdedDamageTypeHolder> damageTypeHolders = new FixedConditionalWeakTable<object, ModdedDamageTypeHolder>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.4"; private static ModdedDamageTypeHolder TempHolder { get; set; } [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static int ModdedDamageTypeCount { get; private set; } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__WriteDamageInfo; if (obj == null) { hook_Write_NetworkWriter_DamageInfo val = WriteDamageInfo; <>O.<0>__WriteDamageInfo = val; obj = (object)val; } NetworkExtensions.Write_NetworkWriter_DamageInfo += (hook_Write_NetworkWriter_DamageInfo)obj; object obj2 = <>O.<1>__ReadDamageInfo; if (obj2 == null) { hook_ReadDamageInfo val2 = ReadDamageInfo; <>O.<1>__ReadDamageInfo = val2; obj2 = (object)val2; } NetworkExtensions.ReadDamageInfo += (hook_ReadDamageInfo)obj2; object obj3 = <>O.<2>__BulletAttackDefaultHitCallbackIL; if (obj3 == null) { Manipulator val3 = BulletAttackDefaultHitCallbackIL; <>O.<2>__BulletAttackDefaultHitCallbackIL = val3; obj3 = (object)val3; } BulletAttack.DefaultHitCallbackImplementation += (Manipulator)obj3; object obj4 = <>O.<3>__DamageOrbOnArrivalIL; if (obj4 == null) { Manipulator val4 = DamageOrbOnArrivalIL; <>O.<3>__DamageOrbOnArrivalIL = val4; obj4 = (object)val4; } DamageOrb.OnArrival += (Manipulator)obj4; object obj5 = <>O.<4>__GenericDamageOrbOnArrivalIL; if (obj5 == null) { Manipulator val5 = GenericDamageOrbOnArrivalIL; <>O.<4>__GenericDamageOrbOnArrivalIL = val5; obj5 = (object)val5; } GenericDamageOrb.OnArrival += (Manipulator)obj5; object obj6 = <>O.<5>__LightningOrbOnArrivalIL; if (obj6 == null) { Manipulator val6 = LightningOrbOnArrivalIL; <>O.<5>__LightningOrbOnArrivalIL = val6; obj6 = (object)val6; } LightningOrb.OnArrival += (Manipulator)obj6; object obj7 = <>O.<6>__ChainGunOrbOnArrivalIL; if (obj7 == null) { Manipulator val7 = ChainGunOrbOnArrivalIL; <>O.<6>__ChainGunOrbOnArrivalIL = val7; obj7 = (object)val7; } ChainGunOrb.OnArrival += (Manipulator)obj7; object obj8 = <>O.<7>__DeathProjectileFixedUpdateIL; if (obj8 == null) { Manipulator val8 = DeathProjectileFixedUpdateIL; <>O.<7>__DeathProjectileFixedUpdateIL = val8; obj8 = (object)val8; } DeathProjectile.FixedUpdate += (Manipulator)obj8; object obj9 = <>O.<8>__ProjectileDotZoneResetOverlapIL; if (obj9 == null) { Manipulator val9 = ProjectileDotZoneResetOverlapIL; <>O.<8>__ProjectileDotZoneResetOverlapIL = val9; obj9 = (object)val9; } ProjectileDotZone.ResetOverlap += (Manipulator)obj9; object obj10 = <>O.<9>__ProjectileExplosionDetonateServerIL; if (obj10 == null) { Manipulator val10 = ProjectileExplosionDetonateServerIL; <>O.<9>__ProjectileExplosionDetonateServerIL = val10; obj10 = (object)val10; } ProjectileExplosion.DetonateServer += (Manipulator)obj10; object obj11 = <>O.<10>__ProjectileGrantOnKillOnDestroyOnDestroyIL; if (obj11 == null) { Manipulator val11 = ProjectileGrantOnKillOnDestroyOnDestroyIL; <>O.<10>__ProjectileGrantOnKillOnDestroyOnDestroyIL = val11; obj11 = (object)val11; } ProjectileGrantOnKillOnDestroy.OnDestroy += (Manipulator)obj11; object obj12 = <>O.<11>__ProjectileIntervalOverlapAttackFixedUpdateIL; if (obj12 == null) { Manipulator val12 = ProjectileIntervalOverlapAttackFixedUpdateIL; <>O.<11>__ProjectileIntervalOverlapAttackFixedUpdateIL = val12; obj12 = (object)val12; } ProjectileIntervalOverlapAttack.FixedUpdate += (Manipulator)obj12; object obj13 = <>O.<12>__ProjectileOverlapAttackStartIL; if (obj13 == null) { Manipulator val13 = ProjectileOverlapAttackStartIL; <>O.<12>__ProjectileOverlapAttackStartIL = val13; obj13 = (object)val13; } ProjectileOverlapAttack.Start += (Manipulator)obj13; object obj14 = <>O.<13>__ProjectileOverlapAttackResetOverlapAttackIL; if (obj14 == null) { Manipulator val14 = ProjectileOverlapAttackResetOverlapAttackIL; <>O.<13>__ProjectileOverlapAttackResetOverlapAttackIL = val14; obj14 = (object)val14; } ProjectileOverlapAttack.ResetOverlapAttack += (Manipulator)obj14; object obj15 = <>O.<14>__ProjectileProximityBeamControllerUpdateServerIL; if (obj15 == null) { Manipulator val15 = ProjectileProximityBeamControllerUpdateServerIL; <>O.<14>__ProjectileProximityBeamControllerUpdateServerIL = val15; obj15 = (object)val15; } ProjectileProximityBeamController.UpdateServer += (Manipulator)obj15; object obj16 = <>O.<15>__ProjectileSingleTargetImpactOnProjectileImpactIL; if (obj16 == null) { Manipulator val16 = ProjectileSingleTargetImpactOnProjectileImpactIL; <>O.<15>__ProjectileSingleTargetImpactOnProjectileImpactIL = val16; obj16 = (object)val16; } ProjectileSingleTargetImpact.OnProjectileImpact += (Manipulator)obj16; object obj17 = <>O.<16>__DotControllerEvaluateDotStacksForTypeIL; if (obj17 == null) { Manipulator val17 = DotControllerEvaluateDotStacksForTypeIL; <>O.<16>__DotControllerEvaluateDotStacksForTypeIL = val17; obj17 = (object)val17; } DotController.EvaluateDotStacksForType += (Manipulator)obj17; object obj18 = <>O.<17>__DotControllerAddPendingDamageEntryIL; if (obj18 == null) { Manipulator val18 = DotControllerAddPendingDamageEntryIL; <>O.<17>__DotControllerAddPendingDamageEntryIL = val18; obj18 = (object)val18; } DotController.AddPendingDamageEntry += (Manipulator)obj18; object obj19 = <>O.<18>__BlastAttackHandleHitsIL; if (obj19 == null) { Manipulator val19 = BlastAttackHandleHitsIL; <>O.<18>__BlastAttackHandleHitsIL = val19; obj19 = (object)val19; } BlastAttack.HandleHits += (Manipulator)obj19; object obj20 = <>O.<19>__BlastAttackPerformDamageServerIL; if (obj20 == null) { Manipulator val20 = BlastAttackPerformDamageServerIL; <>O.<19>__BlastAttackPerformDamageServerIL = val20; obj20 = (object)val20; } BlastAttack.PerformDamageServer += (Manipulator)obj20; HookEndpointManager.Add((MethodBase)Reflection.GetMethodCached(typeof(BlastAttackDamageInfo), "Write"), (Delegate)new BlastAttackDamageInfoWriteDelegate(BlastAttackDamageInfoWrite)); HookEndpointManager.Add((MethodBase)Reflection.GetMethodCached(typeof(BlastAttackDamageInfo), "Read"), (Delegate)new BlastAttackDamageInfoReadDelegate(BlastAttackDamageInfoRead)); object obj21 = <>O.<22>__OverlapAttackProcessHitsIL; if (obj21 == null) { Manipulator val21 = OverlapAttackProcessHitsIL; <>O.<22>__OverlapAttackProcessHitsIL = val21; obj21 = (object)val21; } OverlapAttack.ProcessHits += (Manipulator)obj21; object obj22 = <>O.<23>__OverlapAttackPerformDamageIL; if (obj22 == null) { Manipulator val22 = OverlapAttackPerformDamageIL; <>O.<23>__OverlapAttackPerformDamageIL = val22; obj22 = (object)val22; } OverlapAttack.PerformDamage += (Manipulator)obj22; object obj23 = <>O.<24>__OverlapAttackMessageSerialize; if (obj23 == null) { hook_Serialize val23 = OverlapAttackMessageSerialize; <>O.<24>__OverlapAttackMessageSerialize = val23; obj23 = (object)val23; } OverlapAttackMessage.Serialize += (hook_Serialize)obj23; object obj24 = <>O.<25>__OverlapAttackMessageDeserialize; if (obj24 == null) { hook_Deserialize val24 = OverlapAttackMessageDeserialize; <>O.<25>__OverlapAttackMessageDeserialize = val24; obj24 = (object)val24; } OverlapAttackMessage.Deserialize += (hook_Deserialize)obj24; object obj25 = <>O.<26>__GlobalEventManagerOnHitAllIL; if (obj25 == null) { Manipulator val25 = GlobalEventManagerOnHitAllIL; <>O.<26>__GlobalEventManagerOnHitAllIL = val25; obj25 = (object)val25; } GlobalEventManager.OnHitAll += (Manipulator)obj25; object obj26 = <>O.<27>__HealthComponentSendDamageDealtIL; if (obj26 == null) { Manipulator val26 = HealthComponentSendDamageDealtIL; <>O.<27>__HealthComponentSendDamageDealtIL = val26; obj26 = (object)val26; } HealthComponent.SendDamageDealt += (Manipulator)obj26; object obj27 = <>O.<28>__DamageDealtMessageSerialize; if (obj27 == null) { hook_Serialize val27 = DamageDealtMessageSerialize; <>O.<28>__DamageDealtMessageSerialize = val27; obj27 = (object)val27; } DamageDealtMessage.Serialize += (hook_Serialize)obj27; object obj28 = <>O.<29>__DamageDealtMessageDeserialize; if (obj28 == null) { hook_Deserialize val28 = DamageDealtMessageDeserialize; <>O.<29>__DamageDealtMessageDeserialize = val28; obj28 = (object)val28; } DamageDealtMessage.Deserialize += (hook_Deserialize)obj28; object obj29 = <>O.<30>__ContactDamageFireOverlapsIL; if (obj29 == null) { Manipulator val29 = ContactDamageFireOverlapsIL; <>O.<30>__ContactDamageFireOverlapsIL = val29; obj29 = (object)val29; } ContactDamage.FireOverlaps += (Manipulator)obj29; object obj30 = <>O.<31>__DelayBlastDetonateIL; if (obj30 == null) { Manipulator val30 = DelayBlastDetonateIL; <>O.<31>__DelayBlastDetonateIL = val30; obj30 = (object)val30; } DelayBlast.Detonate += (Manipulator)obj30; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d0: 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_00db: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: 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_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown object obj = <>O.<0>__WriteDamageInfo; if (obj == null) { hook_Write_NetworkWriter_DamageInfo val = WriteDamageInfo; <>O.<0>__WriteDamageInfo = val; obj = (object)val; } NetworkExtensions.Write_NetworkWriter_DamageInfo -= (hook_Write_NetworkWriter_DamageInfo)obj; object obj2 = <>O.<1>__ReadDamageInfo; if (obj2 == null) { hook_ReadDamageInfo val2 = ReadDamageInfo; <>O.<1>__ReadDamageInfo = val2; obj2 = (object)val2; } NetworkExtensions.ReadDamageInfo -= (hook_ReadDamageInfo)obj2; object obj3 = <>O.<2>__BulletAttackDefaultHitCallbackIL; if (obj3 == null) { Manipulator val3 = BulletAttackDefaultHitCallbackIL; <>O.<2>__BulletAttackDefaultHitCallbackIL = val3; obj3 = (object)val3; } BulletAttack.DefaultHitCallbackImplementation -= (Manipulator)obj3; object obj4 = <>O.<3>__DamageOrbOnArrivalIL; if (obj4 == null) { Manipulator val4 = DamageOrbOnArrivalIL; <>O.<3>__DamageOrbOnArrivalIL = val4; obj4 = (object)val4; } DamageOrb.OnArrival -= (Manipulator)obj4; object obj5 = <>O.<4>__GenericDamageOrbOnArrivalIL; if (obj5 == null) { Manipulator val5 = GenericDamageOrbOnArrivalIL; <>O.<4>__GenericDamageOrbOnArrivalIL = val5; obj5 = (object)val5; } GenericDamageOrb.OnArrival -= (Manipulator)obj5; object obj6 = <>O.<5>__LightningOrbOnArrivalIL; if (obj6 == null) { Manipulator val6 = LightningOrbOnArrivalIL; <>O.<5>__LightningOrbOnArrivalIL = val6; obj6 = (object)val6; } LightningOrb.OnArrival -= (Manipulator)obj6; object obj7 = <>O.<6>__ChainGunOrbOnArrivalIL; if (obj7 == null) { Manipulator val7 = ChainGunOrbOnArrivalIL; <>O.<6>__ChainGunOrbOnArrivalIL = val7; obj7 = (object)val7; } ChainGunOrb.OnArrival -= (Manipulator)obj7; object obj8 = <>O.<7>__DeathProjectileFixedUpdateIL; if (obj8 == null) { Manipulator val8 = DeathProjectileFixedUpdateIL; <>O.<7>__DeathProjectileFixedUpdateIL = val8; obj8 = (object)val8; } DeathProjectile.FixedUpdate -= (Manipulator)obj8; object obj9 = <>O.<8>__ProjectileDotZoneResetOverlapIL; if (obj9 == null) { Manipulator val9 = ProjectileDotZoneResetOverlapIL; <>O.<8>__ProjectileDotZoneResetOverlapIL = val9; obj9 = (object)val9; } ProjectileDotZone.ResetOverlap -= (Manipulator)obj9; object obj10 = <>O.<9>__ProjectileExplosionDetonateServerIL; if (obj10 == null) { Manipulator val10 = ProjectileExplosionDetonateServerIL; <>O.<9>__ProjectileExplosionDetonateServerIL = val10; obj10 = (object)val10; } ProjectileExplosion.DetonateServer -= (Manipulator)obj10; object obj11 = <>O.<10>__ProjectileGrantOnKillOnDestroyOnDestroyIL; if (obj11 == null) { Manipulator val11 = ProjectileGrantOnKillOnDestroyOnDestroyIL; <>O.<10>__ProjectileGrantOnKillOnDestroyOnDestroyIL = val11; obj11 = (object)val11; } ProjectileGrantOnKillOnDestroy.OnDestroy -= (Manipulator)obj11; object obj12 = <>O.<11>__ProjectileIntervalOverlapAttackFixedUpdateIL; if (obj12 == null) { Manipulator val12 = ProjectileIntervalOverlapAttackFixedUpdateIL; <>O.<11>__ProjectileIntervalOverlapAttackFixedUpdateIL = val12; obj12 = (object)val12; } ProjectileIntervalOverlapAttack.FixedUpdate -= (Manipulator)obj12; object obj13 = <>O.<12>__ProjectileOverlapAttackStartIL; if (obj13 == null) { Manipulator val13 = ProjectileOverlapAttackStartIL; <>O.<12>__ProjectileOverlapAttackStartIL = val13; obj13 = (object)val13; } ProjectileOverlapAttack.Start -= (Manipulator)obj13; object obj14 = <>O.<13>__ProjectileOverlapAttackResetOverlapAttackIL; if (obj14 == null) { Manipulator val14 = ProjectileOverlapAttackResetOverlapAttackIL; <>O.<13>__ProjectileOverlapAttackResetOverlapAttackIL = val14; obj14 = (object)val14; } ProjectileOverlapAttack.ResetOverlapAttack -= (Manipulator)obj14; object obj15 = <>O.<14>__ProjectileProximityBeamControllerUpdateServerIL; if (obj15 == null) { Manipulator val15 = ProjectileProximityBeamControllerUpdateServerIL; <>O.<14>__ProjectileProximityBeamControllerUpdateServerIL = val15; obj15 = (object)val15; } ProjectileProximityBeamController.UpdateServer -= (Manipulator)obj15; object obj16 = <>O.<15>__ProjectileSingleTargetImpactOnProjectileImpactIL; if (obj16 == null) { Manipulator val16 = ProjectileSingleTargetImpactOnProjectileImpactIL; <>O.<15>__ProjectileSingleTargetImpactOnProjectileImpactIL = val16; obj16 = (object)val16; } ProjectileSingleTargetImpact.OnProjectileImpact -= (Manipulator)obj16; object obj17 = <>O.<16>__DotControllerEvaluateDotStacksForTypeIL; if (obj17 == null) { Manipulator val17 = DotControllerEvaluateDotStacksForTypeIL; <>O.<16>__DotControllerEvaluateDotStacksForTypeIL = val17; obj17 = (object)val17; } DotController.EvaluateDotStacksForType -= (Manipulator)obj17; object obj18 = <>O.<17>__DotControllerAddPendingDamageEntryIL; if (obj18 == null) { Manipulator val18 = DotControllerAddPendingDamageEntryIL; <>O.<17>__DotControllerAddPendingDamageEntryIL = val18; obj18 = (object)val18; } DotController.AddPendingDamageEntry -= (Manipulator)obj18; object obj19 = <>O.<18>__BlastAttackHandleHitsIL; if (obj19 == null) { Manipulator val19 = BlastAttackHandleHitsIL; <>O.<18>__BlastAttackHandleHitsIL = val19; obj19 = (object)val19; } BlastAttack.HandleHits -= (Manipulator)obj19; object obj20 = <>O.<19>__BlastAttackPerformDamageServerIL; if (obj20 == null) { Manipulator val20 = BlastAttackPerformDamageServerIL; <>O.<19>__BlastAttackPerformDamageServerIL = val20; obj20 = (object)val20; } BlastAttack.PerformDamageServer -= (Manipulator)obj20; HookEndpointManager.Remove((MethodBase)Reflection.GetMethodCached(typeof(BlastAttackDamageInfo), "Write"), (Delegate)new BlastAttackDamageInfoWriteDelegate(BlastAttackDamageInfoWrite)); HookEndpointManager.Remove((MethodBase)Reflection.GetMethodCached(typeof(BlastAttackDamageInfo), "Read"), (Delegate)new BlastAttackDamageInfoReadDelegate(BlastAttackDamageInfoRead)); object obj21 = <>O.<22>__OverlapAttackProcessHitsIL; if (obj21 == null) { Manipulator val21 = OverlapAttackProcessHitsIL; <>O.<22>__OverlapAttackProcessHitsIL = val21; obj21 = (object)val21; } OverlapAttack.ProcessHits -= (Manipulator)obj21; object obj22 = <>O.<23>__OverlapAttackPerformDamageIL; if (obj22 == null) { Manipulator val22 = OverlapAttackPerformDamageIL; <>O.<23>__OverlapAttackPerformDamageIL = val22; obj22 = (object)val22; } OverlapAttack.PerformDamage -= (Manipulator)obj22; object obj23 = <>O.<24>__OverlapAttackMessageSerialize; if (obj23 == null) { hook_Serialize val23 = OverlapAttackMessageSerialize; <>O.<24>__OverlapAttackMessageSerialize = val23; obj23 = (object)val23; } OverlapAttackMessage.Serialize -= (hook_Serialize)obj23; object obj24 = <>O.<25>__OverlapAttackMessageDeserialize; if (obj24 == null) { hook_Deserialize val24 = OverlapAttackMessageDeserialize; <>O.<25>__OverlapAttackMessageDeserialize = val24; obj24 = (object)val24; } OverlapAttackMessage.Deserialize -= (hook_Deserialize)obj24; object obj25 = <>O.<26>__GlobalEventManagerOnHitAllIL; if (obj25 == null) { Manipulator val25 = GlobalEventManagerOnHitAllIL; <>O.<26>__GlobalEventManagerOnHitAllIL = val25; obj25 = (object)val25; } GlobalEventManager.OnHitAll -= (Manipulator)obj25; object obj26 = <>O.<27>__HealthComponentSendDamageDealtIL; if (obj26 == null) { Manipulator val26 = HealthComponentSendDamageDealtIL; <>O.<27>__HealthComponentSendDamageDealtIL = val26; obj26 = (object)val26; } HealthComponent.SendDamageDealt -= (Manipulator)obj26; object obj27 = <>O.<28>__DamageDealtMessageSerialize; if (obj27 == null) { hook_Serialize val27 = DamageDealtMessageSerialize; <>O.<28>__DamageDealtMessageSerialize = val27; obj27 = (object)val27; } DamageDealtMessage.Serialize -= (hook_Serialize)obj27; object obj28 = <>O.<29>__DamageDealtMessageDeserialize; if (obj28 == null) { hook_Deserialize val28 = DamageDealtMessageDeserialize; <>O.<29>__DamageDealtMessageDeserialize = val28; obj28 = (object)val28; } DamageDealtMessage.Deserialize -= (hook_Deserialize)obj28; object obj29 = <>O.<30>__ContactDamageFireOverlapsIL; if (obj29 == null) { Manipulator val29 = ContactDamageFireOverlapsIL; <>O.<30>__ContactDamageFireOverlapsIL = val29; obj29 = (object)val29; } ContactDamage.FireOverlaps -= (Manipulator)obj29; object obj30 = <>O.<31>__DelayBlastDetonateIL; if (obj30 == null) { Manipulator val30 = DelayBlastDetonateIL; <>O.<31>__DelayBlastDetonateIL = val30; obj30 = (object)val30; } DelayBlast.Detonate -= (Manipulator)obj30; _hooksEnabled = false; } private static DamageInfo ReadDamageInfo(orig_ReadDamageInfo orig, NetworkReader reader) { DamageInfo val = orig.Invoke(reader); ModdedDamageTypeHolder moddedDamageTypeHolder = ModdedDamageTypeHolder.ReadFromNetworkReader(reader); if (moddedDamageTypeHolder != null) { damageTypeHolders.Add((object)val, moddedDamageTypeHolder); } return val; } private static void WriteDamageInfo(orig_Write_NetworkWriter_DamageInfo orig, NetworkWriter writer, DamageInfo damageInfo) { orig.Invoke(writer, damageInfo); ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue((object)damageInfo, ref moddedDamageTypeHolder)) { writer.Write((byte)0); } else { moddedDamageTypeHolder.WriteToNetworkWriter(writer); } } private static void BulletAttackDefaultHitCallbackIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyCallForNewDamageInfo(new ILCursor(il)); } private static void LightningOrbOnArrivalIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003e: 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) ILCursor val = new ILCursor(il); GotoAndEmitCopyCallForNewDamageInfo(val); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<LightningOrb>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyCall(val); } private static void GenericDamageOrbOnArrivalIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyCallForNewDamageInfo(new ILCursor(il)); } private static void DamageOrbOnArrivalIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyCallForNewDamageInfo(new ILCursor(il)); } private static void ChainGunOrbOnArrivalIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003e: 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) ILCursor val = new ILCursor(il); GotoAndEmitCopyCallForNewDamageInfo(val); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<ChainGunOrb>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyCall(val); } private static void ProjectileProximityBeamControllerUpdateServerIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<LightningOrb>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileOverlapAttackResetOverlapAttackIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_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_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_0034: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_0); val.Emit<ProjectileOverlapAttack>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileOverlapAttackStartIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<ProjectileOverlapAttack>(x, "attack") }); val.Emit(OpCodes.Ldarg_0); val.Emit<ProjectileOverlapAttack>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileIntervalOverlapAttackFixedUpdateIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<OverlapAttack>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileExplosionDetonateServerIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<BlastAttack>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileDotZoneResetOverlapIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<ProjectileDotZone>(x, "attack") }); val.Emit(OpCodes.Ldarg_0); val.Emit<ProjectileDotZone>(OpCodes.Ldfld, "attack"); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ProjectileSingleTargetImpactOnProjectileImpactIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyComponentCallForNewDamageInfo(new ILCursor(il)); } private static void ProjectileGrantOnKillOnDestroyOnDestroyIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyComponentCallForNewDamageInfo(new ILCursor(il)); } private static void DeathProjectileFixedUpdateIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GotoAndEmitCopyComponentCallForNewDamageInfo(new ILCursor(il)); } private static void DotControllerAddPendingDamageEntryIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int pendingDamageIndex = -1; FieldReference val2 = default(FieldReference); val.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref pendingDamageIndex), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 3), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref val2) }); val.Emit(OpCodes.Ldloc, pendingDamageIndex); EmitGetTempHolder(val); EmitAssignHolderCall(val); } private static void DotControllerEvaluateDotStacksForTypeIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown ILCursor val = new ILCursor(il); int dotStackIndex = -1; ILLabel val2 = default(ILLabel); val.GotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref dotStackIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<DotStack>(x, "dotIndex"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val2) }); val.Emit(OpCodes.Ldloc, dotStackIndex); EmitSetTempHolder(val); GotoAndEmitCopyCallForNewDamageInfo(new ILCursor(il)); } private static void BlastAttackDamageInfoRead(BlastAttackDamageInfoReadOrig orig, ref BlastAttackDamageInfo self, NetworkReader networkReader) { orig(ref self, networkReader); ModdedDamageTypeHolder moddedDamageTypeHolder = ModdedDamageTypeHolder.ReadFromNetworkReader(networkReader); if (moddedDamageTypeHolder != null) { TempHolder = moddedDamageTypeHolder; } } private static void BlastAttackDamageInfoWrite(BlastAttackDamageInfoWriteOrig orig, ref BlastAttackDamageInfo self, NetworkWriter networkWriter) { orig(ref self, networkWriter); ModdedDamageTypeHolder tempHolder = TempHolder; if (tempHolder == null) { networkWriter.Write((byte)0); } else { tempHolder.WriteToNetworkWriter(networkWriter); } } private static void BlastAttackPerformDamageServerIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); val.Emit(OpCodes.Dup); EmitGetTempHolder(val); EmitAssignHolderCall(val); } private static void BlastAttackHandleHitsIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<NetworkServer>(x, "get_active") }); val.Emit(OpCodes.Ldarg_0); EmitSetTempHolder(val); } private static void OverlapAttackMessageDeserialize(orig_Deserialize orig, MessageBase self, NetworkReader reader) { orig.Invoke(self, reader); ModdedDamageTypeHolder moddedDamageTypeHolder = ModdedDamageTypeHolder.ReadFromNetworkReader(reader); if (moddedDamageTypeHolder != null) { TempHolder = moddedDamageTypeHolder; } } private static void OverlapAttackMessageSerialize(orig_Serialize orig, MessageBase self, NetworkWriter writer) { orig.Invoke(self, writer); ModdedDamageTypeHolder tempHolder = TempHolder; if (tempHolder == null) { writer.Write((byte)0); } else { tempHolder.WriteToNetworkWriter(writer); } } private static void OverlapAttackPerformDamageIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); val.Emit(OpCodes.Dup); EmitGetTempHolder(val); EmitAssignHolderCall(val); } private static void OverlapAttackProcessHitsIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<NetworkServer>(x, "get_active") }); val.Emit(OpCodes.Ldarg_0); EmitSetTempHolder(val); } private static void GlobalEventManagerOnHitAllIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0067: 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) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "Behemoth") }); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<BlastAttack>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_1); EmitCopyCall(val); } private static void DamageDealtMessageDeserialize(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader) { orig.Invoke(self, reader); ModdedDamageTypeHolder moddedDamageTypeHolder = ModdedDamageTypeHolder.ReadFromNetworkReader(reader); if (moddedDamageTypeHolder != null) { damageTypeHolders.Add((object)self, moddedDamageTypeHolder); } } private static void DamageDealtMessageSerialize(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer) { orig.Invoke(self, writer); ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue((object)self, ref moddedDamageTypeHolder)) { writer.Write((byte)0); } else { moddedDamageTypeHolder.WriteToNetworkWriter(writer); } } private static void HealthComponentSendDamageDealtIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); val.Emit<DamageReport>(OpCodes.Ldfld, "damageInfo"); EmitCopyCall(val); } private static void DelayBlastDetonateIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<BlastAttack>(x) }); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void ContactDamageFireOverlapsIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ContactDamage>(x, "damageType") }); val.Emit(OpCodes.Ldarg_0); val.Emit<ContactDamage>(OpCodes.Ldfld, "overlapAttack"); val.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(val); } private static void EmitGetTempHolder(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Call, (MethodBase)Reflection.GetPropertyCached(typeof(DamageAPI), "TempHolder").GetGetMethod(nonPublic: true)); } private static void EmitSetTempHolder(ILCursor c) { //IL_0001: 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) c.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(DamageAPI), "MakeCopyOfModdedDamageTypeFromObject")); c.Emit(OpCodes.Call, (MethodBase)Reflection.GetPropertyCached(typeof(DamageAPI), "TempHolder").GetSetMethod(nonPublic: true)); } private static void GotoAndEmitCopyCallForNewDamageInfo(ILCursor c) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) c.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldarg_0); EmitCopyCall(c); } private static void GotoAndEmitCopyComponentCallForNewDamageInfo(ILCursor c) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) c.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); c.Emit(OpCodes.Dup); c.Emit(OpCodes.Ldarg_0); EmitCopyFromComponentCall(c); } private static void EmitCopyCall(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(DamageAPI), "CopyModdedDamageType")); } private static void CopyModdedDamageType(object to, object from) { ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (from != null && to != null && damageTypeHolders.TryGetValue(from, ref moddedDamageTypeHolder)) { moddedDamageTypeHolder.CopyToInternal(to); } } private static void EmitCopyFromComponentCall(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(DamageAPI), "CopyModdedDamageTypeFromComponent")); } private static void CopyModdedDamageTypeFromComponent(object to, Component from) { if (Object.op_Implicit((Object)(object)from) && to != null) { ModdedDamageTypeHolderComponent component = from.GetComponent<ModdedDamageTypeHolderComponent>(); if (Object.op_Implicit((Object)(object)component)) { component.CopyToInternal(to); } } } private static void EmitAssignHolderCall(ILCursor c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(DamageAPI), "AssignHolderToObject")); } private static void AssignHolderToObject(object obj, ModdedDamageTypeHolder holder) { if (holder != null && obj != null) { holder.CopyToInternal(obj); } } private static ModdedDamageTypeHolder MakeCopyOfModdedDamageTypeFromObject(object from) { if (from == null) { return null; } ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (damageTypeHolders.TryGetValue(from, ref moddedDamageTypeHolder)) { return moddedDamageTypeHolder.MakeCopy(); } return null; } public static ModdedDamageType ReserveDamageType() { SetHooks(); if (ModdedDamageTypeCount >= 1152) { throw new IndexOutOfRangeException($"Reached the limit of {1152} ModdedDamageTypes. Please contact R2API developers to increase the limit"); } return (ModdedDamageType)(ModdedDamageTypeCount++); } public static void AddModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(damageInfo, moddedDamageType); } public static void AddModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(bulletAttack, moddedDamageType); } public static void AddModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(damageOrb, moddedDamageType); } public static void AddModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(genericDamageOrb, moddedDamageType); } public static void AddModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(lightningOrb, moddedDamageType); } public static void AddModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(blastAttack, moddedDamageType); } public static void AddModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(overlapAttack, moddedDamageType); } public static void AddModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType) { AddModdedDamageTypeInternal(dotStack, moddedDamageType); } private static void AddModdedDamageTypeInternal(object obj, ModdedDamageType moddedDamageType) { SetHooks(); if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0) { throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1)); } ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue(obj, ref moddedDamageTypeHolder)) { damageTypeHolders.Add(obj, moddedDamageTypeHolder = new ModdedDamageTypeHolder()); } moddedDamageTypeHolder.Add(moddedDamageType); } public static bool RemoveModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(damageInfo, moddedDamageType); } public static bool RemoveModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(bulletAttack, moddedDamageType); } public static bool RemoveModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(damageOrb, moddedDamageType); } public static bool RemoveModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(genericDamageOrb, moddedDamageType); } public static bool RemoveModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(lightningOrb, moddedDamageType); } public static bool RemoveModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(blastAttack, moddedDamageType); } public static bool RemoveModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(overlapAttack, moddedDamageType); } public static bool RemoveModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType) { return RemoveModdedDamageTypeInternal(dotStack, moddedDamageType); } private static bool RemoveModdedDamageTypeInternal(object obj, ModdedDamageType moddedDamageType) { SetHooks(); if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0) { throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1)); } ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue(obj, ref moddedDamageTypeHolder)) { return false; } return moddedDamageTypeHolder.Remove(moddedDamageType); } public static bool HasModdedDamageType(this DamageInfo damageInfo, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(damageInfo, moddedDamageType); } public static bool HasModdedDamageType(this BulletAttack bulletAttack, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(bulletAttack, moddedDamageType); } public static bool HasModdedDamageType(this DamageOrb damageOrb, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(damageOrb, moddedDamageType); } public static bool HasModdedDamageType(this GenericDamageOrb genericDamageOrb, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(genericDamageOrb, moddedDamageType); } public static bool HasModdedDamageType(this LightningOrb lightningOrb, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(lightningOrb, moddedDamageType); } public static bool HasModdedDamageType(this BlastAttack blastAttack, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(blastAttack, moddedDamageType); } public static bool HasModdedDamageType(this OverlapAttack overlapAttack, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(overlapAttack, moddedDamageType); } public static bool HasModdedDamageType(this DotStack dotStack, ModdedDamageType moddedDamageType) { return HasModdedDamageTypeInternal(dotStack, moddedDamageType); } private static bool HasModdedDamageTypeInternal(object obj, ModdedDamageType moddedDamageType) { SetHooks(); if ((int)moddedDamageType >= ModdedDamageTypeCount || moddedDamageType < (ModdedDamageType)0) { throw new ArgumentOutOfRangeException(string.Format("Parameter '{0}' with value {1} is out of range of registered types (0-{2})", "moddedDamageType", moddedDamageType, ModdedDamageTypeCount - 1)); } ModdedDamageTypeHolder moddedDamageTypeHolder = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue(obj, ref moddedDamageTypeHolder)) { return false; } return moddedDamageTypeHolder.Has(moddedDamageType); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this DamageInfo damageInfo) { return GetModdedDamageTypeHolderInternal(damageInfo); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this BulletAttack bulletAttack) { return GetModdedDamageTypeHolderInternal(bulletAttack); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this DamageOrb damageOrb) { return GetModdedDamageTypeHolderInternal(damageOrb); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this GenericDamageOrb genericDamageOrb) { return GetModdedDamageTypeHolderInternal(genericDamageOrb); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this LightningOrb lightningOrb) { return GetModdedDamageTypeHolderInternal(lightningOrb); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this BlastAttack blastAttack) { return GetModdedDamageTypeHolderInternal(blastAttack); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this OverlapAttack overlapAttack) { return GetModdedDamageTypeHolderInternal(overlapAttack); } public static ModdedDamageTypeHolder GetModdedDamageTypeHolder(this DotStack dotStack) { return GetModdedDamageTypeHolderInternal(dotStack); } private static ModdedDamageTypeHolder GetModdedDamageTypeHolderInternal(object obj) { SetHooks(); ModdedDamageTypeHolder result = default(ModdedDamageTypeHolder); if (!damageTypeHolders.TryGetValue(obj, ref result)) { return null; } return result; } } [BepInPlugin("com.bepis.r2api.damagetype", "R2API.DamageType", "1.0.4")] public sealed class DamageTypePlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { DamageAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Deployable/R2API.Deployable/R2API.Deployable.dll
Decompiled 11 months agousing System; 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.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API.AutoVersionGen; using RoR2; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Deployable")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.Deployable")] [assembly: AssemblyTitle("R2API.Deployable")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class DeployableAPI { public delegate int GetDeployableSameSlotLimit(CharacterMaster self, int deployableCountMultiplier); [CompilerGenerated] private static class <>O { public static Manipulator <0>__GetDeployableSameSlotLimitIL; } public const string PluginGUID = "com.bepis.r2api.deployable"; public const string PluginName = "R2API.Deployable"; private static readonly Dictionary<DeployableSlot, GetDeployableSameSlotLimit> moddedDeployables; private static bool _hooksEnabled; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static int VanillaDeployableSlotCount { get; } public static int ModdedDeployableSlotCount { get; private set; } static DeployableAPI() { moddedDeployables = new Dictionary<DeployableSlot, GetDeployableSameSlotLimit>(); _hooksEnabled = false; VanillaDeployableSlotCount = Enum.GetValues(typeof(DeployableSlot)).Length; } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__GetDeployableSameSlotLimitIL; if (obj == null) { Manipulator val = GetDeployableSameSlotLimitIL; <>O.<0>__GetDeployableSameSlotLimitIL = val; obj = (object)val; } CharacterMaster.GetDeployableSameSlotLimit += (Manipulator)obj; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__GetDeployableSameSlotLimitIL; if (obj == null) { Manipulator val = GetDeployableSameSlotLimitIL; <>O.<0>__GetDeployableSameSlotLimitIL = val; obj = (object)val; } CharacterMaster.GetDeployableSameSlotLimit -= (Manipulator)obj; _hooksEnabled = false; } private static void GetDeployableSameSlotLimitIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0076: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel switchEndLabel = null; ILLabel[] array = default(ILLabel[]); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array), (Instruction x) => ILPatternMatchingExt.MatchBr(x, ref switchEndLabel) }); ILLabel val2 = il.DefineLabel(); val.Previous.Operand = val2; val.GotoLabel(switchEndLabel, (MoveType)0, false); val.Emit(OpCodes.Ldarg_0); val2.Target = val.Previous; val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc, 1); val.Emit(OpCodes.Ldloca, 0); val.Emit(OpCodes.Call, (MethodBase)typeof(DeployableAPI).GetMethod("GetModdedDeployableSameSlotLimit", BindingFlags.Static | BindingFlags.NonPublic)); } private static void GetModdedDeployableSameSlotLimit(CharacterMaster self, DeployableSlot slot, int deployableCountMultiplier, ref int slotLimit) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (moddedDeployables.TryGetValue(slot, out GetDeployableSameSlotLimit value)) { slotLimit = value(self, deployableCountMultiplier); } } public static DeployableSlot RegisterDeployableSlot(GetDeployableSameSlotLimit getDeployableSameSlotLimit) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) SetHooks(); if (getDeployableSameSlotLimit == null) { throw new ArgumentNullException("getDeployableSameSlotLimit can't be null"); } DeployableSlot val = (DeployableSlot)(VanillaDeployableSlotCount + ModdedDeployableSlotCount++); moddedDeployables[val] = getDeployableSameSlotLimit; return val; } } [BepInPlugin("com.bepis.r2api.deployable", "R2API.Deployable", "1.0.1")] public sealed class DeployablePlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { DeployableAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Difficulty/R2API.Difficulty/R2API.Difficulty.dll
Decompiled 11 months agousing System; using System.Collections.Concurrent; 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.AutoVersionGen; using R2API.ScriptableObjects; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Difficulty")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2")] [assembly: AssemblyProduct("R2API.Difficulty")] [assembly: AssemblyTitle("R2API.Difficulty")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public class DifficultyAPI { [CompilerGenerated] private static class <>O { public static hook_GetDifficultyDef <0>__GetExtendedDifficultyDef; public static hook_FromDifficulty <1>__InitialiseRuleBookAndFinalizeList; } public const string PluginGUID = "com.bepis.r2api.difficulty"; public const string PluginName = "R2API.Difficulty"; private static bool difficultyAlreadyAdded = false; private static readonly DifficultyIndex MinimumIndex = (DifficultyIndex)(-1); public static ConcurrentDictionary<DifficultyIndex, DifficultyDef?>? difficultyDefinitions = new ConcurrentDictionary<DifficultyIndex, DifficultyDef>(); private static HashSet<DifficultyDef> hiddenDifficulties = new HashSet<DifficultyDef>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.1.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static event EventHandler? DifficultyCatalogReady; public static DifficultyIndex AddDifficulty(DifficultyDef? difficulty) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return AddDifficultyInternal(difficulty, preferPositive: false, hidden: false); } public static DifficultyIndex AddDifficulty(DifficultyDef difficulty, Sprite difficultyIcon) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) SetHooks(); difficulty.foundIconSprite = true; difficulty.iconSprite = difficultyIcon; return AddDifficultyInternal(difficulty, preferPositive: false, hidden: false); } public static DifficultyIndex AddDifficulty(DifficultyDef? difficulty, bool preferPositive = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return AddDifficultyInternal(difficulty, preferPositive, hidden: false); } public static DifficultyIndex AddDifficulty(DifficultyDef? difficulty, bool preferPositive = false, bool hidden = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return AddDifficultyInternal(difficulty, preferPositive, hidden); } public static void AddDifficulty(SerializableDifficultyDef serializableDifficultyDef) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) SetHooks(); serializableDifficultyDef.CreateDifficultyDef(); serializableDifficultyDef.DifficultyIndex = AddDifficultyInternal(serializableDifficultyDef.DifficultyDef, serializableDifficultyDef.preferPositiveIndex, serializableDifficultyDef.hideFromDifficultySelection); } private static DifficultyIndex AddDifficultyInternal(DifficultyDef? difficulty, bool preferPositive, bool hidden) { //IL_003b: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (difficultyAlreadyAdded) { DifficultyPlugin.Logger.LogError((object)("Tried to add difficulty: " + difficulty.nameToken + " after difficulty list was created")); return (DifficultyIndex)(-1); } DifficultyIndex val = (DifficultyIndex)((!preferPositive) ? (MinimumIndex - 1 - difficultyDefinitions.Count) : ((DifficultyIndex)(11 + difficultyDefinitions.Count))); if (hidden) { hiddenDifficulties.Add(difficulty); } difficultyDefinitions[val] = difficulty; return val; } internal static void SetHooks() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if (_hooksEnabled) { return; } if (DifficultyAPI.DifficultyCatalogReady != null) { Delegate[] invocationList = DifficultyAPI.DifficultyCatalogReady.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { EventHandler eventHandler = (EventHandler)invocationList[i]; try { eventHandler(null, null); } catch (Exception ex) { DifficultyPlugin.Logger.LogError((object)ex); } } } object obj = <>O.<0>__GetExtendedDifficultyDef; if (obj == null) { hook_GetDifficultyDef val = GetExtendedDifficultyDef; <>O.<0>__GetExtendedDifficultyDef = val; obj = (object)val; } DifficultyCatalog.GetDifficultyDef += (hook_GetDifficultyDef)obj; object obj2 = <>O.<1>__InitialiseRuleBookAndFinalizeList; if (obj2 == null) { hook_FromDifficulty val2 = InitialiseRuleBookAndFinalizeList; <>O.<1>__InitialiseRuleBookAndFinalizeList = val2; obj2 = (object)val2; } RuleDef.FromDifficulty += (hook_FromDifficulty)obj2; _hooksEnabled = true; } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__GetExtendedDifficultyDef; if (obj == null) { hook_GetDifficultyDef val = GetExtendedDifficultyDef; <>O.<0>__GetExtendedDifficultyDef = val; obj = (object)val; } DifficultyCatalog.GetDifficultyDef -= (hook_GetDifficultyDef)obj; object obj2 = <>O.<1>__InitialiseRuleBookAndFinalizeList; if (obj2 == null) { hook_FromDifficulty val2 = InitialiseRuleBookAndFinalizeList; <>O.<1>__InitialiseRuleBookAndFinalizeList = val2; obj2 = (object)val2; } RuleDef.FromDifficulty -= (hook_FromDifficulty)obj2; _hooksEnabled = false; } private static DifficultyDef GetExtendedDifficultyDef(orig_GetDifficultyDef orig, DifficultyIndex difficultyIndex) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (difficultyAlreadyAdded) { if (!difficultyDefinitions.TryGetValue(difficultyIndex, out DifficultyDef value)) { return null; } return value; } return orig.Invoke(difficultyIndex); } private static RuleDef InitialiseRuleBookAndFinalizeList(orig_FromDifficulty orig) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) RuleDef val = orig.Invoke(); DifficultyDef[] difficultyDefs = DifficultyCatalog.difficultyDefs; if (!difficultyAlreadyAdded) { difficultyAlreadyAdded = true; for (int i = 0; i < difficultyDefs.Length; i++) { difficultyDefinitions[(DifficultyIndex)i] = difficultyDefs[i]; } } foreach (KeyValuePair<DifficultyIndex, DifficultyDef> difficultyDefinition in difficultyDefinitions) { try { if ((int)difficultyDefinition.Key < -1 || (int)difficultyDefinition.Key >= 11) { DifficultyDef value = difficultyDefinition.Value; RuleChoiceDef val2 = val.AddChoice(Language.GetString(value.nameToken), (object)null, false); if (value.foundIconSprite) { val2.sprite = value.iconSprite; } else { val2.spritePath = value.iconPath; } val2.tooltipNameToken = value.nameToken; val2.tooltipNameColor = value.color; val2.tooltipBodyToken = value.descriptionToken; val2.serverTag = value.serverTag; val2.excludeByDefault = hiddenDifficulties.Contains(value); val2.difficultyIndex = difficultyDefinition.Key; } } catch { } } val.choices.Sort(delegate(RuleChoiceDef x, RuleChoiceDef y) { //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) float scalingValue = DifficultyCatalog.GetDifficultyDef(x.difficultyIndex).scalingValue; float scalingValue2 = DifficultyCatalog.GetDifficultyDef(y.difficultyIndex).scalingValue; return scalingValue.CompareTo(scalingValue2); }); return val; } } [BepInPlugin("com.bepis.r2api.difficulty", "R2API.Difficulty", "1.1.2")] public sealed class DifficultyPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnEnable() { DifficultyAPI.SetHooks(); } private void OnDisable() { DifficultyAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.ScriptableObjects { [CreateAssetMenu(fileName = "new SerializableDifficultyDef", menuName = "R2API/SerializableDifficultyDef")] public class SerializableDifficultyDef : ScriptableObject { [Tooltip("Scaling value of the difficulty, Drizzle is 1, Rainstorm is 2, Monsoon is 3")] public float scalingValue; public string descriptionToken; public string nameToken; [Tooltip("Unique identifier for this Difficulty")] public string serverTag; [Tooltip("If true, beating the game on this difficulty will unlock the survivor's Mastery skin")] public bool countsAsHardMode; [Tooltip("If set to true, the difficulty index will be a possitive number, this causes the difficulty to have all the Eclipse modifiers (From 1 to 8)")] public bool preferPositiveIndex; [Tooltip("If set to true, the Difficulty will not be selectable on the lobby, and will be hidden.")] public bool hideFromDifficultySelection; public Color difficultyColor; public Sprite iconSprite; public DifficultyDef DifficultyDef { get; private set; } public DifficultyIndex DifficultyIndex { get; internal set; } internal void CreateDifficultyDef() { //IL_0019: 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_0034: Expected O, but got Unknown DifficultyDef = new DifficultyDef(scalingValue, nameToken, string.Empty, descriptionToken, difficultyColor, serverTag, countsAsHardMode); DifficultyDef.foundIconSprite = true; DifficultyDef.iconSprite = iconSprite; } } }
BepinEx/plugins/RiskofThunder-R2API_Director/R2API.Director/R2API.Director.dll
Decompiled 11 months 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.Logging; using HG; using HG.Reflection; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API.AddressReferencedAssets; using R2API.AutoVersionGen; using R2API.Utils; using RoR2; using RoR2.ExpansionManagement; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Director")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] [assembly: AssemblyProduct("R2API.Director")] [assembly: AssemblyTitle("R2API.Director")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [CreateAssetMenu(fileName = "New AddressableDCCSPool", menuName = "R2API/DirectorAPI/AddressableDCCSPool")] public class AddressableDCCSPool : ScriptableObject { [Serializable] public class PoolEntry { [Tooltip("The DCCS for this pool entry")] public AddressableDirectorCardCategorySelection dccs; [Tooltip("The weight of this pool entry relative to the others")] public float weight; internal virtual PoolEntry Upgrade() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown return new PoolEntry { dccs = dccs.targetCardCategorySelection, weight = weight }; } } [Serializable] public class ConditionalPoolEntry : PoolEntry { [Tooltip("ALL expansions in this list must be enabled for this run for this entry to be considered")] public AddressReferencedExpansionDef[] requiredExpansions = Array.Empty<AddressReferencedExpansionDef>(); internal override PoolEntry Upgrade() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown return (PoolEntry)new ConditionalPoolEntry { dccs = dccs.targetCardCategorySelection, requiredExpansions = requiredExpansions.Select((AddressReferencedExpansionDef x) => ((AddressReferencedAsset<ExpansionDef>)(object)x).Asset).ToArray(), weight = weight }; } } [Serializable] public class Category { [Tooltip("A name to help identify this category")] public string name; [Tooltip("The weight of all entries in this category relative to the sibling categories")] public float categoryWeight; [Tooltip("These entries are always considered")] public PoolEntry[] alwaysIncluded = Array.Empty<PoolEntry>(); [Tooltip("These entries are only considered if their individual conditions are met")] public ConditionalPoolEntry[] includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>(); [Tooltip("These entries are considered only if no entries from 'includedIfConditionsMet' have been includedd")] public PoolEntry[] includedIfNoConditionsMet = Array.Empty<PoolEntry>(); internal Category Upgrade() { //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_0011: 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_0052: 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_00c2: Expected O, but got Unknown return new Category { name = name, categoryWeight = categoryWeight, alwaysIncluded = alwaysIncluded.Select((PoolEntry x) => x.Upgrade()).ToArray(), includedIfConditionsMet = includedIfConditionsMet.Select((ConditionalPoolEntry x) => x.Upgrade()).Cast<ConditionalPoolEntry>().ToArray(), includedIfNoConditionsMet = includedIfNoConditionsMet.Select((PoolEntry x) => x.Upgrade()).ToArray() }; } } private static HashSet<AddressableDCCSPool> instances = new HashSet<AddressableDCCSPool>(); [Tooltip("The DccsPool that will be overwritten with the values stored in this AddressableDCCSPool")] public DccsPool targetPool; [Tooltip("The categories for this pool")] public Category[] poolCategories = Array.Empty<Category>(); [SystemInitializer(new Type[] { })] private static void SystemInitializer() { AddressReferencedAsset.OnAddressReferencedAssetsLoaded += delegate { foreach (AddressableDCCSPool instance in instances) { instance.Upgrade(); } }; } private void Upgrade() { Category[] array = poolCategories.Select((Category x) => x.Upgrade()).ToArray(); targetPool.poolCategories = array; poolCategories = null; } private void Awake() { instances.Add(this); } private void OnDestroy() { instances.Remove(this); } } [Serializable] public class AddressableDirectorCard { [Tooltip("The spawn card for this DirectorCard")] public AddressReferencedSpawnCard spawnCard; [Tooltip("The weight of this director card relative to other cards")] public int selectionWeight; [Tooltip("The distance used for spawning this card, used for monsters")] public MonsterSpawnDistance spawnDistance; public bool preventOverhead; [Tooltip("The minimum amount of stages that need to be completed before this Card can be spawned")] public int minimumStageCompletions; [Tooltip("This unlockableDef must be unlocked for this Card to spawn")] public AddressReferencedUnlockableDef requiredUnlockableDef; [Tooltip("This unlockableDef cannot be unlocked for this Card to spawn")] public AddressReferencedUnlockableDef forbiddenUnlockableDef; internal DirectorCard Upgrade() { //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_0016: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown return new DirectorCard { spawnCard = AddressReferencedAsset<SpawnCard>.op_Implicit((AddressReferencedAsset<SpawnCard>)(object)spawnCard), selectionWeight = selectionWeight, spawnDistance = spawnDistance, preventOverhead = preventOverhead, minimumStageCompletions = minimumStageCompletions, requiredUnlockableDef = AddressReferencedAsset<UnlockableDef>.op_Implicit((AddressReferencedAsset<UnlockableDef>)(object)requiredUnlockableDef), forbiddenUnlockableDef = AddressReferencedAsset<UnlockableDef>.op_Implicit((AddressReferencedAsset<UnlockableDef>)(object)forbiddenUnlockableDef) }; } } [CreateAssetMenu(fileName = "New AddressableDirectorCardCategorySelection", menuName = "R2API/DirectorAPI/AddressableDirectorCardCategorySelection")] public class AddressableDirectorCardCategorySelection : ScriptableObject { [Serializable] public struct Category { [Tooltip("The name of this category")] public string name; [Tooltip("The DirectorCards for this category")] public AddressableDirectorCard[] cards; [Tooltip("The weight of this category relative to the other categories")] public float selectionWeight; internal Category Upgrade() { //IL_0002: 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) Category result = default(Category); result.name = name; result.cards = cards.Select((AddressableDirectorCard x) => x.Upgrade()).ToArray(); result.selectionWeight = selectionWeight; return result; } } private static HashSet<AddressableDirectorCardCategorySelection> instances = new HashSet<AddressableDirectorCardCategorySelection>(); [Tooltip("The DirectorCardCategorySelection that will be overridedn with the values stored in this AddressableDirectorCardCategorySelection")] public DirectorCardCategorySelection targetCardCategorySelection; [Tooltip("The categories for this AddressableDirectorCardCategorySelection")] public Category[] categories = Array.Empty<Category>(); private void Upgrade() { targetCardCategorySelection.categories = categories.Select((Category x) => x.Upgrade()).ToArray(); categories = null; } private void Awake() { instances.Add(this); } private void OnDestroy() { instances.Remove(this); } [SystemInitializer(new Type[] { })] private static void SystemInitializer() { AddressReferencedAsset.OnAddressReferencedAssetsLoaded += delegate { foreach (AddressableDirectorCardCategorySelection instance in instances) { instance.Upgrade(); } }; } } [AutoVersion] public static class DirectorAPI { public enum MonsterCategory { Invalid, Custom, BasicMonsters, Minibosses, Champions, Special } public enum InteractableCategory { Invalid, Custom, Chests, Barrels, Shrines, Drones, Misc, Rare, Duplicator, VoidStuff } [Flags] public enum Stage { Custom = 1, TitanicPlains = 2, DistantRoost = 4, WetlandAspect = 8, AbandonedAqueduct = 0x10, RallypointDelta = 0x20, ScorchedAcres = 0x40, AbyssalDepths = 0x80, SirensCall = 0x100, GildedCoast = 0x200, MomentFractured = 0x400, Bazaar = 0x800, VoidCell = 0x1000, MomentWhole = 0x2000, SkyMeadow = 0x4000, ArtifactReliquary = 0x8000, Commencement = 0x10000, SunderedGrove = 0x20000, AphelianSanctuary = 0x40000, AphelianSanctuarySimulacrum = 0x80000, AbyssalDepthsSimulacrum = 0x100000, RallypointDeltaSimulacrum = 0x200000, TitanicPlainsSimulacrum = 0x400000, AbandonedAqueductSimulacrum = 0x800000, CommencementSimulacrum = 0x1000000, SkyMeadowSimulacrum = 0x2000000, SiphonedForest = 0x4000000, SulfurPools = 0x8000000, VoidLocus = 0x10000000, ThePlanetarium = 0x20000000 } public struct StageInfo { public Stage stage; public string CustomStageName; public static StageInfo ParseInternalStageName(string internalStageName) { SetHooks(); StageInfo result = default(StageInfo); result.stage = DirectorAPI.ParseInternalStageName(internalStageName); result.CustomStageName = ((result.stage == Stage.Custom) ? "" : internalStageName); return result; } public string ToInternalStageName() { SetHooks(); string text = DirectorAPI.ToInternalStageName(stage); if (!(text == "")) { return text; } return CustomStageName; } public bool CheckStage(Stage stage, params string[] customStageNames) { SetHooks(); if (!stage.HasFlag(this.stage)) { return false; } if (this.stage == Stage.Custom && customStageNames.Length != 0) { return customStageNames.Contains(CustomStageName); } return true; } } public class StageSettings { public int SceneDirectorMonsterCredits; public int SceneDirectorInteractableCredits; public Dictionary<GameObject, int>? BonusCreditObjects; public Dictionary<DirectorCardCategorySelection, Dictionary<string, float>> MonsterCategoryWeightsPerDccs; public Dictionary<DirectorCardCategorySelection, Dictionary<string, float>> InteractableCategoryWeightsPerDccs; } public class DirectorCardHolder { public DirectorCard? Card; public MonsterCategory MonsterCategory; public string CustomMonsterCategory; public float MonsterCategorySelectionWeight = 1f; public InteractableCategory InteractableCategory; public string CustomInteractableCategory; public float InteractableCategorySelectionWeight = 1f; public bool IsMonster => MonsterCategory != MonsterCategory.Invalid; public bool IsInteractable => InteractableCategory != InteractableCategory.Invalid; public bool IsValid() { SetHooks(); if (InteractableCategory == InteractableCategory.Invalid && MonsterCategory == MonsterCategory.Invalid) { return false; } return true; } public void ThrowIfInvalid() { SetHooks(); if (!IsValid()) { throw new Exception("Both DirectorCardHolder.InteractableCategory and DirectorCardHolder.MonsterCategory are invalid"); } } public string GetCategoryName() { SetHooks(); ThrowIfInvalid(); if (InteractableCategory == InteractableCategory.Invalid) { if (MonsterCategory == MonsterCategory.Custom) { return CustomMonsterCategory; } return Helpers.GetVanillaMonsterCategoryName(MonsterCategory); } if (InteractableCategory == InteractableCategory.Custom) { return CustomInteractableCategory; } return Helpers.GetVanillaInteractableCategoryName(InteractableCategory); } } public class MonsterFamilyHolder { public Dictionary<string, List<DirectorCard>> MonsterCategoryToMonsterCards; public Dictionary<string, float> MonsterCategoryToSelectionWeights; public int MinStageCompletion; public int MaxStageCompletion; public float FamilySelectionWeight; public string? SelectionChatString; } public static class Helpers { public static class MonsterNames { public static readonly string Beetle = "cscbeetle"; public static readonly string BeetleGuard = "cscbeetleguard"; public static readonly string BeetleQueen = "cscbeetlequeen"; public static readonly string BrassContraption = "cscbell"; public static readonly string BighornBison = "cscbison"; public static readonly string Mithrix = "cscbrother"; public static readonly string MithrixHurt = "cscbrotherhurt"; public static readonly string ClayDunestrider = "cscclayboss"; public static readonly string ClayTemplar = "cscclaybruiser"; public static readonly string StrikeDrone = "cscbackupdrone"; public static readonly string GunnerDrone = "cscdrone1"; public static readonly string HealingDrone = "cscdrone2"; public static readonly string TC280Prototype = "cscmegadrone"; public static readonly string OverloadingWorm = "cscelectricworm"; public static readonly string StoneGolem = "cscgolem"; public static readonly string Grandparent = "cscgrandparent"; public static readonly string Grovetender = "cscgravekeeper"; public static readonly string GreaterWisp = "cscgreaterwisp"; public static readonly string HermitCrab = "cschermitcrab"; public static readonly string Imp = "cscimp"; public static readonly string ImpOverlord = "cscimpboss"; public static readonly string Jellyfish = "cscjellyfish"; public static readonly string Lemurian = "csclemurian"; public static readonly string ElderLemurian = "csclemurianbruiser"; public static readonly string LunarChimeraExploder = "csclunarexploder"; public static readonly string LunarChimeraGolem = "csclunargolem"; public static readonly string LunarChimeraWisp = "csclunarwisp"; public static readonly string MagmaWorm = "cscmagmaworm"; public static readonly string MiniMushrum = "cscminimushroom"; public static readonly string VoidReaver = "cscnullifier"; public static readonly string VoidReaverAlly = "cscnullifierally"; public static readonly string Parent = "cscparent"; public static readonly string SolusControlUnit = "cscroboballboss"; public static readonly string SolusProbe = "cscroboballmini"; public static readonly string AlloyWorshipUnit = "cscsuperroboballboss"; public static readonly string Scavenger = "cscscav"; public static readonly string ScavengerBoss = "cscscavboss"; public static readonly string TwiptwiptheDevotee = "cscscavlunar"; public static readonly string StoneTitan = "csctitanblackbeach"; public static readonly string StoneTitanAbyssalDepths = "csctitandampcave"; public static readonly string StoneTitanGolemPlains = "csctitangolemplains"; public static readonly string StoneTitanAbandonedAqueduct = "csctitangoolake"; public static readonly string Aurelionite = "csctitangold"; public static readonly string WanderingVagrant = "cscvagrant"; public static readonly string AlloyVulture = "cscvulture"; public static readonly string LesserWisp = "csclesserwisp"; public static readonly string BeetleGuardAlly = "cscbeetleguardally"; public static readonly string DelightedProbe = "cscroboballgreenbuddy"; public static readonly string QuietProbe = "cscroboballredbuddy"; public static readonly string SquidTurret = "cscsquidturret"; public static readonly string AurelioniteAlly = "csctitangoldally"; public static readonly string Larva = "cscacidlarva"; public static readonly string Assassin = "cscassassin2"; public static readonly string ClayApothecary = "cscclaygrenadier"; public static readonly string ColDroneman = "cscdronecommander"; public static readonly string BlindPest = "cscflyingvermin"; public static readonly string BlindPestSnowy = "cscflyingverminsnowy"; public static readonly string Geep = "cscgeepbody"; public static readonly string Gip = "cscgipbody"; public static readonly string Gup = "cscgupbody"; public static readonly string MAJORCONSTRUCT_BODY_NAME = "cscmajorconstruct"; public static readonly string XiConstruct = "cscmegaconstruct"; public static readonly string AlphaConstruct = "cscminorconstruct"; public static readonly string AlphaConstructAttachable = "cscminorconstructattachable"; public static readonly string AlphaConstructOnKill = "cscminorconstructonkill"; public static readonly string BlindVermin = "cscvermin"; public static readonly string BlindVerminSnowy = "cscverminsnowy"; public static readonly string VoidBarnacle = "cscvoidbarnacle"; public static readonly string VoidBarnacleAlly = "cscvoidbarnacleally"; public static readonly string VoidBarnacleNoCast = "cscvoidbarnaclenocast"; public static readonly string VoidJailer = "cscvoidjailer"; public static readonly string VoidJailerAlly = "cscvoidjailerally"; public static readonly string VoidDevastator = "cscvoidmegacrab"; public static readonly string Voidling = "cscvoidraidcrab"; public static readonly string VoidlingJoint = "cscvoidraidcrabjoint"; public static readonly string VoidlingBase = "cscminivoidraidcrabbase"; public static readonly string VoidlingPhase1 = "cscminivoidraidcrabphase1"; public static readonly string VoidlingPhase2 = "cscminivoidraidcrabphase2"; public static readonly string VoidlingPhase3 = "cscminivoidraidcrabphase3"; public static readonly string VoidInfestor = "cscvoidinfestor"; public static readonly string MithrixInfiniteTower = "cscbrotherit"; public static readonly string ArchWisp = "cscarchwisp"; public static readonly string BeetleCrystal = "cscbeetlecrystal"; public static readonly string BeetleGuardCrystal = "cscbeetleguardcrystal"; public static readonly string MithrixGlass = "cscbrotherglass"; public static readonly string AncestralPod = "cscparentpod"; } public static class MonsterPoolCategories { public static readonly string Standard = "Standard"; public static readonly float StandardWeight = 0.98f; public static readonly string Family = "Family"; public static readonly float FamilyWeight = 0.02f; public static readonly string VoidInvasion = "VoidInvasion"; public static readonly float VoidInvasionWeight = 0.02f; } public static class InteractablePoolCategories { public static readonly string Standard = "Standard"; public static readonly float StandardWeight = 1f; } public static class InteractableNames { public static readonly string BrokenGunnerDrone = "iscbrokendrone1"; public static readonly string BrokenHealingDrone = "iscbrokendrone2"; public static readonly string BrokenEmergencyDrone = "iscbrokenemergencydrone"; public static readonly string BrokenEquipmentDrone = "iscbrokenequipmentdrone"; public static readonly string BrokenIncineratorDrone = "iscbrokenflamedrone"; public static readonly string BrokenTC280 = "iscbrokenmegadrone"; public static readonly string BrokenMissileDrone = "iscbrokenmissiledrone"; public static readonly string BrokenGunnerTurret = "iscbrokenturret1"; public static readonly string ScavengersSack = "iscscavbackpack"; public static readonly string ScavengersLunarSack = "iscscavlunarbackpack"; public static readonly string Barrel = "iscbarrel1"; public static readonly string AdaptiveChest = "isccasinochest"; public static readonly string ChestDamage = "isccategorychestdamage"; public static readonly string ChestHealing = "isccategorychesthealing"; public static readonly string ChestUtility = "isccategorychestutility"; public static readonly string Chest = "iscchest1"; public static readonly string CloakedChest = "iscchest1stealthed"; public static readonly string LargeChest = "iscchest2"; public static readonly string Printer3D = "iscduplicator"; public static readonly string Printer3DLarge = "iscduplicatorlarge"; public static readonly string PrinterMiliTech = "iscduplicatormilitary"; public static readonly string PrinterOvergrown3D = "iscduplicatorwild"; public static readonly string EquipmentBarrel = "iscequipmentbarrel"; public static readonly string LegendaryChest = "iscgoldchest"; public static readonly string LunarPod = "isclunarchest"; public static readonly string GoldPortal = "iscgoldshoresportal"; public static readonly string CelestialPortal = "iscmsportal"; public static readonly string BluePortal = "iscshopportal"; public static readonly string RadioScanner = "iscradartower"; public static readonly string Scrapper = "iscscrapper"; public static readonly string ShrineOfBlood = "iscshrineblood"; public static readonly string ShrineOfBloodSandy = "iscshrinebloodsandy"; public static readonly string ShrineOfBloodSnowy = "iscshrinebloodsnowy"; public static readonly string ShrineOftheMountain = "iscshrineboss"; public static readonly string ShrineOftheMountainSandy = "iscshrinebosssandy"; public static readonly string ShrineOftheMountainSnowy = "iscshrinebosssnowy"; public static readonly string ShrineOfChance = "iscshrinechance"; public static readonly string ShrineOfChanceSandy = "iscshrinechancesandy"; public static readonly string ShrineOfChanceSnowy = "iscshrinechancesnowy"; public static readonly string CleansingPool = "iscshrinecleanse"; public static readonly string CleansingPoolSandy = "iscshrinecleansesandy"; public static readonly string CleansingPoolSnowy = "iscshrinecleansesnowy"; public static readonly string ShrineOfCombat = "iscshrinecombat"; public static readonly string ShrineOfCombatSandy = "iscshrinecombatsandy"; public static readonly string ShrineOfCombatSnowy = "iscshrinecombatsnowy"; public static readonly string AltarOfGold = "iscshrinegoldshoresaccess"; public static readonly string ShrineOftheWoods = "iscshrinehealing"; public static readonly string ShrineOfOrder = "iscshrinerestack"; public static readonly string ShrineOfOrderSandy = "iscshrinerestacksandy"; public static readonly string ShrineOfOrderSnowy = "iscshrinerestacksnowy"; public static readonly string PrimordialTeleporter = "isclunarteleporter"; public static readonly string Teleporter = "iscteleporter"; public static readonly string TripleShop = "isctripleshop"; public static readonly string TripleShopEquipment = "isctripleshopequipment"; public static readonly string TripleShopLarge = "isctripleshoplarge"; public static readonly string HalcyonBeacon = "iscgoldshoresbeacon"; public static readonly string VoidRaidSafeWard = "iscvoidraidsafeward"; public static readonly string InfinitePortal = "iscinfinitetowerportal"; public static readonly string AssessmentFocus = "iscinfinitetowersafeward"; public static readonly string AssessmentFocusAwaitingInteraction = "iscinfinitetowersafewardawaitinginteraction"; public static readonly string LargeChestDamage = "isccategorychest2damage"; public static readonly string LargeChestHealing = "isccategorychest2healing"; public static readonly string LargeChestUtility = "isccategorychest2utility"; public static readonly string DeepVoidPortal = "iscdeepvoidportal"; public static readonly string DeepVoidSignal = "iscdeepvoidportalbattery"; public static readonly string VoidPortal = "iscvoidportal"; public static readonly string VoidSeed = "iscvoidcamp"; public static readonly string VoidCradle = "iscvoidchest"; public static readonly string Stalk = "iscvoidcoinbarrel"; public static readonly string VoidOutroPortal = "iscvoidoutroportal"; public static readonly string NewtAltar = "iscvoidsuppressor"; public static readonly string VoidPotential = "iscvoidtriple"; public static readonly string FreeChestMultiShop = "iscfreechest"; public static readonly string EncrustedLockbox = "isclockboxvoid"; public static readonly string GauntletEntranceOrb = "iscgauntletentrance"; public static readonly string SquidTurretMaster = "iscsquidturret"; public static readonly string RustyLockbox = "isclockbox"; } public static void TryApplyChangesNow() { SetHooks(); ClassicStageInfo.instance.ApplyChanges(); ClassicStageInfo.instance.RebuildCards(); } public static void PreventElites(string? monsterName, bool elitesAllowed) { string monsterName2 = monsterName; SetHooks(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { if (Object.op_Implicit((Object)(object)dccsPool)) { ForEachPoolEntryInDccsPool(dccsPool, delegate(PoolEntry poolEntry) { PreventElitesForPoolEntry(monsterName2, elitesAllowed, poolEntry); }); } foreach (DirectorCardHolder mixEnemyArtifactMonster in mixEnemyArtifactMonsters) { PreventElite(monsterName2, elitesAllowed, mixEnemyArtifactMonster.Card); } }; static void PreventElite(string? monsterName, bool elitesAllowed, DirectorCard card) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (string.Equals(((Object)card.spawnCard).name, monsterName, StringComparison.InvariantCultureIgnoreCase)) { ((CharacterSpawnCard)card.spawnCard).noElites = elitesAllowed; } } static void PreventElitesForPoolEntry(string? monsterName, bool elitesAllowed, PoolEntry poolEntry) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Category[] categories = poolEntry.dccs.categories; for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; foreach (DirectorCard card2 in cards) { PreventElite(monsterName, elitesAllowed, card2); } } } } [Obsolete("Use the overload with the DirectorCardHolder instead")] public static void AddNewMonster(DirectorCard? monsterCard, MonsterCategory monsterCategory) { SetHooks(); AddNewMonster(new DirectorCardHolder { Card = monsterCard, MonsterCategory = monsterCategory }, addToFamilies: false); } public static void AddNewMonster(DirectorCardHolder? monsterCard, bool addToFamilies) { SetHooks(); AddNewMonster(monsterCard, addToFamilies, null); } public static void AddNewMonster(DirectorCardHolder? monsterCard, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate) { DirectorCardHolder monsterCard2 = monsterCard; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2); }; } public static void AddNewMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, DirectorCardHolder monsterCardHolder, bool addToFamilies) { SetHooks(); AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCardHolder, addToFamilies, null); } public static void AddNewMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, DirectorCardHolder monsterCardHolder, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate) { DirectorCardHolder monsterCardHolder2 = monsterCardHolder; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); if (Object.op_Implicit((Object)(object)dccsPool)) { ForEachPoolCategoryInDccsPool(dccsPool, delegate(Category poolCategory) { bool num = poolCategory.name == MonsterPoolCategories.Standard; bool flag = !num; bool flag2 = addToFamilies && flag; if (num || flag2) { ForEachPoolEntryInDccsPoolCategory(poolCategory, delegate(PoolEntry poolEntry) { AddMonsterToPoolEntry(monsterCardHolder2, poolEntry, predicate2); }); } }); } mixEnemyArtifactMonsters?.Add(monsterCardHolder2); } private static void AddMonsterToPoolEntry(DirectorCardHolder monsterCardHolder, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate) { if ((predicate != null && predicate(poolEntry.dccs)) || predicate == null) { poolEntry.dccs.AddCard(monsterCardHolder); } } [Obsolete("Use the overload with the DirectorCardHolder instead")] public static void AddNewMonsterToStage(DirectorCard? monsterCard, MonsterCategory monsterCategory, Stage stage, string? customStageName = "") { SetHooks(); AddNewMonsterToStage(new DirectorCardHolder { Card = monsterCard, MonsterCategory = monsterCategory }, addToFamilies: false, stage, customStageName); } public static void AddNewMonsterToStage(DirectorCardHolder monsterCard, bool addToFamilies, Stage stage, string? customStageName = "") { SetHooks(); AddNewMonsterToStage(monsterCard, addToFamilies, null, stage, customStageName); } public static void AddNewMonsterToStage(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; DirectorCardHolder monsterCard2 = monsterCard; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2); } }; } public static void AddNewMonsterToStagesWhere(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<StageInfo> matchStage) { SetHooks(); AddNewMonsterToStagesWhere(monsterCard, addToFamilies, matchStage, null); } public static void AddNewMonsterToStagesWhere(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<StageInfo> matchStage, Predicate<DirectorCardCategorySelection> predicate) { Predicate<StageInfo> matchStage2 = matchStage; DirectorCardHolder monsterCard2 = monsterCard; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { if (matchStage2(currentStage)) { AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2); } }; } [Obsolete("Use the overload with the DirectorCardHolder instead")] public static void AddNewInteractable(DirectorCard? interactableCard, InteractableCategory interactableCategory) { SetHooks(); AddNewInteractable(new DirectorCardHolder { Card = interactableCard, InteractableCategory = interactableCategory }); } public static void AddNewInteractable(DirectorCardHolder? interactableCardHolder) { SetHooks(); AddNewInteractable(interactableCardHolder, null); } public static void AddNewInteractable(DirectorCardHolder? interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate) { DirectorCardHolder interactableCardHolder2 = interactableCardHolder; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage) { AddNewInteractableToStage(interactablesDccsPool, interactableCardHolder2, predicate2); }; } [Obsolete("Use the overload with the DirectorCardHolder instead")] public static void AddNewInteractableToStage(DirectorCard? interactableCard, InteractableCategory interactableCategory, Stage stage, string? customStageName = "") { SetHooks(); AddNewInteractableToStage(new DirectorCardHolder { Card = interactableCard, InteractableCategory = interactableCategory }, stage, customStageName); } public static void AddNewInteractableToStage(DirectorCardHolder interactableCardHolder, Stage stage, string customStageName = "") { SetHooks(); AddNewInteractableToStage(interactableCardHolder, null, stage, customStageName); } public static void AddNewInteractableToStage(DirectorCardHolder interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string customStageName = "") { string customStageName2 = customStageName; DirectorCardHolder interactableCardHolder2 = interactableCardHolder; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { AddNewInteractableToStage(interactablesDccsPool, interactableCardHolder2, predicate2); } }; } private static void AddNewInteractableToStage(DccsPool interactablesDccsPool, DirectorCardHolder interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate) { DirectorCardHolder interactableCardHolder2 = interactableCardHolder; Predicate<DirectorCardCategorySelection> predicate2 = predicate; if (Object.op_Implicit((Object)(object)interactablesDccsPool)) { ForEachPoolEntryInDccsPool(interactablesDccsPool, delegate(PoolEntry poolEntry) { AddInteractableToPoolEntry(interactableCardHolder2, poolEntry, predicate2); }); } } private static void AddInteractableToPoolEntry(DirectorCardHolder interactableCardHolder, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate) { if ((predicate != null && predicate(poolEntry.dccs)) || predicate == null) { poolEntry.dccs.AddCard(interactableCardHolder); } } public static void RemoveExistingMonster(string? monsterName) { SetHooks(); RemoveExistingMonster(monsterName, removeFromFamilies: true, null); } public static void RemoveExistingMonster(string? monsterName, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate) { Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); StringUtils.ThrowIfStringIsNullOrWhiteSpace(monsterName, "monsterName"); string monsterNameLowered = monsterName.ToLowerInvariant(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { RemoveExistingMonster(dccsPool, mixEnemyArtifactMonsters, monsterNameLowered, removeFromFamilies, predicate2); }; } private static void RemoveExistingMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, string monsterNameLowered, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate) { string monsterNameLowered2 = monsterNameLowered; Predicate<DirectorCardCategorySelection> predicate2 = predicate; if (Object.op_Implicit((Object)(object)dccsPool)) { ForEachPoolCategoryInDccsPool(dccsPool, delegate(Category poolCategory) { bool num = poolCategory.name == MonsterPoolCategories.Standard; bool flag = !num; bool flag2 = removeFromFamilies && flag; if (num || flag2) { ForEachPoolEntryInDccsPoolCategory(poolCategory, delegate(PoolEntry poolEntry) { RemoveMonsterFromPoolEntry(monsterNameLowered2, poolEntry, predicate2); }); } }); } mixEnemyArtifactMonsters.RemoveAll((DirectorCardHolder card) => ((Object)card.Card.spawnCard).name.ToLowerInvariant() == monsterNameLowered2); } private static void RemoveMonsterFromPoolEntry(string monsterNameLowered, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate) { string monsterNameLowered2 = monsterNameLowered; if ((predicate == null || !predicate(poolEntry.dccs)) && predicate != null) { return; } for (int i = 0; i < poolEntry.dccs.categories.Length; i++) { List<DirectorCard> list = poolEntry.dccs.categories[i].cards.ToList(); list.RemoveAll((DirectorCard card) => ((Object)card.spawnCard).name.ToLowerInvariant() == monsterNameLowered2); poolEntry.dccs.categories[i].cards = list.ToArray(); } } public static void RemoveExistingMonsterFromStage(string? monsterName, Stage stage, string? customStageName = "") { SetHooks(); RemoveExistingMonsterFromStage(monsterName, removeFromFamilies: true, null, stage, customStageName); } public static void RemoveExistingMonsterFromStage(string? monsterName, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); StringUtils.ThrowIfStringIsNullOrWhiteSpace(monsterName, "monsterName"); string monsterNameLowered = monsterName.ToLowerInvariant(); MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { RemoveExistingMonster(dccsPool, mixEnemyArtifactMonsters, monsterNameLowered, removeFromFamilies, predicate2); } }; } public static void RemoveExistingInteractable(string? interactableName) { SetHooks(); RemoveExistingInteractable(interactableName, null); } public static void RemoveExistingInteractable(string? interactableName, Predicate<DirectorCardCategorySelection> predicate) { Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); StringUtils.ThrowIfStringIsNullOrWhiteSpace(interactableName, "interactableName"); string interactableNameLowered = interactableName.ToLowerInvariant(); InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage) { RemoveExistingInteractable(interactablesDccsPool, interactableNameLowered, predicate2); }; } public static void RemoveExistingInteractableFromStage(string? interactableName, Stage stage, string? customStageName = "") { SetHooks(); RemoveExistingInteractableFromStage(interactableName, null, stage, customStageName); } public static void RemoveExistingInteractableFromStage(string? interactableName, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; Predicate<DirectorCardCategorySelection> predicate2 = predicate; SetHooks(); StringUtils.ThrowIfStringIsNullOrWhiteSpace(interactableName, "interactableName"); string interactableNameLowered = interactableName.ToLowerInvariant(); InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { RemoveExistingInteractable(interactablesDccsPool, interactableNameLowered, predicate2); } }; } private static void RemoveExistingInteractable(DccsPool interactablesDccsPool, string interactableNameLowered, Predicate<DirectorCardCategorySelection> predicate) { string interactableNameLowered2 = interactableNameLowered; Predicate<DirectorCardCategorySelection> predicate2 = predicate; if (Object.op_Implicit((Object)(object)interactablesDccsPool)) { ForEachPoolEntryInDccsPool(interactablesDccsPool, delegate(PoolEntry poolEntry) { RemoveInteractableFromPoolEntry(interactableNameLowered2, poolEntry, predicate2); }); } } private static void RemoveInteractableFromPoolEntry(string interactableNameLowered, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate) { string interactableNameLowered2 = interactableNameLowered; if ((predicate == null || !predicate(poolEntry.dccs)) && predicate != null) { return; } for (int i = 0; i < poolEntry.dccs.categories.Length; i++) { List<DirectorCard> list = poolEntry.dccs.categories[i].cards.ToList(); list.RemoveAll((DirectorCard card) => ((Object)card.spawnCard).name.ToLowerInvariant() == interactableNameLowered2); poolEntry.dccs.categories[i].cards = list.ToArray(); } } public static void AddSceneMonsterCredits(int increase, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorMonsterCredits += increase; } }; } public static void AddSceneInteractableCredits(int increase, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorInteractableCredits += increase; } }; } public static void MultiplySceneMonsterCredits(int multiplier, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorMonsterCredits *= multiplier; } }; } public static void MultiplySceneInteractableCredits(int multiplier, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorInteractableCredits *= multiplier; } }; } public static void ReduceSceneMonsterCredits(int divisor, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorMonsterCredits /= divisor; } }; } public static void ReduceSceneInteractableCredits(int divisor, Stage stage, string? customStageName = "") { string customStageName2 = customStageName; SetHooks(); StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage) { if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2)) { settings.SceneDirectorInteractableCredits /= divisor; } }; } public static void ForEachPoolEntryInDccsPool(DccsPool dccsPool, Action<PoolEntry> action) { Action<PoolEntry> action2 = action; SetHooks(); ForEachPoolCategoryInDccsPool(dccsPool, delegate(Category poolCategory) { ForEachPoolEntryInDccsPoolCategory(poolCategory, action2); }); } public static void ForEachPoolCategoryInDccsPool(DccsPool dccsPool, Action<Category> action) { SetHooks(); Category[] poolCategories = dccsPool.poolCategories; foreach (Category obj in poolCategories) { try { action(obj); } catch (Exception ex) { DirectorPlugin.Logger.LogError((object)ex); } } } public static void ForEachPoolEntryInDccsPoolCategory(Category dccsPoolCategory, Action<PoolEntry> action) { Action<PoolEntry> action2 = action; SetHooks(); CallAction(dccsPoolCategory.alwaysIncluded); PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)dccsPoolCategory.includedIfConditionsMet; CallAction(includedIfConditionsMet); CallAction(dccsPoolCategory.includedIfNoConditionsMet); void CallAction(PoolEntry[] poolEntries) { foreach (PoolEntry obj in poolEntries) { try { action2(obj); } catch (Exception ex) { DirectorPlugin.Logger.LogError((object)ex); } } } } public static bool IsSameMonsterCategory(ref Category category, MonsterCategory monsterCategory) { SetHooks(); return GetMonsterCategory(category.name) == monsterCategory; } public static MonsterCategory GetMonsterCategory(string categoryString) { SetHooks(); if (string.IsNullOrWhiteSpace(categoryString)) { throw new ArgumentException("categoryString"); } return categoryString switch { "Champions" => MonsterCategory.Champions, "Minibosses" => MonsterCategory.Minibosses, "Basic Monsters" => MonsterCategory.BasicMonsters, "Special" => MonsterCategory.Special, _ => MonsterCategory.Custom, }; } public static string GetVanillaMonsterCategoryName(MonsterCategory monsterCategory) { SetHooks(); switch (monsterCategory) { case MonsterCategory.BasicMonsters: return "Basic Monsters"; case MonsterCategory.Champions: return "Champions"; case MonsterCategory.Minibosses: return "Minibosses"; case MonsterCategory.Special: return "Special"; default: { int num = (int)monsterCategory; throw new ArgumentException(num.ToString()); } } } public static InteractableCategory GetInteractableCategory(string categoryString) { SetHooks(); if (string.IsNullOrWhiteSpace(categoryString)) { throw new ArgumentException("categoryString"); } return categoryString switch { "Chests" => InteractableCategory.Chests, "Barrels" => InteractableCategory.Barrels, "Shrines" => InteractableCategory.Shrines, "Drones" => InteractableCategory.Drones, "Misc" => InteractableCategory.Misc, "Rare" => InteractableCategory.Rare, "Duplicator" => InteractableCategory.Duplicator, "Void Stuff" => InteractableCategory.VoidStuff, _ => InteractableCategory.Custom, }; } public static string GetVanillaInteractableCategoryName(InteractableCategory interactableCategory) { SetHooks(); switch (interactableCategory) { case InteractableCategory.Chests: return "Chests"; case InteractableCategory.Barrels: return "Barrels"; case InteractableCategory.Shrines: return "Shrines"; case InteractableCategory.Drones: return "Drones"; case InteractableCategory.Misc: return "Misc"; case InteractableCategory.Rare: return "Rare"; case InteractableCategory.Duplicator: return "Duplicator"; case InteractableCategory.VoidStuff: return "Void Stuff"; default: { int num = (int)interactableCategory; throw new ArgumentException(num.ToString()); } } } public static bool IsSameInteractableCategory(ref Category category, InteractableCategory interactableCategory) { SetHooks(); return GetInteractableCategory(category.name) == interactableCategory; } } public class OriginalClassicStageInfo { public List<Category> monsterDccsPoolCategories; public DirectorCardCategorySelection monsterCategories; public List<MonsterFamily> possibleMonsterFamilies; public List<Category> interactableDccsPoolCategories; public DirectorCardCategorySelection interactableCategories; } [CompilerGenerated] private static class <>O { public static hook_Start <0>__ApplyChangesOnStart; public static Manipulator <1>__SwapVanillaDccsWithOurs; public static hook_Init <2>__InitStageEnumToSceneDefs; public static Func<DirectorCardCategorySelection, DirectorCardCategorySelection> <3>__SwapDccs; } public const string PluginGUID = "com.bepis.r2api.director"; public const string PluginName = "R2API.Director"; private static DirectorCardCategorySelection _dccsMixEnemyArtifact; private static bool _hooksEnabled = false; private static readonly Dictionary<string, OriginalClassicStageInfo> _classicStageInfoNameToOriginalClassicStageInfos = new Dictionary<string, OriginalClassicStageInfo>(); public const string PluginVersion = "2.1.0"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static Dictionary<Stage, SceneDef[]> VanillaStageToSceneDefs { get; private set; } = new Dictionary<Stage, SceneDef[]>(); public static event Action<StageSettings, StageInfo>? StageSettingsActions; public static event Action<DccsPool, List<DirectorCardHolder>, StageInfo>? MonsterActions; public static event Action<DccsPool, StageInfo>? InteractableActions; public static Stage ParseInternalStageName(string internalStageName) { return internalStageName switch { "golemplains" => Stage.TitanicPlains, "blackbeach" => Stage.DistantRoost, "foggyswamp" => Stage.WetlandAspect, "goolake" => Stage.AbandonedAqueduct, "frozenwall" => Stage.RallypointDelta, "wispgraveyard" => Stage.ScorchedAcres, "dampcavesimple" => Stage.AbyssalDepths, "shipgraveyard" => Stage.SirensCall, "goldshores" => Stage.GildedCoast, "mysteryspace" => Stage.MomentFractured, "bazaar" => Stage.Bazaar, "arena" => Stage.VoidCell, "limbo" => Stage.MomentWhole, "skymeadow" => Stage.SkyMeadow, "artifactworld" => Stage.ArtifactReliquary, "moon2" => Stage.Commencement, "rootjungle" => Stage.SunderedGrove, "ancientloft" => Stage.AphelianSanctuary, "itancientloft" => Stage.AphelianSanctuarySimulacrum, "itdampcave" => Stage.AbyssalDepthsSimulacrum, "itfrozenwall" => Stage.RallypointDeltaSimulacrum, "itgolemplains" => Stage.TitanicPlainsSimulacrum, "itgoolake" => Stage.AbandonedAqueductSimulacrum, "itmoon" => Stage.CommencementSimulacrum, "itskymeadow" => Stage.SkyMeadowSimulacrum, "snowyforest" => Stage.SiphonedForest, "sulfurpools" => Stage.SulfurPools, "voidraid" => Stage.ThePlanetarium, "voidstage" => Stage.VoidLocus, _ => Stage.Custom, }; } public static Stage GetStageEnumFromSceneDef(SceneDef sceneDef) { return ParseInternalStageName(sceneDef.baseSceneName); } public static string ToInternalStageName(Stage stage) { return stage switch { Stage.TitanicPlains => "golemplains", Stage.DistantRoost => "blackbeach", Stage.WetlandAspect => "foggyswamp", Stage.AbandonedAqueduct => "goolake", Stage.RallypointDelta => "frozenwall", Stage.ScorchedAcres => "wispgraveyard", Stage.AbyssalDepths => "dampcavesimple", Stage.SirensCall => "shipgraveyard", Stage.GildedCoast => "goldshores", Stage.MomentFractured => "mysteryspace", Stage.Bazaar => "bazaar", Stage.VoidCell => "arena", Stage.MomentWhole => "limbo", Stage.SkyMeadow => "skymeadow", Stage.ArtifactReliquary => "artifactworld", Stage.Commencement => "moon2", Stage.SunderedGrove => "rootjungle", Stage.AphelianSanctuary => "ancientloft", Stage.AphelianSanctuarySimulacrum => "itancientloft", Stage.AbyssalDepthsSimulacrum => "itdampcave", Stage.RallypointDeltaSimulacrum => "itfrozenwall", Stage.TitanicPlainsSimulacrum => "itgolemplains", Stage.AbandonedAqueductSimulacrum => "itgoolake", Stage.CommencementSimulacrum => "itmoon", Stage.SkyMeadowSimulacrum => "itskymeadow", Stage.SiphonedForest => "snowyforest", Stage.SulfurPools => "sulfurpools", Stage.VoidLocus => "voidstage", Stage.ThePlanetarium => "voidraid", _ => "", }; } public static int AddCard(this DirectorCardCategorySelection dccs, DirectorCardHolder cardHolder) { SetHooks(); string categoryName = cardHolder.GetCategoryName(); for (int i = 0; i < dccs.categories.Length; i++) { if (dccs.categories[i].name == categoryName) { ArrayUtils.ArrayAppend<DirectorCard>(ref dccs.categories[i].cards, ref cardHolder.Card); return dccs.categories[i].cards.Length - 1; } } float num = (cardHolder.IsMonster ? cardHolder.MonsterCategorySelectionWeight : cardHolder.InteractableCategorySelectionWeight); int num2 = dccs.AddCategory(categoryName, num); return dccs.AddCard(num2, cardHolder.Card); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__ApplyChangesOnStart; if (obj == null) { hook_Start val = ApplyChangesOnStart; <>O.<0>__ApplyChangesOnStart = val; obj = (object)val; } ClassicStageInfo.Start += (hook_Start)obj; object obj2 = <>O.<1>__SwapVanillaDccsWithOurs; if (obj2 == null) { Manipulator val2 = SwapVanillaDccsWithOurs; <>O.<1>__SwapVanillaDccsWithOurs = val2; obj2 = (object)val2; } ClassicStageInfo.HandleMixEnemyArtifact += (Manipulator)obj2; object obj3 = <>O.<2>__InitStageEnumToSceneDefs; if (obj3 == null) { hook_Init val3 = InitStageEnumToSceneDefs; <>O.<2>__InitStageEnumToSceneDefs = val3; obj3 = (object)val3; } SceneCatalog.Init += (hook_Init)obj3; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__ApplyChangesOnStart; if (obj == null) { hook_Start val = ApplyChangesOnStart; <>O.<0>__ApplyChangesOnStart = val; obj = (object)val; } ClassicStageInfo.Start -= (hook_Start)obj; object obj2 = <>O.<1>__SwapVanillaDccsWithOurs; if (obj2 == null) { Manipulator val2 = SwapVanillaDccsWithOurs; <>O.<1>__SwapVanillaDccsWithOurs = val2; obj2 = (object)val2; } ClassicStageInfo.HandleMixEnemyArtifact -= (Manipulator)obj2; object obj3 = <>O.<2>__InitStageEnumToSceneDefs; if (obj3 == null) { hook_Init val3 = InitStageEnumToSceneDefs; <>O.<2>__InitStageEnumToSceneDefs = val3; obj3 = (object)val3; } SceneCatalog.Init -= (hook_Init)obj3; _hooksEnabled = false; } private static void ApplyChangesOnStart(orig_Start orig, ClassicStageInfo classicStageInfo) { classicStageInfo.PortToNewSystem(); classicStageInfo.ApplyChanges(); orig.Invoke(classicStageInfo); } private static void SwapVanillaDccsWithOurs(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt<DirectorCardCategorySelection>(i, "CopyFrom") })) { val.EmitDelegate<Func<DirectorCardCategorySelection, DirectorCardCategorySelection>>((Func<DirectorCardCategorySelection, DirectorCardCategorySelection>)SwapDccs); } static DirectorCardCategorySelection SwapDccs(DirectorCardCategorySelection vanillaDccs) { return _dccsMixEnemyArtifact; } } private static void InitStageEnumToSceneDefs(orig_Init orig) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); foreach (IGrouping<Stage, SceneDef> item in from sceneDef in (IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs group sceneDef by GetStageEnumFromSceneDef(sceneDef)) { VanillaStageToSceneDefs[item.Key] = item.ToArray(); } } private static void PortToNewSystem(this ClassicStageInfo classicStageInfo) { PortToNewMonsterSystem(classicStageInfo); PortToNewInteractableSystem(classicStageInfo); } internal static void ApplyChanges(this ClassicStageInfo classicStageInfo) { StageInfo stageInfo = GetStageInfo(classicStageInfo); BackupOrRestoreClassicStageInfoToOriginalState(classicStageInfo, stageInfo); ApplyMonsterChanges(classicStageInfo, stageInfo); ApplyInteractableChanges(classicStageInfo, stageInfo); ApplySettingsChanges(classicStageInfo, stageInfo); } private static StageInfo GetStageInfo(ClassicStageInfo classicStageInfo) { StageInfo stageInfo = default(StageInfo); stageInfo.stage = Stage.Custom; stageInfo.CustomStageName = ""; StageInfo result = stageInfo; SceneInfo component = ((Component)classicStageInfo).GetComponent<SceneInfo>(); if (!Object.op_Implicit((Object)(object)component)) { return result; } SceneDef sceneDef = component.sceneDef; if (!Object.op_Implicit((Object)(object)sceneDef)) { return result; } result.stage = GetStageEnumFromSceneDef(sceneDef); if (result.stage == Stage.Custom) { result.CustomStageName = sceneDef.baseSceneName; } return result; } private static void ApplySettingsChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo) { StageSettings stageSettings = GetStageSettings(classicStageInfo); if (DirectorAPI.StageSettingsActions != null) { Delegate[] invocationList = DirectorAPI.StageSettingsActions.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action<StageSettings, StageInfo> action = (Action<StageSettings, StageInfo>)invocationList[i]; try { action(stageSettings, stageInfo); } catch (Exception ex) { DirectorPlugin.Logger.LogError((object)ex); } } } SetStageSettings(classicStageInfo, stageSettings); } private static void PortToNewMonsterSystem(ClassicStageInfo classicStageInfo) { if (!Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool) && Object.op_Implicit((Object)(object)classicStageInfo.monsterCategories)) { DirectorPlugin.Logger.LogInfo((object)"Current scene is using old monster dccs system, porting to new one"); DccsPool val = ScriptableObject.CreateInstance<DccsPool>(); ((Object)val).name = "R2API_dp" + ((Object)classicStageInfo).name + "Monsters"; List<Category> list = new List<Category>(); PortOldStandardMonsterCategoriesToNewDccsPoolSystem(classicStageInfo.monsterCategories, list); if (classicStageInfo.possibleMonsterFamilies != null) { PortOldMonsterFamiliesToNewDccsPoolSystem(classicStageInfo.possibleMonsterFamilies, list); } val.poolCategories = list.ToArray(); classicStageInfo.monsterDccsPool = val; } } private static void PortOldStandardMonsterCategoriesToNewDccsPoolSystem(DirectorCardCategorySelection monsterCategories, List<Category> dccsPoolCategories) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0053: Expected O, but got Unknown Category val = new Category(); val.name = Helpers.MonsterPoolCategories.Standard; val.categoryWeight = Helpers.MonsterPoolCategories.StandardWeight; val.alwaysIncluded = Array.Empty<PoolEntry>(); val.includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>(); val.includedIfNoConditionsMet = (PoolEntry[])(object)new PoolEntry[1] { new PoolEntry { dccs = monsterCategories, weight = 1f } }; dccsPoolCategories.Add(val); } private static void PortOldMonsterFamiliesToNewDccsPoolSystem(MonsterFamily[] possibleMonsterFamilies, List<Category> dccsPoolCategories) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown Category val = new Category(); val.name = Helpers.MonsterPoolCategories.Family; val.categoryWeight = ClassicStageInfo.monsterFamilyChance; val.alwaysIncluded = Array.Empty<PoolEntry>(); List<ConditionalPoolEntry> list = new List<ConditionalPoolEntry>(); foreach (MonsterFamily val2 in possibleMonsterFamilies) { DirectorCardCategorySelection monsterFamilyCategories = val2.monsterFamilyCategories; FamilyDirectorCardCategorySelection val3 = (FamilyDirectorCardCategorySelection)(object)((monsterFamilyCategories is FamilyDirectorCardCategorySelection) ? monsterFamilyCategories : null); if (val3 != null) { list.Add(new ConditionalPoolEntry { dccs = (DirectorCardCategorySelection)(object)val3, weight = val2.selectionWeight, requiredExpansions = Array.Empty<ExpansionDef>() }); } else { DirectorPlugin.Logger.LogError((object)("classicStageInfo.possibleMonsterFamilies " + ((Object)val2.monsterFamilyCategories).name + " not setup correctly")); } } val.includedIfConditionsMet = list.ToArray(); val.includedIfNoConditionsMet = Array.Empty<PoolEntry>(); dccsPoolCategories.Add(val); } private static void PortToNewInteractableSystem(ClassicStageInfo classicStageInfo) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool) && Object.op_Implicit((Object)(object)classicStageInfo.interactableCategories)) { DirectorPlugin.Logger.LogInfo((object)"Current scene is using old interactable dccs system, porting to new one"); DccsPool val = ScriptableObject.CreateInstance<DccsPool>(); ((Object)val).name = "R2API_dp" + ((Object)classicStageInfo).name + "Interactables"; List<Category> list = new List<Category>(); Category val2 = new Category(); val2.name = Helpers.InteractablePoolCategories.Standard; val2.categoryWeight = Helpers.InteractablePoolCategories.StandardWeight; val2.alwaysIncluded = Array.Empty<PoolEntry>(); val2.includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>(); val2.includedIfNoConditionsMet = (PoolEntry[])(object)new PoolEntry[1] { new PoolEntry { dccs = classicStageInfo.interactableCategories, weight = 1f } }; list.Add(val2); val.poolCategories = list.ToArray(); classicStageInfo.interactableDccsPool = val; } } private static void ApplyMonsterChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo) { InitCustomMixEnemyArtifactDccs(); List<DirectorCardHolder> directorCardHoldersFromDCCS = GetDirectorCardHoldersFromDCCS(_dccsMixEnemyArtifact); if (DirectorAPI.MonsterActions != null) { Delegate[] invocationList = DirectorAPI.MonsterActions.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action<DccsPool, List<DirectorCardHolder>, StageInfo> action = (Action<DccsPool, List<DirectorCardHolder>, StageInfo>)invocationList[i]; try { action(classicStageInfo.monsterDccsPool, directorCardHoldersFromDCCS, stageInfo); } catch (Exception ex) { DirectorPlugin.Logger.LogError((object)ex); } } } ApplyNewCardHoldersToDCCS(_dccsMixEnemyArtifact, directorCardHoldersFromDCCS); } private static void BackupOrRestoreClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, StageInfo stageInfo) { string key = ((stageInfo.stage == Stage.Custom) ? stageInfo.CustomStageName : stageInfo.stage.ToString()); if (!_classicStageInfoNameToOriginalClassicStageInfos.TryGetValue(key, out OriginalClassicStageInfo value)) { BackupClassicStageInfoToOriginalState(classicStageInfo, key); } else { RestoreClassicStageInfoToOriginalState(classicStageInfo, value); } } private static void BackupClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, string key) { OriginalClassicStageInfo originalClassicStageInfo = new OriginalClassicStageInfo(); if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool)) { originalClassicStageInfo.monsterDccsPoolCategories = CopyDccsPoolCategories(classicStageInfo.monsterDccsPool.poolCategories); } if (Object.op_Implicit((Object)(object)classicStageInfo.monsterCategories)) { originalClassicStageInfo.monsterCategories = Object.Instantiate<DirectorCardCategorySelection>(classicStageInfo.monsterCategories); ((Object)originalClassicStageInfo.monsterCategories).name = ((Object)classicStageInfo.monsterCategories).name; } if (classicStageInfo.possibleMonsterFamilies != null) { originalClassicStageInfo.possibleMonsterFamilies = classicStageInfo.possibleMonsterFamilies.ToList(); } if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool)) { originalClassicStageInfo.interactableDccsPoolCategories = CopyDccsPoolCategories(classicStageInfo.interactableDccsPool.poolCategories); } if (Object.op_Implicit((Object)(object)classicStageInfo.interactableCategories)) { originalClassicStageInfo.interactableCategories = Object.Instantiate<DirectorCardCategorySelection>(classicStageInfo.interactableCategories); ((Object)originalClassicStageInfo.interactableCategories).name = ((Object)classicStageInfo.interactableCategories).name; } _classicStageInfoNameToOriginalClassicStageInfos[key] = originalClassicStageInfo; } private static void RestoreClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, OriginalClassicStageInfo originalClassicStageInfo) { if (originalClassicStageInfo.monsterDccsPoolCategories != null) { classicStageInfo.monsterDccsPool.poolCategories = CopyDccsPoolCategories(originalClassicStageInfo.monsterDccsPoolCategories).ToArray(); } if (Object.op_Implicit((Object)(object)originalClassicStageInfo.monsterCategories)) { classicStageInfo.monsterCategories = Object.Instantiate<DirectorCardCategorySelection>(originalClassicStageInfo.monsterCategories); ((Object)classicStageInfo.monsterCategories).name = ((Object)originalClassicStageInfo.monsterCategories).name; } if (originalClassicStageInfo.possibleMonsterFamilies != null) { classicStageInfo.possibleMonsterFamilies = originalClassicStageInfo.possibleMonsterFamilies.ToArray(); } if (originalClassicStageInfo.interactableDccsPoolCategories != null) { classicStageInfo.interactableDccsPool.poolCategories = CopyDccsPoolCategories(originalClassicStageInfo.interactableDccsPoolCategories).ToArray(); } if (Object.op_Implicit((Object)(object)originalClassicStageInfo.interactableCategories)) { classicStageInfo.interactableCategories = Object.Instantiate<DirectorCardCategorySelection>(originalClassicStageInfo.interactableCategories); ((Object)classicStageInfo.interactableCategories).name = ((Object)originalClassicStageInfo.interactableCategories).name; } } private static List<Category> CopyDccsPoolCategories(IEnumerable<Category> dccsPoolCategories) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown List<Category> list = new List<Category>(); foreach (Category dccsPoolCategory in dccsPoolCategories) { Category val = new Category(); val.name = dccsPoolCategory.name; val.categoryWeight = dccsPoolCategory.categoryWeight; val.alwaysIncluded = CopyPoolEntries(dccsPoolCategory.alwaysIncluded).ToArray(); val.includedIfConditionsMet = CopyConditionalPoolEntries(dccsPoolCategory.includedIfConditionsMet).ToArray(); val.includedIfNoConditionsMet = CopyPoolEntries(dccsPoolCategory.includedIfNoConditionsMet).ToArray(); list.Add(val); } return list; } private static List<ConditionalPoolEntry> CopyConditionalPoolEntries(IEnumerable<ConditionalPoolEntry> poolEntries) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown List<ConditionalPoolEntry> list = new List<ConditionalPoolEntry>(); foreach (ConditionalPoolEntry poolEntry in poolEntries) { ConditionalPoolEntry val = new ConditionalPoolEntry(); val.requiredExpansions = ArrayUtils.Clone<ExpansionDef>(poolEntry.requiredExpansions); ((PoolEntry)val).weight = ((PoolEntry)poolEntry).weight; ((PoolEntry)val).dccs = Object.Instantiate<DirectorCardCategorySelection>(((PoolEntry)poolEntry).dccs); ((Object)((PoolEntry)val).dccs).name = ((Object)((PoolEntry)poolEntry).dccs).name; list.Add(val); } return list; } private static List<PoolEntry> CopyPoolEntries(IEnumerable<PoolEntry> poolEntries) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown List<PoolEntry> list = new List<PoolEntry>(); foreach (PoolEntry poolEntry in poolEntries) { PoolEntry val = new PoolEntry(); val.weight = poolEntry.weight; val.dccs = Object.Instantiate<DirectorCardCategorySelection>(poolEntry.dccs); ((Object)val.dccs).name = ((Object)poolEntry.dccs).name; list.Add(val); } return list; } private static List<DirectorCardHolder> GetDirectorCardHoldersFromDCCS(DirectorCardCategorySelection dccs) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) List<DirectorCardHolder> list = new List<DirectorCardHolder>(); if (Object.op_Implicit((Object)(object)dccs)) { Category[] categories = dccs.categories; foreach (Category val in categories) { if (val.cards.Length == 0) { continue; } bool flag = false; flag = IsInteractableDccsCategory(val); DirectorCard[] cards = val.cards; foreach (DirectorCard card in cards) { DirectorCardHolder directorCardHolder = new DirectorCardHolder(); directorCardHolder.Card = card; if (flag) { if ((directorCardHolder.InteractableCategory = Helpers.GetInteractableCategory(val.name)) == InteractableCategory.Custom) { directorCardHolder.CustomInteractableCategory = val.name; } } else if ((directorCardHolder.MonsterCategory = Helpers.GetMonsterCategory(val.name)) == MonsterCategory.Custom) { directorCardHolder.CustomMonsterCategory = val.name; } list.Add(directorCardHolder); } } } return list; } private static bool IsInteractableDccsCategory(Category dccsCategory) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) bool result = false; DirectorCard[] cards = dccsCategory.cards; foreach (DirectorCard val in cards) { if (Object.op_Implicit((Object)(object)val.spawnCard) && Reflection.IsSameOrSubclassOf<InteractableSpawnCard>(((object)val.spawnCard).GetType())) { result = true; break; } } return result; } private static void ApplyNewCardHoldersToDCCS(DirectorCardCategorySelection dccs, List<DirectorCardHolder> directorCardHolders) { dccs.Clear(); foreach (DirectorCardHolder directorCardHolder in directorCardHolders) { dccs.AddCard(directorCardHolder); } } private static void ApplyInteractableChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo) { if (DirectorAPI.InteractableActions == null) { return; } Delegate[] invocationList = DirectorAPI.InteractableActions.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action<DccsPool, StageInfo> action = (Action<DccsPool, StageInfo>)invocationList[i]; try { action(classicStageInfo.interactableDccsPool, stageInfo); } catch (Exception ex) { DirectorPlugin.Logger.LogError((object)ex); } } } private static StageSettings GetStageSettings(ClassicStageInfo classicStageInfo) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) StageSettings stageSettings = new StageSettings { SceneDirectorInteractableCredits = classicStageInfo.sceneDirectorInteractibleCredits, SceneDirectorMonsterCredits = classicStageInfo.sceneDirectorMonsterCredits, BonusCreditObjects = new Dictionary<GameObject, int>() }; BonusInteractibleCreditObject[] bonusInteractibleCreditObjects = classicStageInfo.bonusInteractibleCreditObjects; foreach (BonusInteractibleCreditObject val in bonusInteractibleCreditObjects) { if (Object.op_Implicit((Object)(object)val.objectThatGrantsPointsIfEnabled)) { stageSettings.BonusCreditObjects[val.objectThatGrantsPointsIfEnabled] = val.points; } } GetMonsterCategoryWeightsPerDccs(classicStageInfo, stageSettings); GetInteractableCategoryWeightsPerDccs(classicStageInfo, stageSettings); return stageSettings; } private static void InitCustomMixEnemyArtifactDccs() { _dccsMixEnemyArtifact = Object.Instantiate<DirectorCardCategorySelection>(RoR2Content.mixEnemyMonsterCards); ((Object)_dccsMixEnemyArtifact).name = "dccsR2APIMixEnemyArtifact"; } private static void GetMonsterCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings) { stageSettings.MonsterCategoryWeightsPerDccs = new Dictionary<DirectorCardCategorySelection, Dictionary<string, float>>(); GetMonsterCategoryWeights(stageSettings, _dccsMixEnemyArtifact); if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool)) { Category[] poolCategories = classicStageInfo.monsterDccsPool.poolCategories; foreach (Category val in poolCategories) { GetMonsterCategoryWeights(stageSettings, val.alwaysIncluded); PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet; GetMonsterCategoryWeights(stageSettings, includedIfConditionsMet); GetMonsterCategoryWeights(stageSettings, val.includedIfNoConditionsMet); } } } private static void GetMonsterCategoryWeights(StageSettings stageSettings, DirectorCardCategorySelection dccs) { //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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) stageSettings.MonsterCategoryWeightsPerDccs[dccs] = new Dictionary<string, float>(); Category[] categories = dccs.categories; foreach (Category val in categories) { stageSettings.MonsterCategoryWeightsPerDccs[dccs][val.name] = val.selectionWeight; } } private static void GetMonsterCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories) { foreach (PoolEntry val in poolCategories) { GetMonsterCategoryWeights(stageSettings, val.dccs); } } private static void GetInteractableCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings) { stageSettings.InteractableCategoryWeightsPerDccs = new Dictionary<DirectorCardCategorySelection, Dictionary<string, float>>(); if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool)) { Category[] poolCategories = classicStageInfo.interactableDccsPool.poolCategories; foreach (Category val in poolCategories) { GetInteractableCategoryWeights(stageSettings, val.alwaysIncluded); PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet; GetInteractableCategoryWeights(stageSettings, includedIfConditionsMet); GetInteractableCategoryWeights(stageSettings, val.includedIfNoConditionsMet); } } } private static void GetInteractableCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories) { foreach (PoolEntry val in poolCategories) { GetInteractableCategoryWeights(stageSettings, val.dccs); } } private static void GetInteractableCategoryWeights(StageSettings stageSettings, DirectorCardCategorySelection dccs) { //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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) stageSettings.InteractableCategoryWeightsPerDccs[dccs] = new Dictionary<string, float>(); Category[] categories = dccs.categories; foreach (Category val in categories) { stageSettings.InteractableCategoryWeightsPerDccs[dccs][val.name] = val.selectionWeight; } } private static void SetStageSettings(ClassicStageInfo classicStageInfo, StageSettings stageSettings) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) classicStageInfo.sceneDirectorInteractibleCredits = stageSettings.SceneDirectorInteractableCredits; classicStageInfo.sceneDirectorMonsterCredits = stageSettings.SceneDirectorMonsterCredits; GameObject[] array = stageSettings.BonusCreditObjects.Keys.ToArray(); BonusInteractibleCreditObject[] array2 = (BonusInteractibleCreditObject[])(object)new BonusInteractibleCreditObject[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = new BonusInteractibleCreditObject { objectThatGrantsPointsIfEnabled = array[i], points = stageSettings.BonusCreditObjects[array[i]] }; } classicStageInfo.bonusInteractibleCreditObjects = array2; SetMonsterCategoryWeightsPerDccs(classicStageInfo, stageSettings); SetInteractableCategoryWeightsPerDccs(classicStageInfo, stageSettings); } private static void SetMonsterCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings) { SetMonsterCategoryWeights(_dccsMixEnemyArtifact, stageSettings.MonsterCategoryWeightsPerDccs[_dccsMixEnemyArtifact]); if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool)) { Category[] poolCategories = classicStageInfo.monsterDccsPool.poolCategories; foreach (Category val in poolCategories) { SetMonsterCategoryWeights(stageSettings, val.alwaysIncluded); PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet; SetMonsterCategoryWeights(stageSettings, includedIfConditionsMet); SetMonsterCategoryWeights(stageSettings, val.includedIfNoConditionsMet); } } } private static void SetMonsterCategoryWeights(DirectorCardCategorySelection dccs, Dictionary<string, float> newMonsterCategoryWeights) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < dccs.categories.Length; i++) { Category val = dccs.categories[i]; string name = val.name; val.selectionWeight = newMonsterCategoryWeights[name]; dccs.categories[i] = val; } } private static void SetMonsterCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories) { foreach (PoolEntry val in poolCategories) { SetMonsterCategoryWeights(val.dccs, stageSettings.MonsterCategoryWeightsPerDccs[val.dccs]); } } private static void SetInteractableCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings) { if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool)) { Category[] poolCategories = classicStageInfo.interactableDccsPool.poolCategories; foreach (Category val in poolCategories) { SetInteractableCategoryWeights(stageSettings, val.alwaysIncluded); PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet; SetInteractableCategoryWeights(stageSettings, includedIfConditionsMet); SetInteractableCategoryWeights(stageSettings, val.includedIfNoConditionsMet); } } } private static void SetInteractableCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories) { foreach (PoolEntry val in poolCategories) { SetInteractableCategoryWeights(val.dccs, stageSettings.InteractableCategoryWeightsPerDccs[val.dccs]); } } private static void SetInteractableCategoryWeights(DirectorCardCategorySelection dccs, Dictionary<string, float> newInteractableCategoryWeights) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < dccs.categories.Length; i++) { Category val = dccs.categories[i]; val.selectionWeight = newInteractableCategoryWeights[val.name]; dccs.categories[i] = val; } } } [BepInPlugin("com.bepis.r2api.director", "R2API.Director", "2.1.0")] public sealed class DirectorPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; DirectorAPI.SetHooks(); } private void OnEnable() { DirectorAPI.SetHooks(); } private void OnDisable() { DirectorAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Dot/R2API.Dot/R2API.Dot.dll
Decompiled 11 months 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.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API.AutoVersionGen; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Dot")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.Dot")] [assembly: AssemblyTitle("R2API.Dot")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class DotAPI { public delegate void CustomDotBehaviour(DotController self, DotStack dotStack); public delegate void CustomDotVisual(DotController self); [CompilerGenerated] private static class <>O { public static Manipulator <0>__RetrieveVanillaCount; public static Manipulator <1>__ResizeTimerArray; public static hook_InitDotCatalog <2>__AddCustomDots; public static hook_Awake <3>__TrackActiveCustomDots; public static hook_OnDestroy <4>__TrackActiveCustomDots2; public static hook_GetDotDef <5>__GetDotDef; public static hook_FixedUpdate <6>__FixedUpdate; public static Manipulator <7>__FixInflictDotReturnCheck; public static Manipulator <8>__CallCustomDotBehaviours; public static hook_HasDotActive <9>__OnHasDotActive; public static Manipulator <10>__EvaluateDotStacksForType; public static Manipulator <11>__FixDeathMark; public static Func<DotController, int, int> <12>__CountCustomDots; } public const string PluginGUID = "com.bepis.r2api.dot"; public const string PluginName = "R2API.Dot"; private static readonly List<DotDef> CustomDots = new List<DotDef>(); public static int VanillaDotCount; private static readonly Dictionary<DotController, bool[]> ActiveCustomDots = new Dictionary<DotController, bool[]>(); private static CustomDotBehaviour[] _customDotBehaviours = new CustomDotBehaviour[0]; private static CustomDotVisual[] _customDotVisuals = new CustomDotVisual[0]; private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; private static DotDef[] DotDefs { get { return DotController.dotDefs; } set { DotController.dotDefs = value; } } public static int CustomDotCount => CustomDots.Count; private static void ResizeDotDefs(int newSize) { DotDef[] array = DotDefs; Array.Resize(ref array, newSize); DotDefs = array; } public static DotIndex RegisterDotDef(DotDef? dotDef, CustomDotBehaviour? customDotBehaviour = null, CustomDotVisual? customDotVisual = null) { SetHooks(); int num = VanillaDotCount + CustomDotCount; if (DotDefs != null) { ResizeDotDefs(num + 1); DotDefs[num] = dotDef; } CustomDots.Add(dotDef); int num2 = _customDotBehaviours.Length; Array.Resize(ref _customDotBehaviours, _customDotBehaviours.Length + 1); _customDotBehaviours[num2] = customDotBehaviour; Array.Resize(ref _customDotVisuals, _customDotVisuals.Length + 1); _customDotVisuals[num2] = customDotVisual; if ((Object)(object)dotDef.associatedBuff != (Object)null) { DotPlugin.Logger.LogInfo((object)$"Custom Dot (Index: {num}) that uses Buff : {((Object)dotDef.associatedBuff).name} added"); } else { DotPlugin.Logger.LogInfo((object)$"Custom Dot (Index: {num}) with no associated Buff added"); } return (DotIndex)num; } public static DotIndex RegisterDotDef(float interval, float damageCoefficient, DamageColorIndex colorIndex, BuffDef associatedBuff = null, CustomDotBehaviour customDotBehaviour = null, CustomDotVisual customDotVisual = null) { //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_0011: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002f: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return RegisterDotDef(new DotDef { associatedBuff = associatedBuff, damageCoefficient = damageCoefficient, interval = interval, damageColorIndex = colorIndex }, customDotBehaviour, customDotVisual); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__RetrieveVanillaCount; if (obj == null) { Manipulator val = RetrieveVanillaCount; <>O.<0>__RetrieveVanillaCount = val; obj = (object)val; } DotController.InitDotCatalog += (Manipulator)obj; object obj2 = <>O.<1>__ResizeTimerArray; if (obj2 == null) { Manipulator val2 = ResizeTimerArray; <>O.<1>__ResizeTimerArray = val2; obj2 = (object)val2; } DotController.Awake += (Manipulator)obj2; object obj3 = <>O.<2>__AddCustomDots; if (obj3 == null) { hook_InitDotCatalog val3 = AddCustomDots; <>O.<2>__AddCustomDots = val3; obj3 = (object)val3; } DotController.InitDotCatalog += (hook_InitDotCatalog)obj3; object obj4 = <>O.<3>__TrackActiveCustomDots; if (obj4 == null) { hook_Awake val4 = TrackActiveCustomDots; <>O.<3>__TrackActiveCustomDots = val4; obj4 = (object)val4; } DotController.Awake += (hook_Awake)obj4; object obj5 = <>O.<4>__TrackActiveCustomDots2; if (obj5 == null) { hook_OnDestroy val5 = TrackActiveCustomDots2; <>O.<4>__TrackActiveCustomDots2 = val5; obj5 = (object)val5; } DotController.OnDestroy += (hook_OnDestroy)obj5; object obj6 = <>O.<5>__GetDotDef; if (obj6 == null) { hook_GetDotDef val6 = GetDotDef; <>O.<5>__GetDotDef = val6; obj6 = (object)val6; } DotController.GetDotDef += (hook_GetDotDef)obj6; object obj7 = <>O.<6>__FixedUpdate; if (obj7 == null) { hook_FixedUpdate val7 = FixedUpdate; <>O.<6>__FixedUpdate = val7; obj7 = (object)val7; } DotController.FixedUpdate += (hook_FixedUpdate)obj7; object obj8 = <>O.<7>__FixInflictDotReturnCheck; if (obj8 == null) { Manipulator val8 = FixInflictDotReturnCheck; <>O.<7>__FixInflictDotReturnCheck = val8; obj8 = (object)val8; } DotController.InflictDot_refInflictDotInfo += (Manipulator)obj8; object obj9 = <>O.<8>__CallCustomDotBehaviours; if (obj9 == null) { Manipulator val9 = CallCustomDotBehaviours; <>O.<8>__CallCustomDotBehaviours = val9; obj9 = (object)val9; } DotController.AddDot += (Manipulator)obj9; object obj10 = <>O.<9>__OnHasDotActive; if (obj10 == null) { hook_HasDotActive val10 = OnHasDotActive; <>O.<9>__OnHasDotActive = val10; obj10 = (object)val10; } DotController.HasDotActive += (hook_HasDotActive)obj10; object obj11 = <>O.<10>__EvaluateDotStacksForType; if (obj11 == null) { Manipulator val11 = EvaluateDotStacksForType; <>O.<10>__EvaluateDotStacksForType = val11; obj11 = (object)val11; } DotController.EvaluateDotStacksForType += (Manipulator)obj11; object obj12 = <>O.<11>__FixDeathMark; if (obj12 == null) { Manipulator val12 = FixDeathMark; <>O.<11>__FixDeathMark = val12; obj12 = (object)val12; } GlobalEventManager.OnHitEnemy += (Manipulator)obj12; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d0: 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_00db: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: 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_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown object obj = <>O.<0>__RetrieveVanillaCount; if (obj == null) { Manipulator val = RetrieveVanillaCount; <>O.<0>__RetrieveVanillaCount = val; obj = (object)val; } DotController.InitDotCatalog -= (Manipulator)obj; object obj2 = <>O.<1>__ResizeTimerArray; if (obj2 == null) { Manipulator val2 = ResizeTimerArray; <>O.<1>__ResizeTimerArray = val2; obj2 = (object)val2; } DotController.Awake -= (Manipulator)obj2; object obj3 = <>O.<3>__TrackActiveCustomDots; if (obj3 == null) { hook_Awake val3 = TrackActiveCustomDots; <>O.<3>__TrackActiveCustomDots = val3; obj3 = (object)val3; } DotController.Awake -= (hook_Awake)obj3; object obj4 = <>O.<4>__TrackActiveCustomDots2; if (obj4 == null) { hook_OnDestroy val4 = TrackActiveCustomDots2; <>O.<4>__TrackActiveCustomDots2 = val4; obj4 = (object)val4; } DotController.OnDestroy -= (hook_OnDestroy)obj4; object obj5 = <>O.<5>__GetDotDef; if (obj5 == null) { hook_GetDotDef val5 = GetDotDef; <>O.<5>__GetDotDef = val5; obj5 = (object)val5; } DotController.GetDotDef -= (hook_GetDotDef)obj5; object obj6 = <>O.<6>__FixedUpdate; if (obj6 == null) { hook_FixedUpdate val6 = FixedUpdate; <>O.<6>__FixedUpdate = val6; obj6 = (object)val6; } DotController.FixedUpdate -= (hook_FixedUpdate)obj6; object obj7 = <>O.<7>__FixInflictDotReturnCheck; if (obj7 == null) { Manipulator val7 = FixInflictDotReturnCheck; <>O.<7>__FixInflictDotReturnCheck = val7; obj7 = (object)val7; } DotController.InflictDot_refInflictDotInfo -= (Manipulator)obj7; object obj8 = <>O.<8>__CallCustomDotBehaviours; if (obj8 == null) { Manipulator val8 = CallCustomDotBehaviours; <>O.<8>__CallCustomDotBehaviours = val8; obj8 = (object)val8; } DotController.AddDot -= (Manipulator)obj8; object obj9 = <>O.<9>__OnHasDotActive; if (obj9 == null) { hook_HasDotActive val9 = OnHasDotActive; <>O.<9>__OnHasDotActive = val9; obj9 = (object)val9; } DotController.HasDotActive -= (hook_HasDotActive)obj9; object obj10 = <>O.<10>__EvaluateDotStacksForType; if (obj10 == null) { Manipulator val10 = EvaluateDotStacksForType; <>O.<10>__EvaluateDotStacksForType = val10; obj10 = (object)val10; } DotController.EvaluateDotStacksForType -= (Manipulator)obj10; object obj11 = <>O.<11>__FixDeathMark; if (obj11 == null) { Manipulator val11 = FixDeathMark; <>O.<11>__FixDeathMark = val11; obj11 = (object)val11; } GlobalEventManager.OnHitEnemy -= (Manipulator)obj11; _hooksEnabled = false; } private static void EvaluateDotStacksForType(ILContext il) { } private static void RetrieveVanillaCount(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!new ILCursor(il).TryGotoNext(new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchLdcI4(i, ref VanillaDotCount), (Instruction i) => ILPatternMatchingExt.MatchNewarr<DotDef>(i) })) { DotPlugin.Logger.LogError((object)"Failed finding IL Instructions. Aborting RetrieveVanillaCount IL Hook"); } } private static void ResizeTimerArray(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchLdcI4(i, VanillaDotCount), (Instruction i) => ILPatternMatchingExt.MatchNewarr<float>(i) })) { int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int i) => DotDefs.Length)); } else { DotPlugin.Logger.LogError((object)"Failed finding IL Instructions. Aborting ResizeTimerArray IL Hook"); } } private static void AddCustomDots(orig_InitDotCatalog orig) { orig.Invoke(); DotController.dotDefs = DotController.dotDefs.Concat(CustomDots).ToArray(); } private static void TrackActiveCustomDots(orig_Awake orig, DotController self) { orig.Invoke(self); ActiveCustomDots.Add(self, new bool[CustomDotCount]); } private static void TrackActiveCustomDots2(orig_OnDestroy orig, DotController self) { orig.Invoke(self); ActiveCustomDots.Remove(self); } private static DotDef GetDotDef(orig_GetDotDef orig, DotIndex dotIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return DotDefs[dotIndex]; } private static void FixedUpdate(orig_FixedUpdate orig, DotController self) { orig.Invoke(self); if (NetworkServer.active) { int num2 = default(int); for (int i = VanillaDotCount; i < DotDefs.Length; i++) { DotDef val = DotDefs[i]; float[] dotTimers = self.dotTimers; float num = dotTimers[i] - Time.fixedDeltaTime; if (num <= 0f) { num += val.interval; self.EvaluateDotStacksForType((DotIndex)i, val.interval, ref num2); ActiveCustomDots[self][i - VanillaDotCount] = num2 != 0; } dotTimers[i] = num; } } for (int j = 0; j < CustomDotCount; j++) { if (ActiveCustomDots[self][j]) { _customDotVisuals[j]?.Invoke(self); } } } private static void FixInflictDotReturnCheck(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(InflictDotInfo), "dotIndex"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 9) })) { val.Prev.OpCode = OpCodes.Ldc_I4; val.Prev.Operand = int.MaxValue; } else { ILFailMessage(1); } static void ILFailMessage(int index) { DotPlugin.Logger.LogError((object)$"Failed finding IL Instructions. Aborting FixInflictDotReturnCheck IL Hook {index}"); } } private static void CallCustomDotBehaviours(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int dotStackLoc = 0; MethodReference val2 = default(MethodReference); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction i) => ILPatternMatchingExt.MatchLdsfld<DotController>(i, "dotStackPool"), (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, ref val2), (Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref dotStackLoc) })) { int num2 = default(int); ILLabel[] array = default(ILLabel[]); if (!val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchLdarg(i, ref num2), (Instruction i) => ILPatternMatchingExt.MatchSwitch(i, ref array) })) { return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, dotStackLoc); val.EmitDelegate<Action<DotController, DotStack>>((Action<DotController, DotStack>)delegate(DotController self, DotStack dotStack) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_000e: 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_001a: Expected I4, but got Unknown if ((int)dotStack.dotIndex >= VanillaDotCount) { int num = dotStack.dotIndex - VanillaDotCount; _customDotBehaviours[num]?.Invoke(self, dotStack); } }); } else { ILFailMessage(1); } static void ILFailMessage(int index) { DotPlugin.Logger.LogError((object)$"Failed finding IL Instructions. Aborting OnAddDot IL Hook {index}"); } } private static bool OnHasDotActive(orig_HasDotActive orig, DotController self, DotIndex dotIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0025: 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_001e: Unknown result type (might be due to invalid IL or missing references) if ((int)dotIndex >= VanillaDotCount) { if (ActiveCustomDots.TryGetValue(self, out bool[] value)) { return value[dotIndex - VanillaDotCount]; } return false; } return orig.Invoke(self, dotIndex); } private static void FixDeathMark(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int dotControllerLoc = 0; int numberOfDebuffAndDotLoc2 = 0; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, typeof(DotController), "HasDotActive") })) { if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, ref numberOfDebuffAndDotLoc2) })) { ILFailMessage(2); } } else { ILFailMessage(1); } if (val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, typeof(DotController), "FindDotController"), (Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref dotControllerLoc) })) { val.Emit(OpCodes.Ldloc, dotControllerLoc); val.Emit(OpCodes.Ldloc, numberOfDebuffAndDotLoc2); val.EmitDelegate<Func<DotController, int, int>>((Func<DotController, int, int>)CountCustomDots); val.Emit(OpCodes.Stloc, numberOfDebuffAndDotLoc2); } else { ILFailMessage(3); } static int CountCustomDots(DotController dotController, int numberOfDebuffAndDotLoc) { //IL_0011: 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) if (Object.op_Implicit((Object)(object)dotController)) { for (int j = VanillaDotCount; j < VanillaDotCount + CustomDotCount; j++) { DotIndex val2 = (DotIndex)j; if (dotController.HasDotActive(val2)) { numberOfDebuffAndDotLoc++; } } } return numberOfDebuffAndDotLoc; } static void ILFailMessage(int index) { DotPlugin.Logger.LogError((object)$"Failed finding IL Instructions. Aborting FixDeathMark IL Hook {index}"); } } } [BepInPlugin("com.bepis.r2api.dot", "R2API.Dot", "1.0.1")] public sealed class DotPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { DotAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Elites/R2API.Elites/R2API.Elites.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; 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.Logging; using HG; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API.AutoVersionGen; using R2API.ContentManagement; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Elites")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("R2API.Elites")] [assembly: AssemblyTitle("R2API.Elites")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { public class CustomElite { public EliteDef? EliteDef; public Texture2D? EliteRamp; public IEnumerable<EliteTierDef> EliteTierDefs; public CustomElite(string? name, EquipmentDef equipmentDef, Color32 color, string? modifierToken, IEnumerable<EliteTierDef> eliteTierDefs) { //IL_002f: 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) EliteDef = ScriptableObject.CreateInstance<EliteDef>(); ((Object)EliteDef).name = name; EliteDef.eliteEquipmentDef = equipmentDef; EliteDef.color = color; EliteDef.modifierToken = modifierToken; EliteTierDefs = eliteTierDefs; } public CustomElite(string? name, EquipmentDef equipmentDef, Color32 color, string? modifierToken, IEnumerable<EliteTierDef> eliteTierDefs, Texture2D eliteRamp) { //IL_002f: 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) EliteDef = ScriptableObject.CreateInstance<EliteDef>(); ((Object)EliteDef).name = name; EliteDef.eliteEquipmentDef = equipmentDef; EliteDef.color = color; EliteDef.modifierToken = modifierToken; EliteTierDefs = eliteTierDefs; EliteRamp = eliteRamp; } public CustomElite(EliteDef? eliteDef, IEnumerable<EliteTierDef> eliteTierDefs) { EliteDef = eliteDef; EliteTierDefs = eliteTierDefs; } public CustomElite(EliteDef? eliteDef, IEnumerable<EliteTierDef> eliteTierDefs, Texture2D eliteRamp) { EliteDef = eliteDef; EliteTierDefs = eliteTierDefs; EliteRamp = eliteRamp; } } [AutoVersion] public static class EliteAPI { [CompilerGenerated] private static class <>O { public static Manipulator <0>__RetrieveVanillaEliteTierCount; public static hook_Init <1>__UseOurCombatDirectorInitInstead; public static Action <2>__AddElitesToGame; } public const string PluginGUID = "com.bepis.r2api.elites"; public const string PluginName = "R2API.Elites"; public static ObservableCollection<CustomElite?>? EliteDefinitions; private static bool _hooksEnabled; private static bool _combatDirectorInitialized; public static int VanillaEliteTierCount; private static readonly List<EliteTierDef> CustomEliteTierDefs; public const string PluginVersion = "1.0.3"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static EliteTierDef[] VanillaEliteTiers { get; private set; } public static EliteTierDef VanillaFirstTierDef { get; private set; } public static EliteTierDef VanillaEliteOnlyFirstTierDef { get; private set; } public static int CustomEliteTierCount => CustomEliteTierDefs.Count; static EliteAPI() { EliteDefinitions = new ObservableCollection<CustomElite>(); _hooksEnabled = false; CustomEliteTierDefs = new List<EliteTierDef>(); CombatDirectorInitNoTimingIssue(); VanillaEliteTiers = RetrieveVanillaEliteTiers(); VanillaFirstTierDef = RetrieveFirstVanillaTierDef(); VanillaEliteOnlyFirstTierDef = RetrieveVanillaEliteOnlyFirstTierDef(); ElitesPlugin.Logger.LogDebug((object)"EliteAPI.cctor finished."); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__RetrieveVanillaEliteTierCount; if (obj == null) { Manipulator val = RetrieveVanillaEliteTierCount; <>O.<0>__RetrieveVanillaEliteTierCount = val; obj = (object)val; } CombatDirector.Init += (Manipulator)obj; object obj2 = <>O.<1>__UseOurCombatDirectorInitInstead; if (obj2 == null) { hook_Init val2 = UseOurCombatDirectorInitInstead; <>O.<1>__UseOurCombatDirectorInitInstead = val2; obj2 = (object)val2; } CombatDirector.Init += (hook_Init)obj2; R2APIContentPackProvider.WhenAddingContentPacks = (Action)Delegate.Combine(R2APIContentPackProvider.WhenAddingContentPacks, new Action(AddElitesToGame)); _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__RetrieveVanillaEliteTierCount; if (obj == null) { Manipulator val = RetrieveVanillaEliteTierCount; <>O.<0>__RetrieveVanillaEliteTierCount = val; obj = (object)val; } CombatDirector.Init -= (Manipulator)obj; object obj2 = <>O.<1>__UseOurCombatDirectorInitInstead; if (obj2 == null) { hook_Init val2 = UseOurCombatDirectorInitInstead; <>O.<1>__UseOurCombatDirectorInitInstead = val2; obj2 = (object)val2; } CombatDirector.Init -= (hook_Init)obj2; R2APIContentPackProvider.WhenAddingContentPacks = (Action)Delegate.Remove(R2APIContentPackProvider.WhenAddingContentPacks, new Action(AddElitesToGame)); _hooksEnabled = false; } private static void UseOurCombatDirectorInitInstead(orig_Init orig) { CombatDirectorInitNoTimingIssue(); } private static void CombatDirectorInitNoTimingIssue() { //IL_000e: 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_001e: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_007d: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_01bf: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) if (!_combatDirectorInitialized) { List<EliteTierDef> list = new List<EliteTierDef>(); EliteTierDef item = new EliteTierDef { costMultiplier = 1f, eliteTypes = (EliteDef[])(object)new EliteDef[1], isAvailable = (EliteRules rules) => CombatDirector.NotEliteOnlyArtifactActive(), canSelectWithoutAvailableEliteDef = true }; list.Add(item); EliteTierDef val = new EliteTierDef(); val.costMultiplier = CombatDirector.baseEliteCostMultiplier; val.eliteTypes = (EliteDef[])(object)new EliteDef[4] { Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteLightning/edLightning.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteIce/edIce.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteFire/edFire.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC1/EliteEarth/edEarth.asset").WaitForCompletion() }; val.isAvailable = (EliteRules rules) => CombatDirector.NotEliteOnlyArtifactActive() && (int)rules == 0; val.canSelectWithoutAvailableEliteDef = false; item = val; list.Add(item); val = new EliteTierDef(); val.costMultiplier = Mathf.LerpUnclamped(1f, CombatDirector.baseEliteCostMultiplier, 0.5f); val.eliteTypes = (EliteDef[])(object)new EliteDef[4] { Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteLightning/edLightningHonor.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteIce/edIceHonor.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteFire/edFireHonor.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/DLC1/EliteEarth/edEarthHonor.asset").WaitForCompletion() }; val.isAvailable = (EliteRules rules) => CombatDirector.IsEliteOnlyArtifactActive(); val.canSelectWithoutAvailableEliteDef = false; item = val; list.Add(item); val = new EliteTierDef(); val.costMultiplier = CombatDirector.baseEliteCostMultiplier * 6f; val.eliteTypes = (EliteDef[])(object)new EliteDef[2] { Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/ElitePoison/edPoison.asset").WaitForCompletion(), Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteHaunted/edHaunted.asset").WaitForCompletion() }; val.isAvailable = (EliteRules rules) => Run.instance.loopClearCount > 0 && (int)rules == 0; val.canSelectWithoutAvailableEliteDef = false; item = val; list.Add(item); val = new EliteTierDef(); val.costMultiplier = CombatDirector.baseEliteCostMultiplier; val.eliteTypes = (EliteDef[])(object)new EliteDef[1] { Addressables.LoadAssetAsync<EliteDef>((object)"RoR2/Base/EliteLunar/edLunar.asset").WaitForCompletion() }; val.isAvailable = (EliteRules rules) => (int)rules == 2; val.canSelectWithoutAvailableEliteDef = false; item = val; list.Add(item); CombatDirector.eliteTiers = list.ToArray(); _combatDirectorInitialized = true; } } private static void AddElitesToGame() { foreach (CustomElite customElite in EliteDefinitions) { foreach (EliteTierDef eliteTierDef in customElite.EliteTierDefs) { if (eliteTierDef.eliteTypes == null) { eliteTierDef.eliteTypes = Array.Empty<EliteDef>(); } else if (eliteTierDef.eliteTypes.Any((EliteDef e) => (Object)(object)e == (Object)(object)customElite.EliteDef)) { continue; } ArrayUtils.ArrayAppend<EliteDef>(ref eliteTierDef.eliteTypes, ref customElite.EliteDef); } if (Object.op_Implicit((Object)(object)customElite.EliteRamp)) { EliteRamp.AddRamp(customElite.EliteDef, customElite.EliteRamp); } } } private static void RetrieveVanillaEliteTierCount(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!new ILCursor(il).TryGotoNext(new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchLdcI4(i, ref VanillaEliteTierCount), (Instruction i) => ILPatternMatchingExt.MatchNewarr<EliteTierDef>(i) })) { ElitesPlugin.Logger.LogError((object)"Failed finding IL Instructions. Aborting RetrieveVanillaEliteTierCount IL Hook"); } } [MethodImpl(MethodImplOptions.NoInlining)] public static bool Add(CustomElite? elite) { SetHooks(); return AddInternal(elite, Assembly.GetCallingAssembly()); } internal static bool AddInternal(CustomElite customElite, Assembly addingAssembly) { if (!Object.op_Implicit((Object)(object)customElite.EliteDef)) { throw new ArgumentNullException("customElite.EliteDef"); } if (!CatalogBlockers.GetAvailability<EliteDef>()) { ElitesPlugin.Logger.LogError((object)("Too late ! Tried to add elite: " + customElite.EliteDef.modifierToken + " after the EliteCatalog has initialized!")); return false; } if (customElite.EliteTierDefs == null || customElite.EliteTierDefs.Count() <= 0) { throw new ArgumentNullException("customElite.EliteTierDefs"); } R2APIContentManager.HandleContentAddition(addingAssembly, (Object)(object)customElite.EliteDef); EliteDefinitions.Add(customElite); return true; } private static EliteTierDef[] RetrieveVanillaEliteTiers() { return CombatDirector.eliteTiers; } private static EliteTierDef RetrieveFirstVanillaTierDef() { return CombatDirector.eliteTiers[1]; } private static EliteTierDef RetrieveVanillaEliteOnlyFirstTierDef() { return CombatDirector.eliteTiers[2]; } public static EliteTierDef?[]? GetCombatDirectorEliteTiers() { SetHooks(); return CombatDirector.eliteTiers; } public static void OverrideCombatDirectorEliteTiers(EliteTierDef?[]? newEliteTiers) { SetHooks(); CombatDirector.eliteTiers = newEliteTiers; } public static int AppendCustomEliteTier(EliteTierDef? eliteTierDef) { SetHooks(); return AddCustomEliteTier(eliteTierDef, -1); } public static int AddCustomEliteTier(EliteTierDef? eliteTierDef) { EliteTierDef eliteTierDef2 = eliteTierDef; SetHooks(); int num = Array.FindIndex(GetCombatDirectorEliteTiers(), (EliteTierDef x) => x.costMultiplier >= eliteTierDef2.costMultiplier); if (num >= 0) { return AddCustomEliteTier(eliteTierDef2, num); } return AppendCustomEliteTier(eliteTierDef2); } public static int AddCustomEliteTier(EliteTierDef? eliteTierDef, int indexToInsertAt = -1) { SetHooks(); _ = VanillaEliteTierCount; _ = CustomEliteTierCount; EliteTierDef[] combatDirectorEliteTiers = GetCombatDirectorEliteTiers(); if (combatDirectorEliteTiers != null) { if (indexToInsertAt == -1) { indexToInsertAt = combatDirectorEliteTiers.Length; ArrayUtils.ArrayAppend<EliteTierDef>(ref combatDirectorEliteTiers, ref eliteTierDef); } else { ArrayUtils.ArrayInsert<EliteTierDef>(ref combatDirectorEliteTiers, indexToInsertAt, ref eliteTierDef); } OverrideCombatDirectorEliteTiers(combatDirectorEliteTiers); } CustomEliteTierDefs.Add(eliteTierDef); ElitesPlugin.Logger.LogInfo((object)$"Custom Elite Tier : (Index : {indexToInsertAt}) added"); return indexToInsertAt; } } public static class EliteRamp { [CompilerGenerated] private static class <>O { public static Manipulator <0>__UpdateRampProperly; public static Action <1>__SetupDictionary; public static Action<CharacterModel> <2>__UpdateRampProperly; } private static List<(EliteDef, Texture2D)> elitesAndRamps = new List<(EliteDef, Texture2D)>(); private static Dictionary<EliteIndex, Texture2D> eliteIndexToTexture = new Dictionary<EliteIndex, Texture2D>(); private static Texture2D vanillaEliteRamp; private static bool _hooksEnabled = false; private static int EliteRampPropertyID => Shader.PropertyToID("_EliteRamp"); internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!_hooksEnabled) { object obj = <>O.<0>__UpdateRampProperly; if (obj == null) { Manipulator val = UpdateRampProperly; <>O.<0>__UpdateRampProperly = val; obj = (object)val; } CharacterModel.UpdateMaterials += (Manipulator)obj; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(SetupDictionary)); vanillaEliteRamp = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampElites.psd").WaitForCompletion(); _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__UpdateRampProperly; if (obj == null) { Manipulator val = UpdateRampProperly; <>O.<0>__UpdateRampProperly = val; obj = (object)val; } CharacterModel.UpdateMaterials -= (Manipulator)obj; RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(SetupDictionary)); vanillaEliteRamp = null; _hooksEnabled = false; } private static void UpdateRampProperly(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterModel>(x, "propertyStorage"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(CommonShaderProperties), "_EliteIndex") }); bool flag2 = val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<MaterialPropertyBlock>(x, "SetFloat") }); if (flag && flag2) { val.Emit(OpCodes.Ldarg, 0); val.EmitDelegate<Action<CharacterModel>>((Action<CharacterModel>)UpdateRampProperly); } else { ElitesPlugin.Logger.LogError((object)"Elite Ramp ILHook failed"); } static void UpdateRampProperly(CharacterModel charModel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((int)charModel.myEliteIndex != -1 && eliteIndexToTexture.TryGetValue(charModel.myEliteIndex, out Texture2D value)) { charModel.propertyStorage.SetTexture(EliteRampPropertyID, (Texture)(object)value); } else { charModel.propertyStorage.SetTexture(EliteRampPropertyID, (Texture)(object)vanillaEliteRamp); } } } private static void SetupDictionary() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) foreach (var (val, value) in elitesAndRamps) { eliteIndexToTexture[val.eliteIndex] = value; } elitesAndRamps.Clear(); } public static void AddRamp(EliteDef eliteDef, Texture2D ramp) { SetHooks(); try { eliteDef.shaderEliteRampIndex = 0; elitesAndRamps.Add((eliteDef, ramp)); } catch (Exception ex) { ElitesPlugin.Logger.LogError((object)ex); } } public static void AddRampToMultipleElites(IEnumerable<EliteDef> eliteDefs, Texture2D ramp) { SetHooks(); foreach (EliteDef eliteDef in eliteDefs) { AddRamp(eliteDef, ramp); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.elites", "R2API.Elites", "1.0.3")] public sealed class ElitesPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; EliteAPI.SetHooks(); EliteRamp.SetHooks(); } private void OnDestroy() { EliteAPI.UnsetHooks(); EliteRamp.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Items/R2API.Items/R2API.Items.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; 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 System.Text; using System.Xml.Linq; using BepInEx; using BepInEx.Logging; using HG; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API.AutoVersionGen; using R2API.ContentManagement; using R2API.MiscHelpers; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Items")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("R2API.Items")] [assembly: AssemblyTitle("R2API.Items")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { public class CustomEquipment { public EquipmentDef? EquipmentDef; public ItemDisplayRuleDict? ItemDisplayRules; public CustomEquipment(EquipmentDef? equipmentDef, ItemDisplayRule[]? itemDisplayRules) { EquipmentDef = equipmentDef; ItemDisplayRules = new ItemDisplayRuleDict(itemDisplayRules); } public CustomEquipment(EquipmentDef? equipmentDef, ItemDisplayRuleDict? itemDisplayRules) { EquipmentDef = equipmentDef; ItemDisplayRules = itemDisplayRules; } public CustomEquipment(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, float cooldown, bool canDrop, bool enigmaCompatible, bool isBoss, bool isLunar, BuffDef passiveBuffDef, UnlockableDef unlockableDef, ColorIndex colorIndex = 5, bool appearsInMultiPlayer = true, bool appearsInSinglePlayer = true, ItemDisplayRule[]? itemDisplayRules = null) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>(); EquipmentDef.appearsInMultiPlayer = appearsInMultiPlayer; EquipmentDef.appearsInSinglePlayer = appearsInSinglePlayer; EquipmentDef.canDrop = canDrop; EquipmentDef.colorIndex = colorIndex; EquipmentDef.cooldown = cooldown; EquipmentDef.descriptionToken = descriptionToken; EquipmentDef.enigmaCompatible = enigmaCompatible; EquipmentDef.isBoss = isBoss; EquipmentDef.isLunar = isLunar; EquipmentDef.loreToken = loreToken; ((Object)EquipmentDef).name = name; EquipmentDef.nameToken = nameToken; EquipmentDef.passiveBuffDef = passiveBuffDef; EquipmentDef.pickupIconSprite = pickupIconSprite; EquipmentDef.pickupModelPrefab = pickupModelPrefab; EquipmentDef.pickupToken = pickupToken; EquipmentDef.unlockableDef = unlockableDef; ItemDisplayRules = new ItemDisplayRuleDict(itemDisplayRules); } public CustomEquipment(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, float cooldown, bool canDrop, bool enigmaCompatible, bool isBoss, bool isLunar, BuffDef passiveBuffDef, UnlockableDef unlockableDef, ColorIndex colorIndex = 5, bool appearsInMultiPlayer = true, bool appearsInSinglePlayer = true, ItemDisplayRuleDict? itemDisplayRules = null) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>(); EquipmentDef.appearsInMultiPlayer = appearsInMultiPlayer; EquipmentDef.appearsInSinglePlayer = appearsInSinglePlayer; EquipmentDef.canDrop = canDrop; EquipmentDef.colorIndex = colorIndex; EquipmentDef.cooldown = cooldown; EquipmentDef.descriptionToken = descriptionToken; EquipmentDef.enigmaCompatible = enigmaCompatible; EquipmentDef.isBoss = isBoss; EquipmentDef.isLunar = isLunar; EquipmentDef.loreToken = loreToken; ((Object)EquipmentDef).name = name; EquipmentDef.nameToken = nameToken; EquipmentDef.passiveBuffDef = passiveBuffDef; EquipmentDef.pickupIconSprite = pickupIconSprite; EquipmentDef.pickupModelPrefab = pickupModelPrefab; EquipmentDef.pickupToken = pickupToken; EquipmentDef.unlockableDef = unlockableDef; ItemDisplayRules = itemDisplayRules; } } public class CustomItem { public ItemDef? ItemDef; public ItemDisplayRuleDict? ItemDisplayRules; public CustomItem(ItemDef? itemDef, ItemDisplayRule[]? itemDisplayRules) { ItemDef = itemDef; ItemDisplayRules = new ItemDisplayRuleDict(itemDisplayRules); } public CustomItem(ItemDef? itemDef, ItemDisplayRuleDict? itemDisplayRules) { ItemDef = itemDef; ItemDisplayRules = itemDisplayRules; } public CustomItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, ItemTag[] tags, ItemTier tier, bool hidden, bool canRemove, UnlockableDef unlockableDef, ItemDisplayRule[]? itemDisplayRules) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetupItem(name, nameToken, descriptionToken, loreToken, pickupToken, pickupIconSprite, pickupModelPrefab, tier, tags, canRemove, hidden, unlockableDef, new ItemDisplayRuleDict(itemDisplayRules)); } public CustomItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, ItemTag[] tags, ItemTier tier, bool hidden, bool canRemove, UnlockableDef unlockableDef, ItemDisplayRule[]? itemDisplayRules, ItemTierDef itemTierDef = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetupItem(name, nameToken, descriptionToken, loreToken, pickupToken, pickupIconSprite, pickupModelPrefab, tier, tags, canRemove, hidden, unlockableDef, new ItemDisplayRuleDict(itemDisplayRules), itemTierDef); } public CustomItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, ItemTier tier, ItemTag[] tags, bool canRemove, bool hidden, UnlockableDef unlockableDef = null, ItemDisplayRuleDict? itemDisplayRules = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetupItem(name, nameToken, descriptionToken, loreToken, pickupToken, pickupIconSprite, pickupModelPrefab, tier, tags, canRemove, hidden, unlockableDef, itemDisplayRules); } public CustomItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, ItemTier tier, ItemTag[] tags, bool canRemove, bool hidden, UnlockableDef unlockableDef = null, ItemDisplayRuleDict? itemDisplayRules = null, ItemTierDef itemTierDef = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetupItem(name, nameToken, descriptionToken, loreToken, pickupToken, pickupIconSprite, pickupModelPrefab, tier, tags, canRemove, hidden, unlockableDef, itemDisplayRules, itemTierDef); } private void SetupItem(string name, string nameToken, string descriptionToken, string loreToken, string pickupToken, Sprite pickupIconSprite, GameObject pickupModelPrefab, ItemTier tier, ItemTag[] tags, bool canRemove, bool hidden, UnlockableDef unlockableDef = null, ItemDisplayRuleDict? itemDisplayRules = null, ItemTierDef itemTierDef = null) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ItemDef.canRemove = canRemove; ItemDef.descriptionToken = descriptionToken; ItemDef.hidden = hidden; ItemDef.loreToken = loreToken; ((Object)ItemDef).name = name; ItemDef.nameToken = nameToken; ItemDef.pickupIconSprite = pickupIconSprite; ItemDef.pickupModelPrefab = pickupModelPrefab; ItemDef.pickupToken = pickupToken; ItemDef.tags = tags; ItemDef.unlockableDef = unlockableDef; ItemDisplayRules = itemDisplayRules; if ((int)tier != 10) { ItemDef._itemTierDef = LoadTierFromAddress(tier); } else if (!Object.op_Implicit((Object)(object)itemTierDef)) { ItemDef._itemTierDef = null; ItemsPlugin.Logger.LogWarning((object)("Trying to create an itemDef (" + name + "), but the \"tier\" argument is set to AssignedAtRuntimeAnd the argument \"itemTierDef\" is null! Resorting to setting tier to NoTier")); } else { ItemDef._itemTierDef = itemTierDef; } } private ItemTierDef LoadTierFromAddress(ItemTier itemTierToLoad) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected I4, but got Unknown return (ItemTierDef)((int)itemTierToLoad switch { 0 => LoadTier("RoR2/Base/Common/Tier1Def.asset"), 1 => LoadTier("RoR2/Base/Common/Tier2Def.asset"), 2 => LoadTier("RoR2/Base/Common/Tier3Def.asset"), 3 => LoadTier("RoR2/Base/Common/LunarTierDef.asset"), 4 => LoadTier("RoR2/Base/Common/BossTierDef.asset"), 6 => LoadTier("RoR2/DLC1/Common/VoidTier1Def.asset"), 7 => LoadTier("RoR2/DLC1/Common/VoidTier2Def.asset"), 8 => LoadTier("RoR2/DLC1/Common/VoidTier3Def.asset"), 9 => LoadTier("RoR2/DLC1/Common/VoidBossDef.asset"), 5 => null, 10 => null, _ => null, }); } private ItemTierDef LoadTier(string address) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync<ItemTierDef>((object)address).WaitForCompletion(); } } [AutoVersion] public static class ItemAPI { [CompilerGenerated] private static class <>O { public static Manipulator <0>__MaterialFixForItemDisplayOnCharacter; public static hook_Init <1>__AddingItemDisplayRulesToCharacterModels; public static Manipulator <2>__AddCustomTagsToItemCatalog; } public const string PluginGUID = "com.bepis.r2api.items"; public const string PluginName = "R2API.Items"; public static ObservableCollection<CustomItem?>? ItemDefinitions = new ObservableCollection<CustomItem>(); public static ObservableCollection<CustomEquipment?> EquipmentDefinitions = new ObservableCollection<CustomEquipment>(); private static ICollection<string> noDefaultIDRSCharacterList = new List<string>(); private static List<string> customItemTags = new List<string>(); public static int CustomItemCount; public static int CustomEquipmentCount; private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.3"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__MaterialFixForItemDisplayOnCharacter; if (obj == null) { Manipulator val = MaterialFixForItemDisplayOnCharacter; <>O.<0>__MaterialFixForItemDisplayOnCharacter = val; obj = (object)val; } CharacterModel.UpdateMaterials += (Manipulator)obj; object obj2 = <>O.<1>__AddingItemDisplayRulesToCharacterModels; if (obj2 == null) { hook_Init val2 = AddingItemDisplayRulesToCharacterModels; <>O.<1>__AddingItemDisplayRulesToCharacterModels = val2; obj2 = (object)val2; } ItemDisplayRuleSet.Init += (hook_Init)obj2; object obj3 = <>O.<2>__AddCustomTagsToItemCatalog; if (obj3 == null) { Manipulator val3 = AddCustomTagsToItemCatalog; <>O.<2>__AddCustomTagsToItemCatalog = val3; obj3 = (object)val3; } ItemCatalog.SetItemDefs += (Manipulator)obj3; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__MaterialFixForItemDisplayOnCharacter; if (obj == null) { Manipulator val = MaterialFixForItemDisplayOnCharacter; <>O.<0>__MaterialFixForItemDisplayOnCharacter = val; obj = (object)val; } CharacterModel.UpdateMaterials -= (Manipulator)obj; object obj2 = <>O.<1>__AddingItemDisplayRulesToCharacterModels; if (obj2 == null) { hook_Init val2 = AddingItemDisplayRulesToCharacterModels; <>O.<1>__AddingItemDisplayRulesToCharacterModels = val2; obj2 = (object)val2; } ItemDisplayRuleSet.Init -= (hook_Init)obj2; object obj3 = <>O.<2>__AddCustomTagsToItemCatalog; if (obj3 == null) { Manipulator val3 = AddCustomTagsToItemCatalog; <>O.<2>__AddCustomTagsToItemCatalog = val3; obj3 = (object)val3; } ItemCatalog.SetItemDefs -= (Manipulator)obj3; _hooksEnabled = false; } [MethodImpl(MethodImplOptions.NoInlining)] public static bool Add(CustomItem? item) { SetHooks(); return AddItemInternal(item, Assembly.GetCallingAssembly()); } internal static bool AddItemInternal(CustomItem item, Assembly addingAssembly) { if (!CatalogBlockers.GetAvailability<ItemDef>()) { ItemsPlugin.Logger.LogError((object)("Too late ! Tried to add item: " + item.ItemDef.nameToken + " after the ItemCatalog has Initialized!")); } if (!Object.op_Implicit((Object)(object)item.ItemDef)) { ItemsPlugin.Logger.LogError((object)"ItemDef is null ! Can't add the custom item."); } if (string.IsNullOrEmpty(((Object)item.ItemDef).name)) { ItemsPlugin.Logger.LogError((object)"ItemDef.name is null or empty ! Can't add the custom item."); } if (!Object.op_Implicit((Object)(object)item.ItemDef.pickupModelPrefab)) { ItemsPlugin.Logger.LogWarning((object)("No ItemDef.pickupModelPrefab (" + ((Object)item.ItemDef).name + "), the game will show nothing when the item is on the ground.")); } if (item.ItemDisplayRules != null && item.ItemDisplayRules.Dictionary.Values.Any((ItemDisplayRule[] rules) => rules.Any((ItemDisplayRule rule) => (int)rule.ruleType == 0)) && item.ItemDisplayRules.HasInvalidDisplays(out StringBuilder logger)) { ItemsPlugin.Logger.LogWarning((object)(string.Format("Some of the ItemDisplayRules in the dictionary for CustomItem ({0}) have an invalid {1}. ", item.ItemDef, "followerPrefab") + "(There are ItemDisplayRuleType.ParentedPrefab rules),Logging invalid rules... (For full details, check the Log file)")); ItemsPlugin.Logger.LogDebug((object)logger.ToString()); } bool flag = false; try { new XElement(((Object)item.ItemDef).name); flag = true; } catch { ItemsPlugin.Logger.LogError((object)("Custom item '" + ((Object)item.ItemDef).name + "' is not XMLsafe. Item not added.")); } if (flag) { R2APIContentManager.HandleContentAddition(addingAssembly, (Object)(object)item.ItemDef); ItemDefinitions.Add(item); return true; } return false; } [MethodImpl(MethodImplOptions.NoInlining)] public static bool Add(CustomEquipment? item) { SetHooks(); return AddEquippmentInternal(item, Assembly.GetCallingAssembly()); } private static bool AddEquippmentInternal(CustomEquipment equip, Assembly addingAssembly) { if (!CatalogBlockers.GetAvailability<EquipmentDef>()) { ItemsPlugin.Logger.LogError((object)("Too late ! Tried to add equipment item: " + equip.EquipmentDef.nameToken + " after the EquipmentCatalog has initialized!")); } if ((Object)(object)equip.EquipmentDef == (Object)null) { ItemsPlugin.Logger.LogError((object)"EquipmentDef is null ! Can't add the custom Equipment."); } if (string.IsNullOrEmpty(((Object)equip.EquipmentDef).name)) { ItemsPlugin.Logger.LogError((object)"EquipmentDef.name is null or empty ! Can't add the custom Equipment."); } if (!Object.op_Implicit((Object)(object)equip.EquipmentDef.pickupModelPrefab)) { ItemsPlugin.Logger.LogWarning((object)("No EquipmentDef.pickupModelPrefab (" + ((Object)equip.EquipmentDef).name + "), the game will show nothing when the equipment is on the ground.")); } if (equip.ItemDisplayRules != null && equip.ItemDisplayRules.Dictionary.Values.Any((ItemDisplayRule[] rules) => rules.Any((ItemDisplayRule rule) => (int)rule.ruleType == 0)) && equip.ItemDisplayRules.HasInvalidDisplays(out StringBuilder logger)) { ItemsPlugin.Logger.LogWarning((object)(string.Format("Some of the ItemDisplayRules in the dictionary for CustomEquipment ({0}) have an invalid {1}. ", equip.EquipmentDef, "followerPrefab") + "(There are ItemDisplayRuleType.ParentedPrefab rules),Logging invalid rules... (For full details, check the Log file)")); ItemsPlugin.Logger.LogDebug((object)logger.ToString()); } bool flag = false; try { new XElement(((Object)equip.EquipmentDef).name); flag = true; } catch { ItemsPlugin.Logger.LogError((object)("Custom equipment '" + ((Object)equip.EquipmentDef).name + "' is not XMLsafe. Equipment not added.")); } if (flag) { R2APIContentManager.HandleContentAddition(addingAssembly, (Object)(object)equip.EquipmentDef); EquipmentDefinitions.Add(equip); return true; } return false; } public static ItemTag AddItemTag(string name) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SetHooks(); if (!CatalogBlockers.GetAvailability<ItemDef>()) { ItemsPlugin.Logger.LogError((object)("Too late ! Tried to add itemTag: " + name + " after the ItemCatalog has Initialized!")); return (ItemTag)(-1); } int num = (int)FindItemTagByName(name); if (num == -1) { customItemTags.Add(name); num = customItemTags.Count + 21; } return (ItemTag)num; } public static ItemTag FindItemTagByName(string name) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0023: 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: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) SetHooks(); ItemTag result = (ItemTag)customItemTags.IndexOf(name); if ((int)result == -1) { if (Enum.TryParse<ItemTag>(name, out result)) { return result; } return (ItemTag)(-1); } return (ItemTag)(result + 1 + 21); } public static void ApplyTagToItem(string tagName, ItemDef item) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SetHooks(); ApplyTagToItem(FindItemTagByName(tagName), item); } public static void ApplyTagToItem(ItemTag tag, ItemDef item) { //IL_001e: 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_002a: Unknown result type (might be due to invalid IL or missing references) SetHooks(); ArrayUtils.ArrayAppend<ItemTag>(ref item.tags, ref tag); if (!CatalogBlockers.GetAvailability<ItemDef>()) { ref ItemIndex[] reference = ref ItemCatalog.itemIndicesByTag[tag]; ItemIndex itemIndex = item.itemIndex; ArrayUtils.ArrayAppend<ItemIndex>(ref reference, ref itemIndex); } } public static void DoNotAutoIDRSFor(string bodyPrefabOrCharacterModelName) { SetHooks(); noDefaultIDRSCharacterList.Add(bodyPrefabOrCharacterModelName); } public static void DoNotAutoIDRSFor(GameObject bodyPrefab) { SetHooks(); if (Object.op_Implicit((Object)(object)bodyPrefab.GetComponentInChildren<CharacterModel>())) { DoNotAutoIDRSFor(((Object)bodyPrefab).name); } } private static void MaterialFixForItemDisplayOnCharacter(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int forCounterLoc = 0; int itemDisplayLoc = 0; try { val.GotoNext(new Func<Instruction, bool>[3] { (Instruction i) => ILPatternMatchingExt.MatchLdarg(i, 0), (Instruction i) => ILPatternMatchingExt.MatchLdfld(i, "RoR2.CharacterModel", "parentedPrefabDisplays"), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, ref forCounterLoc) }); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt(i, "RoR2.CharacterModel/ParentedPrefabDisplay", "get_itemDisplay"), (Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref itemDisplayLoc) }); val.Index += 2; val.Emit(OpCodes.Ldloc, itemDisplayLoc); val.Emit(OpCodes.Call, (MethodBase)Reflection.GetMethodCached(typeof(Object), "op_Implicit")); val.Emit(OpCodes.Brfalse, (object)val.MarkLabel()); int index = val.Index - 1; val.GotoNext(new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, forCounterLoc) }); ILLabel operand = val.MarkLabel(); val.Index = index; val.Next.Operand = operand; } catch (Exception arg) { ItemsPlugin.Logger.LogError((object)string.Format("Exception in {0} : Item mods without the {1} component may not work correctly.\n{2}", "MaterialFixForItemDisplayOnCharacter", "ItemDisplay", arg)); } } private static void AddingItemDisplayRulesToCharacterModels(orig_Init orig) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { CharacterModel componentInChildren = allBodyPrefab.GetComponentInChildren<CharacterModel>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { continue; } if (!Object.op_Implicit((Object)(object)componentInChildren.itemDisplayRuleSet)) { componentInChildren.itemDisplayRuleSet = ScriptableObject.CreateInstance<ItemDisplayRuleSet>(); } string name = ((Object)componentInChildren).name; string name2 = ((Object)allBodyPrefab).name; bool flag = true; if (noDefaultIDRSCharacterList.Contains(name) || noDefaultIDRSCharacterList.Contains(name2)) { flag = false; } foreach (CustomItem itemDefinition in ItemDefinitions) { ItemDisplayRuleDict itemDisplayRules = itemDefinition.ItemDisplayRules; if (itemDisplayRules != null && (itemDisplayRules.TryGetRules(name, out ItemDisplayRule[] itemDisplayRules2) || itemDisplayRules.TryGetRules(name2, out itemDisplayRules2) || (flag && componentInChildren.itemDisplayRuleSet.GetItemDisplayRuleGroup(itemDefinition.ItemDef.itemIndex).rules == null))) { componentInChildren.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)itemDefinition.ItemDef, new DisplayRuleGroup { rules = itemDisplayRules2 }); } } foreach (CustomEquipment equipmentDefinition in EquipmentDefinitions) { ItemDisplayRuleDict itemDisplayRules3 = equipmentDefinition.ItemDisplayRules; if (itemDisplayRules3 != null && (itemDisplayRules3.TryGetRules(name, out ItemDisplayRule[] itemDisplayRules4) || itemDisplayRules3.TryGetRules(name2, out itemDisplayRules4) || (flag && componentInChildren.itemDisplayRuleSet.GetEquipmentDisplayRuleGroup(equipmentDefinition.EquipmentDef.equipmentIndex).rules == null))) { componentInChildren.itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)equipmentDefinition.EquipmentDef, new DisplayRuleGroup { rules = itemDisplayRules4 }); } } componentInChildren.itemDisplayRuleSet.GenerateRuntimeValues(); } } private static void AddCustomTagsToItemCatalog(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 21) })) { val.EmitDelegate<Func<int>>((Func<int>)(() => customItemTags.Count + 1)); val.Emit(OpCodes.Add); } } } public class ItemDisplayRuleDict { public ItemDisplayRule[]? this[string? bodyPrefabName] { get { if (string.IsNullOrEmpty(bodyPrefabName) || !Dictionary.ContainsKey(bodyPrefabName)) { return DefaultRules; } return Dictionary[bodyPrefabName]; } set { if (string.IsNullOrEmpty(bodyPrefabName)) { ItemsPlugin.Logger.LogWarning((object)"DefaultRules overwritten with Indexer! Please set them with the constructor instead!"); DefaultRules = value; } else if (Dictionary.ContainsKey(bodyPrefabName)) { Dictionary[bodyPrefabName] = value; } else { Dictionary.Add(bodyPrefabName, value); } } } public ItemDisplayRule[]? DefaultRules { get; private set; } internal Dictionary<string, ItemDisplayRule[]?> Dictionary { get; private set; } public void Add(string? bodyPrefabName, params ItemDisplayRule[]? itemDisplayRules) { this[bodyPrefabName] = itemDisplayRules; } public bool TryGetRules(string? bodyPrefabName, out ItemDisplayRule[] itemDisplayRules) { itemDisplayRules = this[bodyPrefabName]; if (bodyPrefabName != null) { return Dictionary.ContainsKey(bodyPrefabName); } return false; } internal bool HasInvalidDisplays(out StringBuilder logger) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00d4: Unknown result type (might be due to invalid IL or missing references) bool result = false; logger = new StringBuilder(); string text = default(string); ItemDisplayRule[] array = default(ItemDisplayRule[]); foreach (KeyValuePair<string, ItemDisplayRule[]> item in Dictionary) { KeyValuePairExtensions.Deconstruct<string, ItemDisplayRule[]>(item, ref text, ref array); string arg = text; ItemDisplayRule[] array2 = array; for (int i = 0; i < array2.Length; i++) { ItemDisplayRule val = array2[i]; if ((int)val.ruleType != 0) { continue; } if (!Object.op_Implicit((Object)(object)val.followerPrefab)) { logger.AppendLine($"invalid follower prefab for entry {arg}. The follower prefab of entry N°{i} is null. (The ItemDisplayRule.ruleType is ItemDisplayRuleType.ParentedPrefab)"); result = true; continue; } ItemDisplay component = val.followerPrefab.GetComponent<ItemDisplay>(); if (!Object.op_Implicit((Object)(object)component)) { logger.AppendLine($"Invalid follower prefab for entry {arg}. The follower prefab ({val.followerPrefab}) does not have an ItemDisplay component. (The ItemDisplayRule.ruleType is ItemDisplayRuleType.ParentedPrefab) " + "The ItemDisplay model should have one and have at least a rendererInfo in it for having correct visibility levels."); result = true; } else if (component.rendererInfos == null || component.rendererInfos.Length == 0) { logger.AppendLine($"Invalid follower prefab for entry {arg}. The follower prefab ({val.followerPrefab}) has an ItemDisplay component, but no RendererInfos assigned. (The ItemDisplayRule.ruleType is ItemDisplayRuleType.ParentedPrefab)" + "The ItemDisplay model should have one and have at least a rendererInfo in it for having correct visibility levels."); result = true; } } } return result; } public ItemDisplayRuleDict(params ItemDisplayRule[]? defaultRules) { DefaultRules = defaultRules; Dictionary = new Dictionary<string, ItemDisplayRule[]>(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.items", "R2API.Items", "1.0.3")] public sealed class ItemsPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { ItemAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Language/R2API.Language/R2API.Language.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.AutoVersionGen; using RoR2; using SimpleJSON; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Language")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.Language")] [assembly: AssemblyTitle("R2API.Language")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class LanguageAPI { public class LanguageOverlay { public readonly ReadOnlyCollection<OverlayTokenData> readOnlyOverlays; private readonly List<OverlayTokenData> overlayTokenDatas; internal LanguageOverlay(List<OverlayTokenData> data) { overlayTokenDatas = data; readOnlyOverlays = overlayTokenDatas.AsReadOnly(); temporaryOverlays.Add(this); Add(); } private void Add() { foreach (OverlayTokenData readOnlyOverlay in readOnlyOverlays) { if (!OverlayLanguage.ContainsKey(readOnlyOverlay.lang)) { OverlayLanguage.Add(readOnlyOverlay.lang, new Dictionary<string, string>()); } OverlayLanguage[readOnlyOverlay.lang][readOnlyOverlay.key] = readOnlyOverlay.value; } } public void Remove() { SetHooks(); temporaryOverlays.Remove(this); OverlayLanguage.Clear(); foreach (LanguageOverlay temporaryOverlay in temporaryOverlays) { temporaryOverlay.Add(); } } } public struct OverlayTokenData { public string key; public string value; public string lang; public bool isGeneric; internal OverlayTokenData(string _key, string _value, string _lang) { key = _key; value = _value; if (_lang == "generic") { isGeneric = true; } else { isGeneric = false; } lang = _lang; } internal OverlayTokenData(string _key, string _value) { key = _key; value = _value; lang = "generic"; isGeneric = true; } } [CompilerGenerated] private static class <>O { public static hook_GetLocalizedStringByToken <0>__Language_GetLocalizedStringByToken; public static hook_TokenIsRegistered <1>__Language_TokenIsRegistered; } public const string PluginGUID = "com.bepis.r2api.language"; public const string PluginName = "R2API.Language"; private static readonly Dictionary<string, Dictionary<string, string>> CustomLanguage = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, Dictionary<string, string>> OverlayLanguage = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase); private static readonly List<LanguageOverlay> temporaryOverlays = new List<LanguageOverlay>(); private const string genericLanguage = "generic"; private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown if (!_hooksEnabled) { _hooksEnabled = true; LoadLanguageFilesFromPluginFolder(); _hooksEnabled = false; object obj = <>O.<0>__Language_GetLocalizedStringByToken; if (obj == null) { hook_GetLocalizedStringByToken val = Language_GetLocalizedStringByToken; <>O.<0>__Language_GetLocalizedStringByToken = val; obj = (object)val; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj; object obj2 = <>O.<1>__Language_TokenIsRegistered; if (obj2 == null) { hook_TokenIsRegistered val2 = Language_TokenIsRegistered; <>O.<1>__Language_TokenIsRegistered = val2; obj2 = (object)val2; } Language.TokenIsRegistered += (hook_TokenIsRegistered)obj2; _hooksEnabled = true; } } private static void LoadLanguageFilesFromPluginFolder() { string[] files = Directory.GetFiles(Paths.PluginPath, "*.language", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { AddPath(files[i]); } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__Language_GetLocalizedStringByToken; if (obj == null) { hook_GetLocalizedStringByToken val = Language_GetLocalizedStringByToken; <>O.<0>__Language_GetLocalizedStringByToken = val; obj = (object)val; } Language.GetLocalizedStringByToken -= (hook_GetLocalizedStringByToken)obj; object obj2 = <>O.<1>__Language_TokenIsRegistered; if (obj2 == null) { hook_TokenIsRegistered val2 = Language_TokenIsRegistered; <>O.<1>__Language_TokenIsRegistered = val2; obj2 = (object)val2; } Language.TokenIsRegistered -= (hook_TokenIsRegistered)obj2; _hooksEnabled = false; } private static bool Language_TokenIsRegistered(orig_TokenIsRegistered orig, Language self, string token) { string name = self.name; if (OverlayLanguage.ContainsKey(name) && OverlayLanguage[name].ContainsKey(token)) { return true; } if (OverlayLanguage.ContainsKey("generic") && OverlayLanguage["generic"].ContainsKey(token)) { return true; } if (CustomLanguage.ContainsKey(name) && CustomLanguage[name].ContainsKey(token)) { return true; } if (CustomLanguage.ContainsKey("generic") && CustomLanguage["generic"].ContainsKey(token)) { return true; } return orig.Invoke(self, token); } private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token) { string name = self.name; if (OverlayLanguage.ContainsKey(name) && OverlayLanguage[name].ContainsKey(token)) { return OverlayLanguage[name][token]; } if (OverlayLanguage.ContainsKey("generic") && OverlayLanguage["generic"].ContainsKey(token)) { return OverlayLanguage["generic"][token]; } if (CustomLanguage.ContainsKey(name) && CustomLanguage[name].ContainsKey(token)) { return CustomLanguage[name][token]; } if (CustomLanguage.ContainsKey("generic") && CustomLanguage["generic"].ContainsKey(token)) { return CustomLanguage["generic"][token]; } return orig.Invoke(self, token); } private static Dictionary<string, Dictionary<string, string>>? LoadFile(string fileContent) { Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>(); try { JSONNode val = JSON.Parse(fileContent); if (val == (object)null) { return null; } foreach (string key in val.Keys) { JSONNode val2 = val[key]; if (val2 == (object)null) { continue; } string text = key; if (text == "strings") { text = "generic"; } if (!dictionary.ContainsKey(text)) { dictionary.Add(text, new Dictionary<string, string>()); } Dictionary<string, string> dictionary2 = dictionary[text]; foreach (string key2 in val2.Keys) { dictionary2.Add(key2, val2[key2].Value); } } } catch (Exception ex) { Debug.LogFormat("Parsing error in language file , Error: {0}", new object[1] { ex }); return null; } if (dictionary.Count == 0) { return null; } return dictionary; } public static void Add(string? key, string? value) { SetHooks(); if (key == null) { throw new NullReferenceException("param key is null"); } if (value == null) { throw new NullReferenceException("param value is null"); } Add(key, value, "generic"); } public static void Add(string? key, string? value, string? language) { SetHooks(); if (key == null) { throw new NullReferenceException("param key is null"); } if (value == null) { throw new NullReferenceException("param value is null"); } if (language == null) { throw new NullReferenceException("param language is null"); } if (!CustomLanguage.ContainsKey(language)) { CustomLanguage.Add(language, new Dictionary<string, string>()); } Dictionary<string, string> dictionary = CustomLanguage[language]; if (!dictionary.ContainsKey(key)) { dictionary.Add(key, value); } } public static void AddPath(string? path) { SetHooks(); if (path == null) { throw new NullReferenceException("param path is null"); } Add(File.ReadAllText(path)); } public static void Add(string? file) { SetHooks(); if (file == null) { throw new NullReferenceException("param file is null"); } Dictionary<string, Dictionary<string, string>> dictionary = LoadFile(file); if (dictionary != null) { Add(dictionary); } } public static void Add(Dictionary<string, string?>? tokenDictionary) { SetHooks(); Add(tokenDictionary, "generic"); } public static void Add(Dictionary<string, string?>? tokenDictionary, string? language) { SetHooks(); if (tokenDictionary == null) { throw new NullReferenceException("param tokenDictionary is null"); } foreach (KeyValuePair<string, string> item in tokenDictionary) { if (item.Value != null) { Add(item.Key, item.Value, language); } } } public static void Add(Dictionary<string, Dictionary<string, string?>?>? languageDictionary) { SetHooks(); if (languageDictionary == null) { throw new NullReferenceException("param languageDictionary is null"); } foreach (KeyValuePair<string, Dictionary<string, string>> item in languageDictionary) { Add(item.Value, item.Key); } } public static LanguageOverlay AddOverlay(string? key, string? value) { SetHooks(); if (key == null) { throw new NullReferenceException("param key is null"); } if (value == null) { throw new NullReferenceException("param value is null"); } return AddOverlay(key, value, "generic"); } public static LanguageOverlay AddOverlay(string? key, string? value, string? lang) { SetHooks(); if (key == null) { throw new NullReferenceException("param key is null"); } if (value == null) { throw new NullReferenceException("param value is null"); } if (lang == null) { throw new NullReferenceException("param lang is null"); } return new LanguageOverlay(new List<OverlayTokenData>(1) { new OverlayTokenData(key, value, lang) }); } public static LanguageOverlay? AddOverlayPath(string? path) { SetHooks(); if (path == null) { throw new NullReferenceException("param path is null"); } string text = File.ReadAllText(path); if (text == null) { return null; } return AddOverlay(text); } public static LanguageOverlay? AddOverlay(string? file) { SetHooks(); if (file == null) { throw new NullReferenceException("param file is null"); } Dictionary<string, Dictionary<string, string>> dictionary = LoadFile(file); if (dictionary == null) { return null; } return AddOverlay(dictionary); } public static LanguageOverlay AddOverlay(Dictionary<string, string?>? tokenDictionary) { SetHooks(); if (tokenDictionary == null) { throw new NullReferenceException("param tokenDictionary is null"); } return AddOverlay(tokenDictionary, "generic"); } public static LanguageOverlay AddOverlay(Dictionary<string, string?>? tokenDictionary, string? language) { SetHooks(); if (tokenDictionary == null) { throw new NullReferenceException("param tokenDictionary is null"); } if (language == null) { throw new NullReferenceException("param language is null"); } List<OverlayTokenData> list = new List<OverlayTokenData>(tokenDictionary.Count); foreach (KeyValuePair<string, string> item in tokenDictionary) { if (item.Value != null) { list.Add(new OverlayTokenData(item.Key, item.Value, language)); } } return new LanguageOverlay(list); } public static LanguageOverlay AddOverlay(Dictionary<string, Dictionary<string, string?>?>? languageDictionary) { SetHooks(); if (languageDictionary == null) { throw new NullReferenceException("param languageDictionary is null"); } List<OverlayTokenData> list = new List<OverlayTokenData>(); foreach (KeyValuePair<string, Dictionary<string, string>> item in languageDictionary) { if (item.Value == null) { continue; } foreach (KeyValuePair<string, string> item2 in item.Value) { if (item2.Value != null) { list.Add(new OverlayTokenData(item.Key, item2.Key, item2.Value)); } } } return new LanguageOverlay(list); } } [BepInPlugin("com.bepis.r2api.language", "R2API.Language", "1.0.1")] public sealed class LanguagePlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnEnable() { LanguageAPI.SetHooks(); } private void OnDisable() { LanguageAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Loadout/R2API.Loadout/R2API.Loadout.dll
Decompiled 11 months agousing 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.Logging; using EntityStates; using Microsoft.CodeAnalysis; using R2API.AutoVersionGen; using R2API.ContentManagement; using RoR2; using RoR2.Skills; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Loadout")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("R2API.Loadout")] [assembly: AssemblyTitle("R2API.Loadout")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [Obsolete("R2API 4.x.x has made LoadoutAPI Obsolete.\nFor adding Skills, SkillFamilies and EntityStates, utilize the \"R2API.ContentManagement\" submodule.\nFor adding Skins, utilize the \"R2API.Skins\" submodule.\nThis submodule will be removed on the next major R2API release")] [AutoVersion] public static class LoadoutAPI { [Obsolete("Utilize the SkinDefInfo in the R2API namespace instead of this nested type.s")] public struct SkinDefInfo { public SkinDef?[]? BaseSkins; public Sprite? Icon; public string? NameToken; public UnlockableDef? UnlockableDef; public GameObject? RootObject; public RendererInfo[]? RendererInfos; public MeshReplacement[]? MeshReplacements; public GameObjectActivation[]? GameObjectActivations; public ProjectileGhostReplacement[]? ProjectileGhostReplacements; public MinionSkinReplacement[]? MinionSkinReplacements; public string? Name; public static implicit operator SkinDefInfo(SkinDefInfo orig) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) SkinDefInfo result = default(SkinDefInfo); result.BaseSkins = orig.BaseSkins; result.Icon = orig.Icon; result.NameToken = orig.NameToken; result.UnlockableDef = orig.UnlockableDef; result.RootObject = orig.RootObject; result.RendererInfos = orig.RendererInfos; result.MeshReplacements = orig.MeshReplacements; result.GameObjectActivations = orig.GameObjectActivations; result.ProjectileGhostReplacements = orig.ProjectileGhostReplacements; result.MinionSkinReplacements = orig.MinionSkinReplacements; result.Name = orig.Name; return result; } } public const string PluginGUID = "com.bepis.r2api.loadout"; public const string PluginName = "R2API.Loadout"; public const string ObsoleteMessage = "R2API 4.x.x has made LoadoutAPI Obsolete.\nFor adding Skills, SkillFamilies and EntityStates, utilize the \"R2API.ContentManagement\" submodule.\nFor adding Skins, utilize the \"R2API.Skins\" submodule.\nThis submodule will be removed on the next major R2API release"; public const string PluginVersion = "1.0.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; [Obsolete("AddSkill() is obsolete, please add your SkillTypes via R2API.ContentAddition.AddEntityState(Type, bool)")] public static bool AddSkill(Type? t) { if (!CatalogBlockers.GetAvailability<EntityState>()) { LoadoutPlugin.Logger.LogError((object)$"Too late ! Tried to add skill type {t} after the EntityStateCatalog has initialized!"); return false; } if (t == null || !t.IsSubclassOf(typeof(EntityState)) || t.IsAbstract) { LoadoutPlugin.Logger.LogError((object)"Invalid skill type."); return false; } R2APIContentManager.HandleEntityState(Assembly.GetCallingAssembly(), t); return true; } [Obsolete("StateTypeOf<T> is obsolete, please add your SkillTypes via R2API.ContentAddition.AddEntityState<T>(bool)")] public static SerializableEntityStateType StateTypeOf<T>() where T : EntityState, new() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!CatalogBlockers.GetAvailability<EntityState>()) { LoadoutPlugin.Logger.LogError((object)$"Too late ! Tried to add skill type {typeof(T)} after the EntityStateCatalog has initialized!"); return default(SerializableEntityStateType); } R2APIContentManager.HandleEntityState(Assembly.GetCallingAssembly(), typeof(T)); return new SerializableEntityStateType(typeof(T)); } [Obsolete("AddSkillDef is obsolete, please add your SkillDefs via R2API.ContentAddition.AddSkillDef(SkillDef)")] public static bool AddSkillDef(SkillDef? s) { if (!CatalogBlockers.GetAvailability<SkillDef>()) { LoadoutPlugin.Logger.LogError((object)("Too late ! Tried to add skillDef " + s.skillName + " after the SkillCatalog has initialized!")); return false; } if (!Object.op_Implicit((Object)(object)s)) { LoadoutPlugin.Logger.LogError((object)"Invalid SkillDef"); return false; } R2APIContentManager.HandleContentAddition(Assembly.GetCallingAssembly(), (Object)(object)s); return true; } [Obsolete("AddSkillFamily is obsolete, please add your SkillFamilies via R2API.ContentAddition.AddSkillFamily(SkillFamily)")] public static bool AddSkillFamily(SkillFamily? sf) { if (!CatalogBlockers.GetAvailability<SkillFamily>()) { LoadoutPlugin.Logger.LogError((object)"Too late ! Tried to add skillFamily after the SkillCatalog has initialized!"); } if (!Object.op_Implicit((Object)(object)sf)) { LoadoutPlugin.Logger.LogError((object)"Invalid SkillFamily"); return false; } R2APIContentManager.HandleContentAddition(Assembly.GetCallingAssembly(), (Object)(object)sf); return true; } [Obsolete("Create Skin Icons using R2API.Skins.CreateSkinIcon(Color, Color, Color, Color)")] public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left) { //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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) return Skins.CreateSkinIcon(top, right, bottom, left, new Color(0.6f, 0.6f, 0.6f)); } [Obsolete("Create Skin Icons using R2API.Skins.CreateSkinIcon(Color, Color, Color, Color, Color)")] public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left, Color line) { //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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) return Skins.CreateSkinIcon(top, right, bottom, left, new Color(0.6f, 0.6f, 0.6f)); } [Obsolete("Create SkinDefs using R2API.Skins.CreateNewSkinDef(SkinDefInfo)")] public static SkinDef CreateNewSkinDef(SkinDefInfo skin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Skins.CreateNewSkinDef((SkinDefInfo)skin); } [Obsolete("Add Skins to Characters using R2API.Skins.AddSkinToCharacter(GameObject, SkinDefInfo)")] public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDefInfo skin) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Skins.AddSkinToCharacter(bodyPrefab, (SkinDefInfo)skin); } [Obsolete("Add Skins to Characters using R2API.Skins.AddSkinToCharacter(GameObject, SkinDef)")] public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDef? skin) { return Skins.AddSkinToCharacter(bodyPrefab, skin); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.loadout", "R2API.Loadout", "1.0.2")] [Obsolete("R2API 4.x.x has made LoadoutAPI Obsolete.\nFor adding Skills, SkillFamilies and EntityStates, utilize the \"R2API.ContentManagement\" submodule.\nFor adding Skins, utilize the \"R2API.Skins\" submodule.\nThis submodule will be removed on the next major R2API release")] public sealed class LoadoutPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_LobbyConfig/R2API.LobbyConfig/R2API.LobbyConfig.dll
Decompiled 11 months 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using R2API.AutoVersionGen; using R2API.Utils; using RoR2; using RoR2.UI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.LobbyConfig")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.LobbyConfig")] [assembly: AssemblyTitle("R2API.LobbyConfig")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class LobbyConfigAPI { public class LobbyCategory { internal readonly RuleCategoryDef Def; private readonly List<LobbyCategory> _children = new List<LobbyCategory>(); public LobbyCategory(string? title, Color color, string? description) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) SetHooks(); Reflection.GetMethodCached(typeof(RuleCatalog), "AddCategory", new Type[4] { typeof(string), typeof(Color), typeof(string), typeof(Func<bool>) }).Invoke(null, new object[4] { title, color, description, null }); Def = RuleCatalog.allCategoryDefs.Last(); } public LobbyCategory(RuleCategoryDef? category) { SetHooks(); Def = category; } public LobbyCategory PushRule<T>(LobbyRule<T> rule) { SetHooks(); rule.Pushed = true; rule.Def.globalIndex = RuleCatalog.ruleCount; Reflection.GetMethodCached(typeof(RuleCatalog), "AddRule", new Type[1] { typeof(RuleDef) }).Invoke(null, new object[1] { rule.Def }); RuleCatalog.allCategoryDefs.Last()?.children.Remove(rule.Def); ((IEnumerable<RuleCategoryDef>)RuleCatalog.allCategoryDefs).FirstOrDefault((Func<RuleCategoryDef, bool>)((RuleCategoryDef x) => x == Def))?.children.Add(rule.Def); rule.Def.category = Def; rule.Def.choices.ForEach(delegate(RuleChoiceDef x) { x.globalIndex = RuleCatalog.choiceCount; InternalRuleChoices.Add(x); }); Array.Resize(ref PreGameRuleVoteController.votesForEachChoice, RuleCatalog.choiceCount); UpdateValues += rule.UpdateValue; return this; } public LobbyCategory AddChildCategory(LobbyCategory? category) { SetHooks(); if (category == this) { throw new ArgumentException("Cannot be own parent."); } if (_children.Count == 0) { CollapseCategory += HideChildren; } _children.Add(category); return this; } private void HideChildren(object sender, RuleCategoryController category) { RuleCategoryController category2 = category; if (Def != Reflection.GetFieldValue<RuleCategoryDef>((object)category2, "currentCategory")) { return; } _children.ForEach(delegate(LobbyCategory child) { LobbyCategory child2 = child; RuleCategoryController val = _controllers?.FirstOrDefault((Func<RuleCategoryController, bool>)((RuleCategoryController c) => Reflection.GetFieldValue<RuleCategoryDef>((object)c, "currentCategory") == child2.Def)); Reflection.SetFieldValue<bool>((object)val, "collapsed", true); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(!Reflection.GetFieldValue<bool>((object)category2, "collapsed")); } child2.HideChildren(null, val); }); } } public class LobbyRule<T> { internal readonly RuleDef Def; internal bool Pushed; private object _val; private int _choiceNameSequence; public T Value => (T)_val; public event EventHandler<T>? ValueChanged; public LobbyRule() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown SetHooks(); Def = new RuleDef(RuleNameSequence(), "R2API_RULE"); } public LobbyRule<T> AddChoice(T value, string? title, string? description, Color titleColor, Color descriptionColor, string? sprite = "") { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references) SetHooks(); if (Pushed) { throw new NotSupportedException("Cannot add choice after rule has been pushed."); } RuleChoiceDef obj = Def.AddChoice(ChoiceNameSequence(), (object)value, false); obj.tooltipNameToken = title; obj.tooltipNameColor = titleColor; obj.tooltipBodyToken = description; obj.tooltipBodyColor = descriptionColor; obj.spritePath = sprite; return this; } public LobbyRule<T> MakeValueDefault(T value) { T value2 = value; SetHooks(); RuleChoiceDef val = ((IEnumerable<RuleChoiceDef>)Def.choices).FirstOrDefault((Func<RuleChoiceDef, bool>)((RuleChoiceDef x) => value2.Equals(x.extraData))); if (val != null) { Def.defaultChoiceIndex = val.localIndex; } return this; } private string ChoiceNameSequence() { return $"{Def.globalName}_{++_choiceNameSequence:D3}"; } internal void UpdateValue(object _, RuleChoiceDef choiceDef) { if (choiceDef.ruleDef == Def && choiceDef.extraData != _val) { _val = choiceDef.extraData; this.ValueChanged?.Invoke(this, Value); } } } [CompilerGenerated] private static class <>O { public static hook_ApplyChoice <0>__HookApplyChoice_RuleBook; public static hook_Awake <1>__HookAwake_PreGameController; public static hook_Start <2>__HookStart_RuleBookViewer; public static hook_TogglePopoutPanel <3>__HookTogglePopoutPanel_RuleCategoryController; } public const string PluginGUID = "com.bepis.r2api.lobbyconfig"; public const string PluginName = "R2API.LobbyConfig"; private static int _ruleNameSequence; private static readonly List<RuleChoiceDef> InternalRuleChoices = Reflection.GetFieldValue<List<RuleChoiceDef>>(typeof(RuleCatalog), "allChoicesDefs"); private static List<RuleCategoryController> _controllers; private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; private static event EventHandler<RuleChoiceDef> UpdateValues; private static event EventHandler<RuleCategoryController> CollapseCategory; internal static string RuleNameSequence() { return $"LCAPI_{++_ruleNameSequence:D5}"; } private static void HookAwake_PreGameController(orig_Awake orig, PreGameController self) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown orig.Invoke(self); object obj = <>O.<0>__HookApplyChoice_RuleBook; if (obj == null) { hook_ApplyChoice val = HookApplyChoice_RuleBook; <>O.<0>__HookApplyChoice_RuleBook = val; obj = (object)val; } RuleBook.ApplyChoice -= (hook_ApplyChoice)obj; object obj2 = <>O.<0>__HookApplyChoice_RuleBook; if (obj2 == null) { hook_ApplyChoice val2 = HookApplyChoice_RuleBook; <>O.<0>__HookApplyChoice_RuleBook = val2; obj2 = (object)val2; } RuleBook.ApplyChoice += (hook_ApplyChoice)obj2; } private static void HookApplyChoice_RuleBook(orig_ApplyChoice orig, RuleBook self, RuleChoiceDef choiceDef) { orig.Invoke(self, choiceDef); LobbyConfigAPI.UpdateValues?.Invoke(self, choiceDef); } private static void HookStart_RuleBookViewer(orig_Start orig, RuleBookViewer self) { orig.Invoke(self); _controllers = Reflection.GetFieldValue<List<RuleCategoryController>>((object)Reflection.GetFieldValue<UIElementAllocator<RuleCategoryController>>((object)self, "categoryElementAllocator"), "elementControllerComponentsList"); } private static void HookTogglePopoutPanel_RuleCategoryController(orig_TogglePopoutPanel orig, RuleCategoryController self) { orig.Invoke(self); LobbyConfigAPI.CollapseCategory?.Invoke(null, self); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<1>__HookAwake_PreGameController; if (obj == null) { hook_Awake val = HookAwake_PreGameController; <>O.<1>__HookAwake_PreGameController = val; obj = (object)val; } PreGameController.Awake += (hook_Awake)obj; object obj2 = <>O.<2>__HookStart_RuleBookViewer; if (obj2 == null) { hook_Start val2 = HookStart_RuleBookViewer; <>O.<2>__HookStart_RuleBookViewer = val2; obj2 = (object)val2; } RuleBookViewer.Start += (hook_Start)obj2; object obj3 = <>O.<3>__HookTogglePopoutPanel_RuleCategoryController; if (obj3 == null) { hook_TogglePopoutPanel val3 = HookTogglePopoutPanel_RuleCategoryController; <>O.<3>__HookTogglePopoutPanel_RuleCategoryController = val3; obj3 = (object)val3; } RuleCategoryController.TogglePopoutPanel += (hook_TogglePopoutPanel)obj3; _hooksEnabled = true; } } internal static void UnsetHooks() { //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 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<1>__HookAwake_PreGameController; if (obj == null) { hook_Awake val = HookAwake_PreGameController; <>O.<1>__HookAwake_PreGameController = val; obj = (object)val; } PreGameController.Awake -= (hook_Awake)obj; object obj2 = <>O.<0>__HookApplyChoice_RuleBook; if (obj2 == null) { hook_ApplyChoice val2 = HookApplyChoice_RuleBook; <>O.<0>__HookApplyChoice_RuleBook = val2; obj2 = (object)val2; } RuleBook.ApplyChoice -= (hook_ApplyChoice)obj2; object obj3 = <>O.<2>__HookStart_RuleBookViewer; if (obj3 == null) { hook_Start val3 = HookStart_RuleBookViewer; <>O.<2>__HookStart_RuleBookViewer = val3; obj3 = (object)val3; } RuleBookViewer.Start -= (hook_Start)obj3; _hooksEnabled = false; } } [BepInPlugin("com.bepis.r2api.lobbyconfig", "R2API.LobbyConfig", "1.0.1")] public sealed class LobbyConfigPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { LobbyConfigAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Networking/R2API.Networking/R2API.Networking.dll
Decompiled 11 months agousing System; 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.Logging; using Microsoft.CodeAnalysis; using R2API.AutoVersionGen; using R2API.Networking.Interfaces; using R2API.Networking.Messages; using R2API.Utils; using RoR2; using RoR2.Networking; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Networking")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("R2API.Networking")] [assembly: AssemblyTitle("R2API.Networking")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [assembly: TypeForwardedTo(typeof(CompatibilityLevel))] [assembly: TypeForwardedTo(typeof(NetworkCompatibility))] [assembly: TypeForwardedTo(typeof(VersionStrictness))] [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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.Networking { internal class Header : ISerializableObject { internal int TypeCode { get; private set; } internal NetworkDestination Destination { get; private set; } public Header() { } internal Header(int typeCode, NetworkDestination dest) { TypeCode = typeCode; Destination = dest; } internal void RemoveDestination(NetworkDestination destination) { Destination &= (NetworkDestination)(byte)(~(int)destination); } public void Serialize(NetworkWriter writer) { writer.Write(TypeCode); writer.Write((byte)Destination); } public void Deserialize(NetworkReader reader) { TypeCode = reader.ReadInt32(); Destination = (NetworkDestination)reader.ReadByte(); } } [Flags] public enum NetworkDestination : byte { Clients = 1, Server = 2 } internal static class NetworkDestinationExtensions { internal static bool ShouldSend(this NetworkDestination dest) { if (NetworkServer.active) { return dest != NetworkDestination.Server; } return true; } internal static bool ShouldRun(this NetworkDestination dest) { bool active = NetworkServer.active; bool active2 = NetworkClient.active; if (!active || (dest & NetworkDestination.Server) == 0) { if (active2) { return (dest & NetworkDestination.Clients) != 0; } return false; } return true; } internal static Header GetHeader(this NetworkDestination dest, int typeCode) { return new Header(typeCode, dest); } } [AutoVersion] public static class NetworkingAPI { [CompilerGenerated] private static class <>O { public static Action <0>__RegisterServerHandlers; public static Action<NetworkClient> <1>__RegisterClientHandlers; public static Action <2>__UnRegisterServerHandlers; public static Action <3>__UnRegisterClientHandlers; public static NetworkMessageDelegate <4>__HandleMessageServer; public static NetworkMessageDelegate <5>__HandleCommandServer; public static NetworkMessageDelegate <6>__HandleRequestServer; public static NetworkMessageDelegate <7>__HandleReplyServer; public static NetworkMessageDelegate <8>__HandleMessageClient; public static NetworkMessageDelegate <9>__HandleCommandClient; public static NetworkMessageDelegate <10>__HandleRequestClient; public static NetworkMessageDelegate <11>__HandleReplyClient; } public const string PluginGUID = "com.bepis.r2api.networking"; public const string PluginName = "R2API.Networking"; private static readonly Dictionary<int, INetMessage> NetMessages = new Dictionary<int, INetMessage>(); private static readonly Dictionary<int, INetCommand> NetCommands = new Dictionary<int, INetCommand>(); private static readonly Dictionary<int, RequestPerformerBase> NetRequests = new Dictionary<int, RequestPerformerBase>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static short MessageIndex => 2048; internal static short CommandIndex => 4096; internal static short RequestIndex => 6144; internal static short ReplyIndex => 8192; private static NetworkWriter UniversalWriter { get; } = new NetworkWriter(); public static bool RegisterMessageType<TMessage>() where TMessage : INetMessage, new() { SetHooks(); return RegisterMessageTypeInternal<TMessage>(); } internal static bool RegisterMessageTypeInternal<TMessage>() where TMessage : INetMessage, new() { TMessage val = new TMessage(); int networkHash = GetNetworkHash(val.GetType()); if (NetMessages.ContainsKey(networkHash)) { NetworkingPlugin.Logger.LogError((object)"Tried to register a message type with a duplicate hash"); return false; } NetMessages[networkHash] = val; return true; } public static bool RegisterCommandType<TCommand>() where TCommand : INetCommand, new() { SetHooks(); return RegisterCommandTypeInternal<TCommand>(); } internal static bool RegisterCommandTypeInternal<TCommand>() where TCommand : INetCommand, new() { TCommand val = new TCommand(); int networkHash = GetNetworkHash(val.GetType()); if (NetCommands.ContainsKey(networkHash)) { NetworkingPlugin.Logger.LogError((object)"Tried to register a command type with a duplicate hash"); return false; } NetCommands[networkHash] = val; return true; } public static bool RegisterRequestTypes<TRequest, TReply>() where TRequest : INetRequest<TRequest, TReply>, new() where TReply : INetRequestReply<TRequest, TReply>, new() { SetHooks(); return RegisterRequestTypesInternal<TRequest, TReply>(); } internal static bool RegisterRequestTypesInternal<TRequest, TReply>() where TRequest : INetRequest<TRequest, TReply>, new() where TReply : INetRequestReply<TRequest, TReply>, new() { TRequest request = new TRequest(); TReply reply = new TReply(); int networkHash = GetNetworkHash(request.GetType()); if (NetRequests.ContainsKey(networkHash)) { NetworkingPlugin.Logger.LogError((object)"Tried to register a request type with a duplicate hash"); return false; } NetRequests[networkHash] = new RequestPerformer<TRequest, TReply>(request, reply); return true; } internal static void SetHooks() { if (!_hooksEnabled) { RegisterMessageTypeInternal<DamageMessage>(); RegisterMessageTypeInternal<BuffMessage>(); RegisterMessageTypeInternal<DotMessage>(); RegisterMessageTypeInternal<ExampleMessage>(); RegisterRequestTypesInternal<ExamplePing, ExamplePingReply>(); NetworkManagerSystem.onStartServerGlobal += RegisterServerHandlers; NetworkManagerSystem.onStartClientGlobal += RegisterClientHandlers; NetworkManagerSystem.onStopServerGlobal -= UnRegisterServerHandlers; NetworkManagerSystem.onStopClientGlobal -= UnRegisterClientHandlers; _hooksEnabled = true; } } internal static void UnsetHooks() { NetworkManagerSystem.onStartServerGlobal -= RegisterServerHandlers; NetworkManagerSystem.onStartClientGlobal -= RegisterClientHandlers; NetworkManagerSystem.onStopServerGlobal += UnRegisterServerHandlers; NetworkManagerSystem.onStopClientGlobal += UnRegisterClientHandlers; _hooksEnabled = false; } private static void RegisterServerHandlers() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006e: 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: Expected O, but got Unknown //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_009e: Expected O, but got Unknown NetworkingPlugin.Logger.LogInfo((object)"Server Handlers registered"); short messageIndex = MessageIndex; object obj = <>O.<4>__HandleMessageServer; if (obj == null) { NetworkMessageDelegate val = HandleMessageServer; <>O.<4>__HandleMessageServer = val; obj = (object)val; } NetworkServer.RegisterHandler(messageIndex, (NetworkMessageDelegate)obj); short commandIndex = CommandIndex; object obj2 = <>O.<5>__HandleCommandServer; if (obj2 == null) { NetworkMessageDelegate val2 = HandleCommandServer; <>O.<5>__HandleCommandServer = val2; obj2 = (object)val2; } NetworkServer.RegisterHandler(commandIndex, (NetworkMessageDelegate)obj2); short requestIndex = RequestIndex; object obj3 = <>O.<6>__HandleRequestServer; if (obj3 == null) { NetworkMessageDelegate val3 = HandleRequestServer; <>O.<6>__HandleRequestServer = val3; obj3 = (object)val3; } NetworkServer.RegisterHandler(requestIndex, (NetworkMessageDelegate)obj3); short replyIndex = ReplyIndex; object obj4 = <>O.<7>__HandleReplyServer; if (obj4 == null) { NetworkMessageDelegate val4 = HandleReplyServer; <>O.<7>__HandleReplyServer = val4; obj4 = (object)val4; } NetworkServer.RegisterHandler(replyIndex, (NetworkMessageDelegate)obj4); } private static void RegisterClientHandlers(NetworkClient client) { //IL_0025: 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_0030: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkingPlugin.Logger.LogInfo((object)"Client Handlers registered"); short messageIndex = MessageIndex; object obj = <>O.<8>__HandleMessageClient; if (obj == null) { NetworkMessageDelegate val = HandleMessageClient; <>O.<8>__HandleMessageClient = val; obj = (object)val; } client.RegisterHandler(messageIndex, (NetworkMessageDelegate)obj); short commandIndex = CommandIndex; object obj2 = <>O.<9>__HandleCommandClient; if (obj2 == null) { NetworkMessageDelegate val2 = HandleCommandClient; <>O.<9>__HandleCommandClient = val2; obj2 = (object)val2; } client.RegisterHandler(commandIndex, (NetworkMessageDelegate)obj2); short requestIndex = RequestIndex; object obj3 = <>O.<10>__HandleRequestClient; if (obj3 == null) { NetworkMessageDelegate val3 = HandleRequestClient; <>O.<10>__HandleRequestClient = val3; obj3 = (object)val3; } client.RegisterHandler(requestIndex, (NetworkMessageDelegate)obj3); short replyIndex = ReplyIndex; object obj4 = <>O.<11>__HandleReplyClient; if (obj4 == null) { NetworkMessageDelegate val4 = HandleReplyClient; <>O.<11>__HandleReplyClient = val4; obj4 = (object)val4; } client.RegisterHandler(replyIndex, (NetworkMessageDelegate)obj4); } private static void UnRegisterServerHandlers() { NetworkingPlugin.Logger.LogInfo((object)"Server Handlers unregistered"); NetworkServer.UnregisterHandler(MessageIndex); NetworkServer.UnregisterHandler(CommandIndex); NetworkServer.UnregisterHandler(RequestIndex); NetworkServer.UnregisterHandler(ReplyIndex); } private static void UnRegisterClientHandlers() { NetworkingPlugin.Logger.LogInfo((object)"Client Handlers unregistered"); foreach (NetworkClient allClient in NetworkClient.allClients) { allClient.UnregisterHandler(MessageIndex); allClient.UnregisterHandler(CommandIndex); allClient.UnregisterHandler(RequestIndex); allClient.UnregisterHandler(ReplyIndex); } } internal static int GetNetworkHash(Type type) { return (type.Assembly.FullName + type.FullName).GetHashCode(); } internal static Writer GetWriter(short messageIndex, NetworkConnection target, QosType qos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return new Writer(UniversalWriter, messageIndex, target, qos); } private static void HandleCommandServer(NetworkMessage msg) { Header header = msg.reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Server); if (NetCommands.TryGetValue(header.TypeCode, out INetCommand value)) { value.OnReceived(); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled command received, you may be missing mods"); } } if (!header.Destination.ShouldSend()) { return; } int connectionId = msg.conn.connectionId; for (int i = 0; i < NetworkServer.connections.Count; i++) { if (i == connectionId) { continue; } NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { using Writer writer = GetWriter(CommandIndex, val, (QosType)3); SerializableObjectExtensions.Write(writer, header); } } } private static void HandleMessageServer(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Server); if (NetMessages.TryGetValue(header.TypeCode, out INetMessage value)) { value.Deserialize(reader); value.OnReceived(); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled message received, you may be missing mods"); } } if (!header.Destination.ShouldSend()) { return; } int connectionId = msg.conn.connectionId; byte[] array = reader.ReadBytes((int)(reader.Length - reader.Position)); for (int i = 0; i < NetworkServer.connections.Count; i++) { if (i == connectionId) { continue; } NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { using Writer writer = GetWriter(MessageIndex, val, (QosType)3); NetworkWriter obj = writer; obj.Write(header); obj.WriteBytesFull(array); } } } private static void HandleRequestServer(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Server); if (NetRequests.TryGetValue(header.TypeCode, out RequestPerformerBase value)) { ISerializableObject target = value.PerformRequest(reader); Header target2 = new Header(header.TypeCode, NetworkDestination.Clients); using Writer writer = GetWriter(ReplyIndex, msg.conn, (QosType)3); NetworkWriter writer2 = writer; writer2.Write(target2); writer2.Write(target); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled request message received, you may be missing mods"); } } if (!header.Destination.ShouldSend()) { return; } int connectionId = msg.conn.connectionId; byte[] array = reader.ReadBytes((int)(reader.Length - reader.Position)); for (int i = 0; i < NetworkServer.connections.Count; i++) { if (i == connectionId) { continue; } NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { using Writer writer3 = GetWriter(RequestIndex, val, (QosType)3); NetworkWriter obj = writer3; obj.Write(header); obj.WriteBytesFull(array); } } } private static void HandleReplyServer(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Server); if (NetRequests.TryGetValue(header.TypeCode, out RequestPerformerBase value)) { value.PerformReply(reader); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled reply received, you may be missing mods"); } } if (!header.Destination.ShouldSend()) { return; } int connectionId = msg.conn.connectionId; for (int i = 0; i < NetworkServer.connections.Count; i++) { if (i == connectionId) { continue; } NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { using Writer writer = GetWriter(RequestIndex, val, (QosType)3); SerializableObjectExtensions.Write(writer, header); } } } private static void HandleCommandClient(NetworkMessage msg) { Header header = msg.reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Clients); if (NetCommands.TryGetValue(header.TypeCode, out INetCommand value)) { value.OnReceived(); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled command received, you may be missing mods"); } } } private static void HandleMessageClient(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Clients); if (NetMessages.TryGetValue(header.TypeCode, out INetMessage value)) { value.Deserialize(reader); value.OnReceived(); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled message received, you may be missing mods"); } } } private static void HandleRequestClient(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (!header.Destination.ShouldRun()) { return; } header.RemoveDestination(NetworkDestination.Clients); if (NetRequests.TryGetValue(header.TypeCode, out RequestPerformerBase value)) { ISerializableObject target = value.PerformRequest(reader); Header target2 = new Header(header.TypeCode, NetworkDestination.Clients); using Writer writer = GetWriter(ReplyIndex, msg.conn, (QosType)3); NetworkWriter writer2 = writer; writer2.Write(target2); writer2.Write(target); return; } NetworkingPlugin.Logger.LogError((object)"Unhandled request message received, you may be missing mods"); } private static void HandleReplyClient(NetworkMessage msg) { NetworkReader reader = msg.reader; Header header = reader.Read<Header>(); if (header.Destination.ShouldRun()) { header.RemoveDestination(NetworkDestination.Clients); if (NetRequests.TryGetValue(header.TypeCode, out RequestPerformerBase value)) { value.PerformReply(reader); } else { NetworkingPlugin.Logger.LogError((object)"Unhandled reply received, you may be missing mods"); } } } } public static class NetworkingHelpers { public static void DealDamage(this DamageInfo? damage, HurtBox? target, bool callDamage, bool callHitEnemy, bool callHitWorld) { if (NetworkServer.active) { if (callDamage && (Object)(object)target != (Object)null && (Object)(object)target.healthComponent != (Object)null) { target.healthComponent.TakeDamage(damage); } if (callHitEnemy && (Object)(object)target != (Object)null && (Object)(object)target.healthComponent != (Object)null) { GlobalEventManager.instance.OnHitEnemy(damage, ((Component)target.healthComponent).gameObject); } if (callHitWorld) { GlobalEventManager.instance.OnHitAll(damage, (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.healthComponent)) ? ((Component)target.healthComponent).gameObject : null); } } else { new DamageMessage(damage, target, callDamage, callHitEnemy, callHitWorld).Send(NetworkDestination.Server); } } public static void ApplyBuff(this CharacterBody? body, BuffIndex buff, int stacks = 1, float duration = -1f) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { if (duration < 0f) { body.SetBuffCount(buff, stacks); return; } if (stacks < 0) { NetworkingPlugin.Logger.LogError((object)"Cannot remove duration from a buff"); return; } for (int i = 0; i < stacks; i++) { body.AddTimedBuff(buff, duration); } } else { new BuffMessage(body, buff, stacks, duration).Send(NetworkDestination.Server); } } public static void ApplyDot(this HealthComponent victim, GameObject attacker, DotIndex dotIndex, float duration = 8f, float damageMultiplier = 1f) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { DotController.InflictDot(((Component)victim).gameObject, attacker, dotIndex, duration, damageMultiplier, (uint?)null); } else { new DotMessage(((Component)victim).gameObject, attacker, dotIndex, duration, damageMultiplier).Send(NetworkDestination.Server); } } } [BepInPlugin("com.bepis.r2api.networking", "R2API.Networking", "1.0.2")] public sealed class NetworkingPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { NetworkingAPI.UnsetHooks(); } } internal abstract class RequestPerformerBase { internal abstract ISerializableObject PerformRequest(NetworkReader reader); internal abstract void PerformReply(NetworkReader reader); } internal sealed class RequestPerformer<TRequest, TReply> : RequestPerformerBase where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { private readonly TRequest _request; private readonly TReply _reply; internal RequestPerformer(TRequest request, TReply reply) { _request = request; _reply = reply; } internal override ISerializableObject PerformRequest(NetworkReader reader) { _request.Deserialize(reader); return _request.OnRequestReceived(); } internal override void PerformReply(NetworkReader reader) { _reply.Deserialize(reader); _reply.OnReplyReceived(); } } internal class Writer : IDisposable { private readonly NetworkWriter _netWriter; private readonly NetworkConnection _target; private readonly QosType _qos; internal Writer(NetworkWriter writer, short messageIndex, NetworkConnection target, QosType qos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) _netWriter = writer; _target = target; _qos = qos; writer.StartMessage(messageIndex); } public static implicit operator NetworkWriter(Writer writer) { return writer._netWriter; } public void Dispose() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown _netWriter.FinishMessage(); _target.SendWriter(_netWriter, (int)_qos); } } } namespace R2API.Networking.Messages { internal struct BuffMessage : INetMessage, ISerializableObject { private CharacterBody _body; private BuffIndex _buff; private int _stacks; private float _duration; public void Serialize(NetworkWriter writer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) writer.Write(((Component)_body).gameObject); NetworkExtensions.WriteBuffIndex(writer, _buff); writer.Write(_stacks); writer.Write(_duration); } public void Deserialize(NetworkReader reader) { //IL_0013: 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) _body = reader.ReadGameObject().GetComponent<CharacterBody>(); _buff = NetworkExtensions.ReadBuffIndex(reader); _stacks = reader.ReadInt32(); _duration = reader.ReadSingle(); } public void OnReceived() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _body.ApplyBuff(_buff, _stacks, _duration); } internal BuffMessage(CharacterBody body, BuffIndex buff, int stacks, float duration) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _body = body; _buff = buff; _stacks = stacks; _duration = duration; } } internal struct DamageMessage : INetMessage, ISerializableObject { private DamageInfo _damage; private HurtBox _target; private bool _callDamage; private bool _callHitEnemy; private bool _callHitWorld; public void Serialize(NetworkWriter writer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) NetworkExtensions.Write(writer, _damage); NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(_target)); byte b = 0; b = (byte)(b | (_callHitWorld ? 1u : 0u)); b <<= 1; b = (byte)(b | (_callHitEnemy ? 1u : 0u)); b <<= 1; b = (byte)(b | (_callDamage ? 1u : 0u)); writer.Write(b); } public void Deserialize(NetworkReader reader) { //IL_000e: 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) _damage = NetworkExtensions.ReadDamageInfo(reader); HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader); _target = ((HurtBoxReference)(ref val)).ResolveHurtBox(); byte b = reader.ReadByte(); _callDamage = (b & 1) > 0; b >>= 1; _callHitEnemy = (b & 1) > 0; b >>= 1; _callHitWorld = (b & 1) > 0; } public void OnReceived() { _damage.DealDamage(_target, _callDamage, _callHitEnemy, _callHitWorld); } internal DamageMessage(DamageInfo damage, HurtBox target, bool callDamage, bool callHitEnemy, bool callHitWorld) { _damage = damage; _target = target; _callDamage = callDamage; _callHitEnemy = callHitEnemy; _callHitWorld = callHitWorld; } } internal struct DotMessage : INetMessage, ISerializableObject { private GameObject _victim; private GameObject _attacker; private DotIndex _dotIndex; private float _duration; private float _damageMultiplier; public void Serialize(NetworkWriter writer) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown writer.Write(_victim); writer.Write(_attacker); NetworkExtensions.WritePackedIndex32(writer, (int)_dotIndex); writer.Write(_duration); writer.Write(_damageMultiplier); } public void Deserialize(NetworkReader reader) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) _victim = reader.ReadGameObject(); _attacker = reader.ReadGameObject(); _dotIndex = (DotIndex)NetworkExtensions.ReadPackedIndex32(reader); _duration = reader.ReadSingle(); _damageMultiplier = reader.ReadSingle(); } public void OnReceived() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) DotController.InflictDot(_victim, _attacker, _dotIndex, _duration, _damageMultiplier, (uint?)null); } internal DotMessage(GameObject victimObject, GameObject attackerObject, DotIndex dotIndex, float duration, float damageMultiplier) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _victim = victimObject; _attacker = attackerObject; _dotIndex = dotIndex; _duration = duration; _damageMultiplier = damageMultiplier; } } internal struct ExampleMessage : INetMessage, ISerializableObject { internal int Integer; internal string Str; public void Serialize(NetworkWriter writer) { writer.Write(Integer); writer.Write(Str); } public void Deserialize(NetworkReader reader) { Integer = reader.ReadInt32(); Str = reader.ReadString(); } public void OnReceived() { NetworkingPlugin.Logger.LogWarning((object)("int : " + Integer + " str : " + Str)); } } internal struct ExamplePing : INetRequest<ExamplePing, ExamplePingReply>, ISerializableObject { internal int Integer; public void Serialize(NetworkWriter writer) { writer.Write(Integer); } public void Deserialize(NetworkReader reader) { Integer = reader.ReadInt32(); } public ExamplePingReply OnRequestReceived() { NetworkingPlugin.Logger.LogWarning((object)("ExamplePing - Received this request : " + Integer)); ExamplePingReply result = default(ExamplePingReply); result.Str = "I'm answering you back this string"; return result; } } internal struct ExamplePingReply : INetRequestReply<ExamplePing, ExamplePingReply>, ISerializableObject { internal string Str; public void Serialize(NetworkWriter writer) { writer.Write(Str); } public void Deserialize(NetworkReader reader) { Str = reader.ReadString(); } public void OnReplyReceived() { NetworkingPlugin.Logger.LogWarning((object)("ExamplePingReply - Received this Reply : " + Str)); } } } namespace R2API.Networking.Interfaces { public interface INetCommand { void OnReceived(); } public static class NetCommandExtensions { private static void SendCommand(Header header, NetworkConnection conn) { using Writer writer = NetworkingAPI.GetWriter(NetworkingAPI.CommandIndex, conn, (QosType)3); SerializableObjectExtensions.Write(writer, header); } public static void Send(this INetCommand? command, NetworkDestination destination) { if (destination.ShouldRun()) { command.OnReceived(); } if (!destination.ShouldSend()) { return; } Header header = destination.GetHeader(NetworkingAPI.GetNetworkHash(command.GetType())); if (NetworkServer.active) { for (int i = 0; i < NetworkServer.connections.Count; i++) { NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { SendCommand(header, val); } } } else if (NetworkClient.active) { SendCommand(header, ClientScene.readyConnection); } } public static void Send(this INetCommand? command, NetworkConnection target) { if (target == null) { throw new ArgumentNullException("target"); } if (!NetworkServer.active) { throw new InvalidOperationException("NetworkServer is not active."); } if (NetworkClient.active) { foreach (NetworkClient allClient in NetworkClient.allClients) { if (allClient.connection != null && allClient.connection.connectionId == target.connectionId) { command.OnReceived(); return; } } } SendCommand(NetworkDestination.Clients.GetHeader(NetworkingAPI.GetNetworkHash(command.GetType())), target); } } public interface INetMessage : ISerializableObject { void OnReceived(); } public static class NetMessageExtensions { private static void SendMessage(INetMessage? message, Header header, NetworkConnection conn) { using Writer writer = NetworkingAPI.GetWriter(NetworkingAPI.MessageIndex, conn, (QosType)3); NetworkWriter writer2 = writer; writer2.Write(header); writer2.Write(message); } public static void Send(this INetMessage? message, NetworkDestination destination) { if (destination.ShouldRun()) { message.OnReceived(); } if (!destination.ShouldSend()) { return; } Header header = destination.GetHeader(NetworkingAPI.GetNetworkHash(message.GetType())); if (NetworkServer.active) { for (int i = 0; i < NetworkServer.connections.Count; i++) { NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { SendMessage(message, header, val); } } } else if (NetworkClient.active) { SendMessage(message, header, ClientScene.readyConnection); } } public static void Send(this INetMessage? message, NetworkConnection target) { if (target == null) { throw new ArgumentNullException("target"); } if (!NetworkServer.active) { throw new InvalidOperationException("NetworkServer is not active."); } if (NetworkClient.active) { foreach (NetworkClient allClient in NetworkClient.allClients) { if (allClient.connection != null && allClient.connection.connectionId == target.connectionId) { message.OnReceived(); return; } } } Header header = NetworkDestination.Clients.GetHeader(NetworkingAPI.GetNetworkHash(message.GetType())); SendMessage(message, header, target); } } public interface INetRequest<TRequest, TReply> : ISerializableObject where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { TReply OnRequestReceived(); } public interface INetRequestReply<TRequest, TReply> : ISerializableObject where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { void OnReplyReceived(); } public static class NetRequestExtensions { private static void SendRequest<TRequest, TReply>(TRequest request, Header header, NetworkConnection conn) where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { using Writer writer = NetworkingAPI.GetWriter(NetworkingAPI.RequestIndex, conn, (QosType)3); NetworkWriter writer2 = writer; writer2.Write(header); writer2.Write(request); } public static void Send<TRequest, TReply>(this TRequest request, NetworkDestination destination) where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { if (destination.ShouldRun()) { request.OnRequestReceived().OnReplyReceived(); } if (!destination.ShouldSend()) { return; } Header header = destination.GetHeader(NetworkingAPI.GetNetworkHash(request.GetType())); if (NetworkServer.active) { for (int i = 0; i < NetworkServer.connections.Count; i++) { NetworkConnection val = NetworkServer.connections[i]; if (val != null && (!NetworkServer.localClientActive || !NetworkServer.localConnections.Contains(val))) { SendRequest<TRequest, TReply>(request, header, val); } } } else if (NetworkClient.active) { SendRequest<TRequest, TReply>(request, header, ClientScene.readyConnection); } } public static void Send<TRequest, TReply>(this TRequest request, NetworkConnection target) where TRequest : INetRequest<TRequest, TReply> where TReply : INetRequestReply<TRequest, TReply> { if (target == null) { throw new ArgumentNullException("target"); } if (!NetworkServer.active) { throw new InvalidOperationException("NetworkServer is not active."); } if (NetworkClient.active) { foreach (NetworkClient allClient in NetworkClient.allClients) { if (allClient.connection != null && allClient.connection.connectionId == target.connectionId) { request.OnRequestReceived().OnReplyReceived(); return; } } } Header header = NetworkDestination.Clients.GetHeader(NetworkingAPI.GetNetworkHash(request.GetType())); SendRequest<TRequest, TReply>(request, header, target); } } public interface ISerializableObject { void Serialize(NetworkWriter writer); void Deserialize(NetworkReader reader); } public static class SerializableObjectExtensions { public static void Write<TObject>(this NetworkWriter? writer, TObject target) where TObject : ISerializableObject { target.Serialize(writer); } public static TObject Read<TObject>(this NetworkReader? reader, TObject destination) where TObject : ISerializableObject { destination.Deserialize(reader); return destination; } public static TObject Read<TObject>(this NetworkReader? reader) where TObject : ISerializableObject, new() { TObject result = new TObject(); result.Deserialize(reader); return result; } } public interface ISerializer<TObject> { void Serialize(NetworkWriter writer, TObject target); void Deserialize(NetworkReader reader, TObject target); } public static class SerializerExtensions { public static void Write<TObject>(this NetworkWriter? writer, TObject target, ISerializer<TObject>? serializer) { serializer.Serialize(writer, target); } public static TObject Read<TObject>(this NetworkReader? reader, ref TObject destination, ISerializer<TObject>? serializer) { serializer.Deserialize(reader, destination); return destination; } } }
BepinEx/plugins/RiskofThunder-R2API_Orb/R2API.Orb/R2API.Orb.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2.Orbs; using R2API.AutoVersionGen; using R2API.Utils; using RoR2.Orbs; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Orb")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("R2API.Orb")] [assembly: AssemblyTitle("R2API.Orb")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class OrbAPI { [CompilerGenerated] private static class <>O { public static hook_GenerateCatalog <0>__AddOrbs; } public const string PluginGUID = "com.bepis.r2api.orb"; public const string PluginName = "R2API.Orb"; private static bool _orbsAlreadyAdded = false; public static ObservableCollection<Type?>? OrbDefinitions = new ObservableCollection<Type>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static bool AddOrb(Type? t) { SetHooks(); if (_orbsAlreadyAdded) { OrbPlugin.Logger.LogError((object)"Tried to add Orb type: t after orb catalog was generated"); return false; } if (t == null || !t.IsSubclassOf(typeof(Orb))) { OrbPlugin.Logger.LogError((object)"Type: t is null or not a subclass of RoR2.Orbs.Orb"); return false; } OrbDefinitions.Add(t); return true; } public static bool AddOrb<TOrb>() where TOrb : Orb { SetHooks(); Type typeFromHandle = typeof(TOrb); if (_orbsAlreadyAdded) { OrbPlugin.Logger.LogError((object)("Tried to add Orb type: " + typeFromHandle.Name + " after orb catalog was generated")); return false; } if (!typeFromHandle.IsSubclassOf(typeof(Orb))) { OrbPlugin.Logger.LogError((object)("Type: " + typeFromHandle.Name + " is not a subclass of RoR2.Orbs.Orb")); return false; } OrbDefinitions.Add(typeFromHandle); return true; } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__AddOrbs; if (obj == null) { hook_GenerateCatalog val = AddOrbs; <>O.<0>__AddOrbs = val; obj = (object)val; } OrbCatalog.GenerateCatalog += (hook_GenerateCatalog)obj; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__AddOrbs; if (obj == null) { hook_GenerateCatalog val = AddOrbs; <>O.<0>__AddOrbs = val; obj = (object)val; } OrbCatalog.GenerateCatalog -= (hook_GenerateCatalog)obj; _hooksEnabled = false; } private static void AddOrbs(orig_GenerateCatalog orig) { _orbsAlreadyAdded = true; orig.Invoke(); Type[] array = Reflection.GetFieldValue<Type[]>(typeof(OrbCatalog), "indexToType"); Dictionary<Type, int> fieldValue = Reflection.GetFieldValue<Dictionary<Type, int>>(typeof(OrbCatalog), "typeToIndex"); int num = array.Length; int count = OrbDefinitions.Count; Array.Resize(ref array, num + count); for (int i = 0; i < count; i++) { int num2 = i + num; array[num2] = OrbDefinitions[i]; fieldValue.Add(OrbDefinitions[i], num2); } Reflection.SetFieldValue<Type[]>(typeof(OrbCatalog), "indexToType", array); Reflection.SetFieldValue<Dictionary<Type, int>>(typeof(OrbCatalog), "typeToIndex", fieldValue); } } [BepInPlugin("com.bepis.r2api.orb", "R2API.Orb", "1.0.1")] public sealed class OrbPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { OrbAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Prefab/R2API.Prefab/R2API.Prefab.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Networking; using R2API.AutoVersionGen; using R2API.ContentManagement; using R2API.ScriptableObjects; using R2API.Utils; using RoR2.Networking; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Prefab")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("R2API.Prefab")] [assembly: AssemblyTitle("R2API.Prefab")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class PrefabAPI { private struct HashStruct { public GameObject Prefab; public string GoName; public string TypeName; public string MethodName; public Assembly Assembly; } [CompilerGenerated] private static class <>O { public static hook_OnStartClient <0>__SetProperAssetIdForDelayedPrefabs; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<HashStruct, GameObject> <>9__6_0; public static hook_IsPrefab <>9__14_0; internal GameObject <IsPrefabHashed>b__6_0(HashStruct hash) { return hash.Prefab; } internal bool <GetParent>b__14_0(orig_IsPrefab orig, GameObject obj) { if (Object.op_Implicit((Object)(object)obj.transform.parent) && ((Object)((Component)obj.transform.parent).gameObject).name == "ModdedPrefabs") { return true; } return orig.Invoke(obj); } } public const string PluginGUID = "com.bepis.r2api.prefab"; public const string PluginName = "R2API.Prefab"; private static GameObject _parent; private static readonly List<HashStruct> _networkedPrefabs = new List<HashStruct>(); private static bool _delayedPrefabsHookEnabled = false; private static List<HashStruct> _prefabsWithDelayedAddedNetworkIdentities = new List<HashStruct>(); public const string PluginVersion = "1.0.3"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static bool IsPrefabHashed(GameObject prefabToCheck) { return _networkedPrefabs.Select((HashStruct hash) => hash.Prefab).Contains(prefabToCheck); } [MethodImpl(MethodImplOptions.NoInlining)] public static GameObject InstantiateClone(this GameObject g, string nameToSet) { return g.InstantiateCloneInternal(nameToSet, registerNetwork: true); } [MethodImpl(MethodImplOptions.NoInlining)] public static GameObject InstantiateClone(this GameObject g, string nameToSet, bool registerNetwork) { return g.InstantiateCloneInternal(nameToSet, registerNetwork); } [MethodImpl(MethodImplOptions.NoInlining)] [Obsolete("Left over to not break old mods")] [EditorBrowsable(EditorBrowsableState.Never)] public static GameObject InstantiateClone(this GameObject? g, string? nameToSet, bool registerNetwork = true, [CallerFilePath] string? file = "", [CallerMemberName] string? member = "", [CallerLineNumber] int line = 0) { return g.InstantiateCloneInternal(nameToSet, registerNetwork); } private static GameObject InstantiateCloneInternal(this GameObject g, string nameToSet, bool registerNetwork) { GameObject val = Object.Instantiate<GameObject>(g, GetParent().transform); ((Object)val).name = nameToSet; if (registerNetwork) { RegisterPrefabInternal(val, new StackFrame(2)); } return val; } [MethodImpl(MethodImplOptions.NoInlining)] public static void RegisterNetworkPrefab(this GameObject g) { RegisterNetworkPrefabInternal(g); } [MethodImpl(MethodImplOptions.NoInlining)] [Obsolete("Left over to not break old mods.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void RegisterNetworkPrefab(this GameObject? g, [CallerFilePath] string? file = "", [CallerMemberName] string? member = "", [CallerLineNumber] int line = 0) { RegisterNetworkPrefabInternal(g); } private static void RegisterNetworkPrefabInternal(GameObject g) { RegisterPrefabInternal(g, new StackFrame(2)); } private static GameObject GetParent() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0044: 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_004f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_parent)) { _parent = new GameObject("ModdedPrefabs"); Object.DontDestroyOnLoad((Object)(object)_parent); _parent.SetActive(false); object obj2 = <>c.<>9__14_0; if (obj2 == null) { hook_IsPrefab val = (orig_IsPrefab orig, GameObject obj) => (Object.op_Implicit((Object)(object)obj.transform.parent) && ((Object)((Component)obj.transform.parent).gameObject).name == "ModdedPrefabs") || orig.Invoke(obj); <>c.<>9__14_0 = val; obj2 = (object)val; } Util.IsPrefab += (hook_IsPrefab)obj2; } return _parent; } private static void RegisterPrefabInternal(GameObject prefab, StackFrame frame) { //IL_009e: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown MethodBase method = frame.GetMethod(); HashStruct hashStruct = default(HashStruct); hashStruct.Prefab = prefab; hashStruct.GoName = ((Object)prefab).name; hashStruct.TypeName = method.DeclaringType.AssemblyQualifiedName; hashStruct.MethodName = method.Name; hashStruct.Assembly = method.DeclaringType.Assembly; HashStruct hashStruct2 = hashStruct; _networkedPrefabs.Add(hashStruct2); AddToNetworkedObjectPrefabs(hashStruct2); NetworkIdentity component = hashStruct2.Prefab.GetComponent<NetworkIdentity>(); if (Object.op_Implicit((Object)(object)component)) { Reflection.SetFieldValue<NetworkHash128>((object)component, "m_AssetId", NetworkHash128.Parse(MakeHash(hashStruct2.GoName + hashStruct2.TypeName + hashStruct2.MethodName))); return; } _prefabsWithDelayedAddedNetworkIdentities.Add(hashStruct2); if (!_delayedPrefabsHookEnabled) { object obj = <>O.<0>__SetProperAssetIdForDelayedPrefabs; if (obj == null) { hook_OnStartClient val = SetProperAssetIdForDelayedPrefabs; <>O.<0>__SetProperAssetIdForDelayedPrefabs = val; obj = (object)val; } NetworkManagerSystem.OnStartClient += (hook_OnStartClient)obj; _delayedPrefabsHookEnabled = true; } static void AddToNetworkedObjectPrefabs(HashStruct h) { R2APISerializableContentPack orCreateSerializableContentPack = R2APIContentManager.GetOrCreateSerializableContentPack(h.Assembly); List<GameObject> list = orCreateSerializableContentPack.networkedObjectPrefabs.ToList(); list.Add(h.Prefab); orCreateSerializableContentPack.networkedObjectPrefabs = list.ToArray(); } } private static void SetProperAssetIdForDelayedPrefabs(orig_OnStartClient orig, NetworkManagerSystem self, NetworkClient newClient) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) try { foreach (HashStruct prefabsWithDelayedAddedNetworkIdentity in _prefabsWithDelayedAddedNetworkIdentities) { NetworkIdentity component = prefabsWithDelayedAddedNetworkIdentity.Prefab.GetComponent<NetworkIdentity>(); if (Object.op_Implicit((Object)(object)component)) { Reflection.SetFieldValue<NetworkHash128>((object)component, "m_AssetId", NetworkHash128.Parse(MakeHash(prefabsWithDelayedAddedNetworkIdentity.GoName + prefabsWithDelayedAddedNetworkIdentity.TypeName + prefabsWithDelayedAddedNetworkIdentity.MethodName))); } else { PrefabPlugin.Logger.LogError((object)$"{prefabsWithDelayedAddedNetworkIdentity.Prefab} don't have a NetworkIdentity Component but was marked for network registration."); } } } catch (Exception ex) { PrefabPlugin.Logger.LogError((object)ex); } orig.Invoke(self, newClient); } private static string MakeHash(string s) { MD5 mD = MD5.Create(); byte[] array = mD.ComputeHash(Encoding.UTF8.GetBytes(s)); mD.Dispose(); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("x2")); } return stringBuilder.ToString(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.prefab", "R2API.Prefab", "1.0.3")] public sealed class PrefabPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_RecalculateStats/R2API.RecalculateStats/R2API.RecalculateStats.dll
Decompiled 11 months agousing 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.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API.AutoVersionGen; using R2API.Utils; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.RecalculateStats")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("R2API.RecalculateStats")] [assembly: AssemblyTitle("R2API.RecalculateStats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class RecalculateStatsAPI { public class StatHookEventArgs : EventArgs { public float healthMultAdd; public float baseHealthAdd; public float baseShieldAdd; public float regenMultAdd; public float baseRegenAdd; public float baseMoveSpeedAdd; public float moveSpeedMultAdd; public float moveSpeedReductionMultAdd; public float jumpPowerMultAdd; public float damageMultAdd; public float baseDamageAdd; public float baseAttackSpeedAdd; public float attackSpeedMultAdd; public float attackSpeedReductionMultAdd; public float critAdd; public float armorAdd; public float baseCurseAdd; public float cooldownReductionAdd; public float cooldownMultAdd; public float primaryCooldownMultAdd; public float secondaryCooldownMultAdd; public float utilityCooldownMultAdd; public float specialCooldownMultAdd; public float shieldMultAdd; public float baseJumpPowerAdd; public float levelMultAdd; public int moveSpeedRootCount; public float critDamageMultAdd; public float levelFlatAdd; public float sprintSpeedAdd; } public delegate void StatHookEventHandler(CharacterBody sender, StatHookEventArgs args); [CompilerGenerated] private static class <>O { public static Manipulator <0>__HookRecalculateStats; public static Action<CharacterBody> <1>__GetStatMods; } public const string PluginGUID = "com.bepis.r2api.recalculatestats"; public const string PluginName = "R2API.RecalculateStats"; private static bool _hooksEnabled; private static StatHookEventArgs StatMods; public const string PluginVersion = "1.2.0"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; private static event StatHookEventHandler _getStatCoefficients; public static event StatHookEventHandler GetStatCoefficients { add { SetHooks(); _getStatCoefficients += value; } remove { _getStatCoefficients -= value; if (RecalculateStatsAPI._getStatCoefficients != null) { Delegate[] invocationList = RecalculateStatsAPI._getStatCoefficients.GetInvocationList(); if (invocationList == null || invocationList.Length != 0) { return; } } UnsetHooks(); } } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__HookRecalculateStats; if (obj == null) { Manipulator val = HookRecalculateStats; <>O.<0>__HookRecalculateStats = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__HookRecalculateStats; if (obj == null) { Manipulator val = HookRecalculateStats; <>O.<0>__HookRecalculateStats = val; obj = (object)val; } CharacterBody.RecalculateStats -= (Manipulator)obj; _hooksEnabled = false; } private static void HookRecalculateStats(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_007b: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)GetStatMods); ModifyHealthStat(val); ModifyShieldStat(val); ModifyHealthRegenStat(val); ModifyMovementSpeedStat(val); ModifyJumpStat(val); ModifyDamageStat(val); ModifyAttackSpeedStat(val); ModifyCritStat(val); ModifyArmorStat(val); ModifyCurseStat(val); ModifyCooldownStat(val); ModifyLevelingStat(val); } private static void GetStatMods(CharacterBody characterBody) { StatMods = new StatHookEventArgs(); if (RecalculateStatsAPI._getStatCoefficients == null) { return; } Delegate[] invocationList = RecalculateStatsAPI._getStatCoefficients.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { StatHookEventHandler statHookEventHandler = (StatHookEventHandler)invocationList[i]; try { statHookEventHandler(characterBody, StatMods); } catch (Exception arg) { RecalculateStatsPlugin.Logger.LogError((object)$"Exception thrown by : {statHookEventHandler.Method.DeclaringType.Name}.{statHookEventHandler.Method.Name}:\n{arg}"); } } } private static void ModifyCurseStat(ILCursor c) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) c.Index = 0; if (c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(CharacterBody), "cursePenalty")) })) { c.MoveAfterLabels(); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body) { body.cursePenalty += StatMods.baseCurseAdd; }); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyCurseStat failed."); } } private static void ModifyCooldownStat(ILCursor c) { c.Index = 0; int num = 0; while (c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "cooldownScale")) }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "flatCooldownReduction")) })) { num++; } if (num >= 4) { c.Index = 0; c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "cooldownScale")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown * (1f + StatMods.cooldownMultAdd + StatMods.primaryCooldownMultAdd))); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "flatCooldownReduction")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown + StatMods.cooldownReductionAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "cooldownScale")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown * (1f + StatMods.cooldownMultAdd + StatMods.secondaryCooldownMultAdd))); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "flatCooldownReduction")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown + StatMods.cooldownReductionAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "cooldownScale")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown * (1f + StatMods.cooldownMultAdd + StatMods.utilityCooldownMultAdd))); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "flatCooldownReduction")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown + StatMods.cooldownReductionAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "cooldownScale")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown * (1f + StatMods.cooldownMultAdd + StatMods.specialCooldownMultAdd))); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(GenericSkill), "flatCooldownReduction")) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldCooldown) => oldCooldown + StatMods.cooldownReductionAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyCooldownStat failed."); } } private static void ModifyLevelingStat(ILCursor c) { c.Index = 0; if (c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "level")), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f), (Instruction x) => ILPatternMatchingExt.MatchSub(x) })) { c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldScaling) => (oldScaling + StatMods.levelFlatAdd) * (1f + StatMods.levelMultAdd))); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyLevelingStat failed."); } } private static void ModifyArmorStat(ILCursor c) { c.Index = 0; if (c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseArmor") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "armor")) }) && c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "armor")) })) { c.EmitDelegate<Func<float, float>>((Func<float, float>)((float oldArmor) => oldArmor + StatMods.armorAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyArmorStat failed."); } } private static void ModifyAttackSpeedStat(ILCursor c) { c.Index = 0; int locBaseAttackSpeedIndex = -1; int locAttackSpeedMultIndex = -1; if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseAttackSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelAttackSpeed") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseAttackSpeedIndex) }) && c.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseAttackSpeedIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locAttackSpeedMultIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseAttackSpeedIndex) })) { c.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseAttackSpeed") }); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseAttackSpeedIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origSpeed) => origSpeed + StatMods.baseAttackSpeedAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locAttackSpeedMultIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origSpeedMult) => origSpeedMult + StatMods.attackSpeedMultAdd)); c.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locAttackSpeedMultIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origSpeedReductionMult) => Mathf.Max(Mathf.Epsilon, origSpeedReductionMult + StatMods.attackSpeedReductionMultAdd))); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyAttackSpeedStat failed."); } } private static void ModifyCritStat(ILCursor c) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) c.Index = 0; int locOrigCrit = -1; if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locOrigCrit), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(CharacterBody), "crit")) }) && c.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(CharacterBody), "critMultiplier")) })) { int index = c.Index; c.Index = index - 1; c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origCritMult) => origCritMult + StatMods.critDamageMultAdd)); c.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locOrigCrit) }); c.Emit(OpCodes.Ldloc, locOrigCrit); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origCrit) => origCrit + StatMods.critAdd)); c.Emit(OpCodes.Stloc, locOrigCrit); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyCritStat failed."); } } private static void ModifyDamageStat(ILCursor c) { c.Index = 0; int locBaseDamageIndex = -1; int locDamageMultIndex = -1; if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseDamage"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelDamage") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseDamageIndex) }) && c.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseDamageIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locDamageMultIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseDamageIndex) })) { c.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseDamage") }); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseDamageIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origDamage) => origDamage + StatMods.baseDamageAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locDamageMultIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origDamageMult) => origDamageMult + StatMods.damageMultAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyDamageStat failed."); } } private static void ModifyJumpStat(ILCursor c) { c.Index = 0; int num = default(int); if (c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpPower"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelJumpPower"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchAdd(x) })) { c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origJumpPower) => (origJumpPower + StatMods.baseJumpPowerAdd) * (1f + StatMods.jumpPowerMultAdd))); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyJumpStat failed."); } } private static void ModifyHealthStat(ILCursor c) { c.Index = 0; int locBaseHealthIndex = -1; int locHealthMultIndex = -1; if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxHealth"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxHealth") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseHealthIndex) }) && c.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseHealthIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locHealthMultIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseHealthIndex) })) { c.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxHealth") }); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseHealthIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origMaxHealth) => origMaxHealth + StatMods.baseHealthAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locHealthMultIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origHealthMult) => origHealthMult + StatMods.healthMultAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyHealthStat failed."); } } private static void ModifyShieldStat(ILCursor c) { c.Index = 0; int locBaseShieldIndex = -1; if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxShield"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxShield") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseShieldIndex) }) && c.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseShieldIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(CharacterBody), "maxShield")) })) { int index = c.Index; c.Index = index + 1; c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origMaxShield) => origMaxShield * (1f + StatMods.shieldMultAdd))); c.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxShield") }); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseShieldIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origBaseShield) => origBaseShield + StatMods.baseShieldAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyShieldStat failed."); } } private static void ModifyHealthRegenStat(ILCursor c) { //IL_0113: Unknown result type (might be due to invalid IL or missing references) c.Index = 0; int locRegenMultIndex = -1; int locFinalRegenIndex = -1; if (c.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locFinalRegenIndex), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertySetter(typeof(CharacterBody), "regen")) }) && c.TryGotoPrev(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locRegenMultIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locFinalRegenIndex) })) { c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locRegenMultIndex) }); c.EmitDelegate<Func<float>>((Func<float>)(() => StatMods.baseRegenAdd)); c.Emit(OpCodes.Add); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchMul(x) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origRegenMult) => origRegenMult + StatMods.regenMultAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyHealthRegenStat failed."); } } private static void ModifyMovementSpeedStat(ILCursor c) { //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) c.Index = 0; int locBaseSpeedIndex = -1; int locSpeedMultIndex = -1; int locSpeedDivIndex = -1; int num2 = default(int); int num = default(int); if (c.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed") }) && c.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBaseSpeedIndex) }) && c.TryGotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locBaseSpeedIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locSpeedMultIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locSpeedDivIndex), (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseSpeedIndex) }) && c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchOr(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchOr(x) })) { c.EmitDelegate<Func<bool>>((Func<bool>)(() => StatMods.moveSpeedRootCount > 0)); c.Emit(OpCodes.Or); c.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed") }); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBaseSpeedIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origBaseMoveSpeed) => origBaseMoveSpeed + StatMods.baseMoveSpeedAdd)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locSpeedMultIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origMoveSpeedMult) => origMoveSpeedMult + StatMods.moveSpeedMultAdd)); while (c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "sprintingSpeedMultiplier") })) { c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origSprintSpeedMult) => origSprintSpeedMult + StatMods.sprintSpeedAdd)); } c.GotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "isSprinting")) }); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate<Func<bool, CharacterBody, bool>>((Func<bool, CharacterBody, bool>)((bool isSprinting, CharacterBody sender) => isSprinting && sender.sprintingSpeedMultiplier + StatMods.sprintSpeedAdd != 0f)); c.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, locSpeedDivIndex) }); c.EmitDelegate<Func<float, float>>((Func<float, float>)((float origMoveSpeedReductionMult) => origMoveSpeedReductionMult + StatMods.moveSpeedReductionMultAdd)); } else { RecalculateStatsPlugin.Logger.LogError((object)"ModifyMovementSpeedStat failed."); } } } [BepInPlugin("com.bepis.r2api.recalculatestats", "R2API.RecalculateStats", "1.2.0")] public sealed class RecalculateStatsPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { RecalculateStatsAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_SceneAsset/R2API.SceneAsset/R2API.SceneAsset.dll
Decompiled 11 months agousing System; 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.Logging; using Microsoft.CodeAnalysis; using R2API.AutoVersionGen; using R2API.MiscHelpers; using RoR2; using RoR2.Networking; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.SceneAsset")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("R2API.SceneAsset")] [assembly: AssemblyTitle("R2API.SceneAsset")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class SceneAssetAPI { public const string PluginGUID = "com.bepis.r2api.sceneasset"; public const string PluginName = "R2API.SceneAsset"; private static readonly Dictionary<string, Action<GameObject[]>> SceneNameToAssetRequests = new Dictionary<string, Action<GameObject[]>>(); private static bool _hooksEnabled = false; private static bool _requestsDone = false; public const string PluginVersion = "1.1.1"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { if (!_hooksEnabled) { SceneManager.sceneLoaded += SceneManager_sceneLoaded; _hooksEnabled = true; } } private static void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { if (!_requestsDone && ((Scene)(ref arg0)).name != "loadingbasic" && ((Scene)(ref arg0)).name != "splash" && ((Scene)(ref arg0)).name != "intro") { PrepareRequests(); _requestsDone = true; } } internal static void UnsetHooks() { _hooksEnabled = false; } private static void PrepareRequests() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) string text = default(string); Action<GameObject[]> action = default(Action<GameObject[]>); foreach (KeyValuePair<string, Action<GameObject[]>> sceneNameToAssetRequest in SceneNameToAssetRequests) { KeyValuePairExtensions.Deconstruct<string, Action<GameObject[]>>(sceneNameToAssetRequest, ref text, ref action); string sceneName = text; Action<GameObject[]> actionList = action; try { SceneDef val = SceneCatalog.FindSceneDef(sceneName); if (Object.op_Implicit((Object)(object)val)) { AssetReferenceScene sceneAddress = val.sceneAddress; string text2 = ((sceneAddress != null) ? ((AssetReference)sceneAddress).AssetGUID : null); if (!string.IsNullOrEmpty(text2)) { if (NetworkManagerSystem.IsAddressablesKeyValid(text2, typeof(SceneInstance))) { AsyncOperationHandle<SceneInstance> val2 = Addressables.LoadSceneAsync((object)text2, (LoadSceneMode)1, true, 100); val2.Completed += delegate(AsyncOperationHandle<SceneInstance> handle) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ExecuteAddressableRequest(sceneName, actionList, handle.Result); }; SceneAssetPlugin.Logger.LogInfo((object)("Loaded the scene " + sceneName + " through Addressables.LoadSceneAsync")); } else { SceneAssetPlugin.Logger.LogError((object)$"Addressable key Scene address is invalid for sceneName {sceneName} | {sceneAddress}"); } } else { SceneManager.LoadSceneAsync(sceneName, (LoadSceneMode)1).completed += delegate { ExecuteRequest(sceneName, actionList); }; SceneAssetPlugin.Logger.LogInfo((object)("Loaded the scene " + sceneName + " through SceneManager.LoadScene")); } continue; } SceneAssetPlugin.Logger.LogError((object)(sceneName + " doesnt exist, available scene names:")); foreach (KeyValuePair<string, SceneIndex> item in SceneCatalog.nameToIndex) { SceneAssetPlugin.Logger.LogError((object)(item.Key ?? "")); } } catch (Exception arg) { SceneAssetPlugin.Logger.LogError((object)$"Exception in ExecuteRequests : {arg}"); } } } private static void ExecuteAddressableRequest(string sceneName, Action<GameObject[]> actionList, SceneInstance sceneInstance) { //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_0009: 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_0011: Unknown result type (might be due to invalid IL or missing references) Scene scene = ((SceneInstance)(ref sceneInstance)).Scene; ExecuteRequestInternal(actionList, scene); Addressables.UnloadSceneAsync(sceneInstance, true); } private static void ExecuteRequest(string sceneName, Action<GameObject[]> actionList) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Scene sceneByName = SceneManager.GetSceneByName(sceneName); ExecuteRequestInternal(actionList, sceneByName); SceneManager.UnloadSceneAsync(sceneName); } private static void ExecuteRequestInternal(Action<GameObject[]> actionList, Scene scene) { GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); Delegate[] invocationList = actionList.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action<GameObject[]> action = (Action<GameObject[]>)invocationList[i]; try { action(rootGameObjects); } catch (Exception ex) { SceneAssetPlugin.Logger.LogError((object)ex); } } } public static void AddAssetRequest(string? sceneName, Action<GameObject[]>? onSceneObjectsLoaded) { SetHooks(); if (SceneNameToAssetRequests.TryGetValue(sceneName, out Action<GameObject[]> _)) { Dictionary<string, Action<GameObject[]>> sceneNameToAssetRequests = SceneNameToAssetRequests; sceneNameToAssetRequests[sceneName] = (Action<GameObject[]>)Delegate.Combine(sceneNameToAssetRequests[sceneName], onSceneObjectsLoaded); } else { SceneNameToAssetRequests[sceneName] = onSceneObjectsLoaded; } } } [BepInPlugin("com.bepis.r2api.sceneasset", "R2API.SceneAsset", "1.1.1")] public sealed class SceneAssetPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { SceneAssetAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Skins/R2API.Skins/R2API.Skins.dll
Decompiled 11 months 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.Logging; using EntityStates; using HG; using HG.Reflection; using IL.RoR2; using IL.RoR2.Orbs; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates; using On.RoR2; using R2API.AutoVersionGen; using RoR2; using RoR2.Orbs; using Unity.Collections; using Unity.Jobs; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Skins")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+e13431d58bc3e83bee8cb483cb699516721341ac")] [assembly: AssemblyProduct("R2API.Skins")] [assembly: AssemblyTitle("R2API.Skins")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { internal struct IconTexJob : IJobParallelFor { [ReadOnly] public Color32 Top; [ReadOnly] public Color32 Right; [ReadOnly] public Color32 Bottom; [ReadOnly] public Color32 Left; [ReadOnly] public Color32 Line; public NativeArray<Color32> TexOutput; public void Execute(int index) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) int num = index % 128 - 64; int num2 = index / 128 - 64; if (Math.Abs(Math.Abs(num2) - Math.Abs(num)) <= 2) { TexOutput[index] = Line; } else if (num2 > num && num2 > -num) { TexOutput[index] = Top; } else if (num2 < num && num2 < -num) { TexOutput[index] = Bottom; } else if (num2 > num && num2 < -num) { TexOutput[index] = Left; } else if (num2 < num && num2 > -num) { TexOutput[index] = Right; } } } public struct SkinDefInfo { public SkinDef?[]? BaseSkins; public Sprite? Icon; public string? NameToken; public UnlockableDef? UnlockableDef; public GameObject? RootObject; public RendererInfo[]? RendererInfos; public MeshReplacement[]? MeshReplacements; public GameObjectActivation[]? GameObjectActivations; public ProjectileGhostReplacement[]? ProjectileGhostReplacements; public MinionSkinReplacement[]? MinionSkinReplacements; public string? Name; } public static class SkinIDRS { [CompilerGenerated] private static class <>O { public static hook_ApplySkin <0>__SetCustomIDRS; } private static List<(SkinDef, ItemDisplayRuleSet)> tuples = new List<(SkinDef, ItemDisplayRuleSet)>(); private static Dictionary<SkinIndex, ItemDisplayRuleSet> skinIndexToCustomIDRS = new Dictionary<SkinIndex, ItemDisplayRuleSet>(); private static bool hooksSet = false; private static bool catalogInitialized = false; public static bool AddPair(SkinDef skinDef, ItemDisplayRuleSet ruleSet) { SkinDef skinDef2 = skinDef; SetHooks(); if (catalogInitialized) { SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef2} && {ruleSet} as the SkinCatalog has already initialized."); return false; } if (tuples.Any<(SkinDef, ItemDisplayRuleSet)>(((SkinDef, ItemDisplayRuleSet) t) => (Object)(object)t.Item1 == (Object)(object)skinDef2)) { SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef2} && {ruleSet}, the skin {skinDef2} already has an entry associated to it."); return false; } tuples.Add((skinDef2, ruleSet)); return true; } [SystemInitializer(new Type[] { typeof(SkinCatalog) })] private static void SystemInit() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) catalogInitialized = true; foreach (var (val, value) in tuples) { skinIndexToCustomIDRS.Add(val.skinIndex, value); } tuples.Clear(); } internal static void SetHooks() { //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) //IL_0029: Expected O, but got Unknown if (!hooksSet) { hooksSet = true; object obj = <>O.<0>__SetCustomIDRS; if (obj == null) { hook_ApplySkin val = SetCustomIDRS; <>O.<0>__SetCustomIDRS = val; obj = (object)val; } ModelSkinController.ApplySkin += (hook_ApplySkin)obj; } } private static void SetCustomIDRS(orig_ApplySkin orig, ModelSkinController self, int skinIndex) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, skinIndex); if (Object.op_Implicit((Object)(object)self.characterModel)) { SkinDef safe = ArrayUtils.GetSafe<SkinDef>(self.skins, skinIndex); if (Object.op_Implicit((Object)(object)safe) && skinIndexToCustomIDRS.TryGetValue(safe.skinIndex, out ItemDisplayRuleSet value)) { self.characterModel.itemDisplayRuleSet = value; } } } internal static void UnsetHooks() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown hooksSet = false; object obj = <>O.<0>__SetCustomIDRS; if (obj == null) { hook_ApplySkin val = SetCustomIDRS; <>O.<0>__SetCustomIDRS = val; obj = (object)val; } ModelSkinController.ApplySkin -= (hook_ApplySkin)obj; } } [AutoVersion] public static class Skins { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__DoNothing; } public const string PluginGUID = "com.bepis.r2api.skins"; public const string PluginName = "R2API.Skins"; private static readonly HashSet<SkinDef> AddedSkins = new HashSet<SkinDef>(); public const string PluginVersion = "1.1.0"; public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left) { //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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) return CreateSkinIcon(top, right, bottom, left, new Color(0.6f, 0.6f, 0.6f)); } public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left, Color line) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003c: 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_0044: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0078: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); IconTexJob iconTexJob = default(IconTexJob); iconTexJob.Top = Color32.op_Implicit(top); iconTexJob.Bottom = Color32.op_Implicit(bottom); iconTexJob.Right = Color32.op_Implicit(right); iconTexJob.Left = Color32.op_Implicit(left); iconTexJob.Line = Color32.op_Implicit(line); iconTexJob.TexOutput = val.GetRawTextureData<Color32>(); IconTexJob iconTexJob2 = iconTexJob; JobHandle val2 = default(JobHandle); val2 = IJobParallelForExtensions.Schedule<IconTexJob>(iconTexJob2, 16384, 1, val2); ((JobHandle)(ref val2)).Complete(); ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } public static SkinDef CreateNewSkinDef(SkinDefInfo skin) { //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 //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown object obj = <>O.<0>__DoNothing; if (obj == null) { hook_Awake val = DoNothing; <>O.<0>__DoNothing = val; obj = (object)val; } SkinDef.Awake += (hook_Awake)obj; SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>(); val2.baseSkins = skin.BaseSkins ?? Array.Empty<SkinDef>(); val2.icon = skin.Icon; val2.unlockableDef = skin.UnlockableDef; val2.rootObject = skin.RootObject; val2.rendererInfos = skin.RendererInfos ?? Array.Empty<RendererInfo>(); val2.gameObjectActivations = skin.GameObjectActivations ?? Array.Empty<GameObjectActivation>(); val2.meshReplacements = skin.MeshReplacements ?? Array.Empty<MeshReplacement>(); val2.projectileGhostReplacements = skin.ProjectileGhostReplacements ?? Array.Empty<ProjectileGhostReplacement>(); val2.minionSkinReplacements = skin.MinionSkinReplacements ?? Array.Empty<MinionSkinReplacement>(); val2.nameToken = skin.NameToken; ((Object)val2).name = skin.Name; object obj2 = <>O.<0>__DoNothing; if (obj2 == null) { hook_Awake val3 = DoNothing; <>O.<0>__DoNothing = val3; obj2 = (object)val3; } SkinDef.Awake -= (hook_Awake)obj2; AddedSkins.Add(val2); return val2; } public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDefInfo skin) { SkinDef skin2 = CreateNewSkinDef(skin); return AddSkinToCharacter(bodyPrefab, skin2); } public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDef? skin) { //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyPrefab == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to null body prefab."); return false; } if ((Object)(object)skin == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add invalid skin."); return false; } AddedSkins.Add(skin); ModelLocator component = bodyPrefab.GetComponent<ModelLocator>(); if ((Object)(object)component == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to invalid body prefab (No ModelLocator)."); return false; } Transform modelTransform = component.modelTransform; if ((Object)(object)modelTransform == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to body prefab with no modelTransform."); return false; } if ((Object)(object)skin.rootObject != (Object)(object)((Component)modelTransform).gameObject) { SkinsPlugin.Logger.LogError((object)"Tried to add skin with improper root object set."); return false; } ModelSkinController val = ((Component)modelTransform).GetComponent<ModelSkinController>(); if ((Object)(object)val == (Object)null) { SkinsPlugin.Logger.LogWarning((object)(((Object)bodyPrefab).name + " does not have a modelSkinController.\nAdding a new one and attempting to populate the default skin.\nHighly recommended you set the controller up manually.")); CharacterModel component2 = ((Component)modelTransform).GetComponent<CharacterModel>(); if ((Object)(object)component2 == (Object)null) { SkinsPlugin.Logger.LogError((object)"Unable to locate CharacterModel, default skin creation aborted."); return false; } SkinnedMeshRenderer mainSkinnedMeshRenderer = component2.mainSkinnedMeshRenderer; if ((Object)(object)mainSkinnedMeshRenderer == (Object)null) { SkinsPlugin.Logger.LogError((object)"CharacterModel did not contain a main SkinnedMeshRenderer, default skin creation aborted."); return false; } RendererInfo[] baseRendererInfos = component2.baseRendererInfos; if (baseRendererInfos == null || baseRendererInfos.Length == 0) { SkinsPlugin.Logger.LogError((object)"CharacterModel rendererInfos are invalid, default skin creation aborted."); return false; } val = ((Component)modelTransform).gameObject.AddComponent<ModelSkinController>(); SkinDefInfo skin2 = default(SkinDefInfo); skin2.BaseSkins = Array.Empty<SkinDef>(); skin2.GameObjectActivations = Array.Empty<GameObjectActivation>(); skin2.Icon = CreateDefaultSkinIcon(); skin2.Name = "skin" + ((Object)bodyPrefab).name + "Default"; skin2.NameToken = ((Object)bodyPrefab).name.ToUpper() + "_DEFAULT_SKIN_NAME"; skin2.RootObject = ((Component)modelTransform).gameObject; skin2.UnlockableDef = null; skin2.MeshReplacements = (MeshReplacement[]?)(object)new MeshReplacement[1] { new MeshReplacement { renderer = (Renderer)(object)mainSkinnedMeshRenderer, mesh = mainSkinnedMeshRenderer.sharedMesh } }; skin2.RendererInfos = component2.baseRendererInfos; skin2.ProjectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); skin2.MinionSkinReplacements = Array.Empty<MinionSkinReplacement>(); SkinDef val2 = CreateNewSkinDef(skin2); val.skins = (SkinDef[])(object)new SkinDef[1] { val2 }; } SkinDef[] array = val.skins; int num = array.Length; Array.Resize(ref array, num + 1); array[num] = skin; val.skins = array; return true; } private static Sprite CreateDefaultSkinIcon() { //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) return CreateSkinIcon(Color.red, Color.green, Color.blue, Color.black); } private static void DoNothing(orig_Awake orig, SkinDef self) { } } [BepInPlugin("com.bepis.r2api.skins", "R2API.Skins", "1.1.0")] public sealed class SkinsPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnEnable() { SkinIDRS.SetHooks(); SkinVFX.SetHooks(); } private void OnDisable() { SkinIDRS.UnsetHooks(); SkinVFX.UnsetHooks(); } } public static class SkinVFX { public delegate void OnEffectSpawnedDelegate(GameObject spawnedEffect); [CompilerGenerated] private static class <>O { public static hook_Start <0>__ApplyModifier; public static hook_SpawnEffect_GameObject_EffectData_bool <1>__ApplyReplacement; public static Manipulator <2>__ModifyBulletAttack; public static Manipulator <3>__ModifyMuzzleFlash; public static hook_BeginMeleeAttackEffect <4>__ModifyGenericMelee; public static Manipulator <5>__ModifyGenericOrb; } private static List<SkinVFXInfo> skinVFXInfos = new List<SkinVFXInfo>(); private static bool hooksSet = false; private const uint BaseIdentifier = 24000u; private static uint currentIdentifier = 24000u; private static bool hasCatalogInitOccured = false; private static uint nextIdentifier => currentIdentifier++; internal static void SetHooks() { //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) //IL_0029: Expected O, but got Unknown //IL_003e: 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_0049: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown if (!hooksSet) { hooksSet = true; object obj = <>O.<0>__ApplyModifier; if (obj == null) { hook_Start val = ApplyModifier; <>O.<0>__ApplyModifier = val; obj = (object)val; } EffectComponent.Start += (hook_Start)obj; object obj2 = <>O.<1>__ApplyReplacement; if (obj2 == null) { hook_SpawnEffect_GameObject_EffectData_bool val2 = ApplyReplacement; <>O.<1>__ApplyReplacement = val2; obj2 = (object)val2; } EffectManager.SpawnEffect_GameObject_EffectData_bool += (hook_SpawnEffect_GameObject_EffectData_bool)obj2; object obj3 = <>O.<2>__ModifyBulletAttack; if (obj3 == null) { Manipulator val3 = ModifyBulletAttack; <>O.<2>__ModifyBulletAttack = val3; obj3 = (object)val3; } BulletAttack.FireSingle += (Manipulator)obj3; object obj4 = <>O.<3>__ModifyMuzzleFlash; if (obj4 == null) { Manipulator val4 = ModifyMuzzleFlash; <>O.<3>__ModifyMuzzleFlash = val4; obj4 = (object)val4; } EffectManager.SimpleMuzzleFlash += (Manipulator)obj4; object obj5 = <>O.<4>__ModifyGenericMelee; if (obj5 == null) { hook_BeginMeleeAttackEffect val5 = ModifyGenericMelee; <>O.<4>__ModifyGenericMelee = val5; obj5 = (object)val5; } BasicMeleeAttack.BeginMeleeAttackEffect += (hook_BeginMeleeAttackEffect)obj5; object obj6 = <>O.<5>__ModifyGenericOrb; if (obj6 == null) { Manipulator val6 = ModifyGenericOrb; <>O.<5>__ModifyGenericOrb = val6; obj6 = (object)val6; } GenericDamageOrb.Begin += (Manipulator)obj6; } } internal static void UnsetHooks() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown hooksSet = false; object obj = <>O.<0>__ApplyModifier; if (obj == null) { hook_Start val = ApplyModifier; <>O.<0>__ApplyModifier = val; obj = (object)val; } EffectComponent.Start -= (hook_Start)obj; object obj2 = <>O.<1>__ApplyReplacement; if (obj2 == null) { hook_SpawnEffect_GameObject_EffectData_bool val2 = ApplyReplacement; <>O.<1>__ApplyReplacement = val2; obj2 = (object)val2; } EffectManager.SpawnEffect_GameObject_EffectData_bool -= (hook_SpawnEffect_GameObject_EffectData_bool)obj2; object obj3 = <>O.<2>__ModifyBulletAttack; if (obj3 == null) { Manipulator val3 = ModifyBulletAttack; <>O.<2>__ModifyBulletAttack = val3; obj3 = (object)val3; } BulletAttack.FireSingle -= (Manipulator)obj3; object obj4 = <>O.<3>__ModifyMuzzleFlash; if (obj4 == null) { Manipulator val4 = ModifyMuzzleFlash; <>O.<3>__ModifyMuzzleFlash = val4; obj4 = (object)val4; } EffectManager.SimpleMuzzleFlash -= (Manipulator)obj4; object obj5 = <>O.<4>__ModifyGenericMelee; if (obj5 == null) { hook_BeginMeleeAttackEffect val5 = ModifyGenericMelee; <>O.<4>__ModifyGenericMelee = val5; obj5 = (object)val5; } BasicMeleeAttack.BeginMeleeAttackEffect -= (hook_BeginMeleeAttackEffect)obj5; object obj6 = <>O.<5>__ModifyGenericOrb; if (obj6 == null) { Manipulator val6 = ModifyGenericOrb; <>O.<5>__ModifyGenericOrb = val6; obj6 = (object)val6; } GenericDamageOrb.Begin -= (Manipulator)obj6; } [SystemInitializer(new Type[] { typeof(EffectCatalog) })] private static void FindEffectIndexes() { //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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) hasCatalogInitOccured = true; for (int i = 0; i < skinVFXInfos.Count; i++) { SkinVFXInfo skinVFXInfo = skinVFXInfos[i]; if (Object.op_Implicit((Object)(object)skinVFXInfo.EffectPrefab)) { skinVFXInfo.TargetEffect = EffectCatalog.FindEffectIndexFromPrefab(skinVFXInfo.EffectPrefab); } else if (!string.IsNullOrEmpty(skinVFXInfo.EffectString)) { EffectDef val = ((IEnumerable<EffectDef>)EffectCatalog.entries).FirstOrDefault((Func<EffectDef, bool>)((EffectDef effectDef) => effectDef.prefabName == skinVFXInfo.EffectString)); if (val == null) { SkinsPlugin.Logger.LogError((object)("Failed to find effect " + skinVFXInfo.EffectString + " for SkinVFXInfo!")); } else { skinVFXInfo.TargetEffect = val.index; } } } } private static SkinVFXInfo FindSkinVFXInfo(uint identifier) { if (identifier < 24000 || identifier >= (long)skinVFXInfos.Count + 24000L) { return null; } return skinVFXInfos[(int)(identifier - 24000)]; } private static SkinVFXInfo FindSkinVFXInfo(GameObject attacker, GameObject effectPrefab) { //IL_0026: 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) if (!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)effectPrefab)) { return null; } SkinDef skinDef = SkinCatalog.FindCurrentSkinDefForBodyInstance(attacker); EffectIndex index = EffectCatalog.FindEffectIndexFromPrefab(effectPrefab); return skinVFXInfos.FirstOrDefault((SkinVFXInfo skinVFXInfo) => (Object)(object)skinVFXInfo.RequiredSkin == (Object)(object)skinDef && skinVFXInfo.TargetEffect == index); } private static void ModifyGenericMelee(orig_BeginMeleeAttackEffect orig, BasicMeleeAttack self) { SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(((EntityState)self).gameObject, self.swingEffectPrefab); if (skinVFXInfo != null && Object.op_Implicit((Object)(object)skinVFXInfo.ReplacementEffectPrefab)) { self.swingEffectPrefab = skinVFXInfo.ReplacementEffectPrefab; } orig.Invoke(self); if (skinVFXInfo != null && skinVFXInfo.OnEffectSpawned != null) { skinVFXInfo.OnEffectSpawned(self.swingEffectInstance); } } private static void ApplyReplacement(orig_SpawnEffect_GameObject_EffectData_bool orig, GameObject effectPrefab, EffectData effectData, bool transmit) { if (effectData == null) { orig.Invoke(effectPrefab, effectData, transmit); return; } if (effectData.genericUInt < 24000) { orig.Invoke(effectPrefab, effectData, transmit); return; } SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(effectData.genericUInt); if (skinVFXInfo == null) { orig.Invoke(effectPrefab, effectData, transmit); } else if ((Object)(object)skinVFXInfo.ReplacementEffectPrefab != (Object)null) { orig.Invoke(skinVFXInfo.ReplacementEffectPrefab, effectData, transmit); } else { orig.Invoke(effectPrefab, effectData, transmit); } } private static void ApplyModifier(orig_Start orig, EffectComponent self) { orig.Invoke(self); if (self.effectData != null && self.effectData.genericUInt >= 24000) { FindSkinVFXInfo(self.effectData.genericUInt)?.OnEffectSpawned?.Invoke(((Component)self).gameObject); } } private static void ModifyMuzzleFlash(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetChildLocatorTransformReference") })) { SkinsPlugin.Logger.LogError((object)"Failed to apply SkinVFX IL hook on EffectManager.SimpleMuzzleFlash"); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc, 4); val.EmitDelegate<Action<GameObject, GameObject, EffectData>>((Action<GameObject, GameObject, EffectData>)delegate(GameObject effectPrefab, GameObject owner, EffectData data) { SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(owner, effectPrefab); if (skinVFXInfo != null) { data.genericUInt = skinVFXInfo.Identifier; } }); } private static void ModifyGenericOrb(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetHurtBoxReference") })) { SkinsPlugin.Logger.LogError((object)$"Failed to apply SkinVFX IL hook on {il.Method.DeclaringType}.{((MemberReference)il.Method).Name}"); return; } val.Emit(OpCodes.Ldloc_0); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<EffectData, GenericDamageOrb>>((Action<EffectData, GenericDamageOrb>)delegate(EffectData data, GenericDamageOrb orb) { if (data != null && Object.op_Implicit((Object)(object)orb.attacker)) { SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(orb.attacker, orb.GetOrbEffect()); if (skinVFXInfo != null) { data.genericUInt = skinVFXInfo.Identifier; } } }); } private static void ModifyBulletAttack(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetChildLocatorTransformReference") })) { SkinsPlugin.Logger.LogError((object)"Failed to apply SkinVFX IL hook on BulletAttack.FireSingle"); return; } val.Emit(OpCodes.Ldloc_S, (byte)14); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<EffectData, BulletAttack>>((Action<EffectData, BulletAttack>)delegate(EffectData effectData, BulletAttack bulletAttack) { SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(bulletAttack.owner, bulletAttack.tracerEffectPrefab); if (skinVFXInfo != null) { effectData.genericUInt = skinVFXInfo.Identifier; } }); } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, EffectIndex targetEffect, GameObject replacementPrefab) { //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) SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, TargetEffect = targetEffect, ReplacementEffectPrefab = replacementPrefab }; AddSkinVFX(obj); return obj; } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, string targetEffect, GameObject replacementPrefab) { SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, EffectString = targetEffect, ReplacementEffectPrefab = replacementPrefab }; AddSkinVFX(obj); return obj; } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, GameObject targetEffect, GameObject replacementPrefab) { SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, EffectPrefab = targetEffect, ReplacementEffectPrefab = replacementPrefab }; AddSkinVFX(obj); return obj; } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, EffectIndex targetEffect, OnEffectSpawnedDelegate onEffectSpawned) { //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) SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, TargetEffect = targetEffect, OnEffectSpawned = onEffectSpawned }; AddSkinVFX(obj); return obj; } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, string targetEffect, OnEffectSpawnedDelegate onEffectSpawned) { SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, EffectString = targetEffect, OnEffectSpawned = onEffectSpawned }; AddSkinVFX(obj); return obj; } public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, GameObject targetEffect, OnEffectSpawnedDelegate onEffectSpawned) { SetHooks(); SkinVFXInfo obj = new SkinVFXInfo { RequiredSkin = skinDef, EffectPrefab = targetEffect, OnEffectSpawned = onEffectSpawned }; AddSkinVFX(obj); return obj; } public static bool AddSkinVFX(SkinVFXInfo skinVFXInfo) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Invalid comparison between Unknown and I4 //IL_003d: 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_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) SkinVFXInfo skinVFXInfo2 = skinVFXInfo; SetHooks(); if (hasCatalogInitOccured && (Object)(object)skinVFXInfo2.EffectPrefab != (Object)null) { skinVFXInfo2.TargetEffect = EffectCatalog.FindEffectIndexFromPrefab(skinVFXInfo2.EffectPrefab); EffectDef val = ((IEnumerable<EffectDef>)EffectCatalog.entries).FirstOrDefault((Func<EffectDef, bool>)((EffectDef effectDef) => effectDef.prefabName == skinVFXInfo2.EffectString)); if (val == null) { SkinsPlugin.Logger.LogError((object)("Failed to find effect " + skinVFXInfo2.EffectString + " for SkinVFXInfo!")); return false; } skinVFXInfo2.TargetEffect = val.index; } if ((Object)(object)skinVFXInfo2.RequiredSkin == (Object)null) { SkinsPlugin.Logger.LogError((object)"Cannot add a SkinVFXInfo with no assigned SkinDef."); return false; } if ((int)skinVFXInfo2.TargetEffect == -1 && (Object)(object)skinVFXInfo2.EffectPrefab == (Object)null && skinVFXInfo2.EffectString == null) { SkinsPlugin.Logger.LogError((object)"SkinVFXInfo may not have a TargetEffect of EffectIndex.Invalid, or must also specify an EffectPrefab or EffectString."); return false; } if ((Object)(object)skinVFXInfo2.ReplacementEffectPrefab == (Object)null && skinVFXInfo2.OnEffectSpawned == null) { SkinsPlugin.Logger.LogError((object)"SkinVFXInfo must have either a ReplacementEffectPrefab or an OnEffectSpawnedDelegate assigned."); return false; } skinVFXInfo2.Identifier = nextIdentifier; skinVFXInfos.Add(skinVFXInfo2); return true; } } public class SkinVFXInfo { public SkinDef RequiredSkin; public EffectIndex TargetEffect = (EffectIndex)(-1); public GameObject? ReplacementEffectPrefab; public SkinVFX.OnEffectSpawnedDelegate? OnEffectSpawned; public uint Identifier = uint.MaxValue; public GameObject EffectPrefab; public string EffectString; } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Sound/R2API.Sound/R2API.Sound.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AK.Wwise; using BepInEx; using BepInEx.Logging; using HG; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On.RoR2; using R2API.AutoVersionGen; using R2API.ContentManagement; using R2API.MiscHelpers; using R2API.Utils; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Sound")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("R2API.Sound")] [assembly: AssemblyTitle("R2API.Sound")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NativeIntegerAttribute : Attribute { public readonly bool[] TransformFlags; public NativeIntegerAttribute() { TransformFlags = new bool[1] { true }; } public NativeIntegerAttribute(bool[] P_0) { TransformFlags = 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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class SoundAPI { public static class SoundBanks { internal class Bank { private static uint _bankIteration; internal IntPtr? BankDataPtr; internal byte[] BankData; internal GCHandle? Memory; internal uint Size; internal uint PublicID; internal uint BankID; internal Bank(byte[] bankData) { BankData = bankData; Size = (uint)bankData.Length; PublicID = _bankIteration++; } internal Bank(nint bankPtr, uint size) { BankDataPtr = bankPtr; Size = size; PublicID = _bankIteration++; } internal bool Load() { //IL_0067: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 IntPtr valueOrDefault = BankDataPtr.GetValueOrDefault(); if (!BankDataPtr.HasValue) { GCHandle? gCHandle = (Memory = GCHandle.Alloc(BankData, GCHandleType.Pinned)); valueOrDefault = gCHandle.Value.AddrOfPinnedObject(); BankDataPtr = valueOrDefault; } AKRESULT val = AkSoundEngine.LoadBankMemoryView(BankDataPtr.Value, Size, ref BankID); if ((int)val != 1) { Debug.LogError((object)("WwiseUnity: AkMemBankLoader: bank loading failed with result " + ((object)(AKRESULT)(ref val)).ToString())); return false; } BankData = null; return true; } internal AKRESULT UnLoad() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) AKRESULT val = AkSoundEngine.UnloadBank(BankID, BankDataPtr.Value); if ((int)val != 1) { Debug.LogError((object)("Failed to unload bank " + PublicID + ": " + ((object)(AKRESULT)(ref val)).ToString())); return val; } Memory?.Free(); Memory = null; soundBanks.Remove(this); return val; } } internal static bool Loaded = false; internal static List<Bank> soundBanks = new List<Bank>(); public static uint Add(byte[]? bank) { SetHooks(); Bank bank2 = new Bank(bank); if (Loaded) { if (bank2.Load()) { soundBanks.Add(bank2); } } else { soundBanks.Add(bank2); } return bank2.PublicID; } public static uint Add(string? path) { SetHooks(); return Add(File.ReadAllBytes(path)); } public static uint Add(string resourceName, Assembly owningAssembly) { SetHooks(); nint num; int num2; (num, num2) = EmbeddedResources.GetEmbeddedResource(resourceName, owningAssembly); if (num == 0 || num2 == 0) { throw new ArgumentException(resourceName + " did not return a valid resource", "resourceName"); } Bank bank = new Bank(num, (uint)num2); if (Loaded) { if (bank.Load()) { soundBanks.Add(bank); } } else { soundBanks.Add(bank); } return bank.PublicID; } public static AKRESULT Remove(uint ID) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return soundBanks.Find((Bank bank) => bank.PublicID == ID).UnLoad(); } } public static class Music { public class CustomMusicData { public BepInPlugin BepInPlugin; public string PlayMusicSystemEventName; public string BanksFolderPath; public string InitBankName; public string SoundBankName; public Dictionary<SceneDef, IEnumerable<MainAndBossTracks>> SceneDefToTracks; internal uint _loadedInitBankId; internal uint _loadedSoundBankId; public uint LoadedInitBankId { get { return _loadedInitBankId; } private set { _loadedInitBankId = value; } } public uint LoadedSoundBankId { get { return _loadedSoundBankId; } private set { _loadedSoundBankId = value; } } } public struct MainAndBossTracks { public MusicTrackDef MainTrack; public MusicTrackDef BossTrack; public MainAndBossTracks(MusicTrackDef mainTrack, MusicTrackDef bossTrack) { SetHooks(); MainTrack = mainTrack; BossTrack = bossTrack; } } public class CustomMusicTrackDef : MusicTrackDef { public struct CustomState { public uint GroupId; public uint StateId; } public List<CustomState> CustomStates; public string SoundBankName; public override void Preload() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) SetHooks(); if (!string.IsNullOrWhiteSpace(SoundBankName)) { uint num = default(uint); AkSoundEngine.LoadBank(SoundBankName, ref num); } } public override void Play() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) SetHooks(); ((MusicTrackDef)this).Preload(); foreach (CustomState customState in CustomStates) { AkSoundEngine.SetState(customState.GroupId, customState.StateId); } } public override void Stop() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) SetHooks(); foreach (CustomState customState in CustomStates) { AkSoundEngine.SetState(customState.GroupId, 0u); } } } [CompilerGenerated] private static class <>O { public static hook_Start <0>__EnableCustomMusicSystems; public static Action<SceneDef> <1>__OnSceneChangeReplaceMusic; public static hook_UpdateState <2>__IsGameMusicBankInUse; public static Manipulator <3>__PauseMusicIfGameMusicBankNotInUse; public static Func<bool, bool> <4>__PauseMusicIfGameMusicBankNotInUse; } private const string GameMusicBankName = "Music"; private const string GameInitBankName = "Init"; private const string GameEventNamePlayMusicSystem = "Play_Music_System"; private static readonly List<CustomMusicData> CustomMusicDatas = new List<CustomMusicData>(); private static readonly Dictionary<string, BepInPlugin> EventNameToBepinPlugin = new Dictionary<string, BepInPlugin>(); private static readonly HashSet<string> PlayMusicSystemEventNames = new HashSet<string>(); private static readonly Dictionary<SceneDef, MainAndBossTracks> SceneDefToOriginalTracks = new Dictionary<SceneDef, MainAndBossTracks>(); private static readonly Dictionary<SceneDef, List<MainAndBossTracks>> SceneDefToTracks = new Dictionary<SceneDef, List<MainAndBossTracks>>(); private static bool GameMusicBankInUse; private static Hook AddCustomMusicDatasHook; private static bool _hooksEnabled = false; private static bool IsVanillaMusicTrack(MusicTrackDef self) { if (Object.op_Implicit((Object)(object)self) && self.soundBank != null) { return ((BaseType)self.soundBank).Name == "Music"; } return false; } internal static void SetHooks() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if (!_hooksEnabled) { AddCustomMusicDatasHook = new Hook((MethodBase)Reflection.GetMethodCached(typeof(AkWwiseInitializationSettings), "InitializeSoundEngine"), Reflection.GetMethodCached(typeof(Music), "AddCustomMusicDatas")); object obj = <>O.<0>__EnableCustomMusicSystems; if (obj == null) { hook_Start val = EnableCustomMusicSystems; <>O.<0>__EnableCustomMusicSystems = val; obj = (object)val; } MusicController.Start += (hook_Start)obj; SceneCatalog.onMostRecentSceneDefChanged += OnSceneChangeReplaceMusic; object obj2 = <>O.<2>__IsGameMusicBankInUse; if (obj2 == null) { hook_UpdateState val2 = IsGameMusicBankInUse; <>O.<2>__IsGameMusicBankInUse = val2; obj2 = (object)val2; } MusicController.UpdateState += (hook_UpdateState)obj2; object obj3 = <>O.<3>__PauseMusicIfGameMusicBankNotInUse; if (obj3 == null) { Manipulator val3 = PauseMusicIfGameMusicBankNotInUse; <>O.<3>__PauseMusicIfGameMusicBankNotInUse = val3; obj3 = (object)val3; } MusicController.LateUpdate += (Manipulator)obj3; _hooksEnabled = true; } } internal static void UnsetHooks() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown AddCustomMusicDatasHook.Dispose(); object obj = <>O.<0>__EnableCustomMusicSystems; if (obj == null) { hook_Start val = EnableCustomMusicSystems; <>O.<0>__EnableCustomMusicSystems = val; obj = (object)val; } MusicController.Start -= (hook_Start)obj; SceneCatalog.onMostRecentSceneDefChanged -= OnSceneChangeReplaceMusic; object obj2 = <>O.<2>__IsGameMusicBankInUse; if (obj2 == null) { hook_UpdateState val2 = IsGameMusicBankInUse; <>O.<2>__IsGameMusicBankInUse = val2; obj2 = (object)val2; } MusicController.UpdateState -= (hook_UpdateState)obj2; object obj3 = <>O.<3>__PauseMusicIfGameMusicBankNotInUse; if (obj3 == null) { Manipulator val3 = PauseMusicIfGameMusicBankNotInUse; <>O.<3>__PauseMusicIfGameMusicBankNotInUse = val3; obj3 = (object)val3; } MusicController.LateUpdate -= (Manipulator)obj3; _hooksEnabled = false; } private static void IsGameMusicBankInUse(orig_UpdateState orig, MusicController self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.currentTrack)) { GameMusicBankInUse = IsVanillaMusicTrack(self.currentTrack); } } private static bool AddCustomMusicDatas(Func<bool> orig) { //IL_0025: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00be: Invalid comparison between Unknown and I4 //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) bool result = orig(); foreach (CustomMusicData customMusicData in CustomMusicDatas) { AKRESULT val = AkSoundEngine.AddBasePath(customMusicData.BanksFolderPath); if ((int)val != 1) { SoundPlugin.Logger.LogError((object)("Error adding base path : " + customMusicData.BanksFolderPath + ". " + $"Error code : {val}")); continue; } val = AkSoundEngine.LoadBank(customMusicData.InitBankName, ref customMusicData._loadedInitBankId); if ((int)val != 1) { SoundPlugin.Logger.LogError((object)("Error loading init bank : " + customMusicData.InitBankName + ". " + $"Error code : {val}")); continue; } val = AkSoundEngine.LoadBank(customMusicData.SoundBankName, ref customMusicData._loadedSoundBankId); if ((int)val != 1) { SoundPlugin.Logger.LogError((object)("Error loading sound bank : " + customMusicData.SoundBankName + ". " + $"Error code : {val}")); } else { AddCustomTracksToDictionary(customMusicData); } } return result; } private static void AddCustomTracksToDictionary(CustomMusicData data) { if (data.SceneDefToTracks == null) { return; } SceneDef val = default(SceneDef); IEnumerable<MainAndBossTracks> enumerable = default(IEnumerable<MainAndBossTracks>); foreach (KeyValuePair<SceneDef, IEnumerable<MainAndBossTracks>> sceneDefToTrack in data.SceneDefToTracks) { KeyValuePairExtensions.Deconstruct<SceneDef, IEnumerable<MainAndBossTracks>>(sceneDefToTrack, ref val, ref enumerable); SceneDef key = val; IEnumerable<MainAndBossTracks> collection = enumerable; if (SceneDefToTracks.TryGetValue(key, out List<MainAndBossTracks> value)) { value.AddRange(collection); continue; } List<MainAndBossTracks> list = new List<MainAndBossTracks>(); list.AddRange(collection); SceneDefToTracks.Add(key, list); } } private static void EnableCustomMusicSystems(orig_Start orig, MusicController self) { orig.Invoke(self); foreach (string playMusicSystemEventName in PlayMusicSystemEventNames) { AkSoundEngine.PostEvent(playMusicSystemEventName, ((Component)self).gameObject); } } private static void OnSceneChangeReplaceMusic(SceneDef sceneDef) { if (Object.op_Implicit((Object)(object)sceneDef)) { ReplaceSceneMusicWithCustomTracks(sceneDef); } } private static void ReplaceSceneMusicWithCustomTracks(SceneDef sceneDef) { if (!SceneDefToTracks.TryGetValue(sceneDef, out List<MainAndBossTracks> value)) { return; } if (!SceneDefToOriginalTracks.ContainsKey(sceneDef)) { MainAndBossTracks value2 = new MainAndBossTracks(sceneDef.mainTrack, sceneDef.bossTrack); SceneDefToOriginalTracks.Add(sceneDef, value2); } if (value.Count > 0) { MainAndBossTracks mainAndBossTracks = value[RoR2Application.rng.RangeInt(0, value.Count)]; if (Object.op_Implicit((Object)(object)mainAndBossTracks.MainTrack)) { sceneDef.mainTrack = mainAndBossTracks.MainTrack; } if (Object.op_Implicit((Object)(object)mainAndBossTracks.BossTrack)) { sceneDef.bossTrack = mainAndBossTracks.BossTrack; } } } private static void PauseMusicIfGameMusicBankNotInUse(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); int num = default(int); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref num) }); val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)PauseMusicIfGameMusicBankNotInUse); static bool PauseMusicIfGameMusicBankNotInUse(bool shouldPauseMusic) { if (shouldPauseMusic) { return shouldPauseMusic; } return !GameMusicBankInUse; } } public static bool Add(CustomMusicData data) { SetHooks(); if (data.BepInPlugin == null) { throw new ArgumentNullException("CustomMusicData.BepInPlugin"); } if (data.InitBankName == "Init") { SoundPlugin.Logger.LogError((object)"Error loading custom init bank. Called the same as the game Init Bank. The name must be different."); return false; } if (string.IsNullOrWhiteSpace(data.InitBankName)) { SoundPlugin.Logger.LogError((object)"Error loading custom init bank. Should not be empty."); return false; } if (data.PlayMusicSystemEventName == "Play_Music_System") { SoundPlugin.Logger.LogError((object)"Error adding the play music system event name. Called the same as the game play music system event name. The name must be different."); return false; } if (string.IsNullOrWhiteSpace(data.PlayMusicSystemEventName)) { SoundPlugin.Logger.LogError((object)"Error adding the play music system event name. Should not be empty."); return false; } if (!PlayMusicSystemEventNames.Add(data.PlayMusicSystemEventName)) { SoundPlugin.Logger.LogError((object)("Error adding playMusicSystemEventName : " + data.PlayMusicSystemEventName + ". Already in use by " + EventNameToBepinPlugin[data.PlayMusicSystemEventName].GUID + ".")); return false; } EventNameToBepinPlugin.Add(data.PlayMusicSystemEventName, data.BepInPlugin); CustomMusicDatas.Add(data); return true; } public static bool Remove(CustomMusicData data) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) SetHooks(); AKRESULT val = AkSoundEngine.UnloadBank(data.LoadedSoundBankId, IntPtr.Zero); if ((int)val != 1) { SoundPlugin.Logger.LogError((object)("Error unloading sound bank : " + data.SoundBankName + ". " + $"Error code : {val}")); return false; } val = AkSoundEngine.UnloadBank(data.LoadedInitBankId, IntPtr.Zero); if ((int)val != 1) { SoundPlugin.Logger.LogError((object)("Error unloading init bank : " + data.InitBankName + ". " + $"Error code : {val}")); return false; } PlayMusicSystemEventNames.Remove(data.PlayMusicSystemEventName); EventNameToBepinPlugin.Remove(data.PlayMusicSystemEventName); RemoveTracksFromThatBankFromTheScenes(data); return CustomMusicDatas.Remove(data); } private static void RemoveTracksFromThatBankFromTheScenes(CustomMusicData data) { if (data.SceneDefToTracks == null) { return; } SceneDef val = default(SceneDef); IEnumerable<MainAndBossTracks> enumerable = default(IEnumerable<MainAndBossTracks>); foreach (KeyValuePair<SceneDef, IEnumerable<MainAndBossTracks>> sceneDefToTrack in data.SceneDefToTracks) { KeyValuePairExtensions.Deconstruct<SceneDef, IEnumerable<MainAndBossTracks>>(sceneDefToTrack, ref val, ref enumerable); SceneDef key = val; IEnumerable<MainAndBossTracks> enumerable2 = enumerable; List<MainAndBossTracks> list = SceneDefToTracks[key]; foreach (MainAndBossTracks item in enumerable2) { list.Remove(item); RestoreOriginalTracksIfNeeded(item); } } } private static void RestoreOriginalTracksIfNeeded(MainAndBossTracks customTracks) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Enumerator<SceneDef> enumerator = SceneCatalog.allSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; if ((Object)(object)current.mainTrack == (Object)(object)customTracks.MainTrack) { current.mainTrack = SceneDefToOriginalTracks[current].MainTrack; } if ((Object)(object)current.bossTrack == (Object)(object)customTracks.BossTrack) { current.bossTrack = SceneDefToOriginalTracks[current].BossTrack; } } } finally { ((IDisposable)enumerator).Dispose(); } } } public const string PluginGUID = "com.bepis.r2api.sound"; public const string PluginName = "R2API.Sound"; private static Hook AddBanksAfterEngineInitHook; private static readonly List<NetworkSoundEventDef> NetworkSoundEventDefs = new List<NetworkSoundEventDef>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if (!_hooksEnabled && !Application.isBatchMode) { _hooksEnabled = true; string[] files = Directory.GetFiles(Paths.PluginPath, "*.sound", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { SoundBanks.Add(files[i]); } _hooksEnabled = false; AddBanksAfterEngineInitHook = new Hook((MethodBase)Reflection.GetMethodCached(typeof(AkWwiseInitializationSettings), "InitializeSoundEngine"), Reflection.GetMethodCached(typeof(SoundAPI), "AddBanksAfterEngineInit")); Music.SetHooks(); _hooksEnabled = true; } } internal static void UnsetHooks() { AddBanksAfterEngineInitHook.Dispose(); Music.UnsetHooks(); _hooksEnabled = false; } private static bool AddBanksAfterEngineInit(Func<bool> orig) { bool result = orig(); LoadBanks(); return result; } private static void LoadBanks() { List<SoundBanks.Bank> list = new List<SoundBanks.Bank>(); bool flag = false; foreach (SoundBanks.Bank soundBank in SoundBanks.soundBanks) { if (!soundBank.Load()) { list.Add(soundBank); } else { flag = true; } } foreach (SoundBanks.Bank item in list) { SoundBanks.soundBanks.Remove(item); } SoundBanks.Loaded = true; if (flag) { SoundPlugin.Logger.LogInfo((object)"Custom sound banks loaded."); } } [Obsolete("AddNetworkedSoundEvent is obsolete, please add your NetworkSoundEventDefs via R2API.ContentManagement.ContentAdditionHelpers.AddNetworkSoundEventDef()")] public static bool AddNetworkedSoundEvent(NetworkSoundEventDef? networkSoundEventDef) { NetworkSoundEventDef networkSoundEventDef2 = networkSoundEventDef; SetHooks(); if (!CatalogBlockers.GetAvailability<NetworkSoundEventDef>()) { SoundPlugin.Logger.LogError((object)("Too late ! Tried to add network sound event: " + networkSoundEventDef2.eventName + " after the NetworkSoundEventCatalog has initalized!")); return false; } if (NetworkSoundEventDefs.Contains(networkSoundEventDef2) || NetworkSoundEventDefs.Any((NetworkSoundEventDef n) => n.eventName == networkSoundEventDef2.eventName)) { SoundPlugin.Logger.LogError((object)("NetworkSoundEventDef or NetworkSoundEventDef with EventName: " + networkSoundEventDef2.eventName + " already exists in the catalog! Consider changing your event name to avoid the collision. Aborting!")); return false; } NetworkSoundEventDefs.Add(networkSoundEventDef2); R2APIContentManager.HandleContentAddition(Assembly.GetCallingAssembly(), (Object)(object)networkSoundEventDef2); return true; } [Obsolete("AddNetworkedSoundEvent is obsolete, please add your NetworkSoundEventDefs via R2API.ContentManagement.ContentAdditionHelpers.AddNetworkSoundEventDef()")] public static bool AddNetworkedSoundEvent(string eventName) { string eventName2 = eventName; SetHooks(); if (!CatalogBlockers.GetAvailability<NetworkSoundEventDef>()) { SoundPlugin.Logger.LogError((object)("Too late! Tried to add network sound event: " + eventName2 + " after the NetworkSoundEventCatalog has initalized!")); return false; } NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.eventName = eventName2; if (NetworkSoundEventDefs.Any((NetworkSoundEventDef n) => n.eventName == eventName2)) { SoundPlugin.Logger.LogError((object)("NetworkSoundEventDef with Event Name: " + eventName2 + " already exists in the catalog! Consider changing your event name to avoid the collision. Aborting!")); return false; } NetworkSoundEventDefs.Add(val); R2APIContentManager.HandleContentAddition(Assembly.GetCallingAssembly(), (Object)(object)val); return true; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.sound", "R2API.Sound", "1.0.2")] public sealed class SoundPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnEnable() { SoundAPI.SetHooks(); } private void OnDisable() { SoundAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_TempVisualEffect/R2API.TempVisualEffect/R2API.TempVisualEffect.dll
Decompiled 11 months agousing System; 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API.AutoVersionGen; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.TempVisualEffect")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("R2API.TempVisualEffect")] [assembly: AssemblyTitle("R2API.TempVisualEffect")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [AutoVersion] public static class TempVisualEffectAPI { public delegate bool EffectCondition(CharacterBody body); public delegate float EffectRadius(CharacterBody body); internal struct TemporaryVisualEffectInfo { public GameObject effectPrefab; public EffectRadius radius; public bool useBestFitRadius; public EffectCondition condition; public string childLocatorOverride; } [CompilerGenerated] private static class <>O { public static hook_UpdateAllTemporaryVisualEffects <0>__UpdateAllHook; public static Action<CharacterBody> <1>__BodyAwake; public static Action<CharacterBody> <2>__BodyDestroy; } public const string PluginGUID = "com.bepis.r2api.tempvisualeffect"; public const string PluginName = "R2API.TempVisualEffect"; internal static List<TemporaryVisualEffectInfo> temporaryVisualEffectInfos = new List<TemporaryVisualEffectInfo>(); internal static Dictionary<CharacterBody, TemporaryVisualEffect[]> bodyToTemporaryVisualEffects = new Dictionary<CharacterBody, TemporaryVisualEffect[]>(); internal static FixedSizeArrayPool<TemporaryVisualEffect> temporaryVisualEffectArrayPool = new FixedSizeArrayPool<TemporaryVisualEffect>(0); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; public static bool AddTemporaryVisualEffect(GameObject effectPrefab, EffectCondition condition, bool useBestFitRadius = false, string childLocatorOverride = "") { SetHooks(); if (!Object.op_Implicit((Object)(object)effectPrefab)) { TempVisualEffectPlugin.Logger.LogError((object)"Failed to add TemporaryVisualEffect: GameObject is null"); return false; } if (condition == null) { TempVisualEffectPlugin.Logger.LogError((object)("Failed to add TemporaryVisualEffect: " + ((Object)effectPrefab).name + " no condition attached")); return false; } if (!Object.op_Implicit((Object)(object)effectPrefab.GetComponent<TemporaryVisualEffect>())) { TempVisualEffectPlugin.Logger.LogError((object)("Failed to add TemporaryVisualEffect: " + ((Object)effectPrefab).name + " GameObject has no TemporaryVisualEffect component")); return false; } AddTemporaryVisualEffectInternal(effectPrefab, null, condition, useBestFitRadius, childLocatorOverride); return true; } public static bool AddTemporaryVisualEffect(GameObject effectPrefab, EffectRadius radius, EffectCondition condition, string childLocatorOverride = "") { SetHooks(); if (!Object.op_Implicit((Object)(object)effectPrefab)) { TempVisualEffectPlugin.Logger.LogError((object)"Failed to add TemporaryVisualEffect: GameObject is null"); return false; } if (radius == null) { TempVisualEffectPlugin.Logger.LogError((object)("Failed to add TemporaryVisualEffect: " + ((Object)effectPrefab).name + " no radius attached")); return false; } if (condition == null) { TempVisualEffectPlugin.Logger.LogError((object)("Failed to add TemporaryVisualEffect: " + ((Object)effectPrefab).name + " no condition attached")); return false; } if (!Object.op_Implicit((Object)(object)effectPrefab.GetComponent<TemporaryVisualEffect>())) { TempVisualEffectPlugin.Logger.LogError((object)("Failed to add TemporaryVisualEffect: " + ((Object)effectPrefab).name + " GameObject has no TemporaryVisualEffect component")); return false; } AddTemporaryVisualEffectInternal(effectPrefab, radius, condition, useBestFitRadius: false, childLocatorOverride); return true; } internal static void AddTemporaryVisualEffectInternal(GameObject effectPrefab, EffectRadius radius, EffectCondition condition, bool useBestFitRadius, string childLocatorOverride) { TemporaryVisualEffectInfo temporaryVisualEffectInfo = default(TemporaryVisualEffectInfo); temporaryVisualEffectInfo.effectPrefab = effectPrefab; temporaryVisualEffectInfo.radius = radius; temporaryVisualEffectInfo.condition = condition; temporaryVisualEffectInfo.useBestFitRadius = useBestFitRadius; temporaryVisualEffectInfo.childLocatorOverride = childLocatorOverride; TemporaryVisualEffectInfo temporaryVisualEffectInfo2 = temporaryVisualEffectInfo; temporaryVisualEffectInfos.Add(temporaryVisualEffectInfo2); FixedSizeArrayPool<TemporaryVisualEffect> obj = temporaryVisualEffectArrayPool; int lengthOfArrays = obj.lengthOfArrays; obj.lengthOfArrays = lengthOfArrays + 1; TempVisualEffectPlugin.Logger.LogMessage((object)$"Added new TemporaryVisualEffect: {temporaryVisualEffectInfo2}"); } internal static void SetHooks() { //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) //IL_0023: Expected O, but got Unknown if (!_hooksEnabled) { object obj = <>O.<0>__UpdateAllHook; if (obj == null) { hook_UpdateAllTemporaryVisualEffects val = UpdateAllHook; <>O.<0>__UpdateAllHook = val; obj = (object)val; } CharacterBody.UpdateAllTemporaryVisualEffects += (hook_UpdateAllTemporaryVisualEffects)obj; CharacterBody.onBodyAwakeGlobal += BodyAwake; CharacterBody.onBodyDestroyGlobal += BodyDestroy; _hooksEnabled = true; } } internal static void UnsetHooks() { //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>__UpdateAllHook; if (obj == null) { hook_UpdateAllTemporaryVisualEffects val = UpdateAllHook; <>O.<0>__UpdateAllHook = val; obj = (object)val; } CharacterBody.UpdateAllTemporaryVisualEffects -= (hook_UpdateAllTemporaryVisualEffects)obj; CharacterBody.onBodyStartGlobal -= BodyAwake; CharacterBody.onBodyDestroyGlobal -= BodyDestroy; _hooksEnabled = false; } private static void BodyAwake(CharacterBody body) { bodyToTemporaryVisualEffects.Add(body, temporaryVisualEffectArrayPool.Request()); } private static void BodyDestroy(CharacterBody body) { if (bodyToTemporaryVisualEffects.TryGetValue(body, out TemporaryVisualEffect[] value)) { temporaryVisualEffectArrayPool.Return(value); } bodyToTemporaryVisualEffects.Remove(body); } private static void UpdateAllHook(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self) { orig.Invoke(self); if (bodyToTemporaryVisualEffects.TryGetValue(self, out TemporaryVisualEffect[] value)) { for (int i = 0; i < value.Length; i++) { TemporaryVisualEffectInfo temporaryVisualEffectInfo = temporaryVisualEffectInfos[i]; self.UpdateSingleTemporaryVisualEffect(ref value[i], temporaryVisualEffectInfo.effectPrefab, (temporaryVisualEffectInfo.radius != null) ? temporaryVisualEffectInfo.radius(self) : (temporaryVisualEffectInfo.useBestFitRadius ? self.bestFitRadius : self.radius), temporaryVisualEffectInfo.condition(self), temporaryVisualEffectInfo.childLocatorOverride); } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.tempvisualeffect", "R2API.TempVisualEffect", "1.0.2")] public sealed class TempVisualEffectPlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { TempVisualEffectAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-R2API_Unlockable/R2API.Unlockable/R2API.Unlockable.dll
Decompiled 11 months 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.Logging; using Microsoft.CodeAnalysis; using R2API.AutoVersionGen; using R2API.ContentManagement; using RoR2; using RoR2.Achievements; using RoR2BepInExPack.VanillaFixes; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API.Unlockable")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("R2API.Unlockable")] [assembly: AssemblyTitle("R2API.Unlockable")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace R2API { [Obsolete("The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release.")] public interface IModdedUnlockableDataProvider { string AchievementIdentifier { get; } string UnlockableIdentifier { get; } string AchievementNameToken { get; } string PrerequisiteUnlockableIdentifier { get; } string UnlockableNameToken { get; } string AchievementDescToken { get; } Sprite Sprite { get; } Func<string> GetHowToUnlock { get; } Func<string> GetUnlocked { get; } } [Obsolete("The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release.")] public abstract class ModdedUnlockable : BaseAchievement, IModdedUnlockableDataProvider { public abstract string AchievementIdentifier { get; } public abstract string UnlockableIdentifier { get; } public abstract string AchievementNameToken { get; } public abstract string PrerequisiteUnlockableIdentifier { get; } public abstract string UnlockableNameToken { get; } public abstract string AchievementDescToken { get; } public abstract Sprite Sprite { get; } public abstract Func<string> GetHowToUnlock { get; } public abstract Func<string> GetUnlocked { get; } public override bool wantsBodyCallbacks => ((BaseAchievement)this).wantsBodyCallbacks; public override void OnGranted() { ((BaseAchievement)this).OnGranted(); } public override void OnInstall() { ((BaseAchievement)this).OnInstall(); } public override void OnUninstall() { ((BaseAchievement)this).OnUninstall(); } public void Revoke() { if (((BaseAchievement)this).userProfile.HasAchievement(AchievementIdentifier)) { ((BaseAchievement)this).userProfile.RevokeAchievement(AchievementIdentifier); } ((BaseAchievement)this).userProfile.RevokeUnlockable(UnlockableCatalog.GetUnlockableDef(UnlockableIdentifier)); } public override float ProgressForAchievement() { return ((BaseAchievement)this).ProgressForAchievement(); } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ((BaseAchievement)this).LookUpRequiredBodyIndex(); } public override void OnBodyRequirementBroken() { ((BaseAchievement)this).OnBodyRequirementBroken(); } public override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); } } [Obsolete("The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release.")] [AutoVersion] public static class UnlockableAPI { public const string PluginGUID = "com.bepis.r2api.unlockable"; public const string PluginName = "R2API.Unlockable"; public const string ObsoleteMessage = "The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release."; private static readonly HashSet<string> UnlockableIdentifiers = new HashSet<string>(); private static readonly List<AchievementDef> Achievements = new List<AchievementDef>(); private static bool _hooksEnabled = false; public const string PluginVersion = "1.0.2"; [Obsolete("All submodules are automatically loaded and this property is now unused")] public static bool Loaded => true; internal static void SetHooks() { if (!_hooksEnabled) { SaferAchievementManager.OnCollectAchievementDefs += AddOurDefs; _hooksEnabled = true; } } internal static void UnsetHooks() { SaferAchievementManager.OnCollectAchievementDefs -= AddOurDefs; _hooksEnabled = false; } private static void AddOurDefs(List<string> identifiers, Dictionary<string, AchievementDef> stringToAchievementDef, List<AchievementDef> achievementDefs) { foreach (AchievementDef achievement in Achievements) { if (achievement != null) { identifiers.Add(achievement.identifier); achievementDefs.Add(achievement); stringToAchievementDef.Add(achievement.identifier, achievement); } } } internal static UnlockableDef CreateNewUnlockable(UnlockableInfo unlockableInfo) { UnlockableDef unlockableDef = ScriptableObject.CreateInstance<UnlockableDef>(); return SetupUnlockable(unlockableInfo, unlockableDef); } internal static UnlockableDef SetupUnlockable(UnlockableInfo unlockableInfo, UnlockableDef unlockableDef) { unlockableDef.cachedName = unlockableInfo.Name; unlockableDef.nameToken = unlockableInfo.Name; unlockableDef.getHowToUnlockString = unlockableInfo.HowToUnlockString; unlockableDef.getUnlockedString = unlockableInfo.UnlockedString; unlockableDef.sortScore = unlockableInfo.SortScore; return unlockableDef; } [Obsolete("The bool parameter serverTracked is redundant. Instead, pass in a Type that inherits from BaseServerAchievement if it is server tracked, or nothing if it's not")] public static UnlockableDef AddUnlockable<TUnlockable>(bool serverTracked) where TUnlockable : BaseAchievement, IModdedUnlockableDataProvider, new() { SetHooks(); return AddUnlockableInternal(typeof(TUnlockable), Assembly.GetCallingAssembly()); } public static UnlockableDef AddUnlockable<TUnlockable>(Type serverTrackerType) where TUnlockable : BaseAchievement, IModdedUnlockableDataProvider, new() { SetHooks(); return AddUnlockableInternal(typeof(TUnlockable), Assembly.GetCallingAssembly(), serverTrackerType); } public static UnlockableDef AddUnlockable<TUnlockable>(UnlockableDef unlockableDef) where TUnlockable : BaseAchievement, IModdedUnlockableDataProvider, new() { SetHooks(); return AddUnlockableInternal(typeof(TUnlockable), Assembly.GetCallingAssembly(), null, unlockableDef); } public static UnlockableDef AddUnlockable(Type unlockableType, Type serverTrackerType) { SetHooks(); return AddUnlockableInternal(unlockableType, Assembly.GetCallingAssembly(), serverTrackerType); } public static UnlockableDef AddUnlockable(Type unlockableType, UnlockableDef unlockableDef) { SetHooks(); return AddUnlockableInternal(unlockableType, Assembly.GetCallingAssembly(), null, unlockableDef); } public static bool AddAchievement(AchievementDef achievementDef) { SetHooks(); IEnumerable<string> source = Achievements.Select((AchievementDef achievementDef) => achievementDef.identifier); try { if (source.Contains(achievementDef.identifier)) { throw new InvalidOperationException("The achievement identifier '" + achievementDef.identifier + "' is already used by another mod."); } Achievements.Add(achievementDef); return true; } catch (Exception arg) { UnlockablePlugin.Logger.LogError((object)$"An error has occured while trying to add a new AchievementDef: {arg}"); return false; } } public static UnlockableDef AddUnlockable<TUnlockable>(Type serverTrackerType = null, UnlockableDef unlockableDef = null) where TUnlockable : BaseAchievement, IModdedUnlockableDataProvider, new() { SetHooks(); return AddUnlockableInternal(typeof(TUnlockable), Assembly.GetCallingAssembly(), serverTrackerType, unlockableDef); } public static UnlockableDef AddUnlockable(Type unlockableType, Type serverTrackerType = null, UnlockableDef unlockableDef = null) { SetHooks(); return AddUnlockableInternal(unlockableType, Assembly.GetCallingAssembly(), serverTrackerType, unlockableDef); } private static UnlockableDef AddUnlockableInternal(Type unlockableType, Assembly assembly, Type serverTrackerType = null, UnlockableDef unlockableDef = null) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00e1: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown IModdedUnlockableDataProvider moddedUnlockableDataProvider = Activator.CreateInstance(unlockableType) as IModdedUnlockableDataProvider; if (!CatalogBlockers.GetAvailability<UnlockableDef>()) { throw new InvalidOperationException("Too late ! Tried to add unlockable: " + moddedUnlockableDataProvider.UnlockableIdentifier + " after the UnlockableCatalog"); } string unlockableIdentifier = moddedUnlockableDataProvider.UnlockableIdentifier; if (!UnlockableIdentifiers.Add(unlockableIdentifier)) { throw new InvalidOperationException("The unlockable identifier '" + unlockableIdentifier + "' is already used by another mod."); } if ((Object)(object)unlockableDef == (Object)null) { unlockableDef = ScriptableObject.CreateInstance<UnlockableDef>(); } UnlockableInfo unlockableInfo = default(UnlockableInfo); unlockableInfo.Name = moddedUnlockableDataProvider.UnlockableIdentifier; unlockableInfo.HowToUnlockString = moddedUnlockableDataProvider.GetHowToUnlock; unlockableInfo.UnlockedString = moddedUnlockableDataProvider.GetUnlocked; unlockableInfo.SortScore = 200; unlockableDef = SetupUnlockable(unlockableInfo, unlockableDef); AchievementDef item = new AchievementDef { identifier = moddedUnlockableDataProvider.AchievementIdentifier, unlockableRewardIdentifier = moddedUnlockableDataProvider.UnlockableIdentifier, prerequisiteAchievementIdentifier = moddedUnlockableDataProvider.PrerequisiteUnlockableIdentifier, nameToken = moddedUnlockableDataProvider.AchievementNameToken, descriptionToken = moddedUnlockableDataProvider.AchievementDescToken, achievedIcon = moddedUnlockableDataProvider.Sprite, type = moddedUnlockableDataProvider.GetType(), serverTrackerType = serverTrackerType }; R2APIContentManager.HandleContentAddition(assembly, (Object)(object)unlockableDef); Achievements.Add(item); return unlockableDef; } } [Obsolete("The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release.")] internal struct UnlockableInfo { public string Name; public Func<string> HowToUnlockString; public Func<string> UnlockedString; public int SortScore; } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.bepis.r2api.unlockable", "R2API.Unlockable", "1.0.2")] [Obsolete("The patch 1.2.3 for RoR2 has made UnlockableAPI's methods and implementations redundant.\nFrom now on use The game's \"RegisterAchievement\" attribute on top of baseAchievement inheriting classes to register AchievementDefs and tie AchievementDefs to their respective UnlockableDefs.\nUnlockableAPI will be removed on the next major RoR2 release.")] public sealed class UnlockablePlugin : BaseUnityPlugin { internal static ManualLogSource Logger { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; } private void OnDestroy() { UnlockableAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } }
BepinEx/plugins/RiskofThunder-RoR2BepInExPack/RoR2BepInExPack/RoR2BepInExPack.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using HG.Reflection; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.RuntimeDetour.HookGen; using RoR2; using RoR2.Achievements; using RoR2.ConVar; using RoR2.EntitlementManagement; using RoR2.Items; using RoR2.UI; using RoR2.UI.MainMenu; using RoR2BepInExPack.LegacyAssetSystem; using RoR2BepInExPack.ModCompatibility; using RoR2BepInExPack.ReflectionHooks; using RoR2BepInExPack.VanillaFixes; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("RoR2BepInExPack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoR2BepInExPack")] [assembly: AssemblyTitle("RoR2BepInExPack")] [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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 RoR2BepInExPack { internal static class HookWatcher { private static DetourModManager ModManager { get; set; } internal static void Init() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown ModManager = new DetourModManager(); ModManager.OnHook += LogOnHook; ModManager.OnILHook += LogILHook; ModManager.OnDetour += LogDetour; ModManager.OnNativeDetour += LogNativeDetour; HookEndpointManager.OnAdd += LogHookAdd; HookEndpointManager.OnModify += LogHookModify; HookEndpointManager.OnRemove += LogHookRemove; } internal static void Destroy() { HookEndpointManager.OnRemove -= LogHookRemove; HookEndpointManager.OnModify -= LogHookModify; HookEndpointManager.OnAdd -= LogHookAdd; ModManager.OnNativeDetour -= LogNativeDetour; ModManager.OnDetour -= LogDetour; ModManager.OnILHook -= LogILHook; ModManager.OnHook -= LogOnHook; ModManager.Dispose(); ModManager = null; } private static void LogOnHook(Assembly hookOwner, MethodBase originalMethod, MethodBase _, object __) { LogMethod(originalMethod, hookOwner); } private static void LogILHook(Assembly hookOwner, MethodBase originalMethod, Manipulator _) { LogMethod(originalMethod, hookOwner); } private static void LogDetour(Assembly hookOwner, MethodBase originalMethod, MethodBase _) { LogMethod(originalMethod, hookOwner); } private static void LogNativeDetour(Assembly hookOwner, MethodBase originalMethod, IntPtr _, IntPtr __) { LogMethod(originalMethod, hookOwner); } private static bool LogHookAdd(MethodBase originalMethod, Delegate @delegate) { return LogMethod(originalMethod, @delegate.Method.Module.Assembly); } private static bool LogHookModify(MethodBase originalMethod, Delegate @delegate) { return LogMethod(originalMethod, @delegate.Method.Module.Assembly); } private static bool LogHookRemove(MethodBase originalMethod, Delegate @delegate) { return LogMethod(originalMethod, @delegate.Method.Module.Assembly, added: false); } private static bool LogMethod(MemberInfo originalMethod, Assembly hookOwnerAssembly, bool added = true) { if (originalMethod == null) { return true; } string text = "Not Found"; if (hookOwnerAssembly != null) { text = Path.GetFileName(hookOwnerAssembly.Location); } Type declaringType = originalMethod.DeclaringType; string name = originalMethod.Name; string text2 = ((declaringType != null) ? $"{declaringType}.{name}" : name); Log.Debug("Hook " + (added ? "added" : "removed") + " by assembly: " + text + " for: " + text2); return true; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("___riskofthunder.RoR2BepInExPack", "RoR2BepInExPack", "1.10.0")] public class RoR2BepInExPack : BaseUnityPlugin { public const string PluginGUID = "___riskofthunder.RoR2BepInExPack"; public const string PluginName = "RoR2BepInExPack"; public const string PluginVersion = "1.10.0"; private void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); RoR2Application.isModded = true; HookWatcher.Init(); InitHooks(); } private void OnEnable() { EnableHooks(); } private void OnDisable() { DisableHooks(); } private void OnDestroy() { DestroyHooks(); HookWatcher.Destroy(); } private void InitHooks() { ILLine.Init(); AutoCatchReflectionTypeLoadException.Init(); SaferAchievementManager.Init(); SaferSearchableAttribute.Init(); SaferResourceAvailability.Init(); FixConsoleLog.Init(); FixConVar.Init(); FixDeathAnimLog.Init(); FixNullBone.Init(); FixExtraGameModesMenu.Init(); FixProjectileCatalogLimitError.Init(); SaferWWise.Init(); FixNullEntitlement.Init(); FixExposeLog.Init(); FixNonLethalOneHP.Init(); FixRunScaling.Init(); FixCharacterBodyRemoveOldestTimedBuff.Init(); LegacyResourcesDetours.Init(); LegacyShaderDetours.Init(); FixMultiCorrupt.Init(((BaseUnityPlugin)this).Config); } private static void EnableHooks() { ILLine.Enable(); AutoCatchReflectionTypeLoadException.Enable(); SaferAchievementManager.Enable(); SaferSearchableAttribute.Enable(); SaferResourceAvailability.Enable(); FixConsoleLog.Enable(); FixConVar.Enable(); FixDeathAnimLog.Enable(); FixNullBone.Enable(); FixExtraGameModesMenu.Enable(); FixProjectileCatalogLimitError.Enable(); SaferWWise.Enable(); FixNullEntitlement.Enable(); FixExposeLog.Enable(); FixNonLethalOneHP.Enable(); FixRunScaling.Enable(); FixCharacterBodyRemoveOldestTimedBuff.Enable(); LegacyResourcesDetours.Enable(); LegacyShaderDetours.Enable(); FixMultiCorrupt.Enable(); } private static void DisableHooks() { FixMultiCorrupt.Disable(); LegacyShaderDetours.Disable(); LegacyResourcesDetours.Disable(); FixCharacterBodyRemoveOldestTimedBuff.Disable(); FixRunScaling.Disable(); FixNonLethalOneHP.Disable(); FixExposeLog.Disable(); FixNullEntitlement.Disable(); SaferWWise.Disable(); FixProjectileCatalogLimitError.Disable(); FixExtraGameModesMenu.Disable(); FixNullBone.Disable(); FixDeathAnimLog.Disable(); FixConsoleLog.Disable(); FixConVar.Disable(); SaferResourceAvailability.Disable(); SaferSearchableAttribute.Disable(); SaferAchievementManager.Disable(); AutoCatchReflectionTypeLoadException.Disable(); ILLine.Disable(); } private static void DestroyHooks() { FixMultiCorrupt.Destroy(); LegacyShaderDetours.Destroy(); LegacyResourcesDetours.Destroy(); FixCharacterBodyRemoveOldestTimedBuff.Destroy(); FixRunScaling.Destroy(); FixNonLethalOneHP.Destroy(); FixExposeLog.Destroy(); FixNullEntitlement.Destroy(); SaferWWise.Destroy(); FixProjectileCatalogLimitError.Destroy(); FixExtraGameModesMenu.Destroy(); FixNullBone.Destroy(); FixDeathAnimLog.Destroy(); FixConsoleLog.Destroy(); FixConVar.Destroy(); SaferResourceAvailability.Destroy(); SaferSearchableAttribute.Destroy(); SaferAchievementManager.Destroy(); AutoCatchReflectionTypeLoadException.Destroy(); ILLine.Destroy(); } } } namespace RoR2BepInExPack.Utilities { public class FixedConditionalWeakTable<TKey, TValue> : FixedConditionalWeakTableManager.IShrinkable where TKey : class where TValue : class { private readonly struct WeakReferenceWrapper<T> where T : class { public readonly int targetHashCode; public readonly WeakReference<T> weakReference; public readonly T target; public WeakReferenceWrapper(T target, bool strongReference) { targetHashCode = target.GetHashCode(); if (strongReference) { this.target = target; weakReference = null; } else { this.target = null; weakReference = new WeakReference<T>(target); } } public WeakReferenceWrapper(int targetHashCode) { this.targetHashCode = targetHashCode; target = null; weakReference = null; } } [StructLayout(LayoutKind.Sequential, Size = 1)] private readonly struct WeakReferenceWrapperComparer<T> : IEqualityComparer<WeakReferenceWrapper<T>> where T : class { public bool Equals(WeakReferenceWrapper<T> first, WeakReferenceWrapper<T> second) { T target = first.target; T target2 = second.target; T target3; if (target == null && first.weakReference == null) { return !second.weakReference.TryGetTarget(out target3); } if (target2 == null && second.weakReference == null) { return !first.weakReference.TryGetTarget(out target3); } if (target == null && !first.weakReference.TryGetTarget(out target)) { return false; } if (target2 == null && !second.weakReference.TryGetTarget(out target2)) { return false; } return target == target2; } public int GetHashCode(WeakReferenceWrapper<T> obj) { return obj.targetHashCode; } } private ConstructorInfo cachedConstructor; private readonly ConcurrentDictionary<WeakReferenceWrapper<TKey>, TValue> valueByKey = new ConcurrentDictionary<WeakReferenceWrapper<TKey>, TValue>(default(WeakReferenceWrapperComparer<TKey>)); public FixedConditionalWeakTable() { FixedConditionalWeakTableManager.Add(this); } public void Add(TKey key, TValue value) { if (key == null) { throw new ArgumentNullException("key"); } if (!valueByKey.TryAdd(new WeakReferenceWrapper<TKey>(key, strongReference: false), value)) { throw new ArgumentException("The key already exists"); } } public bool Remove(TKey key) { TValue value; return valueByKey.TryRemove(new WeakReferenceWrapper<TKey>(key, strongReference: true), out value); } public bool TryGetValue(TKey key, out TValue value) { return valueByKey.TryGetValue(new WeakReferenceWrapper<TKey>(key, strongReference: true), out value); } public TValue GetValue(TKey key, Func<TKey, TValue> defaultFunc) { if (TryGetValue(key, out var value)) { return value; } value = defaultFunc(key); Add(key, value); return value; } public TValue GetOrCreateValue(TKey key) { if (TryGetValue(key, out var value)) { return value; } if ((object)cachedConstructor == null) { Type typeFromHandle = typeof(TValue); cachedConstructor = typeFromHandle.GetConstructor(Array.Empty<Type>()); if ((object)cachedConstructor == null) { throw new MissingMethodException(typeFromHandle.FullName + " doesn't have public parameterless constructor"); } } value = (TValue)cachedConstructor.Invoke(Array.Empty<object>()); Add(key, value); return value; } void FixedConditionalWeakTableManager.IShrinkable.Shrink() { foreach (KeyValuePair<WeakReferenceWrapper<TKey>, TValue> item in valueByKey) { if (!item.Key.weakReference.TryGetTarget(out var _)) { valueByKey.TryRemove(new WeakReferenceWrapper<TKey>(item.Key.targetHashCode), out var _); } } } } internal static class FixedConditionalWeakTableManager { internal interface IShrinkable { void Shrink(); } private const int shrinkAttemptDelay = 2000; private static readonly object lockObject = new object(); private static readonly List<WeakReference<IShrinkable>> instances = new List<WeakReference<IShrinkable>>(); private static int lastCollectionCount = 0; public static void Add(IShrinkable weakTable) { lock (lockObject) { if (instances.Count == 0) { new Thread(ShrinkThreadLoop).Start(); } instances.Add(new WeakReference<IShrinkable>(weakTable)); } } private static void ShrinkThreadLoop() { while (true) { Thread.Sleep(2000); int num = GC.CollectionCount(2); if (lastCollectionCount == num) { continue; } lastCollectionCount = num; lock (lockObject) { for (int num2 = instances.Count - 1; num2 >= 0; num2--) { if (!instances[num2].TryGetTarget(out var target)) { instances.RemoveAt(num2); } else { target.Shrink(); } } if (instances.Count == 0) { break; } } } } } } namespace RoR2BepInExPack.VanillaFixes { internal class ILLine { private static ILHook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; _hook = new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", (BindingFlags)(-1)), new Manipulator(ShowILLine)); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void ShowILLine(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown try { ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", (BindingFlags)(-1))) }); val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } catch (Exception arg) { Log.Error(string.Format("{0} hook failed.{1}{2}", "ShowILLine", Environment.NewLine, arg)); } } private static string GetLineOrIL(StackFrame instace) { int fileLineNumber = instace.GetFileLineNumber(); if (fileLineNumber != -1 && fileLineNumber != 0) { return fileLineNumber.ToString(); } return "IL_" + instace.GetILOffset().ToString("X4"); } } internal class FixCharacterBodyRemoveOldestTimedBuff { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixRemoveOldestTimedBuff; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(CharacterBody).GetMethod("RemoveOldestTimedBuff", (BindingFlags)(-1), null, new Type[1] { typeof(BuffIndex) }, null); object obj = <>O.<0>__FixRemoveOldestTimedBuff; if (obj == null) { Manipulator val3 = FixRemoveOldestTimedBuff; <>O.<0>__FixRemoveOldestTimedBuff = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void FixRemoveOldestTimedBuff(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2) })) { val.Previous.OpCode = OpCodes.Blt; } else { Log.Error("FixRemoveOldestTimedBuff TryGotoNext failed, not applying patch"); } } } internal class FixConsoleLog { private static Hook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(UnitySystemConsoleRedirector).GetMethod("Redirect", (BindingFlags)(-1)), typeof(FixConsoleLog).GetMethod("DoNothing", (BindingFlags)(-1)), val2); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void DoNothing() { } } internal static class FixConVar { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ScanAllAssemblies; public static Action<Console> <1>__LoadAllConVars; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(Console).GetMethod("InitConVars", (BindingFlags)(-1)); object obj = <>O.<0>__ScanAllAssemblies; if (obj == null) { Manipulator val3 = ScanAllAssemblies; <>O.<0>__ScanAllAssemblies = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void ScanAllAssemblies(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<Console>>((Action<Console>)LoadAllConVars); val.Emit(OpCodes.Ret); } private static bool IsMonoFriendlyType(this Type type) { if (type.GetFields((BindingFlags)(-1)).Any((FieldInfo fi) => fi.FieldType.Name == "MonoFNPtrFakeClass")) { Log.Debug($"Not scanning {type} for ConVars due to it containing delegate pointer field(s)"); return false; } return true; } private static void LoadAllConVars(Console self) { //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown self.allConVars = new Dictionary<string, BaseConVar>(); self.archiveConVars = new List<BaseConVar>(); List<Type> list = new List<Type>(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { if (assembly.GetCustomAttribute<OptInAttribute>() != null) { list.AddRange(from t in assembly.GetTypes() where t.IsMonoFriendlyType() select t); } } catch (Exception data) { Log.Debug(data); } } foreach (Type item in list) { try { FieldInfo[] fields = item.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { try { if (fieldInfo.FieldType.IsSubclassOf(typeof(BaseConVar))) { if (fieldInfo.IsStatic) { BaseConVar val = (BaseConVar)fieldInfo.GetValue(null); self.RegisterConVarInternal(val); } else if (item.GetCustomAttribute<CompilerGeneratedAttribute>() == null) { Debug.LogError((object)("ConVar defined as " + item.Name + "." + fieldInfo.Name + " could not be registered. ConVars must be static fields.")); } } } catch (Exception data2) { Log.Debug(data2); } } MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { try { if (((MemberInfo)methodInfo).GetCustomAttribute<ConVarProviderAttribute>() == null) { continue; } if (methodInfo.ReturnType != typeof(IEnumerable<BaseConVar>) || methodInfo.GetParameters().Length != 0) { Debug.LogError((object)"ConVar provider {type.Name}.{methodInfo.Name} does not match the signature \"static IEnumerable<ConVar.BaseConVar>()\"."); continue; } if (!methodInfo.IsStatic) { Debug.LogError((object)("ConVar provider " + item.Name + "." + methodInfo.Name + " could not be invoked. Methods marked with the ConVarProvider attribute must be static.")); continue; } foreach (BaseConVar item2 in (IEnumerable<BaseConVar>)methodInfo.Invoke(null, Array.Empty<object>())) { self.RegisterConVarInternal(item2); } } catch (Exception data3) { Log.Debug(data3); } } } catch (Exception data4) { Log.Debug(data4); } } foreach (BaseConVar value in self.allConVars.Values) { try { if ((value.flags & 0x10) != 0) { value.defaultValue = value.GetString(); } else if (value.defaultValue != null) { value.AttemptSetString(value.defaultValue); } } catch (Exception data5) { Log.Error(data5); } } } } internal class FixDeathAnimLog { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixLackingAnim; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(GenericCharacterDeath).GetMethod("PlayDeathAnimation", (BindingFlags)(-1)); object obj = <>O.<0>__FixLackingAnim; if (obj == null) { Manipulator val3 = FixLackingAnim; <>O.<0>__FixLackingAnim = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void FixLackingAnim(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel label = val.DefineLabel(); MethodReference val2 = default(MethodReference); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldloc_0); val.EmitDelegate<Func<Animator, bool>>((Func<Animator, bool>)delegate(Animator anim) { for (int i = 0; i < anim.layerCount; i++) { if (anim.HasState(i, Animator.StringToHash("Death"))) { return true; } } return false; }); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error("FixDeathAnimLog TryGotoNext failed, not applying patch"); } } } internal class FixExposeLog { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixAddingExpose; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(HealthComponent).GetMethod("TakeDamage", (BindingFlags)(-1)); object obj = <>O.<0>__FixAddingExpose; if (obj == null) { Manipulator val3 = FixAddingExpose; <>O.<0>__FixAddingExpose = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void FixAddingExpose(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = val.DefineLabel(); FieldReference val3 = default(FieldReference); bool num = val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs).GetField("MercExpose")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(CharacterBody).GetMethod("AddBuff", new Type[1] { typeof(BuffDef) })) }); val.MarkLabel(val2); if (num & val.TryGotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Adding expose") })) { val.Emit(OpCodes.Br, (object)val2); } else { Log.Error("FixExposeLog TryGotoNext failed, not applying patch"); } } } internal class FixExtraGameModesMenu { private static Hook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(MainMenuController).GetMethod("Start", (BindingFlags)(-1)), typeof(FixExtraGameModesMenu).GetMethod("FixIt", (BindingFlags)(-1)), val2); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void FixIt(Action<MainMenuController> orig, MainMenuController self) { orig(self); MPButton val = ((IEnumerable<MPButton>)((Component)self.extraGameModeMenuScreen).GetComponentsInChildren<MPButton>()).FirstOrDefault((Func<MPButton, bool>)((MPButton b) => ((Object)b).name == "GenericMenuButton (Eclipse)")); if (Object.op_Implicit((Object)(object)val)) { val.defaultFallbackButton = true; } } } internal class FixNonLethalOneHP { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixLethality; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(HealthComponent).GetMethod("TakeDamage", (BindingFlags)(-1)); object obj = <>O.<0>__FixLethality; if (obj == null) { Manipulator val3 = FixLethality; <>O.<0>__FixLethality = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void FixLethality(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HealthComponent).GetField("health", (BindingFlags)(-1))), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f), (Instruction x) => ILPatternMatchingExt.MatchBltUn(x, ref val2) })) { int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, HealthComponent, float>>((Func<float, HealthComponent, float>)((float targetHealth, HealthComponent self) => (!(self.health > 0f)) ? targetHealth : 0f)); } else { Log.Error("FixNonLethalOneHP TryGotoNext failed, not applying patch"); } } } internal class FixNullBone { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixBoneCheck; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(DynamicBone).GetMethod("ApplyParticlesToTransforms", (BindingFlags)(-1)); object obj = <>O.<0>__FixBoneCheck; if (obj == null) { Manipulator val3 = FixBoneCheck; <>O.<0>__FixBoneCheck = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void FixBoneCheck(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel ifLabel = val.DefineLabel(); int localIndex = -1; MethodReference val2 = default(MethodReference); if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchBgt(x, ref ifLabel) }) && val.TryGotoPrev(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref localIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, localIndex) })) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldloc, localIndex); val.EmitDelegate<Func<Particle, bool>>((Func<Particle, bool>)((Particle p) => Object.op_Implicit((Object)(object)p?.m_Transform))); val.Emit(OpCodes.Brfalse, (object)ifLabel); } else { Log.Error("FixNullBone TryGotoNext failed, not applying patch"); } } } internal class FixProjectileCatalogLimitError { [CompilerGenerated] private static class <>O { public static Manipulator <0>__IncreaseCatalogLimit; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(ProjectileCatalog).GetMethod("SetProjectilePrefabs", (BindingFlags)(-1)); object obj = <>O.<0>__IncreaseCatalogLimit; if (obj == null) { Manipulator val3 = IncreaseCatalogLimit; <>O.<0>__IncreaseCatalogLimit = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void IncreaseCatalogLimit(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locLimitIndex = -1; ILLabel breakLabel = val.DefineLabel(); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[7] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 256), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locLimitIndex), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(ProjectileCatalog).GetField("projectilePrefabs", (BindingFlags)(-1))), (Instruction x) => ILPatternMatchingExt.MatchLdlen(x), (Instruction x) => ILPatternMatchingExt.MatchConvI4(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locLimitIndex), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref breakLabel) })) { val.Emit(OpCodes.Br, (object)breakLabel); } else { Log.Error("IncreaseCatalogLimit TryGotoNext failed, not applying patch"); } } } internal static class FixRunScaling { [CompilerGenerated] private static class <>O { public static Manipulator <0>__CalculateDifficultyCoefficientOnRunStart; public static Action<Run> <1>__CallRecalculateDifficultyCoefficent; } private static ILHook _ilHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(Run).GetMethod("Start", (BindingFlags)(-1)); object obj = <>O.<0>__CalculateDifficultyCoefficientOnRunStart; if (obj == null) { Manipulator val3 = CalculateDifficultyCoefficientOnRunStart; <>O.<0>__CalculateDifficultyCoefficientOnRunStart = val3; obj = (object)val3; } _ilHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); } internal static void Enable() { _ilHook.Apply(); } internal static void Disable() { _ilHook.Undo(); } internal static void Destroy() { _ilHook.Free(); } private static void CalculateDifficultyCoefficientOnRunStart(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchStfld<Run>(i, "allowNewParticipants") })) { if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction i) => ILPatternMatchingExt.MatchStfld<Run>(i, "allowNewParticipants") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<Run>>((Action<Run>)CallRecalculateDifficultyCoefficent); } else { Log.Error("CalculateDifficultyCoefficientOnRunStart TryGotoNext 2 failed, not applying patch"); } } else { Log.Error("CalculateDifficultyCoefficientOnRunStart TryGotoNext 1 failed, not applying patch"); } static void CallRecalculateDifficultyCoefficent(Run instance) { if (NetworkServer.active && Object.op_Implicit((Object)(object)instance)) { instance.RecalculateDifficultyCoefficent(); } } } } public class SaferAchievementManager { private static Hook _hook; private static FieldInfo _achievementManagerOnAchievementsRegisteredFieldInfo; public static event Func<Type, RegisterAchievementAttribute, RegisterAchievementAttribute> OnRegisterAchievementAttributeFound; public static event Action<List<string>, Dictionary<string, AchievementDef>, List<AchievementDef>> OnCollectAchievementDefs; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(AchievementManager).GetMethod("CollectAchievementDefs", (BindingFlags)(-1)), typeof(SaferAchievementManager).GetMethod("SaferCollectAchievementDefs", (BindingFlags)(-1)), val2); _achievementManagerOnAchievementsRegisteredFieldInfo = typeof(AchievementManager).GetField("onAchievementsRegistered", (BindingFlags)(-1)); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void SaferCollectAchievementDefs(Action<Dictionary<string, AchievementDef>> _, Dictionary<string, AchievementDef> achievementIdentifierToDef) { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) List<AchievementDef> list = new List<AchievementDef>(); achievementIdentifierToDef.Clear(); List<Assembly> list2 = new List<Assembly>(); if (RoR2Application.isModded) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly item in assemblies) { list2.Add(item); } } else { list2.Add(typeof(BaseAchievement).Assembly); } foreach (Assembly item2 in list2) { foreach (Type item3 in from _type in item2.GetTypes() where _type.IsSubclassOf(typeof(BaseAchievement)) orderby _type.Name select _type) { RegisterAchievementAttribute val = null; try { val = (RegisterAchievementAttribute)item3.GetCustomAttributes(inherit: false).FirstOrDefault((object v) => v is RegisterAchievementAttribute); if (SaferAchievementManager.OnRegisterAchievementAttributeFound != null) { val = SaferAchievementManager.OnRegisterAchievementAttributeFound(item3, val); } } catch (Exception ex) { Log.Debug("RegisterAchievementAttribute type.GetCustomAttributes(false) failed for : " + item3.FullName + Environment.NewLine + ex); } if (val == null) { continue; } if (achievementIdentifierToDef.ContainsKey(val.identifier)) { Debug.LogErrorFormat("Class {0} attempted to register as achievement {1}, but class {2} has already registered as that achievement.", new object[3] { item3.FullName, val.identifier, AchievementManager.achievementNamesToDefs[val.identifier].type.FullName }); continue; } UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(val.unlockableRewardIdentifier); AchievementDef achievementDef2 = new AchievementDef { identifier = val.identifier, unlockableRewardIdentifier = val.unlockableRewardIdentifier, prerequisiteAchievementIdentifier = val.prerequisiteAchievementIdentifier, nameToken = "ACHIEVEMENT_" + val.identifier.ToUpper(CultureInfo.InvariantCulture) + "_NAME", descriptionToken = "ACHIEVEMENT_" + val.identifier.ToUpper(CultureInfo.InvariantCulture) + "_DESCRIPTION", type = item3, serverTrackerType = val.serverTrackerType }; if (Object.op_Implicit((Object)(object)unlockableDef) && Object.op_Implicit((Object)(object)unlockableDef.achievementIcon)) { achievementDef2.SetAchievedIcon(unlockableDef.achievementIcon); } else { achievementDef2.iconPath = "Textures/AchievementIcons/tex" + val.identifier + "Icon"; } AchievementManager.achievementIdentifiers.Add(val.identifier); achievementIdentifierToDef.Add(val.identifier, achievementDef2); list.Add(achievementDef2); if ((Object)(object)unlockableDef != (Object)null) { unlockableDef.getHowToUnlockString = () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(achievementDef2.nameToken), Language.GetString(achievementDef2.descriptionToken) }); unlockableDef.getUnlockedString = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(achievementDef2.nameToken), Language.GetString(achievementDef2.descriptionToken) }); } } } SaferAchievementManager.OnCollectAchievementDefs?.Invoke(AchievementManager.achievementIdentifiers, achievementIdentifierToDef, list); AchievementManager.achievementDefs = list.ToArray(); AchievementManager.SortAchievements(AchievementManager.achievementDefs); AchievementManager.serverAchievementDefs = AchievementManager.achievementDefs.Where((AchievementDef achievementDef) => achievementDef.serverTrackerType != null).ToArray(); for (int j = 0; j < AchievementManager.achievementDefs.Length; j++) { AchievementManager.achievementDefs[j].index = new AchievementIndex { intValue = j }; } for (int k = 0; k < AchievementManager.serverAchievementDefs.Length; k++) { AchievementManager.serverAchievementDefs[k].serverIndex = new ServerAchievementIndex { intValue = k }; } for (int l = 0; l < AchievementManager.achievementIdentifiers.Count; l++) { string currentAchievementIdentifier = AchievementManager.achievementIdentifiers[l]; achievementIdentifierToDef[currentAchievementIdentifier].childAchievementIdentifiers = AchievementManager.achievementIdentifiers.Where((string v) => achievementIdentifierToDef[v].prerequisiteAchievementIdentifier == currentAchievementIdentifier).ToArray(); } ((Action)_achievementManagerOnAchievementsRegisteredFieldInfo.GetValue(null))?.Invoke(); } } internal class SaferResourceAvailability { private delegate void orig_MakeAvailable(ref ResourceAvailability self); private static Hook _hook; private static FieldInfo _onAvailableBackingFieldInfo; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(ResourceAvailability).GetMethod("MakeAvailable", (BindingFlags)(-1)), typeof(SaferResourceAvailability).GetMethod("TryCatchEachLoopIteration", (BindingFlags)(-1)), val2); _onAvailableBackingFieldInfo = typeof(ResourceAvailability).GetField("onAvailable", BindingFlags.Instance | BindingFlags.NonPublic); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void TryCatchEachLoopIteration(orig_MakeAvailable orig, ref ResourceAvailability self) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (((ResourceAvailability)(ref self)).available) { return; } ((ResourceAvailability)(ref self)).available = true; Action action = (Action)_onAvailableBackingFieldInfo.GetValue(self); if (action == null) { return; } Delegate[] invocationList = action.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action action2 = (Action)invocationList[i]; try { action2(); } catch (Exception data) { Log.Error(data); } } _onAvailableBackingFieldInfo.SetValue(self, null); } } internal class SaferSearchableAttribute { private static Hook _saferCctorHook; private static Hook _deterministicCctorTimingHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0071: 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_007c: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _saferCctorHook = new Hook((MethodBase)typeof(SearchableAttribute).GetMethod("ScanAllAssemblies", (BindingFlags)(-1)), typeof(SaferSearchableAttribute).GetMethod("TryCatchEachLoopIteration", (BindingFlags)(-1)), val2); _deterministicCctorTimingHook = new Hook((MethodBase)typeof(RoR2Application).GetMethod("OnLoad", (BindingFlags)(-1)), typeof(SaferSearchableAttribute).GetMethod("DeterministicCctorTiming", (BindingFlags)(-1)), val2); } internal static void Enable() { _saferCctorHook.Apply(); _deterministicCctorTimingHook.Apply(); } internal static void Disable() { _deterministicCctorTimingHook.Undo(); _saferCctorHook.Undo(); } internal static void Destroy() { _deterministicCctorTimingHook.Free(); _saferCctorHook.Free(); } private static void TryCatchEachLoopIteration(Action _) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { ScanAssembly(assembly); } catch (Exception ex) { Log.Debug("ScanAssembly failed for assembly : " + assembly.FullName + Environment.NewLine + ex); } } } private static void ScanAssembly(Assembly assembly) { if (SearchableAttribute.assemblyBlacklist.Contains(assembly.FullName)) { return; } SearchableAttribute.assemblyBlacklist.Add(assembly.FullName); if (assembly.GetCustomAttribute<OptInAttribute>() == null) { return; } Type[] types = assembly.GetTypes(); foreach (Type type in types) { SearchableAttribute[] array = Array.Empty<SearchableAttribute>(); try { array = (from a in type.GetCustomAttributes(inherit: false) where a is SearchableAttribute select a).Cast<SearchableAttribute>().ToArray(); } catch (Exception ex) { Log.Debug("ScanAssembly type.GetCustomAttributes(false) failed for : " + type.FullName + Environment.NewLine + ex); } SearchableAttribute[] array2 = array; foreach (SearchableAttribute val in array2) { try { SearchableAttribute.RegisterAttribute(val, (object)type); } catch (Exception ex2) { Log.Debug("SearchableAttribute.RegisterAttribute(attribute, type) failed for : " + type.FullName + Environment.NewLine + ex2); } } MemberInfo[] array3 = Array.Empty<MemberInfo>(); try { array3 = type.GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } catch (Exception ex3) { Log.Debug("type.GetMembers failed for : " + type.FullName + Environment.NewLine + ex3); } MemberInfo[] array4 = array3; foreach (MemberInfo memberInfo in array4) { SearchableAttribute[] array5 = Array.Empty<SearchableAttribute>(); try { array5 = (from a in memberInfo.GetCustomAttributes(inherit: false) where a is SearchableAttribute select a).Cast<SearchableAttribute>().ToArray(); } catch (Exception ex4) { Log.Debug("memberInfo.GetCustomAttributes(false) failed for : " + type.FullName + Environment.NewLine + memberInfo.Name + Environment.NewLine + ex4); } array2 = array5; foreach (SearchableAttribute val2 in array2) { try { SearchableAttribute.RegisterAttribute(val2, (object)memberInfo); } catch (Exception ex5) { Log.Debug("SearchableAttribute.RegisterAttribute(attribute, memberInfo) failed for : " + type.FullName + Environment.NewLine + memberInfo.Name + Environment.NewLine + ex5); } } } } } private static IEnumerator DeterministicCctorTiming(Func<RoR2Application, IEnumerator> orig, RoR2Application self) { RunCctorAgain(); return orig(self); } private static void RunCctorAgain() { typeof(SearchableAttribute).TypeInitializer.Invoke(null, null); } } } namespace RoR2BepInExPack.Reflection { internal class ReflectionHelper { internal const BindingFlags AllFlags = (BindingFlags)(-1); } } namespace RoR2BepInExPack.ReflectionHooks { internal class AutoCatchReflectionTypeLoadException { private static Hook _onHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _onHook = new Hook((MethodBase)typeof(Assembly).GetMethods((BindingFlags)(-1)).First((MethodInfo m) => m.Name == "GetTypes" && m.GetParameters().Length == 0 && (m.MethodImplementationFlags & MethodImplAttributes.InternalCall) == 0), typeof(AutoCatchReflectionTypeLoadException).GetMethod("SaferGetTypes", (BindingFlags)(-1)), ref val2); } internal static void Enable() { _onHook.Apply(); } internal static void Disable() { _onHook.Undo(); } internal static void Destroy() { _onHook.Free(); } private static Type[] SaferGetTypes(Func<Assembly, Type[]> orig, Assembly self) { Type[] array = Array.Empty<Type>(); try { array = orig(self); } catch (ReflectionTypeLoadException ex) { array = ex.Types.Where((Type t) => t != null).ToArray(); Log.Debug($"Assembly.GetTypes() failed for {self.FullName} (threw ReflectionTypeLoadException). {ex}"); } return array; } } } namespace RoR2BepInExPack.ModCompatibility { internal class FixMultiCorrupt { internal enum ContagionPriority { First, Last, Random, Rarest, Alternate } private class ContagionAlternateTracker : MonoBehaviour { private static readonly Dictionary<Inventory, ContagionAlternateTracker> instances = new Dictionary<Inventory, ContagionAlternateTracker>(); private readonly Dictionary<ItemIndex, int> contagions = new Dictionary<ItemIndex, int>(); private Inventory inventory; private void Awake() { inventory = ((Component)this).GetComponent<Inventory>(); instances[inventory] = this; } private void OnDestroy() { instances.Remove(inventory); } public int AddContagion(ItemIndex itemIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) if (contagions.TryGetValue(itemIndex, out var value)) { return contagions[itemIndex] = value + 1; } return contagions[itemIndex] = 0; } public static ContagionAlternateTracker GetOrAdd(Inventory inventory) { if (instances.TryGetValue(inventory, out var value)) { return value; } return ((Component)inventory).gameObject.AddComponent<ContagionAlternateTracker>(); } } [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixStep; } private static ILHook _stepInventoryInfectionILHook; private static Hook _generateStageRNGOnHook; private static Xoroshiro128Plus _voidRNG; private static ConfigEntry<ContagionPriority> _contagionPriority; internal static void Init(ConfigFile config) { //IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_006b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown _contagionPriority = config.Bind<ContagionPriority>("General", "Contagion Priority", ContagionPriority.Random, "Determines behaviour for when multiple results are available for an item transformation."); ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(ContagiousItemManager).GetMethod("StepInventoryInfection", (BindingFlags)(-1)); object obj = <>O.<0>__FixStep; if (obj == null) { Manipulator val3 = FixStep; <>O.<0>__FixStep = val3; obj = (object)val3; } _stepInventoryInfectionILHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); HookConfig val4 = default(HookConfig); val4.ManualApply = true; HookConfig val5 = val4; _generateStageRNGOnHook = new Hook((MethodBase)typeof(Run).GetMethod("GenerateStageRNG", (BindingFlags)(-1)), typeof(FixMultiCorrupt).GetMethod("OnGenerateStageRNG", (BindingFlags)(-1)), ref val5); } internal static void Enable() { _stepInventoryInfectionILHook.Apply(); _generateStageRNGOnHook.Apply(); } internal static void Disable() { _stepInventoryInfectionILHook.Undo(); _generateStageRNGOnHook.Undo(); } internal static void Destroy() { _stepInventoryInfectionILHook.Free(); _generateStageRNGOnHook.Free(); } private static void FixStep(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007d: 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_0096: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(ContagiousItemManager).GetField("originalToTransformed", (BindingFlags)(-1))), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdelemI4(x) })) { val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldarg, 1); val.EmitDelegate<Func<Inventory, ItemIndex, ItemIndex>>((Func<Inventory, ItemIndex, ItemIndex>)delegate(Inventory inventory, ItemIndex pureItem) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) List<ItemIndex> list = inventory.itemAcquisitionOrder.Where((ItemIndex item) => ContagiousItemManager.GetOriginalItemIndex(item) == pureItem).ToList(); if (list.Count == 0) { list = (from info in (IEnumerable<TransformationInfo>)(object)ContagiousItemManager.transformationInfos where info.originalItem == pureItem select info.transformedItem).ToList(); } switch (_contagionPriority.Value) { case ContagionPriority.First: return list.First(); case ContagionPriority.Last: return list.Last(); case ContagionPriority.Alternate: { ContagionAlternateTracker orAdd = ContagionAlternateTracker.GetOrAdd(inventory); return list[orAdd.AddContagion(pureItem) % list.Count]; } case ContagionPriority.Rarest: list.Sort(delegate(ItemIndex item, ItemIndex item2) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000e: 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) ItemTier tier = ItemCatalog.GetItemDef(item).tier; return ((Enum)(ItemTier)(ref tier)).CompareTo((object?)ItemCatalog.GetItemDef(item2).tier); }); return list.Last(); case ContagionPriority.Random: return list[_voidRNG.RangeInt(0, list.Count)]; default: return ContagiousItemManager.originalToTransformed[pureItem]; } }); } else { Log.Error("FixMultiCorrupt TryGotoNext failed, not applying patch"); } } private static void OnGenerateStageRNG(Action<Run> orig, Run self) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown orig(self); _voidRNG = new Xoroshiro128Plus(self.stageRng.nextUlong); } } internal class FixNullEntitlement { [CompilerGenerated] private static class <>O { public static Manipulator <0>__FixEntitledCheck; } private static ILHook _localILHook; private static ILHook _networkILHook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //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_007e: Expected O, but got Unknown ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; MethodInfo? method = typeof(BaseUserEntitlementTracker<LocalUser>).GetMethod("UserHasEntitlement", (BindingFlags)(-1)); object obj = <>O.<0>__FixEntitledCheck; if (obj == null) { Manipulator val3 = FixEntitledCheck; <>O.<0>__FixEntitledCheck = val3; obj = (object)val3; } _localILHook = new ILHook((MethodBase)method, (Manipulator)obj, ref val2); MethodInfo? method2 = typeof(BaseUserEntitlementTracker<NetworkUser>).GetMethod("UserHasEntitlement", (BindingFlags)(-1)); object obj2 = <>O.<0>__FixEntitledCheck; if (obj2 == null) { Manipulator val4 = FixEntitledCheck; <>O.<0>__FixEntitledCheck = val4; obj2 = (object)val4; } _networkILHook = new ILHook((MethodBase)method2, (Manipulator)obj2, ref val2); } internal static void Enable() { _localILHook.Apply(); _networkILHook.Apply(); } internal static void Disable() { _localILHook.Undo(); _networkILHook.Undo(); } internal static void Destroy() { _localILHook.Free(); _networkILHook.Free(); } private static void FixEntitledCheck(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "entitlementDef") })) { val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Ret); } else { Log.Error("FixNullEntitlement TryGotoNext failed, not applying patch"); } } } internal class SaferWWise { [CompilerGenerated] private static class <>O { public static Manipulator <0>__EarlyReturnIfNoSoundEngine; public static Func<bool> <1>__ReturnTrueIfNoSoundEngine; } private static List<ILHook> _hooks = new List<ILHook>(); internal static void Init() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0077: 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_0082: Expected O, but got Unknown if (!Application.isBatchMode) { return; } foreach (MethodInfo item in from m in typeof(AkSoundEngine).GetMethods(BindingFlags.Static | BindingFlags.Public) where m.ReturnParameter.ParameterType == typeof(AKRESULT) select m) { ILHookConfig val = default(ILHookConfig); val.ManualApply = true; ILHookConfig val2 = val; List<ILHook> hooks = _hooks; object obj = <>O.<0>__EarlyReturnIfNoSoundEngine; if (obj == null) { Manipulator val3 = EarlyReturnIfNoSoundEngine; <>O.<0>__EarlyReturnIfNoSoundEngine = val3; obj = (object)val3; } hooks.Add(new ILHook((MethodBase)item, (Manipulator)obj, ref val2)); } } internal static void Enable() { foreach (ILHook hook in _hooks) { hook.Apply(); } } internal static void Disable() { foreach (ILHook hook in _hooks) { hook.Undo(); } } internal static void Destroy() { foreach (ILHook hook in _hooks) { hook.Free(); } } private static void EarlyReturnIfNoSoundEngine(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.EmitDelegate<Func<bool>>((Func<bool>)ReturnTrueIfNoSoundEngine); int index = val.Index; val.Emit(OpCodes.Ldc_I4, 2); val.Emit(OpCodes.Ret); ILLabel val2 = val.MarkLabel(); val.Index = index; val.Emit(OpCodes.Brfalse, (object)val2); static bool ReturnTrueIfNoSoundEngine() { return Application.isBatchMode; } } } } namespace RoR2BepInExPack.LegacyAssetSystem { internal static class LegacyResourcesDetours { private delegate Object ResourcesLoadDefinition(string path, Type type); private static MethodInfo _legacyResourcesAPILoad; private static readonly Dictionary<Type, MethodInfo> GenericVersionsOfLegacyResourcesAPILoad = new Dictionary<Type, MethodInfo>(); private static NativeDetour _resourcesLoadDetour; private static ResourcesLoadDefinition _origLoad; private static MethodInfo GetGenericLegacyResourcesAPILoad(Type type) { if (!GenericVersionsOfLegacyResourcesAPILoad.TryGetValue(type, out var value)) { value = (GenericVersionsOfLegacyResourcesAPILoad[type] = _legacyResourcesAPILoad.MakeGenericMethod(type)); } return value; } internal static void Init() { //IL_001c: 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_002b: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown _legacyResourcesAPILoad = typeof(LegacyResourcesAPI).GetMethod("Load", (BindingFlags)(-1)); NativeDetourConfig val = default(NativeDetourConfig); val.ManualApply = true; NativeDetourConfig val2 = val; _resourcesLoadDetour = new NativeDetour((MethodBase)typeof(Resources).GetMethod("Load", (BindingFlags)(-1), null, new Type[2] { typeof(string), typeof(Type) }, null), (MethodBase)typeof(LegacyResourcesDetours).GetMethod("OnResourcesLoad", (BindingFlags)(-1)), val2); _origLoad = _resourcesLoadDetour.GenerateTrampoline<ResourcesLoadDefinition>(); } internal static void Enable() { _resourcesLoadDetour.Apply(); } internal static void Disable() { _resourcesLoadDetour.Undo(); } internal static void Destroy() { _resourcesLoadDetour.Free(); } private static Object OnResourcesLoad(string path, Type type) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown MethodInfo genericLegacyResourcesAPILoad = GetGenericLegacyResourcesAPILoad(type); object[] parameters = new string[1] { path }; Object val = (Object)genericLegacyResourcesAPILoad.Invoke(null, parameters); if (Object.op_Implicit(val)) { return val; } return _origLoad(path, type); } } internal static class LegacyShaderDetours { private delegate Shader ShaderFindDefinition(string path); private static NativeDetour _shaderFindDetour; private static ShaderFindDefinition _origFind; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown NativeDetourConfig val = default(NativeDetourConfig); val.ManualApply = true; NativeDetourConfig val2 = val; _shaderFindDetour = new NativeDetour((MethodBase)typeof(Shader).GetMethod("Find", (BindingFlags)(-1), null, new Type[1] { typeof(string) }, null), (MethodBase)typeof(LegacyShaderDetours).GetMethod("OnShaderFind", (BindingFlags)(-1)), val2); _origFind = _shaderFindDetour.GenerateTrampoline<ShaderFindDefinition>(); } internal static void Enable() { _shaderFindDetour.Apply(); } internal static void Disable() { _shaderFindDetour.Undo(); } internal static void Destroy() { _shaderFindDetour.Free(); } private static Shader OnShaderFind(string path) { Shader val = LegacyShaderAPI.Find(path); if (Object.op_Implicit((Object)(object)val)) { return val; } return _origFind(path); } } }
BepinEx/plugins/RoR2BepInExPack/RoR2BepInExPack.dll
Decompiled 11 months agousing System; 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.Logging; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using RoR2; using RoR2.UI; using RoR2BepInExPack.LegacyAssetSystem; using RoR2BepInExPack.VanillaFixes; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("RoR2BepInExPack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RoR2BepInExPack")] [assembly: AssemblyTitle("RoR2BepInExPack")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace RoR2BepInExPack { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("___riskofthunder.RoR2BepInExPack", "RoR2BepInExPack", "1.0.1")] public class RoR2BepInExPack : BaseUnityPlugin { public const string PluginGUID = "___riskofthunder.RoR2BepInExPack"; public const string PluginName = "RoR2BepInExPack"; public const string PluginVersion = "1.0.1"; private void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); RoR2Application.isModded = true; InitHooks(); } private void InitHooks() { FixConsoleLog.Init(); FixEclipseButton.Init(); LegacyResourcesDetours.Init(); LegacyShaderDetours.Init(); } private void OnEnable() { FixConsoleLog.Enable(); FixEclipseButton.Enable(); LegacyResourcesDetours.Enable(); LegacyShaderDetours.Enable(); } private void OnDisable() { LegacyShaderDetours.Disable(); LegacyResourcesDetours.Disable(); FixEclipseButton.Disable(); FixConsoleLog.Disable(); } private void OnDestroy() { LegacyShaderDetours.Destroy(); LegacyResourcesDetours.Destroy(); FixEclipseButton.Destroy(); FixConsoleLog.Destroy(); } } } namespace RoR2BepInExPack.VanillaFixes { internal class ILLine { private static ILHook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; _hook = new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", (BindingFlags)(-1)), new Manipulator(ShowILLine)); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void ShowILLine(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown try { ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", (BindingFlags)(-1))) }); val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } catch (Exception arg) { Log.Error(string.Format("{0} hook failed.{1}{2}", "ShowILLine", Environment.NewLine, arg)); } } private static string GetLineOrIL(StackFrame instace) { int fileLineNumber = instace.GetFileLineNumber(); if (fileLineNumber != -1 && fileLineNumber != 0) { return fileLineNumber.ToString(); } return "IL_" + instace.GetILOffset().ToString("X4"); } } internal class FixConsoleLog { private static Hook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(UnitySystemConsoleRedirector).GetMethod("Redirect", (BindingFlags)(-1)), typeof(FixConsoleLog).GetMethod("DoNothing", (BindingFlags)(-1)), val2); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void DoNothing() { } } internal class FixEclipseButton { private static Hook _hook; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown HookConfig val = default(HookConfig); val.ManualApply = true; HookConfig val2 = val; _hook = new Hook((MethodBase)typeof(DisableIfGameModded).GetMethod("OnEnable", (BindingFlags)(-1)), typeof(FixEclipseButton).GetMethod("FixIt", (BindingFlags)(-1)), val2); } internal static void Enable() { _hook.Apply(); } internal static void Disable() { _hook.Undo(); } internal static void Destroy() { _hook.Free(); } private static void FixIt(Action<DisableIfGameModded> orig, DisableIfGameModded self) { if (((Object)self).name == "GenericMenuButton (Eclipse)") { MPButton component = ((Component)self).GetComponent<MPButton>(); if (Object.op_Implicit((Object)(object)component)) { component.defaultFallbackButton = true; } } else { orig(self); } } } } namespace RoR2BepInExPack.Reflection { internal class ReflectionHelper { internal const BindingFlags AllFlags = (BindingFlags)(-1); } } namespace RoR2BepInExPack.LegacyAssetSystem { internal static class LegacyResourcesDetours { private delegate Object ResourcesLoadDefinition(string path, Type type); private static MethodInfo _legacyResourcesAPILoad; private static readonly Dictionary<Type, MethodInfo> GenericVersionsOfLegacyResourcesAPILoad = new Dictionary<Type, MethodInfo>(); private static NativeDetour _resourcesLoadDetour; private static ResourcesLoadDefinition _origLoad; private static MethodInfo GetGenericLegacyResourcesAPILoad(Type type) { if (!GenericVersionsOfLegacyResourcesAPILoad.TryGetValue(type, out var value)) { value = (GenericVersionsOfLegacyResourcesAPILoad[type] = _legacyResourcesAPILoad.MakeGenericMethod(type)); } return value; } internal static void Init() { //IL_001c: 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_002b: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown _legacyResourcesAPILoad = typeof(LegacyResourcesAPI).GetMethod("Load", (BindingFlags)(-1)); NativeDetourConfig val = default(NativeDetourConfig); val.ManualApply = true; NativeDetourConfig val2 = val; _resourcesLoadDetour = new NativeDetour((MethodBase)typeof(Resources).GetMethod("Load", (BindingFlags)(-1), null, new Type[2] { typeof(string), typeof(Type) }, null), (MethodBase)typeof(LegacyResourcesDetours).GetMethod("OnResourcesLoad", (BindingFlags)(-1)), val2); _origLoad = _resourcesLoadDetour.GenerateTrampoline<ResourcesLoadDefinition>(); } internal static void Enable() { _resourcesLoadDetour.Apply(); } internal static void Disable() { _resourcesLoadDetour.Undo(); } internal static void Destroy() { _resourcesLoadDetour.Free(); } private static Object OnResourcesLoad(string path, Type type) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown MethodInfo genericLegacyResourcesAPILoad = GetGenericLegacyResourcesAPILoad(type); object[] parameters = new string[1] { path }; Object val = (Object)genericLegacyResourcesAPILoad.Invoke(null, parameters); if (Object.op_Implicit(val)) { return val; } return _origLoad(path, type); } } internal static class LegacyShaderDetours { private delegate Shader ShaderFindDefinition(string path); private static NativeDetour _shaderFindDetour; private static ShaderFindDefinition _origFind; internal static void Init() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown NativeDetourConfig val = default(NativeDetourConfig); val.ManualApply = true; NativeDetourConfig val2 = val; _shaderFindDetour = new NativeDetour((MethodBase)typeof(Shader).GetMethod("Find", (BindingFlags)(-1), null, new Type[1] { typeof(string) }, null), (MethodBase)typeof(LegacyShaderDetours).GetMethod("OnShaderFind", (BindingFlags)(-1)), val2); _origFind = _shaderFindDetour.GenerateTrampoline<ShaderFindDefinition>(); } internal static void Enable() { _shaderFindDetour.Apply(); } internal static void Disable() { _shaderFindDetour.Undo(); } internal static void Destroy() { _shaderFindDetour.Free(); } private static Shader OnShaderFind(string path) { Shader val = LegacyShaderAPI.Find(path); if (Object.op_Implicit((Object)(object)val)) { return val; } return _origFind(path); } } }
BepinEx/plugins/Rune580-StopStealingMyMouse/StopStealingMyMouse.dll
Decompiled 11 months agousing 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 MonoMod.RuntimeDetour; using RoR2; using RoR2.UI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("StopStealingMyMouse")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StopStealingMyMouse")] [assembly: AssemblyTitle("StopStealingMyMouse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace StopStealingMyMouse; [BepInPlugin("com.rune580.stopstealingmymouse", "Stop stealing my mouse!", "1.2.0")] public sealed class StopStealingMyMousePlugin : BaseUnityPlugin { private const string ModName = "Stop stealing my mouse!"; private const string Author = "rune580"; private const string Guid = "com.rune580.stopstealingmymouse"; private const string Version = "1.2.0"; private bool _arrestRoR2 = true; private Hook _mpEventSystemManagerHook; private Hook _hgButtonHook; private void Awake() { ArrestRoR2(); } private void ArrestRoR2() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown MethodInfo method = typeof(MPEventSystemManager).GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = ((object)this).GetType().GetMethod("MPEventSystemManagerOnUpdate", BindingFlags.Instance | BindingFlags.NonPublic); _mpEventSystemManagerHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(HGButton).GetMethod("OnClickCustom", BindingFlags.Instance | BindingFlags.Public); method2 = ((object)this).GetType().GetMethod("HGButtonOnOnClickCustom", BindingFlags.Instance | BindingFlags.NonPublic); _hgButtonHook = new Hook((MethodBase)method, method2, (object)this); } private void ReleaseRoR2() { _mpEventSystemManagerHook.Undo(); _hgButtonHook.Undo(); } private void MPEventSystemManagerOnUpdate(Action<MPEventSystemManager> orig, MPEventSystemManager self) { if (_arrestRoR2) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = false; } else { orig(self); } } private void HGButtonOnOnClickCustom(Action<HGButton> orig, HGButton self) { if (_arrestRoR2) { ReleaseRoR2(); } orig(self); } private void OnApplicationFocus(bool hasFocus) { if (_arrestRoR2 && RoR2Application.loadFinished && hasFocus) { _arrestRoR2 = false; Cursor.lockState = (CursorLockMode)2; Cursor.visible = false; } } }
BepinEx/plugins/RuneFox237-Teleporter_Turrets/TeleporterTurrets.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using On.RoR2; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TeleporterTurrets")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TeleporterTurrets")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9287bac8-27c9-48a8-a6a0-9d29fad83a57")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyVersion("1.0.0.0")] namespace RuneFoxMods; [BepInPlugin("com.RuneFoxMods.TeleporterTurrets", "TeleporterTurrets", "1.0.3")] public class TeleporterTurrets : BaseUnityPlugin { public static string[] TeleportableTurrets = new string[1] { "Turret1" }; public void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(TeleporterInteraction_OnInteractionBegin); } private void TeleporterInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) if (!self.isIdle) { orig.Invoke(self, activator); return; } ReadOnlyCollection<CharacterMaster> readOnlyInstancesList = CharacterMaster.readOnlyInstancesList; List<CharacterMaster> list = readOnlyInstancesList.Cast<CharacterMaster>().ToList(); List<CharacterMaster> list2 = new List<CharacterMaster>(); foreach (CharacterMaster item in list) { if ((Object)(object)item == (Object)null) { continue; } string[] teleportableTurrets = TeleportableTurrets; foreach (string value in teleportableTurrets) { if (((Object)item).name.StartsWith(value)) { list2.Add(item); } } } int num = 0; int count = list2.Count; Vector3 val = default(Vector3); Vector3 val3 = default(Vector3); foreach (CharacterMaster item2 in list2) { float num2 = 7f; float num3 = (float)Math.PI * 2f / (float)count; ((Vector3)(ref val))..ctor(Mathf.Cos(num3 * (float)num) * num2, 0.25f, Mathf.Sin(num3 * (float)num) * num2); num++; Vector3 val2 = ((Component)self).transform.position + val; CharacterBody body = item2.GetBody(); ((Vector3)(ref val3))..ctor(0f, 0.1f, 0f); Vector3 val4 = body.footPosition - ((Component)body).transform.position; TeleportHelper.TeleportGameObject(((Component)body).gameObject, val2 - val4 + val3); } orig.Invoke(self, activator); } }
BepinEx/plugins/TeaBoneJones-IncreaseHuntressRange/IncreaseHuntressRange.dll
Decompiled 11 months agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using R2API.Utils; using RoR2; 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("IncreaseHuntressRange")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("IncreaseHuntressRange")] [assembly: AssemblyTitle("IncreaseHuntressRange")] [assembly: AssemblyVersion("1.0.0.0")] namespace IncreaseHuntressRange; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.TeaBoneJones.IncreaseHuntressRange", "Increase Huntress Range", "1.0.0")] public class IncreaseHuntressRange : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_SearchForTarget <>9__2_0; internal void <Awake>b__2_0(orig_SearchForTarget orig, HuntressTracker self, Ray aimRay) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) float maxDistanceFilter; if (godMode.Value) { maxDistanceFilter = 10000f; } else { uint teamLevel = TeamManager.instance.GetTeamLevel((TeamIndex)1); maxDistanceFilter = 60f + scaleFactor.Value * (float)(teamLevel - 1); } Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").teamMaskFilter = TeamMask.all; ((TeamMask)(ref Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").teamMaskFilter)).RemoveTeam(Reflection.GetFieldValue<TeamComponent>((object)self, "teamComponent").teamIndex); Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").filterByLoS = true; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").searchOrigin = ((Ray)(ref aimRay)).origin; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").searchDirection = ((Ray)(ref aimRay)).direction; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").sortMode = (SortMode)1; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").maxDistanceFilter = maxDistanceFilter; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").maxAngleFilter = self.maxTrackingAngle; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").RefreshCandidates(); Reflection.SetFieldValue<HurtBox>((object)self, "trackingTarget", Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").GetResults().FirstOrDefault()); } } private static ConfigWrapper<bool> godMode; private static ConfigWrapper<float> scaleFactor; public void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown godMode = ((BaseUnityPlugin)this).Config.Wrap<bool>("Huntress", "GodMode", "Set the range to be so massive that you can attack any enemy that is visible", false); scaleFactor = ((BaseUnityPlugin)this).Config.Wrap<float>("Huntress", "ScaleFactor", "Set how much the range increases (in meters) each level. Recommended: 3 (but I'm not your dad)", 3f); object obj = <>c.<>9__2_0; if (obj == null) { hook_SearchForTarget val = delegate(orig_SearchForTarget orig, HuntressTracker self, Ray aimRay) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) float maxDistanceFilter; if (godMode.Value) { maxDistanceFilter = 10000f; } else { uint teamLevel = TeamManager.instance.GetTeamLevel((TeamIndex)1); maxDistanceFilter = 60f + scaleFactor.Value * (float)(teamLevel - 1); } Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").teamMaskFilter = TeamMask.all; ((TeamMask)(ref Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").teamMaskFilter)).RemoveTeam(Reflection.GetFieldValue<TeamComponent>((object)self, "teamComponent").teamIndex); Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").filterByLoS = true; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").searchOrigin = ((Ray)(ref aimRay)).origin; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").searchDirection = ((Ray)(ref aimRay)).direction; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").sortMode = (SortMode)1; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").maxDistanceFilter = maxDistanceFilter; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").maxAngleFilter = self.maxTrackingAngle; Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").RefreshCandidates(); Reflection.SetFieldValue<HurtBox>((object)self, "trackingTarget", Reflection.GetFieldValue<BullseyeSearch>((object)self, "search").GetResults().FirstOrDefault()); }; <>c.<>9__2_0 = val; obj = (object)val; } HuntressTracker.SearchForTarget += (hook_SearchForTarget)obj; } }
BepinEx/plugins/TheMysticSword-Hyperbleed/Hyperbleed.dll
Decompiled 11 months agousing System; 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 IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RoR2; 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("Hyperbleed")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Hyperbleed")] [assembly: AssemblyTitle("Hyperbleed")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Hyperbleed; [BepInPlugin("com.themysticsword.hyperbleed", "Hyperbleed", "1.0.0")] public class HyperbleedPlugin : BaseUnityPlugin { private struct InflictHyperbleedInfo { public GameObject attacker; public DotIndex dotIndex; public float damageBonus; } public const string PluginGUID = "com.themysticsword.hyperbleed"; public const string PluginName = "Hyperbleed"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<bool> affectBleed; public static ConfigEntry<bool> affectCollapse; private List<InflictHyperbleedInfo> inflictHyperBleedInfos = new List<InflictHyperbleedInfo>(); public void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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 affectBleed = ((BaseUnityPlugin)this).Config.Bind<bool>("", "AffectBleed", true, "Makes the mod affect Bleed from Tri-Tip Daggers and other sources of bleed chance"); affectCollapse = ((BaseUnityPlugin)this).Config.Bind<bool>("", "AffectCollapse", true, "Makes the mod affect Collapse from Needletick (Survivors of the Void DLC)"); GlobalEventManager.OnHitEnemy += new Manipulator(GlobalEventManager_OnHitEnemy); DotController.InflictDot_refInflictDotInfo += new hook_InflictDot_refInflictDotInfo(DotController_InflictDot_refInflictDotInfo); } private void GlobalEventManager_OnHitEnemy(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_bleedChance") }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { val.Emit(OpCodes.Ldarg, 1); val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo damageInfo) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component2 = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component2)) { float num2 = (component2.bleedChance - 100f) * damageInfo.procCoefficient; if (num2 > 0f) { inflictHyperBleedInfos.Add(new InflictHyperbleedInfo { attacker = damageInfo.attacker, dotIndex = (DotIndex)0, damageBonus = num2 / 100f }); } } } }); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to hook Bleed infliction, Hyperbleed will not affect Bleed"); } if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid") }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 19) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProcChainMask>(x, "AddProc") })) { val.Emit(OpCodes.Ldarg, 1); val.EmitDelegate<Action<DamageInfo>>((Action<DamageInfo>)delegate(DamageInfo damageInfo) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { float num = ((float)component.inventory.GetItemCount(Items.BleedOnHitVoid) * 10f - 100f) * damageInfo.procCoefficient; if (num > 0f) { inflictHyperBleedInfos.Add(new InflictHyperbleedInfo { attacker = damageInfo.attacker, dotIndex = (DotIndex)8, damageBonus = num / 100f }); } } } }); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to hook Collapse infliction, Hyperbleed will not affect Collapse"); } } private void DotController_InflictDot_refInflictDotInfo(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) GameObject attacker = inflictDotInfo.attackerObject; DotIndex dotIndex = inflictDotInfo.dotIndex; if (Object.op_Implicit((Object)(object)attacker) && inflictHyperBleedInfos.Count > 0) { InflictHyperbleedInfo item = inflictHyperBleedInfos.Find((InflictHyperbleedInfo x) => (Object)(object)x.attacker == (Object)(object)attacker && x.dotIndex == dotIndex); if (!item.Equals(default(InflictHyperbleedInfo))) { inflictDotInfo.damageMultiplier += item.damageBonus; inflictHyperBleedInfos.Remove(item); } } orig.Invoke(ref inflictDotInfo); } }
BepinEx/plugins/TheRealElysium-EmptyChestsBeGone/ECBG/EmptyChestsBeGone.dll
Decompiled 11 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using EntityStates; using EntityStates.Barrel; using On.EntityStates.Barrel; 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("EmptyChestsBeGone")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmptyChestsBeGone")] [assembly: AssemblyTitle("EmptyChestsBeGone")] [assembly: AssemblyVersion("1.0.0.0")] namespace EmptyChestsBeGone; [BepInPlugin("com.Elysium.ECBG", "EmptyChestsBeGone", "1.1.0")] internal class EmptyChestsBeGone : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__0_0; internal void <Awake>b__0_0(orig_OnEnter orig_OnEnter, Opened orig) { orig_OnEnter.Invoke(orig); Object.Destroy((Object)(object)((Component)((EntityState)orig).outer).gameObject, 3f); } } public void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig_OnEnter, Opened orig) { orig_OnEnter.Invoke(orig); Object.Destroy((Object)(object)((Component)((EntityState)orig).outer).gameObject, 3f); }; <>c.<>9__0_0 = val; obj = (object)val; } Opened.OnEnter += (hook_OnEnter)obj; } }
BepinEx/plugins/TheRealElysium-WaxQuailMultiJump/WaxQuailMultiJump.dll
Decompiled 11 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using EntityStates; using IL.EntityStates; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("WaxQuailMultiJump")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WaxQuailMultiJump")] [assembly: AssemblyTitle("WaxQuailMultiJump")] [assembly: AssemblyVersion("1.0.0.0")] namespace WaxQuailMultiJump; [BepInPlugin("com.Elysium.WaxQuailMultiJump", "WaxQuailMultiJump", "1.0.1")] internal class WaxQuailMultiJump : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__0_1; public static Func<Instruction, bool> <>9__0_2; public static Func<Instruction, bool> <>9__0_3; public static Func<Instruction, bool> <>9__0_4; public static Func<Instruction, bool> <>9__0_5; public static Func<Instruction, bool> <>9__0_6; public static Manipulator <>9__0_0; internal void <Awake>b__0_0(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount") }); val.Index += 5; val.Remove(); val.Emit<CharacterBody>(OpCodes.Callvirt, "get_maxJumpCount"); } internal bool <Awake>b__0_1(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <Awake>b__0_2(Instruction x) { return ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor"); } internal bool <Awake>b__0_3(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount"); } internal bool <Awake>b__0_4(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <Awake>b__0_5(Instruction x) { return ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody"); } internal bool <Awake>b__0_6(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount"); } } public void Awake() { //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_001f: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.GotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterMotor"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterMotor>(x, "jumpCount"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<EntityState>(x, "get_characterBody"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount") }); val2.Index += 5; val2.Remove(); val2.Emit<CharacterBody>(OpCodes.Callvirt, "get_maxJumpCount"); }; <>c.<>9__0_0 = val; obj = (object)val; } GenericCharacterMain.ProcessJump += (Manipulator)obj; } }
BepinEx/plugins/ThinkInvis-Hypercrit/Hypercrit.dll
Decompiled 11 months agousing 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 EntityStates; using EntityStates.Huntress.HuntressWeapon; using IL.EntityStates.Huntress.HuntressWeapon; using IL.RoR2; using IL.RoR2.Orbs; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Huntress.HuntressWeapon; using On.RoR2; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.Orbs; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Hypercrit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Hypercrit")] [assembly: AssemblyTitle("Hypercrit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ThinkInvisible.Hypercrit; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.ThinkInvisible.Hypercrit", "Hypercrit", "2.0.3")] public class HypercritPlugin : BaseUnityPlugin { private enum CritStackingMode { Linear, Exponential, Asymptotic } public class AdditionalCritInfo : ISerializableObject { public float totalCritChance; public int numCrits; public float damageMult = 1f; public void Deserialize(NetworkReader reader) { totalCritChance = reader.ReadSingle(); numCrits = reader.ReadInt32(); damageMult = reader.ReadSingle(); } public void Serialize(NetworkWriter writer) { writer.Write(totalCritChance); writer.Write(numCrits); writer.Write(damageMult); } } public const string ModVer = "2.0.3"; public const string ModName = "Hypercrit"; public const string ModGuid = "com.ThinkInvisible.Hypercrit"; private readonly ConditionalWeakTable<object, AdditionalCritInfo> critInfoAttachments = new ConditionalWeakTable<object, AdditionalCritInfo>(); private int critCap; private float critBase; private float critMult; private float decayParam; private CritStackingMode stackMode; private bool multiFlurry; private int flurryBase; private int flurryAdd; private bool nerfFlurry; private bool loopColors; private int colorLoopRate; private static AdditionalCritInfo lastNetworkedCritInfo; public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_008f: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d4: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0119: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_014e: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0183: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_01c2: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0201: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_0236: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown //IL_026b: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02ab: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown ConfigFile val = new ConfigFile(Paths.ConfigPath + "\\com.ThinkInvisible.Hypercrit.cfg", true); ConfigEntry<int> val2 = val.Bind<int>(new ConfigDefinition("Hypercrit", "CritCap"), 1000000000, new ConfigDescription("Maximum number of extra crit stacks to allow. Reduce SHARPLY (to ~50) if using StackMode: Exponential; attacks may break at high stacks otherwise.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), Array.Empty<object>())); critCap = val2.Value; ConfigEntry<float> val3 = val.Bind<float>(new ConfigDefinition("Hypercrit", "CritBase"), 2f, new ConfigDescription("Damage multiplier to use for base crit. Replaces vanilla crit multiplier for purposes of dealing damage. Examples used to describe other configs will use default value (2).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, float.MaxValue), Array.Empty<object>())); critBase = val3.Value; ConfigEntry<float> val4 = val.Bind<float>(new ConfigDefinition("Hypercrit", "CritMult"), 1f, new ConfigDescription("Damage multiplier to use for all crit stacks except the first.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(float.Epsilon, float.MaxValue), Array.Empty<object>())); critMult = val4.Value; ConfigEntry<float> val5 = val.Bind<float>(new ConfigDefinition("Hypercrit", "DecayParam"), 1f, new ConfigDescription("Used in Asymptotic stack mode. Higher numbers directly multiply the number of stacks required to reach the same crit multiplier (at DecayParam 1, 1 stack : 3x and 2 stacks : 3.5x; at DecayParam 3, 3 stacks : 3x and 6 stacks : 3.5x).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(float.Epsilon, float.MaxValue), Array.Empty<object>())); decayParam = val5.Value; ConfigEntry<CritStackingMode> val6 = val.Bind<CritStackingMode>(new ConfigDefinition("Hypercrit", "StackMode"), CritStackingMode.Linear, new ConfigDescription("How total crit multiplier is calculated based on number of stacked crits. Linear (w/ CritMult 1): x2, x3, x4, x5, x6.... Exponential (w/ CritMult 2): x2, x4, x8, x16, x32.... Asymptotic (w/ CritMult 2): x2, x3, x3.5, x3.75, x3.825....", (AcceptableValueBase)null, Array.Empty<object>())); stackMode = val6.Value; ConfigEntry<bool> val7 = val.Bind<bool>(new ConfigDefinition("Flurry", "Enabled"), true, new ConfigDescription("If false, no changes will be made to Huntress' alternate primary variant. If true, additional shots will be fired for each additional crit stack.", (AcceptableValueBase)null, Array.Empty<object>())); multiFlurry = val7.Value; ConfigEntry<int> val8 = val.Bind<int>(new ConfigDefinition("Flurry", "CountBase"), 3, new ConfigDescription("The number of shots of Flurry to fire with 0 crit stacks.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), Array.Empty<object>())); flurryBase = val8.Value; ConfigEntry<int> val9 = val.Bind<int>(new ConfigDefinition("Flurry", "CountAdd"), 3, new ConfigDescription("The number of extra shots of Flurry to fire per crit stack.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), Array.Empty<object>())); flurryAdd = val9.Value; ConfigEntry<bool> val10 = val.Bind<bool>(new ConfigDefinition("Flurry", "CompensateDamage"), true, new ConfigDescription("If true, only the first crit will count towards extra Flurry damage; every additional stack will adjust total damage to account for increased projectile count.", (AcceptableValueBase)null, Array.Empty<object>())); nerfFlurry = val10.Value; ConfigEntry<bool> val11 = val.Bind<bool>(new ConfigDefinition("NumberColors", "Enabled"), true, new ConfigDescription("If true, crit stacks will display with progressively decreasing hue (yellow --> red --> purple...).", (AcceptableValueBase)null, Array.Empty<object>())); loopColors = val11.Value; ConfigEntry<int> val12 = val.Bind<int>(new ConfigDefinition("NumberColors", "ColorLoopRate"), 36, new ConfigDescription("The number of crit stacks required to loop back around to yellow color.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), Array.Empty<object>())); colorLoopRate = val12.Value; HealthComponent.TakeDamage += (Manipulator)delegate(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) ILCursor val17 = new ILCursor(il); int damageInfoIndex = -1; ILLabel val18 = default(ILLabel); int num2 = default(int); if (val17.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref damageInfoIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, Reflection.GetFieldCached(typeof(DamageInfo), "crit")), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val18), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.CharacterBody", "get_critMultiplier") })) { val17.Emit(OpCodes.Ldloc_1); val17.Emit(OpCodes.Ldarg, damageInfoIndex); val17.EmitDelegate<Func<float, CharacterBody, DamageInfo, float>>((Func<float, CharacterBody, DamageInfo, float>)delegate(float origDmgMult, CharacterBody body, DamageInfo damageInfo) { if (!Object.op_Implicit((Object)(object)body)) { return origDmgMult; } AdditionalCritInfo value3 = null; if (!critInfoAttachments.TryGetValue(damageInfo, out value3)) { value3 = RollHypercrit(body, forceSingleCrit: true); critInfoAttachments.Add(damageInfo, value3); } damageInfo.crit = value3.numCrits > 0; return value3.damageMult; }); } else { Debug.LogError((object)"Hypercrit: failed to apply IL patch (HealthComponent.TakeDamage)! Mod will not work."); } }; if (loopColors) { HealthComponent.SendDamageDealt += (Manipulator)delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val16 = new ILCursor(il); val16.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageDealtMessage>(x) }); val16.Emit(OpCodes.Dup); val16.Emit(OpCodes.Ldarg_0); val16.EmitDelegate<Action<DamageDealtMessage, DamageReport>>((Action<DamageDealtMessage, DamageReport>)delegate(DamageDealtMessage msg, DamageReport report) { TryPassHypercrit(report.damageInfo, msg); }); }; DamageDealtMessage.Serialize += (hook_Serialize)delegate(orig_Serialize orig, DamageDealtMessage self, NetworkWriter writer) { orig.Invoke(self, writer); if (!critInfoAttachments.TryGetValue(self, out var value2)) { value2 = new AdditionalCritInfo(); } writer.Write(value2.numCrits); writer.Write(value2.totalCritChance); writer.Write(value2.damageMult); }; DamageDealtMessage.Deserialize += (hook_Deserialize)delegate(orig_Deserialize orig, DamageDealtMessage self, NetworkReader reader) { orig.Invoke(self, reader); AdditionalCritInfo value = new AdditionalCritInfo { numCrits = reader.ReadInt32(), totalCritChance = reader.ReadSingle(), damageMult = reader.ReadSingle() }; critInfoAttachments.Add(self, value); lastNetworkedCritInfo = value; }; DamageNumberManager.SpawnDamageNumber += (Manipulator)delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val15 = new ILCursor(il); val15.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.DamageColor", "FindColor") }); val15.EmitDelegate<Func<Color, Color>>((Func<Color, Color>)delegate(Color origColor) { //IL_0007: 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_001d: Unknown result type (might be due to invalid IL or missing references) if (lastNetworkedCritInfo == null) { return origColor; } AdditionalCritInfo additionalCritInfo2 = lastNetworkedCritInfo; lastNetworkedCritInfo = null; if (additionalCritInfo2.numCrits == 0) { return origColor; } float num = 1f / 6f - ((float)additionalCritInfo2.numCrits - 1f) / (float)colorLoopRate; return Color.HSVToRGB((num % 1f + 1f) % 1f, 1f, 1f); }); }; } if (!multiFlurry) { return; } FireFlurrySeekingArrow.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, FireFlurrySeekingArrow self) { orig.Invoke(self); AdditionalCritInfo additionalCritInfo = RollHypercrit(((EntityState)self).characterBody); if (nerfFlurry && additionalCritInfo.numCrits > 1) { additionalCritInfo.damageMult *= (float)(flurryBase + flurryAdd) / (float)(flurryBase + flurryAdd * additionalCritInfo.numCrits); } critInfoAttachments.Add(self, additionalCritInfo); ((FireSeekingArrow)self).isCrit = additionalCritInfo.numCrits > 0; ((FireSeekingArrow)self).maxArrowCount = flurryBase + additionalCritInfo.numCrits * flurryAdd; ((FireSeekingArrow)self).arrowReloadDuration = ((FireSeekingArrow)self).baseArrowReloadDuration * (3f / (float)((FireSeekingArrow)self).maxArrowCount) / ((BaseState)self).attackSpeedStat; }; FireSeekingArrow.FireOrbArrow += (Manipulator)delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0037: 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) ILCursor val14 = new ILCursor(il); val14.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0) }); val14.Emit(OpCodes.Dup); val14.Emit(OpCodes.Ldarg_0); val14.EmitDelegate<Action<GenericDamageOrb, FireSeekingArrow>>((Action<GenericDamageOrb, FireSeekingArrow>)delegate(GenericDamageOrb orb, FireSeekingArrow self) { TryPassHypercrit(self, orb); }); }; GenericDamageOrb.OnArrival += (Manipulator)delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val13 = new ILCursor(il); val13.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<DamageInfo>(x) }); val13.Emit(OpCodes.Dup); val13.Emit(OpCodes.Ldarg_0); val13.EmitDelegate<Action<DamageInfo, GenericDamageOrb>>((Action<DamageInfo, GenericDamageOrb>)delegate(DamageInfo di, GenericDamageOrb orb) { TryPassHypercrit(orb, di); }); }; } public bool TryGetHypercrit(object target, ref AdditionalCritInfo aci) { return critInfoAttachments.TryGetValue(target, out aci); } private bool TryPassHypercrit(object from, object to) { AdditionalCritInfo value; bool flag = critInfoAttachments.TryGetValue(from, out value); if (flag) { critInfoAttachments.Add(to, value); } return flag; } private bool TryPassHypercrit(object from, object to, out AdditionalCritInfo aci) { bool flag = critInfoAttachments.TryGetValue(from, out aci); if (flag) { critInfoAttachments.Add(to, aci); } return flag; } private AdditionalCritInfo RollHypercrit(CharacterBody body, bool forceSingleCrit = false) { AdditionalCritInfo additionalCritInfo = new AdditionalCritInfo(); if (Object.op_Implicit((Object)(object)body)) { additionalCritInfo.totalCritChance = body.crit; float num = Mathf.Max(body.crit - (forceSingleCrit ? 100f : 0f), 0f); float num2 = num % 100f; additionalCritInfo.numCrits = Mathf.Min(Mathf.FloorToInt(num / 100f) + (Util.CheckRoll(num2, body.master) ? 1 : 0), critCap); if (forceSingleCrit) { additionalCritInfo.numCrits++; } if (additionalCritInfo.numCrits == 0) { additionalCritInfo.damageMult = 1f; } else { switch (stackMode) { case CritStackingMode.Linear: additionalCritInfo.damageMult = critBase + critMult * (float)(additionalCritInfo.numCrits - 1); break; case CritStackingMode.Asymptotic: additionalCritInfo.damageMult = critBase + critMult * (1f - Mathf.Pow(2f, (float)(-(additionalCritInfo.numCrits - 1)) / decayParam)); break; default: additionalCritInfo.damageMult = critBase * Mathf.Pow(critMult, (float)(additionalCritInfo.numCrits - 1)); break; } } } return additionalCritInfo; } }
BepinEx/plugins/ThinkInvis-TILER2/TILER2.dll
Decompiled 11 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HG.Reflection; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using On.RoR2; using On.RoR2.Items; using On.RoR2.Networking; using On.RoR2.UI; using On.RoR2.UI.LogBook; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using RoR2.ConVar; using RoR2.ExpansionManagement; using RoR2.Items; using RoR2.Navigation; using RoR2.Networking; using RoR2.Orbs; using RoR2.Skills; using RoR2.UI; using RoR2.UI.LogBook; using ShareSuite; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("TILER2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TILER2")] [assembly: AssemblyTitle("TILER2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TILER2; public static class Compat_RiskOfOptions { public struct OptionIdentityStrings { public string category; public string name; public string description; public string modName; public string modGuid; } private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetupMod(string modGuid, string modName, string description, Sprite icon = null) { ModSettingsManager.SetModDescription(description, modGuid, modName); if ((Object)(object)icon != (Object)null) { ModSettingsManager.SetModIcon(icon, modGuid, modName); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_CheckBox(ConfigEntry<bool> configEntry, OptionIdentityStrings ident, bool restartRequired, Func<bool> isDisabledDelegate) { //IL_000e: 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_001f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0050: Expected O, but got Unknown //IL_0055: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry, new CheckBoxConfig { category = ident.category, name = ident.name, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_Slider(ConfigEntry<float> configEntry, OptionIdentityStrings ident, float min, float max, string formatString, bool restartRequired, Func<bool> isDisabledDelegate) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(configEntry, new SliderConfig { category = ident.category, name = ident.name, max = max, min = min, formatString = formatString, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_IntSlider(ConfigEntry<int> configEntry, OptionIdentityStrings ident, int min, int max, string formatString, bool restartRequired, Func<bool> isDisabledDelegate) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntSliderOption(configEntry, new IntSliderConfig { category = ident.category, name = ident.name, max = max, min = min, formatString = formatString, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_Choice(ConfigEntryBase configEntry, OptionIdentityStrings ident, bool restartRequired, Func<bool> isDisabledDelegate) { //IL_000e: 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_001f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0050: Expected O, but got Unknown //IL_0055: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new ChoiceOption(configEntry, new ChoiceConfig { category = ident.category, name = ident.name, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_Keybind(ConfigEntry<KeyboardShortcut> configEntry, OptionIdentityStrings ident, bool restartRequired, Func<bool> isDisabledDelegate) { //IL_000e: 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_001f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0050: Expected O, but got Unknown //IL_0055: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new KeyBindOption(configEntry, new KeyBindConfig { category = ident.category, name = ident.name, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_String(ConfigEntry<string> configEntry, OptionIdentityStrings ident, bool restartRequired, Func<bool> isDisabledDelegate) { //IL_000e: 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_001f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0050: Expected O, but got Unknown //IL_0055: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntry, new InputFieldConfig { category = ident.category, name = ident.name, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_StepSlider(ConfigEntry<float> configEntry, OptionIdentityStrings ident, float min, float max, float step, string formatString, bool restartRequired, Func<bool> isDisabledDelegate) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0075: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntry, new StepSliderConfig { category = ident.category, name = ident.name, min = min, max = max, formatString = formatString, increment = step, restartRequired = restartRequired, description = ident.description, checkIfDisabled = (IsDisabledDelegate)(() => isDisabledDelegate()) }), ident.modGuid, ident.modName); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddOption_Button(OptionIdentityStrings ident, string text, UnityAction del) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new GenericButtonOption(ident.name, ident.category, ident.description, text, del), ident.modGuid, ident.modName); } } public static class Compat_ShareSuite { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.funkfrog_sipondo.sharesuite"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void GiveMoney(uint amount) { MoneySharingHooks.AddMoneyExternal((int)amount); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool MoneySharing() { if (ShareSuite.MoneyIsShared.Value) { return true; } return false; } } [RequireComponent(typeof(Inventory))] public class FakeInventory : NetworkBehaviour { internal class FakeInventoryModule : T2Module<FakeInventoryModule> { public override void SetupConfig() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown base.SetupConfig(); NetworkingAPI.RegisterMessageType<MsgSyncAll>(); Inventory.GetItemCount_ItemIndex += new hook_GetItemCount_ItemIndex(On_InvGetItemCountByIndex); LunarItemOrEquipmentCostTypeHelper.IsAffordable += new hook_IsAffordable(LunarItemOrEquipmentCostTypeHelper_IsAffordable); LunarItemOrEquipmentCostTypeHelper.PayCost += new hook_PayCost(LunarItemOrEquipmentCostTypeHelper_PayCost); LunarItemOrEquipmentCostTypeHelper.PayOne += new hook_PayOne(LunarItemOrEquipmentCostTypeHelper_PayOne); Inventory.HasAtLeastXTotalItemsOfTier += new hook_HasAtLeastXTotalItemsOfTier(Inventory_HasAtLeastXTotalItemsOfTier); Inventory.GetTotalItemCountOfTier += new hook_GetTotalItemCountOfTier(Inventory_GetTotalItemCountOfTier); StolenInventoryInfo.StealItem += new hook_StealItem(StolenInventoryInfo_StealItem); RunReport.Generate += new hook_Generate(RunReport_Generate); ScrapperController.BeginScrapping += new hook_BeginScrapping(ScrapperController_BeginScrapping); ShrineCleanseBehavior.CleanseInventoryServer += new hook_CleanseInventoryServer(ShrineCleanseBehavior_CleanseInventoryServer); ShrineCleanseBehavior.InventoryIsCleansable += new hook_InventoryIsCleansable(ShrineCleanseBehavior_InventoryIsCleansable); Util.GetItemCountForTeam += new hook_GetItemCountForTeam(Util_GetItemCountForTeam); PickupPickerController.SetOptionsFromInteractor += new Manipulator(PickupPickerController_SetOptionsFromInteractor); ContagiousItemManager.StepInventoryInfection += new hook_StepInventoryInfection(ContagiousItemManager_StepInventoryInfection); ContagiousItemManager.OnInventoryChangedGlobal += new hook_OnInventoryChangedGlobal(ContagiousItemManager_OnInventoryChangedGlobal); SuppressedItemManager.OnInventoryChangedGlobal += new hook_OnInventoryChangedGlobal(SuppressedItemManager_OnInventoryChangedGlobal); SuppressedItemManager.SuppressItem += new hook_SuppressItem(SuppressedItemManager_SuppressItem); SuppressedItemManager.TransformItem += new hook_TransformItem(SuppressedItemManager_TransformItem); CharacterMaster.TryCloverVoidUpgrades += new hook_TryCloverVoidUpgrades(CharacterMaster_TryCloverVoidUpgrades); ArtifactTrialMissionController.RemoveAllMissionKeys += new hook_RemoveAllMissionKeys(ArtifactTrialMissionController_RemoveAllMissionKeys); StolenInventoryInfo.TakeItemFromLendee += new hook_TakeItemFromLendee(StolenInventoryInfo_TakeItemFromLendee); StolenInventoryInfo.TakeBackItemsFromLendee += new hook_TakeBackItemsFromLendee(StolenInventoryInfo_TakeBackItemsFromLendee); LunarSunBehavior.FixedUpdate += new hook_FixedUpdate(LunarSunBehavior_FixedUpdate); Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate); ItemInventoryDisplay.UpdateDisplay += new hook_UpdateDisplay(On_IIDUpdateDisplay); ItemInventoryDisplay.OnInventoryChanged += new hook_OnInventoryChanged(On_IIDInventoryChanged); HookEndpointManager.Modify((MethodBase)typeof(CostTypeCatalog).GetNestedType("<>c", BindingFlags.NonPublic).GetMethod("<Init>g__PayCostItems|5_1", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<ILContext>(gPayCostItemsHook)); } } protected struct MsgSyncAll : INetMessage, ISerializableObject { private NetworkInstanceId _ownerNetId; private int[] _itemsToSync; public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(_ownerNetId); NetworkExtensions.WriteItemStacks(writer, _itemsToSync); } public void Deserialize(NetworkReader reader) { //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) _ownerNetId = reader.ReadNetworkId(); _itemsToSync = new int[ItemCatalog.itemCount]; NetworkExtensions.ReadItemStacks(reader, _itemsToSync); } public void OnReceived() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(_ownerNetId); if (!Object.op_Implicit((Object)(object)val)) { TILER2Plugin._logger.LogWarning((object)$"FakeInventory.MsgSyncAll received for missing NetworkObject with ID {_ownerNetId}"); return; } FakeInventory fakeInventory = val.GetComponent<FakeInventory>(); if (!Object.op_Implicit((Object)(object)fakeInventory)) { fakeInventory = val.AddComponent<FakeInventory>(); } fakeInventory._itemStacks = _itemsToSync; Inventory component = ((Component)fakeInventory).GetComponent<Inventory>(); if (NetworkServer.active) { ((NetworkBehaviour)component).SetDirtyBit(1u); ((NetworkBehaviour)component).SetDirtyBit(8u); } Delegate[] invocationList = ((MulticastDelegate)Reflection.GetFieldCached(typeof(Inventory), "onInventoryChanged").GetValue(component)).GetInvocationList(); foreach (Delegate @delegate in invocationList) { @delegate.Method.Invoke(@delegate.Target, null); } } public MsgSyncAll(NetworkInstanceId ownerNetId, int[] itemsToSync) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _ownerNetId = ownerNetId; _itemsToSync = itemsToSync; } } private int[] _itemStacks = ItemCatalog.RequestItemStackArray(); public readonly ReadOnlyCollection<int> itemStacks; public static HashSet<ItemDef> blacklist = new HashSet<ItemDef>(); private bool itemsDirty; public static int ignoreFakes = 0; public FakeInventory() { itemStacks = new ReadOnlyCollection<int>(_itemStacks); } private void OnDestroy() { ItemCatalog.ReturnItemStackArray(_itemStacks); } private void DeltaItem(ItemIndex ind, int count) { //IL_0005: 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_0020: Unknown result type (might be due to invalid IL or missing references) if (!blacklist.Contains(ItemCatalog.GetItemDef(ind))) { _itemStacks[ind] = Mathf.Max(_itemStacks[ind] + count, 0); itemsDirty = true; } } public void GiveItem(ItemIndex ind, int count = 1) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } if (count <= 0) { if (count < 0) { RemoveItem(ind, -count); } } else { DeltaItem(ind, count); } } public void RemoveItem(ItemIndex ind, int count = 1) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } if (count <= 0) { if (count < 0) { GiveItem(ind, -count); } } else { DeltaItem(ind, -count); } } public int GetItemCount(ItemIndex ind) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown return ArrayUtils.GetSafe<int>(_itemStacks, (int)ind); } public int GetRealItemCount(ItemIndex ind) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected I4, but got Unknown return ArrayUtils.GetSafe<int>(((Component)this).GetComponent<Inventory>().itemStacks, (int)ind); } public int GetAdjustedItemCount(ItemIndex ind) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0089: Unknown result type (might be due to invalid IL or missing references) ItemIndex transformedItemIndex = ContagiousItemManager.GetTransformedItemIndex(ind); IEnumerable<TransformationInfo> source = ((IEnumerable<TransformationInfo>)(object)ContagiousItemManager.transformationInfos).Where((TransformationInfo x) => x.transformedItem == ind); bool num = (int)transformedItemIndex != -1; bool flag = source.Count() > 0; int realItemCount = GetRealItemCount(ind); if (num && GetRealItemCount(transformedItemIndex) > 0) { return realItemCount; } if (flag && realItemCount > 0) { return realItemCount + source.Sum((TransformationInfo x) => GetItemCount(x.originalItem)) + GetItemCount(ind); } return realItemCount + GetItemCount(ind); } private void Awake() { //IL_000d: 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_001d: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { NetworkInstanceId netId = ((Component)this).GetComponent<NetworkIdentity>().netId; if (((NetworkInstanceId)(ref netId)).Value != 0) { NetMessageExtensions.Send((INetMessage)(object)new MsgSyncAll(netId, _itemStacks), (NetworkDestination)1); } } } private void Update() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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 (itemsDirty && NetworkServer.active) { NetworkInstanceId netId = ((Component)this).GetComponent<NetworkIdentity>().netId; if (((NetworkInstanceId)(ref netId)).Value != 0) { NetMessageExtensions.Send((INetMessage)(object)new MsgSyncAll(netId, _itemStacks), (NetworkDestination)1); itemsDirty = false; } } } private static void Run_FixedUpdate(orig_FixedUpdate orig, Run self) { orig.Invoke(self); if (ignoreFakes != 0) { TILER2Plugin._logger.LogError((object)$"FakeInventory ignoreFakes count = {ignoreFakes} on new frame (!= 0, very bad!), clearing"); ignoreFakes = 0; } } private static void StolenInventoryInfo_TakeBackItemsFromLendee(orig_TakeBackItemsFromLendee orig, object self) { ignoreFakes++; orig.Invoke(self); ignoreFakes--; } private static void LunarSunBehavior_FixedUpdate(orig_FixedUpdate orig, LunarSunBehavior self) { ignoreFakes++; orig.Invoke(self); ignoreFakes--; } private static int StolenInventoryInfo_TakeItemFromLendee(orig_TakeItemFromLendee orig, object self, ItemIndex itemIndex, int maxStackToTake) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; int result = orig.Invoke(self, itemIndex, maxStackToTake); ignoreFakes--; return result; } private static void ArtifactTrialMissionController_RemoveAllMissionKeys(orig_RemoveAllMissionKeys orig) { ignoreFakes++; orig.Invoke(); ignoreFakes--; } private static void PickupPickerController_SetOptionsFromInteractor(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locIndex = -1; val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locIndex), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemDef>(x, "canRemove") }); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc_S, (byte)locIndex); val.EmitDelegate<Func<bool, Interactor, ItemDef, bool>>((Func<bool, Interactor, ItemDef, bool>)delegate(bool origDoContinue, Interactor iac, ItemDef def) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) bool result = origDoContinue; ignoreFakes++; if (((Component)iac).GetComponent<CharacterBody>().inventory.GetItemCount(def.itemIndex) <= 0) { result = false; } ignoreFakes--; return result; }); } private static void gPayCostItemsHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Inventory>(x, "GetItemCount") }); val.EmitDelegate<Action>((Action)delegate { ignoreFakes++; }); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Inventory>(x, "GetItemCount") }); val.EmitDelegate<Action>((Action)delegate { ignoreFakes--; }); } private static int Util_GetItemCountForTeam(orig_GetItemCountForTeam orig, TeamIndex teamIndex, ItemIndex itemIndex, bool requiresAlive, bool requiresConnected) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; int result = orig.Invoke(teamIndex, itemIndex, requiresAlive, requiresConnected); ignoreFakes--; return result; } private static bool ShrineCleanseBehavior_InventoryIsCleansable(orig_InventoryIsCleansable orig, Inventory inventory) { ignoreFakes++; bool result = orig.Invoke(inventory); ignoreFakes--; return result; } private static int ShrineCleanseBehavior_CleanseInventoryServer(orig_CleanseInventoryServer orig, Inventory inventory) { ignoreFakes++; int result = orig.Invoke(inventory); ignoreFakes--; return result; } private static void ScrapperController_BeginScrapping(orig_BeginScrapping orig, ScrapperController self, int intPickupIndex) { ignoreFakes++; orig.Invoke(self, intPickupIndex); ignoreFakes--; } private static RunReport RunReport_Generate(orig_Generate orig, Run run, GameEndingDef gameEnding) { ignoreFakes++; RunReport result = orig.Invoke(run, gameEnding); ignoreFakes--; return result; } private static int StolenInventoryInfo_StealItem(orig_StealItem orig, object self, ItemIndex itemIndex, int maxStackToSteal, bool? useOrbOverride) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; int result = orig.Invoke(self, itemIndex, maxStackToSteal, useOrbOverride); ignoreFakes--; return result; } private static int Inventory_GetTotalItemCountOfTier(orig_GetTotalItemCountOfTier orig, Inventory self, ItemTier itemTier) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; int result = orig.Invoke(self, itemTier); ignoreFakes--; return result; } private static bool Inventory_HasAtLeastXTotalItemsOfTier(orig_HasAtLeastXTotalItemsOfTier orig, Inventory self, ItemTier itemTier, int x) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; bool result = orig.Invoke(self, itemTier, x); ignoreFakes--; return result; } private static void LunarItemOrEquipmentCostTypeHelper_PayOne(orig_PayOne orig, Inventory inventory) { ignoreFakes++; orig.Invoke(inventory); ignoreFakes--; } private static void LunarItemOrEquipmentCostTypeHelper_PayCost(orig_PayCost orig, CostTypeDef costTypeDef, PayCostContext context) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; orig.Invoke(costTypeDef, context); ignoreFakes--; } private static bool LunarItemOrEquipmentCostTypeHelper_IsAffordable(orig_IsAffordable orig, CostTypeDef costTypeDef, IsAffordableContext context) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; bool result = orig.Invoke(costTypeDef, context); ignoreFakes--; return result; } private static bool ContagiousItemManager_StepInventoryInfection(orig_StepInventoryInfection orig, Inventory inventory, ItemIndex originalItem, int limit, bool isForced) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; bool result = orig.Invoke(inventory, originalItem, limit, isForced); ignoreFakes--; return result; } private static void ContagiousItemManager_OnInventoryChangedGlobal(orig_OnInventoryChangedGlobal orig, Inventory inventory) { ignoreFakes++; orig.Invoke(inventory); ignoreFakes--; } private static void SuppressedItemManager_OnInventoryChangedGlobal(orig_OnInventoryChangedGlobal orig, Inventory inventory) { ignoreFakes++; orig.Invoke(inventory); ignoreFakes--; } private static bool SuppressedItemManager_SuppressItem(orig_SuppressItem orig, ItemIndex suppressedIndex, ItemIndex transformedIndex) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ignoreFakes++; bool result = orig.Invoke(suppressedIndex, transformedIndex); ignoreFakes--; return result; } private static void SuppressedItemManager_TransformItem(orig_TransformItem orig, Inventory inventory, ItemIndex suppressedIndex, ItemIndex transformedIndex) { //IL_000e: 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) ignoreFakes++; orig.Invoke(inventory, suppressedIndex, transformedIndex); ignoreFakes--; } private static void CharacterMaster_TryCloverVoidUpgrades(orig_TryCloverVoidUpgrades orig, CharacterMaster self) { ignoreFakes++; orig.Invoke(self); ignoreFakes--; } private static int On_InvGetItemCountByIndex(orig_GetItemCount_ItemIndex orig, Inventory self, ItemIndex itemIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) int result = orig.Invoke(self, itemIndex); if (ignoreFakes > 0 || !Object.op_Implicit((Object)(object)self)) { return result; } FakeInventory component = ((Component)self).gameObject.GetComponent<FakeInventory>(); if (!Object.op_Implicit((Object)(object)component)) { return result; } return component.GetAdjustedItemCount(itemIndex); } private static void On_IIDInventoryChanged(orig_OnInventoryChanged orig, ItemInventoryDisplay self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !((Behaviour)self).isActiveAndEnabled || !Object.op_Implicit((Object)(object)self.inventory)) { return; } FakeInventory component = ((Component)self.inventory).GetComponent<FakeInventory>(); if (!Object.op_Implicit((Object)(object)component)) { return; } List<ItemIndex> list = self.itemOrder.Take(self.itemOrderCount).ToList(); for (int i = 0; i < self.itemStacks.Length; i++) { int adjustedItemCount = component.GetAdjustedItemCount((ItemIndex)i); if (self.itemStacks[i] == 0) { if (adjustedItemCount > 0) { list.Add((ItemIndex)i); } else { list.Remove((ItemIndex)i); } } self.itemStacks[i] = adjustedItemCount; } list = list.Distinct().ToList(); list.CopyTo(0, self.itemOrder, 0, Mathf.Min(self.itemOrder.Length, list.Count)); self.itemOrderCount = list.Count; } private static void On_IIDUpdateDisplay(orig_UpdateDisplay orig, ItemInventoryDisplay self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); Inventory inventory = self.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } FakeInventory component = ((Component)inventory).gameObject.GetComponent<FakeInventory>(); if (!Object.op_Implicit((Object)(object)component)) { return; } foreach (ItemIcon itemIcon in self.itemIcons) { int realItemCount = component.GetRealItemCount(itemIcon.itemIndex); int num = component.GetAdjustedItemCount(itemIcon.itemIndex) - realItemCount; if (num != 0) { ((Behaviour)itemIcon.stackText).enabled = true; ((TMP_Text)itemIcon.stackText).text = $"x{realItemCount}\n<color=#C18FE0>+{num}</color>"; } } } } [RequireComponent(typeof(NetworkIdentity))] public class ItemWard : NetworkBehaviour { public enum DisplayPerformanceMode { None, OnePerItemIndex, All } internal class ItemWardModule : T2Module<ItemWardModule> { [AutoConfigRoOChoice(null, null)] [AutoConfig("Controls how many item displays are created on ItemWards.", AutoConfigFlags.DeferUntilEndGame, new object[] { })] public DisplayPerformanceMode displayPerformanceMode { get; private set; } = DisplayPerformanceMode.All; public override void SetupConfig() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) base.SetupConfig(); NetworkingAPI.RegisterMessageType<MsgDeltaDisplay>(); NetworkingAPI.RegisterMessageType<MsgSyncRadius>(); GameObject obj = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/orbeffects/ItemTransferOrbEffect")); ((Behaviour)obj.GetComponent<EffectComponent>()).enabled = false; ((Behaviour)obj.GetComponent<OrbEffect>()).enabled = false; ((Behaviour)obj.GetComponent<ItemTakenOrbEffect>()).enabled = false; displayPrefab = PrefabAPI.InstantiateClone(obj, "ItemWardDisplay", false); GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard"), "TILER2TempSetupPrefab", false); GameObject gameObject = ((Component)val.transform.Find("Indicator")).gameObject; gameObject.transform.SetParent((Transform)null); MeshRenderer component = ((Component)gameObject.transform.Find("IndicatorSphere")).gameObject.GetComponent<MeshRenderer>(); ((Renderer)component).material.SetTexture("_RemapTex", (Texture)(object)Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/ColorRamps/texRampDefault.png").WaitForCompletion()); ((Renderer)component).material.SetColor("_CutoffScroll", new Color(0.8f, 0.8f, 0.85f)); ((Renderer)component).material.SetColor("_RimColor", new Color(0.8f, 0.8f, 0.85f)); stockIndicatorPrefab = PrefabAPI.InstantiateClone(gameObject, "ItemWardStockIndicator", false); Object.Destroy((Object)(object)val); Object.Destroy((Object)(object)gameObject); } } protected struct MsgSyncRadius : INetMessage, ISerializableObject { private ItemWard _targetWard; private float _newRadius; public void Serialize(NetworkWriter writer) { writer.Write(((Component)_targetWard).gameObject); writer.Write(_newRadius); } public void Deserialize(NetworkReader reader) { _targetWard = reader.ReadGameObject().GetComponent<ItemWard>(); _newRadius = reader.ReadSingle(); } public void OnReceived() { _targetWard._radius = _newRadius; _targetWard.radSq = _newRadius * _newRadius; } public MsgSyncRadius(ItemWard targetWard, float newRadius) { _targetWard = targetWard; _newRadius = newRadius; } } protected struct MsgDeltaDisplay : INetMessage, ISerializableObject { private NetworkInstanceId _ownerNetId; private ItemIndex _itemIndex; private bool _isAdd; public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown writer.Write(_ownerNetId); writer.Write((int)_itemIndex); writer.Write(_isAdd); } public void Deserialize(NetworkReader reader) { //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_0013: Unknown result type (might be due to invalid IL or missing references) _ownerNetId = reader.ReadNetworkId(); _itemIndex = (ItemIndex)reader.ReadInt32(); _isAdd = reader.ReadBoolean(); } public void OnReceived() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) ItemWard component = Util.FindNetworkObject(_ownerNetId).GetComponent<ItemWard>(); if (_isAdd) { component.ClientAddItemDisplay(_itemIndex); } else { component.ClientRemoveItemDisplay(_itemIndex); } } public MsgDeltaDisplay(NetworkInstanceId ownerNetId, ItemIndex itemIndex, bool isAdd) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _ownerNetId = ownerNetId; _itemIndex = itemIndex; _isAdd = isAdd; } } public static GameObject stockIndicatorPrefab; public static GameObject displayPrefab; public float displayRadiusFracH = 0.5f; public float displayRadiusFracV = 0.3f; public Vector3 displayIndivScale = Vector3.one; public Vector3 displayRadiusOffset = new Vector3(0f, 0f, 0f); public Transform rangeIndicator; public Dictionary<ItemIndex, int> itemcounts = new Dictionary<ItemIndex, int>(); private const float updateTickRate = 1f; private float stopwatch; private TeamFilter teamFilter; private TeamComponent teamComponent; private float rangeIndicatorScaleVelocity; private readonly List<GameObject> displays = new List<GameObject>(); private readonly List<Vector3> displayVelocities = new List<Vector3>(); private readonly List<ItemIndex> displayItems = new List<ItemIndex>(); private readonly List<Inventory> trackedInventories = new List<Inventory>(); private float _radius = 10f; public float radius { get { return _radius; } set { _radius = value; radSq = _radius * _radius; if (NetworkServer.active) { NetMessageExtensions.Send((INetMessage)(object)new MsgSyncRadius(this, value), (NetworkDestination)1); } } } public float radSq { get; private set; } = 100f; public TeamIndex currentTeam { get { //IL_002e: 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) if (!Object.op_Implicit((Object)(object)teamFilter)) { if (!Object.op_Implicit((Object)(object)teamComponent)) { return (TeamIndex)(-1); } return teamComponent.teamIndex; } return teamFilter.teamIndex; } } private void Awake() { teamFilter = ((Component)this).GetComponent<TeamFilter>(); teamComponent = ((Component)this).GetComponent<TeamComponent>(); } private void OnDestroy() { if (!NetworkServer.active) { return; } foreach (GameObject display in displays) { Object.Destroy((Object)(object)display); } } private void OnEnable() { if (Object.op_Implicit((Object)(object)rangeIndicator)) { ((Component)rangeIndicator).gameObject.SetActive(true); } foreach (GameObject display in displays) { display.SetActive(true); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)rangeIndicator)) { ((Component)rangeIndicator).gameObject.SetActive(false); } foreach (GameObject display in displays) { display.SetActive(false); } trackedInventories.RemoveAll((Inventory x) => !Object.op_Implicit((Object)(object)x) || !Object.op_Implicit((Object)(object)((Component)x).gameObject)); for (int num = trackedInventories.Count - 1; num >= 0; num--) { DeregInv(trackedInventories[num]); } } private void Update() { //IL_001b: 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_00cf: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (NetworkClient.active) { if (Object.op_Implicit((Object)(object)rangeIndicator)) { float num = Mathf.SmoothDamp(rangeIndicator.localScale.x, radius, ref rangeIndicatorScaleVelocity, 0.2f); rangeIndicator.localScale = new Vector3(num, num, num); } float num2 = -0.125f * (MathF.PI * 2f * Time.time); float num3 = MathF.PI * 2f / (float)displays.Count; float num4 = radius * displayRadiusFracH; float num5 = Mathf.Max(radius * displayRadiusFracV, 1f); for (int num6 = displays.Count - 1; num6 >= 0; num6--) { Vector3 val = new Vector3(Mathf.Cos(num3 * (float)num6 + num2) * num4, num5, Mathf.Sin(num3 * (float)num6 + num2) * num4) + displayRadiusOffset; Vector3 value = displayVelocities[num6]; displays[num6].transform.localPosition = Vector3.SmoothDamp(displays[num6].transform.localPosition, val, ref value, 1f); displays[num6].transform.localScale = displayIndivScale; displayVelocities[num6] = value; } } } private void FixedUpdate() { //IL_006c: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) stopwatch += Time.fixedDeltaTime; if (!(stopwatch > 1f)) { return; } stopwatch = 0f; trackedInventories.RemoveAll((Inventory x) => !Object.op_Implicit((Object)(object)x) || !Object.op_Implicit((Object)(object)((Component)x).gameObject)); CharacterBody[] array = Object.FindObjectsOfType<CharacterBody>(); foreach (CharacterBody val in array) { if (val.teamComponent.teamIndex == currentTeam) { Vector3 val2 = val.transform.position - ((Component)this).transform.position; if (((Vector3)(ref val2)).sqrMagnitude <= radSq) { RegObject(((Component)val).gameObject); } else { DeregObject(((Component)val).gameObject); } } } } private void RegObject(GameObject go) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = go.GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return; } Inventory inventory = component.inventory; if (!Object.op_Implicit((Object)(object)inventory) || trackedInventories.Contains(inventory)) { return; } trackedInventories.Add(inventory); FakeInventory fakeInventory = ((Component)inventory).gameObject.GetComponent<FakeInventory>(); if (!Object.op_Implicit((Object)(object)fakeInventory)) { fakeInventory = ((Component)inventory).gameObject.AddComponent<FakeInventory>(); } foreach (KeyValuePair<ItemIndex, int> itemcount in itemcounts) { fakeInventory.GiveItem(itemcount.Key, itemcount.Value); } } private void DeregObject(GameObject go) { CharacterBody component = go.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { Inventory inventory = component.inventory; if (Object.op_Implicit((Object)(object)inventory)) { DeregInv(inventory); } } } private void DeregInv(Inventory inv) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!trackedInventories.Contains(inv)) { return; } FakeInventory component = ((Component)inv).gameObject.GetComponent<FakeInventory>(); foreach (KeyValuePair<ItemIndex, int> itemcount in itemcounts) { component.RemoveItem(itemcount.Key, itemcount.Value); } trackedInventories.Remove(inv); } public void ServerAddItem(ItemIndex ind) { //IL_000e: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } if (!itemcounts.ContainsKey(ind)) { itemcounts[ind] = 1; } else { itemcounts[ind]++; } trackedInventories.RemoveAll((Inventory x) => !Object.op_Implicit((Object)(object)x)); foreach (Inventory trackedInventory in trackedInventories) { ((Component)trackedInventory).gameObject.GetComponent<FakeInventory>().GiveItem(ind); } NetMessageExtensions.Send((INetMessage)(object)new MsgDeltaDisplay(((Component)this).GetComponent<NetworkIdentity>().netId, ind, isAdd: true), (NetworkDestination)1); } public void ServerRemoveItem(ItemIndex ind) { //IL_000e: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !itemcounts.ContainsKey(ind)) { return; } itemcounts[ind]--; if (itemcounts[ind] == 0) { itemcounts.Remove(ind); } NetMessageExtensions.Send((INetMessage)(object)new MsgDeltaDisplay(((Component)this).GetComponent<NetworkIdentity>().netId, ind, isAdd: false), (NetworkDestination)1); trackedInventories.RemoveAll((Inventory x) => !Object.op_Implicit((Object)(object)x) || !Object.op_Implicit((Object)(object)((Component)x).gameObject)); foreach (Inventory trackedInventory in trackedInventories) { ((Component)trackedInventory).gameObject.GetComponent<FakeInventory>().RemoveItem(ind); } } internal void ClientAddItemDisplay(ItemIndex ind) { //IL_000d: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { if (!itemcounts.ContainsKey(ind)) { itemcounts[ind] = 1; } else { itemcounts[ind]++; } } if (T2Module<ItemWardModule>.instance.displayPerformanceMode != 0 && (T2Module<ItemWardModule>.instance.displayPerformanceMode != DisplayPerformanceMode.OnePerItemIndex || !displayItems.Contains(ind))) { GameObject val = Object.Instantiate<GameObject>(displayPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); ((Component)val.transform.Find("BillboardBase").Find("PickupSprite")).GetComponent<SpriteRenderer>().sprite = ItemCatalog.GetItemDef(ind).pickupIconSprite; val.transform.parent = ((Component)this).transform; displays.Add(val); displayItems.Add(ind); displayVelocities.Add(new Vector3(0f, 0f, 0f)); } } internal void ClientRemoveItemDisplay(ItemIndex ind) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006a: 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) if (!NetworkServer.active) { if (!itemcounts.ContainsKey(ind)) { return; } itemcounts[ind]--; if (itemcounts[ind] == 0) { itemcounts.Remove(ind); } } if (T2Module<ItemWardModule>.instance.displayPerformanceMode != 0 && (T2Module<ItemWardModule>.instance.displayPerformanceMode != DisplayPerformanceMode.OnePerItemIndex || itemcounts[ind] == 0)) { int index = displayItems.IndexOf(ind); Object.Destroy((Object)(object)displays[index]); displays.RemoveAt(index); displayItems.RemoveAt(index); displayVelocities.RemoveAt(index); } } } public class AutoConfigBinding { public enum DeferType { UpdateImmediately, WaitForNextStage, WaitForRunEnd, NeverAutoUpdate } internal static readonly List<AutoConfigBinding> instances = new List<AutoConfigBinding>(); internal static readonly Dictionary<AutoConfigBinding, (object, bool)> stageDirtyInstances = new Dictionary<AutoConfigBinding, (object, bool)>(); internal static readonly Dictionary<AutoConfigBinding, object> runDirtyInstances = new Dictionary<AutoConfigBinding, object>(); internal bool isOverridden; public AutoConfigContainer owner { get; internal set; } public object target { get; internal set; } public ConfigEntryBase configEntry { get; internal set; } public PropertyInfo boundProperty { get; internal set; } public string modName { get; internal set; } public AutoConfigUpdateActionsAttribute updateEventAttribute { get; internal set; } public MethodInfo propGetter { get; internal set; } public MethodInfo propSetter { get; internal set; } public Type propType { get; internal set; } public object boundKey { get; internal set; } public bool onDict { get; internal set; } public bool allowConCmd { get; internal set; } public bool allowNetMismatch { get; internal set; } public bool netMismatchCritical { get; internal set; } public object cachedValue { get; internal set; } public DeferType deferType { get; internal set; } public string readablePath => modName + "/" + configEntry.Definition.Section + "/" + configEntry.Definition.Key; internal static void CleanupDirty(bool isRunEnd) { TILER2Plugin._logger.LogDebug((object)$"Stage ended; applying {stageDirtyInstances.Count} deferred config changes..."); foreach (AutoConfigBinding key in stageDirtyInstances.Keys) { key.DeferredUpdateProperty(stageDirtyInstances[key].Item1, stageDirtyInstances[key].Item2); } stageDirtyInstances.Clear(); if (!isRunEnd) { return; } TILER2Plugin._logger.LogDebug((object)$"Run ended; applying {runDirtyInstances.Count} deferred config changes..."); foreach (AutoConfigBinding key2 in runDirtyInstances.Keys) { key2.DeferredUpdateProperty(runDirtyInstances[key2], silent: true); } runDirtyInstances.Clear(); } internal AutoConfigBinding() { instances.Add(this); } ~AutoConfigBinding() { if (instances.Contains(this)) { instances.Remove(this); } } internal void OverrideProperty(object newValue, bool silent = false) { if (!isOverridden) { runDirtyInstances[this] = cachedValue; } isOverridden = true; UpdateProperty(newValue, silent); } private void DeferredUpdateProperty(object newValue, bool silent = false) { object oldValue = propGetter.Invoke(target, (!onDict) ? new object[0] : new object[1] { boundKey }); propSetter.Invoke(target, (!onDict) ? new object[1] { newValue } : new object[2] { boundKey, newValue }); AutoConfigUpdateActionTypes autoConfigUpdateActionTypes = updateEventAttribute?.flags ?? AutoConfigUpdateActionTypes.None; AutoConfigUpdateActionsAttribute autoConfigUpdateActionsAttribute = updateEventAttribute; if (autoConfigUpdateActionsAttribute != null && !autoConfigUpdateActionsAttribute.ignoreDefault) { autoConfigUpdateActionTypes |= owner.defaultEnabledUpdateFlags; } cachedValue = newValue; owner.OnConfigChanged(new AutoConfigUpdateActionEventArgs { flags = autoConfigUpdateActionTypes, oldValue = oldValue, newValue = newValue, target = this, silent = silent }); } internal void UpdateProperty(object newValue, bool silent = false) { if (NetworkServer.active && !allowNetMismatch) { NetConfigModule.ServerSyncOneToAll(this, newValue); } if (deferType == DeferType.UpdateImmediately || (Object)(object)Run.instance == (Object)null || !((Behaviour)Run.instance).enabled) { DeferredUpdateProperty(newValue, silent); } else if (deferType == DeferType.WaitForNextStage) { stageDirtyInstances[this] = (newValue, silent); } else if (deferType == DeferType.WaitForRunEnd) { runDirtyInstances[this] = newValue; } else { TILER2Plugin._logger.LogWarning((object)("Something attempted to set the value of an AutoConfigBinding with the DeferForever flag: \"" + readablePath + "\"")); } } public static (List<AutoConfigBinding> results, string errorMsg) FindFromPath(string path1, string path2, string path3) { string p1u = path1.ToUpper(); string p2u = path2?.ToUpper(); string p3u = path3?.ToUpper(); List<AutoConfigBinding> matchesLevel1 = new List<AutoConfigBinding>(); List<AutoConfigBinding> matchesLevel2 = new List<AutoConfigBinding>(); List<AutoConfigBinding> matchesLevel3 = new List<AutoConfigBinding>(); List<AutoConfigBinding> matchesLevel4 = new List<AutoConfigBinding>(); instances.ForEach(delegate(AutoConfigBinding x) { if (x.allowConCmd) { string key = x.configEntry.Definition.Key; string text = key.ToUpper(); string section = x.configEntry.Definition.Section; string text2 = section.ToUpper(); string text3 = x.modName; string text4 = text3.ToUpper(); if (path2 == null) { if (text.Contains(p1u) || text2.Contains(p1u) || text4.Contains(p1u)) { matchesLevel1.Add(x); matchesLevel2.Add(x); if (text == p1u) { matchesLevel3.Add(x); if (key == path1) { matchesLevel4.Add(x); } } } } else if (path3 == null) { bool flag = text4.Contains(p1u); bool flag2 = text2.Contains(p1u); bool flag3 = text2.Contains(p2u); bool flag4 = text.Contains(p2u); if ((flag && flag3) || (flag2 && flag4) || (flag && flag4)) { matchesLevel1.Add(x); if (!(flag && flag4)) { matchesLevel2.Add(x); bool num = text3.Contains(path1); bool flag5 = section.Contains(path1); bool flag6 = section.Contains(path2); bool flag7 = key.Contains(path2); if ((num && flag6) || (flag5 && flag7)) { matchesLevel3.Add(x); bool num2 = text3 == path1; bool flag8 = section == path1; bool flag9 = section == path2; bool flag10 = key == path2; if ((num2 && flag9) || (flag8 && flag10)) { matchesLevel4.Add(x); } } } } } else if (text.Contains(p3u) && text2.Contains(p2u) && text4.Contains(p1u)) { matchesLevel1.Add(x); matchesLevel2.Add(x); if (text4 == p3u && text2 == p2u && text == p1u) { matchesLevel3.Add(x); if (text3 == path3 && section == path2 && key == path1) { matchesLevel4.Add(x); } } } } }); if (matchesLevel1.Count == 0) { return (null, "no level 1 matches"); } if (matchesLevel1.Count == 1) { return (matchesLevel1, null); } if (matchesLevel2.Count == 0) { return (matchesLevel1, "multiple level 1 matches, no level 2 matches"); } if (matchesLevel2.Count == 1) { return (matchesLevel2, null); } if (matchesLevel3.Count == 0) { return (matchesLevel2, "multiple level 2 matches, no level 3 matches"); } if (matchesLevel3.Count == 1) { return (matchesLevel3, null); } if (matchesLevel4.Count == 0) { return (matchesLevel3, "multiple level 3 matches, no level 4 matches"); } if (matchesLevel4.Count == 1) { return (matchesLevel4, null); } Debug.LogError((object)("TILER2 AutoConfig: There are multiple config entries with the path \"" + matchesLevel4[0].readablePath + "\"; this should never happen! Please report this as a bug.")); return (matchesLevel4, "multiple level 4 matches"); } } public class AutoConfigContainer { public struct BindSubDictInfo { public object key; public object val; public Type keyType; public int index; } protected internal readonly List<AutoConfigBinding> bindings = new List<AutoConfigBinding>(); private static readonly Dictionary<ConfigFile, DateTime> observedFiles = new Dictionary<ConfigFile, DateTime>(); private const float filePollingRate = 10f; private static float filePollingStopwatch = 0f; protected internal virtual AutoConfigUpdateActionTypes defaultEnabledUpdateFlags => AutoConfigUpdateActionTypes.None; public event EventHandler<AutoConfigUpdateActionEventArgs> ConfigEntryChanged; public AutoConfigBinding FindConfig(string propName) { return bindings.Find((AutoConfigBinding x) => x.boundProperty.Name == propName && !x.onDict); } public AutoConfigBinding FindConfig(string propName, object dictKey) { return bindings.Find((AutoConfigBinding x) => x.boundProperty.Name == propName && x.onDict && x.boundKey == dictKey); } internal void OnConfigChanged(AutoConfigUpdateActionEventArgs e) { this.ConfigEntryChanged?.Invoke(this, e); Debug.Log((object)$"{e.target.readablePath}: {e.oldValue} > {e.newValue}"); if ((Object)(object)Run.instance != (Object)null && ((Behaviour)Run.instance).isActiveAndEnabled) { if ((e.flags & AutoConfigUpdateActionTypes.InvalidateStats) == AutoConfigUpdateActionTypes.InvalidateStats) { AutoConfigModule.globalStatsDirty = true; } if ((e.flags & AutoConfigUpdateActionTypes.InvalidateDropTable) == AutoConfigUpdateActionTypes.InvalidateDropTable) { AutoConfigModule.globalDropsDirty = true; } if (!e.silent && (e.flags & AutoConfigUpdateActionTypes.AnnounceToRun) == AutoConfigUpdateActionTypes.AnnounceToRun && NetworkServer.active) { NetUtil.ServerSendGlobalChatMsg(Language.GetStringFormatted("TILER2_AUTOCONFIG_ANNOUNCE_CHANGE", new object[3] { e.target.readablePath, e.oldValue, e.newValue })); } } } internal static void FilePollUpdateHook(orig_Update orig, RoR2Application self) { orig.Invoke(self); filePollingStopwatch += Time.unscaledDeltaTime; if (!(filePollingStopwatch >= 10f)) { return; } filePollingStopwatch = 0f; foreach (ConfigFile item in observedFiles.Keys.ToList()) { DateTime lastWriteTime = File.GetLastWriteTime(item.ConfigFilePath); if (observedFiles[item] < lastWriteTime) { observedFiles[item] = lastWriteTime; TILER2Plugin._logger.LogDebug((object)("A config file tracked by AutoItemConfig has been changed: " + item.ConfigFilePath)); item.Reload(); } } } private string ReplaceTags(string orig, PropertyInfo prop, string categoryName, BindSubDictInfo? subDict = null) { return Regex.Replace(orig, "<AIC.([a-zA-Z\\.]+)>", delegate(Match m) { string[] array = Regex.Split(m.Groups[0].Value.Substring(1, m.Groups[0].Value.Length - 2), "(?<!\\\\)\\."); if (array.Length < 2) { return m.Value; } string text = "AutoConfigContainer.Bind on property " + prop.Name + " in category " + categoryName + ": malformed string param \"" + m.Value + "\" "; switch (array[1]) { case "Prop": { if (array.Length < 3) { TILER2Plugin._logger.LogWarning((object)(text + "(not enough params for Prop tag).")); return m.Value; } PropertyInfo property2 = prop.DeclaringType.GetProperty(array[2], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property2 == null) { TILER2Plugin._logger.LogWarning((object)(text + "(could not find Prop \"" + array[2] + "\").")); return m.Value; } return property2.GetValue(this).ToString(); } case "Field": { if (array.Length < 3) { TILER2Plugin._logger.LogWarning((object)(text + "(not enough params for Field tag).")); return m.Value; } FieldInfo field2 = prop.DeclaringType.GetField(array[2], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 == null) { TILER2Plugin._logger.LogWarning((object)(text + "(could not find Field \"" + array[2] + "\").")); return m.Value; } return field2.GetValue(this).ToString(); } case "DictKey": if (!subDict.HasValue) { TILER2Plugin._logger.LogWarning((object)(text + "(DictKey tag used on non-BindDict).")); return m.Value; } return subDict.Value.key.ToString(); case "DictInd": if (!subDict.HasValue) { TILER2Plugin._logger.LogWarning((object)(text + "(DictInd tag used on non-BindDict).")); return m.Value; } return subDict.Value.index.ToString(); case "DictKeyProp": { if (!subDict.HasValue) { TILER2Plugin._logger.LogWarning((object)(text + "(DictKeyProp tag used on non-BindDict).")); return m.Value; } if (array.Length < 3) { TILER2Plugin._logger.LogWarning((object)(text + "(not enough params for DictKeyProp tag).")); return m.Value; } PropertyInfo property = subDict.Value.key.GetType().GetProperty(array[2], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { TILER2Plugin._logger.LogWarning((object)(text + "(could not find DictKeyProp \"" + array[2] + "\").")); return m.Value; } return property.GetValue(subDict.Value.key).ToString(); } case "DictKeyField": { if (!subDict.HasValue) { TILER2Plugin._logger.LogWarning((object)(text + "(DictKeyField tag used on non-BindDict).")); return m.Value; } if (array.Length < 3) { TILER2Plugin._logger.LogWarning((object)(text + "(not enough params for DictKeyField tag).")); return m.Value; } FieldInfo field = subDict.Value.key.GetType().GetField(array[2], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { TILER2Plugin._logger.LogWarning((object)(text + "(could not find DictKeyField \"" + array[2] + "\").")); return m.Value; } return field.GetValue(subDict.Value.key).ToString(); } default: TILER2Plugin._logger.LogWarning((object)(text + "(unknown tag \"" + array[1] + "\").")); return m.Value; } }); } public void Bind(PropertyInfo prop, ConfigFile cfl, string modName, string categoryName, AutoConfigAttribute attrib, AutoConfigUpdateActionsAttribute eiattr = null, BindSubDictInfo? subDict = null) { //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Expected O, but got Unknown //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Expected O, but got Unknown //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Expected O, but got Unknown string text = "AutoConfigContainer.Bind on property " + prop.Name + " in category " + categoryName + " failed: "; if (!subDict.HasValue) { if (bindings.Exists((AutoConfigBinding x) => x.boundProperty == prop)) { TILER2Plugin._logger.LogError((object)(text + "this property has already been bound.")); return; } if ((attrib.flags & AutoConfigFlags.BindDict) == AutoConfigFlags.BindDict) { if (!prop.PropertyType.GetInterfaces().Any((Type i) => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDictionary<, >))) { TILER2Plugin._logger.LogError((object)(text + "BindDict flag cannot be used on property types which don't implement IDictionary.")); return; } Type type = prop.PropertyType.GetGenericArguments()[1]; if (attrib.avb != null && attrib.avbType != type) { TILER2Plugin._logger.LogError((object)(text + "dict value and AcceptableValue types must match (received " + type.Name + " and " + attrib.avbType.Name + ").")); return; } if (!TomlTypeConverter.CanConvert(type)) { TILER2Plugin._logger.LogError((object)(text + "dict value type cannot be converted by BepInEx.Configuration.TomlTypeConverter (received " + type.Name + ").")); return; } IDictionary dictionary = (IDictionary)prop.GetValue(this, null); int num = 0; List<object> list = (from object k in dictionary.Keys select (k)).ToList(); if (list.Count == 0) { TILER2Plugin._logger.LogError((object)(text + "BindDict was used on an empty dictionary. All intended keys must be present at time of binding and cannot be added afterwards.")); } { foreach (object item in list) { Bind(prop, cfl, modName, categoryName, attrib, eiattr, new BindSubDictInfo { key = item, val = dictionary[item], keyType = type, index = num }); num++; } return; } } } if (!subDict.HasValue) { if (attrib.avb != null && attrib.avbType != prop.PropertyType) { TILER2Plugin._logger.LogError((object)(text + "property and AcceptableValue types must match (received " + prop.PropertyType.Name + " and " + attrib.avbType.Name + ").")); return; } if (!TomlTypeConverter.CanConvert(prop.PropertyType)) { TILER2Plugin._logger.LogError((object)(text + "property type cannot be converted by BepInEx.Configuration.TomlTypeConverter (received " + prop.PropertyType.Name + ").")); return; } } object obj2 = (subDict.HasValue ? prop.GetValue(this) : this); IDictionary dictionary2 = (subDict.HasValue ? ((IDictionary)obj2) : null); MethodInfo methodInfo = (subDict.HasValue ? dictionary2.GetType().GetProperty("Item").GetGetMethod(nonPublic: true) : (prop.GetGetMethod(nonPublic: true) ?? prop.DeclaringType.GetProperty(prop.Name)?.GetGetMethod(nonPublic: true))); MethodInfo methodInfo2 = (subDict.HasValue ? dictionary2.GetType().GetProperty("Item").GetSetMethod(nonPublic: true) : (prop.GetSetMethod(nonPublic: true) ?? prop.DeclaringType.GetProperty(prop.Name)?.GetSetMethod(nonPublic: true))); Type type2 = (subDict.HasValue ? subDict.Value.keyType : prop.PropertyType); if (methodInfo == null || methodInfo2 == null) { TILER2Plugin._logger.LogError((object)(text + "property (or IDictionary Item property, if using BindDict flag) must have both a getter and a setter.")); return; } string name = attrib.name; name = ((name == null) ? string.Format("{0}{1}{2}", char.ToUpperInvariant(prop.Name[0]), prop.Name.Substring(1), subDict.HasValue ? (":" + subDict.Value.index) : "") : ReplaceTags(name, prop, categoryName, subDict)); string desc = attrib.desc; desc = ((desc == null) ? ("Automatically generated from a C# " + (subDict.HasValue ? "dictionary " : "") + "property.") : ReplaceTags(desc, prop, categoryName, subDict)); MethodInfo methodInfo3 = typeof(ConfigFile).GetMethods().First((MethodInfo x) => x.Name == "Bind" && x.GetParameters().Length == 3 && x.GetParameters()[0].ParameterType == typeof(ConfigDefinition) && x.GetParameters()[2].ParameterType == typeof(ConfigDescription)).MakeGenericMethod(type2); object obj3 = (subDict.HasValue ? subDict.Value.val : prop.GetValue(this)); bool flag = (attrib.flags & AutoConfigFlags.PreventNetMismatch) != AutoConfigFlags.PreventNetMismatch; bool flag2 = (attrib.flags & AutoConfigFlags.DeferForever) == AutoConfigFlags.DeferForever; bool flag3 = (attrib.flags & AutoConfigFlags.DeferUntilEndGame) == AutoConfigFlags.DeferUntilEndGame; bool flag4 = (attrib.flags & AutoConfigFlags.DeferUntilNextStage) == AutoConfigFlags.DeferUntilNextStage; bool flag5 = (attrib.flags & AutoConfigFlags.PreventConCmd) != AutoConfigFlags.PreventConCmd; if (flag2 && !flag) { desc += "\nWARNING: THIS SETTING CANNOT BE CHANGED WHILE THE GAME IS RUNNING, AND MUST BE SYNCED MANUALLY FOR MULTIPLAYER!"; } ConfigEntryBase cfe = (ConfigEntryBase)methodInfo3.Invoke(cfl, new object[3] { (object)new ConfigDefinition(categoryName, name), obj3, (object)new ConfigDescription(desc, attrib.avb, Array.Empty<object>()) }); observedFiles[cfl] = File.GetLastWriteTime(cfl.ConfigFilePath); AutoConfigBinding newBinding = new AutoConfigBinding { boundProperty = prop, allowConCmd = (flag5 && !flag2 && !flag3), allowNetMismatch = flag, netMismatchCritical = (!flag && flag2), deferType = (flag2 ? AutoConfigBinding.DeferType.NeverAutoUpdate : (flag3 ? AutoConfigBinding.DeferType.WaitForRunEnd : (flag4 ? AutoConfigBinding.DeferType.WaitForNextStage : AutoConfigBinding.DeferType.UpdateImmediately))), configEntry = cfe, modName = modName, owner = this, propGetter = methodInfo, propSetter = methodInfo2, propType = type2, onDict = subDict.HasValue, boundKey = (subDict.HasValue ? subDict.Value.key : null), updateEventAttribute = eiattr, cachedValue = obj3, target = obj2 }; bindings.Add(newBinding); if (!flag2) { typeof(ConfigEntry<>).MakeGenericType(type2).GetEvent("SettingChanged").ReflAddEventHandler(cfe, delegate { newBinding.UpdateProperty(cfe.BoxedValue); }); } if ((attrib.flags & AutoConfigFlags.NoInitialRead) != AutoConfigFlags.NoInitialRead) { methodInfo2.Invoke(obj2, (!subDict.HasValue) ? new object[1] { cfe.BoxedValue } : new object[2] { subDict.Value.key, cfe.BoxedValue }); newBinding.cachedValue = cfe.BoxedValue; } BindRoO(cfe, prop, type2, categoryName, name, desc, flag2, flag3 || flag2); } public void BindRoO(AutoConfigBinding bind, params Attribute[] entryRoOAttributes) { BindRoO(bind.configEntry, bind.boundProperty, bind.propType, bind.configEntry.Definition.Section, bind.configEntry.Definition.Key, bind.configEntry.Description.Description, bind.deferType >= AutoConfigBinding.DeferType.NeverAutoUpdate, bind.deferType >= AutoConfigBinding.DeferType.WaitForRunEnd, entryRoOAttributes); } public void BindRoO(ConfigEntryBase cfe, PropertyInfo prop, Type propType, string categoryName, string cfgName, string cfgDesc, bool deferForever, bool deferRun, params Attribute[] entryRoOAttributes) { if (!Compat_RiskOfOptions.enabled) { return; } string text = "AutoConfigContainer.Bind on property " + prop.Name + " in category " + categoryName + " could not apply Risk of Options compat: "; AutoConfigRoOInfoOverridesAttribute customAttribute = GetType().GetCustomAttribute<AutoConfigRoOInfoOverridesAttribute>(); AutoConfigRoOInfoOverridesAttribute customAttribute2 = prop.GetCustomAttribute<AutoConfigRoOInfoOverridesAttribute>(); if (entryRoOAttributes.Length == 0) { return; } if ((from x in entryRoOAttributes group x by x.GetType()).Any((IGrouping<Type, Attribute> x) => x.Count() > 1)) { TILER2Plugin._logger.LogWarning((object)("AutoConfigContainer.BindRoO on property " + prop.Name + " in category " + categoryName + " has multiple RoO options of the same type")); } string text2 = null; string text3 = null; bool flag = false; if (customAttribute != null) { text2 = customAttribute.modGuid; text3 = customAttribute.modName; flag = true; } else { Assembly assembly = Assembly.GetAssembly(GetType()); Type[] types; try { types = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } Type[] array = types; for (int i = 0; i < array.Length; i++) { BepInPlugin customAttribute3 = ((MemberInfo)array[i]).GetCustomAttribute<BepInPlugin>(); if (customAttribute3 != null) { text2 = customAttribute3.GUID; text3 = customAttribute3.Name; flag = true; break; } } } if (!flag) { TILER2Plugin._logger.LogError((object)(text + "could not find mod info. Declaring type must be in an assembly with a BepInPlugin, or have an AutoConfigContainerRoOInfoAttribute on it.")); return; } Compat_RiskOfOptions.OptionIdentityStrings optionIdentityStrings = default(Compat_RiskOfOptions.OptionIdentityStrings); optionIdentityStrings.category = customAttribute2?.categoryName ?? customAttribute?.categoryName ?? categoryName; optionIdentityStrings.name = customAttribute2?.entryName ?? customAttribute?.entryName ?? cfgName; optionIdentityStrings.description = cfgDesc; optionIdentityStrings.modGuid = customAttribute2?.modGuid ?? text2; optionIdentityStrings.modName = customAttribute2?.modName ?? text3; Compat_RiskOfOptions.OptionIdentityStrings identStrings = optionIdentityStrings; for (int i = 0; i < entryRoOAttributes.Length; i++) { BaseAutoConfigRoOAttribute baseAutoConfigRoOAttribute = (BaseAutoConfigRoOAttribute)entryRoOAttributes[i]; if ((baseAutoConfigRoOAttribute.requiredType == typeof(Enum)) ? (!propType.IsEnum) : (propType != baseAutoConfigRoOAttribute.requiredType)) { TILER2Plugin._logger.LogError((object)(text + baseAutoConfigRoOAttribute.GetType().Name + " may only be applied to " + baseAutoConfigRoOAttribute.requiredType.Name + " properties (got " + propType.Name + ").")); } else { baseAutoConfigRoOAttribute.Apply(cfe, identStrings, deferForever, () => (deferRun && Object.op_Implicit((Object)(object)Run.instance)) ? true : false); } } } internal void BindRoO(ConfigEntryBase cfe, PropertyInfo prop, Type propType, string categoryName, string cfgName, string cfgDesc, bool deferForever, bool deferRun) { if (Compat_RiskOfOptions.enabled) { Attribute[] entryRoOAttributes = prop.GetCustomAttributes<BaseAutoConfigRoOAttribute>().ToArray(); BindRoO(cfe, prop, propType, categoryName, cfgName, cfgDesc, deferForever, deferRun, entryRoOAttributes); } } public void BindAll(ConfigFile cfl, string modName, string categoryName) { PropertyInfo[] properties = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { AutoConfigAttribute customAttribute = propertyInfo.GetCustomAttribute<AutoConfigAttribute>(inherit: true); if (customAttribute != null) { Bind(propertyInfo, cfl, modName, categoryName, customAttribute, propertyInfo.GetCustomAttribute<AutoConfigUpdateActionsAttribute>(inherit: true)); } } } } internal class AutoConfigModule : T2Module<AutoConfigModule> { internal static bool globalStatsDirty; internal static bool globalDropsDirty; internal static bool globalLanguageDirty; public override bool managedEnable => false; public override void SetupConfig() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown base.SetupConfig(); RoR2Application.Update += new hook_Update(AutoConfigContainer.FilePollUpdateHook); NetworkManagerSystem.Disconnect += new hook_Disconnect(On_GNMDisconnect); SceneManager.sceneLoaded += Evt_USMSceneLoaded; } internal static void Update() { if (!((Object)(object)Run.instance != (Object)null) || !((Behaviour)Run.instance).isActiveAndEnabled) { globalStatsDirty = false; globalDropsDirty = false; } else { if (globalStatsDirty) { globalStatsDirty = false; MiscUtil.AliveList().ForEach(delegate(CharacterMaster cm) { if (cm.hasBody) { cm.GetBody().RecalculateStats(); } }); } if (globalDropsDirty) { globalDropsDirty = false; Run.instance.OnRuleBookUpdated(Run.instance.networkRuleBookComponent); Run.instance.BuildDropTable(); } } if (globalLanguageDirty) { globalLanguageDirty = false; Language.SetCurrentLanguage(Language.currentLanguageName); } } internal static void On_GNMDisconnect(orig_Disconnect orig, NetworkManagerSystem self) { orig.Invoke(self); AutoConfigBinding.CleanupDirty(isRunEnd: true); } internal static void Evt_USMSceneLoaded(Scene scene, LoadSceneMode mode) { AutoConfigBinding.CleanupDirty(isRunEnd: false); } } [Flags] public enum AutoConfigFlags { None = 0, AVIsList = 1, DeferUntilNextStage = 2, DeferUntilEndGame = 4, DeferForever = 8, PreventConCmd = 0x10, NoInitialRead = 0x20, PreventNetMismatch = 0x40, BindDict = 0x80 } [Flags] public enum AutoConfigUpdateActionTypes { None = 0, InvalidateLanguage = 1, InvalidateModel = 2, InvalidateStats = 4, InvalidateDropTable = 8, AnnounceToRun = 0x10 } public class AutoConfigUpdateActionEventArgs : EventArgs { public AutoConfigUpdateActionTypes flags; public object oldValue; public object newValue; public AutoConfigBinding target; public bool silent; } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigUpdateActionsAttribute : Attribute { public readonly AutoConfigUpdateActionTypes flags; public readonly bool ignoreDefault; public AutoConfigUpdateActionsAttribute(AutoConfigUpdateActionTypes flags, bool ignoreDefault = false) { this.flags = flags; this.ignoreDefault = ignoreDefault; } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigAttribute : Attribute { public readonly string name; public readonly string desc; public readonly AcceptableValueBase avb; public readonly Type avbType; public readonly AutoConfigFlags flags; public AutoConfigAttribute(string name, string desc, AutoConfigFlags flags = AutoConfigFlags.None, params object[] acceptableValues) : this(desc, flags, acceptableValues) { this.name = name; } public AutoConfigAttribute(string desc, AutoConfigFlags flags = AutoConfigFlags.None, params object[] acceptableValues) : this(flags, acceptableValues) { this.desc = desc; } public AutoConfigAttribute(AutoConfigFlags flags = AutoConfigFlags.None, params object[] acceptableValues) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown if (acceptableValues.Length != 0) { bool flag = (flags & AutoConfigFlags.AVIsList) == AutoConfigFlags.AVIsList; if (!flag && acceptableValues.Length != 2) { throw new ArgumentException("Range mode for acceptableValues (flag AVIsList not set) requires either 0 or 2 params; received " + acceptableValues.Length + ".\nThe description provided was: \"" + desc + "\"."); } Type type = acceptableValues[0].GetType(); for (int i = 1; i < acceptableValues.Length; i++) { if (type != acceptableValues[i].GetType()) { throw new ArgumentException("Types of all acceptableValues must match"); } } avb = (AcceptableValueBase)Activator.CreateInstance(flag ? typeof(AcceptableValueList<>).MakeGenericType(type) : typeof(AcceptableValueRange<>).MakeGenericType(type), acceptableValues); avbType = type; } this.flags = flags; } } public abstract class BaseAutoConfigRoOAttribute : Attribute { public string nameOverride; public string catOverride; public abstract Type requiredType { get; } public BaseAutoConfigRoOAttribute(string nameOverride = null, string catOverride = null) { this.nameOverride = nameOverride; this.catOverride = catOverride; } public abstract void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate); } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOSliderAttribute : BaseAutoConfigRoOAttribute { public string format; public float min; public float max; public override Type requiredType => typeof(float); public AutoConfigRoOSliderAttribute(string format, float min, float max, string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { this.format = format; this.min = min; this.max = max; } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_Slider((ConfigEntry<float>)(object)cfe, identStrings, min, max, format, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOStepSliderAttribute : BaseAutoConfigRoOAttribute { public string format; public float min; public float max; public float step; public override Type requiredType => typeof(float); public AutoConfigRoOStepSliderAttribute(string format, float min, float max, float step, string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { this.format = format; this.min = min; this.max = max; this.step = step; } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_StepSlider((ConfigEntry<float>)(object)cfe, identStrings, min, max, step, format, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOIntSliderAttribute : BaseAutoConfigRoOAttribute { public string format; public int min; public int max; public override Type requiredType => typeof(int); public AutoConfigRoOIntSliderAttribute(string format, int min, int max, string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { this.format = format; this.min = min; this.max = max; } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_IntSlider((ConfigEntry<int>)(object)cfe, identStrings, min, max, format, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOChoiceAttribute : BaseAutoConfigRoOAttribute { public override Type requiredType => typeof(Enum); public AutoConfigRoOChoiceAttribute(string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_Choice(cfe, identStrings, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOKeybindAttribute : BaseAutoConfigRoOAttribute { public override Type requiredType => typeof(KeyboardShortcut); public AutoConfigRoOKeybindAttribute(string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_Keybind((ConfigEntry<KeyboardShortcut>)(object)cfe, identStrings, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOCheckboxAttribute : BaseAutoConfigRoOAttribute { public override Type requiredType => typeof(bool); public AutoConfigRoOCheckboxAttribute(string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_CheckBox((ConfigEntry<bool>)(object)cfe, identStrings, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOStringAttribute : BaseAutoConfigRoOAttribute { public override Type requiredType => typeof(string); public AutoConfigRoOStringAttribute(string nameOverride = null, string catOverride = null) : base(nameOverride, catOverride) { } public override void Apply(ConfigEntryBase cfe, Compat_RiskOfOptions.OptionIdentityStrings identStrings, bool deferForever, Func<bool> isDisabledDelegate) { Compat_RiskOfOptions.AddOption_String((ConfigEntry<string>)(object)cfe, identStrings, deferForever, isDisabledDelegate); } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class AutoConfigRoOInfoOverridesAttribute : Attribute { public string modGuid; public string modName; public string categoryName; public string entryName; public AutoConfigRoOInfoOverridesAttribute(string guid, string name, string cat = null, string ent = null) { modGuid = guid; modName = name; categoryName = cat; entryName = ent; } public AutoConfigRoOInfoOverridesAttribute(Type ownerPluginType, string cat = null, string ent = null) { BepInPlugin customAttribute = ((MemberInfo)ownerPluginType).GetCustomAttribute<BepInPlugin>(); if (customAttribute == null) { TILER2Plugin._logger.LogError((object)("AutoConfigContainerRoOInfoAttribute received an invalid type " + ownerPluginType.Name + " with no BepInPluginAttribute")); return; } modGuid = customAttribute.GUID; modName = customAttribute.Name; categoryName = cat; entryName = ent; } } public static class AutoConfigPresetExtensions { public static void ApplyPreset(this AutoConfigContainer container, string name) { HashSet<ConfigFile> hashSet = new HashSet<ConfigFile>(); foreach (AutoConfigBinding binding in container.bindings) { AutoConfigPresetAttribute autoConfigPresetAttribute = binding.boundProperty.GetCustomAttributes(typeof(AutoConfigPresetAttribute), inherit: true).Cast<AutoConfigPresetAttribute>().FirstOrDefault((AutoConfigPresetAttribute p) => p.presetName == name); if (autoConfigPresetAttribute != null) { binding.configEntry.BoxedValue = autoConfigPresetAttribute.boxedValue; if (!binding.configEntry.ConfigFile.SaveOnConfigSet) { hashSet.Add(binding.configEntry.ConfigFile); } } } foreach (ConfigFile item in hashSet) { item.Save(); } } } [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)] public class AutoConfigPresetAttribute : Attribute { public readonly string presetName; public readonly object boxedValue; public AutoConfigPresetAttribute(string name, object value) { presetName = name; boxedValue = value; } } public abstract class CatalogBoilerplate : T2Module { public struct ConsoleStrings { public string className; public string objectName; public string formattedIndex; } public string nameToken { get; private protected set; } public string pickupToken { get; private protected set; } public string descToken { get; private protected set; } public string loreToken { get; private protected set; } public PickupDef pickupDef { get; internal set; } public PickupIndex pickupIndex { get; internal set; } public Entry logbookEntry { get; internal set; } public RuleDef ruleDef { get; internal set; } protected internal override AutoConfigUpdateActionTypes defaultEnabledUpdateFlags => AutoConfigUpdateActionTypes.AnnounceToRun; public override bool managedEnable => true; public override AutoConfigFlags enabledConfigFlags => AutoConfigFlags.DeferUntilNextStage | AutoConfigFlags.PreventNetMismatch; public override AutoConfigUpdateActionTypes enabledConfigUpdateActionTypes => AutoConfigUpdateActionTypes.InvalidateLanguage | AutoConfigUpdateActionTypes.InvalidateStats | AutoConfigUpdateActionTypes.InvalidateDropTable; public GameObject modelResource { get; protected set; } public Sprite iconResource { get; protected set; } [Obsolete("No longer in use. Replaced by LanguageAPI systems: use a language file or similar to define token ModIdent_ClassName_NAME, e.g. MYMOD_MYITEM_NAME.")] public virtual string displayName { get; } protected virtual string[] GetNameStringArgs(string langID = null) { return new string[0]; } protected virtual string[] GetPickupStringArgs(string langID = null) { return new string[0]; } protected virtual string[] GetDescStringArgs(string langID = null) { return new string[0]; } protected virtual string[] GetLoreStringArgs(string langID = null) { return new string[0]; } protected virtual string GetNameString(string langID = null) { try { Language bestLanguage = MiscUtil.GetBestLanguage(langID); object obj; if (bestLanguage == null) { obj = null; } else { string obj2 = nameToken ?? "Language load error! (null token)"; object[] nameStringArgs = GetNameStringArgs(langID); obj = bestLanguage.GetLocalizedFormattedStringByToken(obj2, nameStringArgs); } if (obj == null) { obj = "Language load error!"; } return string.Format((string)obj); } catch (FormatException) { TILER2Plugin._logger.LogError((object)("Argument count mismatch while retrieving string " + nameToken)); return $"Language load error! (argument count mismatch; expected {GetNameStringArgs(langID).Length} total)"; } } protected virtual string GetPickupString(string langID = null) { try { Language bestLanguage = MiscUtil.GetBestLanguage(langID); object obj; if (bestLanguage == null) { obj = null; } else { string obj2 = pickupToken ?? "Language load error! (null token)"; object[] pickupStringArgs = GetPickupStringArgs(langID); obj = bestLanguage.GetLocalizedFormattedStringByToken(obj2, pickupStringArgs); } if (obj == null) { obj = "Language load error!"; } return string.Format((string)obj); } catch (FormatException) { TILER2Plugin._logger.LogError((object)("Argument count mismatch while retrieving string " + pickupToken)); return $"Language load error! (argument count mismatch; expected {GetPickupStringArgs(langID).Length} total)"; } } protected virtual string GetDescString(string langID = null) { try { Language bestLanguage = MiscUtil.GetBestLanguage(langID); object obj; if (bestLanguage == null) { obj = null; } else { string obj2 = descToken ?? "Language load error! (null token)"; object[] descStringArgs = GetDescStringArgs(langID); obj = bestLanguage.GetLocalizedFormattedStringByToken(obj2, descStringArgs); } if (obj == null) { obj = "Language load error!"; } return string.Format((string)obj); } catch (FormatException) { TILER2Plugin._logger.LogError((object)("Argument count mismatch while retrieving string " + descToken)); return $"Language load error! (argument count mismatch; expected {GetDescStringArgs(langID).Length} total)"; } } protected virtual string GetLoreString(string langID = null) { try { Language bestLanguage = MiscUtil.GetBestLanguage(langID); object obj; if (bestLanguage == null) { obj = null; } else { string obj2 = loreToken ?? "Language load error! (null token)"; object[] loreStringArgs = GetLoreStringArgs(langID); obj = bestLanguage.GetLocalizedFormattedStringByToken(obj2, loreStringArgs); } if (obj == null) { obj = "Language load error!"; } return string.Format((string)obj); } catch (FormatException) { TILER2Plugin._logger.LogError((object)("Argument count mismatch while retrieving string " + loreToken)); return $"Language load error! (argument count mismatch; expected {GetLoreStringArgs(langID).Length} total)"; } } protected virtual GameObject GetPickupModel() { return null; } public CatalogBoilerplate() { CatalogBoilerplateModule.allInstances.Add(this); } public override void SetupConfig() { base.SetupConfig(); base.ConfigEntryChanged += delegate(object sender, AutoConfigUpdateActionEventArgs args) { if ((args.flags & AutoConfigUpdateActionTypes.InvalidateModel) == AutoConfigUpdateActionTypes.InvalidateModel) { GameObject pickupModel = GetPickupModel(); if ((Object)(object)pickupModel != (Object)null) { if (pickupDef != null) { pickupDef.displayPrefab = pickupModel; } if (logbookEntry != null) { logbookEntry.modelPrefab = pickupModel; } } } }; } public override void RefreshPermanentLanguage() { string @string = Language.GetString("TILER2_CONFIG_DISABLED"); permanentGenericLanguageTokens[nameToken + "_RENDERED"] = (base.enabled ? "" : @string) + GetNameString(); permanentGenericLanguageTokens[pickupToken + "_RENDERED"] = (base.enabled ? "" : @string) + GetPickupString(); permanentGenericLanguag
BepinEx/plugins/ThinkInvis-Yeet/Yeet.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Utils; using RoR2; using RoR2.UI; using TILER2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; 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.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Yeet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Yeet")] [assembly: AssemblyTitle("Yeet")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ThinkInvisible.Yeet; [BepInPlugin("com.ThinkInvisible.Yeet", "Yeet", "3.0.2")] [BepInDependency("com.bepis.r2api", "5.0.6")] [BepInDependency("com.ThinkInvisible.TILER2", "7.3.4")] public class YeetPlugin : BaseUnityPlugin { public class ServerBlacklist : AutoConfigContainer { [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool preventEquipment { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool preventLunarEquipment { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool preventNonLunarEquipment { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool preventItems { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] public bool preventHidden { get; private set; } = true; [AutoConfig(/*Could not decode attribute arguments.*/)] public bool preventCantRemove { get; private set; } = true; [AutoConfig(/*Could not decode attribute arguments.*/)] public bool preventTierless { get; private set; } = true; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOString(null, null)] public string blacklistTier { get; private set; } = "LunarTierDef, VoidTier1Def, VoidTier2Def, VoidTier3Def, VoidBossDef"; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOString(null, null)] public string blacklistItem { get; private set; } = ""; } public class ServerConfig : AutoConfigContainer { [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool allowYeet { get; private set; } = true; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool preventRecycling { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool commandExtraCheesyMode { get; private set; } [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOCheckbox(null, null)] public bool announce { get; private set; } = true; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOSlider("{0:N1} m/s", 0f, 500f, null, null)] public float lowThrowForce { get; private set; } = 30f; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOSlider("{0:N1} m/s", 0f, 500f, null, null)] public float highThrowForce { get; private set; } = 150f; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOIntSlider("{0:N0}", 1, 100, null, null)] public int maxThrowCount { get; private set; } = 1; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOSlider("{0:N1} s", 0f, 300f, null, null)] public float yoinkCooldown { get; private set; } = 5f; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOSlider("{0:N1} s", 0f, 300f, null, null)] public float yeetCooldown { get; private set; } = 10f; } public class ClientConfig : AutoConfigContainer { [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOSlider("{0:N1} s", 0f, 10f, null, null)] public float highThrowTime { get; private set; } = 2f; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOIntSlider("{0:N0}", -100, 100, null, null)] public int primaryQuantity { get; private set; } = 1; [AutoConfig(/*Could not decode attribute arguments.*/)] [AutoConfigRoOIntSlider("{0:N0}", -100, 100, null, null)] public int secondaryQuantity { get; private set; } = 1; } public const string ModVer = "3.0.2"; public const string ModName = "Yeet"; public const string ModGuid = "com.ThinkInvisible.Yeet"; public static readonly ServerConfig serverConfig = new ServerConfig(); public static readonly ClientConfig clientConfig = new ClientConfig(); public static readonly ServerBlacklist serverBlacklist = new ServerBlacklist(); internal static ManualLogSource _logger; private static GameObject yeetPickupPrefab; private static readonly HashSet<string> _blacklistTier = new HashSet<string>(); private static readonly HashSet<string> _blacklistItem = new HashSet<string>(); public void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00e7: 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) _logger = ((BaseUnityPlugin)this).Logger; ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "com.ThinkInvisible.Yeet.cfg"), true); ((AutoConfigContainer)serverBlacklist).ConfigEntryChanged += delegate(object sender, AutoConfigUpdateActionEventArgs args) { if (args.target.boundProperty.Name == "blacklistTier" || args.target.boundProperty.Name == "blacklistItem") { UpdateBlacklists(); } }; ((AutoConfigContainer)serverConfig).BindAll(val, "Yeet", "Server"); ((AutoConfigContainer)clientConfig).BindAll(val, "Yeet", "Client"); ((AutoConfigContainer)serverBlacklist).BindAll(val, "Yeet", "ServerBlacklist"); UpdateBlacklists(); ItemIcon.Awake += new hook_Awake(ItemIcon_Awake); EquipmentIcon.Update += new hook_Update(EquipmentIcon_Update); PickupDropletController.OnCollisionEnter += new hook_OnCollisionEnter(PickupDropletController_OnCollisionEnter); GenericPickupController.CreatePickup += new hook_CreatePickup(GenericPickupController_CreatePickup); GenericPickupController.GetInteractability += new hook_GetInteractability(GenericPickupController_GetInteractability); GenericPickupController.OnTriggerStay += new hook_OnTriggerStay(GenericPickupController_OnTriggerStay); AsyncOperationHandle<GameObject> val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/GenericPickup.prefab"); val2.Completed += delegate(AsyncOperationHandle<GameObject> obj) { GameObject result = obj.Result; if (!Object.op_Implicit((Object)(object)result)) { _logger.LogError((object)"Failed to load GenericPickup prefab to copy homework off of. The YoinkCooldown setting will not work (no extra cooldown will be added)."); } else { GameObject val3 = PrefabAPI.InstantiateClone(result, "YeetPickupPrefabPrefab"); val3.AddComponent<YeetData>(); yeetPickupPrefab = PrefabAPI.InstantiateClone(val3, "YeetPickupPrefab", true); } }; } private void UpdateBlacklists() { _blacklistItem.Clear(); _blacklistItem.UnionWith(from x in serverBlacklist.blacklistItem.Split(new char[1] { ',' }) select x.Trim()); _blacklistTier.Clear(); _blacklistTier.UnionWith(from x in serverBlacklist.blacklistTier.Split(new char[1] { ',' }) select x.Trim()); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ConCmdYeet(ConCommandArgs args) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected I4, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected I4, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Invalid comparison between Unknown and I4 //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) if (!serverConfig.allowYeet) { if (Object.op_Implicit((Object)(object)args.sender)) { NetUtil.ServerSendChatMsg(args.sender, "Yeet mod has been temporarily disabled by the server host."); } return; } if (!Object.op_Implicit((Object)(object)((ConCommandArgs)(ref args)).senderBody)) { _logger.LogError((object)"ConCmdYeet: called by nonexistent player!"); return; } if (((ConCommandArgs)(ref args)).Count < 1) { _logger.LogError((object)"ConCmdYeet: not enough arguments! Need at least 1 (item ID), received 0."); return; } YeetData yeetData = ((Component)((ConCommandArgs)(ref args)).senderBody).GetComponent<YeetData>(); if (!Object.op_Implicit((Object)(object)yeetData)) { yeetData = ((Component)((ConCommandArgs)(ref args)).senderBody).gameObject.AddComponent<YeetData>(); yeetData.age = serverConfig.yeetCooldown; } if (yeetData.age < serverConfig.yeetCooldown) { float num = serverConfig.yeetCooldown - yeetData.age; NetUtil.ServerSendChatMsg(args.sender, string.Format("You must wait {0:0} second{1} before yeeting another item.", num, (num < 2f) ? "" : "s")); return; } bool valueOrDefault = ((ConCommandArgs)(ref args)).TryGetArgBool(1).GetValueOrDefault(); if (valueOrDefault ? serverBlacklist.preventEquipment : serverBlacklist.preventItems) { return; } string itemSearch = ((ConCommandArgs)(ref args)).TryGetArgString(0); if (itemSearch == null) { _logger.LogError((object)"ConCmdYeet: could not read first argument (item ID)!"); return; } if (int.TryParse(itemSearch, out var result)) { if (valueOrDefault) { EquipmentIndex val = (EquipmentIndex)result; if (!EquipmentCatalog.IsIndexValid(ref val)) { _logger.LogError((object)"ConCmdYeet: first argument (equipment ID as integer EquipmentIndex) is out of range; no equipment with that ID exists!"); return; } } else { ItemIndex val2 = (ItemIndex)result; if (!ItemCatalog.IsIndexValid(ref val2)) { _logger.LogError((object)"ConCmdYeet: first argument (item ID as integer ItemIndex) is out of range; no item with that ID exists!"); return; } } } else if (valueOrDefault) { IEnumerable<EquipmentIndex> source = ((IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment).Where(delegate(EquipmentIndex searchInd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string nameToken2 = EquipmentCatalog.GetEquipmentDef(searchInd).nameToken; string string2 = Language.GetString(nameToken2); return string2.ToUpper().Contains(itemSearch.ToUpper()); }); if (source.Count() < 1) { _logger.LogError((object)"ConCmdYeet: first argument (equipment ID as string EquipmentName) not found in EquipmentCatalog; no equipment with a name containing that string exists!"); return; } if (source.Count() > 1) { _logger.LogWarning((object)"ConCmdYeet: first argument (item ID as string EquipmentName) matched multiple equipments; using first."); } result = (int)source.First(); } else { IEnumerable<ItemIndex> source2 = ((IEnumerable<ItemIndex>)(object)ItemCatalog.allItems).Where(delegate(ItemIndex searchInd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string nameToken = ItemCatalog.GetItemDef(searchInd).nameToken; string @string = Language.GetString(nameToken); return @string.ToUpper().Contains(itemSearch.ToUpper()); }); if (source2.Count() < 1) { _logger.LogError((object)"ConCmdYeet: first argument (item ID as string ItemName) not found in ItemCatalog; no item with a name containing that string exists!"); return; } if (source2.Count() > 1) { _logger.LogWarning((object)"ConCmdYeet: first argument (item ID as string ItemName) matched multiple items; using first."); } result = (int)source2.First(); } float num2 = Mathf.Lerp(serverConfig.lowThrowForce, serverConfig.highThrowForce, Mathf.Clamp01(((ConCommandArgs)(ref args)).TryGetArgFloat(2).GetValueOrDefault())); int num3 = 1; string text; PickupIndex val3; if (valueOrDefault) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)result); string colorHexString = ColorCatalog.GetColorHexString(equipmentDef.colorIndex); text = "<color=#" + colorHexString + ">" + Language.GetString(equipmentDef.nameToken) + "</color>"; if ((int)((ConCommandArgs)(ref args)).senderBody.inventory.GetEquipmentIndex() != result) { _logger.LogWarning((object)"ConCmdYeet: someone's trying to drop an equipment they don't have"); NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": you don't have it."); return; } if (equipmentDef.isLunar ? serverBlacklist.preventLunarEquipment : serverBlacklist.preventNonLunarEquipment) { NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": tier blacklisted by server."); return; } if (_blacklistItem.Contains(equipmentDef.nameToken)) { NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": equipment blacklisted by server."); return; } ((ConCommandArgs)(ref args)).senderBody.inventory.SetEquipmentIndex((EquipmentIndex)(-1)); val3 = PickupCatalog.FindPickupIndex((EquipmentIndex)result); } else { FakeInventory component = ((Component)((ConCommandArgs)(ref args)).senderBody).GetComponent<FakeInventory>(); int num4 = (Object.op_Implicit((Object)(object)component) ? component.GetRealItemCount((ItemIndex)result) : ((ConCommandArgs)(ref args)).senderBody.inventory.GetItemCount((ItemIndex)result)); ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)result); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); string colorHexString2 = ColorCatalog.GetColorHexString(itemTierDef.colorIndex); text = "<color=#" + colorHexString2 + ">" + Language.GetString(itemDef.nameToken) + "</color>"; if (num4 < 1) { _logger.LogWarning((object)"ConCmdYeet: someone's trying to drop an item they don't have any of"); NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": you don't have any."); return; } if ((serverBlacklist.preventHidden && itemDef.hidden) || (serverBlacklist.preventCantRemove && !itemDef.canRemove) || ((!Object.op_Implicit((Object)(object)itemTierDef)) ? serverBlacklist.preventTierless : _blacklistTier.Contains(((Object)itemTierDef).name))) { NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": tier blacklisted by server."); return; } if (_blacklistItem.Contains(itemDef.nameToken)) { NetUtil.ServerSendChatMsg(args.sender, "Can't yeet " + text + ": item blacklisted by server."); return; } int num5 = ((ConCommandArgs)(ref args)).TryGetArgInt(3) ?? 1; if (num5 < 0) { num5 = Mathf.CeilToInt((float)num4 / ((float)(-num5) * 100f)); } num3 = Mathf.Clamp(num5, 1, Mathf.Min(serverConfig.maxThrowCount, num4)); ((ConCommandArgs)(ref args)).senderBody.inventory.RemoveItem((ItemIndex)result, num3); val3 = PickupCatalog.FindPickupIndex((ItemIndex)result); } if (serverConfig.announce) { NetUtil.ServerSendGlobalChatMsg($"{Util.EscapeRichTextForTextMeshPro(args.sender.userName)} yeeted {num3}x {text}"); } for (int i = 0; i < num3; i++) { GameObject val4 = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, ((ConCommandArgs)(ref args)).senderBody.inputBank.aimOrigin, Quaternion.identity); YeetData yeetData2 = val4.AddComponent<YeetData>(); yeetData2.yeeter = ((ConCommandArgs)(ref args)).senderBody; PickupDropletController component2 = val4.GetComponent<PickupDropletController>(); if (Object.op_Implicit((Object)(object)component2)) { component2.NetworkpickupIndex = val3; CreatePickupInfo createPickupInfo = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex = val3; component2.createPickupInfo = createPickupInfo; } Rigidbody component3 = val4.GetComponent<Rigidbody>(); component3.velocity = ((ConCommandArgs)(ref args)).senderBody.inputBank.aimDirection * num2; component3.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere); NetworkServer.Spawn(val4); } yeetData.age = 0f; } private void GenericPickupController_OnTriggerStay(orig_OnTriggerStay orig, GenericPickupController self, Collider other) { if (NetworkServer.active) { CharacterBody component = ((Component)other).GetComponent<CharacterBody>(); YeetData component2 = ((Component)self).GetComponent<YeetData>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && (Object)(object)component2.yeeter == (Object)(object)component && component2.age < serverConfig.yoinkCooldown) { return; } } orig.Invoke(self, other); } private Interactability GenericPickupController_GetInteractability(orig_GetInteractability orig, GenericPickupController self, Interactor activator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) Interactability result = orig.Invoke(self, activator); YeetData component = ((Component)self).GetComponent<YeetData>(); CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && (Object)(object)component.yeeter == (Object)(object)component2 && component.age < serverConfig.yoinkCooldown) { return (Interactability)0; } return result; } private void PickupDropletController_OnCollisionEnter(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision) { //IL_0038: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !self.alive) { orig.Invoke(self, collision); return; } bool flag = false; YeetData component = ((Component)self).GetComponent<YeetData>(); if (Object.op_Implicit((Object)(object)component)) { if (!serverConfig.commandExtraCheesyMode) { flag = ((IEnumerable<ArtifactDef>)(object)RunArtifactManager.enabledArtifactsEnumerable).Contains(Artifacts.Command); } if (flag) { RunArtifactManager.instance.SetArtifactEnabledServer(Artifacts.Command, false); } if (!Object.op_Implicit((Object)(object)yeetPickupPrefab)) { orig.Invoke(self, collision); } else { self.alive = false; self.createPickupInfo.position = ((Component)self).transform.position; bool flag2 = true; MulticastDelegate multicastDelegate = (MulticastDelegate)Reflection.GetFieldCached(typeof(PickupDropletController), "onDropletHitGroundServer").GetValue(null); if ((object)multicastDelegate != null) { Delegate[] invocationList = multicastDelegate.GetInvocationList(); foreach (Delegate @delegate in invocationList) { object[] array = new object[2] { self.createPickupInfo, flag2 }; @delegate.Method.Invoke(@delegate.Target, array); self.createPickupInfo = (CreatePickupInfo)array[0]; flag2 = (bool)array[1]; } } if (flag2) { GameObject val = Object.Instantiate<GameObject>(yeetPickupPrefab, self.createPickupInfo.position, self.createPickupInfo.rotation); GenericPickupController component2 = val.GetComponent<GenericPickupController>(); if (Object.op_Implicit((Object)(object)component2)) { component2.NetworkpickupIndex = ((CreatePickupInfo)(ref self.createPickupInfo)).pickupIndex; if (serverConfig.preventRecycling) { component2.NetworkRecycled = true; } } PickupIndexNetworker component3 = val.GetComponent<PickupIndexNetworker>(); if (Object.op_Implicit((Object)(object)component3)) { component3.NetworkpickupIndex = ((CreatePickupInfo)(ref self.createPickupInfo)).pickupIndex; } YeetData component4 = val.GetComponent<YeetData>(); component4.age = component.age; component4.yeeter = component.yeeter; NetworkServer.Spawn(val); } Object.Destroy((Object)(object)((Component)self).gameObject); } if (flag) { RunArtifactManager.instance.SetArtifactEnabledServer(Artifacts.Command, true); } } else { orig.Invoke(self, collision); } } private GenericPickupController GenericPickupController_CreatePickup(orig_CreatePickup orig, ref CreatePickupInfo createPickupInfo) { return orig.Invoke(ref createPickupInfo); } private void ItemIcon_Awake(orig_Awake orig, ItemIcon self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<YeetButton>(); } private void EquipmentIcon_Update(orig_Update orig, EquipmentIcon self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponent<YeetButton>())) { YeetButton yeetButton = ((Component)self).gameObject.AddComponent<YeetButton>(); yeetButton.isEquipment = true; } } } public class YeetData : MonoBehaviour { public CharacterBody yeeter; public float age; private void FixedUpdate() { age += Time.fixedDeltaTime; } } public class YeetButton : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler { private float holdTimeL; private float holdTimeR; public bool isEquipment; void IPointerDownHandler.OnPointerDown(PointerEventData eventData) { //IL_0001: 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: Invalid comparison between Unknown and I4 if ((int)eventData.button == 0) { holdTimeL = Time.unscaledTime; } else if ((int)eventData.button == 1) { holdTimeR = Time.unscaledTime; } } void IPointerUpHandler.OnPointerUp(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected I4, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected I4, but got Unknown bool flag = (int)eventData.button == 0; bool flag2 = (int)eventData.button == 1; if (flag || flag2) { float num = Time.unscaledTime - (flag ? holdTimeL : holdTimeR); string text = (isEquipment ? ((int)((Component)this).GetComponent<EquipmentIcon>().targetInventory.GetEquipmentIndex()).ToString() : ((int)((Component)this).GetComponent<ItemIcon>().itemIndex).ToString()); if (NetworkUser.readOnlyLocalPlayersList.Count > 0) { Console.instance.SubmitCmd(NetworkUser.readOnlyLocalPlayersList[0], $"yeet {text} {(isEquipment ? 1 : 0)} {num:N4} {(flag ? YeetPlugin.clientConfig.primaryQuantity : YeetPlugin.clientConfig.secondaryQuantity)}", false); } else { YeetPlugin._logger.LogError((object)"Received inventory click event with no active local players!"); } } } }
BepinEx/plugins/tristanmcpherson-R2API/R2API.Legacy/R2API.dll
Decompiled 11 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using R2API; using R2API.ContentManagement; using R2API.MiscHelpers; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.ScriptableObjects; using R2API.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("R2API")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("5.0.5.0")] [assembly: AssemblyInformationalVersion("5.0.5")] [assembly: AssemblyProduct("R2API")] [assembly: AssemblyTitle("R2API")] [assembly: AssemblyVersion("5.0.5.0")] [assembly: TypeForwardedTo(typeof(ArtifactCodeAPI))] [assembly: TypeForwardedTo(typeof(ContentAddition))] [assembly: TypeForwardedTo(typeof(ManagedReadOnlyContentPack))] [assembly: TypeForwardedTo(typeof(ManagedSerializableContentPack))] [assembly: TypeForwardedTo(typeof(R2APIContentManager))] [assembly: TypeForwardedTo(typeof(CustomElite))] [assembly: TypeForwardedTo(typeof(CustomEquipment))] [assembly: TypeForwardedTo(typeof(CustomItem))] [assembly: TypeForwardedTo(typeof(DamageAPI))] [assembly: TypeForwardedTo(typeof(DeployableAPI))] [assembly: TypeForwardedTo(typeof(DifficultyAPI))] [assembly: TypeForwardedTo(typeof(DirectorAPI))] [assembly: TypeForwardedTo(typeof(DotAPI))] [assembly: TypeForwardedTo(typeof(EliteAPI))] [assembly: TypeForwardedTo(typeof(IModdedUnlockableDataProvider))] [assembly: TypeForwardedTo(typeof(ItemAPI))] [assembly: TypeForwardedTo(typeof(ItemDisplayRuleDict))] [assembly: TypeForwardedTo(typeof(LanguageAPI))] [assembly: TypeForwardedTo(typeof(LoadoutAPI))] [assembly: TypeForwardedTo(typeof(LobbyConfigAPI))] [assembly: TypeForwardedTo(typeof(KeyValuePairExtensions))] [assembly: TypeForwardedTo(typeof(Modifier<>))] [assembly: TypeForwardedTo(typeof(ModdedUnlockable))] [assembly: TypeForwardedTo(typeof(INetCommand))] [assembly: TypeForwardedTo(typeof(INetMessage))] [assembly: TypeForwardedTo(typeof(INetRequest<, >))] [assembly: TypeForwardedTo(typeof(INetRequestReply<, >))] [assembly: TypeForwardedTo(typeof(ISerializableObject))] [assembly: TypeForwardedTo(typeof(ISerializer<>))] [assembly: TypeForwardedTo(typeof(NetCommandExtensions))] [assembly: TypeForwardedTo(typeof(NetMessageExtensions))] [assembly: TypeForwardedTo(typeof(NetRequestExtensions))] [assembly: TypeForwardedTo(typeof(SerializableObjectExtensions))] [assembly: TypeForwardedTo(typeof(SerializerExtensions))] [assembly: TypeForwardedTo(typeof(NetworkDestination))] [assembly: TypeForwardedTo(typeof(NetworkingAPI))] [assembly: TypeForwardedTo(typeof(NetworkingHelpers))] [assembly: TypeForwardedTo(typeof(Notification))] [assembly: TypeForwardedTo(typeof(OrbAPI))] [assembly: TypeForwardedTo(typeof(PrefabAPI))] [assembly: TypeForwardedTo(typeof(R2API))] [assembly: TypeForwardedTo(typeof(RecalculateStatsAPI))] [assembly: TypeForwardedTo(typeof(SceneAssetAPI))] [assembly: TypeForwardedTo(typeof(ArtifactCode))] [assembly: TypeForwardedTo(typeof(R2APISerializableContentPack))] [assembly: TypeForwardedTo(typeof(SerializableColorCatalogEntry))] [assembly: TypeForwardedTo(typeof(SerializableDamageColor))] [assembly: TypeForwardedTo(typeof(SerializableDifficultyDef))] [assembly: TypeForwardedTo(typeof(SoundAPI))] [assembly: TypeForwardedTo(typeof(TempVisualEffectAPI))] [assembly: TypeForwardedTo(typeof(UnlockableAPI))] [assembly: TypeForwardedTo(typeof(CecilUtil))] [assembly: TypeForwardedTo(typeof(ChatMessage))] [assembly: TypeForwardedTo(typeof(CommandHelper))] [assembly: TypeForwardedTo(typeof(CompatibilityLevel))] [assembly: TypeForwardedTo(typeof(DirectMessage))] [assembly: TypeForwardedTo(typeof(EmbeddedResources))] [assembly: TypeForwardedTo(typeof(EnumerableExtensions))] [assembly: TypeForwardedTo(typeof(ManualLogSourceExtension))] [assembly: TypeForwardedTo(typeof(NetworkCompatibility))] [assembly: TypeForwardedTo(typeof(R2APISubmoduleDependency))] [assembly: TypeForwardedTo(typeof(Reflection))] [assembly: TypeForwardedTo(typeof(VersionStrictness))]
BepinEx/plugins/viliger-ActualPrinterIcon/viliger-ActualPrinterIcon/ActualPrinterIcon.dll
Decompiled 11 months agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HG.Reflection; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ActualPrinterIcon")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ActualPrinterIcon")] [assembly: AssemblyTitle("ActualPrinterIcon")] [assembly: AssemblyVersion("1.0.0.0")] namespace RoR2_PrintersIcon; [BepInPlugin("com.Viliger.ActualPrinterIcon", "ActualPrinterIcon", "1.0.0")] public class ActualPrinterIcon : BaseUnityPlugin { public void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Sprite sprite = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "actualprintericon")).LoadAsset<Sprite>("texDuplicatorIconOutline"); AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Duplicator/Duplicator.prefab").WaitForCompletion(), sprite); AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorLarge/DuplicatorLarge.prefab").WaitForCompletion(), sprite); AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorMilitary/DuplicatorMilitary.prefab").WaitForCompletion(), sprite); AddPingInfoOverride(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorWild/DuplicatorWild.prefab").WaitForCompletion(), sprite); } private void AddPingInfoOverride(GameObject duplicator, Sprite sprite) { if (Object.op_Implicit((Object)(object)duplicator)) { duplicator.AddComponent<PingInfoProvider>().pingIconOverride = sprite; } } }
BepinEx/plugins/viliger-ShrineOfRepair/viliger-ShrineOfRepair/ShrineOfRepair.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BubbetsItems; using On.RoR2; using On.RoR2.UI; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Hologram; using RoR2.Navigation; using RoR2.UI; using ShrineOfRepair.Modules.Interactables; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ShrineOfRepair")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShrineOfRepair")] [assembly: AssemblyTitle("ShrineOfRepair")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ShrineOfRepair.Modules { public static class BubbetItemsCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("bubbet.bubbetsitems"); } return _enabled.Value; } } public static bool IsVoidLunar(ItemTier tier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return tier == BubbetsItemsPlugin.VoidLunarTier.tier; } } public class ModExtension { public delegate void DictionaryFillItemsDelegate(); public delegate void DictionaryFillEquipmentDelegate(); private struct RepairableItemsNew { public ItemIndex brokenItem; public ItemIndex repairedItem; public string modName; } private struct RepairableEquipment { public EquipmentIndex brokenEquipment; public EquipmentIndex repairedEquipment; public string modName; } [Obsolete("Depricated, please use RepairableItemsNew")] public class RepairableItems { public ItemIndex brokenItem; public ItemIndex repairedItem; } [Obsolete("Deprecated, plese use DictionaryFillItemsDelegate or DictionaryFillEquipmentDelegate")] public delegate void DictionaryFillDelegate(ref List<RepairableItems> list); private static DictionaryFillItemsDelegate fillItemsDictionaryHandler; private static DictionaryFillEquipmentDelegate fillEquipmentDictionaryHandler; private static List<RepairableItemsNew> ModdedItemsListNew = new List<RepairableItemsNew>(); private static List<RepairableEquipment> ModdedEquipmentList = new List<RepairableEquipment>(); [Obsolete("Depricated, please use fillItemsDictionaryHandler or fillEquipmentDictionaryHandler")] public static DictionaryFillDelegate fillDictionaryHandler; [Obsolete("Depricated, please use ModdedItemsListNew or ModdedEquipmentList")] private static List<RepairableItems> ModdedItemsList = new List<RepairableItems>(); public static void AddItemsListener(DictionaryFillItemsDelegate callback) { fillItemsDictionaryHandler = (DictionaryFillItemsDelegate)Delegate.Combine(fillItemsDictionaryHandler, callback); ShrineOfRepairPlugin.MyLogger.LogMessage((object)$"Added {callback.Method} to fillItemsDictionaryHandler"); } public static void AddItemsToList(ItemIndex brokentItem, ItemIndex repairedItem, string modName) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) ModdedItemsListNew.Add(new RepairableItemsNew { brokenItem = brokentItem, repairedItem = repairedItem, modName = modName }); } public static void AddEquipmentListener(DictionaryFillEquipmentDelegate callback) { fillEquipmentDictionaryHandler = (DictionaryFillEquipmentDelegate)Delegate.Combine(fillEquipmentDictionaryHandler, callback); ShrineOfRepairPlugin.MyLogger.LogMessage((object)$"Added {callback.Method} to fillEquipmentDictionaryHandler"); } public static void AddEquipmentToList(EquipmentIndex brokenEquipment, EquipmentIndex repairedEquipment, string modName) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) ModdedEquipmentList.Add(new RepairableEquipment { brokenEquipment = brokenEquipment, repairedEquipment = repairedEquipment, modName = modName }); } internal static Dictionary<ItemIndex, ItemIndex> FillItemDictionaryFromMods(Dictionary<ItemIndex, ItemIndex> dictionary) { //IL_0033: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) if (ModdedItemsListNew.Count == 0) { fillItemsDictionaryHandler?.Invoke(); } foreach (RepairableItemsNew item in ModdedItemsListNew) { if (!dictionary.ContainsKey(item.brokenItem)) { dictionary.Add(item.brokenItem, item.repairedItem); ManualLogSource myLogger = ShrineOfRepairPlugin.MyLogger; ItemDef itemDef = ItemCatalog.GetItemDef(item.brokenItem); string arg = ((itemDef != null) ? ((Object)itemDef).name : null); ItemDef itemDef2 = ItemCatalog.GetItemDef(item.repairedItem); myLogger.LogMessage((object)$"Added item repairs from {arg} to {((itemDef2 != null) ? ((Object)itemDef2).name : null)} from mod {item.modName}."); } } return dictionary; } internal static Dictionary<EquipmentIndex, EquipmentIndex> FillEquipmentDictionaryFromMods(Dictionary<EquipmentIndex, EquipmentIndex> dictionary) { //IL_0033: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) if (ModdedEquipmentList.Count == 0) { fillEquipmentDictionaryHandler?.Invoke(); } foreach (RepairableEquipment moddedEquipment in ModdedEquipmentList) { if (!dictionary.ContainsKey(moddedEquipment.brokenEquipment)) { dictionary.Add(moddedEquipment.brokenEquipment, moddedEquipment.repairedEquipment); ManualLogSource myLogger = ShrineOfRepairPlugin.MyLogger; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(moddedEquipment.brokenEquipment); string arg = ((equipmentDef != null) ? ((Object)equipmentDef).name : null); EquipmentDef equipmentDef2 = EquipmentCatalog.GetEquipmentDef(moddedEquipment.repairedEquipment); myLogger.LogMessage((object)$"Added equipment repairs from {arg} to {((equipmentDef2 != null) ? ((Object)equipmentDef2).name : null)} from mod {moddedEquipment.modName}."); } } return dictionary; } [Obsolete("Depricated, please use AddItemsListener or AddEquipmentListener")] public static void AddListener(DictionaryFillDelegate callback) { fillDictionaryHandler = (DictionaryFillDelegate)Delegate.Combine(fillDictionaryHandler, callback); ShrineOfRepairPlugin.MyLogger.LogMessage((object)$"Added {callback.Method} to dictionaryFillHandler"); } [Obsolete("Deprecated, only used for compatability with older versions.")] public static Dictionary<ItemIndex, ItemIndex> FillDictionaryFromMods(Dictionary<ItemIndex, ItemIndex> dictionary) { //IL_0038: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) if (ModdedItemsList.Count == 0) { fillDictionaryHandler?.Invoke(ref ModdedItemsList); } foreach (RepairableItems moddedItems in ModdedItemsList) { if (!dictionary.ContainsKey(moddedItems.brokenItem)) { dictionary.Add(moddedItems.brokenItem, moddedItems.repairedItem); ManualLogSource myLogger = ShrineOfRepairPlugin.MyLogger; ItemDef itemDef = ItemCatalog.GetItemDef(moddedItems.brokenItem); myLogger.LogMessage((object)$"Added repairs from {((itemDef != null) ? ((Object)itemDef).name : null)} to {((Object)ItemCatalog.GetItemDef(moddedItems.repairedItem)).name} from a mod."); } } return dictionary; } } public static class RiskOfOptionsCompat { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _enabled.Value; } } public static void SetDescription() { ModSettingsManager.SetModDescription("Shrine to repair your broken items.", "com.Viliger.ShrineOfRepair", "ShrineOfRepair"); } public static void SetIcon() { ModSettingsManager.SetModIcon(ShrineofRepairAssets.MainBundle.LoadAsset<Sprite>("texRiskOfOptionsIcon.png"), "com.Viliger.ShrineOfRepair", "ShrineOfRepair"); } public static void CreateNewOption(ConfigEntry<float> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StepSliderOption(entry, new StepSliderConfig { min = 0f, max = 5f, increment = 0.01f })); } public static void CreateNewOption(ConfigEntry<bool> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry)); } public static void CreateNewOption(ConfigEntry<int> entry, int min = 0, int max = 200) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig { min = min, max = max })); } } public class ShrineofRepairAssets { public static AssetBundle MainBundle; public const string BundleName = "shrinerepair"; public const string BundleFolder = "Assets"; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(ShrineOfRepairPlugin.PInfo.Location), "Assets", "shrinerepair"); public void Init() { MainBundle = AssetBundle.LoadFromFile(AssetBundlePath); } } public class ShrineOfRepairConfigManager { public static ConfigEntry<int> DirectorCost; public static ConfigEntry<int> DirectorWeight; public static ConfigEntry<InteractableCategory> DirectorCategory; public static ConfigEntry<bool> UseBadModel; public static ConfigEntry<string> RepairList; public static ConfigEntry<bool> UsePickupPickerPanel; public static ConfigEntry<bool> SpawnInBazaar; public static ConfigEntry<bool> SpawnInMoon; public static ConfigEntry<bool> UseLunarInMoon; public static ConfigEntry<int> MaxUses; public static ConfigEntry<Vector3> BazaarPosition; public static ConfigEntry<Vector3> BazaarAngle; public static ConfigEntry<Vector3> MoonPosition; public static ConfigEntry<Vector3> MoonAngle; public static ConfigEntry<Vector3> Moon2Position; public static ConfigEntry<Vector3> Moon2Angle; public static ConfigEntry<ShrineOfRepairPurchase.CostTypes> PurchaseInteractionCurrencyType; public static ConfigEntry<int> PurchaseInteractionLunarCoinCost; public static ConfigEntry<int> PurchaseInteractionVoidCoinCost; public static ConfigEntry<int> PurchaseInteractionGoldBaseCost; public static ConfigEntry<bool> PurchaseInteractionGoldUseDefaultScaling; public static ConfigEntry<float> PurchaseInteractionGoldScalingModifier; public static ConfigEntry<int> PickerPanelGoldTier1Cost; public static ConfigEntry<int> PickerPanelGoldTier2Cost; public static ConfigEntry<int> PickerPanelGoldTier3Cost; public static ConfigEntry<int> PickerPanelGoldBossCost; public static ConfigEntry<int> PickerPanelGoldLunarCost; public static ConfigEntry<int> PickerPanelGoldEquipCost; public static ConfigEntry<float> BazaarLunarMultiplier; public static ConfigEntry<bool> PickerUseLunarByDefault; public static ConfigEntry<bool> PickerShowFree; public void Init(string configPath) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) ConfigFile val = new ConfigFile(Path.Combine(configPath, "viliger-ShrineOfRepair-General.cfg"), true); UseBadModel = val.Bind<bool>("Model", "Use Shitty Model", false, "Use shitty model that I made myself. If you want to see what bad modeling by bad programmer looks like - be my guest. I made it, so might as well put it here."); DirectorCost = val.Bind<int>("Director", "Director Cost", 20, "Cost of the shrine in director credits. By defeult equal to the cost of most shrines."); DirectorWeight = val.Bind<int>("Director", "Director Weight", 1, "Weight of the shrine for director. The lower the value, the more rare the shrine is. By default has the same weight as Shrine of Order, the only difference is that it can spawn anywhere."); DirectorCategory = val.Bind<InteractableCategory>("Director", "Director Category", (InteractableCategory)4, "Category of interactable. If you change this, then you should also change Director Cost and Director Weight, as default values for those are balanced around it being spawned as a shrine."); RepairList = val.Bind<string>("RepairList", "Repair List", "ExtraLifeConsumed - ExtraLife, ExtraLifeVoidConsumed - ExtraLifeVoid, FragileDamageBonusConsumed - FragileDamageBonus, HealingPotionConsumed - HealingPotion, RegeneratingScrapConsumed - RegeneratingScrap, BossHunterConsumed - BossHunter", "Main Repair List, by default filled with pairs of breakable-original vanilla items, can be used to create custom pairs of brokenItem - repairedItem, including those from mods. Syntax: (broken) - (new), delimiter: ','"); UsePickupPickerPanel = val.Bind<bool>("Interactable Type", "Use Scrapper-like variation", true, "Use scrapper-like variant, with separate cost for each broken item and ability to select what you want to repair. Scrapper-like variant only works with gold. Setting this to false will return the mod to its pre 1.2.0 function. Each variant has its own config file, AllInOne for pre-1.2.0 version and PerItem for newer."); MaxUses = val.Bind<int>("General", "Max Uses", 1, "Amount of times a single shrine can repair before deactivating. Set to 0 for infinite."); UseLunarInMoon = val.Bind<bool>("General", "Use Lunar Coins in Moon", false, "Make the Commencement shrine act like Bazaar shrine."); SpawnInBazaar = val.Bind<bool>("Bazaar", "Spawn Shrine in Bazaar", false, "Spawn the shrine in the Bazaar Between Time."); BazaarPosition = val.Bind<Vector3>("Bazaar", "Shrine Position in Bazaar", new Vector3(-139.5f, -25.5f, -19.9f), "Position of the shrine in the Bazaar Between Time"); BazaarAngle = val.Bind<Vector3>("Bazaar", "Shrine Angle in Bazaar", new Vector3(0f, 0f, 0f), "Angle (rotation) of the shrine in the Bazaar Between Time"); SpawnInMoon = val.Bind<bool>("Commencement", "Spawn Shrine in Moon", true, "Spawn the shrine in Commencement."); MoonPosition = val.Bind<Vector3>("Commencement", "Shrine Position in Commencement (pre-Aniversary)", new Vector3(749.4f, 253f, -244.3f), "Position of the shrine in Commencement (pre-Aniversary)"); MoonAngle = val.Bind<Vector3>("Commencement", "Shrine Angle in Commencement (pre-Aniversary)", new Vector3(0f, 143.2f, 0f), "Angle (rotation) of the shrine in Commencement (pre-Aniversary)"); Moon2Position = val.Bind<Vector3>("Commencement", "Shrine Position in Commencement", new Vector3(-3.9f, -150.6f, -331.2f), "Position of the shrine in Commencement"); Moon2Angle = val.Bind<Vector3>("Commencement", "Shrine Angle in Commencement", new Vector3(-70f, 164f, 0f), "Angle (rotation) of the shrine in Commencement"); ConfigFile val2 = new ConfigFile(Path.Combine(configPath, "viliger-ShrineOfRepair-AllInOne.cfg"), true); PurchaseInteractionCurrencyType = val2.Bind<ShrineOfRepairPurchase.CostTypes>("Currency", "Currency Type", ShrineOfRepairPurchase.CostTypes.Gold, "Type of currency used to purchase shrine. Using anything other than \"Gold\" disables price scaling over time. Each currency has its own options."); PurchaseInteractionLunarCoinCost = val2.Bind<int>("Lunar Coins", "Shrine Base Cost", 2, "Base cost of the interactable in lunar coins. Does not scale with time. Can be used with EphemeralCoins."); PurchaseInteractionVoidCoinCost = val2.Bind<int>("Void Coins", "Shrine Base Cost", 2, "Base cost of the interactable in void coins. Does not scale with time. To be used with ReleasedFromTheVoid."); PurchaseInteractionGoldBaseCost = val2.Bind<int>("Gold", "Shrine Base Cost", 12, "Base cost of the interactable in gold that is used for scaling. Will spawn with this cost at the start of the run."); PurchaseInteractionGoldUseDefaultScaling = val2.Bind<bool>("Gold", "Use Default Scaling", false, "Use default scaling formula instead of custom scaling formula for the shrine. Custom formula is diffCoef^customsScalingModifier * BaseCost, default formula is diffCoef^1.25 * BaseCost * ScalingModifier"); PurchaseInteractionGoldScalingModifier = val2.Bind<float>("Gold", "Scaling Modifier", 1.35f, "Used for defining how cost of shrine scales throughout the run for both default and custom scaling formulas."); ConfigFile val3 = new ConfigFile(Path.Combine(configPath, "viliger-ShrineOfRepair-PerItem.cfg"), true); PickerPanelGoldTier1Cost = val3.Bind<int>("Per Item Repairs", "Tier 1 cost", 12, "Base cost of tier 1 (white) item repair. By default the cost is equal to the half of normal chest price, rounded down."); PickerPanelGoldTier2Cost = val3.Bind<int>("Per Item Repairs", "Tier 2 cost", 25, "Base cost of tier 2 (green) item repair. By default the cost is equal to the half of large chest price."); PickerPanelGoldTier3Cost = val3.Bind<int>("Per Item Repairs", "Tier 3 cost", 200, "Base cost of tier 3 (red) item repair. By default the cost is equal to the half of legendary chest price."); PickerPanelGoldBossCost = val3.Bind<int>("Per Item Repairs", "Boss cost", 50, "Base cost of boss (yellow) item repair. By default the cost is equal to double tier 2 repair price."); PickerPanelGoldLunarCost = val3.Bind<int>("Per Item Repairs", "Lunar cost", 25, "Base cost of lunar (blue) item repair. By default the cost is equal to the half of large chest price."); PickerPanelGoldEquipCost = val3.Bind<int>("Per Item Repairs", "Equipment cost", 50, "Base cost of equipments (orange) repair. By default the cost is equal to double tier 2 repair price."); BazaarLunarMultiplier = val3.Bind<float>("Bazaar Shrines", "Bazaar Lunar Coin Multiplier", 0.04f, "Lunar Coin cost multiplier for Bazaar shrines. Disabled if currency type is not gold. 25 gold per 1 coin by default. set to 0 for free."); PickerUseLunarByDefault = val3.Bind<bool>("Bazaar Shrines", "Use Lunar Coins by Default", false, "Set to true to make every shrine act like Bazaar's shrines."); PickerShowFree = val3.Bind<bool>("Display", "Display Cost for Free", false, "Set to true to display $0 for free entries."); if (RiskOfOptionsCompat.enabled) { RiskOfOptionsCompat.SetDescription(); RiskOfOptionsCompat.SetIcon(); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldTier1Cost); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldTier2Cost); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldTier3Cost, 0, 400); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldBossCost); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldLunarCost); RiskOfOptionsCompat.CreateNewOption(PickerPanelGoldEquipCost); RiskOfOptionsCompat.CreateNewOption(BazaarLunarMultiplier); RiskOfOptionsCompat.CreateNewOption(PickerUseLunarByDefault); RiskOfOptionsCompat.CreateNewOption(PickerShowFree); RiskOfOptionsCompat.CreateNewOption(MaxUses, 0, 50); RiskOfOptionsCompat.CreateNewOption(SpawnInBazaar); RiskOfOptionsCompat.CreateNewOption(SpawnInMoon); } } } public class ShrineOfRepairLanguages { public const string LanguageFileName = "ShrineOfRepair.language"; public const string LanguageFileFolder = "Languages"; public void Init() { LanguageAPI.AddPath(Path.Combine(Path.GetDirectoryName(ShrineOfRepairPlugin.PInfo.Location), "Languages", "ShrineOfRepair.language")); } } [BepInPlugin("com.Viliger.ShrineOfRepair", "ShrineOfRepair", "1.4.1")] [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.*/)] public class ShrineOfRepairPlugin : BaseUnityPlugin { internal static ManualLogSource MyLogger; public static PluginInfo PInfo { get; private set; } private void Awake() { PInfo = ((BaseUnityPlugin)this).Info; MyLogger = ((BaseUnityPlugin)this).Logger; new ShrineofRepairAssets().Init(); new ShrineOfRepairLanguages().Init(); new ShrineOfRepairConfigManager().Init(Paths.ConfigPath); foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(InteractableBase)) select type) { InteractableBase interactableBase = (InteractableBase)Activator.CreateInstance(item); interactableBase.Init(); MyLogger.LogInfo((object)("Interactable: " + interactableBase.InteractableLangToken + " loaded.")); } } } } namespace ShrineOfRepair.Modules.Interactables { public abstract class InteractableBase<T> : InteractableBase where T : InteractableBase<T> { public static T instance { get; private set; } public InteractableBase() { if (instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).FullName + "\" inhereting InteractableBase was instanced twice"); } instance = this as T; } } public abstract class InteractableBase { public abstract string InteractableLangToken { get; } public abstract void Init(); } public abstract class ShrineOfRepairBase<T> : InteractableBase<T> where T : ShrineOfRepairBase<T> { public static Dictionary<ItemIndex, ItemIndex> RepairItemsDictionary = new Dictionary<ItemIndex, ItemIndex>(); public static Dictionary<EquipmentIndex, EquipmentIndex> RepairEquipmentsDictionary = new Dictionary<EquipmentIndex, EquipmentIndex>(); public static InteractableSpawnCard shrineSpawnCard; public override string InteractableLangToken => "SHRINE_REPAIR"; internal abstract GameObject CreateInteractable(GameObject InteractableModel); public static void FillRepairItemsDictionary() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0074: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_013d: 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_00b9: 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) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) if (RepairItemsDictionary.Count != 0 || RepairEquipmentsDictionary.Count != 0) { return; } string[] array = ShrineOfRepairConfigManager.RepairList.Value.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { '-' }); if (array2.Length != 2) { continue; } ItemIndex val = ItemCatalog.FindItemIndex(array2[0].Trim()); ItemIndex val2 = ItemCatalog.FindItemIndex(array2[1].Trim()); if ((int)val != -1 && (int)val2 != -1) { RepairItemsDictionary.Add(val, val2); continue; } EquipmentIndex val3 = EquipmentCatalog.FindEquipmentIndex(array2[0].Trim()); EquipmentIndex val4 = EquipmentCatalog.FindEquipmentIndex(array2[1].Trim()); if ((int)val3 != -1 && (int)val4 != -1) { RepairEquipmentsDictionary.Add(val3, val4); } } RepairItemsDictionary = ModExtension.FillItemDictionaryFromMods(RepairItemsDictionary); RepairItemsDictionary = ModExtension.FillDictionaryFromMods(RepairItemsDictionary); RepairEquipmentsDictionary = ModExtension.FillEquipmentDictionaryFromMods(RepairEquipmentsDictionary); ShrineOfRepairPlugin.MyLogger.LogDebug((object)"Items"); foreach (KeyValuePair<ItemIndex, ItemIndex> item in RepairItemsDictionary) { ShrineOfRepairPlugin.MyLogger.LogDebug((object)(((Object)ItemCatalog.GetItemDef(item.Key)).name + " -> " + ((Object)ItemCatalog.GetItemDef(item.Value)).name)); } ShrineOfRepairPlugin.MyLogger.LogDebug((object)"Equipments"); foreach (KeyValuePair<EquipmentIndex, EquipmentIndex> item2 in RepairEquipmentsDictionary) { ShrineOfRepairPlugin.MyLogger.LogDebug((object)(((Object)EquipmentCatalog.GetEquipmentDef(item2.Key)).name + " -> " + ((Object)EquipmentCatalog.GetEquipmentDef(item2.Value)).name)); } } internal void CreateInteractables() { GameObject interactableModel = CreateInteractable(ShrineOfRepairConfigManager.UseBadModel.Value ? ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepair.prefab") : ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepairGood.prefab")); GameObject interactableModel2 = CreateInteractable(ShrineOfRepairConfigManager.UseBadModel.Value ? ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepair.prefab") : ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepairGood_sandy.prefab")); GameObject interactableModel3 = CreateInteractable(ShrineOfRepairConfigManager.UseBadModel.Value ? ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepair.prefab") : ShrineofRepairAssets.MainBundle.LoadAsset<GameObject>("ShrineRepairGood_snowy.prefab")); shrineSpawnCard = CreateInteractableSpawnCard(interactableModel, "iscShrineRepair", GetNormalStageList()); CreateInteractableSpawnCard(interactableModel2, "iscShrineRepairSandy", GetSandyStageList()); CreateInteractableSpawnCard(interactableModel3, "iscShrineRepairSnowy", GetSnowyStageList()); } private InteractableSpawnCard CreateInteractableSpawnCard(GameObject InteractableModel, string name, List<Stage> stageList) { //IL_001d: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007a: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) InteractableSpawnCard val = ScriptableObject.CreateInstance<InteractableSpawnCard>(); ((Object)val).name = name; ((SpawnCard)val).prefab = InteractableModel; ((SpawnCard)val).sendOverNetwork = true; ((SpawnCard)val).hullSize = (HullClassification)1; ((SpawnCard)val).nodeGraphType = (GraphType)0; ((SpawnCard)val).requiredFlags = (NodeFlags)0; ((SpawnCard)val).forbiddenFlags = (NodeFlags)16; ((SpawnCard)val).directorCreditCost = ShrineOfRepairConfigManager.DirectorCost.Value; ((SpawnCard)val).occupyPosition = true; val.orientToFloor = false; val.skipSpawnWhenSacrificeArtifactEnabled = false; DirectorCard val2 = new DirectorCard { selectionWeight = ShrineOfRepairConfigManager.DirectorWeight.Value, spawnCard = (SpawnCard)(object)val }; foreach (Stage stage in stageList) { Helpers.AddNewInteractableToStage(val2, ShrineOfRepairConfigManager.DirectorCategory.Value, stage, ""); } return val; } private List<Stage> GetNormalStageList() { return new List<Stage> { (Stage)4, (Stage)128, (Stage)2, (Stage)131072, (Stage)256, (Stage)16384, (Stage)134217728, (Stage)64, (Stage)262144, (Stage)1048576, (Stage)4194304, (Stage)33554432, (Stage)524288 }; } private List<Stage> GetSnowyStageList() { return new List<Stage> { (Stage)67108864, (Stage)32, (Stage)2097152 }; } private List<Stage> GetSandyStageList() { return new List<Stage> { (Stage)16, (Stage)8388608 }; } protected void SpawnShrine(Vector3 position, Vector3 angle) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_003a: Expected O, but got Unknown //IL_0035: 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) if (NetworkServer.active) { DirectorPlacementRule val = new DirectorPlacementRule(); val.placementMode = (PlacementMode)0; GameObject spawnedInstance = ((SpawnCard)shrineSpawnCard).DoSpawn(position, Quaternion.identity, new DirectorSpawnRequest((SpawnCard)(object)shrineSpawnCard, val, Run.instance.runRNG)).spawnedInstance; spawnedInstance.transform.eulerAngles = angle; NetworkServer.Spawn(spawnedInstance); } } protected virtual void Hooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown BazaarController.Awake += (hook_Awake)delegate(orig_Awake orig, BazaarController self) { //IL_0019: 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) orig.Invoke(self); if (ShrineOfRepairConfigManager.SpawnInBazaar.Value) { SpawnShrine(ShrineOfRepairConfigManager.BazaarPosition.Value, ShrineOfRepairConfigManager.BazaarAngle.Value); } }; Stage.Start += (hook_Start)delegate(orig_Start orig, Stage self) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (ShrineOfRepairConfigManager.SpawnInMoon.Value) { if ((Object)(object)SceneCatalog.GetSceneDefForCurrentScene() == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon")) { SpawnShrine(ShrineOfRepairConfigManager.MoonPosition.Value, ShrineOfRepairConfigManager.MoonAngle.Value); } else if ((Object)(object)SceneCatalog.GetSceneDefForCurrentScene() == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon2")) { SpawnShrine(ShrineOfRepairConfigManager.Moon2Position.Value, ShrineOfRepairConfigManager.Moon2Angle.Value); } } }; } } public class ShrineOfRepairPicker : ShrineOfRepairBase<ShrineOfRepairPicker> { public class ShrineRepairManager : NetworkBehaviour { public PickupPickerController pickupPickerController; public Transform iconTransform; [SyncVar] public float coefficient; private int uses; private bool useLunarCoins; private Interactor interactor; private static int kRpcHandleInteractionClient; private static int kRpcHandleDeactivateClient; public void Start() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown ((UnityEvent<int>)(object)pickupPickerController.onPickupSelected).AddListener((UnityAction<int>)HandleSelection); ((UnityEvent<Interactor>)(object)pickupPickerController.onServerInteractionBegin).AddListener((UnityAction<Interactor>)HandleInteraction); coefficient = Mathf.Pow(Run.instance.compensatedDifficultyCoefficient, 1.25f); uses = 0; SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); useLunarCoins = ShrineOfRepairConfigManager.PickerUseLunarByDefault.Value || (Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("bazaar") || (ShrineOfRepairConfigManager.UseLunarInMoon.Value && ((Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon") || (Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon2"))); PickupPickerPanel.OnCreateButton += (hook_OnCreateButton)delegate(orig_OnCreateButton orig, PickupPickerPanel self, int index, MPButton button) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, index, button); if (((Object)self).name.Contains("ShrineRepair") && (Object)(object)self == (Object)(object)pickupPickerController.panelInstanceController) { CharacterMaster obj = (Object.op_Implicit((Object)(object)interactor) ? ((Component)interactor).GetComponent<CharacterBody>().master : LocalUserManager.GetFirstLocalUser().cachedMasterController.master); PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickerController.options[index].pickupIndex); ShrineOfRepairBase<ShrineOfRepairPicker>.FillRepairItemsDictionary(); ItemIndex value; bool flag = ShrineOfRepairBase<ShrineOfRepairPicker>.RepairItemsDictionary.TryGetValue(pickupDef.itemIndex, out value); int itemCount = obj.inventory.GetItemCount(pickupDef.itemIndex); ItemTier tier = ItemCatalog.GetItemDef(value).tier; if (flag || ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary.ContainsKey(pickupDef.equipmentIndex)) { ShrineOfRepairPlugin.MyLogger.LogMessage((object)$"Price for {pickupDef.nameToken}x{itemCount} is {(flag ? GetTotalStackCost(tier, itemCount) : GetEquipmentCost())}"); if (ShrineOfRepairConfigManager.PickerShowFree.Value || (flag ? GetTotalStackCost(tier, itemCount) : GetEquipmentCost()) != 0) { GameObject val = new GameObject("CostText"); val.transform.SetParent(((Component)button).transform); val.layer = 5; RectTransform val2 = val.AddComponent<RectTransform>(); HGTextMeshProUGUI obj2 = val.AddComponent<HGTextMeshProUGUI>(); ((TMP_Text)obj2).enableWordWrapping = false; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)1026; ((TMP_Text)obj2).fontSize = 20f; ((TMP_Text)obj2).faceColor = Color32.op_Implicit(useLunarCoins ? Color.white : Color.yellow); ((TMP_Text)obj2).outlineWidth = 0.2f; ((TMP_Text)obj2).text = (useLunarCoins ? "<sprite name=\"LunarCoin\" tint=1>" : "$") + (flag ? GetTotalStackCost(tier, itemCount) : GetEquipmentCost()); ((Transform)val2).localPosition = Vector3.zero; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; ((Transform)val2).localScale = Vector3.one; val2.sizeDelta = new Vector2(-10f, -4f); val2.anchoredPosition = Vector2.zero; } } } }; } public void OnDestroy() { ((UnityEvent<int>)(object)pickupPickerController.onPickupSelected).RemoveListener((UnityAction<int>)HandleSelection); ((UnityEvent<Interactor>)(object)pickupPickerController.onServerInteractionBegin).RemoveListener((UnityAction<Interactor>)HandleInteraction); } [Server] public void HandleSelection(int selection) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown CallRpcHandleInteractionClient(); if (!NetworkServer.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"[Server] function 'ShrineOfRepair.Interactables.ShrineOfRepairManager::HandleSelection(int)' called on client"); return; } ShrineOfRepairPlugin.MyLogger.LogMessage((object)("Selected " + selection)); if (!Object.op_Implicit((Object)(object)interactor)) { return; } PickupDef pickupDef = PickupCatalog.GetPickupDef(new PickupIndex(selection)); CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); int itemCount = component.inventory.GetItemCount(pickupDef.itemIndex); ShrineOfRepairBase<ShrineOfRepairPicker>.FillRepairItemsDictionary(); ItemIndex value; bool flag = ShrineOfRepairBase<ShrineOfRepairPicker>.RepairItemsDictionary.TryGetValue(pickupDef.itemIndex, out value); ItemTier tier = ItemCatalog.GetItemDef(value).tier; if (!flag && !ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary.ContainsKey(pickupDef.equipmentIndex)) { return; } uint num = (flag ? GetTotalStackCost(tier, itemCount) : GetEquipmentCost()); if (num > (useLunarCoins ? component.master.playerCharacterMasterController.networkUser.lunarCoins : component.master.money)) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)$"Somehow player {component.GetUserName()} ({((Object)component).name}) has less currency than price of {pickupDef.nameToken}x{itemCount}, yet it was available at the start of interaction. Doing nothing..."); return; } string colorHexString; string @string; string text; if (flag) { component.inventory.RemoveItem(pickupDef.itemIndex, itemCount); component.inventory.GiveItem(value, itemCount); CharacterMasterNotificationQueue.SendTransformNotification(component.master, pickupDef.itemIndex, value, (TransformationType)0); colorHexString = ColorCatalog.GetColorHexString(ItemTierCatalog.GetItemTierDef(tier).colorIndex); @string = Language.GetString(ItemCatalog.GetItemDef(value).nameToken); text = ((itemCount == 1) ? "" : ("<style=\"cEvent\">(" + itemCount + ")</style>")); } else { component.inventory.SetEquipmentIndex(ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary[pickupDef.equipmentIndex]); CharacterMasterNotificationQueue.PushEquipmentTransformNotification(component.master, pickupDef.equipmentIndex, ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary[pickupDef.equipmentIndex], (TransformationType)0); colorHexString = ColorCatalog.GetColorHexString(EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex).colorIndex); @string = Language.GetString(EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex).nameToken); text = ""; } if (useLunarCoins) { component.master.playerCharacterMasterController.networkUser.DeductLunarCoins(num); } else { CharacterMaster master = component.master; master.money -= num; } ShrineOfRepairPlugin.MyLogger.LogMessage((object)string.Format("Player {0} ({1}) paid {2} {3} to repair {4}x{5}", component.GetUserName(), ((Object)component).name, num, useLunarCoins ? "lunar coins" : "money", pickupDef.nameToken, itemCount)); EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = ((Component)this).gameObject.transform.position, rotation = Quaternion.identity, scale = 1f, color = Color32.op_Implicit(Color.red) }, true); SubjectFormatChatMessage val = new SubjectFormatChatMessage(); ((SubjectChatMessage)val).subjectAsCharacterBody = component; ((SubjectChatMessage)val).baseToken = "INTERACTABLE_SHRINE_REPAIR_INTERACT_PICKER"; val.paramTokens = new string[2] { "<color=#" + colorHexString + ">" + @string + "</color>", text }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); Object.Destroy((Object)(object)pickupPickerController.panelInstance); uses++; if (uses == ShrineOfRepairConfigManager.MaxUses.Value) { CallRpcHandleDeactivateClient(); pickupPickerController.SetAvailable(false); ((Component)iconTransform).gameObject.SetActive(false); } } [Server] public void HandleInteraction(Interactor interactor) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"[Server] function 'ShrineOfRepair.Interactables.ShrineOfRepairManager::HandleInteraction(RoR2.Interactor)' called on client"); return; } this.interactor = interactor; List<Option> list = new List<Option>(); CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.master)) { return; } uint num = (useLunarCoins ? component.master.playerCharacterMasterController.networkUser.lunarCoins : component.master.money); ShrineOfRepairBase<ShrineOfRepairPicker>.FillRepairItemsDictionary(); foreach (KeyValuePair<ItemIndex, ItemIndex> item in ShrineOfRepairBase<ShrineOfRepairPicker>.RepairItemsDictionary) { int itemCount = component.inventory.GetItemCount(item.Key); if (itemCount > 0) { list.Add(new Option { available = (num >= GetTotalStackCost(ItemCatalog.GetItemDef(item.Value).tier, itemCount)), pickupIndex = PickupCatalog.FindPickupIndex(item.Key) }); } } if (ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary.ContainsKey(component.equipmentSlot.equipmentIndex)) { list.Add(new Option { available = (num >= GetEquipmentCost()), pickupIndex = PickupCatalog.FindPickupIndex(component.equipmentSlot.equipmentIndex) }); } pickupPickerController.SetOptionsServer(list.ToArray()); } private int GetCostFromItemTier(ItemTier tier) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected I4, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (BubbetItemsCompat.enabled && BubbetItemsCompat.IsVoidLunar(tier)) { return ShrineOfRepairConfigManager.PickerPanelGoldLunarCost.Value; } switch ((int)tier) { case 0: case 6: return ShrineOfRepairConfigManager.PickerPanelGoldTier1Cost.Value; default: return ShrineOfRepairConfigManager.PickerPanelGoldTier2Cost.Value; case 2: case 8: return ShrineOfRepairConfigManager.PickerPanelGoldTier3Cost.Value; case 4: case 9: return ShrineOfRepairConfigManager.PickerPanelGoldBossCost.Value; case 3: return ShrineOfRepairConfigManager.PickerPanelGoldLunarCost.Value; } } private uint GetTotalStackCost(ItemTier tier, int numberOfItems) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (GetCostFromItemTier(tier) <= 0) { return 0u; } uint num = (uint)((float)(GetCostFromItemTier(tier) * numberOfItems) * (useLunarCoins ? ShrineOfRepairConfigManager.BazaarLunarMultiplier.Value : coefficient)); if (num == 0) { return 1u; } return num; } private uint GetEquipmentCost() { if (ShrineOfRepairConfigManager.PickerPanelGoldEquipCost.Value <= 0) { return 0u; } uint num = (uint)((float)ShrineOfRepairConfigManager.PickerPanelGoldEquipCost.Value * (useLunarCoins ? ShrineOfRepairConfigManager.BazaarLunarMultiplier.Value : coefficient)); if (num == 0) { return 1u; } return num; } private void CallRpcHandleInteractionClient() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"RPC Function CallRpcHandleInteractionClient called on client."); return; } ShrineOfRepairPlugin.MyLogger.LogMessage((object)"RPC Function CallRpcHandleInteractionClient, sending message to clients"); NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcHandleInteractionClient); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcHandleInteractionClient"); } private void CallRpcHandleDeactivateClient() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"RPC Function CallRpcHandleDeactivateClient called on client."); return; } ShrineOfRepairPlugin.MyLogger.LogMessage((object)"RPC Function CallRpcHandleDeactivateClient, sending message to clients"); NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcHandleDeactivateClient); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcHandleDeactivateClient"); } protected static void InvokeRpcHandleInteractionClient(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"RPC RpcHandleInteractionClient called on server."); } else { ((ShrineRepairManager)(object)obj).RpcHandleInteactionClient(); } } protected static void InvokeRpcHandleDeactivateClient(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"RPC RpcHandleDeactivateClient called on server."); } else { ((ShrineRepairManager)(object)obj).RpcHandleDeactivateClient(); } } [ClientRpc] public void RpcHandleInteactionClient() { ShrineOfRepairPlugin.MyLogger.LogMessage((object)"RPC RpcHandleInteactionClient message recieved"); if (Object.op_Implicit((Object)(object)pickupPickerController) && Object.op_Implicit((Object)(object)pickupPickerController.panelInstance)) { Object.Destroy((Object)(object)pickupPickerController.panelInstance); } } [ClientRpc] public void RpcHandleDeactivateClient() { ShrineOfRepairPlugin.MyLogger.LogMessage((object)"RPC RpcHandleDeactivateClient message recieved"); if (Object.op_Implicit((Object)(object)iconTransform)) { ((Component)iconTransform).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)pickupPickerController)) { pickupPickerController.available = false; } } static ShrineRepairManager() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown kRpcHandleInteractionClient = 1268743049; NetworkBehaviour.RegisterRpcDelegate(typeof(ShrineRepairManager), kRpcHandleInteractionClient, new CmdDelegate(InvokeRpcHandleInteractionClient)); kRpcHandleDeactivateClient = 1631732147; NetworkBehaviour.RegisterRpcDelegate(typeof(ShrineRepairManager), kRpcHandleDeactivateClient, new CmdDelegate(InvokeRpcHandleDeactivateClient)); NetworkCRC.RegisterBehaviour("ShrineRepairManager", 0); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<MeshRenderer, bool> <>9__1_0; public static hook_Awake <>9__2_0; public static hook_GetInteractability <>9__2_1; internal bool <CreateInteractable>b__1_0(MeshRenderer x) { return ((Object)((Component)x).gameObject).name.Contains("mdlRepairShrine"); } internal void <Hooks>b__2_0(orig_Awake orig, PickupPickerPanel self) { orig.Invoke(self); if (!((Object)self).name.Contains("ShrineRepair")) { return; } Transform val = ((Component)self).transform.Find("MainPanel"); if (!((Object)(object)val != (Object)null)) { return; } Transform val2 = ((Component)val).transform.Find("Juice"); if (!((Object)(object)val2 != (Object)null)) { return; } Transform val3 = ((Component)val2).transform.Find("Label"); if ((Object)(object)val3 != (Object)null) { LanguageTextMeshController component = ((Component)val3).GetComponent<LanguageTextMeshController>(); if ((Object)(object)component != (Object)null) { component.token = "INTERACTABLE_SHRINE_REPAIR_PICKERPANEL_HEADER"; component.ResolveString(); } } } internal Interactability <Hooks>b__2_1(orig_GetInteractability orig, PickupPickerController self, Interactor activator) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (((Object)self).name.Contains("ShrineRepair") && Object.op_Implicit((Object)(object)activator)) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master)) { bool flag = false; ShrineOfRepairBase<ShrineOfRepairPicker>.FillRepairItemsDictionary(); foreach (KeyValuePair<ItemIndex, ItemIndex> item in ShrineOfRepairBase<ShrineOfRepairPicker>.RepairItemsDictionary) { if (component.inventory.GetItemCount(item.Key) > 0) { flag = true; } } foreach (KeyValuePair<EquipmentIndex, EquipmentIndex> item2 in ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary) { if (component.equipmentSlot.equipmentIndex == item2.Key) { flag = true; } } if (!flag) { return (Interactability)1; } } } return orig.Invoke(self, activator); } } public override void Init() { if (ShrineOfRepairConfigManager.UsePickupPickerPanel.Value) { CreateInteractables(); Hooks(); } } internal override GameObject CreateInteractable(GameObject InteractableModel) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) InteractableModel.AddComponent<NetworkIdentity>(); PickupPickerController val = InteractableModel.AddComponent<PickupPickerController>(); val.contextString = "INTERACTABLE_" + InteractableLangToken + "_CONTEXT"; GameObject val2 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Scrapper/ScrapperPickerPanel.prefab").WaitForCompletion(), "ShrineRepairPickerPanel"); val2.AddComponent<NetworkIdentity>(); val.panelPrefab = val2; val.cutoffDistance = 10f; InteractableModel.AddComponent<PingInfoProvider>().pingIconOverride = ShrineofRepairAssets.MainBundle.LoadAsset<Sprite>("Assets/RoR2/Base/Common/MiscIcons/texShrineIconOutlined.png"); InteractableModel.AddComponent<GenericDisplayNameProvider>().displayToken = "INTERACTABLE_" + InteractableLangToken + "_NAME"; ((Component)InteractableModel.GetComponentInChildren<MeshCollider>()).gameObject.AddComponent<EntityLocator>().entity = InteractableModel; ModelLocator obj = InteractableModel.AddComponent<ModelLocator>(); obj.modelTransform = InteractableModel.transform.Find("mdlRepairShrine"); obj.modelBaseTransform = InteractableModel.transform.Find("Base"); obj.dontDetatchFromParent = true; obj.autoUpdateModelTransform = true; Highlight obj2 = InteractableModel.AddComponent<Highlight>(); obj2.targetRenderer = (Renderer)(object)(from x in InteractableModel.GetComponentsInChildren<MeshRenderer>() where ((Object)((Component)x).gameObject).name.Contains("mdlRepairShrine") select x).First(); obj2.strength = 1f; obj2.highlightColor = (HighlightColor)0; Transform val3 = InteractableModel.transform.Find("Icon"); ((Component)val3).gameObject.AddComponent<Billboard>(); Material material = ((Renderer)((Component)LegacyResourcesAPI.Load<SpawnCard>("spawncards/interactablespawncard/iscShrineBoss").prefab.transform.Find("Symbol")).GetComponent<MeshRenderer>()).material; SpriteRenderer component = ((Component)val3).GetComponent<SpriteRenderer>(); Texture mainTexture = ((Renderer)component).material.mainTexture; Color color = component.color; ((Renderer)component).material = new Material(material.shader); ((Renderer)component).material.CopyPropertiesFromMaterial(material); ((Renderer)component).material.mainTexture = mainTexture; ((Renderer)component).material.SetColor("_TintColor", color); ShrineRepairManager shrineRepairManager = InteractableModel.AddComponent<ShrineRepairManager>(); shrineRepairManager.pickupPickerController = val; shrineRepairManager.iconTransform = val3; PrefabAPI.RegisterNetworkPrefab(InteractableModel); return InteractableModel; } protected override void Hooks() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_003e: 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_0049: Expected O, but got Unknown base.Hooks(); object obj = <>c.<>9__2_0; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, PickupPickerPanel self) { orig.Invoke(self); if (((Object)self).name.Contains("ShrineRepair")) { Transform val3 = ((Component)self).transform.Find("MainPanel"); if ((Object)(object)val3 != (Object)null) { Transform val4 = ((Component)val3).transform.Find("Juice"); if ((Object)(object)val4 != (Object)null) { Transform val5 = ((Component)val4).transform.Find("Label"); if ((Object)(object)val5 != (Object)null) { LanguageTextMeshController component2 = ((Component)val5).GetComponent<LanguageTextMeshController>(); if ((Object)(object)component2 != (Object)null) { component2.token = "INTERACTABLE_SHRINE_REPAIR_PICKERPANEL_HEADER"; component2.ResolveString(); } } } } } }; <>c.<>9__2_0 = val; obj = (object)val; } PickupPickerPanel.Awake += (hook_Awake)obj; object obj2 = <>c.<>9__2_1; if (obj2 == null) { hook_GetInteractability val2 = delegate(orig_GetInteractability orig, PickupPickerController self, Interactor activator) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (((Object)self).name.Contains("ShrineRepair") && Object.op_Implicit((Object)(object)activator)) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master)) { bool flag = false; ShrineOfRepairBase<ShrineOfRepairPicker>.FillRepairItemsDictionary(); foreach (KeyValuePair<ItemIndex, ItemIndex> item in ShrineOfRepairBase<ShrineOfRepairPicker>.RepairItemsDictionary) { if (component.inventory.GetItemCount(item.Key) > 0) { flag = true; } } foreach (KeyValuePair<EquipmentIndex, EquipmentIndex> item2 in ShrineOfRepairBase<ShrineOfRepairPicker>.RepairEquipmentsDictionary) { if (component.equipmentSlot.equipmentIndex == item2.Key) { flag = true; } } if (!flag) { return (Interactability)1; } } } return orig.Invoke(self, activator); }; <>c.<>9__2_1 = val2; obj2 = (object)val2; } PickupPickerController.GetInteractability += (hook_GetInteractability)obj2; } } public class ShrineOfRepairPurchase : ShrineOfRepairBase<ShrineOfRepairPurchase> { public enum CostTypes { Gold, VoidCoin, LunarCoin } public class RepairShrineManager : NetworkBehaviour { public PurchaseInteraction PurchaseInteraction; public float ScalingModifier; public bool UseDefaultScaling; [SyncVar] public int BaseCostDetermination; public int uses; public void Start() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance)) { PurchaseInteraction.SetAvailable(true); } ((UnityEvent<Interactor>)(object)PurchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)RepairPurchaseAttempt); if ((int)PurchaseInteraction.costType == 1) { SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); if ((Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("bazaar") || (ShrineOfRepairConfigManager.UseLunarInMoon.Value && ((Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon") || (Object)(object)sceneDefForCurrentScene == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("moon2")))) { PurchaseInteraction.costType = (CostTypeIndex)3; PurchaseInteraction.automaticallyScaleCostWithDifficulty = false; BaseCostDetermination = ShrineOfRepairConfigManager.PurchaseInteractionLunarCoinCost.Value; PurchaseInteraction.cost = BaseCostDetermination; } else { BaseCostDetermination = (UseDefaultScaling ? ((int)((float)PurchaseInteraction.cost * ScalingModifier)) : ((int)(Mathf.Pow(Run.instance.compensatedDifficultyCoefficient, ScalingModifier) * (float)PurchaseInteraction.cost))); PurchaseInteraction.cost = BaseCostDetermination; } } else { BaseCostDetermination = PurchaseInteraction.cost; PurchaseInteraction.cost = BaseCostDetermination; } uses = 0; } [Server] public void RepairPurchaseAttempt(Interactor interactor) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_009d: 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_0130: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0116: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown if (!NetworkServer.active) { ShrineOfRepairPlugin.MyLogger.LogWarning((object)"[Server] function 'ShrineOfRepair.Interactables.ShrineOfRepair::RepairPurchaseAttempt(RoR2.Interactor)' called on client"); } else { if (!Object.op_Implicit((Object)(object)interactor)) { return; } CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.master)) { return; } Inventory inventory = component.inventory; ShrineOfRepairBase<ShrineOfRepairPurchase>.FillRepairItemsDictionary(); foreach (KeyValuePair<ItemIndex, ItemIndex> item in ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairItemsDictionary) { int itemCount = inventory.GetItemCount(item.Key); if (itemCount > 0) { inventory.RemoveItem(item.Key, itemCount); inventory.GiveItem(item.Value, itemCount); CharacterMasterNotificationQueue.SendTransformNotification(component.master, item.Key, item.Value, (TransformationType)0); } } if (ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairEquipmentsDictionary.ContainsKey(component.equipmentSlot.equipmentIndex)) { inventory.SetEquipmentIndex(ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairEquipmentsDictionary[component.equipmentSlot.equipmentIndex]); CharacterMasterNotificationQueue.PushEquipmentTransformNotification(component.master, component.equipmentSlot.equipmentIndex, ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairEquipmentsDictionary[component.equipmentSlot.equipmentIndex], (TransformationType)0); } EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = ((Component)this).gameObject.transform.position, rotation = Quaternion.identity, scale = 1f, color = Color32.op_Implicit(Color.red) }, true); uses++; if (uses == ShrineOfRepairConfigManager.MaxUses.Value) { ((Component)((Component)this).gameObject.transform.Find("Icon")).gameObject.SetActive(false); } Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage { subjectAsCharacterBody = ((Component)interactor).GetComponent<CharacterBody>(), baseToken = "INTERACTABLE_SHRINE_REPAIR_INTERACT" }); if (NetworkServer.active && uses == ShrineOfRepairConfigManager.MaxUses.Value) { PurchaseInteraction.SetAvailable(false); } } } } public override void Init() { if (!ShrineOfRepairConfigManager.UsePickupPickerPanel.Value) { new ShrineofRepairAssets().Init(); CreateInteractables(); Hooks(); } } internal override GameObject CreateInteractable(GameObject InteractableModel) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) InteractableModel.AddComponent<NetworkIdentity>(); PurchaseInteraction val = InteractableModel.AddComponent<PurchaseInteraction>(); val.displayNameToken = "INTERACTABLE_" + InteractableLangToken + "_NAME"; val.contextToken = "INTERACTABLE_" + InteractableLangToken + "_CONTEXT"; val.costType = GetCostTypeFromConfig(ShrineOfRepairConfigManager.PurchaseInteractionCurrencyType.Value); val.automaticallyScaleCostWithDifficulty = ShrineOfRepairConfigManager.PurchaseInteractionCurrencyType.Value == CostTypes.Gold && ShrineOfRepairConfigManager.PurchaseInteractionGoldUseDefaultScaling.Value; val.cost = GetCostValueFromConfig(ShrineOfRepairConfigManager.PurchaseInteractionCurrencyType.Value); val.available = true; val.setUnavailableOnTeleporterActivated = false; val.isShrine = true; val.isGoldShrine = false; InteractableModel.AddComponent<PingInfoProvider>().pingIconOverride = ShrineofRepairAssets.MainBundle.LoadAsset<Sprite>("Assets/RoR2/Base/Common/MiscIcons/texShrineIconOutlined.png"); InteractableModel.AddComponent<GenericDisplayNameProvider>().displayToken = "INTERACTABLE_" + InteractableLangToken + "_NAME"; RepairShrineManager repairShrineManager = InteractableModel.AddComponent<RepairShrineManager>(); repairShrineManager.PurchaseInteraction = val; repairShrineManager.ScalingModifier = ShrineOfRepairConfigManager.PurchaseInteractionGoldScalingModifier.Value; repairShrineManager.UseDefaultScaling = ShrineOfRepairConfigManager.PurchaseInteractionGoldUseDefaultScaling.Value; ((Component)InteractableModel.GetComponentInChildren<MeshCollider>()).gameObject.AddComponent<EntityLocator>().entity = InteractableModel; ModelLocator obj = InteractableModel.AddComponent<ModelLocator>(); obj.modelTransform = InteractableModel.transform.Find("mdlRepairShrine"); obj.modelBaseTransform = InteractableModel.transform.Find("Base"); obj.dontDetatchFromParent = true; obj.autoUpdateModelTransform = true; HologramProjector obj2 = InteractableModel.AddComponent<HologramProjector>(); obj2.hologramPivot = InteractableModel.transform.Find("HologramPivot"); obj2.displayDistance = 10f; obj2.disableHologramRotation = false; Highlight component = InteractableModel.GetComponent<Highlight>(); component.targetRenderer = (Renderer)(object)(from x in InteractableModel.GetComponentsInChildren<MeshRenderer>() where ((Object)((Component)x).gameObject).name.Contains("mdlRepairShrine") select x).First(); component.strength = 1f; component.highlightColor = (HighlightColor)0; Transform obj3 = InteractableModel.transform.Find("Icon"); ((Component)obj3).gameObject.AddComponent<Billboard>(); Material material = ((Renderer)((Component)LegacyResourcesAPI.Load<SpawnCard>("spawncards/interactablespawncard/iscShrineBoss").prefab.transform.Find("Symbol")).GetComponent<MeshRenderer>()).material; SpriteRenderer component2 = ((Component)obj3).GetComponent<SpriteRenderer>(); Texture mainTexture = ((Renderer)component2).material.mainTexture; Color color = component2.color; ((Renderer)component2).material = new Material(material.shader); ((Renderer)component2).material.CopyPropertiesFromMaterial(material); ((Renderer)component2).material.mainTexture = mainTexture; ((Renderer)component2).material.SetColor("_TintColor", color); PrefabAPI.RegisterNetworkPrefab(InteractableModel); return InteractableModel; } private CostTypeIndex GetCostTypeFromConfig(CostTypes currency) { switch (currency) { case CostTypes.LunarCoin: if (ShrineOfRepairConfigManager.PurchaseInteractionLunarCoinCost.Value != 0) { return (CostTypeIndex)3; } return (CostTypeIndex)0; case CostTypes.VoidCoin: if (ShrineOfRepairConfigManager.PurchaseInteractionVoidCoinCost.Value != 0) { return (CostTypeIndex)14; } return (CostTypeIndex)0; default: if (ShrineOfRepairConfigManager.PurchaseInteractionGoldBaseCost.Value != 0) { return (CostTypeIndex)1; } return (CostTypeIndex)0; } } private int GetCostValueFromConfig(CostTypes currency) { return currency switch { CostTypes.LunarCoin => ShrineOfRepairConfigManager.PurchaseInteractionLunarCoinCost.Value, CostTypes.VoidCoin => ShrineOfRepairConfigManager.PurchaseInteractionVoidCoinCost.Value, _ => ShrineOfRepairConfigManager.PurchaseInteractionGoldBaseCost.Value, }; } protected override void Hooks() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown base.Hooks(); PurchaseInteraction.GetInteractability += (hook_GetInteractability)delegate(orig_GetInteractability orig, PurchaseInteraction self, Interactor activator) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (self.displayNameToken == "INTERACTABLE_" + InteractableLangToken + "_NAME" && Object.op_Implicit((Object)(object)activator)) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master)) { bool flag = false; ShrineOfRepairBase<ShrineOfRepairPurchase>.FillRepairItemsDictionary(); foreach (KeyValuePair<ItemIndex, ItemIndex> item in ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairItemsDictionary) { if (component.inventory.GetItemCount(item.Key) > 0) { flag = true; } } if (ShrineOfRepairBase<ShrineOfRepairPurchase>.RepairEquipmentsDictionary.ContainsKey(component.equipmentSlot.equipmentIndex)) { flag = true; } if (!flag) { return (Interactability)1; } } } return orig.Invoke(self, activator); }; } } }
BepinEx/plugins/XoXFaby-BetterGameplay/BetterGameplay.dll
Decompiled 11 months agousing 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 BetterUnityPlugin; using RoR2; using RoR2.Navigation; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BetterGameplay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.3.0")] [assembly: AssemblyInformationalVersion("1.1.3+Branch.tags-v1.1.3.Sha.0815cd4060ca2777c4a777cdc54d8378a63eb44a")] [assembly: AssemblyProduct("BetterGameplay")] [assembly: AssemblyTitle("BetterGameplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.3.0")] [module: UnverifiableCode] namespace BetterGameplay; [BepInPlugin("com.xoxfaby.BetterGameplay", "BetterGameplay", "1.1.3")] public class BetterGameplayPlugin : BetterUnityPlugin<BetterGameplayPlugin> { public const string GUID = "com.xoxfaby.BetterGameplay"; public const string Name = "BetterGameplay"; public const string Version = "1.1.3"; public override BaseUnityPlugin typeReference { get { throw new NotImplementedException(); } } private static void MapZone_Awake(Action<MapZone> orig, MapZone self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) orig(self); if ((int)self.zoneType == 0) { ((Component)self).gameObject.layer = 29; } } private static void MapZone_TryZoneStart(Action<MapZone, Collider> orig, MapZone self, Collider collider) { //IL_0001: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0079: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) if ((int)self.zoneType == 0 && (Object.op_Implicit((Object)(object)((Component)collider).GetComponent<PickupDropletController>()) || Object.op_Implicit((Object)(object)((Component)collider).GetComponent<GenericPickupController>()))) { SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>(); val.hullSize = (HullClassification)0; val.nodeGraphType = (GraphType)0; val.prefab = Resources.Load<GameObject>("SpawnCards/HelperPrefab"); GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)3, position = ((Component)collider).transform.position }, RoR2Application.rng)); if (Object.op_Implicit((Object)(object)val2)) { TeleportHelper.TeleportGameObject(((Component)collider).gameObject, val2.transform.position); Object.Destroy((Object)(object)val2); } Object.Destroy((Object)(object)val); } orig(self, collider); } private static bool EquipmentSlot_ExecuteIfReady(Func<EquipmentSlot, bool> orig, EquipmentSlot self) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.inventory != (Object)null && self.inventory.GetItemCount(ItemCatalog.FindItemIndex("AutoCastEquipment")) > 0 && SceneInfo.instance.sceneDef.nameToken == "MAP_BAZAAR_TITLE") { return false; } return orig(self); } private static void Inventory_UpdateEquipment(Action<Inventory> orig, Inventory self) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (self.GetItemCount(ItemCatalog.FindItemIndex("AutoCastEquipment")) > 0 && SceneInfo.instance.sceneDef.nameToken == "MAP_BAZAAR_TITLE") { for (int i = 0; i < self.equipmentStateSlots.Length; i++) { self.equipmentStateSlots[i].chargeFinishTime.t += Time.deltaTime; } } else { orig(self); } } protected override void Awake() { base.Awake(); for (int i = 0; i < 32; i++) { Physics.IgnoreLayerCollision(29, i, Physics.GetIgnoreLayerCollision(15, i)); } Physics.IgnoreLayerCollision(29, 8, false); Physics.IgnoreLayerCollision(29, 13, false); BetterUnityPlugin<BetterGameplayPlugin>.Hooks.Add<MapZone>("Awake", (Action<Action<MapZone>, MapZone>)MapZone_Awake, BindingFlags.Default); BetterUnityPlugin<BetterGameplayPlugin>.Hooks.Add<MapZone, Collider>("TryZoneStart", (Action<Action<MapZone, Collider>, MapZone, Collider>)MapZone_TryZoneStart, BindingFlags.Default); BetterUnityPlugin<BetterGameplayPlugin>.Hooks.Add<EquipmentSlot, bool>("ExecuteIfReady", (Func<Func<EquipmentSlot, bool>, EquipmentSlot, bool>)EquipmentSlot_ExecuteIfReady, BindingFlags.Default); BetterUnityPlugin<BetterGameplayPlugin>.Hooks.Add<Inventory>("UpdateEquipment", (Action<Action<Inventory>, Inventory>)Inventory_UpdateEquipment, BindingFlags.Default); } }
BepinEx/plugins/XoXFaby-BetterGameplay/BetterUnityPlugin.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using MonoMod.Cil; using MonoMod.RuntimeDetour; 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("BetterUnityPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterUnityPlugin")] [assembly: AssemblyTitle("BetterUnityPlugin")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterUnityPlugin; public abstract class BetterUnityPlugin<T> : BaseUnityPlugin { public class HookManager { private List<(MethodInfo methodFrom, MethodInfo methodTo)> hookSignatures = new List<(MethodInfo, MethodInfo)>(); private List<(MethodInfo methodFrom, Manipulator ILHookMethod)> ILHookMethods = new List<(MethodInfo, Manipulator)>(); private List<Hook> hooks = new List<Hook>(); private List<ILHook> ILHooks = new List<ILHook>(); private bool enabled = false; public HookManager() { BetterUnityPlugin<T>.onEnable += BetterUnityPlugin_onEnable; BetterUnityPlugin<T>.onDisable += BetterUnityPlugin_onDisable; } private void BetterUnityPlugin_onEnable() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown enabled = true; foreach (var hookSignature in hookSignatures) { hooks.Add(new Hook((MethodBase)hookSignature.methodFrom, hookSignature.methodTo)); } foreach (var iLHookMethod in ILHookMethods) { ILHooks.Add(new ILHook((MethodBase)iLHookMethod.methodFrom, iLHookMethod.ILHookMethod)); } } private void BetterUnityPlugin_onDisable() { enabled = false; foreach (Hook hook in hooks) { hook.Dispose(); } foreach (ILHook iLHook in ILHooks) { iLHook.Dispose(); } } public static MethodInfo FindMethod(Type type, string methodName, Type[] types, BindingFlags bindings = BindingFlags.Default) { if (bindings != 0) { return type.GetMethod(methodName, bindings, null, types, null) ?? type.GetMethod(methodName, bindings); } return type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public, null, types, null) ?? type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic, null, types, null) ?? type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public, null, types, null) ?? type.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic, null, types, null) ?? type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public) ?? type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic) ?? type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public) ?? type.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic); } public static Type[] getParameterTypes(MethodInfo methodInfo) { List<Type> list = new List<Type>(); ParameterInfo[] parameters = methodInfo.GetParameters(); for (int i = 1; i < parameters.Length; i++) { list.Add(parameters[i].ParameterType); } return list.ToArray(); } public void Add(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[0], ILHookMethod, bindings); } public void Add(Type type, string methodName, Delegate hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[0], hookMethod.Method, bindings); } public void Add(Type type, string methodName, Action<Action> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1>(string methodName, Delegate hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, getParameterTypes(hookMethod.Method), hookMethod.Method, bindings); } public void Add<T1>(Type type, string methodName, Action<Action<T1>, T1> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[1] { typeof(T1) }, hookMethod.Method, bindings); } public void Add<T1>(Type type, string methodName, Func<Func<T1>, T1> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1>(string methodName, Action<Action> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1>(string methodName, Action<Action<T1>, T1> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[0], ILHookMethod, bindings); } public void Add<T1>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[1] { typeof(T1) }, ILHookMethod, bindings); } public void Add<T1, T2>(Type type, string methodName, Action<Action<T1, T2>, T1, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[2] { typeof(T1), typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2>(Type type, string methodName, Func<Func<T1, T2>, T1, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[1] { typeof(T1) }, hookMethod.Method, bindings); } public void Add<T1, T2>(string methodName, Action<Action<T2>, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[1] { typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2>(string methodName, Func<Func<T2>, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1, T2>(string methodName, Action<Action<T1, T2>, T1, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[1] { typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2>(string methodName, Func<Func<T1, T2>, T1, T2> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[0], hookMethod.Method, bindings); } public void Add<T1, T2>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[1] { typeof(T2) }, ILHookMethod, bindings); } public void Add<T1, T2>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[1] { typeof(T2) }, ILHookMethod, bindings); } public void Add<T1, T2, T3>(Type type, string methodName, Action<Action<T1, T2, T3>, T1, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[3] { typeof(T1), typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(Type type, string methodName, Func<Func<T1, T2, T3>, T1, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[2] { typeof(T1), typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(string methodName, Action<Action<T2, T3>, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[2] { typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(string methodName, Func<Func<T2, T3>, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[1] { typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(string methodName, Action<Action<T1, T2, T3>, T1, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[2] { typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(string methodName, Func<Func<T1, T2, T3>, T1, T2, T3> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[1] { typeof(T2) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[2] { typeof(T2), typeof(T3) }, ILHookMethod, bindings); } public void Add<T1, T2, T3>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[2] { typeof(T2), typeof(T3) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4>(Type type, string methodName, Action<Action<T1, T2, T3, T4>, T1, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[4] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(Type type, string methodName, Func<Func<T1, T2, T3, T4>, T1, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[3] { typeof(T1), typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(string methodName, Action<Action<T2, T3, T4>, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(string methodName, Func<Func<T2, T3, T4>, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[2] { typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(string methodName, Action<Action<T1, T2, T3, T4>, T1, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(string methodName, Func<Func<T1, T2, T3, T4>, T1, T2, T3, T4> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[2] { typeof(T2), typeof(T3) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[5] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[4] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(string methodName, Action<Action<T2, T3, T4, T5>, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(string methodName, Func<Func<T2, T3, T4, T5>, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(string methodName, Action<Action<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(string methodName, Func<Func<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[3] { typeof(T2), typeof(T3), typeof(T4) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6>, T1, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[6] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6>, T1, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[5] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(string methodName, Action<Action<T2, T3, T4, T5, T6>, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(string methodName, Func<Func<T2, T3, T4, T5, T6>, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6>, T1, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6>, T1, T2, T3, T4, T5, T6> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[4] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7>, T1, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[7] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7>, T1, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[6] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7>, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7>, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7>, T1, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7>, T1, T2, T3, T4, T5, T6, T7> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[5] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8>, T1, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[8] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8>, T1, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[7] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8>, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8>, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8>, T1, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8>, T1, T2, T3, T4, T5, T6, T7, T8> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[6] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>, T1, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[9] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9>, T1, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[8] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9>, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9>, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>, T1, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9>, T1, T2, T3, T4, T5, T6, T7, T8, T9> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[7] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[10] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[9] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10>, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10>, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[8] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[11] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[10] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[9] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[12] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[11] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[10] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[13] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[12] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[11] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[14] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[13] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[12] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Type type, string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[15] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Type type, string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[14] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(string methodName, Action<Action<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[14] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(string methodName, Func<Func<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(string methodName, Action<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[14] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(string methodName, Func<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> hookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[13] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) }, hookMethod.Method, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(typeof(T1), methodName, new Type[14] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) }, ILHookMethod, bindings); } public void Add<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Type type, string methodName, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { Add(type, methodName, new Type[14] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) }, ILHookMethod, bindings); } public void Add(Type type, string methodName, Type[] types, Manipulator ILHookMethod, BindingFlags bindings = BindingFlags.Default) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown MethodInfo methodInfo = FindMethod(type, methodName, types, bindings); if (methodInfo == null) { Debug.LogError((object)$"Could not hook method {methodName} of {type}, method not found."); return; } ILHookMethods.Add((methodInfo, ILHookMethod)); if (enabled) { ILHooks.Add(new ILHook((MethodBase)methodInfo, ILHookMethod)); } } public void Add(Type type, string methodName, Type[] types, MethodInfo hookMethod, BindingFlags bindings = BindingFlags.Default) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown MethodInfo methodInfo = FindMethod(type, methodName, types, bindings); if (methodInfo == null) { Debug.LogError((object)$"Could not hook method {methodName} of {type}, method not found."); return; } hookSignatures.Add((methodInfo, hookMethod)); if (enabled) { hooks.Add(new Hook((MethodBase)methodInfo, hookMethod)); } } } public static HookManager Hooks = new HookManager(); public abstract BaseUnityPlugin typeReference { get; } public static event Action onAwake; public static event Action onStart; public static event Action onEnable; public static event Action onDisable; public static event Action onUpdate; public static event Action onFixedUpdate; public static event Action onLateUpdate; protected virtual void Awake() { if (BetterUnityPlugin<T>.onAwake != null) { BetterUnityPlugin<T>.onAwake(); } } protected virtual void Start() { if (BetterUnityPlugin<T>.onStart != null) { BetterUnityPlugin<T>.onStart(); } } protected virtual void OnEnable() { if (BetterUnityPlugin<T>.onEnable != null) { BetterUnityPlugin<T>.onEnable(); } } protected virtual void OnDisable() { if (BetterUnityPlugin<T>.onDisable != null) { BetterUnityPlugin<T>.onDisable(); } } protected virtual void Update() { if (BetterUnityPlugin<T>.onUpdate != null) { BetterUnityPlugin<T>.onUpdate(); } } protected virtual void FixedUpdate() { if (BetterUnityPlugin<T>.onFixedUpdate != null) { BetterUnityPlugin<T>.onFixedUpdate(); } } protected virtual void LateUpdate() { if (BetterUnityPlugin<T>.onLateUpdate != null) { BetterUnityPlugin<T>.onLateUpdate(); } } }