Beispiel #1
0
        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)
            }
        }
Beispiel #2
0
        public string SetZone(string zone)
        {
            int continentID;

            if (!zoneToMapId.TryGetValue(zone, out continentID))
            {
                int colon = zone.IndexOf(":");
                if (colon == -1)
                {
                    return(null);
                }
                zone = zone.Substring(colon);
                if (!zoneToMapId.TryGetValue(zone, out continentID))
                {
                    return(null);
                }
            }

            archive.ExtractFile("DBFilesClient\\Map.dbc", "Map.dbc");
            DBC     maps = new DBC();
            DBCFile mf   = new DBCFile("Map.dbc", maps);


            for (int i = 0; i < maps.recordCount; i++)
            {
                int mapID = maps.GetInt(i, 0);
                // Console.WriteLine("   ID:" + maps.GetInt(i, 0));
                // Console.WriteLine(" File: " + maps.GetString(i, 1));
                // Console.WriteLine(" Name: " + maps.GetString(i, 4)); // the file!!!

                if (mapID == continentID) // file == continentFile)
                {
                    //  Console.WriteLine(String.Format("{0,4} {1}", mapID, maps.GetString(i, 1)));
                    string file = maps.GetString(i, 1);
                    continentFile = file;



                    wdt = new WDT();

                    wdtf = new WDTFile(archive, continentFile, wdt, wmomanager, modelmanager);
                    if (!wdtf.loaded)
                    {
                        wdt = null; // bad
                    }
                    else
                    {
                        // Console.WriteLine("  global Objects " + wdt.gwmois.Count + " Models " + wdt.gwmois.Count);
                        //global_triangles.color = new float[3] { 0.8f, 0.8f, 1.0f };
                    }
                    return(continentFile);
                }
            }
            if (wdt == null)
            {
                return("Failed to open file files for continent ID" + continentID);
            }
            return(null);
        }
        public string SetZone(string zone)
        {
            int continentID;

            if (!zoneToMapId.TryGetValue(zone, out continentID))
            {
                int colon = zone.IndexOf(":");
                if (colon == -1)
                {
                    return(null);
                }
                zone = zone.Substring(colon);
                if (!zoneToMapId.TryGetValue(zone, out continentID))
                {
                    return(null);
                }
            }

            var path = Path.Join(dataConfig.PPather, "Map.dbc");

            archive.ExtractFile("..\\PathingAPI\\DBFilesClient\\Map.dbc", "PPather\\Map.dbc");
            DBC     maps = new DBC();
            DBCFile mf   = new DBCFile(path, maps, this.logger);

            for (int i = 0; i < maps.recordCount; i++)
            {
                int mapID = maps.GetInt(i, 0);
                // logger.WriteLine("   ID:" + maps.GetInt(i, 0));
                // logger.WriteLine(" File: " + maps.GetString(i, 1));
                // logger.WriteLine(" Name: " + maps.GetString(i, 4)); // the file!!!

                if (mapID == continentID) // file == continentFile)
                {
                    //  logger.WriteLine(String.Format("{0,4} {1}", mapID, maps.GetString(i, 1)));
                    string file = maps.GetString(i, 1);
                    SetContinent(file);
                    return(continentFile);
                }
            }
            if (wdt == null)
            {
                return("Failed to open file files for continent ID" + continentID);
            }
            return(null);
        }
Beispiel #4
0
        public string SetZone(string zone)
        {
            int continentID;

            if (!zoneToMapId.TryGetValue(zone, out continentID))
            {
                int colon = zone.IndexOf(":");
                if (colon == -1)
                {
                    return(null);
                }
                zone = zone.Substring(colon);
                if (!zoneToMapId.TryGetValue(zone, out continentID))
                {
                    return(null);
                }
            }

            archive.ExtractFile("DBFilesClient\\Map.dbc", "PPather\\Map.dbc");
            var maps = new DBC();
            var mf   = new DBCFile("PPather\\Map.dbc", maps);


            for (int i = 0; i < maps.recordCount; i++)
            {
                int mapID = maps.GetInt(i, 0);
                // PathGraph.Log("   ID:" + maps.GetInt(i, 0));
                // PathGraph.Log(" File: " + maps.GetString(i, 1));
                // PathGraph.Log(" Name: " + maps.GetString(i, 4)); // the file!!!

                if (mapID == continentID) // file == continentFile)
                {
                    //  PathGraph.Log(String.Format("{0,4} {1}", mapID, maps.GetString(i, 1)));
                    string file = maps.GetString(i, 1);
                    SetContinent(file);
                    return(continentFile);
                }
            }
            if (wdt == null)
            {
                return("Failed to open file files for continent ID" + continentID);
            }
            return(null);
        }
Beispiel #5
0
        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)
            }
        }
Beispiel #6
0
        public string SetZone(string zone)
        {
            int continentID;

            if (!zoneToMapId.TryGetValue(zone, out continentID))
            {
                int colon = zone.IndexOf(":");
                if (colon == -1)
                    return null;
                zone = zone.Substring(colon);
                if (!zoneToMapId.TryGetValue(zone, out continentID))
                {
                    return null;
                }
            }

            archive.ExtractFile("DBFilesClient\\Map.dbc", "PPather\\Map.dbc");
            DBC maps = new DBC();
            DBCFile mf = new DBCFile("PPather\\Map.dbc", maps);

            for (int i = 0; i < maps.recordCount; i++)
            {
                int mapID = maps.GetInt(i, 0);
                // Console.WriteLine("   ID:" + maps.GetInt(i, 0));
                // Console.WriteLine(" File: " + maps.GetString(i, 1));
                // Console.WriteLine(" Name: " + maps.GetString(i, 4)); // the file!!!

                if (mapID == continentID) // file == continentFile)
                {
                    //  Console.WriteLine(String.Format("{0,4} {1}", mapID, maps.GetString(i, 1)));
                    string file = maps.GetString(i, 1);
                    SetContinent(file);
                    return continentFile;
                }
            }
            if (wdt == null)
            {
                return "Failed to open file files for continent ID" + continentID;
            }
            return null;
        }
Beispiel #7
0
        public string SetZone(string zone)
        {
            int continentID;

            if (!zoneToMapId.TryGetValue(zone, out continentID))
            {
                int colon = zone.IndexOf(":");
                if(colon == -1)
                    return null;
                zone = zone.Substring(colon);
                if (!zoneToMapId.TryGetValue(zone, out continentID))
                {
                    return null;
                }
            }

            archive.ExtractFile("DBFilesClient\\Map.dbc", "Map.dbc");
            DBC maps = new DBC();
            DBCFile mf = new DBCFile("Map.dbc", maps);

            for (int i = 0; i < maps.recordCount; i++)
            {
                int mapID = maps.GetInt(i, 0);
               // Console.WriteLine("   ID:" + maps.GetInt(i, 0));
               // Console.WriteLine(" File: " + maps.GetString(i, 1));
               // Console.WriteLine(" Name: " + maps.GetString(i, 4)); // the file!!!

                if (mapID == continentID) // file == continentFile)
                {
                    //  Console.WriteLine(String.Format("{0,4} {1}", mapID, maps.GetString(i, 1)));
                    string file = maps.GetString(i, 1);
                    continentFile = file;

                    wdt = new WDT();

                    wdtf = new WDTFile(archive, continentFile, wdt, wmomanager, modelmanager);
                    if (!wdtf.loaded)
                        wdt = null; // bad
                    else
                    {

                       // Console.WriteLine("  global Objects " + wdt.gwmois.Count + " Models " + wdt.gwmois.Count);
                        //global_triangles.color = new float[3] { 0.8f, 0.8f, 1.0f };
                    }
                    return continentFile;
                }
            }
            if (wdt == null)
            {
                return "Failed to open file files for continent ID" + continentID;
            }
            return null;
        }
Beispiel #8
0
        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)
            }
        }
Beispiel #9
0
        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)
            }
        }