Beispiel #1
0
        public BatchEntitySpawner(ResourceAssets resourceAssets)
        {
            worldEntitiesByClassId = resourceAssets.WorldEntitiesByClassId;
            batchCellsParser       = new BatchCellsParser();

            LootDistributionsParser lootDistributionsParser = new LootDistributionsParser();

            lootDistributionData = lootDistributionsParser.GetLootDistributionData(resourceAssets.LootDistributionsJson);

            customBootstrappersByTechType[TechType.CrashHome] = new CrashFishBootstrapper();
        }
Beispiel #2
0
        private LootDistributionData GetLootDistributionData(string lootDistributionJson)
        {
            JsonMapper.RegisterImporter((double value) => Convert.ToSingle(value));

            Dictionary <string, LootDistributionData.SrcData> result = JsonMapper.ToObject <Dictionary <string, LootDistributionData.SrcData> >(lootDistributionJson);

            LootDistributionData lootDistributionData = new LootDistributionData();

            lootDistributionData.Initialize(result);

            return(lootDistributionData);
        }
Beispiel #3
0
        public BatchEntitySpawner(ResourceAssets resourceAssets, List <Int3> loadedPreviousParsed)
        {
            parsedBatches          = new HashSet <Int3>(loadedPreviousParsed);
            worldEntitiesByClassId = resourceAssets.WorldEntitiesByClassId;
            batchCellsParser       = new BatchCellsParser();

            LootDistributionsParser lootDistributionsParser = new LootDistributionsParser();

            lootDistributionData = lootDistributionsParser.GetLootDistributionData(resourceAssets.LootDistributionsJson);

            customBootstrappersByTechType[TechType.CrashHome] = new CrashFishBootstrapper();
            customBootstrappersByTechType[TechType.Reefback]  = new ReefbackBootstrapper();
        }
Beispiel #4
0
        public EntitySpawner()
        {
            string lootDistributionString;

            if (GetDataFiles(out lootDistributionString, out worldEntitiesByClassId))
            {
                // TODO: If data files can't be loaded the code will crash due to NRE's.
                batchCellsParser = new BatchCellsParser();

                LootDistributionsParser lootDistributionsParser = new LootDistributionsParser();
                lootDistributionData = lootDistributionsParser.GetLootDistributionData(lootDistributionString);
            }
        }
Beispiel #5
0
        internal List <BiomeData> GetBiomeData()
        {
            if (this.TechToCopy != TechType.None && !BiomeData.Any())
            {
                // This will load the games distribution data and then return the biome distribution list for the techtype you tried to copy from if it has one.
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                if (data.GetPrefabData(CraftData.GetClassIdForTechType(TechToCopy), out SrcData srcData))
                {
                    return(srcData.distribution);
                }
            }

            return(BiomeData ?? new List <BiomeData>());
        }
Beispiel #6
0
        public EntitySpawner()
        {
            string lootDistributionString = "";

            if (GetDataFiles(out lootDistributionString, out worldEntitiesByClassId))
            {
                BatchCellsParser BatchCellsParser = new BatchCellsParser();
                entitySpawnPoints = BatchCellsParser.GetEntitySpawnPoints();

                LootDistributionsParser lootDistributionsParser = new LootDistributionsParser();
                lootDistributionData = lootDistributionsParser.GetLootDistributionData(lootDistributionString);

                SpawnEntities();
            }
        }
Beispiel #7
0
        public EntitySpawner()
        {
            WorldEntityDataParser worldEntityDataParser = new WorldEntityDataParser();

            worldEntitiesByClassId = worldEntityDataParser.GetWorldEntitiesByClassId();

            BatchCellsParser BatchCellsParser = new BatchCellsParser();

            entitySpawnPoints = BatchCellsParser.GetEntitySpawnPoints();

            LootDistributionsParser lootDistributionsParser = new LootDistributionsParser();

            lootDistributionData = lootDistributionsParser.GetLootDistributionData();

            SpawnEntities();
        }
        /**
         * Hacky implementation that parses the user-exported version of EntityDistributions
         * resource.  This json file contains the probability of each prefab spawning in the
         * various biomes.  We will want to eventually change out this implementation for
         * something that automatically mines the values.
         */
        public LootDistributionData GetLootDistributionData()
        {
            string file = Path.GetFullPath(@"..\..\..\raw\EntityDistributions.json");

            string json = File.ReadAllText(file);

            JsonMapper.RegisterImporter((double value) => Convert.ToSingle(value));

            Dictionary <string, LootDistributionData.SrcData> result = JsonMapper.ToObject <Dictionary <string, LootDistributionData.SrcData> >(json);

            LootDistributionData lootDistributionData = new LootDistributionData();

            lootDistributionData.Initialize(result);

            return(lootDistributionData);
        }
        private static void InitializePostfix(LootDistributionData __instance)
        {
            foreach (KeyValuePair <string, LootDistributionData.SrcData> entry in CustomSrcData)
            {
                LootDistributionData.SrcData customSrcData = entry.Value;
                string classId = entry.Key;

                if (__instance.srcDistribution.TryGetValue(entry.Key, out LootDistributionData.SrcData srcData))
                {
                    EditExistingData(classId, srcData, customSrcData, __instance.dstDistribution);
                }
                else
                {
                    AddCustomData(classId, customSrcData, __instance.srcDistribution, __instance.dstDistribution);
                }
            }
        }
Beispiel #10
0
        private static void EnsureDefaultDistributions()
        {
            if (!File.Exists(DefaultDistributions))
            {
                PrefabDatabase.LoadPrefabDatabase(SNUtils.prefabDatabaseFilename);
            }
            {
                SortedDictionary <string, List <BiomeData> > defaultDistributions = new SortedDictionary <string, List <BiomeData> >();
                LootDistributionData data = LootDistributionData.Load("Balance/EntityDistributions");
                foreach (KeyValuePair <string, SrcData> pair in data.srcDistribution)
                {
                    if (WorldEntityDatabase.TryGetInfo(pair.Key, out WorldEntityInfo info))
                    {
                        if (info.techType != TechType.None)
                        {
                            defaultDistributions[info.techType.AsString()] = pair.Value.distribution;
                        }
                    }
                }

                using (StreamWriter writer = new StreamWriter(DefaultDistributions))
                {
                    writer.Write(JsonConvert.SerializeObject(defaultDistributions, Formatting.Indented, new JsonConverter[] {
                        new StringEnumConverter()
                        {
#if SUBNAUTICA_STABLE
                            CamelCaseText = true,
#else
                            NamingStrategy = new CamelCaseNamingStrategy(),
#endif
                            AllowIntegerValues = true
                        },

                        new TechTypeConverter()
                    }));
                }
            }
        }
Beispiel #11
0
        public static void Load()
        {
            LootDistributionData data       = LootDistributionData.Load("Balance/EntityDistributions");
            List <TechType>      Drillables = Enum.GetValues(typeof(TechType)).OfType <TechType>().Where((tt) => tt.AsString().Contains("Drillable")).ToList();

            data.GetPrefabData(CraftData.GetClassIdForTechType(TechType.DrillableUranium), out SrcData UraniumData);
            foreach (TechType techType in Drillables)
            {
                string classId = CraftData.GetClassIdForTechType(techType);

                if (CraftData.GetPrefabForTechType(techType, false) == null)
                {
                    continue;
                }

                if (WorldEntityDatabase.TryGetInfo(classId, out WorldEntityInfo info))
                {
                    if (!data.GetPrefabData(classId, out SrcData srcData))
                    {
                        SMLHelper.V2.Handler.LootDistributionHandler.AddLootDistributionData(classId, UraniumData);
                    }
                }
            }
        }
 public static void Postfix(LootDistributionData __instance)
 {
     QuickLogger.Debug($"Initialize Loot Distribution Data: {__instance}");
     Mod.LootDistributionData = __instance;
 }
Beispiel #13
0
 public SubnauticaUwePrefabFactory(string lootDistributionJson)
 {
     lootDistributionData = GetLootDistributionData(lootDistributionJson);
 }
Beispiel #14
0
        public static bool Prefix(LootDistributionData __instance, BiomeType biome, ref bool __result, out LootDistributionData.DstData data)
        {
            if (customDSTDistribution.Count == 0 || Config.RegenSpawns)
            {
                Config.techProbability = new SortedList <string, float>();
                customDSTDistribution  = new SortedDictionary <BiomeType, LootDistributionData.DstData>();
                foreach (BiomeType bio in Enum.GetValues(typeof(BiomeType)))
                {
                    string x = bio.AsString().Split('_').GetLast <string>();
                    techs = new SortedDictionary <TechType, LootDistributionData.PrefabData>();
                    if (__instance.dstDistribution.ContainsKey(bio))
                    {
                        if (!Config.resetDefaults)
                        {
                            foreach (TechType type in Enum.GetValues(typeof(TechType)))
                            {
                                string tech0 = TechTypeExtensions.GetOrFallback(Language.main, type, type) + "| " + bio.AsString().Split('_')[0];
                                if (PlayerPrefs.HasKey(tech0 + ":TechProbability"))
                                {
                                    Config.techProbability[tech0] = PlayerPrefs.GetFloat(tech0 + ":TechProbability");
                                }
                            }
                        }
                        customDSTDistribution[bio]         = new LootDistributionData.DstData();
                        customDSTDistribution[bio].prefabs = new List <LootDistributionData.PrefabData>();

                        foreach (BiomeType b in Enum.GetValues(typeof(BiomeType)))
                        {
                            if (Config.Randomization && __instance.dstDistribution.TryGetValue(b, out var d))
                            {
                                foreach (LootDistributionData.PrefabData prefabData in d.prefabs)
                                {
                                    if (prefabData.classId.ToLower() != "none")
                                    {
                                        WorldEntityInfo wei;
                                        if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1)
                                        {
                                            if (!bio.AsString().Contains("Fragment") && wei.slotType == EntitySlot.Type.Creature)
                                            {
                                                if (wei.techType == TechType.ReaperLeviathan)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                        {
                                                            if (wei2.techType == TechType.Sandshark ||
                                                                wei2.techType == TechType.BoneShark ||
                                                                wei2.techType == TechType.SpineEel ||
                                                                wei2.techType == TechType.Shocker ||
                                                                wei2.techType == TechType.CrabSquid ||
                                                                wei2.techType == TechType.LavaLizard ||
                                                                wei2.techType == TechType.WarperSpawner)
                                                            {
                                                                check = true;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                techs[wei.techType]    = prefabData;
                                                                prefabData.probability = 0.0025f;
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (wei.techType == TechType.Shocker || wei.techType == TechType.CrabSquid || wei.techType == TechType.WarperSpawner)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                        {
                                                            if (wei2.techType == TechType.Sandshark ||
                                                                wei2.techType == TechType.BoneShark ||
                                                                wei2.techType == TechType.SpineEel ||
                                                                wei2.techType == TechType.Shocker ||
                                                                wei2.techType == TechType.CrabSquid ||
                                                                wei2.techType == TechType.Crabsnake ||
                                                                wei2.techType == TechType.LavaLizard)
                                                            {
                                                                check = true;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                                prefabData.probability > 0 &&
                                                                prefabData.probability < 1 &&
                                                                prefabData.count > 0)
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (wei.techType == TechType.Mesmer)
                                                {
                                                    bool check = false;
                                                    foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                    {
                                                        WorldEntityInfo wei2;
                                                        if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei2))
                                                        {
                                                            if (BehaviourData.GetBehaviourType(wei2.techType) == BehaviourType.SmallFish ||
                                                                wei2.techType == TechType.Peeper ||
                                                                wei2.techType == TechType.Mesmer)
                                                            {
                                                                check = true;
                                                                break;
                                                            }
                                                        }
                                                    }
                                                    if (check)
                                                    {
                                                        if (!techs.ContainsKey(wei.techType))
                                                        {
                                                            if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                            {
                                                                prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                                techs[wei.techType]    = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                            else
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                                prefabData.probability > 0 &&
                                                                prefabData.probability < 1 &&
                                                                prefabData.count > 0)
                                                            {
                                                                Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                                techs[wei.techType] = prefabData;
                                                                customDSTDistribution[bio].prefabs.Add(prefabData);
                                                                continue;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Chunk"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType == TechType.LimestoneChunk ||
                                                            wei2.techType == TechType.SandstoneChunk ||
                                                            wei2.techType == TechType.ShaleChunk)
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && (wei.techType == TechType.AluminumOxide ||
                                                                                                                               wei.techType == TechType.BloodOil ||
                                                                                                                               wei.techType == TechType.Sulphur ||
                                                                                                                               wei.techType == TechType.Diamond ||
                                                                                                                               wei.techType == TechType.Kyanite ||
                                                                                                                               wei.techType == TechType.Lead ||
                                                                                                                               wei.techType == TechType.Lithium ||
                                                                                                                               wei.techType == TechType.Magnetite ||
                                                                                                                               wei.techType == TechType.Nickel ||
                                                                                                                               wei.techType == TechType.Quartz ||
                                                                                                                               wei.techType == TechType.Silver))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType == TechType.AluminumOxide ||
                                                            wei2.techType == TechType.BloodOil ||
                                                            wei2.techType == TechType.Sulphur ||
                                                            wei2.techType == TechType.Diamond ||
                                                            wei2.techType == TechType.Kyanite ||
                                                            wei2.techType == TechType.Lead ||
                                                            wei2.techType == TechType.Lithium ||
                                                            wei2.techType == TechType.Magnetite ||
                                                            wei2.techType == TechType.Nickel ||
                                                            wei2.techType == TechType.Salt ||
                                                            wei2.techType == TechType.Silver)
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (wei.techType != TechType.None && !bio.AsString().Contains("Fragment") && wei.techType.AsString().Contains("Drillable"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Drillable"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (((!bio.AsString().Contains("Fragment") &&
                                                       !b.AsString().Contains("Fragment")) || (bio.AsString().Contains("Fragment") &&
                                                                                               b.AsString().Contains("Fragment"))) &&
                                                     wei.techType.AsString().Contains("Fragment"))
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[bio].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Fragment"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }

                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0 &&
                                                            !bio.AsString().Contains("Fragment") &&
                                                            !b.AsString().Contains("Fragment"))
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                            else if (!bio.AsString().Contains("Fragment") && wei.techType == TechType.TimeCapsule)
                                            {
                                                bool check = false;
                                                foreach (LootDistributionData.PrefabData prefab in __instance.dstDistribution[b].prefabs)
                                                {
                                                    WorldEntityInfo wei2;
                                                    if (WorldEntityDatabase.TryGetInfo(prefab.classId, out wei2))
                                                    {
                                                        if (wei2.techType.AsString().Contains("Fragment"))
                                                        {
                                                            check = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (check)
                                                {
                                                    if (!techs.ContainsKey(wei.techType))
                                                    {
                                                        if (Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                                        {
                                                            prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 1000;
                                                            techs[wei.techType]    = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (((techs[wei.techType].probability > prefabData.probability && prefabData.count >= techs[wei.techType].count) || (techs[wei.techType].probability >= prefabData.probability && prefabData.count > techs[wei.techType].count)) &&
                                                            prefabData.probability > 0 &&
                                                            prefabData.probability < 1 &&
                                                            prefabData.count > 0)
                                                        {
                                                            Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 1000;
                                                            techs[wei.techType] = prefabData;
                                                            customDSTDistribution[bio].prefabs.Add(prefabData);
                                                            continue;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        foreach (LootDistributionData.PrefabData prefabData in __instance.dstDistribution[bio].prefabs)
                        {
                            WorldEntityInfo wei;
                            if (WorldEntityDatabase.TryGetInfo(prefabData.classId, out wei) && prefabData.probability > 0 && prefabData.probability < 1)
                            {
                                if (wei.techType != TechType.None)
                                {
                                    if (!Config.techProbability.ContainsKey(TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]))
                                    {
                                        Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] = prefabData.probability * 100;
                                        techs[wei.techType] = prefabData;
                                        customDSTDistribution[bio].prefabs.Add(prefabData);
                                        continue;
                                    }
                                    else
                                    {
                                        prefabData.probability = Config.techProbability[TechTypeExtensions.GetOrFallback(Language.main, wei.techType, wei.techType) + "| " + bio.AsString().Split('_')[0]] / 100;
                                        techs[wei.techType]    = prefabData;
                                        customDSTDistribution[bio].prefabs.Add(prefabData);
                                        continue;
                                    }
                                }
                                else
                                {
                                    customDSTDistribution[bio].prefabs.Add(prefabData);
                                    continue;
                                }
                            }
                            else
                            {
                                customDSTDistribution[bio].prefabs.Add(prefabData);
                            }
                        }
                    }
                }
                if (Config.RegenSpawns)
                {
                    Config.resetDefaults = false;
                    Config.RegenSpawns   = false;
                    IngameMenu.main.Open();
                    IngameMenu.main.ChangeSubscreen("Options");
                }
            }

            __result = customDSTDistribution.TryGetValue(biome, out data);
            return(!(__result));
        }