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 Garbel Company v1.0.0
GarbelCompany.dll
Decompiled a year agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [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-CSharp")] [assembly: AssemblyCompany("GarbelCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GarbelCompany")] [assembly: AssemblyTitle("GarbelCompany")] [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 GarbelCompany { [BepInPlugin("GarbelCompany", "GarbelCompany", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GarbelCompany : BaseUnityPlugin { public static AssetBundle MyBundle; public static GarbelCompany Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); Logger.LogInfo((object)"ALEEEEEEEEEEEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); LoadBundles(); } private void LoadBundles() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); MyBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "garbelbundle")); if ((Object)(object)MyBundle == (Object)null) { Logger.LogInfo((object)"Failed to load custom assets."); return; } ImplemantScrap(); SetupLogoChanger(); Logger.LogInfo((object)"Custom assets loaded successfully!"); Printer("I love Lorenzo", 20); Printer("I love Perre", 20); Printer("I love Massime", 20); } private void SetupLogoChanger() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("MenuDetector"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<LogoChanger>(); Logger.LogInfo((object)("SETUP : " + ((Object)val).name)); Sprite sprite = MyBundle.LoadAsset<Sprite>("assets/gab/garbelsprite.png"); val.GetComponent<LogoChanger>().SetupSprite(sprite); } private void ImplemantScrap() { int num = 100; LoadCustomAsset("assets/gab/data/id_punchbox.asset", 60, "GarbelCompany.PunchBoxPlugin", "assets/gab/sfx/punchboxsfx.mp3"); LoadCustomAsset("assets/gab/data/id_poem.asset", 50, "GarbelCompany.PerrePoem"); LoadCustomAsset("assets/gab/data/ID_TrinityBox.asset", 67); LoadCustomAsset("assets/gab/data/ID_GarbelPaint.asset", 30); } private void LoadCustomAsset(string Path, int rarity, string scriptToAdd = "", string clipPath = "") { Item val = MyBundle.LoadAsset<Item>(Path); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"ASSETS NOT FOUND"); return; } Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, rarity, (LevelTypes)(-1)); if (string.IsNullOrEmpty(scriptToAdd)) { return; } Type type = Type.GetType(scriptToAdd); if (!(type != null)) { return; } Component obj = val.spawnPrefab.AddComponent(type); MethodInfo method = type.GetMethod("Initialize"); if (method != null) { if (!string.IsNullOrEmpty(clipPath)) { AudioClip val2 = MyBundle.LoadAsset<AudioClip>(clipPath); if ((Object)(object)val2 == (Object)null) { Logger.LogError((object)"AUDIO CLIP DOSENT EXIST"); return; } method.Invoke(obj, new object[2] { val, val2 }); } else { method.Invoke(obj, new object[2] { val, null }); } } else { Logger.LogError((object)"NO METHOD NAME LIKE THAT"); } } private void Printer(string text, int iteration) { for (int i = 0; i < iteration; i++) { Debug.Log((object)text); } } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("GarbelCompany"); } 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 class LogoChanger : MonoBehaviour { public Sprite _SpriteGarbel; private void start() { ChangeLogo(); } private void Awake() { SceneManager.sceneLoaded += OnSceneLoaded; } public void SetupSprite(Sprite sprite) { if ((Object)(object)sprite == (Object)null) { Debug.LogWarning((object)"SPRITE EMPTY"); } else { _SpriteGarbel = sprite; } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name == "MainMenu") { ChangeLogo(); ChangeVersion(); } } private void ChangeLogo() { GameObject.Find("HeaderImage").GetComponent<Image>().sprite = _SpriteGarbel; } private void ChangeVersion() { ((TMP_Text)GameObject.Find("VersionNum").GetComponent<TextMeshProUGUI>()).text = "VIloveyou <3"; } } public class PerrePoem : GrabbableObject { public AudioClip Clip; private bool _isOpen; private bool _canAction; private Animator _animator; private AudioSource _audioSource; private string _actionToDo = "[RMB] Read poem"; private string _actionJoke = "I love perre"; private void Awake() { _canAction = true; Transform transform = ((Component)((Component)this).transform.Find("Cover")).transform; _animator = ((Component)transform).GetComponent<Animator>(); _audioSource = ((Component)transform).GetComponent<AudioSource>(); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); SetControlPunchBox(); } private void SetControlPunchBox() { string[] array = new string[2] { _actionToDo, _actionJoke }; if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties); } } public void Initialize(Item ItemID, AudioClip clip = null) { AudioClip clip2 = Clip; base.itemProperties = ItemID; base.grabbable = true; base.isInFactory = true; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (_canAction) { ((MonoBehaviour)this).StartCoroutine(CooldownAction(0.8f)); if (_isOpen) { ClosingPoem(); } else { OpeningPoem(); } } } private void OpeningPoem() { _isOpen = true; _animator.SetTrigger("Open"); _audioSource.Play(); } private void ClosingPoem() { _isOpen = false; _animator.SetTrigger("Close"); _audioSource.Stop(); } private IEnumerator CooldownAction(float timeToWait) { _canAction = false; yield return (object)new WaitForSeconds(timeToWait); _canAction = true; } } public class PunchBoxPlugin : GrabbableObject { [Header("PUNCH BOX INFO")] public Animator animPunchBox; public float cooldownAnim = 13f; public AudioClip punchClip; [Header("OTHER INFO")] private string _actionString = "Wind box [RMB]"; private bool _inAnimation; private void Awake() { animPunchBox = ((Component)((Component)this).transform.Find("AnimController")).GetComponent<Animator>(); if ((Object)(object)animPunchBox == (Object)null) { Debug.LogError((object)"ANIMATOR NOT FOUND"); } } private void SetItem(Item ItemID) { base.itemProperties = ItemID; } public void Initialize(Item ItemID, AudioClip clip = null) { punchClip = clip; base.itemProperties = ItemID; base.grabbable = true; base.isInFactory = true; } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); SetControlPunchBox(); } private void SetControlPunchBox() { string[] array = new string[1] { _actionString }; if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (!_inAnimation && !((Object)(object)animPunchBox == (Object)null)) { ((Component)((Component)this).transform).GetComponent<AudioSource>().PlayOneShot(punchClip); ((GrabbableObject)this).ItemActivate(used, buttonDown); animPunchBox.SetTrigger("TriggerBox"); _inAnimation = true; ((MonoBehaviour)this).StartCoroutine(WaitForAnimToEnd()); } } private IEnumerator WaitForAnimToEnd() { yield return (object)new WaitForSeconds(cooldownAnim); _inAnimation = false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "GarbelCompany"; public const string PLUGIN_NAME = "GarbelCompany"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace GarbelCompany.Patches { [HarmonyPatch(typeof(TVScript))] public class ExampleTVPatch { [HarmonyPatch("SwitchTVLocalClient")] [HarmonyPrefix] private static void SwitchTVPrefix(TVScript __instance) { StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }