Beispiel #1
0
 public decimal GetPlayerSalary(long playerId)
 {
     if (!Verificacoes <Jogador> .Exite(Tabelas.Jogadores, playerId))
     {
         throw new PlayerNotFoundException();
     }
     return(Tabelas.Jogadores.Where(x => x.id == playerId).Select(x => x.salary).SingleOrDefault());
 }
Beispiel #2
0
 public string GetPlayerName(long playerId)
 {
     if (!Verificacoes <Jogador> .Exite(Tabelas.Jogadores, playerId))
     {
         throw new PlayerNotFoundException();
     }
     return(Tabelas.Jogadores.Where(x => x.id == playerId).Select(x => x.name).SingleOrDefault());
 }
Beispiel #3
0
 public string GetTeamName(long teamId)
 {
     if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
     {
         throw new TeamNotFoundException();
     }
     return(Tabelas.Times.Where(x => x.id == teamId).Select(x => x.name).SingleOrDefault());
 }
Beispiel #4
0
 public void SetCaptain(long playerId)
 {
     if (!Verificacoes <Jogador> .Exite(Tabelas.Jogadores, playerId))
     {
         throw new PlayerNotFoundException();
     }
     Tabelas.Jogadores.Where(x => x.id == playerId).Single().DefineCapitao();
 }
Beispiel #5
0
        public void AddTeam(long id, string name, DateTime createDate, string mainShirtColor, string secondaryShirtColor)
        {
            if (Verificacoes <Time> .Exite(Tabelas.Times, id))
            {
                throw new UniqueIdentifierException();
            }
            Time _time = new Time(id, name, createDate, mainShirtColor, secondaryShirtColor);

            Tabelas.Times.Add(_time);
        }
Beispiel #6
0
        public long GetOlderTeamPlayer(long teamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            var OlderPlayer = Tabelas.Jogadores.Where(x => x.teamId == teamId && x.birthDate == Tabelas.Jogadores.Where(y => y.teamId == teamId).Min(y => y.birthDate)).Select(x => x.id).Min();

            return(OlderPlayer);
        }
Beispiel #7
0
        public long GetHigherSalaryPlayer(long teamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            var Players   = Tabelas.Jogadores.Where(x => x.teamId == teamId).ToList();
            var MaxSalary = Players.Max(x => x.salary);

            return(Players.Where(x => x.salary == MaxSalary).Select(x => x.id).SingleOrDefault());
        }
Beispiel #8
0
        public List <long> GetTeamPlayers(long teamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            var Players = Tabelas.Jogadores.Where(x => x.teamId == teamId).Select(x => x.id).ToList();

            Players.Sort();
            return(Players);
        }
Beispiel #9
0
        public void AddPlayer(long id, long teamId, string name, DateTime birthDate, int skillLevel, decimal salary)
        {
            Verificacoes <Jogador> .VerificaId(Tabelas.Jogadores, id);

            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            Jogador _jogador = new Jogador(id, teamId, name, birthDate, skillLevel, salary);

            Tabelas.Jogadores.Add(_jogador);
        }
Beispiel #10
0
        public long GetTeamCaptain(long teamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            Jogador Capitao = Tabelas.Jogadores.Where(x => x.teamId == teamId && x.Capitao).SingleOrDefault();

            if (Capitao == null)
            {
                throw new Codenation.Challenge.Exceptions.CaptainNotFoundException();
            }
            else
            {
                return(Capitao.id);
            }
        }
Beispiel #11
0
        public long GetBestTeamPlayer(long teamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            var BestPlayer = Tabelas.Jogadores.Where(x => x.teamId == teamId && x.skillLevel == Tabelas.Jogadores.Where(y => y.teamId == teamId).Max(y => y.skillLevel));

            if (BestPlayer.Count() > 1)
            {
                return(BestPlayer.Where(x => x.id == BestPlayer.Min(y => y.id)).Select(x => x.id).Single());
            }
            else
            {
                return(BestPlayer.Select(x => x.id).Single());
            }
        }
Beispiel #12
0
 public static void Atacar()
 {
     while (true)
     {
         if (Setting.PlayerOnScreen == true || Setting.Kill)
         {
             Thread.CurrentThread.Abort();
         }
         bool targeting = Verificacoes.Targetando();
         bool vivo      = Verificacoes.PokeVivo();
         if (targeting == false && vivo == true)
         {
             if (Setting.PlayerOnScreen == true || Setting.Kill)
             {
                 Thread.CurrentThread.Abort();
             }
             win32.LeftClick(Setting.BattleX, Setting.BattleY);
             if (Setting.tries < Setting.triestotal)
             {
                 if (Setting.Pescar == 1)
                 {
                     Setting.tries++;
                 }
             }
             else
             {
                 Setting.PlayerOnScreen = true;
             }
         }
         Thread.Sleep(300);
         if (targeting == true)
         {
             Setting.tries = 0;
             Moves();
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
     }
 }
Beispiel #13
0
        public string GetVisitorShirtColor(long teamId, long visitorTeamId)
        {
            if (!Verificacoes <Time> .Exite(Tabelas.Times, teamId))
            {
                throw new TeamNotFoundException();
            }
            if (!Verificacoes <Time> .Exite(Tabelas.Times, visitorTeamId))
            {
                throw new TeamNotFoundException();
            }
            var corCasa      = Tabelas.Times.Where(x => x.id == teamId).Select(x => x.corUniformePrincipal).SingleOrDefault();
            var corVisitante = Tabelas.Times.Where(x => x.id == visitorTeamId).Select(x => x.corUniformePrincipal).SingleOrDefault();

            if (corCasa != corVisitante)
            {
                return(corVisitante);
            }
            else
            {
                return(Tabelas.Times.Where(x => x.id == visitorTeamId).Select(x => x.corUniformeSecundario).SingleOrDefault());
            }
        }
Beispiel #14
0
        public void verificacoes()
        {
            string texto = "";

            if (Verificacoes.verifica_Contas_pagar_atrazadas(this))
            {
                texto += "Existem contas a pagar atrazadas\n";
            }
            if (Verificacoes.verifica_Contas_receber_atrazadas(this))
            {
                texto += "Existem contas a serem recebidas\n";
            }
            if (Verificacoes.verifica_estoque_minimo(this))
            {
                texto += "Alguns produtos estão com o estoque menor do que o recomendável";
            }
            if (texto.Length > 0)
            {
                this.LayoutMdi(MdiLayout.Cascade);
                MessageBox.Show(texto, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #15
0
        public void exec()
        {
            if (stop == true)
            {
                Thread.CurrentThread.Abort();
            }
            int time = 200;

            view.Rows[iexec].Selected = true;
            string now = view.Rows[iexec].Cells[1].Value.ToString();

            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            switch (now)
            {
            default:
                break;

            case "Waypoint":
                int ix = Convert.ToInt32(view.Rows[iexec].Cells[2].Value);
                int iy = Convert.ToInt32(view.Rows[iexec].Cells[3].Value);
                int nx, ny, lx, ly;
                int max = 5;
                while (Setting.charx != ix | Setting.chary != iy)
                {
                    if (Setting.PausarNoTarget == 1)
                    {
                        Verificacoes.Targetando();
                        while (Setting.IsTargeting == 1)
                        {
                            Thread.Sleep(0);
                            Verificacoes.Targetando();
                        }
                    }
                    if (Setting.charx < ix)
                    {
                        lx = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Right}");
                        Thread.Sleep(time);
                        nx = Setting.charx;
                        if (lx == nx)
                        {
                            //if(Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            //else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.charx > ix)
                    {
                        lx = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Left}");
                        Thread.Sleep(time);
                        nx = Setting.charx;
                        if (lx == nx)
                        {
                            //if (Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            // else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.chary > iy)
                    {
                        ly = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Up}");
                        Thread.Sleep(time);
                        ny = Setting.charx;
                        if (ly == ny)
                        {
                            // if (Rdn.Radn() == 0) SendKeys.SendWait("{Up}");
                            // else SendKeys.SendWait("{Down}");
                        }
                    }
                    if (Setting.chary < iy)
                    {
                        ly = Setting.charx;
                        win32.SetForegroundWindow(otpHandle);
                        //SendKeysA(Keys.Right);
                        SendKeys.SendWait("{Down}");
                        Thread.Sleep(time);
                        ny = Setting.charx;
                        if (ly == ny)
                        {
                            //  if (Rdn.Radn() == 0) SendKeys.SendWait("{Left}");
                            //    else SendKeys.SendWait("{Right}");
                        }
                    }
                }
                break;

            case "Left":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Left);
                SendKeys.SendWait("{Left}");
                Thread.Sleep(time);
                break;

            case "Right":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Right);
                SendKeys.SendWait("{Right}");
                Thread.Sleep(time);
                break;

            case "Up":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Up);
                SendKeys.SendWait("{Up}");
                Thread.Sleep(time);
                break;

            case "Down":
                win32.SetForegroundWindow(otpHandle);
                //SendKeysA(Keys.Down);
                SendKeys.SendWait("{Down}");
                Thread.Sleep(time);
                break;

            case "Wait":
                //win32.SetForegroundWindow(otpHandle);
                Thread.Sleep(Convert.ToInt32(view.Rows[iexec].Cells[4].Value) * 1000);
                break;

            case "LClick":
                //win32.SetForegroundWindow(otpHandle);
                win32.LeftClick(Convert.ToInt32(view.Rows[iexec].Cells[2].Value), Convert.ToInt32(view.Rows[iexec].Cells[3].Value));
                Thread.Sleep(200);
                break;

            case "RClick":
                //win32.SetForegroundWindow(otpHandle);
                win32.RightClick(Convert.ToInt32(view.Rows[iexec].Cells[2].Value), Convert.ToInt32(view.Rows[iexec].Cells[3].Value));
                Thread.Sleep(200);
                break;

            case "Message":
                //win32.SetForegroundWindow(otpHandle);
                MessageBox.Show(Convert.ToString(view.Rows[iexec].Cells[4].Value));
                Thread.Sleep(200);
                break;

            case "Goto Label":
                string labeltogo = view.Rows[iexec].Cells[4].Value.ToString();
                for (int a = 0; a < view.RowCount; a++)
                {
                    if (view.Rows[a].Cells[1].Value.ToString() == "Label" && view.Rows[a].Cells[4].Value.ToString() == labeltogo)
                    {
                        iexec = a;
                        break;
                    }
                }
                break;

            case "If Color":
                //win32.SetForegroundWindow(otpHandle);
                int x = Convert.ToInt32(view.Rows[iexec].Cells[2].Value);
                int y = Convert.ToInt32(view.Rows[iexec].Cells[3].Value);
                //MessageBox.Show(GrabPixel(x, y));
                if (GrabPixel(x, y) == view.Rows[iexec].Cells[4].Value.ToString())
                {
                    trueif = true;
                    //MessageBox.Show(Convert.ToString(trueif));
                    //iexec++;
                }
                else
                {
                    trueif = false;
                    for (int b = iexec; b < view.RowCount; b++)
                    {
                        if (view.Rows[b].Cells[1].Value.ToString() == "Else")
                        {
                            iexec = b;
                            break;
                        }
                        else if (view.Rows[b].Cells[1].Value.ToString() == "End")
                        {
                            iexec = b;
                            break;
                        }
                        if (b == view.RowCount)
                        {
                            MessageBox.Show("End não encontrado!\nParando CaveBot!");
                            iexec = view.RowCount;
                            break;
                        }
                    }
                }
                break;

            case "Else":
                for (int c = iexec; c < view.RowCount; c++)
                {
                    if (view.Rows[c].Cells[1].Value.ToString() == "End")
                    {
                        //MessageBox.Show("f");
                        if (trueif == true)
                        {
                            iexec = c; trueif = false;
                        }
                        break;
                    }
                    if (c == view.RowCount)
                    {
                        MessageBox.Show("End não encontrado!\nParando CaveBot!");
                        iexec = view.RowCount;
                        break;
                    }
                }
                break;

            case "SAY":
                String s = Convert.ToString(view.Rows[iexec].Cells[4].Value);
                SendKeys.SendWait("{Enter}");
                var chars = s.ToCharArray();
                for (int ctr = 0; ctr < chars.Length; ctr++)                            //Console.WriteLine("   {0}: {1}", ctr, chars[ctr]);
                {
                    win32.SetForegroundWindow(otpHandle);
                    if (Convert.ToString(chars[ctr]) == " ")
                    {
                        SendKeys.SendWait(" ");
                    }
                    else
                    {
                        SendKeys.SendWait("{" + chars[ctr] + "}");
                    }
                    //MessageBox.Show("{" + chars[ctr] + "}");
                }
                SendKeys.SendWait("{Enter}");
                break;

            case "Pokemon":
                //win32.SetForegroundWindow(otpHandle);
                int diff       = Setting.Poke2Y - Setting.Poke1Y;
                int pokechange = Convert.ToInt32(view.Rows[iexec].Cells[4].Value);
                if (pokechange == 1)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke1X, Setting.Poke1Y);
                }
                if (pokechange == 2)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke2X, Setting.Poke2Y);
                }
                if (pokechange == 3)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke3X, Setting.Poke3Y);
                }
                if (pokechange == 4)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke4X, Setting.Poke4Y);
                }
                if (pokechange == 5)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke5X, Setting.Poke5Y);
                }
                if (pokechange == 6)
                {
                    Thread.Sleep(500); win32.LeftClick(Setting.Poke6X, Setting.Poke6Y);
                }
                Thread.Sleep(3000);
                break;

            case "Teleport":
                string tp      = "!teleport Saffron";
                var    charstp = tp.ToCharArray();
                SendKeys.SendWait("{Enter}");
                for (int ctr = 0; ctr < charstp.Length; ctr++)                            //Console.WriteLine("   {0}: {1}", ctr, chars[ctr]);
                {
                    win32.SetForegroundWindow(otpHandle);
                    if (Convert.ToString(charstp[ctr]) == " ")
                    {
                        SendKeys.SendWait(" ");
                    }
                    else
                    {
                        SendKeys.SendWait("{" + charstp[ctr] + "}");
                    }
                    //MessageBox.Show("{" + chars[ctr] + "}");
                }
                SendKeys.SendWait("{Enter}");
                Thread.Sleep(1000);
                break;

            case "Logout":
                while (z == 1)
                {
                    string colornow = GrabPixel(Setting.RodX, Setting.RodY);
                    Thread.Sleep(1000);
                    win32.SetForegroundWindow(otpHandle);
                    SendKeys.SendWait("^{q}");
                    if (colornow != colorrod)
                    {
                        z = 0;
                        break;
                    }
                }
                break;
            }
            if (Setting.PausarNoTarget == 1)
            {
                Verificacoes.Targetando();
                while (Setting.IsTargeting == 1)
                {
                    Thread.Sleep(0);
                    Verificacoes.Targetando();
                }
            }
            if (iexec < view.RowCount)
            {
                iexec++;
            }
            if (iexec >= view.RowCount)
            {
                iexec = 0; stop = true;
            }
            if (stop == false)
            {
                exec();
            }
        }
Beispiel #16
0
        public static bool Pescar()
        {
            bool pescou = false;

            Mem.Memory();
            if (Setting.charx == Setting.LastX && Setting.chary == Setting.LastY)
            {
                IntPtr handle = win32.FindWindow("otPokemon", null);
                int    dir    = 8;
                #region random
                Random rnd = new Random();
                if (Setting.randomfish == 1)
                {
                    dir = rnd.Next(0, 8);
                }
                else
                {
                    dir = 8;
                }

                int wx = Setting.WaterX, wy = Setting.WaterY;
                switch (dir)
                {
                case 0:
                    wx = wx + 64;     //direita
                    break;

                case 1:
                    wx = wx - 64;     //esquerda
                    break;

                case 2:
                    wy = wy + 64;     // baixo
                    break;

                case 3:
                    wy = wy - 64;     //cima
                    break;

                case 4:
                    wx = wx + 64;     //direita
                    wy = wy + 64;     // baixo
                    break;

                case 5:
                    wx = wx - 64;     //esquerda
                    wy = wy + 64;     // baixo
                    break;

                case 6:
                    wx = wx + 64;     //direita
                    wy = wy - 64;     //cima
                    break;

                case 7:
                    wx = wx - 64;     //esquerda
                    wy = wy - 64;     //cima
                    break;

                case 8:
                    break;
                }
                #endregion
                int time = 0;
                Chat.CheckChat();
                Thread.Sleep(500);

                if (Setting.PlayerOnScreen == true || Setting.Kill)
                {
                    Thread.CurrentThread.Abort();
                }
                Setting.clicklock = true;
                win32.LeftClickLocked(0, 0);
                //IntPtr now = win32.GetForegroundWindow();
                //MessageBox.Show(now.ToString());
                win32.SetForegroundWindow(handle);
                win32.LeftClickOld(win32.FindWindow("otPokemon", null), Setting.RodX, Setting.RodY);//clicar na vara
                //win32.LeftClick(Setting.RodX, Setting.RodY);
                Thread.Sleep(200);
                win32.LeftClickOld(win32.FindWindow("otPokemon", null), wx, wy);//clicar na agua
                Mem.Memory();
                Setting.LastX = Setting.charx;
                Setting.LastY = Setting.chary;
                //win32.LeftClick(wx, wy);
                //win32.SetForegroundWindow(now);
                Thread.Sleep(200);
                win32.LeftClickLocked(0, 0);
                Setting.clicklock = false;
                string startcolor = Verificacoes.FishColor();
                string colornow   = Verificacoes.FishColor();
                while (colornow == startcolor)
                {
                    if (Setting.PlayerOnScreen == true || Setting.Kill)
                    {
                        Thread.CurrentThread.Abort();
                    }
                    Thread.Sleep(500);
                    if (time < 20)
                    {
                        //colornow = Convert.ToString(getpixel.GetPixel(getpixel.GetWindowDC(getpixel.GetDesktopWindow()), Setting.FishX, Setting.FishY));
                        colornow = Verificacoes.FishColor();
                        time++;
                    }
                    else
                    {
                        colornow = "0";
                    }
                }
                Chat.CheckChat();
                if (Setting.PlayerOnScreen == true || Setting.Kill)
                {
                    Thread.CurrentThread.Abort();
                }
                Mem.Memory();
                if (Setting.charx == Setting.LastX && Setting.chary == Setting.LastY)
                {
                    win32.LeftClick(Setting.FishX, Setting.FishY);
                }
                win32.MoveMouse(0, 0);
                if (Setting.AtacarSemTarget == 1)
                {
                    Ataque.MovesSemTarget();
                }
                pescou = true;
            }
            else
            {
                Setting.PlayerOnScreen = true;
            }
            return(pescou);
        }
Beispiel #17
0
 static void Moves()
 {
     while (true)
     {
         if (Setting.PlayerOnScreen == true || Setting.Kill)
         {
             Thread.CurrentThread.Abort();
         }
         Verificacoes.Targetar();
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         if (Setting.m1 == 1)
         {
             win32.SendKeys(Keys.F1);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m2 == 1)
         {
             win32.SendKeys(Keys.F2);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m3 == 1)
         {
             win32.SendKeys(Keys.F3);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m4 == 1)
         {
             win32.SendKeys(Keys.F4);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m5 == 1)
         {
             win32.SendKeys(Keys.F5);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m6 == 1)
         {
             win32.SendKeys(Keys.F6);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m7 == 1)
         {
             win32.SendKeys(Keys.F7);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m8 == 1)
         {
             win32.SendKeys(Keys.F8);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m9 == 1)
         {
             win32.SendKeys(Keys.F9);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
         Verificacoes.Targetar();
         if (Setting.m10 == 1)
         {
             win32.SendKeys(Keys.F10);
         }
         if (Verificacoes.PokeVivo() == false)
         {
             break;
         }
         Thread.Sleep(Setting.attacktime);
     }
 }