using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using FishNet; using FishNet.Connection; using FluffyUnderware.DevTools.Extensions; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using S1API.Quests; using S1API.Saveables; using ScheduleOne; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.Core.Items.Framework; using ScheduleOne.DevUtilities; using ScheduleOne.Dialogue; using ScheduleOne.Economy; using ScheduleOne.EntityFramework; using ScheduleOne.Equipping; using ScheduleOne.Growing; using ScheduleOne.ItemFramework; using ScheduleOne.Management; using ScheduleOne.Messaging; using ScheduleOne.NPCs; using ScheduleOne.NPCs.CharacterClasses; using ScheduleOne.NPCs.Relation; using ScheduleOne.ObjectScripts; using ScheduleOne.Persistence; using ScheduleOne.PlayerScripts; using ScheduleOne.Product; using ScheduleOne.Quests; using ScheduleOne.StationFramework; using ScheduleOne.Storage; using ScheduleOne.UI.MainMenu; using ScheduleOne.UI.Phone; using ScheduleOne.UI.Phone.Delivery; using ScheduleOne.UI.Phone.Messages; using ScheduleOne.UI.Phone.ProductManagerApp; using ScheduleOne.UI.Shop; using UnicornsCustomSeeds; using UnicornsCustomSeeds.Managers; using UnicornsCustomSeeds.Patches; using UnicornsCustomSeeds.SeedQuests; using UnicornsCustomSeeds.Seeds; using UnicornsCustomSeeds.TemplateUtils; using UnityEngine; using UnityEngine.Events; 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: MelonInfo(typeof(Core), "Unicorns Custom Seeds", "1.1.1", "OverweightUnicorn", null)] [assembly: MelonColor(255, 191, 0, 255)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ScheduleOne.Core")] [assembly: AssemblyCompany("UnicornsCustomSeeds_Mono_1.1.1")] [assembly: AssemblyConfiguration("MONO")] [assembly: AssemblyFileVersion("1.1.1")] [assembly: AssemblyInformationalVersion("1.0.0+0ea043a8feb584ee5677fdd4bbe56297e6c59355")] [assembly: AssemblyProduct("UnicornsCustomSeeds_Mono_1.1.1")] [assembly: AssemblyTitle("UnicornsCustomSeeds_Mono_1.1.1")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UnicornsCustomSeeds { public static class BuildInfo { public const string Name = "Unicorns Custom Seeds"; public const string Description = "Your good buddy Unicorn can help you synthesize seeds"; public const string Author = "OverweightUnicorn"; public const string Company = "UnicornsCanMod"; public const string Version = "1.1.1"; public const string DownloadLink = null; } public class Core : MelonMod { public override void OnInitializeMelon() { AssetBundleUtils.Initialize(this); } public override void OnLateInitializeMelon() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown StashManager.InitializeConfig(); SeedVisualsManager.LoadSeedMaterial(); Singleton.Instance.onLoadComplete.AddListener(new UnityAction(InitMod)); Singleton.Instance.onSaveComplete.AddListener(new UnityAction(SaveData)); } public void SaveData() { try { string loadedGameFolderPath = Singleton.Instance.LoadedGameFolderPath; if (!string.IsNullOrEmpty(loadedGameFolderPath) && Directory.Exists(loadedGameFolderPath)) { string path = Path.Combine(loadedGameFolderPath, "DiscoveredCustomSeeds.json"); List list = CustomSeedsManager.DiscoveredSeeds.Values.ToList(); string contents = JsonConvert.SerializeObject((object)list, (Formatting)1); File.WriteAllText(path, contents); } } catch (Exception e) { Utility.PrintException(e); } } public void InitMod() { CustomSeedsManager.Initialize(); StashManager.GetAlbertsStash(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { SeedDefinition item = Registry.GetItem("ogkushseed"); if (CustomSeedsManager.factory == null && (Object)(object)item != (Object)null) { CustomSeedsManager.factory = new SeedFactory(item); } StashManager.GetAlbertsStash(); if (sceneName.ToLower() != "main") { CustomSeedsManager.ClearAll(); ProductManagerAppPatches.ClearPendingIndicators(); } else if ((Object)(object)SeedVisualsManager.seedIcon == (Object)null || (Object)(object)SeedVisualsManager.baseSeedSprite == (Object)null) { SeedVisualsManager.LoadSeedMaterial(); } } } } namespace UnicornsCustomSeeds.TemplateUtils { public static class AssetBundleUtils { private static Core mod; private static MelonAssembly melonAssembly; private static Dictionary assetBundles = new Dictionary(); public static void Initialize(Core coreMod) { mod = coreMod; melonAssembly = ((MelonBase)mod).MelonAssembly; } public static AssetBundle LoadAssetBundle(string bundleFileName) { if (assetBundles.ContainsKey(bundleFileName)) { return assetBundles[bundleFileName]; } try { string text = typeof(Core).Namespace + ".Assets." + bundleFileName; Stream manifestResourceStream = melonAssembly.Assembly.GetManifestResourceStream(text ?? ""); if (manifestResourceStream == null) { ((MelonBase)mod).Unregister("AssetBundle: '" + text + "' not found. \nOpen .csproj file and search for '" + bundleFileName + "'.\nIf it doesn't exist,\nCopy your asset to Assets/ folder then look for 'your.assetbundle' in .csproj file.", false); return null; } AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream); assetBundles.Add(bundleFileName, val); return val; } catch (Exception arg) { ((MelonBase)mod).Unregister($"Failed to load AssetBundle. Please report to dev: {arg}", false); return null; } } public static AssetBundle GetLoadedAssetBundle(string bundleName) { if (assetBundles.ContainsKey(bundleName)) { return assetBundles[bundleName]; } ((MelonBase)mod).Unregister("Failed to get " + bundleName, false); throw new Exception("Asset '" + bundleName + "' has not been loaded in yet"); } public static T LoadAssetFromBundle(string assetName, string bundleName) where T : Object { AssetBundle loadedAssetBundle = GetLoadedAssetBundle(bundleName); if ((Object)(object)loadedAssetBundle == (Object)null) { throw new Exception("Couldn't find " + bundleName + ", Did you load it?"); } T val = loadedAssetBundle.LoadAsset(assetName); if ((Object)(object)val == (Object)null) { throw new Exception(assetName + " not found in bundle"); } return val; } } public static class Utility { public static void PrintException(Exception e) { MelonLogger.Msg(ConsoleColor.Red, e.GetType().FullName); MelonLogger.Msg(ConsoleColor.DarkRed, e.Message); if (!string.IsNullOrWhiteSpace(e.StackTrace)) { MelonLogger.Msg(ConsoleColor.DarkRed, "StackTrace:"); string[] array = e.StackTrace.Split('\n'); foreach (string text in array) { MelonLogger.Msg(ConsoleColor.DarkRed, " " + text.Trim()); } } if (e.InnerException != null) { MelonLogger.Msg(ConsoleColor.DarkRed, " -- Inner Exception --"); PrintException(e.InnerException); } } public static void Error(string msg) { MelonLogger.Msg(ConsoleColor.Red, msg); } public static void Log(string msg) { MelonLogger.Msg(ConsoleColor.DarkMagenta, msg); } public static void Success(string msg) { MelonLogger.Msg(ConsoleColor.Green, msg); } } } namespace UnicornsCustomSeeds.Seeds { [Serializable] public class UnicornSeedData { public string seedId { get; set; } public string weedId { get; set; } public string baseSeedId { get; set; } public float price { get; set; } } public class SeedFactory { private Transform rootGameObject; private WeedPlant basePlantPrefab; private PlantHarvestable baseBranchPrefab; private FunctionalSeed baseFunctionalSeedPrefab; private Equippable_Seed baseEquippableSeedPrefab; private AvatarEquippable baseAvatarEquippablePrefab; private StoredItem baseStorableItem; public SeedDefinition baseSeedDefinition; public SeedFactory(SeedDefinition seedDefinition) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown baseSeedDefinition = seedDefinition; baseFunctionalSeedPrefab = seedDefinition.FunctionSeedPrefab; baseStorableItem = ((StorableItemDefinition)seedDefinition).StoredItem; InitializeBasePlant(seedDefinition); InitializeEquippable(seedDefinition); if ((Object)(object)rootGameObject == (Object)null) { GameObject val = new GameObject(((BaseItemDefinition)baseSeedDefinition).ID + "_CustomSeeds"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); rootGameObject = val.transform; } } private void InitializeBasePlant(SeedDefinition seedDefinition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown WeedPlant val = (WeedPlant)seedDefinition.PlantPrefab; if ((Object)(object)val != (Object)null) { basePlantPrefab = val; if ((Object)(object)basePlantPrefab != (Object)null) { baseBranchPrefab = basePlantPrefab.BranchPrefab; } } else { Utility.Log("Failed to cast PlantPrefab to WeedPlant."); } } private void InitializeEquippable(SeedDefinition seedDefinition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Equippable_Seed val = (Equippable_Seed)((ItemDefinition)seedDefinition).Equippable; if ((Object)(object)val != (Object)null) { baseEquippableSeedPrefab = val; baseAvatarEquippablePrefab = ((Equippable_Viewmodel)val).AvatarEquippable; } else { Utility.Log("Failed to cast Equippable to Equippable_Seed."); } } public void DeleteChildren() { TransformExt.DeleteChildren(rootGameObject, true, false); } private void GrowLabel(Transform root, string seedDefId) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Transform val = null; Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if (((Object)val2).name == "Label") { val = ((Component)val2).transform; } } if ((Object)(object)val != (Object)null) { val.localScale = new Vector3(1.05f, 1.05f, 2f); val.position = new Vector3(0f, -0.05f, 0f); if ((Object)(object)SeedVisualsManager.customMat == (Object)null) { SeedVisualsManager.LoadSeedMaterial(); } if ((Object)(object)SeedVisualsManager.customMat != (Object)null) { Renderer component = ((Component)val).GetComponent(); component.material = SeedVisualsManager.customMat; ((Component)val).gameObject.AddComponent(); ((Object)val).name = ((Object)val).name + ":" + seedDefId; } else { Utility.Log("MATERIAL NOT LOADED!!!"); } } } public WeedPlant ClonePlantPrefab(WeedDefinition newDef) { if ((Object)(object)basePlantPrefab == (Object)null) { throw new InvalidOperationException("Base plant prefab not initialized."); } WeedPlant val = Object.Instantiate(basePlantPrefab, rootGameObject); SetPlantAppearance(newDef, val); PlantHarvestable val2 = CloneBranchPrefab(newDef); SetBranchAppearance(((Component)val2).transform, newDef); val.BranchPrefab = val2; PlantHarvestable[] componentsInChildren = ((Component)val).GetComponentsInChildren(); PlantHarvestable[] array = componentsInChildren; foreach (PlantHarvestable val3 in array) { val3.Product = (StorableItemDefinition)(object)newDef; } return val; } public void SetPlantAppearance(WeedDefinition newDef, WeedPlant plant) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) PlantGrowthStage[] growthStages = ((Plant)plant).GrowthStages; foreach (PlantGrowthStage val in growthStages) { WeedAppearanceSettings val2 = newDef.appearance; if (val2 == null) { val2 = WeedDefinition.GetAppearanceSettings(((PropertyItemDefinition)newDef).Properties); } if ((Object)(object)val != (Object)null && val2 != null) { for (int j = 0; j < ((Component)val).transform.childCount; j++) { Transform child = ((Component)val).transform.GetChild(j); if ((Object)(object)child == (Object)null) { continue; } MeshRenderer component = ((Component)child).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } Material material = ((Renderer)component).material; if ((Object)(object)material == (Object)null) { continue; } if (((Object)child).name == "Stem") { material.color = Color32.op_Implicit(val2.StemColor); } if (((Object)child).name == "BigLeaves") { material.color = Color32.op_Implicit(val2.LeafColor); } if (((Object)child).name == "SmallLeaves") { material.color = Color32.op_Implicit(val2.LeafColor); } Transform[] growthSites = val.GrowthSites; foreach (Transform val3 in growthSites) { if ((Object)(object)val3 != (Object)null) { Transform child2 = val3.GetChild(0); if (Object.op_Implicit((Object)(object)child2)) { SetBranchAppearance(child2, val2); } } } } } else { Utility.Error("Plant Stage is NULL! Thats impossible"); } } } public void SetBranchAppearance(Transform branchTransform, WeedDefinition weedDef) { WeedAppearanceSettings val = weedDef.appearance; if (val == null) { val = WeedDefinition.GetAppearanceSettings(((PropertyItemDefinition)weedDef).Properties); } if (val != null && (Object)(object)branchTransform != (Object)null) { SetBranchAppearance(branchTransform, val); } } public void SetBranchAppearance(Transform branchTransform, WeedAppearanceSettings weedAppearance) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) Transform child = branchTransform.GetChild(0); Transform val = ((child != null) ? child.GetChild(0) : null); if ((Object)(object)val == (Object)null) { return; } for (int i = 0; i < val.childCount; i++) { Transform child2 = val.GetChild(i); if ((Object)(object)child2 == (Object)null) { continue; } MeshRenderer component = ((Component)child2).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } Material material = ((Renderer)component).material; if (!((Object)(object)material == (Object)null)) { if (((Object)child2).name == "Stem") { material.color = Color32.op_Implicit(weedAppearance.StemColor); } if (((Object)child2).name == "Leaves") { material.color = Color32.op_Implicit(weedAppearance.LeafColor); } if (((Object)child2).name == "Main") { material.color = Color32.op_Implicit(weedAppearance.MainColor); } if (((Object)child2).name == "Secondary") { material.color = Color32.op_Implicit(weedAppearance.SecondaryColor); } } } } public PlantHarvestable CloneBranchPrefab(WeedDefinition newDef) { if ((Object)(object)baseBranchPrefab == (Object)null) { throw new InvalidOperationException("Base branch prefab not initialized."); } PlantHarvestable val = Object.Instantiate(baseBranchPrefab, rootGameObject); ((Object)((Component)val).gameObject).name = ((BaseItemDefinition)newDef).ID + "_Harvestable"; ((Component)val).gameObject.layer = ((Component)baseBranchPrefab).gameObject.layer; val.Product = (StorableItemDefinition)(object)newDef; return val; } public FunctionalSeed CloneFunctionalSeedPrefab(string seedDefId) { if ((Object)(object)baseFunctionalSeedPrefab == (Object)null) { throw new InvalidOperationException("Base functional seed prefab not initialized."); } FunctionalSeed val = Object.Instantiate(baseFunctionalSeedPrefab, rootGameObject); GrowLabel(((Component)val).transform, seedDefId); return val; } public Equippable_Seed CloneEquippableSeedPrefab(SeedDefinition newDef, WeedAppearanceSettings weedAppearance) { if ((Object)(object)baseEquippableSeedPrefab == (Object)null) { throw new InvalidOperationException("Base equippable seed prefab not initialized."); } Equippable_Seed val = Object.Instantiate(baseEquippableSeedPrefab, rootGameObject); GrowLabel(((Component)val).transform, ((BaseItemDefinition)newDef).ID); ((Object)((Component)val).gameObject).name = ((BaseItemDefinition)newDef).ID + "_Equippable"; ((Component)val).gameObject.layer = ((Component)baseEquippableSeedPrefab).gameObject.layer; val.Seed = newDef; ((Equippable_Viewmodel)val).AvatarEquippable = CloneAvatarEquippablePrefab(((BaseItemDefinition)newDef).ID); ((Object)((Equippable_Viewmodel)val).AvatarEquippable).name = ((BaseItemDefinition)newDef).ID + "_AvatarEquippable"; return val; } public AvatarEquippable CloneAvatarEquippablePrefab(string newDefId) { if ((Object)(object)baseAvatarEquippablePrefab == (Object)null) { throw new InvalidOperationException("Base avatar equippable prefab not initialized."); } AvatarEquippable val = Object.Instantiate(baseAvatarEquippablePrefab, rootGameObject); GrowLabel(((Component)val).transform, newDefId); return val; } public StoredItem CloneStoredItem(string newDefId) { if ((Object)(object)baseStorableItem == (Object)null) { throw new InvalidOperationException("Base Stored Item not initialized."); } StoredItem val = Object.Instantiate(baseStorableItem, rootGameObject); GrowLabel(((Component)val).transform, newDefId); return val; } public SeedDefinition CreateSeedDefinition(WeedDefinition weedDef) { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)baseSeedDefinition == (Object)null) { throw new InvalidOperationException("Base seed definition not initialized."); } SeedDefinition val = Object.Instantiate(baseSeedDefinition); WeedAppearanceSettings val2 = weedDef.appearance; if (val2 == null) { val2 = WeedDefinition.GetAppearanceSettings(((PropertyItemDefinition)weedDef).Properties); } ((Object)val).name = ((BaseItemDefinition)weedDef).ID + "_customseeddefinition"; ((BaseItemDefinition)val).ID = ((BaseItemDefinition)weedDef).ID + "_customseeddefinition"; ((BaseItemDefinition)val).Name = ((Object)weedDef).name + " Seed"; ((BaseItemDefinition)val).Description = ((Object)weedDef).name + " Seed"; ((BaseItemDefinition)val).Icon = ((BaseItemDefinition)baseSeedDefinition).Icon; ((ItemDefinition)val).Equippable = (Equippable)(object)CloneEquippableSeedPrefab(val, val2); val.PlantPrefab = (Plant)(object)ClonePlantPrefab(weedDef); val.PlantPrefab.SeedDefinition = val; val.FunctionSeedPrefab = CloneFunctionalSeedPrefab(((BaseItemDefinition)val).ID); ((Object)val.FunctionSeedPrefab).name = ((BaseItemDefinition)weedDef).ID + "Seed_Functional"; ((StorableItemDefinition)val).StoredItem = CloneStoredItem(((BaseItemDefinition)val).ID); SeedVisualsManager.appearanceMap.Add(((BaseItemDefinition)val).ID, val2); if ((Object)(object)SeedVisualsManager.baseSeedSprite != (Object)null) { try { Sprite val3 = SeedVisualsManager.GenerateSpriteWithGradient(Color32.op_Implicit(val2.MainColor), Color32.op_Implicit(val2.SecondaryColor)); ((Object)val3).name = ((Object)val).name + "_icon"; SeedVisualsManager.seedIcons.Add(((BaseItemDefinition)val).ID, val3); ((BaseItemDefinition)val).Icon = val3; } catch (Exception e) { ((BaseItemDefinition)val).Icon = SeedVisualsManager.baseSeedSprite; Utility.PrintException(e); } } return val; } } [RegisterTypeInIl2Cpp] public class SeedVialLabel : MonoBehaviour { private Renderer rend; private MaterialPropertyBlock block; public Color colorA; public Color colorB; public bool useRandomColors = false; private void Start() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //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: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (useRandomColors) { colorA = Random.ColorHSV(); colorB = Random.ColorHSV(); } rend = ((Component)this).GetComponent(); block = new MaterialPropertyBlock(); SetupLabel(); } public void SetupLabel() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rend == (Object)null) { return; } MeshFilter component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { string key = ((Object)this).name.Split(':')[1]; SeedVisualsManager.appearanceMap.TryGetValue(key, out var value); if (value != null) { colorA = Color32.op_Implicit(value.MainColor); colorB = Color32.op_Implicit(value.SecondaryColor); } Bounds bounds = component.sharedMesh.bounds; rend.GetPropertyBlock(block); block.SetColor("_ColorA", colorA); block.SetColor("_ColorB", colorB); block.SetFloat("_MinZ", ((Bounds)(ref bounds)).min.z); block.SetFloat("_MaxZ", ((Bounds)(ref bounds)).max.z); rend.SetPropertyBlock(block); } } } } namespace UnicornsCustomSeeds.SeedQuests { public class CustomSeedQuest : Quest { [SaveableField("QuestData")] private CustomSeedQuestData _data = new CustomSeedQuestData(); public QuestEntry customSeedEntry; protected override string Title => "Drop off the Mix"; protected override string Description => $"Take {StashManager.StashQtyEntry.Value}x of your weed mix and ${StashManager.StashCostEntry.Value} dollary doos to Albert Hoovers supply stash"; protected override void OnLoaded() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (base.QuestEntries.Count == 0) { customSeedEntry = ((Quest)this).AddEntry($"Give Albert {StashManager.StashQtyEntry.Value}x of a Weed Mix and ${StashManager.StashCostEntry.Value}", (Vector3?)((Component)StashManager.albertsStash).transform.position); } } protected override void OnCreated() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (base.QuestEntries.Count == 0) { customSeedEntry = ((Quest)this).AddEntry($"Give Albert {StashManager.StashQtyEntry.Value}x of a Weed Mix and ${StashManager.StashCostEntry.Value}", (Vector3?)((Component)StashManager.albertsStash).transform.position); } } } [Serializable] public class CustomSeedQuestData { public float quantity { get; set; } = 0f; public string seedId { get; set; } = string.Empty; } } namespace UnicornsCustomSeeds.Patches { [HarmonyPatch(typeof(QuestManager), "OnSpawnServer")] public static class QuestManager_OnSpawnServer_Patch { public static void Postfix(NetworkConnection connection) { if (InstanceFinder.IsServer && QuestManager.GetQuestByName("Drop off the Mix") is CustomSeedQuest) { SeedQuestManager.BroadcastCustomQuest(); } } } [HarmonyPatch(typeof(ProductManager), "OnSpawnServer")] public static class ProductManager_OnSpawnServer_NetTest { public static void Postfix(ProductManager __instance, NetworkConnection connection) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown if (connection == (NetworkConnection)null || !InstanceFinder.IsServer || connection.IsHost) { return; } List list = new List(); WeedAppearanceSettings val = new WeedAppearanceSettings(Color32.op_Implicit(__instance.DefaultWeed.MainMat.color), Color32.op_Implicit(__instance.DefaultWeed.SecondaryMat.color), Color32.op_Implicit(__instance.DefaultWeed.LeafMat.color), Color32.op_Implicit(__instance.DefaultWeed.StemMat.color)); foreach (KeyValuePair discoveredSeed in CustomSeedsManager.DiscoveredSeeds) { __instance.CreateWeed_Server("[NET-JSON]" + JsonConvert.SerializeObject((object)discoveredSeed.Value, (Formatting)0), "ogkushseed", (EDrugType)0, list, val); } } } [HarmonyPatch(typeof(ProductManager), "RpcLogic___CreateWeed_1777266891")] public static class ProductManager_RpcLogic_CreateWeed_NetTest { public static void Postfix(ProductManager __instance, NetworkConnection conn, string name, string id, EDrugType type, List properties, WeedAppearanceSettings appearance) { if (id != "ogkushseed" || name == null) { return; } if (name.StartsWith("[NET-QUEST]") && InstanceFinder.IsClientOnly) { string text = name.Replace("[NET-QUEST]", ""); try { string[] array = text.Split(','); if (array.Length == 3) { if (int.TryParse(array[0], out var result)) { StashManager.StashCostEntry.Value = result; } if (int.TryParse(array[1], out var result2)) { StashManager.StashQtyEntry.Value = result2; } if (int.TryParse(array[2], out var result3)) { StashManager.SynthesizeTime.Value = result3; } } } catch (Exception e) { Utility.PrintException(e); } if ((Object)(object)StashManager.albertsStash == (Object)null) { StashManager.GetAlbertsStash(); } CustomSeedQuest customSeedQuest = QuestManager.GetQuestByName("Drop off the Mix") as CustomSeedQuest; if (customSeedQuest == null) { SeedQuestManager.CreateQuestAsync(); } } else { if (!name.StartsWith("[NET-JSON]")) { return; } string text2 = name.Replace("[NET-JSON]", ""); try { UnicornSeedData unicornSeedData = JsonConvert.DeserializeObject(text2); if (Registry.ItemExists(unicornSeedData.seedId)) { return; } if (!CustomSeedsManager.DiscoveredSeeds.ContainsKey(unicornSeedData.weedId)) { CustomSeedsManager.DiscoveredSeeds.Add(unicornSeedData.weedId, unicornSeedData); } SeedDefinition val = CustomSeedsManager.SeedDefinitionLoader(unicornSeedData); if ((Object)(object)val != (Object)null) { try { WeedDefinition item = Registry.GetItem(unicornSeedData.weedId); float ingredientCost = StashManager.GetIngredientCost((ProductDefinition)(object)item); Singleton.Instance.Seeds.Add(val); CustomSeedsManager.CreateShopListing(val, ingredientCost); CustomSeedsManager.AddSeedToPots(val); CustomSeedsManager.EnableSeedIndicator(unicornSeedData.weedId); } catch (Exception e2) { Utility.PrintException(e2); } } if (InstanceFinder.IsClient) { DeferredPlantsManager.TrySpawnQueuedPlants(((BaseItemDefinition)val).ID); } } catch (Exception e3) { Utility.PrintException(e3); } } } } [HarmonyPatch(typeof(Pot), "RpcLogic___PlantSeed_Client_4077118173")] public static class Patch_Pot_RpcLogic___PlantSeed_Client_4077118173 { public static bool Prefix(Pot __instance, NetworkConnection conn, string seedID, float normalizedSeedProgress) { if (!InstanceFinder.IsClient || InstanceFinder.IsServer) { return true; } if (DeferredPlantsManager.IsReplaying) { return true; } if (string.IsNullOrEmpty(seedID)) { return true; } if (!seedID.Contains("customseeddefinition")) { return true; } if (Registry.ItemExists(seedID)) { return true; } DeferredPlantsManager.AddDeferredSeed(__instance, seedID, normalizedSeedProgress); return false; } } [HarmonyPatch(typeof(Pot), "RpcLogic___SetHarvestableActive_Client_338960014")] public static class Patch_Pot_RpcLogic___SetHarvestableActive_Client_338960014 { public static bool Prefix(Pot __instance, NetworkConnection conn, int harvestableIndex, bool active) { if (!InstanceFinder.IsClient || InstanceFinder.IsServer) { return true; } if (DeferredPlantsManager.PendingPotGuids.Contains(((BuildableItem)__instance).GUID.ToString())) { DeferredPlantsManager.AddHarvestableUpdate(((BuildableItem)__instance).GUID.ToString(), harvestableIndex, active); return false; } return true; } } public class ProductManagerAppPatches { [HarmonyPatch(typeof(ProductManagerApp))] public static class ProductManagerApp_Patch { [HarmonyPrefix] [HarmonyPatch("Start")] public static bool StartPatch(ProductManagerApp __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.EntryPrefab != (Object)null && (Object)(object)__instance.EntryPrefab.transform.Find("SeedIndicator") == (Object)null) { GameObject val = new GameObject("Temp"); val.SetActive(false); GameObject val2 = Object.Instantiate(__instance.EntryPrefab, val.transform); ProductEntry component = __instance.EntryPrefab.GetComponent(); GameObject val3 = Object.Instantiate(((Component)component.FavouriteButton).gameObject, val2.transform); Button component2 = val3.GetComponent