示例#1
0
        public bool CreateSellItem(int n, int at)
        {
            int row = 0;
            int col = 0;

            row = (int)Math.Floor((double)at / 4);
            row = row % 2;
            col = at % 4;

            if (n == 1)
            {
                touch.ClickAt(new Point(428 + 146 * col, 260 + 182 * row)); // click bua` hi vong se trung o
                Bot.BotApplication.Wait(100);
                if (touch.CheckPixel(1033, 131, Color.White, 10))           // if create sell form are show
                {
                    log.Info("Sell form are showed start selling at  [" + col + "," + row + "] ");
                    touch.ClickAt(new Point(325, 297));
                    Bot.BotApplication.Wait(100);
                    SetPriceAndQty();
                    Bot.BotApplication.Wait(200);
                }
                else
                {
                    // 808 116
                    if (touch.CheckPixel(808, 116, Color.White, 10)) //if edit sell form are show
                    {
                        touch.ClickAt(new Point(808, 116));
                        Bot.BotApplication.Wait(100);
                    }
                    else   // if nothing happend then phat click bua thanh ra collect cmnr
                    {
                        touch.ClickAt(new Point(428 + 146 * col, 260 + 182 * row));
                        Bot.BotApplication.Wait(100);
                        if (touch.CheckPixel(1033, 131, Color.White, 10)) // if create sell form are show
                        {
                            log.Info("Sell form are showed start selling at  [" + col + "," + row + "] ");
                            touch.ClickAt(new Point(325, 297));
                            Bot.BotApplication.Wait(100);
                            SetPriceAndQty();
                            Bot.BotApplication.Wait(200);
                        }
                        else
                        {
                            touch.ClickAt(new Point(873, 183));
                            Bot.BotApplication.Wait(100);

                            return(false);
                        }
                    }
                }



                return(true);
            }



            int x = 409 + 146 * col;
            int y = 305 + 182 * row;

            Color  c     = touch.GetPixel(409 + 146 * col, 305 + 182 * row);
            double delta = compareColor(c, Color.FromArgb(255, 119, 173, 45));

            if (delta < 10) // if sold then collect gold
            {
                log.Info(" Slot [" + col + "," + row + "] are sold");

                touch.ClickAt(new Point(409 + 146 * col, 305 + 182 * row)); //collect
                Bot.BotApplication.Wait(100);

                // then create sell
                touch.ClickAt(new Point(409 + 146 * col, 305 + 182 * row));
                Bot.BotApplication.Wait(100);
                touch.ClickAt(new Point(325, 297));
                Bot.BotApplication.Wait(100);
                SetPriceAndQty();
                Bot.BotApplication.Wait(200);
            }
            else
            {
                c     = touch.GetPixel(428 + 146 * col, 260 + 182 * row);
                delta = compareColor(c, Color.FromArgb(255, 255, 255, 255));

                if (delta < 10)
                {
                    log.Info("Slot [" + col + "," + row + "] selling");


                    // click for edit sell
                    touch.ClickAt(new Point(428 + 146 * col, 260 + 182 * row));

                    // 723 492
                    //rgb 40 , 122 , 161
                    BotApplication.Wait(50);
                    c     = touch.GetPixel(723, 492);
                    delta = compareColor(c, Color.FromArgb(255, 40, 122, 161));
                    log.Info("adv status " + delta);
                    if (delta < 50)      // check if can advsertise
                    {
                        touch.ClickAt(new Point(723, 492));
                    }
                    // then close
                    BotApplication.Wait(50);
                    touch.ClickAt(new Point(802, 124));
                    BotApplication.Wait(20);
                }
                else
                {
                    log.Info("Slot [" + col + "," + row + "] avaiable");



                    // then create sell
                    touch.ClickAt(new Point(409 + 146 * col, 305 + 182 * row));
                    Bot.BotApplication.Wait(200);
                    touch.ClickAt(new Point(325, 297));
                    Bot.BotApplication.Wait(200);
                    SetPriceAndQty();
                    Bot.BotApplication.Wait(200);
                }
            }

            /*if ((at + 1) % 8 == 0)
             * {
             *  //touch.Execute("input touchscreen swipe 923 300 339 300");
             *  touch.Execute("input touchscreen swipe 923 300 384 300");
             *
             *  Bot.BotApplication.Wait(150);
             * }*/
            return(true);
        }