Example #1
0
        public void validarInicioBatalha()
        {
            Rectangle areaBusca = new Rectangle(200, 200, Proporcao.Width / 2, Proporcao.Height - 200);

            Model.Match objMatchIniciarBatalha = ImagemBusca.obterInstancia().buscarImagemPorTemplate(BotaoAcao.obterInstancia().obterBotaoAcao("IniciarBatalha").Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);


            bool isIniciarBatalha = false;

            if (objMatchIniciarBatalha.Semelhanca > 0)
            {
                isIniciarBatalha = true;
            }
            else
            {
                Model.Match objMatchPassarTurno = ImagemBusca.obterInstancia().buscarImagemPorTemplate(BotaoAcao.obterInstancia().obterBotaoAcao("PassarTurno").Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);
                if (objMatchPassarTurno.Semelhanca > 0)
                {
                    isIniciarBatalha = true;
                }
            }
            if (isIniciarBatalha)
            {
                System.Windows.Forms.SendKeys.SendWait(" ");
                Batalha.obterInstancia().iniciar(Batalha.EnumTiposBatalha.AntiBOT);
            }
        }
Example #2
0
        public override bool executarAcao()
        {
            try
            {
                Random objRandomNumber = new Random();
                Win32.clicarBotaoDireito(objMatch.Location.X + objRandomNumber.Next(2, 8), objMatch.Location.Y + objRandomNumber.Next(2, 8));
                Thread.Sleep(600);

                if (objMatch.Location.X > 100 && objMatch.Location.Y > 60)
                {
                    Rectangle areaBusca    = new Rectangle(objMatch.Location.X - 100, objMatch.Location.Y - 60, 200, 200);
                    Bitmap    telaOriginal = ImagemCaptura.obterInstancia().obterImagemTela(true);
                    if (areaBusca.Width + areaBusca.X < telaOriginal.Width && areaBusca.Height + areaBusca.Y < telaOriginal.Height)
                    {
                        objMatch = ImagemBusca.obterInstancia().buscarImagemPorTemplate(objABotaoAcao.Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);
                        if (objMatch.Semelhanca > 0)
                        {
                            Win32.clicarBotaoEsquerdo(objMatch.Location.X + 5, objMatch.Location.Y + 5);
                            Thread.Sleep(2000);
                            Thread.Sleep(objRecurso.Tempo);
                            return(true);
                        }
                    }
                }
                return(false);
            }
            catch (System.Exception objException)
            {
                throw new System.Exception(objException.ToString());
            }
        }
Example #3
0
        public void tratarCliqueBotaoFechar()
        {
            Rectangle areaBusca = new Rectangle(57, 24, Proporcao.Width - 57, Proporcao.Height - 24);

            Model.Match objMatch = ImagemBusca.obterInstancia().buscarImagemPorTemplate((new BotaoFechar()).Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);
            if (objMatch.Semelhanca > 0)
            {
                Win32.clicarBotaoEsquerdo(objMatch.Location.X + 15, objMatch.Location.Y + 5);
            }
        }
Example #4
0
        public void tratarRecusaDeGrupo()
        {
            Rectangle areaBusca = new Rectangle(60, 20, Proporcao.Width - 60, Proporcao.Height - 20);

            Model.Match objMatch = ImagemBusca.obterInstancia().buscarImagemPorTemplate((new BotaoNao()).Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);
            if (objMatch.Semelhanca > 0)
            {
                Win32.clicarBotaoEsquerdo(objMatch.Location.X + 15, objMatch.Location.Y + 5);
            }
        }
Example #5
0
        public void validarFechamentoMensagens()
        {
            Rectangle areaBusca = new Rectangle(50, 50, Proporcao.Width - 50, Proporcao.Height - 50);

            Model.Match objMatch = ImagemBusca.obterInstancia().buscarImagemPorTemplate((new BotaoFecharX()).Imagem, Imagem.EnumRegiaoImagem.COMPLETO, areaBusca);
            if (objMatch.Semelhanca > 0)
            {
                Win32.clicarBotaoEsquerdo(objMatch.Location.X + 5, objMatch.Location.Y + 5);
            }
        }
Example #6
0
        public bool buscar(AViewModelColeta objAViewModelColeta)
        {
            bool retorno = false;

            this.validarInicioColeta(isAtivarModoBaixoConsumo);

            objAViewModelColeta.objMatch = new Model.Match();

            while (objAViewModelColeta.objMatch.Semelhanca < 0.633d)
            {
                foreach (string caminhoImagem in objAViewModelColeta.objRecurso.ListaImagens)
                {
                    objAViewModelColeta.objMatch = ImagemBusca.obterInstancia().buscarImagemPorTemplateRotacionado(caminhoImagem, Imagem.EnumRegiaoImagem.COMPLETO, obterRetanguloAreaColeta());
                    if (objAViewModelColeta.objMatch.Semelhanca > 0)
                    {
                        break;
                    }
                }


                if (objAViewModelColeta.objMatch.Semelhanca >= 0.633d)
                {
                    retorno = objAViewModelColeta.executarAcao();
                    break;
                }
                else if (_percentualAreaBusca > 89)
                {
                    break;
                }
                else
                {
                    _ampliarAreaColeta();
                }
            }
            _redefinirAreaBusca();

            return(retorno);
        }
Example #7
0
        public bool acaoIniciarBatalha()
        {
            System.Threading.Thread.Sleep(1000);
            System.Windows.Forms.SendKeys.SendWait(" ");
            System.Threading.Thread.Sleep(4000);
            try
            {
                Size bounds = Proporcao.obterProporcao();

                if (ImagemCaptura.obterInstancia().objBitmap != null)
                {
                    ImagemCaptura.obterInstancia().objBitmap.Dispose();
                }
                Bitmap objBitmap = ImagemCaptura.obterInstancia().obterImagemTela(true);

                int eixoHorizontal = 275;
                int eixoVertical   = 405;
                //Acrescentado 21 pixels na altura/largura do retangulo do personagem e gato, estava cortando no meio do retangulo do número.
                int larguraEAlturaRetangulo = 107 + 21;

                Rectangle retanguloPersonagem = new Rectangle(eixoHorizontal, eixoVertical, larguraEAlturaRetangulo, larguraEAlturaRetangulo);

                eixoHorizontal = 448;
                Rectangle retanguloGato = new Rectangle(eixoHorizontal, eixoVertical, larguraEAlturaRetangulo, larguraEAlturaRetangulo);

                Dictionary <int, Model.Match> MatchesGato = new Dictionary <int, Model.Match>();
                AntiBOT objAntiBOT = new AntiBOT();
                for (int numeroMatch = 1; numeroMatch <= 8; numeroMatch++)
                {
                    MatchesGato.Add(numeroMatch, ImagemBusca.obterInstancia().buscarImagemPorTemplateRotacionado(
                                        objAntiBOT.numerosMatch["Numero" + numeroMatch],
                                        Imagem.EnumRegiaoImagem.RETANGULO,
                                        retanguloGato
                                        )
                                    );
                }
                Application.DoEvents();

                List <Model.Match> Verificar      = new List <Model.Match>();
                List <Model.Match> NaoEncontrados = new List <Model.Match>();

                //Buscar os números até encontrar pelo menos 3 do lado do gato
                Verificar.Clear();
                foreach (Model.Match m in MatchesGato.Values)
                {
                    if (m.Semelhanca > 0)
                    {
                        Verificar.Add(m);
                    }
                    else
                    {
                        NaoEncontrados.Add(m);
                    }
                }

                List <Model.Match> Clicar = new List <Model.Match>();
                bool conflito             = false;
                if (Verificar.Count > 3)
                {
                    for (int i = 0; i < Verificar.Count; i++)
                    {
                        conflito = false;

                        for (int j = 0; j < Verificar.Count; j++)
                        {
                            if (i == j)
                            {
                                continue;
                            }

                            if (new Rectangle(Verificar[i].Location, new Size(24, 24)).Contains(Verificar[j].Location))
                            {
                                conflito = true;
                                if (Verificar[i].Semelhanca > Verificar[j].Semelhanca)
                                {
                                    Clicar.Add(Verificar[i]);
                                }
                                else
                                {
                                    Clicar.Add(Verificar[j]);
                                }
                            }
                        }
                        if (!conflito)
                        {
                            Clicar.Add(Verificar[i]);
                        }
                    }
                }
                else
                {
                    Clicar.AddRange(Verificar);
                }
                System.Threading.Thread.Sleep(1100);
                foreach (Model.Match objMatch in Clicar)
                {
                    //System.Threading.Thread.Sleep(2000);
                    Model.Match matchClicar = ImagemBusca.obterInstancia().buscarImagemPorTemplateRotacionado(objAntiBOT.numerosMatch["Numero" + objMatch.Numero.ToString()], Imagem.EnumRegiaoImagem.RETANGULO, retanguloPersonagem);

                    System.Windows.Forms.SendKeys.SendWait("1");
                    System.Threading.Thread.Sleep(800);
                    Common.Lib.Win32.clicarBotaoEsquerdo(matchClicar.Location.X, matchClicar.Location.Y);
                }

                Application.DoEvents();

                System.Threading.Thread.Sleep(5000);
                Busca.obterInstancia().validarFechamentoMensagens();
            }
            catch (Exception objException)
            {
                MessageBox.Show(objException.Message);
            }
            return(true);
        }
Example #8
0
 public Model.Match buscarNumeroPorTemplateRotacionado(string caminhoTemplateNumero, Imagem.EnumRegiaoImagem objRegiaoImagem)
 {
     return(ImagemBusca.obterInstancia().buscarImagemPorTemplateRotacionado(caminhoTemplateNumero, objRegiaoImagem, new Rectangle(0, 0, Proporcao.Width, Proporcao.Height)));
 }