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 Vkusno And Tochka v1.0.1
VkusnoAndTochka.dll
Decompiled 2 weeks 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.AI.Navigation; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("VkusnoAndTochka")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VkusnoAndTochka")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("16b96268-95fc-4134-8b77-7f496e67c973")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace VkusnoAndTochka; public class AdApply : MonoBehaviour { [SerializeField] private Material ad1; [SerializeField] private Material ad2; [SerializeField] private Material ad3; private void Start() { if (VAT.adImages.Count > 0) { ad1.mainTexture = (Texture)(object)VAT.adImages[0]; ad2.mainTexture = (Texture)(object)VAT.adImages[1]; ad3.mainTexture = (Texture)(object)VAT.adImages[2]; } } } internal class Patch { private static NetworkObject vatSpawned = null; private static string messageId = "Fitrutrash.VIT.Spawn"; private static NetworkManager networkManager; private static bool isPrefabsAdded = false; private static bool badgeChanged = false; public static Dictionary<Planet, (Vector3 Position, Quaternion Rotation)> transformByPlanet = new Dictionary<Planet, (Vector3, Quaternion)> { { Planet.Company, (new Vector3(-5.18f, -2.05f, 17.31f), Quaternion.Euler(0f, -153.712f, 0f)) }, { Planet.Experimentation, (new Vector3(-69.84f, -1.46f, -3.49f), Quaternion.Euler(0f, -270.982f, 0f)) }, { Planet.Assurance, (new Vector3(49.88587f, -2.22f, -52.59689f), Quaternion.Euler(0f, -339.285f, 0f)) }, { Planet.Vow, (new Vector3(-82.22f, -0.69f, 141.42f), Quaternion.Euler(0f, -247.47f, 0f)) }, { Planet.Offense, (new Vector3(63.44f, -2.4f, 0.85f), Quaternion.Euler(0f, -128.36f, 0f)) }, { Planet.March, (new Vector3(-98.78f, 0.08f, -6.55f), Quaternion.Euler(0f, -365.513f, 0f)) }, { Planet.Adamance, (new Vector3(-60.47f, -18.33f, 30.5f), Quaternion.Euler(-1.031f, -166.277f, 2.117f)) }, { Planet.Rend, (new Vector3(30.54114f, -9.624619f, -79.7013f), Quaternion.Euler(-2.345f, -430.438f, 8.627f)) }, { Planet.Dine, (new Vector3(-25.63f, -2.24f, -37.68f), Quaternion.Euler(0.394f, -359.706f, 4.792f)) }, { Planet.Titan, (new Vector3(9.69f, -0.06f, -41.42f), Quaternion.Euler(3.686f, -24.085f, 0f)) }, { Planet.Artifice, (new Vector3(60.21f, -5.92f, -104.81f), Quaternion.Euler(-4.364f, -90f, 0f)) } }; [HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")] [HarmonyPostfix] private unsafe static void LoadNewLevelWait(RoundManager __instance) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) Planet planet = planetToEnum(__instance.currentLevel.PlanetName); if (!((NetworkBehaviour)__instance).NetworkManager.IsServer || (VAT.spawnOnPlanet & planet) == 0 || !((Object)(object)vatSpawned == (Object)null)) { return; } CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; if (customMessagingManager != null) { VAT.LogDebug("[Хост] Отправляю данные клиентам..."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValue<Planet>(ref planet, default(ForEnums)); customMessagingManager.SendNamedMessageToAll(messageId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] private static void DespawnPropsAtEndOfRound() { if (networkManager.IsServer && (Object)(object)vatSpawned != (Object)null) { vatSpawned.Despawn(true); vatSpawned = null; VAT.LogDebug("[Хост] ВкусноИТочка задеспавнена."); } } [HarmonyPatch(typeof(NetworkManager), "Initialize")] [HarmonyPostfix] private static void OnNetworkInitialize(NetworkManager __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown networkManager = __instance; CustomMessagingManager customMessagingManager = __instance.CustomMessagingManager; if (customMessagingManager != null) { customMessagingManager.RegisterNamedMessageHandler(messageId, new HandleNamedMessageDelegate(SpawnVIT)); } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void PlayerStart(PlayerControllerB __instance) { if (VAT.changeBadge && !badgeChanged) { ((Renderer)GameObject.Find("LevelSticker").GetComponent<MeshRenderer>()).sharedMaterials[0].mainTexture = (Texture)(object)VAT.badgeTexture; badgeChanged = true; } } [HarmonyPatch(typeof(NetworkManager), "Initialize")] [HarmonyPostfix] private static void AddPrefabs(NetworkManager __instance) { if (!isPrefabsAdded && (Object)(object)VAT.VITPrefab != (Object)null) { NetworkManager.Singleton.AddNetworkPrefab(VAT.VITPrefab); isPrefabsAdded = true; VAT.LogDebug("[Хост] NetworkManager принял префаб."); } } private static void SpawnVIT(ulong senderClientId, FastBufferReader reader) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Planet planet = default(Planet); ((FastBufferReader)(ref reader)).ReadValue<Planet>(ref planet, default(ForEnums)); VAT.LogDebug("[Клиент] Получил данные от Хоста."); if ((Object)(object)networkManager == (Object)null) { VAT.LogDebug("[Клиент] NetworkManager по какой-то причине null, не могу заспавнить ВкусноИТочку."); return; } if (networkManager.IsHost) { VAT.LogDebug("[Хост] Спавню саму ВкусноИТочку..."); vatSpawned = NetworkObject.InstantiateAndSpawn(VAT.VITPrefab, networkManager, 0uL, true, false, false, transformByPlanet[planet].Position, transformByPlanet[planet].Rotation); } NavMeshSurface val = null; VAT.LogDebug("[Клиент] Делаю изменения на карте в зависимости от планеты..."); if (planet != Planet.Company) { val = GameObject.Find("Environment").GetComponent<NavMeshSurface>(); GameObject.Find("VkusnoITochka(Clone)").transform.SetParent(((Component)val).gameObject.transform); } switch (planet) { case Planet.Company: GameObject.Find("ShippingContainer (7)").SetActive(false); GameObject.Find("ShippingContainer (8)").SetActive(false); GameObject.Find("CompanyBuildingContour2").GetComponent<SpriteRenderer>().sprite = VAT.contourSprite; break; case Planet.Adamance: GameObject.Find("SnowCabin").SetActive(false); GameObject.Find("StoryLogCollectable (5)").SetActive(false); break; case Planet.Rend: GameObject.Find("SnowCabin").SetActive(false); break; case Planet.Artifice: GameObject.Find("treeLeafless.001_LOD0 (1)").SetActive(false); GameObject.Find("Plane.015 (22)").SetActive(false); GameObject.Find("Plane.015 (21)").SetActive(false); break; case Planet.March: GameObject.Find("WychElmB (7)").SetActive(false); break; case Planet.Titan: val = null; break; } if (planet != Planet.Company && (Object)(object)val != (Object)null) { VAT.LogDebug("[Клиент] Переделываю пути для монстров..."); val.BuildNavMesh(); } ((FastBufferReader)(ref reader)).Dispose(); VAT.Log.LogInfo((object)"[Клиент] ВкусноИТочка полностью заспавнена."); } private static Planet planetToEnum(string planet) { return planet switch { "71 Gordion" => Planet.Company, "41 Experimentation" => Planet.Experimentation, "220 Assurance" => Planet.Assurance, "56 Vow" => Planet.Vow, "21 Offense" => Planet.Offense, "61 March" => Planet.March, "20 Adamance" => Planet.Adamance, "85 Rend" => Planet.Rend, "7 Dine" => Planet.Dine, "8 Titan" => Planet.Titan, "68 Artifice" => Planet.Artifice, _ => Planet.Company, }; } } [BepInPlugin("fitrutrash", "VkusnoAndTochka", "1.0.0")] public class VAT : BaseUnityPlugin { private enum LogLevel { Info, Debug } public static ManualLogSource Log; public static GameObject VITPrefab = null; public static Sprite contourSprite = null; public static List<Texture2D> adImages = new List<Texture2D>(3); public static Texture2D badgeTexture = null; public static Planet spawnOnPlanet; public static bool changeBadge; private static LogLevel logLevel; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; if (LoadBundle()) { LoadAds(); new Harmony("Fitrutrash.VAT").PatchAll(typeof(Patch)); spawnOnPlanet = ((BaseUnityPlugin)this).Config.Bind<Planet>("Главное", "Планеты, на которых будет спавниться вкусная точка", Planet.Company, (ConfigDescription)null).Value; changeBadge = ((BaseUnityPlugin)this).Config.Bind<bool>("Главное", "Использовать модовые бэйджи уровня", true, (ConfigDescription)null).Value; logLevel = ((BaseUnityPlugin)this).Config.Bind<LogLevel>("Логирование", "Уровень логирования", LogLevel.Info, (ConfigDescription)null).Value; Log.LogInfo((object)"[Система] Мод загружен успешно."); } } private bool LoadBundle() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) string text = null; string[] directories = Directory.GetDirectories(Paths.PluginPath); for (int i = 0; i < directories.Length; i++) { string[] files = Directory.GetFiles(directories[i]); foreach (string text2 in files) { if (text2.EndsWith("vkusnoitochka.pack")) { text = text2; break; } } } if (text == null) { Log.LogError((object)"[Система] По какой-то причине не был найден bundle. Мод не будет загружен."); return false; } AssetBundle obj = AssetBundle.LoadFromFile(text); VITPrefab = obj.LoadAsset<GameObject>("Assets/LethalCompany/Mods/VIT/VkusnoITochka.prefab"); Texture2D val = obj.LoadAsset<Texture2D>("Assets/LethalCompany/Mods/VIT/Images/CompanyBuildingContour.png"); contourSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); badgeTexture = obj.LoadAsset<Texture2D>("Assets/LethalCompany/Mods/VIT/Images/PlayerLevelStickers.png"); return true; } private void LoadAds() { bool flag = false; string[] directories = Directory.GetDirectories(Paths.PluginPath); foreach (string text in directories) { if (text.EndsWith("CustomVITAds")) { flag = LoadTextures(text); if (flag) { break; } } if (flag) { continue; } string[] directories2 = Directory.GetDirectories(text); foreach (string text2 in directories2) { if (text2.EndsWith("CustomVITAds")) { flag = LoadTextures(text2); break; } } } if (flag) { Log.LogInfo((object)"[Система] Кастомная реклама была найдена и успешно загружена :3"); } else { Log.LogInfo((object)"[Система] Кастомная реклама не была найдена так что используется стандартная."); } } private bool LoadTextures(string path) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown for (int i = 1; i < 4; i++) { if (!File.Exists($"{path}\\{i}.png")) { return false; } Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, File.ReadAllBytes($"{path}\\{i}.png")); adImages.Add(val); } return true; } public static void LogDebug(string info) { if (logLevel == LogLevel.Debug) { Log.LogInfo((object)info); } } } [Flags] public enum Planet { None = 0, Experimentation = 1, Assurance = 2, Vow = 4, Offense = 8, March = 0x10, Adamance = 0x20, Rend = 0x40, Dine = 0x80, Titan = 0x100, Artifice = 0x200, Company = 0x400 }