/// <summary> /// Gets an annotated Area array /// </summary> /// <param name="ed">Encounter Data GARC</param> /// <param name="zd">ZoneData GARC</param> /// <param name="wd">WorldData GARC</param> /// <param name="locationList">Location strings</param> /// <returns>Annotated Area Array</returns> public static Area7[] GetArray(lzGARCFile ed, lzGARCFile zd, lzGARCFile wd, string[] locationList) { var Worlds = wd.Files.Select(f => Mini.UnpackMini(f, "WD")[0]).ToArray(); byte[][] zdfiles = zd.Files; var worldData = zdfiles[1]; var zoneData = zdfiles[0]; var zones = ZoneData7.GetZoneData7Array(zoneData, worldData, locationList, Worlds); var areas = GetArray(ed, zones); return(areas); }
public static Area7[] GetArray(lzGARCFile ed, ZoneData7[] zd) { int fileCount = ed.FileCount; var numAreas = fileCount / 11; var areas = new Area7[numAreas]; for (int i = 0; i < numAreas; i++) { areas[i] = new Area7 { FileNumber = 9 + (11 * i), Zones = zd.Where(z => z.AreaIndex == i).ToArray() }; var md = ed[areas[i].FileNumber]; if (md.Length <= 0) { areas[i].HasTables = false; continue; } byte[][] Tables = Mini.UnpackMini(md, PackIdentifier); areas[i].HasTables = Tables.Any(t => t.Length > 0); if (!areas[i].HasTables) { continue; } foreach (var Table in Tables) { var DayTable = Table.Skip(4).Take(0x164).ToArray(); var NightTable = Table.Skip(0x168).ToArray(); areas[i].Tables.Add(new EncounterTable(DayTable)); areas[i].Tables.Add(new EncounterTable(NightTable)); } } return(areas); }