-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMapParser.cs
More file actions
executable file
·46 lines (42 loc) · 2.12 KB
/
MapParser.cs
File metadata and controls
executable file
·46 lines (42 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.Versioning;
using System.Text.Json;
namespace ResourceExtractor;
[SupportedOSPlatform("windows")]
public static class MapParser {
public static void Extract(string outDir) {
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ResourceExtractor.MapDats.json");
var dats = JsonSerializer.Deserialize<IDictionary<string, IDictionary<string, ushort>>>(stream);
foreach (var (zone, maps) in dats) {
foreach (var (map, datId) in maps) {
using var dat = File.Open(Program.GetPath(datId), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
var image = ImageParser.Parse(dat, true);
using var file = File.Open($"{outDir}/resources/maps/{zone}_{map}.png", FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite);
image.Save(file, ImageFormat.Png);
}
}
}
#region JSON Comments/Posterity
//There are a number of duplicate or unused map DAT's.
//These are values that have been removed from MapDats.json.
//"2": {"0": 5689}, //0 is not used in game.
//"29": {"2": 5729}, //Duplicate of map 1.
//"30": {"2": 5731}, //Duplicate of map 1.
//"44": {"2": 5748}, //Duplicate of map 1.
//"140": {"15": 5341}, //15 is not used in game.
//"142": {"0": 5343}, //Duplicate of map 1.
//"169": {"3": 5633}, //Duplicate of map 2.
//"171": {"0": 5408, //0 is a dummy map.
//"173": {"0": 5410}, //0 is not used in game.
//"174": {"0": 5411}, //0 is not used in game.
//"190": {"1001": 5430}, //Duplicate of map 1.
//"191": {"0": 5431}, //Duplicate of map 1.
//"205": {"1015": 5456, "1016": 5457 //These are maps that never made it to game, different zone name.
//"205": {"18": 5685 //18 is not used in game.
//"226": {"0": 5475}, //0 is a dummy map.
//"242": {"0": 5490}, //0 is a dummy map.
#endregion
}