Example #1
0
        public static IEnumerable <string> GetLines(EncounterArchive8 t, IReadOnlyDictionary <ulong, string> zone_names, string[] subtable_names, string[] species)
        {
            for (var i = 0; i < t.EncounterTables.Length; i++)
            {
                var enc = t.EncounterTables[i];
                yield return($"{i:000} - {zone_names[enc.ZoneID]}:");

                if (enc.SubTables.Length != 0)
                {
                    var       j = 0;
                    const int NUM_WEATHER_TABLES = 9;
                    if (AllWeatherTablesIdentical(enc.SubTables, NUM_WEATHER_TABLES))
                    {
                        foreach (var line in GetSubTableSummary(enc.SubTables[0], "All Weather", species))
                        {
                            yield return($"\t{line}");
                        }
                        j = NUM_WEATHER_TABLES;
                    }

                    while (j < enc.SubTables.Length)
                    {
                        foreach (var line in GetSubTableSummary(enc.SubTables[j], subtable_names[j], species))
                        {
                            yield return($"\t{line}");
                        }
                        j++;
                    }
                }

                yield return(string.Empty);
            }
        }
Example #2
0
        public static byte[][] GetBytes(IReadOnlyDictionary <ulong, byte> zone_loc, EncounterArchive8 t, bool hiddenTreeFix = false)
        {
            var result = new List <DumpableLocation>();

            foreach (var zone in t.EncounterTables)
            {
                var entry = GetDumpable(zone, zone_loc);
                if (entry.Slots.Count == 0)
                {
                    continue;
                }
                result.Add(entry);
            }

            if (hiddenTreeFix)
            {
                // The Berry Trees in Bridge Field are right against the map boundary, and can be accessed on the adjacent Map ID (Stony Wilderness)
                // Copy the two Berry Tree encounters from Bridge to Stony, as these aren't overworld (wandering) crossover encounters.
                var bridge = result.Find(z => z.Location == 142);
                var stony  = result.Find(z => z.Location == 144);

                foreach (var s in bridge.Slots.Where(z => z.EncounterType == SWSHEncounterType.Shaking_Trees))
                {
                    stony.Slots.Add(s);
                }
            }

            return(result.ConvertAll(z => z.Serialize()).ToArray());
        }
Example #3
0
        public static byte[][] GetBytes(IReadOnlyDictionary <ulong, byte> zone_loc, EncounterArchive8 t)
        {
            var result = new byte[t.EncounterTables.Length][];

            for (int i = 0; i < result.Length; i++)
            {
                var zone = t.EncounterTables[i];
                result[i] = GetZoneBytes(zone, zone_loc);
            }

            return(result);
        }
Example #4
0
        public static byte[][] GetBytes(IReadOnlyDictionary <ulong, byte> zone_loc, EncounterArchive8 t)
        {
            var result = new List <byte[]>();

            foreach (var zone in t.EncounterTables)
            {
                var entry = GetZoneBytes(zone, zone_loc);
                if (entry.Length != 0)
                {
                    result.Add(entry);
                }
            }

            return(result.ToArray());
        }