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 PlayerBracken v1.0.1
PlayerBracken.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using TMPro; 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("PlayerBracken")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PlayerBracken")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e509da5c-cf1d-4920-88e7-e6e88e8a0faa")] [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")] namespace PlayerBracken { public static class MyPluginInfo { public const string PLUGIN_GUID = "PlayerBracken"; public const string PLUGIN_NAME = "PlayerBracken"; public const string PLUGIN_VERSION = "1.0.1"; } [BepInPlugin("PlayerBracken", "PlayerBracken", "1.0.1")] public class Plugin : BaseUnityPlugin { public static GameObject Visuals; public static ConfigEntry<bool> showPlayerNameText; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PlayerBracken is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "playerbracken.bundle"); AssetBundle val = AssetBundle.LoadFromFile(text); Visuals = val.LoadAsset<GameObject>("assets/raecomission/animcontainer.prefab"); showPlayerNameText = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerBracken", "ShowPlayerNameAboveBracken", false, "Enable/Disable whether the player name should appear above the fake Player. This will pick a random player in the server for the name."); Renderer[] componentsInChildren = Visuals.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { ((Component)val2).gameObject.layer = LayerMask.NameToLayer("Enemies"); } } } } namespace PlayerBracken.Patches { [HarmonyPatch(typeof(FlowermanAI), "Start")] internal class FlowermanPatch { private static void Postfix(FlowermanAI __instance) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.Visuals == (Object)null) { return; } Transform val = ((Component)__instance).transform.Find("FlowermanModel"); object obj; if (val == null) { obj = null; } else { Transform obj2 = val.Find("LOD1"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<SkinnedMeshRenderer>() : null); } SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)obj; object obj3; if (val == null) { obj3 = null; } else { Transform obj4 = val.Find("AnimContainer"); obj3 = ((obj4 != null) ? obj4.Find("metarig") : null); } Transform val3 = (Transform)obj3; if ((Object)(object)val2 == (Object)null || !((Renderer)val2).enabled) { return; } ((Renderer)val2).enabled = false; Renderer[] componentsInChildren = ((Component)val3).gameObject.GetComponentsInChildren<Renderer>(); foreach (Renderer val4 in componentsInChildren) { val4.enabled = false; } GameObject val5 = Object.Instantiate<GameObject>(Plugin.Visuals, val); val5.transform.localPosition = Vector3.zero; val5.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val5.transform.localScale = new Vector3(5.85875f, 5.85875f, 5.85875f); Transform val6 = val5.transform.Find("metarig"); ((EnemyAI)__instance).creatureAnimator = ((Component)val6).GetComponent<Animator>(); __instance.rightHandGrip = val6.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003") .Find("shoulder.R") .Find("arm.R_upper") .Find("arm.R_lower") .Find("hand.R") .Find("HandGripPosition"); TextMeshProUGUI component = ((Component)val5.transform.Find("PlayerUsernameCanvas").Find("Text (TMP)")).GetComponent<TextMeshProUGUI>(); if (Plugin.showPlayerNameText.Value) { string[] source = StartOfRound.Instance.allPlayerScripts.Select((PlayerControllerB x) => x.playerUsername).ToArray(); Random random = new Random(); source = source.OrderBy((string x) => random.Next()).ToArray(); string[] array = source; foreach (string text in array) { if (!text.ToLower().Contains("player")) { ((Component)component).gameObject.SetActive(true); ((TMP_Text)component).text = text; break; } } } else { ((Component)component).gameObject.SetActive(false); } } } }