public static void WriteToList(List <ZoneSystem.ZoneLocation> zoneLocations)
        {
            HashSet <string> printedLocations = new();
            StringBuilder    stringBuilder    = new ();
            Dictionary <Heightmap.Biome, List <string> > locationsByBiome = new();

            foreach (var location in zoneLocations)
            {
                var biomes = SplitBiome(location.m_biome);

                foreach (var biome in biomes)
                {
                    List <string> biomeLocations;

                    if (!locationsByBiome.TryGetValue(biome, out biomeLocations))
                    {
                        locationsByBiome[biome] = biomeLocations = new();
                    }

                    biomeLocations.Add(location.m_prefabName);
                }
            }

            foreach (var biome in locationsByBiome.OrderBy(x => x.Key))
            {
                var currentBiome = biome.Key.ToString();

                stringBuilder.AppendLine();
                stringBuilder.AppendLine($"[{currentBiome}]");

                foreach (var location in biome.Value)
                {
                    var locationKey = location + "." + currentBiome;

                    if (!printedLocations.Contains(locationKey))
                    {
                        stringBuilder.AppendLine(location);
                        printedLocations.Add(locationKey);
                    }
                }
            }

            PrintDebugFile.PrintFile(stringBuilder.ToString(), FileName, "locations");
        }
Exemple #2
0
        public static void WriteToFile(List <Tuple <GameObject, CharacterDrop> > characters)
        {
            List <string> lines = new List <string>(characters.Count * 20);

            foreach (var characterDrop in characters)
            {
                if (characterDrop.Item2.IsNull() ||
                    (characterDrop.Item2.m_drops?.Count ?? 0) == 0)
                {
                    continue;
                }

                for (int i = 0; i < characterDrop.Item2.m_drops.Count; ++i)
                {
                    var item = characterDrop.Item2.m_drops[i];

                    if (item is null)
                    {
                        continue;
                    }

                    string itemName = characterDrop.Item1.IsNull()
                        ? "MissingNo"
                        : characterDrop.Item1.name;

                    string itemPrefabName = item.m_prefab.IsNull()
                        ? ""
                        : item.m_prefab.GetCleanedName();

                    lines.Add($"[{itemName}.{i}]");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.PrefabName)}={itemPrefabName}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.EnableConfig)}={true}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.SetAmountMin)}={item.m_amountMin}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.SetAmountMax)}={item.m_amountMax}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.SetChanceToDrop)}={(item.m_chance * 100).ToString(CultureInfo.InvariantCulture)}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.SetDropOnePerPlayer)}={item.m_onePerPlayer}");
                    lines.Add($"{nameof(CharacterDropItemConfiguration.SetScaleByLevel)}={item.m_levelMultiplier}");
                    lines.Add("");
                }
            }

            PrintDebugFile.PrintFile(lines, FileName, "default creature drop tables");
        }