public static void save() { River river = new River(Level.info.path + "/Spawns/Vehicles.dat", false); river.writeByte(LevelVehicles.SAVEDATA_VERSION); river.writeByte((byte)LevelVehicles.tables.Count); byte b = 0; while ((int)b < LevelVehicles.tables.Count) { VehicleTable vehicleTable = LevelVehicles.tables[(int)b]; river.writeColor(vehicleTable.color); river.writeString(vehicleTable.name); river.writeUInt16(vehicleTable.tableID); river.writeByte((byte)vehicleTable.tiers.Count); byte b2 = 0; while ((int)b2 < vehicleTable.tiers.Count) { VehicleTier vehicleTier = vehicleTable.tiers[(int)b2]; river.writeString(vehicleTier.name); river.writeSingle(vehicleTier.chance); river.writeByte((byte)vehicleTier.table.Count); byte b3 = 0; while ((int)b3 < vehicleTier.table.Count) { VehicleSpawn vehicleSpawn = vehicleTier.table[(int)b3]; river.writeUInt16(vehicleSpawn.vehicle); b3 += 1; } b2 += 1; } b += 1; } river.writeUInt16((ushort)LevelVehicles.spawns.Count); for (int i = 0; i < LevelVehicles.spawns.Count; i++) { VehicleSpawnpoint vehicleSpawnpoint = LevelVehicles.spawns[i]; river.writeByte(vehicleSpawnpoint.type); river.writeSingleVector3(vehicleSpawnpoint.point); river.writeByte(MeasurementTool.angleToByte(vehicleSpawnpoint.angle)); } river.closeRiver(); }
// Token: 0x06003479 RID: 13433 RVA: 0x001584AC File Offset: 0x001568AC private static void exportVehicles(string path, Data spawnsData, ref ushort id, bool isLegacy) { for (int i = 0; i < LevelVehicles.tables.Count; i++) { VehicleTable vehicleTable = LevelVehicles.tables[i]; if (vehicleTable.tableID == 0) { vehicleTable.tableID = id; spawnsData.writeString(id.ToString(), Level.info.name + "_" + vehicleTable.name); Data data = new Data(); data.writeString("Type", "Spawn"); Data data2 = data; string key = "ID"; ushort value; id = (value = id) + 1; data2.writeUInt16(key, value); if (ReadWrite.fileExists(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, true)) { Data data3 = ReadWrite.readData(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, true); data.writeInt32("Tables", 1); data.writeUInt16("Table_0_Spawn_ID", data3.readUInt16("ID")); data.writeInt32("Table_0_Weight", 100); } else { data.writeInt32("Tables", 1); data.writeUInt16("Table_0_Spawn_ID", id); data.writeInt32("Table_0_Weight", 100); spawnsData.writeString(id.ToString(), vehicleTable.name); Data data4 = new Data(); data4.writeString("Type", "Spawn"); Data data5 = data4; string key2 = "ID"; id = (value = id) + 1; data5.writeUInt16(key2, value); if (isLegacy) { if (vehicleTable.tiers.Count > 1) { float num = float.MaxValue; for (int j = 0; j < vehicleTable.tiers.Count; j++) { VehicleTier vehicleTier = vehicleTable.tiers[j]; if (vehicleTier.chance < num) { num = vehicleTier.chance; } } int num2 = Mathf.CeilToInt(10f / num); data4.writeInt32("Tables", vehicleTable.tiers.Count); for (int k = 0; k < vehicleTable.tiers.Count; k++) { VehicleTier vehicleTier2 = vehicleTable.tiers[k]; bool flag = SpawnTableTool.isVariantVehicleTier(vehicleTier2); if (flag && ReadWrite.fileExists(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, true)) { Data data6 = ReadWrite.readData(string.Concat(new string[] { "/Bundles/Spawns/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, true); data4.writeUInt16("Table_" + k + "_Spawn_ID", data6.readUInt16("ID")); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); } else if (flag && ReadWrite.fileExists(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false)) { Data data7 = ReadWrite.readData(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false); data4.writeUInt16("Table_" + k + "_Spawn_ID", data7.readUInt16("ID")); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); } else { data4.writeUInt16("Table_" + k + "_Spawn_ID", id); data4.writeInt32("Table_" + k + "_Weight", (int)(vehicleTier2.chance * (float)num2)); if (flag) { spawnsData.writeString(id.ToString(), vehicleTier2.name); } else { spawnsData.writeString(id.ToString(), vehicleTable.name + "_" + vehicleTier2.name); } Data data8 = new Data(); data8.writeString("Type", "Spawn"); Data data9 = data8; string key3 = "ID"; id = (value = id) + 1; data9.writeUInt16(key3, value); data8.writeInt32("Tables", vehicleTier2.table.Count); for (int l = 0; l < vehicleTier2.table.Count; l++) { VehicleSpawn vehicleSpawn = vehicleTier2.table[l]; data8.writeUInt16("Table_" + l + "_Asset_ID", vehicleSpawn.vehicle); data8.writeInt32("Table_" + l + "_Weight", 10); } if (flag) { ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTier2.name, "/", vehicleTier2.name, ".dat" }), false, false, data8); } else { ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTable.name, "_", vehicleTier2.name, "/", vehicleTable.name, "_", vehicleTier2.name, ".dat" }), false, false, data8); } } } } else { VehicleTier vehicleTier3 = vehicleTable.tiers[0]; data4.writeInt32("Tables", vehicleTier3.table.Count); for (int m = 0; m < vehicleTier3.table.Count; m++) { VehicleSpawn vehicleSpawn2 = vehicleTier3.table[m]; data4.writeUInt16("Table_" + m + "_Asset_ID", vehicleSpawn2.vehicle); data4.writeInt32("Table_" + m + "_Weight", 10); } } } ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", vehicleTable.name, "/", vehicleTable.name, ".dat" }), false, false, data4); } ReadWrite.writeData(string.Concat(new string[] { path, "/Vehicles/", Level.info.name, "_", vehicleTable.name, "/", Level.info.name, "_", vehicleTable.name, ".dat" }), false, false, data); } } }