示例#1
0
        public void LoadData()
        {
            // File version, must be 18.
            Console.WriteLine("Reading file version...");
            if (!ReadMVER())
            {
                return;
            }

            // MapHeader
            Console.WriteLine("Reading map header...");
            if (!ReadMPHD())
            {
                return;
            }

            // Map tile table. Needs to contain 64x64 = 4096 entries of sizeof(SMAreaInfo)
            Console.WriteLine("Reading MAIN section...");
            if (!ReadMAIN())
            {
                return;
            }

            // Filenames Doodads. Zero-terminated strings with complete paths to models.
            Console.WriteLine("Reading Doodads file names...");
            if (!ReadMDNM())
            {
                return;
            }

            // Filenames WMOS. Zero-terminated strings with complete paths to models.
            Console.WriteLine("Reading WMOS file names...");
            if (!ReadMONM())
            {
                return;
            }

            // Only one instance is possible. It is usually used by WMO based maps which contain no ADT parts with the exception of RazorfenDowns.
            // If this chunk exists, the client marks the map as a dungeon and uses absolute positioning for lights.
            Console.WriteLine("Reading MODF section...");
            if (!ReadMODF())
            {
                return;
            }

            // The start of what is now the ADT files.
            Console.WriteLine($"Reading {SMAreaChunks.Length} Area chunks...");
            if (!LoadMapAreaChunks())
            {
                return;
            }

            Console.WriteLine();
            Console.WriteLine($"Map information:");
            Console.WriteLine($"ADT Version: {ADTVersion}");
            Console.Write(SMOHeader.ToString());
            Console.WriteLine($"DoodadsNames: {DoodadsNames.Count}");
            Console.WriteLine($"MapObjectsNames: {MapObjectsNames.Count}");
            Console.WriteLine($"SMAreaChunks: {SMAreaChunks.Length}");
            Console.WriteLine($"MapAreaChunks: {MapAreaChunks.Count}");

            Console.WriteLine();
            Console.WriteLine("Found data for the following Areas:");
            foreach (var area in GetUniqueAreaIDs())
            {
                if (DBCStorage.TryGetByAreaNumber(area, out AreaTable table))
                {
                    Console.WriteLine($" AreaNumber: {table.AreaNumber}\tAreaName: {table.AreaName_enUS}");
                }
                else
                {
                    Console.WriteLine($" No information found for Area id: {area}");
                }
            }


            Console.WriteLine("Map loading complete.");
            OnRead -= OnBinaryRead;
            Worker  = null;
        }
示例#2
0
        public void LoadData()
        {
            Logger.Notice($"Processing map: {Name} ContinentID: {DBCMap.ID} IsInstance: {DBCMap.IsInMap != 1}");

            // File version, must be 18.
            if (Globals.Verbose)
            {
                Logger.Info("Reading file version...");
            }
            if (!ReadMVER())
            {
                return;
            }

            // MapHeader
            if (Globals.Verbose)
            {
                Logger.Info("Reading map header...");
            }
            if (!ReadMPHD())
            {
                return;
            }

            // Map tile table. Needs to contain 64x64 = 4096 entries of sizeof(SMAreaInfo)
            if (Globals.Verbose)
            {
                Logger.Info("Reading MAIN section...");
            }
            if (!ReadMAIN())
            {
                return;
            }

            // Filenames Doodads. Zero-terminated strings with complete paths to models.
            if (Globals.Verbose)
            {
                Logger.Info("Reading Doodads file names...");
            }
            if (!ReadMDNM())
            {
                return;
            }

            // Filenames WMOS. Zero-terminated strings with complete paths to models.
            if (Globals.Verbose)
            {
                Logger.Info("Reading WMOS file names...");
            }
            if (!ReadMONM())
            {
                return;
            }

            // Only one instance is possible. It is usually used by WMO based maps which contain no ADT parts with the exception of RazorfenDowns.
            // If this chunk exists, the client marks the map as a dungeon and uses absolute positioning for lights.
            if (Globals.Verbose)
            {
                Logger.Info("Reading MODF section...");
            }
            if (!ReadMODF())
            {
                return;
            }

            // The start of what is now the ADT files.
            if (Globals.Verbose)
            {
                Logger.Info($"Reading {TileBlocksInformation.Length} TileBlocks information...");
            }
            if (!LoadMapAreaChunks())
            {
                return;
            }

            if (Globals.Verbose)
            {
                Console.WriteLine();
                Logger.Notice($"Map information:");
                Logger.Info($"ADT Version: {ADTVersion}");
                Logger.Info(SMOHeader.ToString());
                Logger.Info($"DoodadsNames (.wdx): {DoodadsNames.Count}");
                Logger.Info($"MapObjectsNames (.wmo): {MapObjectsNames.Count}");
                Logger.Info($"Usable Tiles: {UsableTiles}");
                Logger.Info($"UnUsable Tiles: {UnUsableTiles}");
                PrintTileBlockInformation();
            }

            Logger.Success("Map information loaded successfully.");
        }