Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TrespassReworked v0.6.0
BepInEx/Plugins/Trespass rework.dll
Decompiled 7 months agousing System; 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 EntityStates; using EntityStates.VoidSurvivor; using Microsoft.CodeAnalysis; using On.EntityStates.VoidSurvivor; using On.RoR2; using RiskOfOptions; using RiskOfOptions.Options; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Trespass rework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6a86be20856cdcb76b174f5cc4daaab900fc25cd")] [assembly: AssemblyProduct("Trespass rework")] [assembly: AssemblyTitle("Trespass rework")] [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 VoidBlinkHoldToFloat { [BepInPlugin("com.yourname.voidblinkhold", "TresspassTweaks", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { private const float DOWN_DURATION = 0.5f; private const float DOWN_SPEED_COEFFICIENT = 2f; private static readonly AnimationCurve DOWN_UP_SPEED; private static readonly AnimationCurve DOWN_FORWARD_SPEED; private const float UP_DURATION = 1f; private const float UP_SPEED_COEFFICIENT = 2.2f; private static readonly AnimationCurve UP_UP_SPEED; private static readonly AnimationCurve UP_FORWARD_SPEED; private const float INITIAL_DASH_TIME = 0.25f; private const float TRANSITION_DURATION = 0.3f; public static ConfigEntry<bool> DisableCancellation; public static ConfigEntry<KeyboardShortcut> HoldKey; private static Dictionary<NetworkInstanceId, BlinkStateData> stateData; static Main() { //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_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0083: 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_00a3: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00df: 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_00ff: 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_0113: Expected O, but got Unknown //IL_013b: 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_015b: 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) //IL_016f: Expected O, but got Unknown stateData = new Dictionary<NetworkInstanceId, BlinkStateData>(); DOWN_UP_SPEED = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f, -2.3116775f, -2.3116775f), new Keyframe(1f, 0f, -0.2283835f, -0.2283835f) }); DOWN_UP_SPEED.preWrapMode = (WrapMode)8; DOWN_FORWARD_SPEED = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f, 3.39932f, 3.39932f), new Keyframe(1f, 2f, 0f, 0f) }); DOWN_FORWARD_SPEED.preWrapMode = (WrapMode)8; UP_UP_SPEED = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f) }); UP_UP_SPEED.preWrapMode = (WrapMode)8; UP_FORWARD_SPEED = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f, -1f, -1f), new Keyframe(1f, 0f, -1f, -1f) }); UP_FORWARD_SPEED.preWrapMode = (WrapMode)8; } public void Awake() { //IL_001b: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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 //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown HoldKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Hold To Float Key", new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>()), "The key you must hold to activate the 'float' portion of the blink."); DisableCancellation = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks", "Disable Cancellation", false, "If enabled, the ability cannot be cancelled by releasing the hold key - it will always complete its full duration"); SetupRiskOfOptions(); CharacterBody.FixedUpdate += new hook_FixedUpdate(CharacterBody_FixedUpdate); VoidBlinkBase.OnEnter += new hook_OnEnter(VoidBlinkBase_OnEnter); VoidBlinkBase.GetVelocity += new hook_GetVelocity(VoidBlinkBase_GetVelocity); VoidBlinkBase.FixedUpdate += new hook_FixedUpdate(VoidBlinkBase_FixedUpdate); } private void SetupRiskOfOptions() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown try { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(HoldKey)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DisableCancellation)); ModSettingsManager.SetModDescription("Hold the configured key during Void Blink to float upward instead of dashing forward. Tap for dash, hold for float!"); SetModIcon(); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error setting up Risk of Options: {arg}"); } } private void SetModIcon() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d7: 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) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("icon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (text == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Mod icon resource not found. Make sure icon.png is embedded."); return; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, array)) { Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ModSettingsManager.SetModIcon(modIcon); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod icon set successfully."); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to set mod icon: " + ex.Message)); } } private void CharacterBody_FixedUpdate(orig_FixedUpdate orig, CharacterBody self) { //IL_0047: 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) //IL_0088: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); List<NetworkInstanceId> list = new List<NetworkInstanceId>(); foreach (KeyValuePair<NetworkInstanceId, BlinkStateData> stateDatum in stateData) { if (stateDatum.Value.lastUpdatedTime < Time.time - 10f) { list.Add(stateDatum.Key); } } foreach (NetworkInstanceId item in list) { stateData.Remove(item); } } private void VoidBlinkBase_OnEnter(orig_OnEnter orig, VoidBlinkBase self) { //IL_0019: 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_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) orig.Invoke(self); CharacterBody characterBody = ((EntityState)self).characterBody; if (Object.op_Implicit((Object)(object)characterBody)) { _ = ((NetworkBehaviour)characterBody).netId; if (true) { stateData[((NetworkBehaviour)characterBody).netId] = new BlinkStateData { isHoldingMode = false, modeDetermined = false, transitionStartTime = 0f, transitionStartVelocity = Vector3.zero, lastUpdatedTime = Time.time }; self.duration = 0.5f; } } } private Vector3 VoidBlinkBase_GetVelocity(orig_GetVelocity orig, VoidBlinkBase self) { //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_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_0244: 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_00a7: 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_0134: 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_0146: 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_0150: 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_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_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0233: 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_023a: Unknown result type (might be due to invalid IL or missing references) CharacterBody characterBody = ((EntityState)self).characterBody; if (Object.op_Implicit((Object)(object)characterBody)) { _ = ((NetworkBehaviour)characterBody).netId; if (stateData.TryGetValue(((NetworkBehaviour)characterBody).netId, out BlinkStateData value)) { value.lastUpdatedTime = Time.time; if (!value.modeDetermined && ((EntityState)self).fixedAge >= 0.25f) { value.isHoldingMode = IsHoldKeyDown(); value.modeDetermined = true; if (value.isHoldingMode) { value.transitionStartTime = ((EntityState)self).fixedAge; value.transitionStartVelocity = ((EntityState)self).characterMotor?.velocity ?? Vector3.zero; self.duration = 1f; } } float num = (value.isHoldingMode ? 1f : 0.5f); AnimationCurve val = (value.isHoldingMode ? UP_UP_SPEED : DOWN_UP_SPEED); AnimationCurve val2 = (value.isHoldingMode ? UP_FORWARD_SPEED : DOWN_FORWARD_SPEED); float num2 = (value.isHoldingMode ? 2.2f : 2f); float num3 = Mathf.Clamp01(((EntityState)self).fixedAge / num); Vector3 val3 = (val2.Evaluate(num3) * self.forwardVector + val.Evaluate(num3) * Vector3.up) * num2 * ((BaseState)self).moveSpeedStat; if (value.isHoldingMode && ((EntityState)self).fixedAge < value.transitionStartTime + 0.3f) { float num4 = Mathf.Clamp01((((EntityState)self).fixedAge - value.transitionStartTime) / 0.3f); float num5 = Mathf.SmoothStep(0f, 1f, num4); float num6 = Mathf.Lerp(1f, 0.8f, num4); float num7 = Vector3.Dot(value.transitionStartVelocity, self.forwardVector); float y = value.transitionStartVelocity.y; Vector3 val4 = self.forwardVector * Mathf.Lerp(num7, ((Vector3)(ref val3)).magnitude * num6, num5); Vector3 val5 = Vector3.up * Mathf.Lerp(y, val3.y, num5 * num5); return val4 + val5; } return val3; } } return orig.Invoke(self); } private void VoidBlinkBase_FixedUpdate(orig_FixedUpdate orig, VoidBlinkBase self) { //IL_0019: 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) orig.Invoke(self); CharacterBody characterBody = ((EntityState)self).characterBody; if (!Object.op_Implicit((Object)(object)characterBody)) { return; } _ = ((NetworkBehaviour)characterBody).netId; if (stateData.TryGetValue(((NetworkBehaviour)characterBody).netId, out BlinkStateData value)) { value.lastUpdatedTime = Time.time; bool flag = IsHoldKeyDown(); if (((EntityState)self).isAuthority && value.modeDetermined && value.isHoldingMode && !flag && ((EntityState)self).fixedAge > 0.1f && !DisableCancellation.Value) { self.duration = ((EntityState)self).fixedAge; } } } private static bool IsHoldKeyDown() { //IL_000d: 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_0020: 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: Invalid comparison between Unknown and I4 //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_0040: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<KeyboardShortcut> holdKey = HoldKey; if (holdKey != null) { _ = holdKey.Value; if (true) { KeyboardShortcut value = HoldKey.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { value = HoldKey.Value; return Input.GetKey(((KeyboardShortcut)(ref value)).MainKey); } } } return false; } } public class BlinkStateData { public bool isHoldingMode; public bool modeDetermined; public float transitionStartTime; public Vector3 transitionStartVelocity; public float lastUpdatedTime; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }