private static void AddCustomData(string classId, LootDistributionData.SrcData customSrcData, Dictionary <string, LootDistributionData.SrcData> srcDistribution, Dictionary <BiomeType, LootDistributionData.DstData> dstDistribution)
        {
            srcDistribution.Add(classId, customSrcData);

            List <LootDistributionData.BiomeData> distribution = customSrcData.distribution;

            if (distribution != null)
            {
                for (int i = 0; i < distribution.Count; i++)
                {
                    LootDistributionData.BiomeData biomeData = distribution[i];
                    BiomeType biome       = biomeData.biome;
                    int       count       = biomeData.count;
                    float     probability = biomeData.probability;

                    if (!dstDistribution.TryGetValue(biome, out LootDistributionData.DstData dstData))
                    {
                        dstData = new LootDistributionData.DstData
                        {
                            prefabs = new List <LootDistributionData.PrefabData>()
                        };
                        dstDistribution.Add(biome, dstData);
                    }

                    var prefabData = new LootDistributionData.PrefabData
                    {
                        classId     = classId,
                        count       = count,
                        probability = probability
                    };
                    dstData.prefabs.Add(prefabData);
                }
            }
        }
        private static void EditExistingData(string classId, LootDistributionData.SrcData existingData, LootDistributionData.SrcData changes, Dictionary <BiomeType, LootDistributionData.DstData> dstData)
        {
            foreach (LootDistributionData.BiomeData customBiomeDist in changes.distribution)
            {
                bool foundBiome = false;

                for (int i = 0; i < existingData.distribution.Count; i++)
                {
                    LootDistributionData.BiomeData biomeDist = existingData.distribution[i];

                    if (customBiomeDist.biome == biomeDist.biome)
                    {
                        biomeDist.count       = customBiomeDist.count;
                        biomeDist.probability = customBiomeDist.probability;

                        foundBiome = true;
                    }
                }

                if (!foundBiome)
                {
                    existingData.distribution.Add(customBiomeDist);
                }

                if (!dstData.TryGetValue(customBiomeDist.biome, out LootDistributionData.DstData biomeDistData))
                {
                    biomeDistData = new LootDistributionData.DstData
                    {
                        prefabs = new List <LootDistributionData.PrefabData>()
                    };
                    dstData.Add(customBiomeDist.biome, biomeDistData);
                }

                bool foundPrefab = false;

                for (int j = 0; j < biomeDistData.prefabs.Count; j++)
                {
                    LootDistributionData.PrefabData prefabData = biomeDistData.prefabs[j];

                    if (prefabData.classId == classId)
                    {
                        prefabData.count       = customBiomeDist.count;
                        prefabData.probability = customBiomeDist.probability;

                        foundPrefab = true;
                    }
                }

                if (!foundPrefab)
                {
                    biomeDistData.prefabs.Add(new LootDistributionData.PrefabData()
                    {
                        classId     = classId,
                        count       = customBiomeDist.count,
                        probability = customBiomeDist.probability
                    });
                }
            }
        }
Example #3
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));
        }