Esempio n. 1
0
 private void ConfigurarSala()
 {
     try
     {
         int    x    = 11;
         int    y    = 11;
         string mapa = string.Empty;
         using (mysql client = new mysql())
         {
             client.SetParameter("id", Escenario.modelo);
             if (Escenario.es_categoria == 2)//mgame
             {
                 DataRow row = client.ExecuteQueryRow("SELECT * FROM mapas_mgame WHERE id = @id");
                 if (row != null)
                 {
                     mapa = (string)row["mapa"];
                 }
             }
             if (Escenario.es_categoria == 1)//publico
             {
                 DataRow row = client.ExecuteQueryRow("SELECT * FROM mapas_publicos WHERE id = @id");
                 if (row != null)
                 {
                     x    = (int)row["PosX"];
                     y    = (int)row["PosY"];
                     mapa = (string)row["mapa"];
                 }
             }
             if (Escenario.es_categoria == 0)//privado
             {
                 DataRow row = client.ExecuteQueryRow("SELECT * FROM mapas_privados WHERE id = @id");
                 if (row != null)
                 {
                     x    = (int)row["PosX"];
                     y    = (int)row["PosY"];
                     mapa = (string)row["mapa"];
                 }
             }
             this.Puerta = new Posicion(x, y);
             string[] MapaString = mapa.Split(Convert.ToChar("\n"));
             this.Map      = new Chutas[MapaString.Length, MapaString[0].Length];
             this.MapSizeX = MapaString.Length;
             this.MapSizeY = MapaString[0].Length;
             for (int Y = 0; Y < MapaString.Length - 1; Y++)
             {
                 for (int X = 0; X < MapaString[0].Length; X++)
                 {
                     this.Map[Y, X] = (MapaString[Y][X] == '0') ? new Chutas(true) : new Chutas(false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Output.WriteLine(ex.ToString()); Program.EditorialResponse(ex);
     }
 }
Esempio n. 2
0
 static void Validar_Clave_Acceso(SessionInstance Session, string[,] Parameters)
 {
     if (Session.User != null)
     {
         if (Session.User.PreLock__Proteccion_SQL == true)
         {
             return;
         }
         if (Session.User.Sala != null)
         {
             return;
         }
         mysql   client = new mysql();
         DataRow row    = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE id = '" + int.Parse(Parameters[0, 0]) + "'");
         if (row != null)
         {
             EscenarioInstance Escenario = new EscenarioInstance(row);
             if (Escenario.categoria != 2)
             {
                 return;
             }
             if (!string.IsNullOrEmpty(Escenario.Clave))
             {
                 if (Escenario.Clave != Parameters[1, 0])
                 {
                     Packet_189_123(Session);
                     return;
                 }
             }
             SalasManager.IrAlli(Session, Escenario.es_categoria, Escenario.id, null, true);
         }
         Session.User.PreLock__Proteccion_SQL = true;
     }
 }
Esempio n. 3
0
 private static void Primer_Usuario_Manager(SessionInstance Session, int Item, bool pm, string Mensaje, int x, int y)
 {
     using (mysql efecto = new mysql())
     {
         DataRow ver_objeto = efecto.ExecuteQueryRow("SELECT * FROM objetos WHERE id = '" + Item + "'");
         if (ver_objeto != null)
         {
             string categoria_objeto = (string)ver_objeto["categoria"];
             string nombre_objeto    = (string)ver_objeto["titulo"];
             if (categoria_objeto.Contains("7") || categoria_objeto.Contains("8"))
             {
                 Packet_133(Session, string.Format("{0} abre un " + nombre_objeto + "", Session.User.nombre), true);
             }
             else if (categoria_objeto.Contains("4"))
             {
                 Packet_133(Session, string.Format("{0} consume una poción de " + nombre_objeto + "", Session.User.nombre), true);
             }
             else
             {
                 Packet_133(Session, string.Format("{0} consume una pocion", Session.User.nombre), true);
             }
             Pociones_Manager(Session, Item, Session.User.id, pm, Mensaje, x, y);
         }
     }
 }
Esempio n. 4
0
        private static void Otro_Usuario_Manager(SessionInstance Session, int Item, int id_USUARIO, bool pm, string Mensaje)
        {
            SessionInstance OtherSession = UserManager.ObtenerSession(id_USUARIO);

            if (OtherSession == null)
            {
                return;
            }
            using (mysql efecto = new mysql())
            {
                DataRow ver_objeto = efecto.ExecuteQueryRow("SELECT * FROM objetos WHERE id = '" + Item + "'");
                if (ver_objeto != null)
                {
                    string categoria_objeto = (string)ver_objeto["categoria"];
                    string nombre_objeto    = (string)ver_objeto["titulo"];
                    OtherSession.User.Trayectoria.DetenerMovimiento();
                    if (categoria_objeto.Contains("7") || categoria_objeto.Contains("8"))
                    {
                        Packet_133(Session, string.Format("{0} entrega un " + nombre_objeto + " a {1}", Session.User.nombre, OtherSession.User.nombre), true);
                    }
                    else if (categoria_objeto.Contains("4"))
                    {
                        Packet_133(Session, string.Format("{0} lanza una poción de " + nombre_objeto + " a {1}", Session.User.nombre, OtherSession.User.nombre), true);
                    }
                    else
                    {
                        Packet_133(Session, string.Format("{0} envía una pocion a {1}", Session.User.nombre, OtherSession.User.nombre), true);
                    }
                    Pociones_Manager(Session, Item, OtherSession.User.id, pm, Mensaje, 0, 0);
                }
            }
        }
Esempio n. 5
0
        public static void cargar_planta(SessionInstance Session, BuyObjectInstance objeto)
        {
            mysql client = new mysql();

            client.SetParameter("id", objeto.id);
            DataRow           objetos_comprado = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE id = @id");
            BuyObjectInstance Compra           = CatalogoManager.ObtenerCompra((int)objetos_comprado["id"]);

            if (Compra.Planta_agua - Compra.Planta_sol < 0 && Time.GetDifference(Compra.Planta_sol) <= 0)//planta murio
            {
                Compra.Planta_agua = 0;
                Compra.Planta_sol  = 0;
                planta_sql(Compra);
                return;
            }
            if (Time.GetDifference(Compra.Planta_sol) <= 0 && Time.GetDifference(Compra.Planta_agua) > 0 && Compra.Planta_sol != 0)//Planta ha crecido
            {
                Compra.Planta_agua = 0;
                Compra.Planta_sol  = 0;
                planta_sql(Compra);
                actualizar_planta(Compra.id, Compra, Session);
                return;
            }
            if (Time.GetDifference(Compra.Planta_agua) <= 0)//Planta ha muerto
            {
                Compra.Planta_agua = 0;
                Compra.Planta_sol  = 0;
                planta_sql(Compra);
                return;
            }
            new Thread(() => Packet_189_173(Session, Compra)).Start();
        }
Esempio n. 6
0
 static void Poner_Clave(SessionInstance Session, string[,] Parameters)
 {
     if (Session.User != null)
     {
         if (Session.User.PreLock__Proteccion_SQL == true)
         {
             return;
         }
         if (Session.User.Sala != null)
         {
             return;
         }
         mysql   client = new mysql();
         DataRow row    = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE id = '" + int.Parse(Parameters[1, 0]) + "'");
         if (row != null)
         {
             EscenarioInstance Escenario = new EscenarioInstance(row);
             if (Escenario.Creador.id == Session.User.id || Session.User.admin == 1)
             {
                 if (client.ExecuteNonQuery("UPDATE escenarios_privados SET clave = '" + Parameters[2, 0] + "' WHERE id = '" + Escenario.id + "'") == 1)
                 {
                     if (SalasManager.Salas_Privadas.ContainsKey(int.Parse(Parameters[1, 0])))
                     {
                         SalaInstance Sala = SalasManager.Salas_Privadas[int.Parse(Parameters[1, 0])];
                         Sala.Escenario.Clave = Parameters[2, 0];
                     }
                 }
             }
         }
         Session.User.PreLock__Proteccion_SQL = true;
     }
 }
Esempio n. 7
0
        public static List <int> BB_Managers = new List <int>();///Listado de actividades de eventos y rankings del juego

        static void BoomBang_Managers(mysql client)
        {
            DataRow managers = client.ExecuteQueryRow("SELECT proximo_evento, tiempo_evento, tipo_evento, loteria_semanal, ranking_semanal FROM bb_managers ORDER BY id DESC LIMIT 1");

            if (managers != null)
            {
                BB_Managers = new List <int> {
                    (int)managers["proximo_evento"], (int)managers["tiempo_evento"], (int)managers["tipo_evento"], (int)managers["loteria_semanal"], (int)managers["ranking_semanal"]
                };
            }
        }
Esempio n. 8
0
        private static void Com_Obj_Much(SessionInstance Session, int id_object, int count, bool status)
        {
            mysql client = new mysql();

            if (status == false)
            {
                for (int id = 0; id < count; id++)
                {
                    client.SetParameter("user", Session.User.id);
                    client.SetParameter("item", id_object);
                    client.ExecuteNonQuery("DELETE FROM objetos_comprados where objeto_id = @item AND usuario_id = @user LIMIT 1");
                    ServerMessage server = new ServerMessage();
                    server.AddHead(189);
                    server.AddHead(169);
                    server.AppendParameter(-1);
                    server.AppendParameter(id_object);
                    server.AppendParameter(1);
                    Session.SendData(server);
                }
            }
            else
            {
                client.SetParameter("id", id_object);
                DataRow row = client.ExecuteQueryRow("SELECT * FROM objetos WHERE id = @id");
                CatalogObjectInstance item = new CatalogObjectInstance(row);
                client.SetParameter("item_id", id_object);
                client.SetParameter("userid", Session.User.id);
                client.SetParameter("hex", item.colores_hex);
                client.SetParameter("rgb", item.colores_rgb);
                client.SetParameter("tam", "tam_n");
                client.SetParameter("default_data", 0);
                if (client.ExecuteNonQuery("INSERT INTO objetos_comprados (`objeto_id`, `colores_hex`, `colores_rgb`, `usuario_id`, `tam`, `data`) VALUES (@item_id, @hex, @rgb, @userid, @tam, @default_data)") == 1)
                {
                    client.SetParameter("id", id_object);
                    client.SetParameter("UserID", Session.User.id);
                    int           compra_id      = int.Parse(Convert.ToString(client.ExecuteScalar("SELECT MAX(id) FROM objetos_comprados WHERE objeto_id = @id AND usuario_id = @UserID")));
                    ServerMessage añadir_mochila = new ServerMessage();
                    añadir_mochila.AddHead(189);
                    añadir_mochila.AddHead(139);
                    añadir_mochila.AppendParameter(compra_id);
                    añadir_mochila.AppendParameter(id_object);
                    añadir_mochila.AppendParameter(item.colores_hex);
                    añadir_mochila.AppendParameter(item.colores_rgb);
                    añadir_mochila.AppendParameter(0);
                    añadir_mochila.AppendParameter(0);
                    añadir_mochila.AppendParameter(0);
                    añadir_mochila.AppendParameter("tam_n");
                    añadir_mochila.AppendParameter(0);
                    añadir_mochila.AppendParameter(0);
                    añadir_mochila.AppendParameter(1);//CantidadObjetos
                    Session.SendData(añadir_mochila);
                }
            }
        }
Esempio n. 9
0
 static bool MandarSolicitud(SessionInstance Session, UserInstance User)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("MyID", Session.User.id);
         client.SetParameter("OtherID", User.id);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM bpad_amigos WHERE (ID_1 = @OtherID AND ID_2 = @MyID)");
         if (row == null)
         {
             DataRow comprobar = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE id = '" + User.id + "'");
             if (comprobar != null)
             {
                 client.SetParameter("MyID", Session.User.id);
                 client.SetParameter("OtherID", User.id);
                 client.ExecuteNonQuery("INSERT INTO bpad_amigos (`ID_1`, `ID_2`) VALUES (@OtherID, @MyID)");
             }
             return(true);
         }
     }
     return(false);
 }
Esempio n. 10
0
        private static void handler_120146(SessionInstance Session, string nombre)
        {
            mysql   client = new mysql();
            DataRow objeto = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE objeto_id = '3065' AND usuario_id = '" + Session.User.id + "'");

            if (objeto != null)
            {
                DataRow comprobar_nombre = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE nombre = '" + nombre + "'");
                if (comprobar_nombre != null)
                {
                    Packet_120_146(Session, 0);
                    return;
                }
                client.ExecuteNonQuery("UPDATE usuarios SET nombre_antiguo = '" + Session.User.nombre + "' WHERE id = '" + Session.User.id + "'");
                client.ExecuteNonQuery("UPDATE usuarios SET nombre = '" + nombre + "' WHERE id = '" + Session.User.id + "'");
                client.ExecuteNonQuery("UPDATE usuarios SET cambio_nombre = '0' WHERE id = '" + Session.User.id + "'");
                client.ExecuteNonQuery("DELETE FROM objetos_comprados WHERE objeto_id = '3065' AND usuario_id = '" + Session.User.id + "' LIMIT 1");
                Session.User.nombre = nombre;
                Packet_120_146(Session, 1);
                Packet_189_169(Session, -1, 3065);
            }
        }
Esempio n. 11
0
 public static IslaInstance ObtenerIsla(int id)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", id);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM islas WHERE id = @id");
         if (row != null)
         {
             return(new IslaInstance(row));
         }
     }
     return(null);
 }
Esempio n. 12
0
 public static BuyObjectInstance ObtenerCompra(int id)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", id);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE id = @id");
         if (row != null)
         {
             return(new BuyObjectInstance(row));
         }
     }
     return(null);
 }
Esempio n. 13
0
 public static IslaInstance ObtenerIsla(string nombre)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("nombre", nombre);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM islas WHERE nombre = @nombre");
         if (row != null)
         {
             return(new IslaInstance(row));
         }
     }
     return(null);
 }
Esempio n. 14
0
 private static EscenarioInstance Obtener_Privado(int id)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", id);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE id = @id");
         if (row != null)
         {
             return(new EscenarioInstance(row));
         }
     }
     return(null);
 }
Esempio n. 15
0
        public static UserInstance ObtenerUsuario(string nombre)
        {
            mysql client = new mysql();

            client.SetParameter("nombre", nombre);
            DataRow usuario = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE nombre = @nombre");

            if (usuario != null)
            {
                UserInstance user = new UserInstance(usuario);
                return(user);
            }
            return(null);
        }
Esempio n. 16
0
 public static int GetZoneID(int UserID, int RoomID)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("User", UserID);
         client.SetParameter("modelo", Get_modelo_ByID(RoomID));
         DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE categoria = '4' AND modelo = @modelo AND CreadorID = @User");
         if (row != null)
         {
             return((int)row["id"]);
         }
     }
     return(0);
 }
Esempio n. 17
0
 private static bool EsAmigo(int Emisor, int Receptor)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("MyID", Emisor);
         client.SetParameter("OtherID", Receptor);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM bpad_amigos WHERE ID_1 = @MyID AND ID_2 = @OtherID AND Solicitud = 0");
         if (row != null)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 18
0
 public static UserInstance ObtenerUsuario(int id)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", id);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE id = @id");
         if (row != null)
         {
             UserInstance user = new UserInstance(row);
             return(user);
         }
     }
     return(null);
 }
Esempio n. 19
0
 public static EscenarioInstance ObtenerCasa(string nombre)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("nombre", nombre);
         client.SetParameter("modelo", 25);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE nombre = @nombre AND modelo = @modelo");
         if (row != null)
         {
             return(new EscenarioInstance(row));
         }
     }
     return(null);
 }
Esempio n. 20
0
 public static SalaInstance Buscar_Juego(int ID)
 {
     foreach (SalaInstance Sala in CocosLocos.Values)
     {
         if (Sala.Escenario.id != ID)
         {
             continue;
         }
         if (Sala.Usuarios.Count >= Sala.Escenario.max_visitantes)
         {
             continue;
         }
         if (Sala.Entrable == false)
         {
             continue;
         }
         return(Sala);
     }
     using (mysql client = new mysql())
     {
         client.SetParameter("id", ID);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios_mgame WHERE id = @id");
         if (row != null)
         {
             while (CocosLocos.ContainsKey(Cocos_Today))
             {
                 Cocos_Today++;
             }
             CocosLocos.Add(Cocos_Today, new SalaInstance(Cocos_Today, new EscenarioInstance(row)));
             foreach (SalaInstance Sala in CocosLocos.Values)
             {
                 if (Sala.Escenario.id != ID)
                 {
                     continue;
                 }
                 if (Sala.Usuarios.Count >= Sala.Escenario.max_visitantes)
                 {
                     continue;
                 }
                 if (Sala.Entrable == false)
                 {
                     continue;
                 }
                 return(Sala);
             }
         }
     }
     return(null);
 }
Esempio n. 21
0
        public static UserInstance ObtenerUsuario(string nombre, string contraseña)
        {
            mysql client = new mysql();

            client.SetParameter("nombre", nombre);
            client.SetParameter("password", Gcrypt(contraseña));
            DataRow usuario = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE nombre = @nombre AND password = @password LIMIT 1");

            if (usuario != null)
            {
                UserInstance user = new UserInstance(usuario);
                return(user);
            }
            return(null);
        }
Esempio n. 22
0
 static bool AceptarSolicitud(SessionInstance Session, UserInstance User)
 {
     using (mysql client = new mysql())
     {
         DataRow comprobar = client.ExecuteQueryRow("SELECT * FROM usuarios WHERE id = '" + User.id + "'");
         if (comprobar != null)
         {
             client.SetParameter("MyID", Session.User.id);
             client.SetParameter("FriendID", User.id);
             client.ExecuteNonQuery("INSERT INTO bpad_amigos (`ID_1`, `ID_2`, `Solicitud`) VALUES (@FriendID, @MyID, 0)");
             client.SetParameter("MyID", Session.User.id);
             client.SetParameter("FriendID", User.id);
             client.ExecuteNonQuery("UPDATE bpad_amigos SET Solicitud = '0' WHERE ID_1 = @MyID AND ID_2 = @FriendID");
         }
     }
     return(true);
 }
Esempio n. 23
0
 static void AñadirFavorito(SessionInstance Session, string[,] Parameters)
 {
     if (Session.User != null)
     {
         if (Session.User.Sala != null)
         {
             return;
         }
         mysql   client    = new mysql();
         DataRow favoritos = client.ExecuteQueryRow("SELECT * FROM escenarios_favoritos WHERE user_id = '" + Session.User.id + "' AND sala_id = '" + int.Parse(Parameters[1, 0]) + "'");
         if (favoritos != null)
         {
             return;
         }
         client.ExecuteNonQuery("INSERT INTO escenarios_favoritos (`user_id`, `sala_id`) VALUES ('" + Session.User.id + "', '" + int.Parse(Parameters[1, 0]) + "')");
     }
 }
Esempio n. 24
0
 public static void EliminarIsla(IslaInstance Isla)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", Isla.id);
         client.ExecuteNonQuery("DELETE FROM Islas WHERE id = @id");
         DataRow ver_islas_favoritas = client.ExecuteQueryRow("SELECT * FROM escenarios_favoritos WHERE sala_id = '" + Isla.id + "'");
         if (ver_islas_favoritas != null)
         {
             client.ExecuteNonQuery("DELETE FROM escenarios_favoritos WHERE sala_id = '" + Isla.id + "'");
         }
     }
     foreach (EscenarioInstance Zona in ZonasIsla(Isla))
     {
         EscenariosManager.EliminarEscenario(Zona);
     }
     Diccionario_EliminarIsla(Isla);
 }
Esempio n. 25
0
 static void EliminarFavorito(SessionInstance Session, string[,] Parameters)
 {
     if (Session.User != null)
     {
         if (Session.User.Sala != null)
         {
             return;
         }
         if (Session.User.id != int.Parse(Parameters[0, 0]))
         {
             return;
         }
         mysql client = new mysql();
         if (client.ExecuteQueryRow("SELECT * FROM escenarios_favoritos WHERE user_id = '" + Session.User.id + "' AND sala_id = '" + int.Parse(Parameters[1, 0]) + "'") != null)
         {
             client.ExecuteNonQuery("DELETE FROM escenarios_favoritos WHERE user_id = '" + Session.User.id + "' AND sala_id = '" + int.Parse(Parameters[1, 0]) + "'");
         }
     }
 }
Esempio n. 26
0
 static void MostrarNoticia(SessionInstance Session, string[,] Parameters)
 {
     if (Session.User != null)
     {
         if (Session.User.Sala != null)
         {
             return;
         }
         mysql   client = new mysql();
         DataRow row    = client.ExecuteQueryRow("SELECT * FROM noticias WHERE id = '" + int.Parse(Parameters[1, 0]) + "'");
         if (row != null)
         {
             Packet_208_121(Session, row);
             Session.User.novedades_noticias = 0;
             client.ExecuteNonQuery("UPDATE usuarios SET novedades_noticias = 0 WHERE id = " + Session.User.id + "");
         }
         Session.User.PreLock__Proteccion_SQL = true;
     }
 }
Esempio n. 27
0
        public static List <IslaInstance> ObtenerIslasFavoritos(int id)
        {
            List <IslaInstance> Islas = new List <IslaInstance>();

            using (mysql client = new mysql())
            {
                client.SetParameter("id", id);
                foreach (DataRow row in client.ExecuteQueryTable("SELECT * FROM escenarios_favoritos WHERE user_id = @id").Rows)
                {
                    client.SetParameter("id", row["sala_id"]);
                    DataRow row2 = client.ExecuteQueryRow("SELECT * FROM islas WHERE id = @id");
                    if (row2 != null)
                    {
                        Islas.Add(new IslaInstance(row2));
                    }
                }
            }
            return(Islas);
        }
Esempio n. 28
0
        static void CreacionObjeto(SessionInstance Session, string[,] Parameters)
        {
            mysql client  = new mysql();
            int   funcion = int.Parse(Parameters[0, 0]);

            if (funcion == 22)//Santa claus de bosque nevada
            {
                npc_packet_manager(Session, 22);
                return;
            }
            if (funcion == 20)//Duende de cueva de bosque nevada
            {
                npc_packet_manager(Session, 20);
                return;
            }
            DataRow sala_id_npc = client.ExecuteQueryRow("SELECT * FROM escenarios_npc WHERE EscenarioID = '" + Session.User.Sala.Escenario.id + "'");

            if (sala_id_npc != null)
            {
                npc_packet_manager(Session, (int)sala_id_npc["function"]);
            }
        }
Esempio n. 29
0
 public static bool EntregarLiana(SessionInstance Session, int Objeto)
 {
     using (mysql client = new mysql())
     {
         client.SetParameter("id", Objeto);
         DataRow row = client.ExecuteQueryRow("SELECT * FROM objetos WHERE id = @id");
         CatalogObjectInstance item = new CatalogObjectInstance(row);
         client.SetParameter("item_id", Objeto);
         client.SetParameter("userid", Session.User.id);
         client.SetParameter("hex", item.colores_hex);
         client.SetParameter("rgb", item.colores_rgb);
         client.SetParameter("tam", "tam_n");
         client.SetParameter("default_data", 0);
         if (client.ExecuteNonQuery("INSERT INTO objetos_comprados (`objeto_id`, `colores_hex`, `colores_rgb`, `usuario_id`, `tam`, `data`) VALUES (@item_id, @hex, @rgb, @userid, @tam, @default_data)") == 1)
         {
             client.SetParameter("id", Objeto);
             client.SetParameter("UserID", Session.User.id);
             int           compra_id      = int.Parse(Convert.ToString(client.ExecuteScalar("SELECT MAX(id) FROM objetos_comprados WHERE objeto_id = @id AND usuario_id = @UserID")));
             ServerMessage añadir_mochila = new ServerMessage();
             añadir_mochila.AddHead(189);
             añadir_mochila.AddHead(139);
             añadir_mochila.AppendParameter(compra_id);
             añadir_mochila.AppendParameter(Objeto);
             añadir_mochila.AppendParameter(item.colores_hex);
             añadir_mochila.AppendParameter(item.colores_rgb);
             añadir_mochila.AppendParameter(0);
             añadir_mochila.AppendParameter(0);
             añadir_mochila.AppendParameter(0);
             añadir_mochila.AppendParameter("tam_n");
             añadir_mochila.AppendParameter(0);
             añadir_mochila.AppendParameter(0);
             añadir_mochila.AppendParameter(1);//CantidadObjetos
             Session.SendData(añadir_mochila);
         }
     }
     return(false);
 }
Esempio n. 30
0
        private static void Pociones_Manager(SessionInstance Session, int Item, int ID_Usuario, bool pajarito_mensajero, string Mensaje, int x, int y)
        {
            mysql           client       = new mysql();
            SessionInstance OtherSession = UserManager.ObtenerSession(ID_Usuario);

            if (OtherSession == null)
            {
                return;
            }
            OtherSession.User.Trayectoria.DetenerMovimiento();
            OtherSession.User.Time_Interactuando = Time.GetCurrentAndAdd(AddType.Segundos, 4);
            DataRow ver_objeto = client.ExecuteQueryRow("SELECT swf,efecto_id,tiempo_pocion FROM objetos WHERE id = '" + Item + "'");

            if (ver_objeto != null)
            {
                String swf    = (String)ver_objeto["swf"];
                int    id     = (byte)ver_objeto["efecto_id"];
                int    tiempo = Convert.ToInt16(ver_objeto["tiempo_pocion"]);
                if (id != 0)
                {
                    OtherSession.User.Efecto = id; OtherSession.User.TiempoPocion = tiempo;
                    if (swf == "Miedo_Pipeta_Dark_Red")
                    {
                        new Thread(() => Teleport_Master_X(Session, x, y)).Start();
                    }
                    else if (swf == "Miedo_Pipeta_Red")
                    {
                        new Thread(() => Teleport(OtherSession.User.id)).Start();
                    }
                }
            }
            Packet_189_169(Session, -1, Item);
            Packet_184_120(OtherSession, OtherSession.User.Efecto, Mensaje, true);
            Packet_181_120(Session, Item);
            PathfindingHandler.Reprar_Mirada_Z(OtherSession);
            client.ExecuteNonQuery("DELETE FROM objetos_comprados where objeto_id = '" + Item + "' AND usuario_id = '" + Session.User.id + "' LIMIT 1");
        }