Exemple #1
0
        private Zone[] LoadZones(int MapId, out RectangleF continentBounds)
        {
            var zones = new List <Zone>();

            continentBounds = RectangleF.Empty;

            // Look for zones matching this map ID in WorldMapArea database
            foreach (var worldMapAreaRecord in worldMapAreaDatabase.Records)
            {
                // Zone information stored as following
                //  In field 1: ID of the game map containing the zone
                //  In field 8: ID of the map virtually containing the zone (-1 if it is the same as field 1)

                if ((worldMapAreaRecord.VirtualMap == -1 && worldMapAreaRecord.Map == MapId) ||              // Either virtual ID is -1 and we have ID in field 1
                    worldMapAreaRecord.VirtualMap == MapId)                        // Or we have ID in field 8
                {
                    var bounds = new RectangleF(worldMapAreaRecord.BoxLeft, worldMapAreaRecord.BoxTop, worldMapAreaRecord.BoxRight - worldMapAreaRecord.BoxLeft, worldMapAreaRecord.BoxBottom - worldMapAreaRecord.BoxTop);

                    if (worldMapAreaRecord.Area == 0)                     // For continents
                    {
                        continentBounds = bounds;
                    }
                    else                     // Now look into AreaTable database
                    {
                        AreaTableRecord areaTableRecord;

                        if (areaTableDatabase.TryGetValue(worldMapAreaRecord.Area, out areaTableRecord))
                        {
#if DEBUG
                            System.Diagnostics.Debug.WriteLine("Bounds of \"" + areaTableRecord.Name + "\": " + bounds.ToString());
#endif
                            zones.Add
                            (
                                new Zone
                                (
                                    worldMapAreaRecord.Id,
                                    worldMapAreaRecord.Area,
                                    MapId,
                                    bounds,
                                    (ZoneFlags)worldMapAreaRecord.Flags,
                                    areaTableRecord.Name,
                                    worldMapAreaRecord.DataName,
                                    LoadOverlays(worldMapAreaRecord.Id)
                                )
                            );
                        }
                    }
                }
            }

            return(zones.ToArray());
        }
Exemple #2
0
        private void LoadContinents()
        {
            foreach (var worldMapContinentRecord in worldMapContinentDatabase.Records)
            {
                MapRecord mapRecord;

                if (mapDatabase.TryGetValue(worldMapContinentRecord.Map, out mapRecord))
                {
                    RectangleF bounds;
                    var        zones = LoadZones(worldMapContinentRecord.Map, out bounds);

                    Continent continent = new Continent
                                          (
                        worldMapContinentRecord.Id,
                        worldMapContinentRecord.Map,
                        bounds,
                        mapRecord.Name,
                        mapRecord.DataName,
                        zones,
                        LoadZoneMap(@"Interface\WorldMap\" + mapRecord.DataName + ".zmp")
                                          );

                    continents.Add(continent);
                }
            }
        }