public override void Process(CmdTrigger <ToolCmdArgs> trigger) { var mod = trigger.Text.NextModifiers(); string dir; if (mod == "a") { dir = DBCTool.FindWowDir(null); } else { dir = Path.GetFullPath(trigger.Text.Remainder); if (trigger.Text.Remainder.EndsWith(".exe")) { dir = Path.GetDirectoryName(dir); } } if (!Directory.Exists(dir)) { trigger.Reply("Directory does not exist: " + dir); } else { ToolConfig.WoWDir = dir; ToolConfig.Instance.Save(); VersionUpdater.SetWowDir(ToolConfig.WoWFileLocation); trigger.Reply("Selected client: {0}", VersionUpdater.WoWFile); } }
public MpqTerrainManager(TileIdentifier tileId) { var wowRootDir = DBCTool.FindWowDir(); MpqManager = new MpqManager(wowRootDir); TileId = tileId; var entries = GetMapEntries(); MapInfo entry = null; foreach (var item in entries) { if (item.Id != tileId.MapId) { continue; } entry = item; break; } WDTParser.MpqManager = MpqManager; _wdt = WDTParser.Process(entry); _adtManager = new ADTManager(this); _wmoManager = new WMOManager(); _m2Manager = new M2Manager(); _meshManager = new NavMeshManager(); _selectedTriangleManager = new SelectedTriangleManager(_adtManager); }
public static List <DBCMapEntry> GetMapEntries() { var wowRootDir = DBCTool.FindWowDir(null); if (!Directory.Exists(wowRootDir)) { log.Error("Could not find WoW-directory: \"{0}\"", wowRootDir); return(null); } var DBCMapEntryReader = new DBCReader <DBCMapEntry, DBCMapConverter>( RealmServerConfiguration.GetDBCFile("Map.dbc")); return(DBCMapEntryReader.EntryList); }
/// <summary> /// Starts processing all WDT and ADT files /// </summary> public static void ProcessAll() { if (Parsed == null) { throw new Exception("WDTExtractor.Parsed must be set before calling WDTExtractor.Process"); } var wowRootDir = DBCTool.FindWowDir(); MpqManager = new MpqManager(wowRootDir); var entryList = GetMapEntries(); WDTParser.MpqManager = MpqManager; foreach (var mapEntry in entryList) { //if (mapEntry.Id != MapId.EasternKingdoms) continue; var wdt = WDTParser.Process(mapEntry); if (wdt == null) { continue; } var path = Path.Combine(TerrainDisplayConfig.MapDir, wdt.Entry.Id.ToString()); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var filePath = Path.Combine(path, string.Format("{0}{1}", wdt.Entry.Id, Extension)); using (var file = File.Create(filePath)) { WriteWdt(file, wdt); file.Close(); } Parsed(wdt); } }
public static ZoneTileSet[] GetZoneTileSets() { var wowRootDir = DBCTool.FindWowDir(null); manager = new MpqManager(wowRootDir); var entryList = GetMapEntries(); if (entryList == null) { Console.WriteLine("Error retrieving Map Entries."); return(null); } var tiles = new ZoneTileSet[(int)MapId.End]; var count = 0; foreach (var dbcMapEntry in entryList) { var dir = dbcMapEntry.MapDirName; var wdtDir = Path.Combine(baseDir, dir); var wdtName = dir; var wdt = RegionBoundaries.Process(manager, wdtDir, wdtName + ".wdt"); if (wdt == null) { continue; } if ((wdt.Header.Header1 & WDTFlags.GlobalWMO) == 0) { var tileSet = new ZoneTileSet(); // Read in the Tiles for (var y = 0; y < 64; y++) { for (var x = 0; x < 64; x++) { if (!wdt.TileProfile[x, y]) { continue; } ++count; var adtName = string.Format("{0}_{1:00}_{2:00}", wdtName, x, y); var adt = Process(manager, wdtDir, adtName); if (adt == null) { continue; } // Read in the TileChunks for (var j = 0; j < 16; j++) { for (var i = 0; i < 16; i++) { var areaId = adt.MapChunks[i, j].AreaId; tileSet.ZoneGrids[x, y].ZoneIds[i, j] = (ZoneId)areaId; } } } } tiles[dbcMapEntry.Id] = tileSet; } else { log.Info("Could not read Zones from WMO: " + (MapId)dbcMapEntry.Id); } } log.Info("Exported {0} ZoneTileSets.", count); return(tiles); }
public string GetWoWDir() { return(wowDir ?? (wowDir = DBCTool.FindWowDir())); }