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 FinalBurst v0.1.2
FinalBurst.dll
Decompiled 8 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 HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; 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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Kai")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FinalBurst")] [assembly: AssemblyTitle("FinalBurst")] [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 FinalBurst { [BepInPlugin("Kai.FinalBurst", "FinalBurst", "0.1.1")] public class FinalBurst : BaseUnityPlugin { public static ConfigEntry<float> CannonDelay; public static ConfigEntry<int> CannonHpCost; public static ConfigEntry<KeyCode> CannonKey; internal static FinalBurst Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Instance = this; Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); val.PatchAll(); CannonDelay = ((BaseUnityPlugin)this).Config.Bind<float>("FinalBurst", "CannonDelay", 1f, "Delay between cannon shots (seconds)"); CannonHpCost = ((BaseUnityPlugin)this).Config.Bind<int>("FinalBurst", "CannonHpCost", 50, "HP cost per cannon shot"); CannonKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("FinalBurst", "CannonKey", (KeyCode)103, "Key to fire cannon"); Logger.LogInfo((object)"[FinalBurst] Plugin Loaded"); } public void TryUseCannon_FromPatch(PlayerController controller) { //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_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_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) PlayerAvatar playerAvatarScript = controller.playerAvatarScript; if (Object.op_Implicit((Object)(object)playerAvatarScript)) { int value = CannonHpCost.Value; playerAvatarScript.playerHealth.Hurt(value, false, -1); Vector3 position = controller.cameraGameObject.transform.position; Vector3 forward = controller.cameraGameObject.transform.forward; FinalBurstShooter component = ((Component)playerAvatarScript).GetComponent<FinalBurstShooter>(); component.Fire_Cannon(position, forward); Logger.LogInfo((object)$"[FinalBurst] Cannon fired with HP cost {value}"); } } } public class FinalBurstShooter : MonoBehaviourPun { private static bool loaded; private static GameObject cannonBulletPrefab; private static Sound fireSound; private static Sound explosionSound; public static void TryLoadPrefab() { if (loaded) { return; } Dictionary<string, Item> dictionary = StatsManager.instance?.itemDictionary; if (dictionary == null) { return; } foreach (KeyValuePair<string, Item> item in dictionary) { PrefabRef prefab = item.Value.prefab; GameObject val = ((prefab != null) ? prefab.Prefab : null); if (Object.op_Implicit((Object)(object)val)) { ItemCartCannon component = val.GetComponent<ItemCartCannon>(); if (Object.op_Implicit((Object)(object)component)) { cannonBulletPrefab = component.bulletPrefab; fireSound = component.shootSound; explosionSound = component.soundHit; FinalBurst.Logger.LogInfo((object)"[FinalBurst] Cannon prefab & sounds loaded"); break; } } } loaded = true; } public void Fire_Cannon(Vector3 origin, Vector3 dir) { //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_0039: 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_0043: 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_0047: 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_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_00cd: 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_00cf: 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_00d9: 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_00a9: 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) TryLoadPrefab(); if (!Object.op_Implicit((Object)(object)cannonBulletPrefab)) { FinalBurst.Logger.LogError((object)"[FinalBurst] cannonBulletPrefab missing!"); return; } float num = 80f; Vector3 val = origin + dir * num; bool flag = false; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(origin, dir, ref val2, num, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }))) { val = ((RaycastHit)(ref val2)).point; flag = true; } if (PhotonNetwork.IsConnected) { ((MonoBehaviourPun)this).photonView.RPC("FireRPC", (RpcTarget)0, new object[4] { origin, dir, val, flag }); } else { FireRPC(origin, dir, val, flag, default(PhotonMessageInfo)); } } [PunRPC] private void FireRPC(Vector3 origin, Vector3 dir, Vector3 endPos, bool hitFlag, PhotonMessageInfo info) { //IL_0059: 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_005b: 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_006f: 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_00bc: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)cannonBulletPrefab)) { FinalBurst.Logger.LogError((object)"[FinalBurst] FireRPC but cannonBulletPrefab is null"); return; } if (fireSound != null) { fireSound.Play(origin, 1f, 1f, 1f, 1f); } GameObject val = Object.Instantiate<GameObject>(cannonBulletPrefab, origin, Quaternion.LookRotation(dir)); ItemGunBullet component = val.GetComponent<ItemGunBullet>(); component.hitPosition = endPos; component.bulletHit = hitFlag; component.shootLineWidthCurve = AnimationCurve.Linear(1f, 1f, 0f, 0f); component.ActivateAll(); if (hitFlag && explosionSound != null) { explosionSound.Play(endPos, 1f, 1f, 1f, 1f); } } } [HarmonyPatch(typeof(GameDirector))] public static class FinalBurst_GameDirectorPatch { private static bool applied; [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(GameDirector __instance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 if (!applied && (int)__instance.currentState == 2) { applied = true; FinalBurst.Logger.LogInfo((object)"[FinalBurst] GameState=Main → attaching shooters & loading prefab"); FinalBurstShooter.TryLoadPrefab(); PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent<FinalBurstShooter>())) { ((Component)val).gameObject.AddComponent<FinalBurstShooter>(); FinalBurst.Logger.LogInfo((object)"[FinalBurst] Shooter attached to Avatar (GameState.Main)"); } } } if ((int)__instance.currentState != 2) { applied = false; } } } [HarmonyPatch(typeof(PlayerAvatar))] public static class FinalBurst_PlayerAvatarPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerAvatar __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<FinalBurstShooter>())) { ((Component)__instance).gameObject.AddComponent<FinalBurstShooter>(); FinalBurst.Logger.LogInfo((object)"[FinalBurst] FinalBurstShooter attached to PlayerAvatar"); } } } [HarmonyPatch(typeof(PlayerController))] public static class FinalBurst_PlayerControllerPatch { private static float cannonCooldown; [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update_Postfix(PlayerController __instance) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)__instance.playerAvatarScript) && __instance.playerAvatarScript.isLocal && LevelGenerator.Instance.Generated && !SemiFunc.MenuLevel() && (!Object.op_Implicit((Object)(object)ChatManager.instance) || !ChatManager.instance.StateIsActive())) { if (cannonCooldown > 0f) { cannonCooldown -= Time.deltaTime; } if (Input.GetKeyDown(FinalBurst.CannonKey.Value) && !(cannonCooldown > 0f)) { FinalBurst.Logger.LogInfo((object)"[FinalBurst] Cannon key detected"); cannonCooldown = FinalBurst.CannonDelay.Value; FinalBurst.Instance?.TryUseCannon_FromPatch(__instance); } } } } }