//this generates an item from what is stored in the entry. Note no exception handling public override Item GenerateItem() { TreasureMap map = (TreasureMap)Activator.CreateInstance(_Type, new object[] { _Level, _ChestMap }); map.ChestLocation = _ChestLocation; //this is done to ensure the map gump displays properly map.Bounds = _Bounds; map.Decoder = _Decoder; //the map will have some bogus pin on it when it's first withdrawn. First, remove the bogus pin map.ClearPins(); //then add the proper pin map.AddWorldPin(_ChestLocation.X, _ChestLocation.Y); map.LootType = _LootType; map.Insured = _Insured; return(map); }
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); }