Please disclose if your mod was created primarily 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 BrackenSaucisse v3.0.0
Roucas76.BrackenSaucisse.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 CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using LethalThings; using Microsoft.CodeAnalysis; using Unity.Netcode; 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: AssemblyCompany("Roucas76.BrackenSaucisse")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d33d1aa776fa5c31cf1d0369e86a6b370e5b7d37")] [assembly: AssemblyProduct("BrackenSaucisse")] [assembly: AssemblyTitle("Roucas76.BrackenSaucisse")] [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 BrackenSaucisse { public class BrackenSaucisseConfig : SyncedConfig2<BrackenSaucisseConfig> { [SyncedEntryField] public readonly SyncedEntry<double> SausageChances; public BrackenSaucisseConfig(ConfigFile cfg) : base("Roucas76.BrackenSaucisse") { SausageChances = SyncedBindingExtensions.BindSyncedEntry<double>(cfg, "BrackenSaucisse", "SausageChances", 12.5, "Chances to trigger the Saucissade."); ConfigManager.Register<BrackenSaucisseConfig>((SyncedConfig2<BrackenSaucisseConfig>)(object)this); } } [BepInPlugin("Roucas76.BrackenSaucisse", "BrackenSaucisse", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.sigurd.csync", "5.0.0")] public class Plugin : BaseUnityPlugin { internal static BrackenSaucisseConfig Config; public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Config = new BrackenSaucisseConfig(((BaseUnityPlugin)this).Config); Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Logger.LogInfo((object)"Roucas76.BrackenSaucisse BORDEL DDE MERDE !!!"); Patch(); Logger.LogInfo((object)"Roucas76.BrackenSaucisse v1.0.0 has loaded!"); } internal static void Patch() { //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 Logger.LogDebug((object)"Patching..."); if (Harmony == null) { Harmony = new Harmony("Roucas76.BrackenSaucisse"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Roucas76.BrackenSaucisse"; public const string PLUGIN_NAME = "BrackenSaucisse"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace BrackenSaucisse.Patches { [HarmonyPatch(typeof(EnemyAI))] public class BrackenEverywherePatch { [HarmonyPatch(typeof(EnemyAI), "PlayerIsTargetable")] [HarmonyPostfix] private static void TargetAnything(EnemyAI __instance, ref bool __result) { if ((Object)(object)__instance == (Object)(object)GiftBoxItemPatch.bracken) { __result = true; } } } [HarmonyPatch(typeof(FlowermanAI))] public class BrackenPatch { [HarmonyPatch(typeof(FlowermanAI), "FinishKillAnimation")] [HarmonyPrefix] public static bool DoFinishKillAnimation(FlowermanAI __instance, ref bool carryingBody) { if ((Object)(object)__instance == (Object)(object)GiftBoxItemPatch.bracken) { return false; } return true; } } [HarmonyPatch(typeof(GiftBoxItem))] public class GiftBoxItemPatch { public static PlayerControllerB? player; public static GiftBoxItem? instance; public static FlowermanAI? bracken; [HarmonyPatch(typeof(GiftBoxItem), "ItemActivate")] [HarmonyPrefix] private static void DoItemActivate(GiftBoxItem __instance) { Plugin.Logger.LogDebug((object)"ItemActivate."); instance = __instance; float num = Random.value * 100f; Plugin.Logger.LogDebug((object)$"Saucisse Pourcent : {num}."); Plugin.Logger.LogDebug((object)$"Param Pourcent : {Plugin.Config.SausageChances.Value}."); if ((double)num <= Plugin.Config.SausageChances.Value) { player = ((GrabbableObject)__instance).playerHeldBy; Plugin.Logger.LogDebug((object)"Lezgo la saucisse."); } } [HarmonyPatch(typeof(GiftBoxItem), "OpenGiftBoxServerRpc")] [HarmonyPrefix] public static bool PreOpenGiftBoxServerRpc(GiftBoxItem __instance) { Plugin.Logger.LogDebug((object)"OpenGiftBoxServerRpc."); if ((Object)(object)__instance == (Object)(object)instance) { __instance.objectInPresent = null; } return true; } [HarmonyPatch(typeof(GiftBoxItem), "OpenGiftBoxServerRpc")] [HarmonyPostfix] public static void PostOpenGiftBoxServerRpc(GiftBoxItem __instance) { Plugin.Logger.LogDebug((object)"OpenGiftBoxServerRpc."); if (!((Object)(object)__instance != (Object)(object)instance)) { GetBracken(); } } private static void GetBracken() { NetworkObject val = TryGetBracken(); if ((Object)(object)val != (Object)null) { bracken = ((Component)val).GetComponent<FlowermanAI>(); ((EnemyAI)bracken).targetPlayer = player; bracken.lookAtPlayer = player; ((EnemyAI)bracken).OnCollideWithPlayer(player.playerCollider); } static NetworkObject TryGetBracken() { //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_005c: 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_0072: 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_00b8: Unknown result type (might be due to invalid IL or missing references) EnemyAI val2 = ((IEnumerable<EnemyAI>)RoundManager.Instance.SpawnedEnemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI x) => (Object)(object)((Component)x).GetComponent<FlowermanAI>() != (Object)null)); if ((Object)(object)val2 != (Object)null) { return ((Component)val2).GetComponent<NetworkObject>(); } Vector3 val3 = -((Component)player).transform.forward; Vector3 val4 = ((Component)player).transform.position + val3 * 0.1f; SpawnableEnemyWithRarity item = RoundManager.Instance.currentLevel.Enemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.Equals("Flowerman")); RoundManager.Instance.SpawnEnemyOnServer(val4, 0f, RoundManager.Instance.currentLevel.Enemies.IndexOf(item)); return TryGetBracken(); } } } [HarmonyPatch(typeof(DeadBodyInfo))] public class SausagePatch { [HarmonyPatch(typeof(DeadBodyInfo), "Start")] [HarmonyPostfix] public static void DoStart(DeadBodyInfo __instance) { if (!((Object)(object)__instance.playerScript != (Object)(object)GiftBoxItemPatch.player)) { ToSausage(__instance); } } public static void ToSausage(DeadBodyInfo __instance) { Plugin.Logger.LogDebug((object)"La saucisse ???"); Plugin.Logger.LogDebug((object)string.Join(",", Content.Prefabs.Keys)); Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName.Equals("Glizzy")); Plugin.Logger.LogDebug((object)("glizzy.spawnPrefab.transform.name: " + ((Object)val.spawnPrefab.transform).name)); Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)__instance).transform); Object.Destroy((Object)(object)((Component)__instance).gameObject.GetComponent<SkinnedMeshRenderer>()); } public static void ChangeMesh(DeadBodyInfo deadBody, SkinnedMeshRenderer smr) { SkinnedMeshRenderer component = ((Component)deadBody).gameObject.GetComponent<SkinnedMeshRenderer>(); Plugin.Logger.LogDebug((object)"---------SKIN AVANT---------"); Plugin.Logger.LogDebug((object)("deadSMR:" + ((Object)component).name)); Plugin.Logger.LogDebug((object)("deadSMR.gameobject:" + ((Object)((Component)component).gameObject).name)); Plugin.Logger.LogDebug((object)$"deadSMR.bones:{component.bones}"); Plugin.Logger.LogDebug((object)$"deadSMR.rootBone:{component.rootBone}"); Plugin.Logger.LogDebug((object)$"deadSMR.materials:{((Renderer)component).materials}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMesh:{component.sharedMesh}"); Plugin.Logger.LogDebug((object)$"deadSMR.material:{((Renderer)component).material}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMaterial:{((Renderer)component).sharedMaterial}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMaterials:{((Renderer)component).sharedMaterials}"); component.bones = smr.bones; component.rootBone = smr.rootBone; ((Renderer)component).materials = ((Renderer)smr).materials; component.sharedMesh = smr.sharedMesh; ((Renderer)component).material = ((Renderer)smr).material; ((Renderer)component).sharedMaterial = ((Renderer)smr).sharedMaterial; ((Renderer)component).sharedMaterials = ((Renderer)smr).sharedMaterials; Plugin.Logger.LogDebug((object)"---------SKIN APRES---------"); Plugin.Logger.LogDebug((object)$"deadSMR.bones:{component.bones}"); Plugin.Logger.LogDebug((object)$"deadSMR.rootBone:{component.rootBone}"); Plugin.Logger.LogDebug((object)$"deadSMR.materials:{((Renderer)component).materials}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMesh:{component.sharedMesh}"); Plugin.Logger.LogDebug((object)$"deadSMR.material:{((Renderer)component).material}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMaterial:{((Renderer)component).sharedMaterial}"); Plugin.Logger.LogDebug((object)$"deadSMR.sharedMaterials:{((Renderer)component).sharedMaterials}"); } } }