コード例 #1
0
        public bool isGroupCapturable(List <KeyValuePair <int, int> > list_monstre_nombre, Monstruos groupe_actual)
        {
            bool capturable = false;

            foreach (var item in list_monstre_nombre)
            {
                if (item.Value <= groupe_actual.get_number_monstre(item.Key))
                {
                    capturable = true;
                    break;
                }
            }
            return(capturable);
        }
コード例 #2
0
ファイル: MapFrame.cs プロジェクト: edsan89/Bot-Dofus-Retro
        public async Task get_Movimientos_Personajes(TcpClient cliente, string paquete)
        {
            Account cuenta = cliente.account;

            string[] separador_jugadores = paquete.Substring(3).Split('|'), informaciones;
            string   _loc6, nombre_template, tipo;

            for (int i = 0; i < separador_jugadores.Length; ++i)
            {
                _loc6 = separador_jugadores[i];
                if (_loc6.Length != 0)
                {
                    informaciones = _loc6.Substring(1).Split(';');
                    if (_loc6[0].Equals('+'))
                    {
                        Cell  celda = cuenta.game.map.GetCellFromId(short.Parse(informaciones[0]));
                        Fight pelea = cuenta.game.fight;
                        int   id    = int.Parse(informaciones[3]);
                        nombre_template = informaciones[4];
                        tipo            = informaciones[5];
                        if (tipo.Contains(","))
                        {
                            tipo = tipo.Split(',')[0];
                        }

                        switch (int.Parse(tipo))
                        {
                        case -1:
                        case -2:
                            if (cuenta.AccountState == AccountStates.FIGHTING)
                            {
                                int  vida   = int.Parse(informaciones[12]);
                                byte pa     = byte.Parse(informaciones[13]);
                                byte pm     = byte.Parse(informaciones[14]);
                                byte equipo = byte.Parse(informaciones[15]);

                                pelea.get_Agregar_Luchador(new Luchadores(id, true, vida, pa, pm, celda, vida, equipo));
                            }
                            break;

                        case -3:    //monstruos
                            string[] templates = nombre_template.Split(',');
                            string[] niveles   = informaciones[7].Split(',');

                            Monstruos monstruo = new Monstruos(id, int.Parse(templates[0]), celda, int.Parse(niveles[0]));
                            monstruo.lider_grupo = monstruo;

                            for (int m = 1; m < templates.Length; ++m)
                            {
                                monstruo.moobs_dentro_grupo.Add(new Monstruos(id, int.Parse(templates[m]), celda, int.Parse(niveles[m])));
                            }

                            cuenta.game.map.entities.TryAdd(id, monstruo);
                            break;

                        case -4:    //NPC
                            cuenta.game.map.entities.TryAdd(id, new Npcs(id, int.Parse(nombre_template), celda));
                            break;

                        case -5:
                        case -6:
                        case -8:
                        case -9:
                        case -10:
                            break;

                        default:    // jugador
                            if (cuenta.AccountState != AccountStates.FIGHTING)
                            {
                                if (cuenta.game.character.id != id)
                                {
                                    cuenta.game.map.entities.TryAdd(id, new Personajes(id, nombre_template, byte.Parse(informaciones[7].ToString()), celda));
                                }
                                else
                                {
                                    cuenta.game.character.celda = celda;
                                }
                            }
                            else
                            {
                                int  vida   = int.Parse(informaciones[14]);
                                byte pa     = byte.Parse(informaciones[15]);
                                byte pm     = byte.Parse(informaciones[16]);
                                byte equipo = byte.Parse(informaciones[24]);

                                pelea.get_Agregar_Luchador(new Luchadores(id, true, vida, pa, pm, celda, vida, equipo));

                                if (cuenta.game.character.id == id && cuenta.fightExtension.configuracion.posicionamiento != PosicionamientoInicioPelea.INMOVIL)
                                {
                                    await Task.Delay(500);

                                    /** la posicion es aleatoria pero el paquete GP siempre aparecera primero el team donde esta el pj **/
                                    short celda_posicion = pelea.get_Celda_Mas_Cercana_O_Lejana(cuenta.fightExtension.configuracion.posicionamiento == PosicionamientoInicioPelea.CERCA_DE_ENEMIGOS, pelea.celdas_preparacion);
                                    await Task.Delay(500);

                                    if (celda_posicion != celda.cellId)
                                    {
                                        cuenta.connexion.SendPacket("Gp" + celda_posicion, true);
                                    }
                                    else
                                    {
                                        if (cuenta.isGroupLeader == true)
                                        {
                                            await Task.Delay(3800);
                                        }
                                        else
                                        {
                                            await Task.Delay(1800);
                                        }
                                        cuenta.connexion.SendPacket("GR1");
                                    }
                                }
                                else if (cuenta.game.character.id == id)
                                {
                                    if (cuenta.isGroupLeader == true)
                                    {
                                        await Task.Delay(3800);
                                    }
                                    else
                                    {
                                        await Task.Delay(1800);
                                    }
                                    cuenta.connexion.SendPacket("GR1");    //boton listo
                                }
                            }
                            break;
                        }
                    }
                    else if (_loc6[0].Equals('-'))
                    {
                        if (cuenta.AccountState != AccountStates.FIGHTING)
                        {
                            int id = int.Parse(_loc6.Substring(1));
                            cuenta.game.map.entities.TryRemove(id, out Entidad entidad);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public async Task get_Movimientos_Personajes(ClienteTcp cliente, string paquete)
        {
            Cuenta cuenta = cliente.cuenta;

            string[] separador_jugadores = paquete.Substring(3).Split(new char[]
            {
                '|'
            });
            int num;

            for (int i = 0; i < separador_jugadores.Length; i = num)
            {
                string _loc6 = separador_jugadores[i];
                bool   flag  = _loc6.Length != 0;
                if (flag)
                {
                    string[] informaciones = _loc6.Substring(1).Split(new char[]
                    {
                        ';'
                    });
                    bool flag2 = _loc6[0].Equals('+');
                    if (flag2)
                    {
                        Celda  celda           = cuenta.juego.mapa.get_Celda_Id(short.Parse(informaciones[0]));
                        Pelea  pelea           = cuenta.juego.pelea;
                        int    id              = int.Parse(informaciones[3]);
                        string nombre_template = informaciones[4];
                        string tipo            = informaciones[5];
                        bool   flag3           = tipo.Contains(",");
                        if (flag3)
                        {
                            tipo = tipo.Split(new char[]
                            {
                                ','
                            })[0];
                        }
                        string[]  templates;
                        string[]  niveles;
                        Monstruos monstruo;
                        switch (int.Parse(tipo))
                        {
                        case -10:
                        case -9:
                        case -8:
                        case -7:
                        case -6:
                        case -5:
                            break;

                        case -4:
                            cuenta.juego.mapa.entidades.TryAdd(id, new Npcs(id, int.Parse(nombre_template), celda));
                            break;

                        case -3:
                            templates = nombre_template.Split(new char[]
                            {
                                ','
                            });
                            niveles = informaciones[7].Split(new char[]
                            {
                                ','
                            });
                            monstruo             = new Monstruos(id, int.Parse(templates[0]), celda, int.Parse(niveles[0]));
                            monstruo.lider_grupo = monstruo;
                            for (int j = 1; j < templates.Length; j = num)
                            {
                                monstruo.moobs_dentro_grupo.Add(new Monstruos(id, int.Parse(templates[j]), celda, int.Parse(niveles[j])));
                                num = j + 1;
                            }
                            cuenta.juego.mapa.entidades.TryAdd(id, monstruo);
                            break;

                        case -2:
                        case -1:
                        {
                            bool flag4 = cuenta.Estado_Cuenta == EstadoCuenta.LUCHANDO;
                            if (flag4)
                            {
                                int  vida   = int.Parse(informaciones[12]);
                                byte pa     = byte.Parse(informaciones[13]);
                                byte pm     = byte.Parse(informaciones[14]);
                                byte equipo = byte.Parse(informaciones[15]);
                                pelea.get_Agregar_Luchador(new Luchadores(id, true, vida, pa, pm, celda, vida, equipo));
                            }
                            break;
                        }

                        default:
                        {
                            bool flag5 = cuenta.Estado_Cuenta != EstadoCuenta.LUCHANDO;
                            if (flag5)
                            {
                                bool flag6 = cuenta.juego.personaje.id != id;
                                if (flag6)
                                {
                                    cuenta.juego.mapa.entidades.TryAdd(id, new Personajes(id, nombre_template, byte.Parse(informaciones[7].ToString()), celda));
                                }
                                else
                                {
                                    cuenta.juego.personaje.celda = celda;
                                }
                            }
                            else
                            {
                                int  vida2   = int.Parse(informaciones[14]);
                                byte pa2     = byte.Parse(informaciones[15]);
                                byte pm2     = byte.Parse(informaciones[16]);
                                byte equipo2 = byte.Parse(informaciones[24]);
                                pelea.get_Agregar_Luchador(new Luchadores(id, true, vida2, pa2, pm2, celda, vida2, equipo2));
                                bool flag7 = cuenta.juego.personaje.id == id && cuenta.pelea_extension.configuracion.posicionamiento != PosicionamientoInicioPelea.INMOVIL;
                                if (flag7)
                                {
                                    await Task.Delay(300);

                                    short celda_posicion = pelea.get_Celda_Mas_Cercana_O_Lejana(cuenta.pelea_extension.configuracion.posicionamiento == PosicionamientoInicioPelea.CERCA_DE_ENEMIGOS, pelea.celdas_preparacion);
                                    if (celda_posicion != celda.id)
                                    {
                                        cuenta.conexion.enviar_Paquete("Gp" + celda_posicion.ToString(), true);
                                    }
                                    else
                                    {
                                        cuenta.conexion.enviar_Paquete("GR1", false);
                                    }
                                }
                                else if (cuenta.juego.personaje.id == id)
                                {
                                    await Task.Delay(300);

                                    cuenta.conexion.enviar_Paquete("GR1", false);
                                }
                            }
                            break;
                        }
                        }
                        templates = null;
                        niveles   = null;
                        monstruo  = null;
                        celda     = null;
                        pelea     = null;
                    }
                    else if (_loc6[0].Equals('-'))
                    {
                        if (cuenta.Estado_Cuenta != EstadoCuenta.LUCHANDO)
                        {
                            int     id2 = int.Parse(_loc6.Substring(1));
                            Entidad entidad;
                            cuenta.juego.mapa.entidades.TryRemove(id2, out entidad);
                            entidad = null;
                        }
                    }
                }
                num = i + 1;
            }
        }