Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Opioid Expansion v1.0.0
Mods/OpioidMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.Json; using HarmonyLib; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppFishNet.Object; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.Audio; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.AvatarFramework.Animation; using Il2CppScheduleOne.AvatarFramework.Emotions; using Il2CppScheduleOne.AvatarFramework.Equipping; using Il2CppScheduleOne.Building; using Il2CppScheduleOne.Combat; using Il2CppScheduleOne.Core.Audio; using Il2CppScheduleOne.Core.Avatar; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.Delivery; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.Doors; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.Effects; using Il2CppScheduleOne.Employees; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.FX; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Growing; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Management; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.NPCs.Relation; using Il2CppScheduleOne.NPCs.Schedules; using Il2CppScheduleOne.Noise; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Packaging; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.PlayerScripts.Health; using Il2CppScheduleOne.PlayerTasks; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.StationFramework; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.Tiles; using Il2CppScheduleOne.Tools; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Handover; using Il2CppScheduleOne.UI.Items; using Il2CppScheduleOne.UI.Management; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.Delivery; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppScheduleOne.UI.Phone.ProductManagerApp; using Il2CppScheduleOne.UI.Shop; using Il2CppScheduleOne.UI.Stations; using Il2CppScheduleOne.Variables; using Il2CppScheduleOne.Vision; using Il2CppScheduleOne.VoiceOver; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using OpioidMod; using OpioidMod.Compat; using OpioidMod.Effects; using OpioidMod.Machines; using OpioidMod.Machines.Loading; using OpioidMod.Machines.Sound; using OpioidMod.Systems; using OpioidMod.Ui; using OpioidMod.Visuals; using S1API.Console; using S1API.DeadDrops.Native; using S1API.Entities; using S1API.Entities.Dialogue; using S1API.Entities.Relation; using S1API.Entities.Supplier; using S1API.Entities.Voices; using S1API.Internal.Abstraction; using S1API.Items; using S1API.Items.Buildable; using S1API.Items.Quality; using S1API.Items.Storable; using S1API.Leveling; using S1API.Lifecycle; using S1API.Map; using S1API.Map.DeliveryLocations; using S1API.Messaging; using S1API.Money; using S1API.Products; using S1API.Properties; using S1API.Properties.Interfaces; using S1API.Rendering; using S1API.Saveables; using S1API.Stations; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "Opioid Mod", "1.0.0", "JPM", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("OpioidMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OpioidMod")] [assembly: AssemblyTitle("OpioidMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 OpioidMod { internal static class Cfg { private static MelonPreferences_Category category = null; private static readonly Dictionary<string, MelonPreferences_Entry<float>> numbers = new Dictionary<string, MelonPreferences_Entry<float>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, MelonPreferences_Entry<string>> ranks = new Dictionary<string, MelonPreferences_Entry<string>>(StringComparer.OrdinalIgnoreCase); public static MelonPreferences_Entry<float> MorphinePrice = null; public static MelonPreferences_Entry<float> HeroinPrice = null; public static MelonPreferences_Entry<float> MorphineAddictiveness = null; public static MelonPreferences_Entry<float> HeroinAddictiveness = null; public static MelonPreferences_Entry<float> PoppyPodsPrice = null; public static MelonPreferences_Entry<float> DreamSyrupPrice = null; public static MelonPreferences_Entry<float> HollowSaltsPrice = null; public static MelonPreferences_Entry<float> PoppySeedPrice = null; public static MelonPreferences_Entry<float> BotanicalProcessorPrice = null; public static MelonPreferences_Entry<float> FinishingStationPrice = null; public static MelonPreferences_Entry<int> ProcessorMinutes = null; public static MelonPreferences_Entry<int> FinishingMinutes = null; public static MelonPreferences_Entry<int> MorphineUnitsPerCook = null; public static MelonPreferences_Entry<bool> ShortcutRecipes = null; public static MelonPreferences_Entry<bool> HandsOnLoading = null; public static MelonPreferences_Entry<int> MorphineCookMinutes = null; public static MelonPreferences_Entry<int> HeroinCookMinutes = null; public static MelonPreferences_Entry<int> HeroinUnitsPerCook = null; public static MelonPreferences_Entry<bool> Overdoses = null; public static MelonPreferences_Entry<bool> OverdoseDeaths = null; public static MelonPreferences_Entry<bool> Tolerance = null; public static MelonPreferences_Entry<bool> Withdrawals = null; public static MelonPreferences_Entry<bool> DependenceSystem = null; public static MelonPreferences_Entry<bool> DependenceDemand = null; public static MelonPreferences_Entry<bool> RefuseWeakOpioids = null; public static MelonPreferences_Entry<bool> WithdrawalAggression = null; public static MelonPreferences_Entry<bool> NoTeleportAway = null; public static MelonPreferences_Entry<bool> OpioidOrderChoice = null; public static MelonPreferences_Entry<bool> DoctorPractice = null; public static MelonPreferences_Entry<bool> DoctorLockedRegions = null; public static MelonPreferences_Entry<bool> DoctorVisibleEffects = null; public static MelonPreferences_Entry<string> DoctorUnlockRelationship = null; public static MelonPreferences_Entry<bool> CustomEffects = null; public static MelonPreferences_Entry<bool> ScreenEffects = null; public static MelonPreferences_Entry<bool> NpcSpeechBubbles = null; public static MelonPreferences_Entry<bool> PlayerOverdoses = null; public static MelonPreferences_Entry<bool> PlayerOverdoseDeaths = null; public static MelonPreferences_Entry<string> DocUnlockRank = null; public static MelonPreferences_Entry<string> DrugCategory = null; public static void Init() { category = MelonPreferences.CreateCategory("OpioidMod", "Opioid Mod"); MorphinePrice = category.CreateEntry<float>("MorphinePrice", 90f, "Morphine price", "Starting market price for one unit of morphine.", false, false, (ValueValidator)null, (string)null); HeroinPrice = category.CreateEntry<float>("HeroinPrice", 180f, "Heroin price", "Starting market price for one unit of heroin.", false, false, (ValueValidator)null, (string)null); MorphineAddictiveness = category.CreateEntry<float>("MorphineAddictiveness", 0.55f, "Morphine addictiveness", "0 to 1. For comparison, Ecstasy Mod uses 0.35.", false, false, (ValueValidator)null, (string)null); HeroinAddictiveness = category.CreateEntry<float>("HeroinAddictiveness", 0.75f, "Heroin addictiveness", "0 to 1.", false, false, (ValueValidator)null, (string)null); PoppyPodsPrice = category.CreateEntry<float>("PoppyPodsPrice", 40f, "Dried Poppy Pods value", "No longer sold; sets the resale value of pods bought before v0.3.", false, false, (ValueValidator)null, (string)null); DreamSyrupPrice = category.CreateEntry<float>("DreamSyrupPrice", 60f, "Botanical Processing Agent price", "Doc's price per unit.", false, false, (ValueValidator)null, (string)null); HollowSaltsPrice = category.CreateEntry<float>("HollowSaltsPrice", 80f, "Refinery Processing Agent price", "Doc's price per unit.", false, false, (ValueValidator)null, (string)null); PoppySeedPrice = category.CreateEntry<float>("PoppySeedPrice", 25f, "Opium Poppy Seeds price", "Doc's price per seed.", false, false, (ValueValidator)null, (string)null); Num("PoppyColdPeak", 3f, "Poppy growth at 0 C", "How fast Opium Poppies grow in the coldest pot (0 C, right by an AC on Cooling), times normal, 1 to 10. At room temperature (20 C) they grow at normal speed; the colder, the faster, and the bonus builds fastest close to freezing (with 3: 1.7x at 10 C, 2.3x at 5 C). Other plants are unchanged. In multiplayer everyone needs the same value."); Num("PoppyHeatHalving", 5f, "Poppy heat slowdown (C)", "Every this many degrees above room temperature (20 C) halves how fast Opium Poppies grow, 1 to 40. With 5: half speed at 25 C, a quarter at 30 C, a sixteenth at 40 C (an AC on Heating). Other plants are unchanged. In multiplayer everyone needs the same value."); BotanicalProcessorPrice = category.CreateEntry<float>("BotanicalProcessorPrice", 1500f, "Botanical Processor price", "Oscar's price.", false, false, (ValueValidator)null, (string)null); FinishingStationPrice = category.CreateEntry<float>("FinishingStationPrice", 1200f, "Finishing Station price", "Oscar's price.", false, false, (ValueValidator)null, (string)null); ProcessorMinutes = category.CreateEntry<int>("ProcessorMinutes", 120, "Botanical Processor cycle", "In-game minutes for one extraction cycle.", false, false, (ValueValidator)null, (string)null); FinishingMinutes = category.CreateEntry<int>("FinishingMinutes", 120, "Finishing Station cycle (morphine)", "In-game minutes for one morphine finishing cycle.", false, false, (ValueValidator)null, (string)null); MorphineUnitsPerCook = category.CreateEntry<int>("MorphineUnitsPerCook", 10, "Morphine per batch", "Units of morphine one Botanical Extract makes at the Finishing Station.", false, false, (ValueValidator)null, (string)null); ShortcutRecipes = category.CreateEntry<bool>("ShortcutRecipes", false, "Shortcut recipes", "Also allow the old one-step morphine and heroin recipes at a normal chemistry station.", false, false, (ValueValidator)null, (string)null); HandsOnLoading = category.CreateEntry<bool>("HandsOnLoading", true, "Hands-on machine loading", "Begin on one of the mod's machines runs a short hands-on step: press E to pour or tip each ingredient in, hold E to mix, press E to start. Off: Begin starts the cycle straight away.", false, false, (ValueValidator)null, (string)null); MorphineCookMinutes = category.CreateEntry<int>("MorphineCookMinutes", 240, "Shortcut morphine cook time", "In-game minutes for the old one-step morphine recipe.", false, false, (ValueValidator)null, (string)null); HeroinCookMinutes = category.CreateEntry<int>("HeroinCookMinutes", 360, "Shortcut heroin cook time", "In-game minutes for the old one-step heroin recipe.", false, false, (ValueValidator)null, (string)null); HeroinUnitsPerCook = category.CreateEntry<int>("HeroinUnitsPerCook", 8, "Heroin per batch", "Units of heroin one Refined Batch makes at the Finishing Station.", false, false, (ValueValidator)null, (string)null); Num("OxycodonePrice", 110f, "Oxycodone price", "Starting market price for one Oxycodone Tablet."); Num("PercocetPrice", 80f, "Percocet price", "Starting market price for one Percocet."); Num("FentanylPrice", 300f, "Fentanyl price", "Starting market price for one unit of fentanyl."); Num("LacedHeroinPrice", 260f, "Laced Heroin price", "Starting market price for one unit of laced heroin."); Num("OxycodoneAddictiveness", 0.6f, "Oxycodone addictiveness", "0 to 1."); Num("PercocetAddictiveness", 0.45f, "Percocet addictiveness", "0 to 1."); Num("FentanylAddictiveness", 0.9f, "Fentanyl addictiveness", "0 to 1."); Num("LacedHeroinAddictiveness", 0.9f, "Laced Heroin addictiveness", "0 to 1."); Num("PharmaBasePrice", 150f, "Pharmaceutical Base price", "Doc's price per unit."); Num("TabletFillerPrice", 35f, "Tablet Filler price", "Doc's price per unit."); Num("AcetaminophenPrice", 50f, "Acetaminophen Component price", "Doc's price per unit."); Num("SyntheticFeedstockPrice", 600f, "Synthetic Feedstock price", "Doc's price per unit."); Num("SyntheticAgentPrice", 450f, "Synthetic Processing Agent price", "Doc's price per unit."); Num("NarcanPrice", 120f, "Narcan price", "Doc's price per dose."); Num("IndustrialRefineryPrice", 3500f, "Industrial Refinery price", "Oscar's price."); Num("PharmaMixerPrice", 2000f, "Pharmaceutical Mixer price", "Oscar's price."); Num("TabletPressPrice", 5000f, "Tablet Press price", "Oscar's price."); Num("CombinationMachinePrice", 4000f, "Combination Formulation Machine price", "Oscar's price."); Num("IndustrialLabPrice", 15000f, "Industrial Laboratory price", "Oscar's price. The most expensive line to set up."); Num("MachineSize", 1f, "Machine size", "Scales every machine model, 0.5 to 2. At 1 they're about a quarter bigger than the 2 x 1 m spot they're placed on, overhanging it about 25 cm to each side and toward the front (the back stays flush, for walls). Leave room between them, or lower this to about 0.8 to fit the spot exactly."); Num("MachineSoundVolume", 1f, "Machine sound volume", "Loudness of the machines' sounds (their running hum, start-up and done sounds, and the hands-on loading steps), 0 to 2, on top of the game's own sound-effects volume. 0 silences them."); Num("RefineryMinutes", 180f, "Industrial Refinery cycle", "In-game minutes."); Num("HeroinFinishingMinutes", 120f, "Finishing Station cycle (heroin)", "In-game minutes."); Num("MixerMinutes", 90f, "Pharmaceutical Mixer cycle", "In-game minutes."); Num("PressMinutes", 60f, "Tablet Press cycle", "In-game minutes."); Num("CombinationMinutes", 90f, "Combination Machine cycle (Percocet)", "In-game minutes."); Num("LacingMinutes", 60f, "Combination Machine cycle (lacing)", "In-game minutes."); Num("LabMinutes", 360f, "Industrial Laboratory cycle", "In-game minutes."); Num("PressUnits", 24f, "Tablet Press batch", "Oxycodone Tablets per Tablet Blend."); Num("PercocetUnits", 10f, "Percocet per batch", "Percocet per Combination Machine cycle (4 Oxycodone Tablets + 1 Acetaminophen)."); Num("LacedHeroinUnits", 5f, "Laced Heroin per batch", "From 4 heroin and 1 fentanyl."); Num("FentanylUnits", 12f, "Fentanyl per batch", "Units of fentanyl per laboratory program."); RankEntry("HeroinLineRank", "Bagman", "Heroin line rank", "Rank needed to buy the Industrial Refinery and its agent."); RankEntry("OxyLineRank", "Enforcer", "Oxy line rank", "Rank needed for the Pharmaceutical Mixer, Tablet Press and their ingredients."); RankEntry("PercocetLineRank", "ShotCaller", "Percocet line rank", "Rank needed for the Combination Machine and Acetaminophen."); RankEntry("FentanylLineRank", "BlockBoss", "Fentanyl line rank", "Rank needed for the Industrial Laboratory and its ingredients."); Num("PharmaBaseLowPrice", 90f, "Cut-Rate Pharmaceutical Base price", "Doc's price per unit. Makes Poor quality."); Num("PharmaBaseHighPrice", 300f, "Pharma-Grade Pharmaceutical Base price", "Doc's price per unit. Makes Premium quality."); Num("SyntheticFeedstockLowPrice", 360f, "Cut-Rate Synthetic Feedstock price", "Doc's price per unit. Makes Poor quality."); Num("SyntheticFeedstockHighPrice", 1200f, "Pharma-Grade Synthetic Feedstock price", "Doc's price per unit. Makes Premium quality."); Num("PurifyingAgentPrice", 150f, "Purifying Agent price", "Doc's price per unit. One is used per purification pass."); Num("PurifyUnits", 5f, "Units per purification pass", "Units of a drug one Purifying Agent takes up a quality tier at the Finishing Station, 1 to 20."); Num("PurifyMinutes", 30f, "Finishing Station cycle (purification)", "In-game minutes."); RankEntry("PharmaGradeBaseRank", "ShotCaller", "Pharma-Grade base rank", "Rank needed to buy Pharma-Grade Pharmaceutical Base."); RankEntry("PharmaGradeFeedstockRank", "Underlord", "Pharma-Grade feedstock rank", "Rank needed to buy Pharma-Grade Synthetic Feedstock."); Overdoses = category.CreateEntry<bool>("Overdoses", true, "Overdoses", "Customers can overdose after taking an opioid. Revive them with Narcan in time.", false, false, (ValueValidator)null, (string)null); OverdoseDeaths = category.CreateEntry<bool>("OverdoseDeaths", true, "Overdose deaths", "A customer nobody revives dies and is gone for a few days (as when an NPC is killed). Off: they wake up on their own, still upset.", false, false, (ValueValidator)null, (string)null); Num("OverdoseWindowSeconds", 120f, "Narcan window", "Real seconds you have to reach an overdosing customer with Narcan."); Num("RiskPercocet", 0.5f, "Percocet overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Num("RiskOxycodone", 1f, "Oxycodone overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Num("RiskMorphine", 1f, "Morphine overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Num("RiskHeroin", 4f, "Heroin overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Num("RiskLacedHeroin", 12f, "Laced Heroin overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Num("RiskFentanyl", 20f, "Fentanyl overdose risk", "Base percent chance per dose before tolerance reduction (50% cap). Maximum tolerance lowers this by 75%."); Tolerance = category.CreateEntry<bool>("Tolerance", true, "Tolerance ladder", "Regulars build tolerance from their first dose: weaker opioids gradually stop doing it for them (Percs, then Oxy and morphine) and they want something stronger.", false, false, (ValueValidator)null, (string)null); Num("ToleranceWeightPercocet", 0.2f, "Percocet tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("ToleranceWeightOxycodone", 0.25f, "Oxycodone tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("ToleranceWeightMorphine", 0.25f, "Morphine tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("ToleranceWeightHeroin", 0.4f, "Heroin tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("ToleranceWeightLacedHeroin", 0.5f, "Laced Heroin tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("ToleranceWeightFentanyl", 0.6f, "Fentanyl tolerance weight", "Tolerance one dose builds, 0 to 2. A customer's tolerance runs from 0 to 2: Percs fade between 0 and 1, Oxy and morphine between 1 and 2. Percs can't build it past 1."); Num("WeakProductAppeal", 0.45f, "Appeal of too-weak opioids", "0 to 1: how much a customer still likes an opioid once it's fully too weak for them."); Num("ToleranceRecoverySeconds", 1800f, "Tolerance recovery interval", "Loaded gameplay seconds without opioids per level lost."); DependenceSystem = category.CreateEntry<bool>("DependenceSystem", true, "Dependence system", "Every opioid customer has a dependence score, 0 to 100, that builds with each dose and falls when they go without. It puts them in a stage: Curious, Regular, Hooked, Dependent.", false, false, (ValueValidator)null, (string)null); Num("DependenceWeightPercocet", 3f, "Percocet dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceWeightOxycodone", 5f, "Oxycodone dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceWeightMorphine", 5f, "Morphine dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceWeightHeroin", 8f, "Heroin dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceWeightLacedHeroin", 10f, "Laced Heroin dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceWeightFentanyl", 12f, "Fentanyl dependence weight", "Dependence one dose builds (the score runs 0 to 100)."); Num("DependenceRegular", 15f, "Regular stage starts at", "Dependence score, 1 to 98."); Num("DependenceHooked", 40f, "Hooked stage starts at", "Dependence score; must be above the Regular one."); Num("DependenceDependent", 70f, "Dependent stage starts at", "Dependence score; must be above the Hooked one."); Num("DependenceGraceDays", 2f, "Days before dependence falls", "In-game days of play without a dose before the score starts to fall."); Num("DependenceDecayPerDay", 1.5f, "Dependence lost per day", "Points lost per in-game day of play once it's falling."); DependenceDemand = category.CreateEntry<bool>("DependenceDemand", true, "Dependence demand", "Regular, Hooked and Dependent customers order more often, spend more on opioids and pay more per unit. Dependent ones also come looking for you. Needs the Dependence system on.", false, false, (ValueValidator)null, (string)null); Num("DemandWeeklySpendRegular", 1.6f, "Regular weekly spend", "What a customer at this stage spends on our opioids a week, times the base game's (1 = no change). It's never less than 1 + the price premium."); Num("DemandWeeklySpendHooked", 2.6f, "Hooked weekly spend", "What a customer at this stage spends on our opioids a week, times the base game's (1 = no change). It's never less than 1 + the price premium."); Num("DemandWeeklySpendDependent", 5f, "Dependent weekly spend", "What a customer at this stage spends on our opioids a week, times the base game's (1 = no change). It's never less than 1 + the price premium."); Num("DemandPricePremiumRegular", 10f, "Regular price premium", "Percent more per unit this stage pays for our opioids, in orders and when judging your offers."); Num("DemandPricePremiumHooked", 25f, "Hooked price premium", "Percent more per unit this stage pays for our opioids, in orders and when judging your offers."); Num("DemandPricePremiumDependent", 40f, "Dependent price premium", "Percent more per unit this stage pays for our opioids, in orders and when judging your offers."); Num("DemandExtraDaysRegular", 1f, "Regular extra order days", "Order days a week added to the base game's (at most 7 in all)."); Num("DemandExtraDaysHooked", 2f, "Hooked extra order days", "Order days a week added to the base game's (at most 7 in all)."); Num("DemandExtraDaysDependent", 3f, "Dependent extra order days", "Order days a week added to the base game's (at most 7 in all)."); Num("DemandMinDaysDependent", 6f, "Dependent order days at least", "A Dependent customer orders on at least this many days a week."); Num("DemandAddictionDependent", 90f, "Dependent addiction held at", "Percent. The base game's addiction is kept at least this high for Dependent customers; from 33% the game has them walk up to you when you're close, more often the higher it is. 0 = off."); RefuseWeakOpioids = category.CreateEntry<bool>("RefuseWeakOpioids", true, "Too-weak opioids refused", "Once an opioid is fully too weak for a customer (Percs at tolerance 1, Oxy and morphine at 2), they won't order it and refuse offers and counteroffers of it. Hooked and Dependent customers text you for the next drug by name. Needs the tolerance ladder on.", false, false, (ValueValidator)null, (string)null); Num("DemandTextDays", 1f, "Days between demand texts", "In-game days of play between a Hooked or Dependent customer's texts asking for a stronger opioid when nothing you sell works for them."); Num("CustomerTextFrequency", 1f, "Customer text frequency", "0 to 3. Customers text you about their opioids only some of the time, with odds that depend on why (a passing remark after a dose is rare, withdrawal and replies to your counteroffers are likely). This multiplies every one of those odds: 0.5 is half as many texts, 2 twice as many, 0 none at all."); Num("CustomerTextGapHours", 8f, "Quiet hours after a customer texts", "In-game hours a customer stays quiet after texting you, 0 to 72 (passing remarks wait three times as long). Withdrawal, referrals and replies to your counteroffers aren't held back."); Withdrawals = category.CreateEntry<bool>("CustomerWithdrawals", true, "Customer withdrawals", "Hooked and Dependent customers who go without an opioid go into withdrawal: rough, then agitated (they come looking for you and like you less), then for Dependent ones crazy. A dose from you or a dealer ends it and their orders pay a surge premium meanwhile; left alone they drop a stage and stay angry. Needs the Dependence system on.", false, false, (ValueValidator)null, (string)null); Num("WithdrawalOnsetDaysHooked", 2.5f, "Hooked: days before withdrawal", "In-game days of play without a dose before a Hooked customer goes into withdrawal."); Num("WithdrawalOnsetDaysDependent", 1.5f, "Dependent: days before withdrawal", "In-game days of play without a dose before a Dependent customer goes into withdrawal."); Num("WithdrawalStepDays", 1f, "Days per withdrawal step", "In-game days of play in each step (rough, agitated, and for Dependent customers crazy). Left alone, it ends after the last one."); Num("WithdrawalSurgePremium", 25f, "Withdrawal surge premium", "Percent more they pay for opioids while in withdrawal, on top of their stage's premium."); Num("WithdrawalRelationshipPerDay", 0.5f, "Relationship lost per day", "Relationship (out of 5) lost per in-game day while agitated; twice as fast while crazy."); Num("WithdrawalEndRelationship", 0.5f, "Relationship lost if left alone", "Relationship lost when a withdrawal runs its course without you."); WithdrawalAggression = category.CreateEntry<bool>("WithdrawalAggression", true, "Withdrawal swings", "A Dependent customer in the crazy step of withdrawal may take a swing at you when you're right next to them (the game's own fight, as when an aggressive customer's deal is rejected).", false, false, (ValueValidator)null, (string)null); OpioidOrderChoice = category.CreateEntry<bool>("OpioidOrderChoice", true, "Customers choose their opioid", "When the base game gives a customer an opioid order, they order the opioid their tolerance, dependence stage, withdrawal and preference point to (Percs early on, Oxy and morphine next, then heroin, then fentanyl and laced heroin), out of the opioids you have for sale. How often they order opioids and other drugs is unchanged. Off: the base game's list order decides.", false, false, (ValueValidator)null, (string)null); Num("OrderChoicePushHooked", 0.5f, "Hooked: stronger opioid", "How many strength steps this adds to the opioid a customer aims for (Percs 1, Oxy and morphine 2, heroin 3, fentanyl and laced heroin 4; the aim starts at 1 + their tolerance)."); Num("OrderChoicePushDependent", 1f, "Dependent: stronger opioid", "How many strength steps this adds to the opioid a customer aims for (Percs 1, Oxy and morphine 2, heroin 3, fentanyl and laced heroin 4; the aim starts at 1 + their tolerance)."); Num("OrderChoicePushWithdrawal", 1f, "In withdrawal: stronger opioid", "How many strength steps this adds to the opioid a customer aims for (Percs 1, Oxy and morphine 2, heroin 3, fentanyl and laced heroin 4; the aim starts at 1 + their tolerance). Uses the larger of this and the stage's."); Num("OrderChoicePushPreference", 0.5f, "Preference: stronger opioid", "Steps added at full liking of opioids (taken away at full dislike), scaled by their preference."); Num("OrderChoiceSpread", 0.6f, "Opioid choice spread", "How often a customer orders a step away from their aim. 0.6: about 1 in 5 orders is a step either side; lower is stricter."); Num("PreferenceLikePercocet", 70f, "Percocet like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikePercocet", 30f, "Percocet dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceLikeOxycodone", 75f, "Oxycodone like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikeOxycodone", 25f, "Oxycodone dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceLikeMorphine", 80f, "Morphine like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikeMorphine", 20f, "Morphine dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceLikeHeroin", 85f, "Heroin like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikeHeroin", 15f, "Heroin dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceLikeLacedHeroin", 90f, "LacedHeroin like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikeLacedHeroin", 10f, "LacedHeroin dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceLikeFentanyl", 95f, "Fentanyl like chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceDislikeFentanyl", 5f, "Fentanyl dislike chance", "Percent per consumed dose. If combined chances exceed 100, both are scaled proportionally."); Num("PreferenceStep", 10f, "Preference change per dose", "Points toward liking or disliking; score is -100 to 100."); Num("PreferenceOverdosePenalty", 25f, "Overdose preference loss", "Preference points lost after an overdose."); DoctorPractice = category.CreateEntry<bool>("DoctorPractice", true, "The doctor's practice", "Dr. Okoro stands next to the medical centre. Once Doc introduces him you can pay him to put people on your Percs, Oxy and morphine: your customers and people who aren't customers yet. When pills stop working for a patient he refers them to you. Needs the tolerance ladder on.", false, false, (ValueValidator)null, (string)null); DoctorUnlockRelationship = category.CreateEntry<string>("DoctorUnlockRelationship", "Friendly", "Doctor unlock: relationship with Doc", "How well you need to get on with Doc before he introduces Dr. Okoro: Unfriendly, Neutral, Friendly or Loyal. Paying off what you owe Doc at his stash raises it (+0.5 out of 5 for every $6,000 paid; he starts at 1.5, Friendly is 3). In multiplayer the host's game decides, and every player's payments count.", false, false, (ValueValidator)null, (string)null); Num("DoctorHireFee", 5000f, "Doctor: setup fee", "Cash you pay Dr. Okoro once to start prescribing for you."); Num("DoctorFeePerUnit", 25f, "Doctor: fee per unit", "Cash he charges for each loose Perc, Oxy or morphine he takes off you."); Num("DoctorPatients", 8f, "Doctor: patients", "How many people he has on your pills at a time."); Num("DoctorDosesPerDay", 2f, "Doctor: doses per patient per day", "Units each patient gets per in-game day of play. With the default tolerance weights a new patient is referred after 9 doses."); Num("DoctorReferralDependence", 40f, "Doctor: dependence at referral", "A referred patient arrives with at least this dependence score (40 = Hooked by default). 0 = whatever they built up."); DoctorLockedRegions = category.CreateEntry<bool>("DoctorLockedRegions", false, "Doctor: patients from locked regions", "On: he also takes people from regions you haven't unlocked, so they can be referred to you before you can deal there.", false, false, (ValueValidator)null, (string)null); DoctorVisibleEffects = category.CreateEntry<bool>("DoctorVisibleEffects", true, "Doctor: patients show their high", "His patients take each dose where they are (the use animation) and show the drug's effects, as if you'd sold it to them. The dose is still only counted once, and there's no overdose risk. Skipped for anyone driving, in a deal with you, or already high.", false, false, (ValueValidator)null, (string)null); CustomEffects = category.CreateEntry<bool>("CustomEffects", true, "Custom opioid effects", "Each opioid has its own six effects (Warm Euphoria, Nodding, Rubber Legs and so on) that change how customers look and act, and how you feel if you take one. Off: the old base-game effects. Takes effect after restarting the game. In multiplayer everyone needs the same setting.", false, false, (ValueValidator)null, (string)null); Num("EffectStrength", 1f, "Effect strength", "0 to 2. Scales how strong the custom effects look and feel. 1 is normal."); ScreenEffects = category.CreateEntry<bool>("ScreenEffects", true, "Screen effects", "Tints, glow, vignettes, eyelids, fades and camera sway when you take an opioid yourself. Off: only the gameplay side (speed, damage, sound).", false, false, (ValueValidator)null, (string)null); NpcSpeechBubbles = category.CreateEntry<bool>("NpcSpeechBubbles", true, "Customer speech bubbles", "Customers on opioids now and then say how they feel.", false, false, (ValueValidator)null, (string)null); Num("NpcEffectSeconds", 0f, "Customer effect length", "Real seconds one dose's effects last on a customer. 0 = game default. Takes effect after restarting the game; in multiplayer everyone needs the same value."); Num("PlayerEffectSeconds", 0f, "Your effect length", "Real seconds one dose's effects last on you. 0 = game default. Takes effect after restarting the game; in multiplayer everyone needs the same value."); Num("WithdrawalSeconds", 90f, "Withdrawal length", "Real seconds of withdrawal after heroin wears off, for repeat users."); PlayerOverdoses = category.CreateEntry<bool>("PlayerOverdoses", true, "You can overdose", "Fentanyl and laced heroin can make you overdose too. Use Narcan on yourself in time.", false, false, (ValueValidator)null, (string)null); Num("PlayerOverdoseChance", 10f, "Your overdose risk", "Percent chance per dose of fentanyl or laced heroin."); Num("PlayerOverdoseWindowSeconds", 45f, "Your Narcan window", "Real seconds you have to use Narcan on yourself."); PlayerOverdoseDeaths = category.CreateEntry<bool>("PlayerOverdoseDeaths", true, "You can die of an overdose", "Off: you black out and come round instead.", false, false, (ValueValidator)null, (string)null); DocUnlockRank = category.CreateEntry<string>("DocUnlockRank", "Hustler", "Doc unlock rank", "Rank at which Doc gets in touch: StreetRat, Hoodlum, Peddler, Hustler, Bagman, Enforcer, ShotCaller, BlockBoss, Underlord, Baron, Kingpin.", false, false, (ValueValidator)null, (string)null); DrugCategory = category.CreateEntry<string>("DrugCategory", "Heroin", "Drug category", "How the game files these drugs behind the scenes: Heroin (the game's unused heroin slot) or Cocaine (fallback if Heroin causes problems). Only change this on a new save.", false, false, (ValueValidator)null, (string)null); NoTeleportAway = category.CreateEntry<bool>("NoTeleportAway", true, "No teleporting away", "People near you never teleport or vanish away (after a walk-up, a deal or turning them down): they walk off instead. Walking up to you still starts near you, as in the base game. Applies to everyone, not only opioid customers. Off: the base game's teleports.", false, false, (ValueValidator)null, (string)null); Num("NoTeleportAwayRange", 40f, "No teleporting within (m)", "Metres from you, 5 to 500. Further away than this, the base game may still teleport people out of sight."); } public static string MultiplayerCode() { List<string> list = new List<string>(); foreach (MelonPreferences_Entry entry in category.Entries) { string identifier = entry.Identifier; bool flag = identifier.Contains("Price", StringComparison.OrdinalIgnoreCase) || identifier.Contains("Addictiveness", StringComparison.OrdinalIgnoreCase) || identifier.Contains("Units", StringComparison.OrdinalIgnoreCase) || identifier.Contains("Minutes", StringComparison.OrdinalIgnoreCase) || identifier.EndsWith("Rank", StringComparison.OrdinalIgnoreCase) || identifier.EndsWith("EffectSeconds", StringComparison.OrdinalIgnoreCase); if (!flag) { bool flag2; switch (identifier) { case "CustomEffects": case "DrugCategory": case "ShortcutRecipes": flag2 = true; break; default: flag2 = false; break; } flag = flag2; } bool flag3 = flag; if (!flag3) { bool flag2 = ((identifier == "PoppyColdPeak" || identifier == "PoppyHeatHalving") ? true : false); flag3 = flag2; } if (flag3) { list.Add(identifier.ToLowerInvariant() + "=" + entry.GetValueAsString()?.Trim().ToLowerInvariant()); } } list.Sort(StringComparer.Ordinal); uint num = 2166136261u; string text = string.Join("|", list); foreach (char c in text) { num = (num ^ c) * 16777619; } return $"{num >> 16:X4}-{num & 0xFFFF:X4}"; } private static void Num(string key, float value, string label, string description) { numbers[key] = category.CreateEntry<float>(key, value, label, description, false, false, (ValueValidator)null, (string)null); } private static void RankEntry(string key, string value, string label, string description) { ranks[key] = category.CreateEntry<string>(key, value, label, description, false, false, (ValueValidator)null, (string)null); } public static float Number(string key, float fallback, float min, float max) { if (!numbers.TryGetValue(key, out MelonPreferences_Entry<float> value)) { return fallback; } float value2 = value.Value; if (!float.IsFinite(value2) || !(value2 >= min) || !(value2 <= max)) { return fallback; } return value2; } public static int Count(string key, int fallback, int min, int max) { return (int)Math.Round(Number(key, fallback, min, max)); } public static float ItemPrice(string key, float fallback) { return Number(key, fallback, 1f, 999f); } public static float MachinePrice(string key, float fallback) { return Number(key, fallback, 1f, 99999f); } public static int Minutes(string key, int fallback) { return Count(key, fallback, 1, 1440); } public static Rank RankSetting(string key, Rank fallback) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!ranks.TryGetValue(key, out MelonPreferences_Entry<string> value) || !Enum.TryParse<Rank>(value.Value?.Trim(), ignoreCase: true, out Rank result)) { return fallback; } return result; } public static float Price(MelonPreferences_Entry<float> entry, float fallback, float max = 999f) { float value = entry.Value; if (!float.IsFinite(value) || !(value >= 1f)) { return fallback; } return Math.Min(value, max); } public static float MachinePrice(MelonPreferences_Entry<float> entry, float fallback) { return Price(entry, fallback, 99999f); } public static float Addictiveness(MelonPreferences_Entry<float> entry, float fallback) { float value = entry.Value; if (!float.IsFinite(value)) { return fallback; } return Math.Clamp(value, 0f, 1f); } public static int Whole(MelonPreferences_Entry<int> entry, int min, int max, int fallback) { int value = entry.Value; if (value < min || value > max) { return fallback; } return value; } public static ERelationshipCategory DoctorUnlockLevel() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!Enum.TryParse<ERelationshipCategory>(DoctorUnlockRelationship.Value?.Trim(), ignoreCase: true, out ERelationshipCategory result) || !Enum.IsDefined(typeof(ERelationshipCategory), result) || (int)result == 0) { return (ERelationshipCategory)3; } return result; } public static Rank UnlockRank() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!Enum.TryParse<Rank>(DocUnlockRank.Value?.Trim(), ignoreCase: true, out Rank result)) { return (Rank)3; } return result; } } internal static class Content { public static CustomProductDefinition? Morphine; public static CustomProductDefinition? Heroin; public static CustomProductDefinition? Oxycodone; public static CustomProductDefinition? Percocet; public static CustomProductDefinition? Fentanyl; public static CustomProductDefinition? LacedHeroin; private static bool ingredientsDone; private static bool productsDone; private static bool recipesDone; public static readonly Color CutRateTint = new Color(0.62f, 0.56f, 0.5f); public static readonly Color PharmaGradeTint = new Color(1f, 0.86f, 0.45f); public static readonly Color PurifierTint = new Color(0.72f, 0.55f, 0.95f); private static readonly HashSet<string> seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static bool discoveryActive; private static float nextDiscoveryCheck; private static readonly Dictionary<string, int> LargestBatch = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); public static void RegisterAll() { Step("ingredients", RegisterIngredients); Step("products", RegisterProducts); Step("product inputs", ProductInputs.Prepare); Step("poppy seeds", Growing.RegisterSeed); Step("Narcan", Narcan.Register); Step("machines", OpioidMod.Machines.Machines.Register); Step("recipes", RegisterRecipes); Step("shared recipes", OpioidMod.Machines.Machines.ShareRecipes); Step("stack sizes", FitStacks); Step("icons", Looks.TryMakeIcons); } private static void Step(string what, Action action) { try { action(); } catch (Exception value) { Log.Error($"Could not register {what}: {value}"); } } public static FullRank? RankFor(string settingKey, Rank fallback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new FullRank(Cfg.RankSetting(settingKey, fallback), 1); } private static void RegisterIngredients() { //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) if (!ingredientsDone) { Ingredient("opioidmod_poppypods", "pseudo", "Dried Poppy Pods", "Old stock from Doc. They work like Opium Poppy in the Botanical Processor, but Doc doesn't sell them any more: grow your own.", Cfg.Price(Cfg.PoppyPodsPrice, 40f)); Ingredient("opioidmod_dreamsyrup", "acid", "Botanical Processing Agent", "Doc's own blend. Goes into the Botanical Processor with the poppies.", Cfg.Price(Cfg.DreamSyrupPrice, 60f)); Ingredient("opioidmod_hollowsalts", "phosphorus", "Refinery Processing Agent", "Grey crystals for the Industrial Refinery. Refines morphine into a heroin batch.", Cfg.Price(Cfg.HollowSaltsPrice, 80f), RankFor("HeroinLineRank", (Rank)4)); Ingredient("opioidmod_pharmabase", "pseudo", "Pharmaceutical Base", "The base for tablet production. Mix it with Tablet Filler in the Pharmaceutical Mixer.", Cfg.ItemPrice("PharmaBasePrice", 150f), RankFor("OxyLineRank", (Rank)5)); Ingredient("opioidmod_tabletfiller", "phosphorus", "Tablet Filler", "Bulks out a tablet blend so it presses cleanly.", Cfg.ItemPrice("TabletFillerPrice", 35f), RankFor("OxyLineRank", (Rank)5)); Ingredient("opioidmod_acetaminophen", "phosphorus", "Acetaminophen Component", "Combined with Oxycodone Tablets in the Combination Formulation Machine to make Percocet.", Cfg.ItemPrice("AcetaminophenPrice", 50f), RankFor("PercocetLineRank", (Rank)6)); Ingredient("opioidmod_syntheticfeedstock", "acid", "Synthetic Feedstock", "Expensive laboratory feedstock for the Industrial Laboratory.", Cfg.ItemPrice("SyntheticFeedstockPrice", 600f), RankFor("FentanylLineRank", (Rank)7)); Ingredient("opioidmod_syntheticagent", "acid", "Synthetic Processing Agent", "Goes into the Industrial Laboratory with the feedstock.", Cfg.ItemPrice("SyntheticAgentPrice", 450f), RankFor("FentanylLineRank", (Rank)7)); Ingredient("opioidmod_pharmabase_low", "pseudo", "Cut-Rate Pharmaceutical Base", "Doc's cheapest base. Tablets made from it come out Poor quality.", Cfg.ItemPrice("PharmaBaseLowPrice", 90f), RankFor("OxyLineRank", (Rank)5)); Ingredient("opioidmod_pharmabase_high", "pseudo", "Pharma-Grade Pharmaceutical Base", "The real thing, straight from a hospital supplier. Tablets made from it come out Premium quality.", Cfg.ItemPrice("PharmaBaseHighPrice", 300f), RankFor("PharmaGradeBaseRank", (Rank)6)); Ingredient("opioidmod_syntheticfeedstock_low", "acid", "Cut-Rate Synthetic Feedstock", "Doc's cheapest feedstock. Fentanyl made from it comes out Poor quality.", Cfg.ItemPrice("SyntheticFeedstockLowPrice", 360f), RankFor("FentanylLineRank", (Rank)7)); Ingredient("opioidmod_syntheticfeedstock_high", "acid", "Pharma-Grade Synthetic Feedstock", "Laboratory-certified feedstock. Fentanyl made from it comes out Premium quality.", Cfg.Number("SyntheticFeedstockHighPrice", 1200f, 1f, 9999f), RankFor("PharmaGradeFeedstockRank", (Rank)8)); Ingredient("opioidmod_purifyingagent", "acid", "Purifying Agent", "Takes any opioid up one quality tier. Load it into the Pharmaceutical Finishing Station with unpackaged product and run the purification program.", Cfg.ItemPrice("PurifyingAgentPrice", 150f)); QualityIngredient("opioidmod_opiumpoppy", "Opium Poppy", "Ripe poppy pods, fresh from your own plants. Load them into the Botanical Processor.", 30f); QualityIngredient("opioidmod_botanicalextract", "Botanical Extract", "An amber batch from the Botanical Processor. Finish it at the Pharmaceutical Finishing Station.", 250f); QualityIngredient("opioidmod_refinedbatch", "Refined Batch", "A dark batch from the Industrial Refinery. Finish it at the Pharmaceutical Finishing Station to get heroin.", 700f); QualityIngredient("opioidmod_tabletblend", "Tablet Blend", "A blended powder from the Pharmaceutical Mixer, ready for the Tablet Press.", 300f); Looks.ApplyIngredient("opioidmod_poppypods", "Dried Poppy Pods", Models.DriedPods, new Color(0.75f, 0.66f, 0.46f)); Looks.ApplyIngredient("opioidmod_dreamsyrup", "Botanical Processing Agent", Models.BotanicalAgent, new Color(0.45f, 0.72f, 0.42f)); Looks.ApplyIngredient("opioidmod_hollowsalts", "Refinery Processing Agent", Models.RefineryAgent, new Color(0.66f, 0.7f, 0.78f)); Looks.ApplyIngredient("opioidmod_pharmabase", "Pharmaceutical Base", Models.PharmaBase, new Color(0.9f, 0.92f, 0.96f)); Looks.ApplyIngredient("opioidmod_tabletfiller", "Tablet Filler", Models.TabletFiller, new Color(0.9f, 0.88f, 0.8f)); Looks.ApplyIngredient("opioidmod_acetaminophen", "Acetaminophen Component", Models.Acetaminophen, new Color(0.95f, 0.85f, 0.85f)); Looks.ApplyIngredient("opioidmod_syntheticfeedstock", "Synthetic Feedstock", Models.SyntheticFeedstock, new Color(0.7f, 0.74f, 0.78f)); Looks.ApplyIngredient("opioidmod_syntheticagent", "Synthetic Processing Agent", Models.SyntheticAgent, new Color(0.4f, 0.85f, 0.95f)); Color cutRateTint = CutRateTint; Color pharmaGradeTint = PharmaGradeTint; Color purifierTint = PurifierTint; Looks.ApplyIngredient("opioidmod_pharmabase_low", "Cut-Rate Pharmaceutical Base", Tinted(Models.PharmaBase, cutRateTint), cutRateTint); Looks.ApplyIngredient("opioidmod_pharmabase_high", "Pharma-Grade Pharmaceutical Base", Tinted(Models.PharmaBase, pharmaGradeTint), pharmaGradeTint); Looks.ApplyIngredient("opioidmod_syntheticfeedstock_low", "Cut-Rate Synthetic Feedstock", Tinted(Models.SyntheticFeedstock, cutRateTint), cutRateTint); Looks.ApplyIngredient("opioidmod_syntheticfeedstock_high", "Pharma-Grade Synthetic Feedstock", Tinted(Models.SyntheticFeedstock, pharmaGradeTint), pharmaGradeTint); Looks.ApplyIngredient("opioidmod_purifyingagent", "Purifying Agent", Models.PurifyingAgent, purifierTint); Looks.ApplyIngredient("opioidmod_opiumpoppy", "Opium Poppy", Models.PoppyPods, new Color(0.56f, 0.7f, 0.45f)); RackHanging.Setup("opioidmod_opiumpoppy", "Opium Poppy", "OpioidMod_OpiumPoppy_Model"); Looks.ApplyIngredient("opioidmod_botanicalextract", "Botanical Extract", Models.BotanicalExtract, new Color(0.86f, 0.6f, 0.28f)); Looks.ApplyIngredient("opioidmod_refinedbatch", "Refined Batch", Models.RefinedBatch, new Color(0.62f, 0.44f, 0.3f)); Looks.ApplyIngredient("opioidmod_tabletblend", "Tablet Blend", Models.TabletBlend, new Color(0.95f, 0.95f, 0.97f)); ConsoleItemAliases.Register("poppypods", "opioidmod_poppypods"); ConsoleItemAliases.Register("dreamsyrup", "opioidmod_dreamsyrup"); ConsoleItemAliases.Register("hollowsalts", "opioidmod_hollowsalts"); ConsoleItemAliases.Register("botanicalagent", "opioidmod_dreamsyrup"); ConsoleItemAliases.Register("refineryagent", "opioidmod_hollowsalts"); ConsoleItemAliases.Register("opiumpoppy", "opioidmod_opiumpoppy"); ConsoleItemAliases.Register("botanicalextract", "opioidmod_botanicalextract"); ConsoleItemAliases.Register("pharmabase", "opioidmod_pharmabase"); ConsoleItemAliases.Register("tabletfiller", "opioidmod_tabletfiller"); ConsoleItemAliases.Register("acetaminophen", "opioidmod_acetaminophen"); ConsoleItemAliases.Register("syntheticfeedstock", "opioidmod_syntheticfeedstock"); ConsoleItemAliases.Register("syntheticagent", "opioidmod_syntheticagent"); ConsoleItemAliases.Register("refinedbatch", "opioidmod_refinedbatch"); ConsoleItemAliases.Register("tabletblend", "opioidmod_tabletblend"); ConsoleItemAliases.Register("cutratebase", "opioidmod_pharmabase_low"); ConsoleItemAliases.Register("pharmagradebase", "opioidmod_pharmabase_high"); ConsoleItemAliases.Register("cutratefeedstock", "opioidmod_syntheticfeedstock_low"); ConsoleItemAliases.Register("pharmagradefeedstock", "opioidmod_syntheticfeedstock_high"); ConsoleItemAliases.Register("purifyingagent", "opioidmod_purifyingagent"); ingredientsDone = true; } } internal static Func<GameObject> Tinted(Func<GameObject> makeModel, Color tint) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) GameObject obj = makeModel(); VisualKit.Recolor(obj, tint); return obj; }; } private static void Ingredient(string id, string template, string name, string description, float price, FullRank? rank = null) { if (!(ItemManager.GetDefinition(id) != (ItemDefinition)null)) { ((StorableItemDefinitionBuilderBase<StorableItemDefinitionBuilder>)(object)((StorableItemDefinitionBuilderBase<StorableItemDefinitionBuilder>)(object)((StorableItemDefinitionBuilderBase<StorableItemDefinitionBuilder>)(object)ItemCreator.CloneFrom(template)).WithBasicInfo(id, name, description, (ItemCategory)9)).WithPricing(price, 0.5f)).WithRequiredRank(rank).Build(); Log.Msg($"Registered ingredient {name} ({id})."); } } private static void QualityIngredient(string id, string name, string description, float price) { if (!(ItemManager.GetDefinition(id) != (ItemDefinition)null)) { ((StorableItemDefinitionBuilderBase<QualityItemDefinitionBuilder>)(object)((StorableItemDefinitionBuilderBase<QualityItemDefinitionBuilder>)(object)((StorableItemDefinitionBuilderBase<QualityItemDefinitionBuilder>)(object)QualityItemCreator.CloneFrom("pseudo")).WithBasicInfo(id, name, description, (ItemCategory)9)).WithPricing(price, 0.5f)).WithRequiredRank((FullRank?)null).Build(); Log.Msg($"Registered ingredient {name} ({id})."); } } private static void RegisterProducts() { //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0100: Unknown result type (might be due to invalid IL or missing references) bool custom; if (!productsDone) { ItemDefinition definition = ItemManager.GetDefinition("cocaine"); ProductDefinition val = (ProductDefinition)(object)((definition is ProductDefinition) ? definition : null); if (val == null) { throw new InvalidOperationException("The base-game product 'cocaine' is not available yet."); } PackagingDefinition[] array = (from p in ((IEnumerable<string>)new string[3] { "baggie", "jar", "brick" }).Select((Func<string, PackagingDefinition>)ProductPopulator.GetPackaging) where (ItemDefinition)(object)p != (ItemDefinition)null select (p)).ToArray(); if (array.Length == 0) { throw new InvalidOperationException("No packaging (baggie, jar, brick) is available yet."); } DrugType val2 = (DrugType)(string.Equals(Cfg.DrugCategory.Value?.Trim(), "Cocaine", StringComparison.OrdinalIgnoreCase) ? 2 : 5); ProductKind kind = new ProductKindBuilder("opioidmod:opioid").WithCompatibilityDrugType(val2).Build(); try { FxCatalog.Register(val2); } catch (Exception value) { Log.Error($"Could not register the custom effects, so the products keep the base-game ones: {value}"); } custom = Cfg.CustomEffects.Value && FxCatalog.Ready; FxCatalog.InUse = custom; Looks.RegisterDrug("opioidmod:morphine", "Morphine", DrugLook.Morphine); Looks.RegisterDrug("opioidmod:heroin", "Heroin", DrugLook.Heroin); Looks.RegisterDrug("opioidmod:fentanyl", "Fentanyl", DrugLook.Fentanyl); Looks.RegisterDrug("opioidmod:lacedheroin", "Laced Heroin", DrugLook.LacedHeroin); Looks.RegisterDrug("opioidmod:oxycodone", "Oxycodone Tablets", DrugLook.Oxycodone); Looks.RegisterDrug("opioidmod:percocet", "Percocet", DrugLook.Percocet); Morphine = Product(kind, val, array, "opioidmod:morphine", "Morphine", "A heavy, sleepy painkiller. Customers come back for more.", Cfg.Price(Cfg.MorphinePrice, 90f), Cfg.Addictiveness(Cfg.MorphineAddictiveness, 0.55f), EffectsFor("opioidmod:morphine", (PropertyBase[])(object)new PropertyBase[2] { Property.Sedating, Property.Calming })); Heroin = Product(kind, val, array, "opioidmod:heroin", "Heroin", "Refined from morphine. Potent and very hard to quit.", Cfg.Price(Cfg.HeroinPrice, 180f), Cfg.Addictiveness(Cfg.HeroinAddictiveness, 0.75f), EffectsFor("opioidmod:heroin", (PropertyBase[])(object)new PropertyBase[2] { Property.Sedating, Property.Euphoric })); Oxycodone = Product(kind, val, array, "opioidmod:oxycodone", "Oxycodone Tablets", "Pressed pharmaceutical tablets. Customers call them Oxy.", Cfg.ItemPrice("OxycodonePrice", 110f), Cfg.Number("OxycodoneAddictiveness", 0.6f, 0f, 1f), EffectsFor("opioidmod:oxycodone", (PropertyBase[])(object)new PropertyBase[2] { Property.Euphoric, Property.Calming })); Percocet = Product(kind, val, array, "opioidmod:percocet", "Percocet", "Oxycodone combined with acetaminophen. The mildest opioid on the street: Percs.", Cfg.ItemPrice("PercocetPrice", 80f), Cfg.Number("PercocetAddictiveness", 0.45f, 0f, 1f), EffectsFor("opioidmod:percocet", (PropertyBase[])(object)new PropertyBase[1] { Property.Calming })); Fentanyl = Product(kind, val, array, "opioidmod:fentanyl", "Fentanyl", "Synthetic and extremely potent. A real overdose risk; keep Narcan handy.", Cfg.ItemPrice("FentanylPrice", 300f), Cfg.Number("FentanylAddictiveness", 0.9f, 0f, 1f), EffectsFor("opioidmod:fentanyl", (PropertyBase[])(object)new PropertyBase[3] { Property.Sedating, Property.Euphoric, Property.Foggy })); LacedHeroin = Product(kind, val, array, "opioidmod:lacedheroin", "Laced Heroin", "Heroin cut with fentanyl. Stronger, pricier, and far more likely to put someone down.", Cfg.ItemPrice("LacedHeroinPrice", 260f), Cfg.Number("LacedHeroinAddictiveness", 0.9f, 0f, 1f), EffectsFor("opioidmod:lacedheroin", (PropertyBase[])(object)new PropertyBase[3] { Property.Sedating, Property.Euphoric, Property.Foggy })); ConsoleItemAliases.Register("morphine", "opioidmod:morphine"); ConsoleItemAliases.Register("heroin", "opioidmod:heroin"); ConsoleItemAliases.Register("oxy", "opioidmod:oxycodone"); ConsoleItemAliases.Register("oxycodone", "opioidmod:oxycodone"); ConsoleItemAliases.Register("percocet", "opioidmod:percocet"); ConsoleItemAliases.Register("percs", "opioidmod:percocet"); ConsoleItemAliases.Register("fentanyl", "opioidmod:fentanyl"); ConsoleItemAliases.Register("lacedheroin", "opioidmod:lacedheroin"); Log.Msg($"Registered morphine, heroin, oxycodone, percocet, fentanyl and laced heroin (category {val2}, packaging: {string.Join(", ", array.Select((PackagingDefinition p) => ((ItemDefinition)p).ID))})."); Log.Msg(custom ? "The opioids use the custom effects (six each)." : ("The opioids use the base-game effects (" + (Cfg.CustomEffects.Value ? "the custom ones failed to register" : "CustomEffects is off") + ").")); productsDone = true; } PropertyBase[] EffectsFor(string id, params PropertyBase[] vanilla) { if (!custom) { return vanilla; } return FxCatalog.For(id) ?? vanilla; } } private static CustomProductDefinition Product(ProductKind kind, ProductDefinition template, PackagingDefinition[] packaging, string id, string name, string description, float price, float addictiveness, params PropertyBase[] effects) { CustomProductDefinitionBuilder val = CustomProductItemCreator.CreateBuilder(id, kind).WithName(name).WithDescription(description) .WithProductPrice(price) .WithProperties(effects) .WithLegalStatus((LegalStatus)1) .WithBaseAddictiveness(addictiveness) .WithDefaultQuality((Quality)2) .WithValidPackaging(packaging) .WithRepresentationsFrom(template); (int, int)? tuple = EffectDurations(); if (tuple.HasValue) { val = val.WithEffectDurations(tuple.Value.Item1, tuple.Value.Item2); } return val.Build(); } private static (int Player, int Npc)? EffectDurations() { int num = Cfg.Count("PlayerEffectSeconds", 0, 0, 3600); int num2 = Cfg.Count("NpcEffectSeconds", 0, 0, 3600); if (num <= 0 && num2 <= 0) { return null; } if (num <= 0 || num2 <= 0) { ItemDefinition item = Registry.GetItem("cocaine"); ProductDefinition val = ((item != null) ? ((Il2CppObjectBase)item).TryCast<ProductDefinition>() : null); if ((Object)(object)val == (Object)null) { Log.Warning("Couldn't read the game's own effect lengths, so PlayerEffectSeconds/NpcEffectSeconds need both set; using the game's lengths."); return null; } if (num <= 0) { num = val.PlayerEffectDuration; } if (num2 <= 0) { num2 = val.NPCEffectDuration; } } return (num, num2); } public static IEnumerable<CustomProductDefinition> AllProducts() { CustomProductDefinition[] array = (CustomProductDefinition[])(object)new CustomProductDefinition[6] { Morphine, Heroin, Oxycodone, Percocet, Fentanyl, LacedHeroin }; foreach (CustomProductDefinition val in array) { if ((ItemDefinition)(object)val != (ItemDefinition)null) { yield return val; } } } public static void DiscoverProducts() { Discover("opioidmod:morphine"); Discover("opioidmod:heroin"); } public static void ResetDiscovery() { discoveryActive = false; seen.Clear(); } public static void StartDiscovery() { discoveryActive = true; } public static void Seen(string? itemId) { if (discoveryActive && itemId != null && !seen.Contains(itemId) && itemId.StartsWith("opioidmod:", StringComparison.OrdinalIgnoreCase) && InstanceFinder.IsServer) { seen.Add(itemId); Discover(itemId); } } public static void DiscoveryTick() { if (!discoveryActive || Time.unscaledTime < nextDiscoveryCheck) { return; } nextDiscoveryCheck = Time.unscaledTime + 3f; PlayerInventory instance = PlayerSingleton<PlayerInventory>.Instance; List<HotbarSlot> val = ((instance != null) ? instance.hotbarSlots : null); if (val == null) { return; } for (int i = 0; i < val.Count; i++) { HotbarSlot obj = val[i]; object itemId; if (obj == null) { itemId = null; } else { ItemInstance itemInstance = ((ItemSlot)obj).ItemInstance; itemId = ((itemInstance != null) ? ((BaseItemInstance)itemInstance).ID : null); } Seen((string?)itemId); } } public static void Discover(string productId) { CustomProductDefinition product = AllProducts().FirstOrDefault((Func<CustomProductDefinition, bool>)((CustomProductDefinition p) => string.Equals(((ItemDefinition)p).ID, productId, StringComparison.OrdinalIgnoreCase))); if ((ItemDefinition)(object)product == (ItemDefinition)null) { return; } try { if (!ProductManager.DiscoveredProducts.Any((ProductDefinition p) => string.Equals(((ItemDefinition)p).ID, ((ItemDefinition)product).ID, StringComparison.OrdinalIgnoreCase))) { product.Discover(false); Log.Msg("Discovered " + ((ItemDefinition)product).Name + "."); } } catch (Exception value) { Log.Error($"Could not discover {((ItemDefinition)product).Name}: {value}"); } } private static void RegisterRecipes() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) if (recipesDone) { return; } if ((ItemDefinition)(object)Morphine == (ItemDefinition)null || (ItemDefinition)(object)Heroin == (ItemDefinition)null || (ItemDefinition)(object)Oxycodone == (ItemDefinition)null || (ItemDefinition)(object)Percocet == (ItemDefinition)null || (ItemDefinition)(object)Fentanyl == (ItemDefinition)null || (ItemDefinition)(object)LacedHeroin == (ItemDefinition)null) { throw new InvalidOperationException("Products were not registered, so the recipes were skipped."); } string[] pods = new string[2] { "opioidmod_opiumpoppy", "opioidmod_poppypods" }; int morphinePerBatch = Cfg.Whole(Cfg.MorphineUnitsPerCook, 1, 20, 10); int heroinPerBatch = Cfg.Whole(Cfg.HeroinUnitsPerCook, 1, 20, 8); List<string> registered = new List<string>(); Recipe("opioidmod:extract-processor", "Botanical Extraction", Cfg.Whole(Cfg.ProcessorMinutes, 1, 1440, 120), new Color(0.82f, 0.55f, 0.18f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredientOptions((IEnumerable<string>)pods, 2).WithIngredient("opioidmod_dreamsyrup", 1).WithProduct("opioidmod_botanicalextract", 1); }); Recipe("opioidmod:morphine-finishing", "Morphine", Cfg.Whole(Cfg.FinishingMinutes, 1, 1440, 120), new Color(0.95f, 0.9f, 0.77f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod_botanicalextract", 1).WithProduct("opioidmod:morphine", morphinePerBatch); }); Recipe("opioidmod:refined-refinery", "Refinement", Cfg.Minutes("RefineryMinutes", 180), new Color(0.5f, 0.32f, 0.18f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod:morphine", 5).WithIngredient("opioidmod_hollowsalts", 1).WithProduct("opioidmod_refinedbatch", 1); }); Recipe("opioidmod:heroin-finishing", "Heroin", Cfg.Minutes("HeroinFinishingMinutes", 120), new Color(0.58f, 0.4f, 0.24f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod_refinedbatch", 1).WithProduct("opioidmod:heroin", heroinPerBatch); }); Recipe("opioidmod:blend-mixer", "Tablet Formulation", Cfg.Minutes("MixerMinutes", 90), new Color(0.95f, 0.95f, 0.97f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredientOptions((IEnumerable<string>)new string[3] { "opioidmod_pharmabase", "opioidmod_pharmabase_low", "opioidmod_pharmabase_high" }, 1).WithIngredient("opioidmod_tabletfiller", 1).WithProduct("opioidmod_tabletblend", 1); }); int minutes = Cfg.Minutes("PressMinutes", 60); int pressUnits = Cfg.Count("PressUnits", 24, 1, 40); string[] array = new string[3] { "opioidmod:oxy-press1", "opioidmod:oxy-press2", "opioidmod:oxy-press3" }; foreach (string id in array) { Recipe(id, "Oxycodone Tablets", minutes, Models.OxyBlue, delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod_tabletblend", 1).WithProduct("opioidmod:oxycodone", pressUnits); }); } int lacedUnits = Cfg.Count("LacedHeroinUnits", 5, 1, 20); int percocetUnits = Cfg.Count("PercocetUnits", 10, 1, 20); Recipe("opioidmod:percocet-combination", "Percocet", Cfg.Minutes("CombinationMinutes", 90), Models.PercWhite, delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod:oxycodone", 4).WithIngredient("opioidmod_acetaminophen", 1).WithProduct("opioidmod:percocet", percocetUnits); }); Recipe("opioidmod:lacedheroin-combination", "Laced Heroin", Cfg.Minutes("LacingMinutes", 60), new Color(0.5f, 0.43f, 0.4f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient("opioidmod:heroin", 4).WithIngredient("opioidmod:fentanyl", 1).WithProduct("opioidmod:lacedheroin", lacedUnits); }); int fentanylUnits = Cfg.Count("FentanylUnits", 12, 1, 20); Recipe("opioidmod:fentanyl-lab", "Fentanyl Program", Cfg.Minutes("LabMinutes", 360), new Color(0.6f, 0.95f, 1f), delegate(ChemistryStationRecipeBuilder b) { b.WithIngredientOptions((IEnumerable<string>)new string[3] { "opioidmod_syntheticfeedstock", "opioidmod_syntheticfeedstock_low", "opioidmod_syntheticfeedstock_high" }, 1).WithIngredient("opioidmod_syntheticagent", 1).WithProduct("opioidmod:fentanyl", fentanylUnits); }); int purifyUnits = Cfg.Count("PurifyUnits", 5, 1, 20); int minutes2 = Cfg.Minutes("PurifyMinutes", 30); Dictionary<string, (string, Color)> dictionary = new Dictionary<string, (string, Color)>(StringComparer.OrdinalIgnoreCase) { ["opioidmod:morphine"] = ("Morphine", new Color(0.95f, 0.9f, 0.77f)), ["opioidmod:heroin"] = ("Heroin", new Color(0.58f, 0.4f, 0.24f)), ["opioidmod:oxycodone"] = ("Oxycodone Tablets", Models.OxyBlue), ["opioidmod:percocet"] = ("Percocet", Models.PercWhite), ["opioidmod:fentanyl"] = ("Fentanyl", new Color(0.6f, 0.95f, 1f)), ["opioidmod:lacedheroin"] = ("Laced Heroin", new Color(0.5f, 0.43f, 0.4f)) }; foreach (KeyValuePair<string, string> purifyRecipe in QualityRules.PurifyRecipes) { string drug = purifyRecipe.Value; var (text, liquid) = dictionary[drug]; Recipe(purifyRecipe.Key, "Purify " + text, minutes2, liquid, delegate(ChemistryStationRecipeBuilder b) { b.WithIngredient(drug, purifyUnits).WithIngredient("opioidmod_purifyingagent", 1).WithProduct(drug, purifyUnits); }); } LargestBatch["opioidmod:morphine"] = morphinePerBatch; LargestBatch["opioidmod:heroin"] = heroinPerBatch; LargestBatch["opioidmod:oxycodone"] = pressUnits; LargestBatch["opioidmod:lacedheroin"] = lacedUnits; LargestBatch["opioidmod:percocet"] = percocetUnits; LargestBatch["opioidmod:fentanyl"] = fentanylUnits; Recipe("opioidmod:morphine-basic", "Morphine (shortcut)", Cfg.Whole(Cfg.MorphineCookMinutes, 1, 1440, 240), new Color(0.85f, 0.62f, 0.25f), delegate(ChemistryStationRecipeBuilder b) { b.WithTemperature(220f, 30f).WithIngredientOptions((IEnumerable<string>)pods, 2).WithIngredient("opioidmod_dreamsyrup", 1) .WithProduct("opioidmod:morphine", morphinePerBatch); }); Recipe("opioidmod:heroin-basic", "Heroin (shortcut)", Cfg.Whole(Cfg.HeroinCookMinutes, 1, 1440, 360), new Color(0.42f, 0.26f, 0.14f), delegate(ChemistryStationRecipeBuilder b) { b.WithTemperature(270f, 15f).WithIngredientOptions((IEnumerable<string>)pods, 2).WithIngredient("opioidmod_dreamsyrup", 1) .WithIngredient("opioidmod_hollowsalts", 1) .WithProduct("opioidmod:heroin", heroinPerBatch); }); string value = (Cfg.ShortcutRecipes.Value ? "on" : "off"); Log.Msg($"Registered {registered.Count} recipes: {string.Join(", ", registered)}. Shortcut recipes {value}."); recipesDone = true; void Recipe(string text2, string title, int num2, Color val, Action<ChemistryStationRecipeBuilder> configure) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) try { ChemistryStationRecipes.CreateAndRegister((Action<ChemistryStationRecipeBuilder>)delegate(ChemistryStationRecipeBuilder b) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) b.WithRecipeId(text2).WithTitle(title).WithCookTimeMinutes(num2) .WithFinalLiquidColor(val); configure(b); }); registered.Add(title); } catch (Exception ex) { Log.Error($"Recipe {title} ({text2}) failed: {ex.Message}"); } } } public static void FitStacks() { foreach (KeyValuePair<string, int> item in LargestBatch) { ItemDefinition definition = ItemManager.GetDefinition(item.Key); if (!(definition == (ItemDefinition)null) && definition.StackLimit < item.Value) { int stackLimit = definition.StackLimit; definition.StackLimit = item.Value; Log.Msg($"{definition.Name}: stack size raised from {stackLimit} to {item.Value}, so a full machine batch fits in the output slot."); } } } } public sealed class DocSupplier : NPC { private const string IntroText = "Hey. Got your number from someone who says you move product. I used to work at Hyland Medical until they pulled my licence. I can set you up with poppy seeds and processing agents, and Narcan, because you'll need it. Oscar at the warehouse stocks the equipment: start with a Botanical Processor and a Finishing Station. Grow the poppies, run them through both, and you've got morphine. Move up and I'll have pharmaceutical stock for you too. Ask for a meetup when you're ready."; private static bool warnedMissing; public override bool IsPhysical => true; public override bool IsSupplier => true; protected override void ConfigurePrefab(NPCPrefabBuilder builder) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) builder.WithIdentity("opioidmod_doc", "Doc", "Halloway").WithSpawnPosition(new Vector3(-53.5f, 1.1f, 67.8f)).WithVoice(NPCVoiceCatalog.Monotone, 0.9f) .WithAppearanceDefaults((Action<AvatarDefaultsBuilder>)delegate(AvatarDefaultsBuilder av) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) av.Gender = 0f; av.Height = 1f; av.Weight = 0.35f; Color32 val = default(Color32); ((Color32)(ref val))..ctor((byte)222, (byte)186, (byte)160, byte.MaxValue); av.SkinColor = val; av.LeftEyeLidColor = Color32.op_Implicit(val); av.RightEyeLidColor = Color32.op_Implicit(val); av.LeftEye = (0.38f, 0.5f); av.RightEye = (0.38f, 0.5f); av.HairPath = "Avatar/Hair/receding/Receding"; av.HairColor = new Color(0.55f, 0.55f, 0.55f); av.WithFaceLayer("Avatar/Layers/Face/Face_Neutral", Color.white); av.WithFaceLayer("Avatar/Layers/Face/EyeShadow", new Color(0f, 0f, 0f, 0.7f)); av.WithBodyLayer("Avatar/Layers/Top/Buttonup", new Color(0.82f, 0.86f, 0.9f)); av.WithBodyLayer("Avatar/Layers/Bottom/Jeans", new Color(0.22f, 0.24f, 0.28f)); av.WithAccessoryLayer("Avatar/Accessories/Chest/Blazer/Blazer", new Color(0.3f, 0.27f, 0.24f)); av.WithAccessoryLayer("Avatar/Accessories/Head/SmallRoundGlasses/SmallRoundGlasses", new Color(0.15f, 0.15f, 0.15f)); av.WithAccessoryLayer("Avatar/Accessories/Feet/DressShoes/DressShoes", new Color(0.12f, 0.1f, 0.08f)); }) .WithRelationshipDefaults((Action<NPCRelationshipDataBuilder>)delegate(NPCRelationshipDataBuilder r) { r.WithDelta(1.5f).SetUnlocked(false).SetUnlockType((UnlockType)0); }) .WithSupplierDefaults((Action<SupplierDataBuilder>)delegate(SupplierDataBuilder s) { s.WithOrderLimits(200f, 6000f).WithDeliveryItem("opioidmod_poppyseed").WithDeliveryItem("opioidmod_dreamsyrup") .WithDeliveryItem("opioidmod_purifyingagent") .WithDeliveryItem("opioidmod_narcan") .WithDeliveryItem("opioidmod_hollowsalts") .WithDeliveryItem("opioidmod_pharmabase_low") .WithDeliveryItem("opioidmod_pharmabase") .WithDeliveryItem("opioidmod_pharmabase_high") .WithDeliveryItem("opioidmod_tabletfiller") .WithDeliveryItem("opioidmod_acetaminophen") .WithDeliveryItem("opioidmod_syntheticfeedstock_low") .WithDeliveryItem("opioidmod_syntheticfeedstock") .WithDeliveryItem("opioidmod_syntheticfeedstock_high") .WithDeliveryItem("opioidmod_syntheticagent") .WithStashDeadDrop<BehindMedicalPractice>() .WithRecommendationMessage("I know a guy, <NAME>. Used to be a doctor. He can get you <PRODUCT>. I gave him your number.") .WithUnlockHint("<NAME> sells seeds, processing agents, pharmaceutical ingredients and Narcan. The machines are at Oscar's Store. More of his stock unlocks as your rank goes up. Base and feedstock come in three grades (cut-rate, normal, pharma-grade): the grade sets the quality. A Purifying Agent at the Finishing Station takes any opioid up a tier."); }); } protected override void OnCreated() { ((NPC)this).OnCreated(); ((NPC)this).Appearance.Build(); } public static void TryUnlock(string reason) { //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_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_0067: 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_006d: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) try { if (!InstanceFinder.IsServer) { return; } if (!(NPC.Get<DocSupplier>() is DocSupplier docSupplier)) { if (!warnedMissing) { warnedMissing = true; Log.Warning("Doc is not in the world, so he can't be unlocked yet."); } } else if (((NPC)docSupplier).Relationship.IsUnlocked) { Content.DiscoverProducts(); } else { if (!LevelManager.Exists) { return; } Rank val = Cfg.UnlockRank(); FullRank currentRank = LevelManager.CurrentRank; Rank rank = ((FullRank)(ref currentRank)).Rank; if (rank >= val) { ((NPC)docSupplier).Supplier.Unlock(); if (!((NPC)docSupplier).Relationship.IsUnlocked) { ((NPC)docSupplier).Relationship.Unlock((UnlockType)0, false); } ((NPC)docSupplier).SendTextMessage("Hey. Got your number from someone who says you move product. I used to work at Hyland Medical until they pulled my licence. I can set you up with poppy seeds and processing agents, and Narcan, because you'll need it. Oscar at the warehouse stocks the equipment: start with a Botanical Processor and a Finishing Station. Grow the poppies, run them through both, and you've got morphine. Move up and I'll have pharmaceutical stock for you too. Ask for a meetup when you're ready.", (Response[])null, 1f, true); Content.DiscoverProducts(); Log.Msg($"Doc unlocked ({reason}: rank {rank}, needs {val})."); } } } catch (Exception value) { Log.Error($"Could not unlock Doc ({reason}): {value}"); } } } public sealed class DoctorNpc : NPC { private const string DocsIntro = "You've been good to me, so here's something back. Simon Okoro still works at Hyland Medical. We trained together and he owes me. For a fee he'll put people on your pills: Percs, Oxy, morphine, loose, straight from your machines. When pills stop working for them, he sends them to you. You'll find him outside the medical centre."; private const string DoctorsIntro = "Halloway says you're serious. Come and see me outside the medical centre and we'll talk terms."; private static bool warnedMissing; private static bool placed; private static DocSupplier? doc; private static int loggedLevel = -1; private static float nextWatch; private static int unlockErrors; private static bool followed; private static bool followWarned; private static Vector3? target; private static Quaternion facing; public override bool IsPhysical => true; protected override void ConfigurePrefab(NPCPrefabBuilder builder) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) builder.WithIdentity("opioidmod_doctor", "Dr. Simon", "Okoro").WithSpawnPosition(new Vector3(-56.5f, 1.1f, 67.8f)).WithVoice(NPCVoiceCatalog.Monotone, 1.05f) .WithAppearanceDefaults((Action<AvatarDefaultsBuilder>)delegate(AvatarDefaultsBuilder av) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) av.Gender = 0f; av.Height = 1.02f; av.Weight = 0.45f; Color32 val = default(Color32); ((Color32)(ref val))..ctor((byte)112, (byte)78, (byte)56, byte.MaxValue); av.SkinColor = val; av.LeftEyeLidColor = Color32.op_Implicit(val); av.RightEyeLidColor = Color32.op_Implicit(val); av.LeftEye = (0.3f, 0.45f); av.RightEye = (0.3f, 0.45f); av.HairPath = "Avatar/Hair/receding/Receding"; av.HairColor = new Color(0.08f, 0.07f, 0.06f); av.WithFaceLayer("Avatar/Layers/Face/Face_Neutral", Color.white); av.WithBodyLayer("Avatar/Layers/Top/Buttonup", new Color(0.62f, 0.76f, 0.86f)); av.WithBodyLayer("Avatar/Layers/Bottom/Jeans", new Color(0.16f, 0.17f, 0.2f)); av.WithAccessoryLayer("Avatar/Accessories/Chest/Blazer/Blazer", new Color(0.95f, 0.95f, 0.93f)); av.WithAccessoryLayer("Avatar/Accessories/Feet/DressShoes/DressShoes", new Color(0.1f, 0.1f, 0.1f)); }) .WithRelationshipDefaults((Action<NPCRelationshipDataBuilder>)delegate(NPCRelationshipDataBuilder r) { r.WithDelta(2f).SetUnlocked(false).SetUnlockType((UnlockType)0); }); } protected override void OnCreated() { ((NPC)this).OnCreated(); ((NPC)this).Appearance.Build(); } public static DoctorNpc? Find() { return NPC.Get<DoctorNpc>() as DoctorNpc; } private static DocSupplier? FindDoc() { return doc ?? (doc = NPC.Get<DocSupplier>() as DocSupplier); } public static void WatchDoc(DoctorNpc doctor) { if (!Practice.Introduced) { float unscaledTime = Time.unscaledTime; if (!(unscaledTime < nextWatch)) { nextWatch = unscaledTime + 2f; TryUnlock("Doc's relationship", doctor); } } } public static void TryUnlock(string reason, DoctorNpc? doctor = null) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected I4, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected I4, but got Unknown try { if (!InstanceFinder.IsServer || !Cfg.DoctorPractice.Value) { return; } if (doctor == null) { doctor = Find(); } if (doctor == null) { if (!warnedMissing) { warnedMissing = true; Log.Warning("Dr. Okoro is not in the world, so the practice can't start yet."); } return; } if (Practice.Introduced) { if (!((NPC)doctor).Relationship.IsUnlocked) { ((NPC)doctor).Relationship.Unlock((UnlockType)0, false); Practice.Changed(); Log.Msg("Dr. Okoro: back in your contacts (" + reason + "); the game hadn't kept it."); } return; } if (((NPC)doctor).Relationship.IsUnlocked) { Practice.Introduced = true; return; } DocSupplier docSupplier = FindDoc(); if (docSupplier == null || !((NPC)docSupplier).Relationship.IsUnlocked) { return; } ERelationshipCategory val = Cfg.DoctorUnlockLevel(); float delta = ((NPC)docSupplier).Relationship.Delta; ERelationshipCategory category = RelationshipCategory.GetCategory(delta); if (category < val) { if ((int)category != loggedLevel) { loggedLevel = (int)category; Log.Msg($"Dr. Okoro: Doc is {category} with you ({delta:0.00}/5). He introduces the doctor at {val} ({(int)val}/5); paying off what you owe him at his stash raises it."); } } else { ((NPC)doctor).Relationship.Unlock((UnlockType)0, true); Practice.Introduced = true; ((NPC)docSupplier).SendTextMessage("You've been good to me, so here's something back. Simon Okoro still works at Hyland Medical. We trained together and he owes me. For a fee he'll put people on your pills: Percs, Oxy, morphine, loose, straight from your machines. When pills stop working for them, he sends them to you. You'll find him outside the medical centre.", (Response[])null, 1f, true); ((NPC)doctor).SendTextMessage("Halloway says you're serious. Come and see me outside the medical centre and we'll talk terms.", (Response[])null, 1f, true); Practice.Changed(); Log.Msg($"Dr. Okoro unlocked ({reason}: Doc is {category}, {delta:0.00}/5, needs {val})."); } } catch (Exception value) { if (++unlockErrors <= 3) { Log.Error($"Could not unlock Dr. Okoro ({reason}): {value}"); } } } public static void FollowHost(DoctorNpc doctor) { if (followed || !PracticeNet.HostIntroduced) { return; } try { followed = true; if (!((NPC)doctor).Relationship.IsUnlocked) { bool hostIntroducedLive = PracticeNet.HostIntroducedLive; ((NPC)doctor).Relationship.Unlock((UnlockType)0, hostIntroducedLive); Practice.Changed(); Log.Msg(hostIntroducedLive ? "Dr. Okoro: the host's game just introduced him, so he's in your contacts now." : "Dr. Okoro: already introduced in the host's game; added to your contacts."); } } catch (Exception ex) { followed = false; if (!followWarned) { followWarned = true; Log.Warning("Multiplayer: couldn't add Dr. Okoro to your contacts from the host's game: " + ex.Message); } } } public static void Reset() { placed = false; warnedMissing = false; target = null; doc = null; loggedLevel = -1; nextWatch = 0f; unlockErrors = 0; followed = false; followWarned = false; } public static void KeepInPlace() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) try { DoctorNpc doctorNpc = Find(); if (doctorNpc == null) { return; } if (!target.HasValue) { Place(); } else if (!((NPC)doctorNpc).Dialogue.IsDialogueInProgress && ((NPC)doctorNpc).IsConscious) { Vector3 val = ((NPC)doctorNpc).Position - target.Value; if (((Vector3)(ref val)).sqrMagnitude > 6.25f) { ((NPC)doctorNpc).Position = target.Value; ((NPC)doctorNpc).Transform.rotation = facing; } } } catch (Exception ex) { Log.Warning("Dr. Okoro: couldn't check his spot: " + ex.Message); } } public static void Place() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) try { if (!InstanceFinder.IsServer || !Cfg.DoctorPractice.Value) { return; } DoctorNpc doctorNpc = Find(); if (doctorNpc == null) { return; } DeliveryLocation obj = DeliveryLocation.Get<NextToMedicalCenter>(); Transform val = ((obj != null) ? obj.CustomerStandPoint : null); if ((Object)(object)val == (Object)null) { Log.Warning("Dr. Okoro: couldn't find the spot next to the medical centre; he stays where he spawned."); return; } Vector3 val2 = (((NPC)doctorNpc).Position = val.position + val.right * 1.6f); ((NPC)doctorNpc).Transform.rotation = val.rotation; target = val2; facing = val.rotation; if (!placed) { placed = true; Log.Msg($"Dr. Okoro is next to the medical centre ({val2.x:0.0}, {val2.y:0.0}, {val2.z:0.0})."); } } catch (Exception ex) { Log.Warning("Dr. Okoro: couldn't place him: " + ex.Message); } } } internal static class Growing { private static bool done; private static SeedDefinition? registered; private static readonly Color VialTint = new Color(0.95f, 0.55f, 0.55f); private static bool iconQueued; public static void RegisterSeed() { //IL_01b7: Unknown result type (might be due to invalid IL or missing references) if (done) { if ((Object)(object)registered != (Object)null && !Registry.ItemExists("opioidmod_poppyseed")) { Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)registered); Log.Msg("Opium Poppy Seeds (opioidmod_poppyseed) put back in the registry for this load."); } return; } if (Registry.ItemExists("opioidmod_poppyseed")) { ItemDefinition item = Registry.GetItem("opioidmod_poppyseed"); registered = ((item != null) ? ((Il2CppObjectBase)item).TryCast<SeedDefinition>() : null); done = true; return; } ItemDefinition item2 = Registry.GetItem("cocaseed"); SeedDefinition val = ((item2 != null) ? ((Il2CppObjectBase)item2).TryCast<SeedDefinition>() : null); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("The base-game seed 'cocaseed' is not available yet."); } ItemDefinition item3 = Registry.GetItem("opioidmod_opiumpoppy"); StorableItemDefinition val2 = ((item3 != null) ? ((Il2CppObjectBase)item3).TryCast<StorableItemDefinition>() : null); if ((Object)(object)val2 == (Object)null) { throw new InvalidOperationException("Opium Poppy wasn't registered, so its seed was skipped."); } SeedDefinition val3 = Object.Instantiate<SeedDefinition>(val); ((BaseItemDefinition)val3).ID = "opioidmod_poppyseed"; ((BaseItemDefinition)val3).Name = "Opium Poppy Seeds"; ((BaseItemDefinition)val3).Description = $"Plant in a pot like any other seed. Loves the cold: grows up to {PoppyClimate.Peak:0.#}x faster near an AC on Cooling, and slows to a crawl in the heat. Harvest the ripe pods for the Botanical Processor."; ((StorableItemDefinition)val3).BasePurchasePrice = Cfg.Price(Cfg.PoppySeedPrice, 25f); ((StorableItemDefinition)val3).RequiresLevelToPurchase = false; ((Object)val3).name = "opioidmod_poppyseed"; ((Object)val3).hideFlags = (HideFlags)61; try { Plant val4 = MakePlant(val, val3, val2); if ((Object)(object)val4 != (Object)null) { val3.PlantPrefab = val4; } } catch (Exception ex) { Log.Warning("Poppy plant: " + ex.Message + ". Seeds will grow coca-looking plants that still give Opium Poppy."); } try { FunctionalSeed functionSeedPrefab = val.FunctionSeedPrefab; if ((Object)(object)functionSeedPrefab != (Object)null) { GameObject val5 = VisualKit.CopyPrefab(((Component)functionSeedPrefab).gameObject, "opioidmod_poppyseed_FunctionalSeed"); VisualKit.Recolor(val5, VialTint); val3.FunctionSeedPrefab = val5.GetComponent<FunctionalSeed>(); } } catch (Exception ex2) { Log.Warning("Poppy seed vial: " + ex2.Message); } Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)val3); registered = val3; UseVialLook(val, val3); BindHeldSeed(val, val3); ConsoleItemAliases.Register("poppyseed", "opioidmod_poppyseed"); Log.Msg("Registered Opium Poppy Seeds (opioidmod_poppyseed)."); done = true; } private static void UseVialLook(SeedDefinition template, SeedDefinition seed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) try { StoredItem storedItem = ((StorableItemDefinition)template).StoredItem; if ((Object)(object)storedItem != (Object)null) { GameObject val = VisualKit.CopyPrefab(((Component)storedItem).gameObject, "opioidmod_poppyseed_StoredItem"); VisualKit.Recolor(val, VialTint); ((StorableItemDefinition)seed).StoredItem = val.GetComponent<StoredItem>(); } } catch (Exception ex) { Log.Warning("Poppy seed shelf model: " + ex.Message); } try { Equippable equippable = ((ItemDefinition)template).Equippable; if ((Object)(object)equippable != (Object)null) { GameObject val2 = VisualKit.CopyPrefab(((Component)equippable).gameObject, "opioidmod_poppyseed_Equippable"); VisualKit.Recolor(val2, VialTint); ((ItemDefinition)seed).Equippable = val2.GetComponent<Equippable>(); } } catch (Exception ex2) { Log.Warning("Poppy seed held model: " + ex2.Message); } } public static void FinishLook() { ItemDefinition item = Registry.GetItem("opioidmod_poppyseed"); SeedDefinition val = ((item != null) ? ((Il2CppObjectBase)item).TryCast<SeedDefinition>() : null); if ((Object)(object)val == (Object)null) { return; } FunctionalSeed functionSeedPrefab = val.FunctionSeedPrefab; Relabel((functionSeedPrefab != null) ? ((Component)functionSeedPrefab).gameObject : null, "sowing vial"); Equippable equippable = ((ItemDefinition)val).Equippable; Relabel((equippable != null) ? ((Component)equippable).gameObject : null, "held vial"); StoredItem storedItem = ((StorableItemDefinition)val).StoredItem; Relabel((storedItem != null) ? ((Component)storedItem).gameObject : null, "shelf vial"); if (iconQueued) { return; } StoredItem storedItem2 = ((StorableItemDefinition)val).StoredItem; GameObject? obj = Ours((store