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 Balkan Company v1.0.3
Drunk Company.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using Drunk_Company.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; 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("Drunk Company")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Drunk Company")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ebec061f-f0fb-4f23-a59b-a822b541d5c6")] [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 Drunk_Company { [BepInPlugin("zakater.Drunk_Company", "Drunk Company", "1.0.3")] public class MainClass : BaseUnityPlugin { private const string modGUID = "zakater.Drunk_Company"; private const string modName = "Drunk Company"; private const string modVersion = "1.0.3"; private readonly Harmony harmony = new Harmony("zakater.Drunk_Company"); private static MainClass Instance; internal ManualLogSource mls; public static List<Texture2D> painting_textures = new List<Texture2D>(); internal static List<Texture2D> poster_textures = new List<Texture2D>(); internal static List<Texture2D> nametag_textures = new List<Texture2D>(); internal static List<AudioClip> SoundEffects = new List<AudioClip>(); internal static List<AudioClip> Baboon_SoundEffects = new List<AudioClip>(); internal static List<AudioClip> LootBug_SoundEffects = new List<AudioClip>(); internal static AssetBundle bundle; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("zakater.Drunk_Company"); mls.LogInfo((object)"Drunk company be running!"); harmony.PatchAll(typeof(MainClass)); harmony.PatchAll(typeof(StartOfRound)); harmony.PatchAll(typeof(BaboonBirdAI)); harmony.PatchAll(typeof(HoarderBugAI)); harmony.PatchAll(typeof(DropShipPatch)); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "drunk_company"); bundle = AssetBundle.LoadFromFile(text); Item val = bundle.LoadAsset<Item>("Assets/LaskoBeer.asset"); Item val2 = bundle.LoadAsset<Item>("Assets/UnionBeer.asset"); Item val3 = bundle.LoadAsset<Item>("Assets/PittingerBeer.asset"); List<Item> list = new List<Item> { val, val2, val3 }; foreach (Item item in list) { if (item != null) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Utilities.FixMixerGroups(item.spawnPrefab); } } Items.RegisterScrap(val, 100, (LevelTypes)(-1)); Items.RegisterScrap(val2, 100, (LevelTypes)(-1)); Items.RegisterScrap(val3, 100, (LevelTypes)(-1)); Texture2D[] collection = (Texture2D[])(object)new Texture2D[4] { bundle.LoadAsset<Texture2D>("Assets/PaintingTextures/PaintingTextureA.png"), bundle.LoadAsset<Texture2D>("Assets/PaintingTextures/PaintingTextureB.png"), bundle.LoadAsset<Texture2D>("Assets/PaintingTextures/PaintingTextureC.png"), bundle.LoadAsset<Texture2D>("Assets/PaintingTextures/PaintingTextureD.png") }; painting_textures.AddRange(collection); TexturesPatch.Init(mls, painting_textures); Texture2D[] collection2 = (Texture2D[])(object)new Texture2D[2] { bundle.LoadAsset<Texture2D>("Assets/PosterTextures/TipsPoster2.png"), bundle.LoadAsset<Texture2D>("Assets/PosterTextures/posters.png") }; poster_textures.AddRange(collection2); AudioClip[] collection3 = (AudioClip[])(object)new AudioClip[5] { bundle.LoadAsset<AudioClip>("Assets/Audio/KlincKlanc.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Sateliti-Audi.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/DajPicke.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/jedi leba domaci mrane.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/jedi domaci mranauu.mp3") }; SoundEffects.AddRange(collection3); AudioClip[] collection4 = (AudioClip[])(object)new AudioClip[4] { bundle.LoadAsset<AudioClip>("Assets/Audio/LootBug/smeskajmo se.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/LootBug/smeskajmo se uzleba.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/LootBug/smeskajmo se cough cough.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/LootBug/smej se hahaha.mp3") }; LootBug_SoundEffects.AddRange(collection4); AudioClip[] collection5 = (AudioClip[])(object)new AudioClip[7] { bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/a mas 20eur.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/alo alo.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/kaj gledas.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/najdl te bomo.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/oojjj.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/sipsu matr.mp3"), bundle.LoadAsset<AudioClip>("Assets/Audio/Baboon/ti se sam mirki sam mirki se.mp3") }; Baboon_SoundEffects.AddRange(collection5); Texture2D[] collection6 = (Texture2D[])(object)new Texture2D[1] { bundle.LoadAsset<Texture2D>("Assets/NametagTextures/") }; nametag_textures.AddRange(collection6); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "zakater.Drunk_Company"); } } } namespace Drunk_Company.Patches { [HarmonyPatch(typeof(BaboonBirdAI))] internal class BaboonBirdAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(BaboonBirdAI __instance) { for (int i = 0; i < __instance.cawLaughSFX.Length; i++) { if (Object.op_Implicit((Object)(object)MainClass.Baboon_SoundEffects[i])) { __instance.cawLaughSFX[i] = MainClass.Baboon_SoundEffects[i]; } } for (int j = 0; j < __instance.cawScreamSFX.Length; j++) { if (Object.op_Implicit((Object)(object)MainClass.Baboon_SoundEffects[j])) { __instance.cawScreamSFX[j] = MainClass.Baboon_SoundEffects[j]; } } } private static void OverrideAudio2(BaboonHawkAudioEvents __instance) { for (int i = 0; i < __instance.randomClips.Length; i++) { if (Object.op_Implicit((Object)(object)MainClass.Baboon_SoundEffects[i])) { __instance.randomClips[i] = MainClass.Baboon_SoundEffects[i]; } } } } [HarmonyPatch(typeof(PlayerControllerB), "ShowNameBillboard")] internal class BillboardPatch { private static void Postfix(PlayerControllerB __instance) { } } [HarmonyPatch(typeof(ItemDropship))] [HarmonyPatch("Start")] internal class DropShipPatch { private static ItemDropship shipScript; private static AudioClip music; private static AudioClip musicFar; private static AudioSource musicComponent; private static AudioSource musicFarComponent; [HarmonyPostfix] private static void Init(ItemDropship __instance) { try { shipScript = __instance; Transform transform = ((Component)shipScript).transform; Transform val = transform.Find("Music"); musicComponent = ((Component)val).GetComponent<AudioSource>(); musicFarComponent = ((Component)val.Find("Music (1)")).GetComponent<AudioSource>(); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "drunk_company.assetbundle"); Debug.Log((object)("Attempting to load AssetBundle at: " + text)); AssetBundle val2 = AssetBundle.LoadFromFile(text); if ((Object)(object)val2 == (Object)null) { Debug.LogError((object)"Failed to load AssetBundle!"); return; } Debug.Log((object)("Assets in bundle: " + string.Join(", ", val2.GetAllAssetNames()))); music = val2.LoadAsset<AudioClip>("Assets/Audio/Sateliti-Audi"); musicFar = music; if ((Object)(object)music == (Object)null) { Debug.LogError((object)"Failed to load 'Sateliti-Audi' from AssetBundle!"); return; } musicComponent.clip = music; musicFarComponent.clip = musicFar; musicComponent.Play(); musicFarComponent.Play(); val2.Unload(false); Debug.Log((object)"Successfully replaced dropship music!"); } catch (Exception arg) { Debug.LogError((object)$"Failed to initialize DropShipPatch: {arg}"); } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(HoarderBugAI __instance) { for (int i = 0; i < __instance.chitterSFX.Length; i++) { if (Object.op_Implicit((Object)(object)MainClass.LootBug_SoundEffects[i])) { __instance.chitterSFX[i] = MainClass.LootBug_SoundEffects[i]; } } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OverrideAudio(StartOfRound __instance) { __instance.shipIntroSpeechSFX = MainClass.SoundEffects[0]; } } [HarmonyPatch(typeof(TexturesPatch))] internal class TexturesPatch { private static ManualLogSource Logger { get; set; } public static List<Texture2D> PaintingTextures { get; set; } public static void Init(ManualLogSource logger, List<Texture2D> painting_textures) { Logger = logger; PaintingTextures = painting_textures; } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPostfix] private static void OverrideTextures(GrabbableObject __instance) { if (__instance.itemProperties.itemName == "Painting") { if (PaintingTextures.Count > 0) { Random random = new Random(); int index = random.Next(PaintingTextures.Count); Texture2D texture = PaintingTextures[index]; UpdateTexture(texture, __instance.itemProperties.materialVariants[0]); UpdateTexture(texture, __instance.itemProperties.materialVariants[1]); } else { Debug.LogWarning((object)"No textures available in the painting_textures list."); } } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartPatch() { Logger.LogInfo((object)"Patching Start in StartOfRound"); UpdateMaterials(0); } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] private static void GenerateNewLevelClientRpcPatch(int randomSeed) { Logger.LogInfo((object)"Patching GenerateNewLevelClientRpc in RoundManager"); UpdateMaterials(randomSeed); } private static void UpdateMaterials(int seed) { Logger.LogInfo((object)"Patching the textures"); Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials; UpdateTexture(MainClass.poster_textures[1], materials[0]); UpdateTexture(MainClass.poster_textures[0], materials[1]); } private static void UpdateTexture(Texture2D texture, Material material) { if ((Object)(object)texture != (Object)null) { Logger.LogInfo((object)("Applying specific texture to " + ((Object)material).name)); material.mainTexture = (Texture)(object)texture; } else { Logger.LogError((object)"Texture is null, cannot apply to material."); } } } }