ModifySelectedZoneWithBrush() public méthode

public ModifySelectedZoneWithBrush ( List Groups, List Locations, List Flags, bool add, int chance ) : bool
Groups List
Locations List
Flags List
add bool
chance int
Résultat bool
Exemple #1
0
        private void pctWorldMap_MouseMove(object sender, MouseEventArgs e)
        {
            int ZoneX = Display.PixelToZoneCoord(e.X);
            int ZoneY = Display.PixelToZoneCoord(e.Y);

            Point ZoneCoords = new Point(ZoneX, ZoneY);

            toolStripStatusLabelMouseCoords.Text = "| Coords: " + e.X.ToString() + ", " + e.Y.ToString();
            toolStripStatusLabelZoneCoords.Text  = "Zone: " + ZoneCoords.X.ToString() + ", " + ZoneCoords.Y.ToString();
            toolStripStatusLabelGameCoords.Text  = "Game Coords: " + Display.PixelToGameCoords(e.X).ToString() + ", " + Display.PixelToGameCoords(e.Y).ToString();

            if (AddLocation.Selected)
            {
                AddLocation.Loc.X          = Display.PixelToGameCoords(e.X);
                AddLocation.Loc.Y          = Display.PixelToGameCoords(e.Y);
                AddLocation.Loc.OnWorldmap = true;
                AddLocation.Loc.Modified   = true;
                pctWorldMap.Refresh();
            }

            if (Control.MouseButtons == MouseButtons.Left)
            {
                if (AnyBrushModeEnabled())
                {
                    worldmap.SetSelectedZone(ZoneX, ZoneY);
                }

                if (toolbtnClone.Checked)
                {
                    ReplaceSelectedZone(PaintZone, ICopyParams);
                    RefreshZoneProperties();
                }

                if (toolbtnErase.Checked)
                {
                    if (worldmap.ModifySelectedZoneWithBrush(BrushOptions.Groups, BrushOptions.Locations, BrushOptions.Flags, false, 0))
                    {
                        RefreshZoneProperties();
                    }
                }

                if (toolbtnBrush.Checked)
                {
                    int chance = 0;
                    if ((BrushOptions.OverwriteChance))
                    {
                        chance = BrushOptions.EncounterChance;
                    }
                    if (worldmap.ModifySelectedZoneWithBrush(BrushOptions.Groups, BrushOptions.Locations, BrushOptions.Flags, true, chance))
                    {
                        RefreshZoneProperties();
                    }
                }

                //if (AnyBrushModeEnabled())
                //    RefreshZoneProperties();
            }

            if (!Config.ShowTooltip || AddLocation.Selected)
            {
                return;
            }

            if (DrawToolTip)
            {
                int    x         = e.X + 15;
                int    y         = e.Y + 15;
                string str       = (string)LocationToolTip.Tag.ToString();
                int    strlength = str.Length;

                if ((Cursor.Position.X + (strlength * 4)) > Screen.PrimaryScreen.Bounds.Width)
                {
                    x -= ((Cursor.Position.X + (strlength * 4)) - Screen.PrimaryScreen.Bounds.Width);
                }
                if ((x != ToolTipLast.X) || (y != ToolTipLast.Y))
                {
                    LocationToolTip.Show((string)LocationToolTip.Tag, pctWorldMap, x, y, 100000);
                    ToolTipLast.X = x;
                    ToolTipLast.Y = y;
                }
            }

            MouseZoneLocation = ZoneCoords;

            if (worldmap == null)
            {
                return;
            }

            Location Loc = worldmap.GetLocation(Display.PixelToGameCoords(e.X), Display.PixelToGameCoords(e.Y));

            if (Loc != null && Loc.OnWorldmap)
            {
                LocationToolTip.Tag = Loc.Name + " (" + Loc.Pid + ")" + Environment.NewLine + Loc.WorldMapDescription
                                      + Environment.NewLine + (Loc.Visible ? "Visible: Yes" : "Visible: No");
                LocationToolTip.UseFading = true;
                DrawToolTip = true;
            }
            else
            {
                LocationToolTip.Hide(pctWorldMap);
                DrawToolTip = false;
                return;
            }
        }