Пример #1
0
        public Foothold findBelow(Point p)
        {
            int             num;
            Foothold        foothold;
            List <Foothold> footholds = new List <Foothold>();

            foreach (Foothold foothold1 in this.footholds)
            {
                footholds.Add(foothold1);
            }
            List <Foothold> footholds1 = new List <Foothold>();

            foreach (Foothold foothold2 in footholds)
            {
                if (foothold2.getX1() > p.X || foothold2.getX2() < p.X)
                {
                    continue;
                }
                footholds1.Add(foothold2);
            }
            footholds1.Sort();
            List <Foothold> .Enumerator enumerator = footholds1.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Foothold current = enumerator.Current;
                    if (current.isWall() || current.getY1() == current.getY2())
                    {
                        if (current.isWall() || current.getY1() < p.Y)
                        {
                            continue;
                        }
                        foothold = current;
                        return(foothold);
                    }
                    else
                    {
                        double num1 = (double)Math.Abs(current.getY2() - current.getY1());
                        double num2 = (double)Math.Abs(current.getX2() - current.getX1());
                        double num3 = (double)Math.Abs(p.X - current.getX1());
                        double num4 = Math.Atan(num2 / num1);
                        double num5 = Math.Atan(num1 / num2);
                        double num6 = Math.Cos(num4) * num3 / Math.Cos(num5);
                        num = (current.getY2() >= current.getY1() ? current.getY1() + (int)num6 : current.getY1() - (int)num6);
                        if (num < p.Y)
                        {
                            continue;
                        }
                        foothold = current;
                        return(foothold);
                    }
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
        }
Пример #2
0
        public string getPermitXY(int UID)
        {
            Player user = getPlayer(UID);

            if (user != null)
            {
                if (isCoordFiltered(user.x, user.y, xLow, xHigh, yLow, yHigh))
                {
                    updateLog("[Filter] Spot filtered at " + user.x + "," + user.y);
                    return(null);
                }
                Foothold foothold = myCharacter.Map.footholds.findBelow(new Point(user.x, user.y));
                if (Program.whiteList)
                {
                    string contents = File.ReadAllText(Program.FMWhiteList);
                    if (contents.ToLower().Contains(user.ign.ToLower()))
                    {
                        return(null);
                    }
                }
                else
                {
                    string contents = File.ReadAllText(Program.FMBlackList);
                    if (contents.ToLower().Contains(user.ign.ToLower()))
                    {
                        return(string.Concat(user.x, ",", foothold.getY1(), ",", foothold.getId()));
                    }
                    return(null);
                }
                return(string.Concat(user.x, ",", foothold.getY1(), ",", foothold.getId()));
            }
            return(null);
        }
Пример #3
0
 private void MiniMap_MouseClick(object sender, MouseEventArgs e)
 {
     try
     {
         double num  = 0;
         double num1 = 0;
         xclick = (short)e.X;
         yclick = (short)e.Y;
         num    = (xclick < 1 ? 50 : (double)xclick / (double)mmi.canvas.Width);
         double num2 = num;
         num1 = (yclick < 1 ? 50 : (double)yclick / (double)mmi.canvas.Height);
         double num3 = num1;
         int    num4 = (int)(num2 * (double)mmi.width);
         int    num5 = (int)(num3 * (double)mmi.height);
         finalx = mmi.centerX * -1 + num4;
         finaly = mmi.centerY * -1 + num5;
         Foothold foothold = Database.loadMap(mmi.id).footholds.findBelow(new Point(finalx, finaly));
         if (foothold == null)
         {
             MessageBox.Show("Pick a spawnpoint with a foothold below it.");
             return;
         }
         else
         {
             Clipboard.SetText(finalx.ToString() + "," + finaly.ToString());
             MessageBox.Show("Copied to following coords to clipboard:\n" + finalx.ToString() + "," + finaly.ToString());
             return;
         }
     }
     catch
     {
     }
 }
Пример #4
0
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            double num;
            double num1;

            xclick = (short)e.X;
            yclick = (short)e.Y;
            num    = (xclick < 1 ? 50 : (double)xclick / (double)mmi.canvas.Width);
            double num2 = num;

            num1 = (yclick < 1 ? 50 : (double)yclick / (double)mmi.canvas.Height);
            double num3 = num1;
            int    num4 = (int)(num2 * (double)mmi.width);
            int    num5 = (int)(num3 * (double)mmi.height);

            finalx = mmi.centerX * -1 + num4;
            finaly = mmi.centerY * -1 + num5;
            toolStripLabelX.Text = "X: " + finalx.ToString();
            toolStripLabelY.Text = "Y: " + finaly.ToString();
            Foothold foothold = Database.loadMap(mmi.id).footholds.findBelow(new Point(finalx, finaly));

            if (foothold == null)
            {
                pictureBox.Refresh();
                SolidBrush solidBrush = new SolidBrush(Color.White);
                Graphics   graphic    = pictureBox.CreateGraphics();
                graphic.FillRectangle(solidBrush, new Rectangle(e.X - 3, e.Y - 3, 7, 7));
                solidBrush.Dispose();
                graphic.Dispose();
                return;
            }
            else
            {
                double width = (double)(finalx - mmi.centerX * -1);
                width = width / (double)mmi.width;
                width = width * (double)mmi.canvas.Width;
                double y1 = (double)(foothold.getY1() - mmi.centerY * -1);
                y1 = y1 / (double)mmi.height;
                y1 = y1 * (double)mmi.canvas.Height;
                pictureBox.Refresh();
                SolidBrush solidBrush1 = new SolidBrush(Color.Pink);
                Graphics   graphic1    = pictureBox.CreateGraphics();
                graphic1.FillRectangle(solidBrush1, new Rectangle((int)width - 3, (int)y1 - 3, 7, 6));
                solidBrush1.Dispose();
                graphic1.Dispose();
                return;
            }
        }
Пример #5
0
        public int CompareTo(object othera)
        {
            Foothold foothold = (Foothold)othera;

            if (this.p2.Y >= foothold.getY1())
            {
                if (this.p1.Y <= foothold.getY2())
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }
            else
            {
                return(-1);
            }
        }
Пример #6
0
 public void Insert(Foothold f)
 {
     this.footholds.Add(f);
 }
Пример #7
0
        public string getStoreXY(int UID)
        {
            MapleFMShop shop = mapleFMShopCollection.getPlayerShop(UID, false);

            if (shop != null)
            {
                if (clientMode != ClientMode.SHOPRESET)
                {
                    if (isCoordFiltered(shop.x, shop.y, xLow, xHigh, yLow, yHigh))
                    {
                        updateLog("[Filter] Spot filtered at " + shop.x + "," + shop.y);
                        return(null);
                    }
                }
                Foothold foothold = myCharacter.Map.footholds.findBelow(new Point(shop.x, shop.y));
                if (clientMode == ClientMode.SHOPRESET)
                {
                    return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId()));
                }
                if (Program.whiteList)
                {
                    string contents = File.ReadAllText(Program.FMWhiteList);
                    if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(shop.owner.ToLower()))
                    {
                        return(null);
                    }
                }
                else
                {
                    string contents = File.ReadAllText(Program.FMBlackList);
                    if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(shop.owner.ToLower()))
                    {
                        return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId()));
                    }
                    return(null);
                }
                return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId()));
            }
            else
            {
                updateLog("[Error] Could not find your store!");
                updateLog("[Error] Is your char in the right FM room?");
                forceDisconnect(false, 0, false, "Character not in right FM room?");
                return(null);
            }

            /*
             * List<KeyValuePair<int, MapleFMShop>>.Enumerator enumerator = mapleFMShopCollection.shops.ToList<KeyValuePair<int, MapleFMShop>>().GetEnumerator();
             * try
             * {
             *  while (enumerator.MoveNext())
             *  {
             *      KeyValuePair<int, MapleFMShop> current = enumerator.Current;
             *      if (current.Value.playerUID == UID)
             *      {
             *          Foothold foothold = myCharacter.Map.footholds.findBelow(new Point(current.Value.x, current.Value.y));
             *          if (clientMode == ClientMode.SHOPRESET)
             *              return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId());
             *          if (Program.whiteList)
             *          {
             *              string contents = File.ReadAllText(Program.FMWhiteList);
             *              if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(current.Value.owner.ToLower()))
             *              {
             *                  return null;
             *              }
             *          }
             *          else
             *          {
             *              string contents = File.ReadAllText(Program.FMBlackList);
             *              if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(current.Value.owner.ToLower()))
             *              {
             *                  return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId());
             *              }
             *              return null;
             *          }
             *          return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId());
             *      }
             *  }
             *  updateLog("[Error] Could not find your store!");
             *  updateLog("[Error] Is your char in the right FM room?");
             *  forceDisconnect(false, 0, false);
             *  return null;
             * }
             * finally
             * {
             *  ((IDisposable)enumerator).Dispose();
             * }
             * return null;
             */
        }