public void writeJson(StreamWriter outputStream, string tab, bool isFirst) { string entryStarter = isFirst ? "" : ","; string entriesTab = $"{tab}\t"; cWeenie wcidWeenie = Program.cache9Converter.getWeenie(wcid); string wcidName = ""; if (wcidWeenie != null) { wcidName = wcidWeenie.weenieName; } wcidName = Utils.removeWcidNameRedundancy(WeenieClassNames.getWeenieClassName(wcid), wcidName); outputStream.Write("{0}\n{1}\"cprof\": {{", entryStarter, tab); Utils.writeJson(outputStream, "wcid", wcid, entriesTab, true, true, 11); Utils.writeJson(outputStream, "_comment", wcidName, " ", false, false, 0); Utils.writeJson(outputStream, "palette", palette, entriesTab, false, true, 8); Utils.writeJson(outputStream, "shade", shade, entriesTab, false, true, 10); Utils.writeJson(outputStream, "destination", (int)destination, entriesTab, false, true, 4); Utils.writeJson(outputStream, "_comment2", destination.ToString(), " ", false, false, 0); Utils.writeJson(outputStream, "stack_size", stack_size, entriesTab, false, true, 5); Utils.writeJson(outputStream, "try_to_bond", try_to_bond, entriesTab, false, true, 4); outputStream.Write("\n{0}}}", tab); }
public void writeJson(StreamWriter outputStream, string tab, bool isFirst) { string entryStarter = isFirst ? "" : ","; string entriesTab = $"{tab}\t"; string subEntriesTab = $"{tab}\t\t"; cWeenie wcidWeenie = Program.cache9Converter.getWeenie(type); string wcidName = ""; if (wcidWeenie != null) { wcidName = wcidWeenie.weenieName; } wcidName = Utils.removeWcidNameRedundancy(WeenieClassNames.getWeenieClassName(type), wcidName); outputStream.Write("{0}\n{1}{{", entryStarter, entriesTab); Utils.writeJson(outputStream, "type", type, subEntriesTab, true, true, 16); if ((int)whereCreate < 0x40) { Utils.writeJson(outputStream, "_comment", wcidName, " ", false, false, 0); } else { Utils.writeJson(outputStream, "_comment", ((eTreasureGeneratorType)type).ToString(), " ", false, false, 0); } //Utils.writeJson(outputStream, "_comment", "Unknown treasure table value. Not working in phatAC", " ", false, false, 0); Utils.writeJson(outputStream, "probability", probability, subEntriesTab, false, true, 9); Utils.writeJson(outputStream, "delay", delay, subEntriesTab, false, true, 15); Utils.writeJson(outputStream, "initCreate", initCreate, subEntriesTab, false, true, 10); Utils.writeJson(outputStream, "maxNum", maxNum, subEntriesTab, false, true, 14); Utils.writeJson(outputStream, "whenCreate", (int)whenCreate, subEntriesTab, false, true, 10); Utils.writeJson(outputStream, "_comment2", whenCreate.ToString(), " ", false, false, 0); Utils.writeJson(outputStream, "whereCreate", (int)whereCreate, subEntriesTab, false, true, 9); Utils.writeJson(outputStream, "_comment3", whereCreate.ToString(), " ", false, false, 0); Utils.writeJson(outputStream, "stackSize", stackSize, subEntriesTab, false, true, 11); Utils.writeJson(outputStream, "ptid", ptid, subEntriesTab, false, true, 16); Utils.writeJson(outputStream, "shade", shade, subEntriesTab, false, true, 15); Utils.writeJson(outputStream, "slot", slot, subEntriesTab, false, true, 16); Utils.writeJson(outputStream, "objcell_id", objcell_id, subEntriesTab, false, true, 10); frame.writeJson(outputStream, subEntriesTab, false); outputStream.Write("\n{0}}}", entriesTab); }
public void writeJson(StreamWriter outputStream, string tab = "", bool isFirst = true) { string entriesTab = $"{tab}\t"; string subEntriesTab = $"{tab}\t\t"; string entryStarter = isFirst ? "" : ",\n"; outputStream.Write("{0}{1}{{", entryStarter, tab); Utils.writeJson(outputStream, "wcid", wcid, entriesTab, true, true); cWeenie wcidWeenie = Program.cache9Converter.getWeenie(wcid); string wcidName = ""; if (wcidWeenie != null) { wcidName = wcidWeenie.weenieName; } wcidName = Utils.removeWcidNameRedundancy(WeenieClassNames.getWeenieClassName(wcid), wcidName); Utils.writeJson(outputStream, "_comment", $"{wcidName}", " ", false, false); //Utils.writeJson(outputStream, "weenieName", weenieName, entriesTab, false, true); Utils.writeJson(outputStream, "weenieType", (int)weenieType, entriesTab, false, true); Utils.writeJson(outputStream, "_comment2", weenieType.ToString(), " ", false, false); if (statFlags.HasFlag(eStatFlags.stringStats)) { writeStringStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.intStats)) { writeIntStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.int64Stats)) { writeInt64StatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.boolStats)) { writeBoolStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.floatStats)) { writeFloatStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.didStats)) { writeDidStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.posStats)) { writePosStatsJson(outputStream, entriesTab); } if (statFlags.HasFlag(eStatFlags.iidStat)) { writeIidStatsJson(outputStream, entriesTab); } if (dataFlags.HasFlag(eDataFlags.attributes)) { attributes.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.skills)) { skills.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.body)) { body.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.spellBook)) { spellBook.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.eventFilter)) { eventFilter.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.emoteTable)) { emoteTable.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.createList)) { createList.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.pageDataList)) { pageDataList.writeJson(outputStream, entriesTab, false); } if (dataFlags.HasFlag(eDataFlags.generatorTable)) { generatorTable.writeJson(outputStream, entriesTab, false); } outputStream.Write("\n{0}}}", tab); }