Пример #1
0
        public void DrawPoint(Graphics g, SMobPoint p, int markedCount, bool marked, bool ShowName)
        {
            int imgIndex = p.RuleLevelToIndex(this);

            p.Marked = marked;
            if (Properties.Settings.Default.MarkedStandAlone == true && markedCount > 0 && p.Marked == false)
            {
                return;
            }

            g.DrawImage(SMobPoints.MobImages[imgIndex], p.RectX, p.RectY, SMobPoint.ImageSize, SMobPoint.ImageSize);
            if (p.Marked == true && !Properties.Settings.Default.MarkedStandAlone)
            {
                g.DrawImage(p.Gif.GetNextFrame(), p.RectX - SMobPoint.MarkedDiffSize, p.RectY - SMobPoint.MarkedDiffSize, SMobPoint.MarkedImageSize, SMobPoint.MarkedImageSize);
            }
            // Boss Overlay
            if (p.IsBoss == true)
            {
                g.DrawImage(Properties.Resources.MobBoss, p.RectX - SMobPoint.BossDiffSize, p.RectY - SMobPoint.BossDiffSize, SMobPoint.BossImageSize, SMobPoint.BossImageSize);
            }

            if (ShowName == false)
            {
                return;
            }

            // Point.X & .Y build's the Image Center, RectX & RectY the Top-Left Corner
            Font  drawFont = new Font("Tahoma", 8f);
            SizeF nameSize = g.MeasureString(p.Name, drawFont);
            Point drawAt   = new Point(p.RectX + (SMobPoint.ImageSize / 2) - (int)(nameSize.Width / 2), p.RectY - (int)nameSize.Height);

            g.DrawString(p.Name, drawFont, Brushes.White, drawAt.X + 1, drawAt.Y + 1);
            g.DrawString(p.Name, drawFont, Brushes.Black, drawAt);
        }
Пример #2
0
        private void ListView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            if (e.ColumnIndex != 2)
            {
                e.DrawDefault = true;
                return;
            }

            int       pIndex = (int)e.Item.Tag;
            SMobPoint p      = Points[pIndex] as SMobPoint;

            if (p.Element == EMobElement.Unbekannt)
            {
                e.DrawDefault = true;
                return;
            }

            if (ListView.SelectedIndices.Contains(e.ItemIndex))
            {
                e.Graphics.FillRectangle(Brushes.RoyalBlue, e.Bounds);
            }
            using (Image img = p.Element.ToImage()) {
                e.Graphics.DrawImage(img, new Rectangle(e.Bounds.X + (e.Bounds.Width / 2) - img.Width / 2, e.Bounds.Y + (e.Bounds.Height / 2) - img.Height / 2, img.Width, img.Height));
            }
        }
Пример #3
0
        public bool SelectPoint(SMobPoint p, bool Clear)
        {
            if (Clear == true)
            {
                listMobPoints.SelectedIndices.Clear();
                mMarkedMobs.Clear();
                MonsterMap.Invalidate();
            }

            for (int i = 0; i < mFactory.Points.Count; i++)
            {
                if (mFactory[i].Equals(p) == true)
                {
                    mMarkedMobs.Add(i);

                    for (int j = 0; j < listMobPoints.Items.Count; j++)
                    {
                        if (int.Parse(listMobPoints.Items[j].Tag.ToString()) == i)
                        {
                            listMobPoints.SelectedIndices.Add(j);
                            break;
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
		public override void MapImage_MouseClick( object sender, MouseEventArgs e ) {
			if( MapControl.CanEdit == false )
				return;

			int i = InRange( e.X, e.Y );
			if( i == -1 && e.Button != MouseButtons.Left )
				return;

			// remove a Point
			if( e.Button == MouseButtons.Right ) {
				if( RemovePoint != null )
					RemovePoint( i );
				return;
			}

			// edit a Point
			if( e.Button == MouseButtons.Middle ) {
				mToolTip.Active = false;
				if( EditPoint != null )
					EditPoint( i, Factory[ i ].X, Factory[ i ].Y );

				return;
			}

			// add a Point
			frmMobPoint frm = new frmMobPoint( "hinzufügen..." );
			if( frm.ShowDialog() != DialogResult.OK )
				return;

			Factory.AddToList( SMobPoint.FromForm( e.X, e.Y, frm ) );

			this.Invalidate();
		}
Пример #5
0
        public override void AddToList(IPoint Point)
        {
            SMobPoint p = Point as SMobPoint;
            int       i = Points.Count;

            Points.Add(p);

            if (ListView == null)
            {
                return;
            }

            ListView.Items.Add(FactoryMobPoint.BuildListItem(this, i, p));
        }
Пример #6
0
        public void LoadList(string Mapname)
        {
            ClearList();

            Points        = new SMobPoints(Mapname.ToEMap());
            ActiveMapRule = SMobMapRule.GetRule(Points.Map);
            ResultTable table = Mysql.Query("SELECT * FROM `shaiya_mob_db` WHERE mapname = '" + Mapname + "'");

            if (table.Rows.Count == 0)
            {
                return;
            }

            if (ListView != null)
            {
                ListView.BeginUpdate();
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                ResultRow row = table.Rows[i];
                SMobPoint p   = new SMobPoint();
                p.ID       = row["id"].GetInt();
                p.X        = row["pos_x"].GetInt();
                p.Y        = row["pos_y"].GetInt();
                p.Name     = row["name"].GetString();
                p.Level    = row["level"].GetString();
                p.Anzahl   = row["anzahl"].GetString();
                p.Element  = row["element"].GetEnum <EMobElement>();
                p.IsBoss   = row["boss"].GetInt() == 1;
                p.InfoDesc = row["info"].GetString();

                if (p.Anzahl.IndexOf("Boss") != -1)
                {
                    p.IsBoss = true;
                }

                AddToList(p);
            }
            if (ListView != null)
            {
                ListView.EndUpdate();
            }
        }
Пример #7
0
        public void EditMobPoint(int i, int x, int y)
        {
            frmMobPoint frm = new frmMobPoint("bearbeiten...");

            SMobPoint p = mFactory[i] as SMobPoint;

            frm.txtName.Text            = p.Name;
            frm.txtLevel.Text           = p.Level;
            frm.cbCount.Text            = p.Anzahl;
            frm.cbElement.SelectedIndex = (int)p.Element;
            frm.chkBoss.Checked         = p.IsBoss;
            frm.txtInfo.Text            = p.InfoDesc;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            p.Changed  = true;
            p.Name     = frm.txtName.Text;
            p.Level    = frm.txtLevel.Text;
            p.Anzahl   = frm.cbCount.Text;
            p.Element  = (EMobElement)frm.cbElement.SelectedIndex;
            p.IsBoss   = frm.chkBoss.Checked;
            p.InfoDesc = frm.txtInfo.Text;

            for (int j = 0; j < listMobPoints.Items.Count; j++)
            {
                if (int.Parse(listMobPoints.Items[j].Tag.ToString()) == i)
                {
                    listMobPoints.Items[j] = FactoryMobPoint.BuildListItem(mFactory, i, p);
                    break;
                }
            }

            MonsterMap.Invalidate();
        }
Пример #8
0
        public static ListViewItem BuildListItem(FactoryMobPoint mobFac, int PointNum, SMobPoint p)
        {
            ListViewItem item = new ListViewItem(new string[] { p.Name, p.Level, p.Element.ToName(true), p.Anzahl });

            item.Tag         = PointNum;
            item.ToolTipText = string.Format("{0} ({1}) | {2} [{3}]", p.Name, p.Level, p.Element, p.Anzahl);
            item.ImageIndex  = p.RuleLevelToIndex(mobFac);

            return(item);
        }
Пример #9
0
 private bool PointExists(SMobPoint p)
 {
     return(Mysql.QueryCount("SELECT COUNT(id) AS count FROM `shaiya_mob_db` WHERE name = '{0}' AND mapname = '{1}' AND pos_x = {2} AND pos_y = {3}", p.Name.MysqlEscape(), Points.Map.ToName().MysqlEscape(), p.RectX, p.RectY) > 0);
 }
Пример #10
0
        public override SizeF DrawTooltip( Graphics g, Font Font, bool DrawIt )
        {
            SizeF tmpSize = g.MeasureString( "A", Font );
            Font fontBase = new Font( Font, FontStyle.Regular );
            Font fontBold = new Font( Font, FontStyle.Bold );
            SMobPoint p = InfoPoint as SMobPoint;

            string drawText = string.Empty;
            Size letterSize = new Size( (int)tmpSize.Width, (int)tmpSize.Height );
            int startX = 2;
            float x = startX, maxX = 0;
            float y = startX;

            x = startX;

            // Bossinfo
            if( p.IsBoss == true ) {
                x += DrawText( g, fontBold, ForeColor, x, y, "-{ Boss Monster }-", DrawIt );
                maxX = Math.Max( x, maxX );
                y += letterSize.Height;
                x = startX;
            }

            // Name
            x += DrawText( g, fontBold, ForeColor, x, y, "Name", DrawIt );
            // : X
            x += DrawText( g, fontBase, ForeColor, x, y, ": " + p.Name, DrawIt );
            maxX = Math.Max( x, maxX );
            y += letterSize.Height;
            x = startX;

            // Level
            x += DrawText( g, fontBold, ForeColor, x, y, "Level", DrawIt );
            // : X
            x += DrawText( g, fontBase, ForeColor, x, y, ": " + p.Level, DrawIt );
            maxX = Math.Max( x, maxX );
            y += letterSize.Height;
            x = startX;

            // Anzahl
            x += DrawText( g, fontBold, ForeColor, x, y, "Anzahl", DrawIt );
            // : X
            x += DrawText( g, fontBase, ForeColor, x, y, ": " + p.Anzahl, DrawIt );
            maxX = Math.Max( x, maxX );
            y += letterSize.Height;
            x = startX;

            // Element
            x += DrawText( g, fontBold, ForeColor, x, y, "Element", DrawIt );
            // : [to avoid colored :]
            x += DrawText( g, fontBase, ForeColor, x, y, ": ", DrawIt );
            // X
            x += DrawText( g, fontBase, p.Element.ToColor( true ), x, y, p.Element.ToString() + " ", DrawIt );
            if( p.Element != EMobElement.Unbekannt ){
                g.DrawImage( p.Element.ToImage(), new Rectangle( (int)x, (int)y, letterSize.Height, letterSize.Height ) );
                x += p.Element.ToImage().Width;
            }
            maxX = Math.Max( x, maxX );
            y += letterSize.Height;
            x = startX;

            // MobInfo
            if( p.InfoDesc != string.Empty ) {
                x += DrawText( g, fontBold, ForeColor, x, y, "MobInfo", DrawIt );
                // : X
                x += DrawText( g, fontBase, ForeColor, x, y, ": " + p.InfoDesc, DrawIt );
                maxX = Math.Max( x, maxX );
                y += letterSize.Height;
            }

            return new SizeF( maxX, y );
        }