示例#1
0
文件: Map.cs 项目: stephenZh/l2net
		protected void DrawGameInner()
		{
            if (LoadTextures)
            {
                try
                {
                    LoadTexturesInternal();
                }
                catch
                {
#if DEBUG
                    Globals.l2net_home.Add_OnlyDebug("failed to load textures internal");
#endif
                }
            }

            my_target = Globals.gamedata.my_char.TargetID;

            my_z = Globals.gamedata.my_char.Z;
            zrange_draw = Math.Abs((float)Util.GetInt32(Globals.l2net_home.textBox_zrange_map.Text));

            //xc = 16384;
            //yc = 16384;
            xc = Util.Float_Int32(Globals.gamedata.my_char.X);// +Util.GetInt32(Globals.l2net_home.textBox_offset_x.Text);
            yc = Util.Float_Int32(Globals.gamedata.my_char.Y);// +Util.GetInt32(Globals.l2net_home.textBox_offset_y.Text);
            zc = Util.Float_Int32(Globals.gamedata.my_char.Z);

            xm = this.Width / 2;//ClientSize
            ym = this.Height / 2;//ClientSize

			scale = MapThread.GetZoom();

			//need to fix these copy things, its the same values being referenced...
			//we need to make copies, not references
			tmp_path.Clear();
			tmp_walls.Clear();
			cache_draw.Clear();

            try
            {
                if (Globals.gamedata.my_pet.ID != 0)
                {
                    ddt = new DrawData();
                    ddt.ID = Globals.gamedata.my_pet.ID;
                    ddt.X = Util.Float_Int32(Globals.gamedata.my_pet.X);
                    ddt.Y = Util.Float_Int32(Globals.gamedata.my_pet.Y);
                    ddt.Radius = Globals.gamedata.my_pet.CollisionRadius;
                    if (Globals.ShowNamesPcs)
                    {
                        ddt.Text = Globals.gamedata.my_pet.Name;
                    }
                    else
                    {
                        ddt.Text = "";
                    }

                    ddt.Color1 = 5;

                    if (Globals.gamedata.my_pet.Karma > 0)
                        ddt.Color2 = 0;
                    else if (Globals.gamedata.my_pet.PvPFlag == 1)
                        ddt.Color2 = 1;
                    else if (Globals.gamedata.my_pet.PvPFlag == 2)
                        ddt.Color2 = 2;
                    else
                        ddt.Color2 = 3;

                    cache_draw.Add(ddt);
                }
                if (Globals.gamedata.my_pet1.ID != 0)
                {
                    ddt = new DrawData();
                    ddt.ID = Globals.gamedata.my_pet1.ID;
                    ddt.X = Util.Float_Int32(Globals.gamedata.my_pet1.X);
                    ddt.Y = Util.Float_Int32(Globals.gamedata.my_pet1.Y);
                    ddt.Radius = Globals.gamedata.my_pet1.CollisionRadius;
                    if (Globals.ShowNamesPcs)
                    {
                        ddt.Text = Globals.gamedata.my_pet1.Name;
                    }
                    else
                    {
                        ddt.Text = "";
                    }

                    ddt.Color1 = 5;

                    if (Globals.gamedata.my_pet1.Karma > 0)
                        ddt.Color2 = 0;
                    else if (Globals.gamedata.my_pet1.PvPFlag == 1)
                        ddt.Color2 = 1;
                    else if (Globals.gamedata.my_pet1.PvPFlag == 2)
                        ddt.Color2 = 2;
                    else
                        ddt.Color2 = 3;

                    cache_draw.Add(ddt);
                }
                if (Globals.gamedata.my_pet2.ID != 0)
                {
                    ddt = new DrawData();
                    ddt.ID = Globals.gamedata.my_pet2.ID;
                    ddt.X = Util.Float_Int32(Globals.gamedata.my_pet2.X);
                    ddt.Y = Util.Float_Int32(Globals.gamedata.my_pet2.Y);
                    ddt.Radius = Globals.gamedata.my_pet2.CollisionRadius;
                    if (Globals.ShowNamesPcs)
                    {
                        ddt.Text = Globals.gamedata.my_pet2.Name;
                    }
                    else
                    {
                        ddt.Text = "";
                    }

                    ddt.Color1 = 5;

                    if (Globals.gamedata.my_pet2.Karma > 0)
                        ddt.Color2 = 0;
                    else if (Globals.gamedata.my_pet2.PvPFlag == 1)
                        ddt.Color2 = 1;
                    else if (Globals.gamedata.my_pet2.PvPFlag == 2)
                        ddt.Color2 = 2;
                    else
                        ddt.Color2 = 3;

                    cache_draw.Add(ddt);
                }
                if (Globals.gamedata.my_pet3.ID != 0)
                {
                    ddt = new DrawData();
                    ddt.ID = Globals.gamedata.my_pet3.ID;
                    ddt.X = Util.Float_Int32(Globals.gamedata.my_pet3.X);
                    ddt.Y = Util.Float_Int32(Globals.gamedata.my_pet3.Y);
                    ddt.Radius = Globals.gamedata.my_pet3.CollisionRadius;
                    if (Globals.ShowNamesPcs)
                    {
                        ddt.Text = Globals.gamedata.my_pet3.Name;
                    }
                    else
                    {
                        ddt.Text = "";
                    }

                    ddt.Color1 = 5;

                    if (Globals.gamedata.my_pet3.Karma > 0)
                        ddt.Color2 = 0;
                    else if (Globals.gamedata.my_pet3.PvPFlag == 1)
                        ddt.Color2 = 1;
                    else if (Globals.gamedata.my_pet3.PvPFlag == 2)
                        ddt.Color2 = 2;
                    else
                        ddt.Color2 = 3;

                    cache_draw.Add(ddt);
                }
            }
            catch
            {
#if DEBUG
                Globals.l2net_home.Add_OnlyDebug("failed to cache pet internal");
#endif
            }

            try
            {
                SortedList tmp_party = new SortedList();
                if (Globals.PartyLock.TryEnterReadLock(Globals.THREAD_WAIT_DX))
                {
                    try
                    {
                        foreach (uint key in Globals.gamedata.PartyMembers.Keys)
                        {
                            tmp_party.Add(key, key);
                        }
                    }
                    finally
                    {
                        Globals.PartyLock.ExitReadLock();
                    }
                }

                if (Globals.PlayerLock.TryEnterReadLock(Globals.THREAD_WAIT_DX))
                {
                    try
                    {
                        foreach (CharInfo player in Globals.gamedata.nearby_chars.Values)
                        {
                            if (Math.Abs(player.Z - my_z) <= zrange_draw)
                            {
                                ddt = new DrawData();
                                ddt.ID = player.ID;
                                ddt.X = Util.Float_Int32(player.X);
                                ddt.Y = Util.Float_Int32(player.Y);
                                ddt.Radius = player.CollisionRadius;
                                if (Globals.ShowNamesPcs)
                                {
                                    ddt.Text = player.Name;
                                }
                                else
                                {
                                    ddt.Text = "";
                                }

                                if (tmp_party.ContainsKey(player.ID))
                                {
                                    ddt.Color1 = 5;
                                }
                                else
                                {
                                    ddt.Color1 = 2;
                                }

                                if ((player.Karma > 0) && (Globals.gamedata.Chron <= Chronicle.CT2_6))
                                    ddt.Color2 = 0;
                                else if ((player.Karma < 0) && (Globals.gamedata.Chron >= Chronicle.CT3_0))
                                    ddt.Color2 = 0;
                                else if (player.PvPFlag == 1)
                                    ddt.Color2 = 1;
                                else if (player.PvPFlag == 2)
                                    ddt.Color2 = 2;
                                else
                                    ddt.Color2 = 3;

                                cache_draw.Add(ddt);
                            }
                        }
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitReadLock();
                    }
                }
            }
            catch
            {
                //busted getting the lock... oh well
#if DEBUG
                Globals.l2net_home.Add_OnlyDebug("failed to lock on players for minimap caching");
#endif
            }

            try
            {
                if(Globals.NPCLock.TryEnterReadLock(Globals.THREAD_WAIT_DX))
                {
                    try
                    {
                        foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values)
                        {
                            if (Math.Abs(npc.Z - my_z) <= zrange_draw && npc.isInvisible != 1 ) //if == 1, the mob shouldn't show up.
                            {
                                ddt = new DrawData();
                                ddt.ID = npc.ID;
                                ddt.X = Util.Float_Int32(npc.X);
                                ddt.Y = Util.Float_Int32(npc.Y);
                                ddt.Radius = npc.CollisionRadius;
                                if (Globals.ShowNamesNpcs)
                                {
                                    ddt.Text = Util.GetNPCName(npc.NPCID);
                                }
                                else
                                {
                                    ddt.Text = "";
                                }
                                if (npc.isAttackable == 0)
                                {
                                    ddt.Color1 = 3;
                                }
                                else
                                {
                                    ddt.Color1 = 0;
                                }
                                //#if DEBUG
                                //		if( Globals.gamedata.Paths.IsPointInside( ddt.X, ddt.Y) )
                                //			ddt.Color2 = 0;
                                //		else
                                //#endif
                                ddt.Color2 = 3;
                                cache_draw.Add(ddt);
                            }
                        }
                    }
                    finally
                    {
                        Globals.NPCLock.ExitReadLock();
                    }
                }
            }
            catch
            {
                //busted getting the lock... oh well
#if DEBUG
                Globals.l2net_home.Add_OnlyDebug("failed to lock on npcs for minimap caching");
#endif
            }

            try
            {
                if (Globals.ItemLock.TryEnterReadLock(Globals.THREAD_WAIT_DX))
                {
                    try
                    {
                        foreach (ItemInfo item in Globals.gamedata.nearby_items.Values)
                        {
                            if (Math.Abs(item.Z - my_z) <= zrange_draw)
                            {
                                ddt = new DrawData();
                                ddt.ID = item.ID;
                                ddt.X = Util.Float_Int32(item.X);
                                ddt.Y = Util.Float_Int32(item.Y);
                                ddt.Radius = item.DropRadius;
                                if (Globals.ShowNamesItems)
                                {
                                    ddt.Text = Util.GetItemName(item.ItemID);
                                }
                                else
                                {
                                    ddt.Text = "";
                                }
                                ddt.Color1 = 1;
                                ddt.Color2 = 3;
                                cache_draw.Add(ddt);
                            }
                        }
                    }
                    finally
                    {
                        Globals.ItemLock.ExitReadLock();
                    }
                }
            }
            catch
            {
                //busted getting the lock... oh well
#if DEBUG
                Globals.l2net_home.Add_OnlyDebug("failed to lock on items for minimap caching");
#endif
            }

			try
			{
				if(Globals.l2net_home.checkBox_minimap.Checked)// && miniMap != null)
				{
                    //0,0,0 = 20_18
                    int x_block = (int)((Globals.gamedata.my_char.X + Globals.ModX) / Globals.UNITS);
                    int y_block = (int)((Globals.gamedata.my_char.Y + Globals.ModY) / Globals.UNITS);
                    int z_diff = (int)Math.Abs(Globals.gamedata.my_char.Z - last_MAPZ);

                    if (x_block != last_MAPX || y_block != last_MAPY || z_diff >= Globals.ZRANGE_DIFF)
                    {
                        last_MAPX = x_block;
                        last_MAPY = y_block;
                        last_MAPZ = (int)Globals.gamedata.my_char.Z;

                        switch(Globals.ViewRange)
                        {
                            case 1:
                                LoadMapFile(last_MAPX, last_MAPY, last_MAPZ);
                                LoadMapFile(last_MAPX - 1, last_MAPY, last_MAPZ);
                                LoadMapFile(last_MAPX + 1, last_MAPY, last_MAPZ);
                                LoadMapFile(last_MAPX, last_MAPY - 1, last_MAPZ);
                                LoadMapFile(last_MAPX, last_MAPY + 1, last_MAPZ);
                                break;
                            case 2:
                                LoadMapFile(last_MAPX, last_MAPY, last_MAPZ);
                                LoadMapFile(last_MAPX - 1, last_MAPY, last_MAPZ);
                                LoadMapFile(last_MAPX + 1, last_MAPY, last_MAPZ);

                                LoadMapFile(last_MAPX, last_MAPY - 1, last_MAPZ);
                                LoadMapFile(last_MAPX - 1, last_MAPY - 1, last_MAPZ);
                                LoadMapFile(last_MAPX + 1, last_MAPY - 1, last_MAPZ);

                                LoadMapFile(last_MAPX, last_MAPY + 1, last_MAPZ);
                                LoadMapFile(last_MAPX - 1, last_MAPY + 1, last_MAPZ);
                                LoadMapFile(last_MAPX + 1, last_MAPY + 1, last_MAPZ);
                                break;
                            default:
                                LoadMapFile(last_MAPX, last_MAPY, last_MAPZ);
                                break;
                        }
                    }

                    //DrawMap
                    switch(Globals.ViewRange)
                    {
                        case 1:
                            DrawMap(last_MAPX, last_MAPY, last_MAPZ);
                            DrawMap(last_MAPX - 1, last_MAPY, last_MAPZ);
                            DrawMap(last_MAPX + 1, last_MAPY, last_MAPZ);
                            DrawMap(last_MAPX, last_MAPY - 1, last_MAPZ);
                            DrawMap(last_MAPX, last_MAPY + 1, last_MAPZ);
                            break;
                        case 2:
                            DrawMap(last_MAPX, last_MAPY, last_MAPZ);
                            DrawMap(last_MAPX - 1, last_MAPY, last_MAPZ);
                            DrawMap(last_MAPX + 1, last_MAPY, last_MAPZ);

                            DrawMap(last_MAPX, last_MAPY - 1, last_MAPZ);
                            DrawMap(last_MAPX - 1, last_MAPY - 1, last_MAPZ);
                            DrawMap(last_MAPX + 1, last_MAPY - 1, last_MAPZ);

                            DrawMap(last_MAPX, last_MAPY + 1, last_MAPZ);
                            DrawMap(last_MAPX - 1, last_MAPY + 1, last_MAPZ);
                            DrawMap(last_MAPX + 1, last_MAPY + 1, last_MAPZ);
                            break;
                        default:
                            DrawMap(last_MAPX, last_MAPY, last_MAPZ);
                            break;
                    }
                }
				else
				{
					//draw no map
				}

				//draw self
                if (my_target == Globals.gamedata.my_char.ID)
                {
                    DrawFilledBox(xm - 5, ym - 5, xm + 5, ym + 5, Color.Red);
                }
                else
                {
                    DrawBox(xm - 5, ym - 5, xm + 5, ym + 5, Color.Red);
                }
    		}
			catch
			{
				//failed to draw minimap or self
#if DEBUG
				Globals.l2net_home.Add_OnlyDebug("failed to draw minimap or self");
#endif
			}

            try
			{
			    //only care to draw it if we have 3 points, since that is the only time it becomes meaningful
			    if(Globals.gamedata.Paths.PointList.Count > 0)
			    {
				    //lets scale the points accordingly
				    for(int i = 0; i < Globals.gamedata.Paths.PointList.Count; i++)
				    {
					    Point npt = new Point();
					    npt.X = ((Point)Globals.gamedata.Paths.PointList[i]).X;
                        npt.X = GetScaledX(npt.X);//((npt.X - xc) / scale) + xm;

					    npt.Y = ((Point)Globals.gamedata.Paths.PointList[i]).Y;
                        npt.Y = GetScaledY(npt.Y);//((npt.Y - yc) / scale) + ym;

                        DrawBox((int)npt.X - 2, (int)npt.Y - 2, (int)npt.X + 2, (int)npt.Y + 2, Color.Black);

					    tmp_path.Add(npt);
				    }
                    if (Globals.gamedata.Paths.PointList.Count > 1)
                    {
                        //lets do that last points on the polygon
                        Point p1 = (Point)tmp_path[0];
                        Point p2 = (Point)tmp_path[tmp_path.Count - 1];
                        DrawLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y, Color.Black);

                        //now lets draw the lines
                        for (int pi = 1; pi < tmp_path.Count; pi++)
                        {
                            p1 = (Point)tmp_path[pi - 1];
                            p2 = (Point)tmp_path[pi];
                            DrawLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y, Color.Black);
                        }
                    }
			    }
			    //***************
			    //
			    //now lets draw our walls
			    for(int i = 0; i < Globals.gamedata.Walls.Count; i++)
			    {
				    Wall tmp_w = new Wall();
				    Point npt1 = new Point();
				    Point npt2 = new Point();
                    npt1.X = ((Wall)Globals.gamedata.Walls[i]).P1.X;
                    npt1.X = GetScaledX(npt1.X);//((npt1.X - xc) / scale) + xm;

                    npt1.Y = ((Wall)Globals.gamedata.Walls[i]).P1.Y;
                    npt1.Y = GetScaledY(npt1.Y);//((npt1.Y - yc) / scale) + ym;

                    npt2.X = ((Wall)Globals.gamedata.Walls[i]).P2.X;
                    npt2.X = GetScaledX(npt2.X);//((npt2.X - xc) / scale) + xm;

                    npt2.Y = ((Wall)Globals.gamedata.Walls[i]).P2.Y;
                    npt2.Y = GetScaledY(npt2.Y);//((npt2.Y - yc) / scale) + ym;

                    tmp_w.P1 = npt1; tmp_w.P2 = npt2;
				    tmp_walls.Add(tmp_w);
			    }
			    for(int pi = 0; pi < tmp_walls.Count; pi++)
			    {
				    Point p1 = ((Wall)tmp_walls[pi]).P1;
				    Point p2 = ((Wall)tmp_walls[pi]).P2;
                    DrawLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y, Color.MediumVioletRed);
			    }

                //drawing A* grid 
#if DEBUG
                if (Globals.debugPath != null)
                {
                    for (int i = 0; i < Globals.debugPath.Count; i++)
                    {
                        int drawX, drawY, drawX2, drawY2;
                        System.Drawing.Color tempPen;

                        tempPen = Color.White;

                        drawX = GetScaledX(((AstarNode)Globals.debugPath[i]).x);//(((((AstarNode)Globals.debugPath[i]).x - xc)) / scale) + xm;
                        drawY = GetScaledY(((AstarNode)Globals.debugPath[i]).y);//(((((AstarNode)Globals.debugPath[i]).y - yc)) / scale) + ym;
                        drawX2 = GetScaledX(((AstarNode)Globals.debugPath[i]).x2);//(((((AstarNode)Globals.debugPath[i]).x2 - xc)) / scale) + xm;
                        drawY2 = GetScaledY(((AstarNode)Globals.debugPath[i]).y2);//(((((AstarNode)Globals.debugPath[i]).y2 - yc)) / scale) + ym;

                        DrawLine(drawX, drawY, drawX, drawY2, tempPen);
                        DrawLine(drawX, drawY2, drawX2, drawY2, tempPen);
                        DrawLine(drawX2, drawY2, drawX2, drawY, tempPen);
                        DrawLine(drawX2, drawY, drawX, drawY, tempPen);
                    }
                }
                if (Globals.debugNode != null)
                {
                    int drawX, drawY, drawX2, drawY2;
                    System.Drawing.Color tempPen;

                    tempPen = Color.Gold;

                    drawX = GetScaledX(Globals.debugNode.x);//((Globals.debugNode.x - xc) / scale) + xm;
                    drawY = GetScaledY(Globals.debugNode.y);//((Globals.debugNode.y - yc) / scale) + ym;
                    drawX2 = GetScaledX(Globals.debugNode.x2);//((Globals.debugNode.x2 - xc) / scale) + xm;
                    drawY2 = GetScaledY(Globals.debugNode.y2);//((Globals.debugNode.y2 - yc) / scale) + ym;

                    DrawLine(drawX, drawY, drawX, drawY2, tempPen);
                    DrawLine(drawX, drawY2, drawX2, drawY2, tempPen);
                    DrawLine(drawX2, drawY2, drawX2, drawY, tempPen);                 
                    DrawLine(drawX2, drawY, drawX, drawY, tempPen);
                }
                if (Globals.debugNode2 != null)
                {
                    int drawX, drawY, drawX2, drawY2;
                    System.Drawing.Color tempPen;

                    tempPen = Color.Aquamarine;

                    drawX = GetScaledX(Globals.debugNode2.x);//((Globals.debugNode2.x - xc) / scale) + xm;
                    drawY = GetScaledY(Globals.debugNode2.y);//((Globals.debugNode2.y - yc) / scale) + ym;
                    drawX2 = GetScaledX(Globals.debugNode2.x);//((Globals.debugNode2.x2 - xc) / scale) + xm;
                    drawY2 = GetScaledY(Globals.debugNode2.y);//((Globals.debugNode2.y2 - yc) / scale) + ym;

                    DrawLine(drawX, drawY, drawX, drawY2, tempPen);
                    DrawLine(drawX, drawY2, drawX2, drawY2, tempPen);
                    DrawLine(drawX2, drawY2, drawX2, drawY, tempPen);
                    DrawLine(drawX2, drawY, drawX, drawY, tempPen);
                }
                if (Globals.debugNode3 != null)
                {
                    int drawX, drawY, drawX2, drawY2;
                    System.Drawing.Color tempPen;

                    tempPen = Color.SpringGreen;

                    drawX = GetScaledX(Globals.debugNode3.x);//((Globals.debugNode3.x - xc) / scale) + xm;
                    drawY = GetScaledY(Globals.debugNode3.y);//((Globals.debugNode3.y - yc) / scale) + ym;
                    drawX2 = GetScaledX(Globals.debugNode3.x);//((Globals.debugNode3.x2 - xc) / scale) + xm;
                    drawY2 = GetScaledY(Globals.debugNode3.y);//((Globals.debugNode3.y2 - yc) / scale) + ym;

                    DrawLine(drawX, drawY, drawX, drawY2, tempPen);
                    DrawLine(drawX, drawY2, drawX2, drawY2, tempPen);
                    DrawLine(drawX2, drawY2, drawX2, drawY, tempPen);
                    DrawLine(drawX2, drawY, drawX, drawY, tempPen);
                }

#endif
			}
#if DEBUG
            catch (Exception e)
			{
				//failed to draw path or walls
				Globals.l2net_home.Add_OnlyDebug("failed to draw paths of walls : " + e.Message);
            }
#else
            catch
			{
				//failed to draw path or walls
				Globals.l2net_home.Add_OnlyDebug("failed to draw paths of walls");
            }
#endif


            try
			{
                if (Globals.White_Names)
                {
                    text_color = Color.White;
                    //text_brush = WhiteBrush;
                    text_color_shadow = Color.Black;
                    //text_brush_shadow = BlackBrush;
                }
                else
                {
                    text_color = Color.Black;
                    //text_brush = BlackBrush;
                    text_color_shadow = Color.Gray;
                    //text_brush_shadow = WhiteBrush;
                }

				//draw all the text objects
				for(int i = 0; i < cache_draw.Count; i++)
				{
                    dx = GetScaledX(((DrawData)cache_draw[i]).X);//(int)((((DrawData)cache_draw[i]).X - xc) / scale) + xm;
                    dy = GetScaledY(((DrawData)cache_draw[i]).Y);//(int)((((DrawData)cache_draw[i]).Y - yc) / scale) + ym;
                    dr2 = (int)(((DrawData)cache_draw[i]).Radius / scale);
                    dr = (int)(((DrawData)cache_draw[i]).Radius / scale / 2);
                    if (dr2 < Globals.MIN_RADIUS)
                    {
                        dr2 = Globals.MIN_RADIUS;
                        dr = dr2 / 2;
                    }

					if( ((DrawData)cache_draw[i]).ID == my_target)
					{
						switch(((DrawData)cache_draw[i]).Color1)
						{
							case 0://black
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Black);
								break;
							case 1://yellow
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Yellow);
								break;
							case 2://blue
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Blue);
								break;
                            case 3://darkgreen
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.SkyBlue);
								break;
                            case 4://red
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Red);
                                break;
                            case 5://orangered
                                DrawFilledBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.OrangeRed);
                                break;
                        }
					}
					else
					{
						switch(((DrawData)cache_draw[i]).Color1)
						{
							case 0://black
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Black);
								break;
							case 1://yellow
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Yellow);
								break;
							case 2://blue
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Blue);
								break;
                            case 3://darkgreen
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.SkyBlue);
                                break;
                            case 4://red
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.Red);
                                break;
                            case 5://orangered
                                DrawBox(dx - dr, dy - dr, dx + dr, dy + dr, Color.OrangeRed);
                                break;
                        }
                    } 

                    if (((DrawData)cache_draw[i]).Text.Length > 0)
                    {
                        ddtext = ((DrawData)cache_draw[i]).Text;

                        switch (((DrawData)cache_draw[i]).Color2)
                        {
                            case 0://red
                                DrawText(ddtext, dx - wid_2, dy - hgt - 10, wid, hgt, Color.Red);
                                break;
                            case 1://purple
                                DrawText(ddtext, dx - wid_2, dy - hgt - 10, wid, hgt, Color.FromArgb(184, 0, 184));
                                break;
                            case 2://light purple
                                DrawText(ddtext, dx - wid_2, dy - hgt - 10, wid, hgt, Color.FromArgb(247, 0, 247));
                                break;
                            case 3://black
                                DrawText(ddtext, dx - wid_2 - 1, dy - hgt - 10 + 1, wid, hgt, text_color_shadow);
                                DrawText(ddtext, dx - wid_2, dy - hgt - 10, wid, hgt, text_color);
                                break;
                        }
                    }
				}
			}
			catch
			{
				//failed to draw items
				//dont really care to output text like this
#if DEBUG
				Globals.l2net_home.Add_OnlyDebug("failed to draw from cached players/npcs/items");
#endif
			}
        }
示例#2
0
        private void Script_ADD_WALL(string line)
        {
            string s_x1 = Get_String(ref line);
            string s_y1 = Get_String(ref line);
            string s_x2 = Get_String(ref line);
            string s_y2 = Get_String(ref line);

            int i_x1 = Util.GetInt32(s_x1);
            int i_y1 = Util.GetInt32(s_y1);
            int i_x2 = Util.GetInt32(s_x2);
            int i_y2 = Util.GetInt32(s_y2);

            Point npt1 = new Point();
            npt1.X = i_x1;
            npt1.Y = i_y1;
            npt1.Z = 0;

            Point npt2 = new Point();
            npt2.X = i_x2;
            npt2.Y = i_y2;
            npt2.Z = 0;

            Wall wall = new Wall();
            wall.P1 = npt1;
            wall.P2 = npt2;

            Globals.gamedata.Walls.Add(wall);
        }