示例#1
0
        private void timerAtacar_Tick(object sender, EventArgs e)
        {
            if (!checkBox_targeting.Checked)
            {
                return;
            }

            timerAtacar.Enabled = false;

            /* Actualizamos los valores de los checkbox pa poder usarlos en el cavebot */
            AppConstants.FIGHT_PP1 = checkBox1.Checked;
            AppConstants.FIGHT_PP2 = checkBox2.Checked;
            AppConstants.FIGHT_PP3 = checkBox3.Checked;
            AppConstants.FIGHT_PP4 = checkBox4.Checked;

            if (Player.estaPeleando())
            {
                short  idContrario = Enemy.getId();
                Thread t;

                if (!estaOcupado)
                {
                    guardarHistorial = checkBox_historialPeleas.Checked;

                    #region Vemos si debo atacar
                    bool debeAtacar = false;

                    if (checkBox_noMatarShiny.Checked && Enemy.isShiny())
                    {
                        if (checkBox_alarmaShiny.Checked)
                        {
                            try
                            {
                                SoundPlayer player = new SoundPlayer(Resources.alert);
                                player.Play();
                            }
                            catch (Exception ex) { }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < listView_targets.Items.Count; i++)
                        {
                            string actual = listView_targets.Items[i].Text.ToUpper();
                            if (actual == PokemonInfo.getPokemonName(idContrario).ToUpper())
                            {
                                debeAtacar = true;
                                break;
                            }
                            else if (actual == "TODOS" || actual == "ALL" || actual == "TODO")
                            {
                                debeAtacar = true;
                                break;
                            }
                        }
                    }
                    #endregion

                    if (BotUtils.tengoPP(checkBox1.Checked, checkBox2.Checked,
                                         checkBox3.Checked, checkBox4.Checked))
                    {
                        if (debeAtacar)
                        {
                            t = new Thread(atacar);
                            t.Start();
                        }
                        else if (checkBox_correrleAlResto.Checked)
                        {
                            t = new Thread(salirDeLaPelea);
                            t.Start();
                        }
                        else if (checkBox_alarmaPoemonEspecial.Checked)
                        {
                            try
                            {
                                SoundPlayer player = new SoundPlayer(Resources.alert);
                                player.Play();
                            }
                            catch (Exception ex) { }
                        }
                    }
                    else /* Salir de la pelea si no tengo pp */
                    {
                        t = new Thread(salirDeLaPelea);
                        t.Start();
                    }
                }
            }

            if (!Player.estaPeleando())
            {
                debeAnadir = true;
            }

            timerAtacar.Enabled = true;
        }
示例#2
0
        public void goToNextWaypoint()
        {
            if (waypointList.Count == 0)
            {
                return;
            }

            isWalking = true;
            int nextWaypointType = waypointList[nextWaypoint].getType();

            if (nextWaypointType == AppConstants.WAYPOINT_ACTION)
            {
                //int yInicial = Player.getPosY();
                //int yFinal = yInicial++; // Cuando haya bajado 1 sqm es pq termino de hablar

                while (MemoryHandler.getPosY() < 5) /* que balurdez */
                {
                    BotUtils.doAction();
                    Thread.Sleep(AppConstants.LAG_HIGH);
                    BotUtils.moveDown();
                    Thread.Sleep(AppConstants.LAG_HIGH);
                }
            }
            else
            {
                BotUtils.walk(waypointList[nextWaypoint]);

                /*BotUtils.moveRight();
                 * Thread.Sleep(AppConstants.KEY_DELAY);
                 * BotUtils.moveLeft();*/
                Thread.Sleep(AppConstants.KEY_DELAY);
            }

            int prevType = nextWaypointType;

            if ((Player.getPosX() == waypointList[nextWaypoint].getX() &&
                 Player.getPosY() == waypointList[nextWaypoint].getY()) ||
                nextWaypointType == AppConstants.WAYPOINT_ACTION ||
                nextWaypointType == AppConstants.WAYPOINT_DOOR)
            {
                nextWaypoint = getNextWaypointId();
            }

            /* Chequeo si era LOOP o ENDLOOP para modificar ...*/
            if (prevType == AppConstants.WAYPOINT_LOOP)
            {
                /* Chequeo PPs.. Si tengo, sigo normal.. Sino, mando al sig de endloop */
                if (!BotUtils.tengoPP(AppConstants.FIGHT_PP1, AppConstants.FIGHT_PP2,
                                      AppConstants.FIGHT_PP3, AppConstants.FIGHT_PP4))
                {
                    /* Busco el que sigue despues de endloop */
                    for (int i = prevType; i < waypointList.Count; i++)
                    {
                        if (waypointList[i].getType() == AppConstants.WAYPOINT_ENDLOOP)
                        {
                            nextWaypoint = i + 1;
                            break;
                        }
                    }
                }
            }
            if (prevType == AppConstants.WAYPOINT_ENDLOOP)
            {
                /* Mando a LOOP */
                for (int i = 0; i < waypointList.Count; i++)
                {
                    if (waypointList[i].getType() == AppConstants.WAYPOINT_LOOP)
                    {
                        nextWaypoint = i;
                        break;
                    }
                }
            }

            isWalking = false;
        }