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 BaguetteMod v1.0.0
plugins/baguette_pinpin25/MeleeWeaponMod.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("MeleeWeaponMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MeleeWeaponMod")] [assembly: AssemblyTitle("MeleeWeaponMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } public class BaguetteWeapon : MonoBehaviour { } [HarmonyPatch(typeof(ItemMelee), "Start")] public class BaguetteSpawner { private static void Postfix(ItemMelee __instance) { //IL_008c: 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_00cc: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)MeleeWeaponMod.weaponPrefab == (Object)null)) { MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { ((Renderer)val).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)__instance).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } GameObject val3 = Object.Instantiate<GameObject>(MeleeWeaponMod.weaponPrefab, ((Component)__instance).transform); val3.transform.localPosition = new Vector3(0f, 0f, 0f); val3.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); val3.transform.localScale = new Vector3(0.48f, 0.48f, 0.48f); Collider[] componentsInChildren3 = val3.GetComponentsInChildren<Collider>(); foreach (Collider val4 in componentsInChildren3) { val4.enabled = false; } Debug.Log((object)"[BaguetteMod] Bat remplacée par la baguette !"); } } catch (Exception ex) { Debug.LogError((object)("[BaguetteMod] Erreur : " + ex.Message)); } } } public class MeleeWeapon : MonoBehaviour { public Transform hitPoint; public float range = 1.5f; public float damage = 25f; public float cooldown = 0.6f; private float lastAttackTime; private void Update() { //IL_0060: 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_0065: 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_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_0073: Unknown result type (might be due to invalid IL or missing references) if (IsLocalPlayer() && Input.GetMouseButtonDown(0) && Time.time > lastAttackTime + cooldown) { lastAttackTime = Time.time; Vector3 pos = (((Object)(object)hitPoint != (Object)null) ? hitPoint.position : ((Component)this).transform.position); Vector3 forward = ((Component)this).transform.forward; NetMessages.SendAttack(pos, forward); } } private bool IsLocalPlayer() { return true; } } [BepInPlugin("com.pinpin25.baguettemod", "Baguette Mod", "1.0.0")] public class MeleeWeaponMod : BaseUnityPlugin { public static GameObject weaponPrefab; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) LoadBundle(); new Harmony("com.pinpin25.baguettemod").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BaguetteMod] Loaded !"); } private void LoadBundle() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "baguette_assets"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("[BaguetteMod] AssetBundle introuvable ! Chemin : " + text)); return; } weaponPrefab = val.LoadAsset<GameObject>("Baguette"); if ((Object)(object)weaponPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[BaguetteMod] Prefab 'Baguette' introuvable dans le bundle !"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BaguetteMod] Prefab Baguette chargé !"); } } } public static class NetMessages { public static float damage = 25f; public static float range = 1.5f; public static void SendAttack(Vector3 pos, Vector3 dir) { //IL_000c: 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) Debug.Log((object)"[BaguetteMod] Attack envoyée au host"); HostProcessAttack(pos, dir); } public static void HostProcessAttack(Vector3 pos, Vector3 dir) { //IL_0001: 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) Collider[] array = Physics.OverlapSphere(pos, range); Collider[] array2 = array; foreach (Collider val in array2) { if (((Component)val).CompareTag("Enemy")) { Debug.Log((object)("[BaguetteMod] Ennemi touché : " + ((Object)val).name)); } } RpcPlayEffects(pos); } public unsafe static void RpcPlayEffects(Vector3 pos) { //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) Vector3 val = pos; Debug.Log((object)("[BaguetteMod] FX au point " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString())); } } public static class WeaponSpawner { public static GameObject Spawn(Transform hand) { //IL_003e: 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) if ((Object)(object)MeleeWeaponMod.weaponPrefab == (Object)null) { Debug.LogError((object)"[BaguetteMod] Prefab manquant !"); return null; } GameObject val = Object.Instantiate<GameObject>(MeleeWeaponMod.weaponPrefab); val.transform.SetParent(hand); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; Debug.Log((object)"[BaguetteMod] Baguette spawned !"); return val; } }