Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of GunAbility v1.0.2
GunAbility.dll
Decompiled 4 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using AbilityApi; using BepInEx; using BoplFixedMath; using HarmonyLib; using Microsoft.CodeAnalysis; 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("Ghost Ability")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Ghost Ability")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9e5d4943-526f-4757-941c-a54b3a9e0064")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [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 GunAbility { [BepInPlugin("org.000diggity000.LongAbility", "GunAbility", "1.0.2")] public class Plugin : BaseUnityPlugin { private GameObject BowObject; public static BoplBody Arrow; public static Stream GetResourceStream(string namespaceName, string path) { return Assembly.GetExecutingAssembly().GetManifestResourceStream(namespaceName + "." + path); } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b9: 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_00e9: 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_017b: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown Harmony val = new Harmony("org.000diggity000.GunAbility"); MethodBase methodBase = AccessTools.Method(typeof(Arrow), "OnCollide", (Type[])null, (Type[])null); val.Patch(methodBase, new HarmonyMethod(AccessTools.Method(typeof(Patches), "OnCollide", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.PatchAll(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); GunAbility gunAbility = ConstructAbility<GunAbility>("Gun"); ((Component)gunAbility).gameObject.AddComponent<PlayerPhysics>(); Texture2D val2 = new Texture2D(1, 1); ImageConversion.LoadImage(val2, ReadFully(GetResourceStream("GunAbility", "AbilityIcon.png"))); Sprite val3 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); NamedSprite val4 = default(NamedSprite); ((NamedSprite)(ref val4))..ctor("Gun", val3, ((Component)gunAbility).gameObject, true); Api.RegisterNamedSprites(val4, true); GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[]; GameObject[] array2 = array; GameObject[] array3 = array2; foreach (GameObject val5 in array3) { if (((Object)val5).name == "Bow") { BowObject = val5; break; } } Component component = BowObject.GetComponent(typeof(BowTransform)); BowTransform obj = (BowTransform)((component is BowTransform) ? component : null); Arrow = (BoplBody)AccessTools.Field(typeof(BowTransform), "Arrow").GetValue(obj); } public static byte[] ReadFully(Stream input) { byte[] array = new byte[16384]; using MemoryStream memoryStream = new MemoryStream(); int count; while ((count = input.Read(array, 0, array.Length)) > 0) { memoryStream.Write(array, 0, count); } return memoryStream.ToArray(); } public static T ConstructAbility<T>(string name) where T : MonoUpdatable { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0060: 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_00ad: 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) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)(object)val); Ability val2 = val.AddComponent<Ability>(); val.AddComponent<FixTransform>(); val.AddComponent<SpriteRenderer>(); Texture2D val3 = new Texture2D(2, 2); ImageConversion.LoadImage(val3, ReadFully(GetResourceStream("GunAbility", "gun.png"))); Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); val.GetComponent<SpriteRenderer>().sprite = sprite; ((Renderer)val.GetComponent<SpriteRenderer>()).enabled = false; val.AddComponent<PlayerBody>(); val.AddComponent<DPhysicsBox>(); val.GetComponent<DPhysicsBox>().Scale = (Fix)1.5f; val.AddComponent<PlayerCollision>(); MonoUpdatable val4 = (MonoUpdatable)(object)val.AddComponent<T>(); if ((Object)(object)val4 == (Object)null) { Object.Destroy((Object)(object)val); throw new MissingReferenceException("Invalid type was fed to ConstructAbility"); } return (T)(object)val4; } } public class GunAbility : MonoUpdatable, IAbilityComponent { public Ability ab; private Player player; private FixTransform playerTransform; private PlayerBody body; private PlayerPhysics playerPhysics; private SpriteRenderer spriteRenderer; private bool hasFired = true; private bool releasedButton; private Vec2 inputVector; private Vec2 actualInputVector; private Fix FirePointOffsetX = (Fix)3f; private Fix FirePointOffSetY = -(Fix)3f; private RingBuffer<BoplBody> Bullets; private BoplBody Bullet; public void Awake() { //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_0056: 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_0072: Expected O, but got Unknown //IL_00a6: 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) Updater.RegisterUpdatable((MonoUpdatable)(object)this); ab = ((Component)this).GetComponent<Ability>(); ab.Cooldown = (Fix)4L; spriteRenderer = ((Component)this).GetComponent<SpriteRenderer>(); playerPhysics = ((Component)this).GetComponent<PlayerPhysics>(); body = ((Component)this).GetComponent<PlayerBody>(); player = PlayerHandler.Get().GetPlayer(ab.GetPlayerInfo().playerId); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, Plugin.ReadFully(Plugin.GetResourceStream("GunAbility", "gun.png"))); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); Bullets = new RingBuffer<BoplBody>(10, true); } public void Update() { } public override void Init() { } private void OldUpdate(Fix simDeltaTime) { //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_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_0030: 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_009f: 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_00ae: 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_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_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_0075: 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_0086: 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_00ef: 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_00d7: 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) if (player != null) { Vec2 val = player.AimVector(); if (Vec2.Magnitude(val) > (Fix)0.4 && !releasedButton && !hasFired) { Vec2 val2 = default(Vec2); ((Vec2)(ref val2))..ctor((Fix)1L / val.x, -(Fix)1L / val.y); inputVector = Vec2.Normalized(val2); } Vec2 val3 = player.AimVector(); if (Vec2.Magnitude(val) > (Fix)0.4 && !releasedButton && !hasFired) { actualInputVector = Vec2.Normalized(val3); } if (!player.AbilityButtonIsDown(ab.GetPlayerInfo().AbilityButtonUsedIndex012) && !hasFired) { Fire(); releasedButton = true; } } } public override void UpdateSim(Fix SimDeltaTime) { //IL_0002: 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_0027: 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_005d: 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_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) //IL_0177: 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_018f: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0234: 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_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0409: 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) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //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_042d: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0391: 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_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: 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_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: 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_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: 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_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //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_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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_0370: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) OldUpdate(SimDeltaTime); _ = inputVector; if (!hasFired) { float num = (float)(Math.Atan2((float)inputVector.y, (float)inputVector.x) / (Math.PI * 2.0)); body.rotation = (Fix)num; float num2 = num; num2 *= 360f; if (num2 > 0f && num2 < 90f) { spriteRenderer.flipX = false; spriteRenderer.flipY = false; } if (num2 > 90f && num2 < 180f) { spriteRenderer.flipX = true; spriteRenderer.flipY = false; } if (num2 > -180f && num2 < -90f) { spriteRenderer.flipX = false; spriteRenderer.flipY = true; } if (num2 > -90f && num2 < 0f) { spriteRenderer.flipX = true; spriteRenderer.flipY = true; } } if ((Object)(object)playerPhysics == (Object)null) { return; } if (SceneBounds.WaterHeight > body.position.y - (Fix)0.2f) { AbilityExitInfo info = default(AbilityExitInfo); info.position = body.position; info.selfImposedVelocity = body.selfImposedVelocity; ExitAbility(info); } if (playerPhysics.IsGrounded() && (Vec2.SqrMagnitude(body.selfImposedVelocity) > (Fix)1E-06f || (Object)(object)playerPhysics.getAttachedGround() == (Object)null || !((Behaviour)playerPhysics.getAttachedGround()).isActiveAndEnabled)) { playerPhysics.gravity_modifier = (Fix)0f; playerPhysics.UnGround(false, true); } if (!playerPhysics.IsGrounded()) { playerPhysics.AddGravityFactor(); if (playerPhysics.VelocityBasedRaycasts(true, SimDeltaTime) && hasFired) { AbilityExitInfo val = default(AbilityExitInfo); body.rotation = Fix.Zero; val.justlanded = true; val.groundedSpeed = playerPhysics.groundedSpeed; val.isGrounded = playerPhysics.IsGrounded(); val.isFacingRight = inputVector.x >= 0L; val.position = body.position; val.selfImposedVelocity = body.selfImposedVelocity; val.externalVelocity = body.externalVelocity; val.currentlyAttachedGround = playerPhysics.getAttachedGround(); val.lastSprite = spriteRenderer.sprite; val.groundedLocalPosition = playerPhysics.LocalPlatformPos; val.radius = playerPhysics.radius; ((AbilityMonoBehaviour)ab).ExitAbility(val); } } if (!hasFired) { body.up = inputVector; if (Vec2.Magnitude(body.selfImposedVelocity) > (Fix)9f) { body.selfImposedVelocity = Vec2.Normalized(body.selfImposedVelocity) * (Fix)9f; } } else { Vec2 selfImposedVelocity = body.selfImposedVelocity; Fix val2 = player.HorizontalAxis(); playerPhysics.AirealMovement(val2, SimDeltaTime); Vec2 selfImposedVelocity2 = body.selfImposedVelocity; body.selfImposedVelocity = Vec2.Lerp(selfImposedVelocity, selfImposedVelocity2, (Fix)0.5f); } if (Vec2.Magnitude(body.selfImposedVelocity) > playerPhysics.Speed) { body.selfImposedVelocity = Vec2.Normalized(body.selfImposedVelocity) * playerPhysics.Speed; } if (playerPhysics.IsGrounded()) { playerPhysics.gravity_modifier = Fix.Zero; playerPhysics.UnGround(false, false); playerPhysics.DropPlatformTest(); } } public void OnEnterAbility() { //IL_000d: 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_0055: 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_007f: 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_00bf: 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_00c9: 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) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) ((Renderer)spriteRenderer).material = ab.GetPlayerInfo().playerMaterial; ((Renderer)spriteRenderer).enabled = true; spriteRenderer.flipX = false; spriteRenderer.flipY = false; body.position = ab.GetPlayerInfo().position; body.rotation = (Fix)0L; playerPhysics.SyncPhysicsTo(ab.GetPlayerInfo()); player = PlayerHandler.Get().GetPlayer(ab.GetPlayerInfo().playerId); releasedButton = false; hasFired = false; inputVector = ab.GetPlayerInfo().upVector; body.rotation = Fix.Zero; playerPhysics.gravity_modifier = Fix.One; playerPhysics.UnGround(false, true); } public void Fire() { //IL_0013: 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_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_0043: 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_0079: 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) //IL_009b: 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_00d0: 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_00ed: Expected O, but got Unknown //IL_0125: 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_015c: 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_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_0193: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01e4: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0220: 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) //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_0236: 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_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: 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) //IL_0295: 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) AudioManager.Get().Play("explosion"); AbilityExitInfo val = default(AbilityExitInfo); val.position = body.position; val.selfImposedVelocity = body.selfImposedVelocity; float num = (float)(Math.Atan2((float)inputVector.y, (float)inputVector.x) / (Math.PI * 2.0)); body.rotation = (Fix)num; float num2 = num; num2 *= 360f; Vec2 val2 = CurrentFirePoint(); BoplBody val3 = FixTransform.InstantiateFixed<BoplBody>(Plugin.Arrow, CurrentFirePoint(), body.rotation); ((Object)((Component)val3).gameObject).name = "bullet-diggity"; ((Component)val3).GetComponent<Arrow>().StickTo = default(LayerMask); Bullets.Add(val3); Texture2D val4 = new Texture2D(2, 2); ImageConversion.LoadImage(val4, Plugin.ReadFully(Plugin.GetResourceStream("GunAbility", "bullet.png"))); Sprite sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f)); ((Component)val3).GetComponent<SpriteRenderer>().sprite = sprite; ((Renderer)((Component)val3).GetComponent<SpriteRenderer>()).material = ab.GetPlayerInfo().playerMaterial; val3.Scale = (Fix)0.3f * body.fixtrans.Scale; Fix val5 = Fix.One + (body.fixtrans.Scale - Fix.One) / (Fix)2L; ((Component)val3).GetComponent<IPlayerIdHolder>().SetPlayerId(ab.GetPlayerInfo().playerId); inputVector = Vec2.Normalized(inputVector); ((Renderer)((Component)val3).GetComponent<SpriteRenderer>()).material = ab.GetPlayerInfo().playerMaterial; val3.StartVelocity = actualInputVector * (Fix)55L * Fix.One * val5; ((Component)val3).GetComponent<Projectile>().DelayedEnableHurtOwner((Fix)0.3f); val3.gravityScale = (Fix)0L; hasFired = true; val3.rotation = body.rotation; val3.up = body.up; val3.right = body.right; ((AbilityMonoBehaviour)ab).ExitAbility(val); } public void ExitAbility(AbilityExitInfo info) { //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_0039: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)this).enabled = false; playerPhysics.gravity_modifier = Fix.One; spriteRenderer.flipX = false; spriteRenderer.flipY = false; ((AbilityMonoBehaviour)ab).ExitAbility(info); } public Vec2 CurrentFirePoint() { //IL_0007: 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_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_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_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: 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) //IL_0057: 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_006c: 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_0080: 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_0088: Unknown result type (might be due to invalid IL or missing references) return body.position + FirePointOffSetY * Vec2.Normalized(player.AimVector()) * body.fixtrans.Scale + FirePointOffsetX * Vec2.Normalized(player.AimVector()) * body.fixtrans.Scale * (Fix)1.5f; } public void OnScaleChanged(Fix scaleMultiplier) { throw new NotImplementedException(); } } public class Patches { public static bool OnCollide(Arrow __instance) { if (((Object)((Component)__instance).gameObject).name == "bullet-diggity") { Updater.DestroyFix(((Component)__instance).gameObject); return false; } return true; } } }