コード例 #1
0
        public void get_Experiencia_Oficio(ClienteTcp cliente, string paquete)
        {
            string[]       separador_oficio_experiencia = paquete.Substring(3).Split('|');
            PersonajeJuego personaje = cliente.cuenta.juego.personaje;
            uint           experiencia_actual, experiencia_base, experiencia_siguiente_nivel;
            short          id;
            byte           nivel;

            foreach (string oficio in separador_oficio_experiencia)
            {
                id                 = short.Parse(oficio.Split(';')[0]);
                nivel              = byte.Parse(oficio.Split(';')[1]);
                experiencia_base   = uint.Parse(oficio.Split(';')[2]);
                experiencia_actual = uint.Parse(oficio.Split(';')[3]);

                if (nivel < 100)
                {
                    experiencia_siguiente_nivel = uint.Parse(oficio.Split(';')[4]);
                }
                else
                {
                    experiencia_siguiente_nivel = 0;
                }

                personaje.oficios.Find(x => x.id == id).set_Actualizar_Oficio(nivel, experiencia_base, experiencia_actual, experiencia_siguiente_nivel);
            }
            personaje.evento_Oficios_Actualizados();
        }
コード例 #2
0
        // Token: 0x060000D9 RID: 217 RVA: 0x00004BFC File Offset: 0x00002FFC
        private async Task get_Verificar_Sacos()
        {
            bool flag = !this.manejador_script.get_Global_Or <bool>("OUVERTURE_DES_SACS", DataType.Boolean, false);

            if (!flag)
            {
                PersonajeJuego           personaje = this.cuenta.juego.personaje;
                List <ObjetosInventario> sacos     = (from o in personaje.inventario.objetos
                                                      where o.tipo == 100
                                                      select o).ToList <ObjetosInventario>();
                bool flag2 = sacos.Count > 0;
                if (flag2)
                {
                    foreach (ObjetosInventario saco in sacos)
                    {
                        personaje.inventario.utilizar_Objeto(saco);
                        await Task.Delay(500);

                        saco = null;
                    }
                    List <ObjetosInventario> .Enumerator enumerator = default(List <ObjetosInventario> .Enumerator);
                    this.cuenta.logger.log_Script("SCRIPT", string.Format("{0} sac de ressource ouvert !", sacos.Count));
                }
            }
        }
コード例 #3
0
        public Task get_Personaje_Seleccionado(ClienteTcp cliente, string paquete) => Task.Run(async() =>
        {
            Cuenta cuenta            = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;
            string[] _loc4           = paquete.Substring(4).Split('|');

            int id        = int.Parse(_loc4[0]);
            string nombre = _loc4[1];
            byte nivel    = byte.Parse(_loc4[2]);
            byte raza_id  = byte.Parse(_loc4[3]);
            byte sexo     = byte.Parse(_loc4[4]);

            personaje.set_Datos_Personaje(id, nombre, nivel, sexo, raza_id);
            personaje.esta_conectado = true;
            personaje.inventario.agregar_Objetos(_loc4[9]);

            cuenta.juego.personaje.timer_afk.Change(1200000, 1200000);
            cuenta.pelea_extension.configuracion.cargar();
            cuenta.juego.personaje.evento_Personaje_Seleccionado();

            await cliente.enviar_Paquete_Async("GC1");

            if (cuenta.es_lider_grupo && cuenta.tiene_grupo)
            {
                await cuenta.grupo.get_Esperar_Miembros_Conectados();
                cuenta.grupo.get_Invitar_Grupo_Miembros();
            }
        });
コード例 #4
0
 // Token: 0x06000452 RID: 1106 RVA: 0x0000FB74 File Offset: 0x0000DF74
 public Movimiento(Cuenta _cuenta, Mapa _mapa, PersonajeJuego _personaje)
 {
     this.cuenta                 = _cuenta;
     this.personaje              = _personaje;
     this.mapa                   = _mapa;
     this.pathfinder             = new Pathfinder();
     this.mapa.mapa_actualizado += this.evento_Mapa_Actualizado;
 }
コード例 #5
0
ファイル: Juego.cs プロジェクト: Aetra/BotDofusW
 internal Juego(Cuenta cuenta)
 {
     servidor  = new ServidorJuego();
     mapa      = new Mapa();
     personaje = new PersonajeJuego(cuenta);
     manejador = new Manejador(cuenta, mapa, personaje);
     pelea     = new Pelea(cuenta);
 }
コード例 #6
0
        public Movimiento(Cuenta _cuenta, Mapa _mapa, PersonajeJuego _personaje)
        {
            cuenta    = _cuenta;
            personaje = _personaje;
            mapa      = _mapa;

            pathfinder             = new Pathfinder();
            mapa.mapa_actualizado += evento_Mapa_Actualizado;
        }
コード例 #7
0
        public void get_Cantidad_Vida_Regenerada(ClienteTcp cliente, string paquete)
        {
            paquete = paquete.Substring(3);
            int            vida      = int.Parse(paquete);
            Cuenta         cuenta    = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            personaje.caracteristicas.vitalidad_actual += vida;
            cuenta.logger.log_informacion("DOFUS", $"Vous avez récupéré {vida} points de vie");
        }
コード例 #8
0
ファイル: PersonajeFrame.cs プロジェクト: Leandre3Lu/FreeBot
        public Task get_Cantidad_Vida_Regenerada(ClienteTcp cliente, string paquete) => Task.Run(() =>
        {
            paquete                  = paquete.Substring(3);
            int vida                 = int.Parse(paquete);
            Cuenta cuenta            = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            personaje.caracteristicas.vitalidad_actual += vida;
            cuenta.logger.log_informacion("DOFUS", $"Has recuperado {vida} puntos de vida");
        });
コード例 #9
0
ファイル: PersonajeFrame.cs プロジェクト: Leandre3Lu/FreeBot
        public Task get_Actualizacion_Pods(ClienteTcp cliente, string paquete) => Task.Run(() =>
        {
            string[] pods            = paquete.Substring(2).Split('|');
            short pods_actuales      = short.Parse(pods[0]);
            short pods_maximos       = short.Parse(pods[1]);
            PersonajeJuego personaje = cliente.cuenta.juego.personaje;

            personaje.inventario.pods_actuales = pods_actuales;
            personaje.inventario.pods_maximos  = pods_maximos;
            cliente.cuenta.juego.personaje.evento_Pods_Actualizados();
        });
コード例 #10
0
        public void get_Tiempo_Regenerado(ClienteTcp cliente, string paquete)
        {
            paquete = paquete.Substring(3);
            int            num       = int.Parse(paquete);
            Cuenta         cuenta    = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            personaje.timer_regeneracion.Change(-1, -1);
            personaje.timer_regeneracion.Change(num, num);
            cuenta.logger.log_informacion("DOFUS", string.Format("Votre personnage récupère 1 pdv toutes les {0} secondes", num / 1000));
        }
コード例 #11
0
        private async Task get_Verificar_Script_Regeneracion()
        {
            Table auto_regeneracion = manejador_script.get_Global_Or <Table>("AUTO_REGENERACION", DataType.Table, null);

            if (auto_regeneracion == null)
            {
                return;
            }

            PersonajeJuego personaje   = cuenta.juego.personaje;
            int            vida_minima = auto_regeneracion.get_Or("VIDA_MINIMA", DataType.Number, 0);
            int            vida_maxima = auto_regeneracion.get_Or("VIDA_MAXIMA", DataType.Number, 100);

            if (vida_minima == 0 || personaje.caracteristicas.porcentaje_vida > vida_minima)
            {
                return;
            }

            int fin_vida            = vida_maxima * personaje.caracteristicas.vitalidad_maxima / 100;
            int vida_para_regenerar = fin_vida - personaje.caracteristicas.vitalidad_actual;

            List <int> objetos = auto_regeneracion.Get("OBJETOS").ToObject <List <int> >();

            foreach (int id_objeto in objetos)
            {
                if (vida_para_regenerar < 20)
                {
                    break;
                }

                ObjetosInventario objeto = personaje.inventario.get_Objeto_Modelo_Id(id_objeto);

                if (objeto == null)
                {
                    continue;
                }

                if (objeto.vida_regenerada <= 0)
                {
                    continue;
                }

                int cantidad_necesaria = (int)Math.Floor(vida_para_regenerar / (double)objeto.vida_regenerada);
                int cantidad_correcta  = Math.Min(cantidad_necesaria, objeto.cantidad);

                for (int j = 0; j < cantidad_correcta; j++)
                {
                    personaje.inventario.utilizar_Objeto(objeto);
                    await Task.Delay(800);
                }

                vida_para_regenerar -= objeto.vida_regenerada * cantidad_correcta;
            }
        }
コード例 #12
0
ファイル: PersonajeFrame.cs プロジェクト: Leandre3Lu/FreeBot
        public Task get_Tiempo_Regenerado(ClienteTcp cliente, string paquete) => Task.Run(() =>
        {
            paquete                  = paquete.Substring(3);
            int tiempo               = int.Parse(paquete);
            Cuenta cuenta            = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            personaje.timer_regeneracion.Change(Timeout.Infinite, Timeout.Infinite);
            personaje.timer_regeneracion.Change(tiempo, tiempo);

            cuenta.logger.log_informacion("DOFUS", $"Tú personaje recupera 1 pdv cada {tiempo / 1000} segundos");
        });
コード例 #13
0
        public void get_Tiempo_Regenerado(ClienteTcp cliente, string paquete)
        {
            paquete = paquete.Substring(3);
            int            tiempo    = int.Parse(paquete);
            Cuenta         cuenta    = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            personaje.timer_regeneracion.Change(Timeout.Infinite, Timeout.Infinite);
            personaje.timer_regeneracion.Change(tiempo, tiempo);

            cuenta.logger.log_informacion("DOFUS", $"Votre personnage récupère 1 pdv chaque {tiempo / 1000} secondes");
        }
コード例 #14
0
        private Dictionary <short, ObjetoInteractivo> get_Interactivos_Utilizables(List <short> elementos_ids)
        {
            Dictionary <short, ObjetoInteractivo> elementos_utilizables = new Dictionary <short, ObjetoInteractivo>();
            PersonajeJuego personaje = cuenta.juego.personaje;

            ObjetosInventario arma     = personaje.inventario.get_Objeto_en_Posicion(InventarioPosiciones.ARMA);
            byte distancia_arma        = 1;
            bool es_herramienta_pescar = false;

            if (arma != null)
            {
                distancia_arma        = get_Distancia_herramienta(arma.id_modelo);
                es_herramienta_pescar = herramientas_pescar.Contains(arma.id_modelo);
            }

            foreach (ObjetoInteractivo interactivo in mapa.interactivos.Values)
            {
                if (!interactivo.es_utilizable || !interactivo.modelo.recolectable)
                {
                    continue;
                }

                List <Celda> path = pathfinder.get_Path(personaje.celda, interactivo.celda, mapa.celdas_ocupadas(), true, distancia_arma);

                if (path == null || path.Count == 0)
                {
                    continue;
                }

                foreach (short habilidad in interactivo.modelo.habilidades)
                {
                    if (!elementos_ids.Contains(habilidad))
                    {
                        continue;
                    }

                    if (!es_herramienta_pescar && path.Last().get_Distancia_Entre_Dos_Casillas(interactivo.celda) > 1)
                    {
                        continue;
                    }

                    if (es_herramienta_pescar && path.Last().get_Distancia_Entre_Dos_Casillas(interactivo.celda) > distancia_arma)
                    {
                        continue;
                    }

                    elementos_utilizables.Add(interactivo.celda.id, interactivo);
                }
            }

            return(elementos_utilizables);
        }
コード例 #15
0
        public void get_Experiencia_Oficio(ClienteTcp cliente, string paquete)
        {
            string[] array = paquete.Substring(3).Split(new char[]
            {
                '|'
            });
            PersonajeJuego personaje = cliente.cuenta.juego.personaje;
            short          id;

            Predicate <Oficio> < > 9__0;
            foreach (string text in array)
            {
                id = short.Parse(text.Split(new char[]
                {
                    ';'
                })[0]);
                byte b = byte.Parse(text.Split(new char[]
                {
                    ';'
                })[1]);
                uint experiencia_base = uint.Parse(text.Split(new char[]
                {
                    ';'
                })[2]);
                uint experiencia_actual = uint.Parse(text.Split(new char[]
                {
                    ';'
                })[3]);
                bool flag = b < 100;
                uint experiencia_siguiente_nivel;
                if (flag)
                {
                    experiencia_siguiente_nivel = uint.Parse(text.Split(new char[]
                    {
                        ';'
                    })[4]);
                }
                else
                {
                    experiencia_siguiente_nivel = 0U;
                }
                List <Oficio>      oficios = personaje.oficios;
                Predicate <Oficio> match;
                if ((match = < > 9__0) == null)
                {
                    match = (< > 9__0 = ((Oficio x) => x.id == (int)id));
                }
                oficios.Find(match).set_Actualizar_Oficio(b, experiencia_base, experiencia_actual, experiencia_siguiente_nivel);
            }
            personaje.evento_Oficios_Actualizados();
        }
コード例 #16
0
        public void get_Actualizacion_Pods(ClienteTcp cliente, string paquete)
        {
            string[] array = paquete.Substring(2).Split(new char[]
            {
                '|'
            });
            short          pods_actuales = short.Parse(array[0]);
            short          pods_maximos  = short.Parse(array[1]);
            PersonajeJuego personaje     = cliente.cuenta.juego.personaje;

            personaje.inventario.pods_actuales = pods_actuales;
            personaje.inventario.pods_maximos  = pods_maximos;
            cliente.cuenta.juego.personaje.evento_Pods_Actualizados();
        }
コード例 #17
0
        private void caracteristicas_Actualizadas()
        {
            BeginInvoke((Action)(() =>
            {
                PersonajeJuego personaje = cuenta.juego.personaje;

                progresBar_vitalidad.valor_Maximo = personaje.caracteristicas.vitalidad_maxima;
                progresBar_vitalidad.Valor = personaje.caracteristicas.vitalidad_actual;
                progresBar_energia.valor_Maximo = personaje.caracteristicas.maxima_energia;
                progresBar_energia.Valor = personaje.caracteristicas.energia_actual;
                progresBar_experiencia.Text = personaje.nivel.ToString();
                progresBar_experiencia.Valor = personaje.porcentaje_experiencia;
                label_kamas_principal.Text = personaje.kamas.ToString("0,0");
            }));
        }
コード例 #18
0
        // Token: 0x060000DC RID: 220 RVA: 0x00004E9C File Offset: 0x0000329C
        private async Task get_Verificar_Script_Regeneracion()
        {
            Table auto_regeneracion = this.manejador_script.get_Global_Or <Table>("AUTO_REGENERATION", DataType.Table, null);
            bool  flag = auto_regeneracion == null;

            if (!flag)
            {
                PersonajeJuego personaje   = this.cuenta.juego.personaje;
                int            vida_minima = auto_regeneracion.get_Or("VIE_MIN", DataType.Number, 0);
                int            vida_maxima = auto_regeneracion.get_Or("VIE_MAX", DataType.Number, 100);
                bool           flag2       = vida_minima == 0 || personaje.caracteristicas.porcentaje_vida > vida_minima;
                if (!flag2)
                {
                    int        fin_vida            = vida_maxima * personaje.caracteristicas.vitalidad_maxima / 100;
                    int        vida_para_regenerar = fin_vida - personaje.caracteristicas.vitalidad_actual;
                    List <int> objetos             = auto_regeneracion.Get("OBJETS").ToObject <List <int> >();
                    foreach (int id_objeto in objetos)
                    {
                        bool flag3 = vida_para_regenerar < 20;
                        if (flag3)
                        {
                            break;
                        }
                        ObjetosInventario objeto = personaje.inventario.get_Objeto_Modelo_Id(id_objeto);
                        bool flag4 = objeto == null;
                        if (!flag4)
                        {
                            bool flag5 = objeto.vida_regenerada <= 0;
                            if (!flag5)
                            {
                                int cantidad_necesaria = (int)Math.Floor((double)vida_para_regenerar / (double)objeto.vida_regenerada);
                                int cantidad_correcta  = Math.Min(cantidad_necesaria, objeto.cantidad);
                                for (int i = 0; i < cantidad_correcta; i++)
                                {
                                    personaje.inventario.utilizar_Objeto(objeto);
                                    await Task.Delay(800);
                                }
                                vida_para_regenerar -= (int)objeto.vida_regenerada * cantidad_correcta;
                                objeto = null;
                            }
                        }
                    }
                    List <int> .Enumerator enumerator = default(List <int> .Enumerator);
                }
            }
        }
コード例 #19
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    pathfinder.Dispose();
                }

                actual_path?.Clear();
                actual_path = null;
                pathfinder  = null;
                cuenta      = null;
                personaje   = null;
                disposed    = true;
            }
        }
コード例 #20
0
ファイル: ManejadorAcciones.cs プロジェクト: Aetra/BotDofusW
        public ManejadorAcciones(Cuenta _cuenta, LuaManejadorScript _manejador_script)
        {
            cuenta           = _cuenta;
            manejador_script = _manejador_script;
            fila_acciones    = new ConcurrentQueue <AccionesScript>();
            timer_out        = new TimerWrapper(60000, time_Out_Callback);
            PersonajeJuego personaje = cuenta.juego.personaje;

            cuenta.juego.mapa.mapa_actualizado += evento_Mapa_Cambiado;
            cuenta.juego.pelea.pelea_creada    += get_Pelea_Creada;
            cuenta.juego.manejador.movimientos.movimiento_finalizado += evento_Movimiento_Celda;
            personaje.dialogo_npc_recibido += npcs_Dialogo_Recibido;
            personaje.dialogo_npc_acabado  += npcs_Dialogo_Acabado;
            personaje.inventario.almacenamiento_abierto             += iniciar_Almacenamiento;
            personaje.inventario.almacenamiento_cerrado             += cerrar_Almacenamiento;
            cuenta.juego.manejador.recoleccion.recoleccion_iniciada += get_Recoleccion_Iniciada;
            cuenta.juego.manejador.recoleccion.recoleccion_acabada  += get_Recoleccion_Acabada;
        }
コード例 #21
0
        // Token: 0x06000443 RID: 1091 RVA: 0x0000F4FC File Offset: 0x0000D8FC
        private Dictionary <short, ObjetoInteractivo> get_Interactivos_Utilizables(List <short> elementos_ids)
        {
            Dictionary <short, ObjetoInteractivo> dictionary = new Dictionary <short, ObjetoInteractivo>();
            PersonajeJuego    personaje         = this.cuenta.juego.personaje;
            ObjetosInventario objetosInventario = personaje.inventario.get_Objeto_en_Posicion(InventarioPosiciones.CAC);
            byte b     = 1;
            bool flag  = false;
            bool flag2 = objetosInventario != null;

            if (flag2)
            {
                b    = this.get_Distancia_herramienta(objetosInventario.id_modelo);
                flag = Recoleccion.herramientas_pescar.Contains(objetosInventario.id_modelo);
            }
            foreach (ObjetoInteractivo objetoInteractivo in this.mapa.interactivos.Values)
            {
                bool flag3 = !objetoInteractivo.es_utilizable || !objetoInteractivo.modelo.recolectable;
                if (!flag3)
                {
                    List <Celda> list  = this.pathfinder.get_Path(personaje.celda, objetoInteractivo.celda, this.mapa.celdas_ocupadas(), true, b);
                    bool         flag4 = list == null || list.Count == 0;
                    if (!flag4)
                    {
                        foreach (short item in objetoInteractivo.modelo.habilidades)
                        {
                            bool flag5 = !elementos_ids.Contains(item);
                            if (!flag5)
                            {
                                bool flag6 = !flag && list.Last <Celda>().get_Distancia_Entre_Dos_Casillas(objetoInteractivo.celda) > 1;
                                if (!flag6)
                                {
                                    bool flag7 = flag && list.Last <Celda>().get_Distancia_Entre_Dos_Casillas(objetoInteractivo.celda) > (int)b;
                                    if (!flag7)
                                    {
                                        dictionary.Add(objetoInteractivo.celda.id, objetoInteractivo);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(dictionary);
        }
コード例 #22
0
        public void get_Skills_Oficio(ClienteTcp cliente, string paquete)
        {
            string[]       separador_skill;
            PersonajeJuego personaje = cliente.cuenta.juego.personaje;
            Oficio         oficio;
            SkillsOficio   skill = null;
            short          id_oficio, id_skill;
            byte           cantidad_minima, cantidad_maxima;
            float          tiempo;

            foreach (string datos_oficio in paquete.Substring(3).Split('|'))
            {
                id_oficio = short.Parse(datos_oficio.Split(';')[0]);
                oficio    = personaje.oficios.Find(x => x.id == id_oficio);

                if (oficio == null)
                {
                    oficio = new Oficio(id_oficio);
                    personaje.oficios.Add(oficio);
                }

                foreach (string datos_skill in datos_oficio.Split(';')[1].Split(','))
                {
                    separador_skill = datos_skill.Split('~');
                    id_skill        = short.Parse(separador_skill[0]);
                    cantidad_minima = byte.Parse(separador_skill[1]);
                    cantidad_maxima = byte.Parse(separador_skill[2]);
                    tiempo          = float.Parse(separador_skill[4]);
                    skill           = oficio.skills.Find(actividad => actividad.id == id_skill);

                    if (skill != null)
                    {
                        skill.set_Actualizar(id_skill, cantidad_minima, cantidad_maxima, tiempo);
                    }
                    else
                    {
                        oficio.skills.Add(new SkillsOficio(id_skill, cantidad_minima, cantidad_maxima, tiempo));
                    }
                }
            }

            personaje.evento_Oficios_Actualizados();
        }
コード例 #23
0
        private async Task get_Verificar_Sacos()
        {
            if (!manejador_script.get_Global_Or("ABRIR_SACOS", DataType.Boolean, false))
            {
                return;
            }

            PersonajeJuego           personaje = cuenta.juego.personaje;
            List <ObjetosInventario> sacos     = personaje.inventario.objetos.Where(o => o.tipo == 100).ToList();

            if (sacos.Count > 0)
            {
                foreach (ObjetosInventario saco in sacos)
                {
                    personaje.inventario.utilizar_Objeto(saco);
                    await Task.Delay(500);
                }

                cuenta.logger.log_informacion("SCRIPT", $"{sacos.Count} saco(s) abierto(s).");
            }
        }
コード例 #24
0
        public void get_Skills_Oficio(ClienteTcp cliente, string paquete)
        {
            PersonajeJuego personaje = cliente.cuenta.juego.personaje;
            short          id_oficio;
            short          id_skill;

            Predicate <Oficio> < > 9__0;
            Predicate <SkillsOficio> < > 9__1;
            foreach (string text in paquete.Substring(3).Split(new char[]
            {
                '|'
            }))
            {
                id_oficio = short.Parse(text.Split(new char[]
                {
                    ';'
                })[0]);
                List <Oficio>      oficios = personaje.oficios;
                Predicate <Oficio> match;
                if ((match = < > 9__0) == null)
                {
                    match = (< > 9__0 = ((Oficio x) => x.id == (int)id_oficio));
                }
                Oficio oficio = oficios.Find(match);
                bool   flag   = oficio == null;
                if (flag)
                {
                    oficio = new Oficio((int)id_oficio);
                    personaje.oficios.Add(oficio);
                }
                foreach (string text2 in text.Split(new char[]
                {
                    ';'
                })[1].Split(new char[]
                {
                    ','
                }))
                {
                    string[] array3 = text2.Split(new char[]
                    {
                        '~'
                    });
                    id_skill = short.Parse(array3[0]);
                    byte  cantidad_minima           = byte.Parse(array3[1]);
                    byte  cantidad_maxima           = byte.Parse(array3[2]);
                    float tiempo                    = float.Parse(array3[4]);
                    List <SkillsOficio>      skills = oficio.skills;
                    Predicate <SkillsOficio> match2;
                    if ((match2 = < > 9__1) == null)
                    {
                        match2 = (< > 9__1 = ((SkillsOficio actividad) => actividad.id == id_skill));
                    }
                    SkillsOficio skillsOficio = skills.Find(match2);
                    bool         flag2        = skillsOficio != null;
                    if (flag2)
                    {
                        skillsOficio.set_Actualizar(id_skill, cantidad_minima, cantidad_maxima, tiempo);
                    }
                    else
                    {
                        oficio.skills.Add(new SkillsOficio(id_skill, cantidad_minima, cantidad_maxima, tiempo));
                    }
                }
            }
            personaje.evento_Oficios_Actualizados();
        }
コード例 #25
0
        public async Task get_Iniciar_Accion(ClienteTcp cliente, string paquete)
        {
            string[] separador = paquete.Substring(2).Split(new char[]
            {
                ';'
            });
            int            id_accion = int.Parse(separador[1]);
            Cuenta         cuenta    = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;
            bool           flag      = id_accion > 0;

            if (flag)
            {
                int        id_entidad = int.Parse(separador[2]);
                Mapa       mapa       = cuenta.juego.mapa;
                Pelea      pelea      = cuenta.juego.pelea;
                int        num        = id_accion;
                int        num2       = num;
                int        num3       = num2;
                Celda      celda;
                Luchadores luchador;
                if (num3 <= 151)
                {
                    if (num3 <= 102)
                    {
                        switch (num3)
                        {
                        case 1:
                        {
                            celda = mapa.get_Celda_Id(Hash.get_Celda_Id_Desde_hash(separador[3].Substring(separador[3].Length - 2)));
                            bool flag2 = !cuenta.esta_luchando();
                            if (flag2)
                            {
                                bool flag3 = id_entidad == personaje.id && celda.id > 0 && personaje.celda.id != celda.id;
                                if (flag3)
                                {
                                    byte tipo_gkk_movimiento = byte.Parse(separador[0]);
                                    await cuenta.juego.manejador.movimientos.evento_Movimiento_Finalizado(celda, tipo_gkk_movimiento, true);
                                }
                                else
                                {
                                    Entidad entidad;
                                    if (mapa.entidades.TryGetValue(id_entidad, out entidad))
                                    {
                                        entidad.celda = celda;
                                        if (GlobalConf.mostrar_mensajes_debug)
                                        {
                                            cuenta.logger.log_informacion("DEBUG", "Detectado movimiento de una entidad a la casilla: " + celda.id.ToString());
                                        }
                                    }
                                    entidad = null;
                                }
                                mapa.evento_Entidad_Actualizada();
                            }
                            else
                            {
                                luchador = pelea.get_Luchador_Por_Id(id_entidad);
                                if (luchador != null)
                                {
                                    luchador.celda = celda;
                                    if (luchador.id == personaje.id)
                                    {
                                        byte tipo_gkk_movimiento = byte.Parse(separador[0]);
                                        await Task.Delay(400 + 100 *personaje.celda.get_Distancia_Entre_Dos_Casillas(celda));

                                        cuenta.conexion.enviar_Paquete("GKK" + tipo_gkk_movimiento.ToString(), false);
                                    }
                                }
                            }
                            break;
                        }

                        case 2:
                        case 3:
                            break;

                        case 4:
                            separador = separador[3].Split(new char[]
                            {
                                ','
                            });
                            celda = mapa.get_Celda_Id(short.Parse(separador[1]));
                            if (!cuenta.esta_luchando() && id_entidad == personaje.id && celda.id > 0 && personaje.celda.id != celda.id)
                            {
                                personaje.celda = celda;
                                await Task.Delay(150);

                                cuenta.conexion.enviar_Paquete("GKK1", false);
                                mapa.evento_Entidad_Actualizada();
                                cuenta.juego.manejador.movimientos.movimiento_Actualizado(true);
                            }
                            break;

                        case 5:
                            if (cuenta.esta_luchando())
                            {
                                separador = separador[3].Split(new char[]
                                {
                                    ','
                                });
                                luchador = pelea.get_Luchador_Por_Id(int.Parse(separador[0]));
                                if (luchador != null)
                                {
                                    luchador.celda = mapa.get_Celda_Id(short.Parse(separador[1]));
                                }
                            }
                            break;

                        default:
                            if (num3 == 102)
                            {
                                if (cuenta.esta_luchando())
                                {
                                    luchador = pelea.get_Luchador_Por_Id(id_entidad);
                                    byte pa_utilizados = byte.Parse(separador[3].Split(new char[]
                                    {
                                        ','
                                    })[1].Substring(1));
                                    if (luchador != null)
                                    {
                                        Luchadores luchadores = luchador;
                                        luchadores.pa -= pa_utilizados;
                                    }
                                }
                            }
                            break;
                        }
                    }
                    else if (num3 != 103)
                    {
                        if (num3 != 129)
                        {
                            if (num3 == 151)
                            {
                                if (cuenta.esta_luchando())
                                {
                                    luchador = pelea.get_Luchador_Por_Id(id_entidad);
                                    if (luchador != null && luchador.id == personaje.id)
                                    {
                                        cuenta.logger.log_Error("INFORMATION", "No es posible realizar esta acción por culpa de un obstáculo invisible.");
                                        pelea.get_Hechizo_Lanzado(short.Parse(separador[3]), false);
                                    }
                                }
                            }
                        }
                        else if (cuenta.esta_luchando())
                        {
                            luchador = pelea.get_Luchador_Por_Id(id_entidad);
                            byte pm_utilizados = byte.Parse(separador[3].Split(new char[]
                            {
                                ','
                            })[1].Substring(1));
                            if (luchador != null)
                            {
                                Luchadores luchadores2 = luchador;
                                luchadores2.pm -= pm_utilizados;
                            }
                            if (luchador.id == personaje.id)
                            {
                                pelea.get_Movimiento_Exito(true);
                            }
                        }
                    }
                    else if (cuenta.esta_luchando())
                    {
                        int id_muerto = int.Parse(separador[3]);
                        luchador = pelea.get_Luchador_Por_Id(id_muerto);
                        if (luchador != null)
                        {
                            luchador.esta_vivo = false;
                        }
                    }
                }
                else if (num3 <= 300)
                {
                    if (num3 != 181)
                    {
                        if (num3 == 300)
                        {
                            if (cuenta.esta_luchando() && id_entidad == cuenta.juego.personaje.id)
                            {
                                short celda_id_lanzado = short.Parse(separador[3].Split(new char[]
                                {
                                    ','
                                })[1]);
                                pelea.get_Hechizo_Lanzado(celda_id_lanzado, true);
                            }
                        }
                    }
                    else
                    {
                        celda = mapa.get_Celda_Id(short.Parse(separador[3].Substring(1)));
                        short id_luchador = short.Parse(separador[6]);
                        short vida        = short.Parse(separador[15]);
                        byte  pa          = byte.Parse(separador[16]);
                        byte  pm          = byte.Parse(separador[17]);
                        byte  equipo      = byte.Parse(separador[25]);
                        pelea.get_Agregar_Luchador(new Luchadores((int)id_luchador, true, (int)vida, pa, pm, celda, (int)vida, equipo, id_entidad));
                    }
                }
                else if (num3 != 302)
                {
                    if (num3 != 501)
                    {
                        if (num3 == 900)
                        {
                            cuenta.conexion.enviar_Paquete("GA902" + id_entidad.ToString(), true);
                            cuenta.logger.log_informacion("INFORMATION", "Desafio del personaje id: " + id_entidad.ToString() + " cancelado");
                        }
                    }
                    else
                    {
                        int tiempo_recoleccion = int.Parse(separador[3].Split(new char[]
                        {
                            ','
                        })[1]);
                        celda = mapa.get_Celda_Id(short.Parse(separador[3].Split(new char[]
                        {
                            ','
                        })[0]));
                        byte tipo_gkk_recoleccion = byte.Parse(separador[0]);
                        await cuenta.juego.manejador.recoleccion.evento_Recoleccion_Iniciada(id_entidad, tiempo_recoleccion, celda.id, tipo_gkk_recoleccion);
                    }
                }
                else if (cuenta.esta_luchando() && id_entidad == cuenta.juego.personaje.id)
                {
                    pelea.get_Hechizo_Lanzado(0, false);
                }
                celda    = null;
                luchador = null;
                mapa     = null;
                pelea    = null;
            }
        }
コード例 #26
0
ファイル: MapaFrame.cs プロジェクト: Aetra/BotDofusW
        public async Task get_Iniciar_Accion(ClienteTcp cliente, string paquete)
        {
            string[]       separador = paquete.Substring(2).Split(';');
            int            id_accion = int.Parse(separador[1]);
            Cuenta         cuenta    = cliente.cuenta;
            PersonajeJuego personaje = cuenta.juego.personaje;

            if (id_accion > 0)
            {
                int        id_entidad = int.Parse(separador[2]);
                byte       tipo_gkk_movimiento;
                Celda      celda;
                Luchadores luchador;
                Mapa       mapa  = cuenta.juego.mapa;
                Pelea      pelea = cuenta.juego.pelea;

                switch (id_accion)
                {
                case 1:
                    celda = mapa.get_Celda_Id(Hash.get_Celda_Id_Desde_hash(separador[3].Substring(separador[3].Length - 2)));

                    if (!cuenta.esta_luchando())
                    {
                        if (id_entidad == personaje.id && celda.id > 0 && personaje.celda.id != celda.id)
                        {
                            tipo_gkk_movimiento = byte.Parse(separador[0]);

                            await cuenta.juego.manejador.movimientos.evento_Movimiento_Finalizado(celda, tipo_gkk_movimiento, true);
                        }
                        else if (mapa.entidades.TryGetValue(id_entidad, out Entidad entidad))
                        {
                            entidad.celda = celda;

                            if (GlobalConf.mostrar_mensajes_debug)
                            {
                                cuenta.logger.log_informacion("DEBUG", "movimiento détecté d'une entité vers la cellule : " + celda.id);
                            }
                        }
                        mapa.evento_Entidad_Actualizada();
                    }
                    else
                    {
                        luchador = pelea.get_Luchador_Por_Id(id_entidad);
                        if (luchador != null)
                        {
                            luchador.celda = celda;

                            if (luchador.id == personaje.id)
                            {
                                tipo_gkk_movimiento = byte.Parse(separador[0]);

                                await Task.Delay(400 + (100 * personaje.celda.get_Distancia_Entre_Dos_Casillas(celda)));

                                cuenta.conexion.enviar_Paquete("GKK" + tipo_gkk_movimiento);
                            }
                        }
                    }
                    break;

                case 4:
                    separador = separador[3].Split(',');
                    celda     = mapa.get_Celda_Id(short.Parse(separador[1]));

                    if (!cuenta.esta_luchando() && id_entidad == personaje.id && celda.id > 0 && personaje.celda.id != celda.id)
                    {
                        personaje.celda = celda;
                        await Task.Delay(150);

                        cuenta.conexion.enviar_Paquete("GKK1");
                        mapa.evento_Entidad_Actualizada();
                        cuenta.juego.manejador.movimientos.movimiento_Actualizado(true);
                    }
                    break;

                case 5:
                    if (cuenta.esta_luchando())
                    {
                        separador = separador[3].Split(',');
                        luchador  = pelea.get_Luchador_Por_Id(int.Parse(separador[0]));

                        if (luchador != null)
                        {
                            luchador.celda = mapa.get_Celda_Id(short.Parse(separador[1]));
                        }
                    }
                    break;

                case 102:
                    if (cuenta.esta_luchando())
                    {
                        luchador = pelea.get_Luchador_Por_Id(id_entidad);
                        byte pa_utilizados = byte.Parse(separador[3].Split(',')[1].Substring(1));

                        if (luchador != null)
                        {
                            luchador.pa -= pa_utilizados;
                        }
                    }
                    break;

                case 103:
                    if (cuenta.esta_luchando())
                    {
                        int id_muerto = int.Parse(separador[3]);

                        luchador = pelea.get_Luchador_Por_Id(id_muerto);
                        if (luchador != null)
                        {
                            luchador.esta_vivo = false;
                        }
                    }
                    break;

                case 129:     //movimiento en pelea con exito
                    if (cuenta.esta_luchando())
                    {
                        luchador = pelea.get_Luchador_Por_Id(id_entidad);
                        byte pm_utilizados = byte.Parse(separador[3].Split(',')[1].Substring(1));

                        if (luchador != null)
                        {
                            luchador.pm -= pm_utilizados;
                        }

                        if (luchador.id == personaje.id)
                        {
                            pelea.get_Movimiento_Exito(true);
                        }
                    }
                    break;

                case 151:    //obstaculos invisibles
                    if (cuenta.esta_luchando())
                    {
                        luchador = pelea.get_Luchador_Por_Id(id_entidad);

                        if (luchador != null && luchador.id == personaje.id)
                        {
                            cuenta.logger.log_Error("INFORMATION", "Il n'est pas possible d'effectuer cette action à cause d'un obstacle invisible.");
                            pelea.get_Hechizo_Lanzado(short.Parse(separador[3]), false);
                        }
                    }
                    break;

                case 181:     //efecto de invocacion (pelea)
                    celda = mapa.get_Celda_Id(short.Parse(separador[3].Substring(1)));
                    short id_luchador = short.Parse(separador[6]);
                    short vida        = short.Parse(separador[15]);
                    byte  pa          = byte.Parse(separador[16]);
                    byte  pm          = byte.Parse(separador[17]);
                    byte  equipo      = byte.Parse(separador[25]);

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

                case 302:    //fallo critico
                    if (cuenta.esta_luchando() && id_entidad == cuenta.juego.personaje.id)
                    {
                        pelea.get_Hechizo_Lanzado(0, false);
                    }
                    break;

                case 300:     //hechizo lanzado con exito
                    if (cuenta.esta_luchando() && id_entidad == cuenta.juego.personaje.id)
                    {
                        short celda_id_lanzado = short.Parse(separador[3].Split(',')[1]);
                        pelea.get_Hechizo_Lanzado(celda_id_lanzado, true);
                    }
                    break;

                case 501:
                    int tiempo_recoleccion = int.Parse(separador[3].Split(',')[1]);
                    celda = mapa.get_Celda_Id(short.Parse(separador[3].Split(',')[0]));
                    byte tipo_gkk_recoleccion = byte.Parse(separador[0]);

                    await cuenta.juego.manejador.recoleccion.evento_Recoleccion_Iniciada(id_entidad, tiempo_recoleccion, celda.id, tipo_gkk_recoleccion);

                    break;

                case 900:
                    cuenta.conexion.enviar_Paquete("GA902" + id_entidad, true);
                    cuenta.logger.log_informacion("INFORMATION", "Le défi avec le personnage ID : " + id_entidad + " est annulée");
                    break;
                }
            }
        }
コード例 #27
0
ファイル: Manejador.cs プロジェクト: Aetra/BotDofusW
 public Manejador(Cuenta cuenta, Mapa mapa, PersonajeJuego personaje)
 {
     movimientos = new Movimiento(cuenta, mapa, personaje);
     recoleccion = new Recoleccion(cuenta, movimientos, mapa);
 }