public MPQTriangleSupplier(Logger logger) { this.logger = logger; string[] archiveNames = GetArchiveNames(s => logger.WriteLine(s)); archive = new StormDll.ArchiveSet(this.logger); archive.AddArchives(archiveNames); modelmanager = new ModelManager(archive, 80); wmomanager = new WMOManager(archive, modelmanager, 30); archive.ExtractFile("..\\PathingAPI\\DBFilesClient\\AreaTable.dbc", "..\\PathingAPI\\PPather\\AreaTable.dbc"); DBC areas = new DBC(); DBCFile af = new DBCFile("..\\PathingAPI\\PPather\\AreaTable.dbc", areas, this.logger); for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); //0 uint AreaID int WorldID = (int)areas.GetUint(i, 1); //1 uint Continent (refers to a WorldID) int Parent = (int)areas.GetUint(i, 2); //2 uint Region (refers to an AreaID) string Name = areas.GetString(i, 11); areaIdToName.Add(AreaID, Name); } for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); int WorldID = (int)areas.GetUint(i, 1); int Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); string TotalName = ""; //areaIdToName.Add(AreaID, Name); //areaIdParent.Add(AreaID, Parent); string ParentName = ""; if (!areaIdToName.TryGetValue(Parent, out ParentName)) { TotalName = ":" + Name; } else { TotalName = Name + ":" + ParentName; } try { zoneToMapId.Add(TotalName, WorldID); //logger.WriteLine(TotalName + " => " + WorldID); } catch { int id; zoneToMapId.TryGetValue(TotalName, out id); //// logger.WriteLine("Duplicate: " + TotalName + " " + WorldID +" " + id); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } }
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 override void Close() { archive.Close(); wdt = null; wdtf = null; modelmanager = null; wmomanager = null; zoneToMapId = null; mapIdToFile = null; areaIdToName = null; archive = null; base.Close(); }
public MPQTriangleSupplier() { string[] archiveNames = { "patch.MPQ", "enUS\\patch-enUS.MPQ", "enGB\\patch-enGB.MPQ", "lichking.MPQ", "common-2.MPQ", "common.MPQ", "expansion.MPQ", "enUS\\lichking-locale-enUS.MPQ", "enUS\\locale-enUS.MPQ", "enUS\\expansion-locale-enUS.MPQ", "enGB\\lichking-locale-enGB.MPQ", "enGB\\locale-enGB.MPQ", "enGB\\expansion-locale-enGB.MPQ", "enUS\\base-enUS.MPQ", "enGB\\base-enGB.MPQ", "enUS\\backup-enUS.MPQ", "enGB\\backup-enGB.MPQ"}; //StormDll.ArchiveSet archive = null; archive = new StormDll.ArchiveSet(); string regGameDir = archive.SetGameDirFromReg(); //string gameDir = "F:\\World of Warcraft\\Data\\"; //archive.SetGameDir(gameDir); Console.WriteLine("Game dir is " + regGameDir); archive.AddArchives(archiveNames); modelmanager = new ModelManager(archive, 80); wmomanager = new WMOManager(archive, modelmanager, 30); archive.ExtractFile("DBFilesClient\\AreaTable.dbc", "PPather\\AreaTable.dbc"); DBC areas = new DBC(); DBCFile af = new DBCFile("PPather\\AreaTable.dbc", areas); for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); int WorldID = (int)areas.GetUint(i, 1); int Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); areaIdToName.Add(AreaID, Name); if (WorldID != 0 && WorldID != 1 && WorldID != 530) { //// Console.WriteLine(String.Format("{0,4} {1,3} {2,3} {3}", AreaID, WorldID, Parent, Name)); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); int WorldID = (int)areas.GetUint(i, 1); int Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); string TotalName = ""; //areaIdToName.Add(AreaID, Name); //areaIdParent.Add(AreaID, Parent); string ParentName = ""; if (!areaIdToName.TryGetValue(Parent, out ParentName)) { TotalName = ":" + Name; } else TotalName = Name + ":" + ParentName; try { zoneToMapId.Add(TotalName, WorldID); //Console.WriteLine(TotalName + " => " + WorldID); } catch { int id; zoneToMapId.TryGetValue(TotalName, out id); //// Console.WriteLine("Duplicate: " + TotalName + " " + WorldID +" " + id); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } }
public MPQTriangleSupplier() { string[] archiveNames = { "patch-2.MPQ", "patch.MPQ", "enUS\\patch-enUS-2.MPQ", "enUS\\patch-enUS.MPQ", "enGB\\patch-enGB-2.MPQ", "enGB\\patch-enGB.MPQ", "common.MPQ", "expansion.MPQ", "enUS\\locale-enUS.MPQ", "enUS\\expansion-locale-enUS.MPQ", "enGB\\locale-enGB.MPQ", "enGB\\expansion-locale-enGB.MPQ" }; //StormDll.ArchiveSet archive = null; archive = new StormDll.ArchiveSet(); string regGameDir = archive.SetGameDirFromReg(); //string gameDir = "F:\\World of Warcraft\\Data\\"; //archive.SetGameDir(gameDir); Console.WriteLine("Game dir is " + regGameDir); archive.AddArchives(archiveNames); modelmanager = new ModelManager(archive, 80); wmomanager = new WMOManager(archive, modelmanager, 30); archive.ExtractFile("DBFilesClient\\AreaTable.dbc", "AreaTable.dbc"); DBC areas = new DBC(); DBCFile af = new DBCFile("AreaTable.dbc", areas); for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); int WorldID = (int)areas.GetUint(i, 1); int Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); areaIdToName.Add(AreaID, Name); if (WorldID != 0 && WorldID != 1 && WorldID != 530) { //// Console.WriteLine(String.Format("{0,4} {1,3} {2,3} {3}", AreaID, WorldID, Parent, Name)); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } for (int i = 0; i < areas.recordCount; i++) { int AreaID = (int)areas.GetUint(i, 0); int WorldID = (int)areas.GetUint(i, 1); int Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); string TotalName = ""; //areaIdToName.Add(AreaID, Name); //areaIdParent.Add(AreaID, Parent); string ParentName = ""; if (!areaIdToName.TryGetValue(Parent, out ParentName)) { TotalName = ":" + Name; } else { TotalName = Name + ":" + ParentName; } try { zoneToMapId.Add(TotalName, WorldID); Console.WriteLine(TotalName + " => " + WorldID); }catch { int id; zoneToMapId.TryGetValue(TotalName, out id); //// Console.WriteLine("Duplicate: " + TotalName + " " + WorldID +" " + id); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } }
public MPQTriangleSupplier() { string[] archiveNames = { "patch.MPQ", "enUS\\patch-enUS.MPQ", "enGB\\patch-enGB.MPQ", "lichking.MPQ", "common-2.MPQ", "common.MPQ", "expansion.MPQ", "enUS\\lichking-locale-enUS.MPQ","enUS\\locale-enUS.MPQ", "enUS\\expansion-locale-enUS.MPQ", "enGB\\lichking-locale-enGB.MPQ","enGB\\locale-enGB.MPQ", "enGB\\expansion-locale-enGB.MPQ", "enUS\\base-enUS.MPQ", "enGB\\base-enGB.MPQ", "enUS\\backup-enUS.MPQ", "enGB\\backup-enGB.MPQ" }; //StormDll.ArchiveSet archive = null; Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); archive = new ArchiveSet(); string regGameDir = archive.SetGameDirFromReg(); //string gameDir = @"C:\WoW 335\Data\"; //archive.SetGameDir(gameDir); zoneToMapId = new Dictionary <string, int>(); mapIdToFile = new Dictionary <int, string>(); areaIdToName = new Dictionary <int, string>(); PathGraph.Log("Game dir is " + regGameDir); archive.AddArchives(archiveNames); modelmanager = new ModelManager(archive, 80); wmomanager = new WMOManager(archive, modelmanager, 30); archive.ExtractFile("DBFilesClient\\AreaTable.dbc", "PPather\\AreaTable.dbc"); var areas = new DBC(); var af = new DBCFile("PPather\\AreaTable.dbc", areas); for (int i = 0; i < areas.recordCount; i++) { var AreaID = (int)areas.GetUint(i, 0); var WorldID = (int)areas.GetUint(i, 1); var Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); areaIdToName.Add(AreaID, Name); if (WorldID != 0 && WorldID != 1 && WorldID != 530) { //// PathGraph.Log(String.Format("{0,4} {1,3} {2,3} {3}", AreaID, WorldID, Parent, Name)); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } for (int i = 0; i < areas.recordCount; i++) { var AreaID = (int)areas.GetUint(i, 0); var WorldID = (int)areas.GetUint(i, 1); var Parent = (int)areas.GetUint(i, 2); string Name = areas.GetString(i, 11); string TotalName = ""; //areaIdToName.Add(AreaID, Name); //areaIdParent.Add(AreaID, Parent); string ParentName = ""; if (!areaIdToName.TryGetValue(Parent, out ParentName)) { TotalName = ":" + Name; } else { TotalName = Name + ":" + ParentName; } if (!zoneToMapId.ContainsKey(Name) && !zoneToMapId.ContainsKey(TotalName)) { zoneToMapId.Add(TotalName, WorldID); //PathGraph.Log(TotalName + " => " + WorldID); } else { int id; zoneToMapId.TryGetValue(TotalName, out id); //// PathGraph.Log("Duplicate: " + TotalName + " " + WorldID +" " + id); } //0 uint AreaID //1 uint Continent (refers to a WorldID) //2 uint Region (refers to an AreaID) } }