示例#1
0
        private TreasureMap Construct(TreasureMapEntry entry)
        {
            if (entry == null)
                return null;

            TreasureMap map = new TreasureMap();
            map.ChestLocation = new Point2D(entry.Location.X, entry.Location.Y);

            map.Level = entry.Level;
            map.Facet = entry.Map;

            map.Completed = entry.Completed;
            map.CompletedBy = entry.CompletedBy;
            map.Decoder = entry.Decoder;
            map.NextReset = entry.NextReset;

            map.Width = 300;
            map.Height = 300;
            int x = entry.Location.X;
            int y = entry.Location.Y;
            int width, height;
            Map facet = entry.Map;

            map.GetWidthAndHeight(facet, out width, out height);

            int x1 = x - Utility.RandomMinMax(width / 4, (width / 4) * 3);
            int y1 = y - Utility.RandomMinMax(height / 4, (height / 4) * 3);

            if (x1 < 0) x1 = 0;
            if (y1 < 0) y1 = 0;

            int x2, y2;

            map.AdjustMap(facet, out x2, out y2, x1, y1, width, height);

            x1 = x2 - width;
            y1 = y2 - height;

            map.Bounds = new Rectangle2D(x1, y1, width, height);
            map.Protected = true;

            map.AddWorldPin(x, y);

            return map;
        }