private void TileListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (tileListBox.SelectedItem == null) { e.Handled = true; return; } try { var selectedMap = (MapListItem)mapListBox.SelectedItem; if (!wdtCache.ContainsKey(selectedMap.ID)) { var reader = new WoWFormatLib.FileReaders.WDTReader(); reader.LoadWDT((uint)selectedMap.WDTFileDataID); wdtCache.Add(selectedMap.ID, reader); } var file = (string)tileListBox.SelectedItem; var splitTile = file.Split('_'); var fixedTileName = splitTile[0].PadLeft(2, '0') + "_" + splitTile[1].PadLeft(2, '0'); var minimapFile = "world\\minimaps\\" + selectedMap.Internal + "\\map" + fixedTileName + ".blp"; if (!Listfile.TryGetFileDataID(minimapFile, out var minimapFileDataID)) { Logger.WriteLine("Unable to find filedataid for minimap file " + minimapFile); minimapFileDataID = wdtCache[selectedMap.ID].tileFiles[(byte.Parse(splitTile[0]), byte.Parse(splitTile[1]))].minimapTexture;
private void MapListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { tileListBox.Items.Clear(); if (mapListBox.HasItems) { var selectedItem = (MapListItem)mapListBox.SelectedItem; if (CASC.FileExists((uint)selectedItem.WDTFileDataID)) { if (!wdtCache.ContainsKey(selectedItem.ID)) { var reader = new WoWFormatLib.FileReaders.WDTReader(); reader.LoadWDT((uint)selectedItem.WDTFileDataID); wdtCache.Add(selectedItem.ID, reader); } for (var i = 0; i < wdtCache[selectedItem.ID].tiles.Count; i++) { tileListBox.Items.Add(wdtCache[selectedItem.ID].tiles[i].Item1.ToString() + "_" + wdtCache[selectedItem.ID].tiles[i].Item2.ToString()); } } } e.Handled = true; }
private void MapListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { tileListBox.Items.Clear(); if (mapListBox.HasItems) { var selectedItem = (MapListItem)mapListBox.SelectedItem; var wdt = "world\\maps\\" + selectedItem.Internal + "\\" + selectedItem.Internal + ".wdt"; if (CASC.FileExists(wdt)) { var reader = new WoWFormatLib.FileReaders.WDTReader(); reader.LoadWDT(wdt); for (var i = 0; i < reader.tiles.Count; i++) { tileListBox.Items.Add(reader.tiles[i][0].ToString().PadLeft(2, '0') + "_" + reader.tiles[i][1].ToString().PadLeft(2, '0')); } } } }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("Not enough arguments!"); } else { if (args[0] == "wdt") { if (args.Length != 2) { throw new Exception("Not enough arguments. Need mode, file"); } var wdt = new WoWFormatLib.FileReaders.WDTReader(); wdt.LoadWDT(File.OpenRead(args[1])); Console.WriteLine(JsonConvert.SerializeObject(wdt.wdtfile.manm, Formatting.Indented)); } /* * if (args[0] == "adt") * { * if (args.Length != 2) * throw new Exception("Not enough arguments. Need mode, file"); * * var adt = new WoWFormatLib.FileReaders.ADTReader(); * * adt.LoadADT(File.OpenRead(args[1])); * * for (var i = 0; i < adt.adtfile.chunks.Length; i++) * { * adt.adtfile.chunks[i].vertices = new WoWFormatLib.Structs.ADT.MCVT(); * adt.adtfile.chunks[i].normals = new WoWFormatLib.Structs.ADT.MCNR(); * adt.adtfile.chunks[i].vertexShading = new WoWFormatLib.Structs.ADT.MCCV(); * } * * Console.WriteLine(JsonConvert.SerializeObject(adt, Formatting.Indented)); * } */ if (args[0] == "wmo") { if (args.Length != 2) { throw new Exception("Not enough arguments. Need mode, file"); } var reader = new WoWFormatLib.FileReaders.WMOReader(); var wmo = reader.LoadWMO(File.OpenRead(args[1])); Console.WriteLine(JsonConvert.SerializeObject(wmo, Formatting.Indented)); } if (args[0] == "m2") { if (args.Length != 2) { throw new Exception("Not enough arguments. Need mode, file"); } var m2 = new WoWFormatLib.FileReaders.M2Reader(); m2.LoadM2(File.OpenRead(args[1])); m2.model.vertices = new WoWFormatLib.Structs.M2.Vertice[0]; Console.WriteLine(JsonConvert.SerializeObject(m2, Formatting.Indented)); } } }