public static void WriteMapModels(ARealmReversed realm, TerritoryType teriType) { Territory territory = Plot.StringToWard(teriType.Name); string inpath = FFXIVHSPaths.GetTerritoryJson(territory); if (!File.Exists(inpath)) { throw new FileNotFoundException(); } string outpath = FFXIVHSPaths.GetTerritoryObjectsDirectory(territory); string json = File.ReadAllText(inpath); Map map = JsonConvert.DeserializeObject <Map>(json); foreach (MapModel model in map.models.Values) { if (realm.Packs.TryGetFile(model.modelPath, out SaintCoinach.IO.File f)) { ObjectFileWriter.WriteObjectFile(outpath, (ModelFile)f); } } }
/// <summary> /// Occurs first in the ward data output flow and populates plots with the sizes of /// the appropriate plots from the sheet HousingLandSet. /// </summary> private static void ReadLandSetSheet(ARealmReversed realm, ref List <Plot> plots) { IXivSheet <XivRow> landSet = realm.GameData.GetSheet("HousingLandSet"); foreach (XivRow row in landSet) { Territory thisTerritory = (Territory)row.Key; for (int i = 0; i < 60; i++) { //Get this plot's size Size size = (Size)(byte)row[i]; Plot p = new Plot(thisTerritory, i > 29, (byte)(i % 30 + 1), size); plots.Add(p); } } }
public static void WriteMap(ARealmReversed realm, TerritoryType teriType) { Territory territory = Plot.StringToWard(teriType.Name); string outpath = FFXIVHSPaths.GetTerritoryJson(territory); if (File.Exists(outpath)) { WriteMapModels(realm, teriType); return; } Map map = ReadTerritory(teriType); string json = JsonConvert.SerializeObject(map, Formatting.Indented); File.WriteAllText(outpath, json); }