Ejemplo n.º 1
0
        public void VerificarMovimiento(SessionInstance Session)
        {
            if (!Iniciado)
            {
                return;
            }
            List <SessionInstance> ParaDescalificar = new List <SessionInstance>();

            if (!Senderos.Contains(new Point(Session.User.Posicion.x, Session.User.Posicion.y)))
            {
                new Thread(() => this.Liana(Session)).Start();
                return;
            }
            if (Session.User.Posicion.x == 15 && Session.User.Posicion.y == 13)
            {
                Iniciado = false;
                if (Participantes.ContainsKey(Session.User.IDEspacial))
                {
                    if (Participantes.Remove(Session.User.IDEspacial))
                    {
                        Session.User.Jugando       = false;
                        Session.User.SenderoOculto = null;
                        CancelarInscripcion(Session);
                        switch (sala.Escenario.id)
                        {
                        case 6:     //Golden
                            ServerMessage server = new ServerMessage();
                            server.AddHead(160);
                            server.AddHead(129);
                            server.AppendParameter(0);
                            server.AppendParameter(0);
                            server.AppendParameter(Session.User.nombre);
                            server.AppendParameter("Ha ganado: 1 Liana y suma una victoria!");
                            sala.SendData(server);
                            Session.User.senderos_ganados++;
                            sala.ActualizarEstadisticas(Session.User);
                            EntregarLiana(Session, 1230);
                            RankingsManager.agregar_user_ranking(Session.User.id, 3, 2, 1);
                            break;

                        case 7:     //Silver
                            ServerMessage server1 = new ServerMessage();
                            server1.AddHead(160);
                            server1.AddHead(129);
                            server1.AppendParameter(0);
                            server1.AppendParameter(0);
                            server1.AppendParameter(Session.User.nombre);
                            server1.AppendParameter("Ha ganado: 5 monedas de plata!");
                            sala.SendData(server1);
                            UserManager.Creditos(Session.User, false, true, Recompensa_Silver);
                            NotificacionesManager.Recompensa_Plata(Session, 5);
                            sala.ActualizarEstadisticas(Session.User);
                            break;
                        }
                        DescalificarUsuarios();
                        FinalizarSendero();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 static void Alerta_Automatica_Manager()
 {
     foreach (SessionInstance Session in UserManager.UsuariosOnline.Values.ToList())
     {
         if (Session.User != null)
         {
             if (Session.User.Sala != null)
             {
                 Random randoom      = new Random();
                 int    notificacion = randoom.Next(1, 6);
                 if (notificacion == 1)
                 {
                     NotificacionesManager.NotifiChat(Session, "Sabio: Escribe en el chat /info para consultar tus estadísticas especiales.");
                 }
                 if (notificacion == 2)
                 {
                     NotificacionesManager.NotifiChat(Session, "Sabio: Consulta tu posición en ranking de uppers. Escribe en el chat /upper");
                 }
                 if (notificacion == 3)
                 {
                     NotificacionesManager.NotifiChat(Session, "Sabio: Participa en lotería semanal. Compra un ticket dorado en Set New del catalogo.");
                 }
                 if (notificacion == 4)
                 {
                     NotificacionesManager.NotifiChat(Session, "Sabio: Cada viernes nuevos objetos están de rebaja en Set New del catalogo.");
                 }
                 if (notificacion == 5)
                 {
                     NotificacionesManager.NotifiChat(Session, "Sabio: ¿Has escuchado sobre Igloo? El oso polar dice que caen cocos y shurikens.");
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        // GET: Notificaciones
        public ActionResult BuscaNotificacion()
        {
            NotificacionesManager nm = new NotificacionesManager();

            ObtenerUsuarioActual();

            if (usuarioActual.idUsuario != 0)
            {
                //Retornar lo del SP en nl pasando los parametros que corresponda. seguramente dependera del perfil.
                List <NotificacionesEntity> nl = new List <NotificacionesEntity>();

                nl = nm.consultarNotificaciones(usuarioActual.idUsuario, usuarioActual.idPerfil);

                ////Iterar el listado que viene desde la DB.
                //for (int i = 0; i < 3; i++)
                //{
                //    NotificacionesEntity n1 = new NotificacionesEntity();
                //    n1.Descripcion = "Solicitudes";
                //    n1.Cantidad = 20;
                //    n1.Url = Url.Content("~/Reservas/ReservasUsuario");
                //    nl.Add(n1);
                //}

                return(Json(nl, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(RedirectToAction("Login", "Usuarios"));
            }
        }
Ejemplo n.º 4
0
        private static void Teleport_Master(SessionInstance Session, string[,] Parameters)
        {
            int OtherUserID = int.Parse(Parameters[0, 0]);
            int Item_ID     = int.Parse(Parameters[1, 0]);
            int x           = int.Parse(Parameters[2, 0]);
            int y           = int.Parse(Parameters[3, 0]);

            if (Session == null)
            {
                return;
            }
            if (Session.User == null)
            {
                return;
            }
            if (Session.User.Sala == null)
            {
                return;
            }
            if (Session.User.PreLock_Interactuando)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Ring != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Cocos != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Sendero != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Camino != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.id == 2)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.anti_efecto == true)
            {
                NotificacionesManager.NotifiChat(Session, "Sabio: Los efectos estan desactivados en esta Sala."); Packet_143(Session); return;
            }
            if (Session == null)
            {
                return;
            }
            if (Session.User.Efecto != 0)
            {
                Packet_143(Session); return;
            }

            Primer_Usuario_Manager(Session, Item_ID, false, "", x, y);
        }
Ejemplo n.º 5
0
        private static void Pociones(SessionInstance Session, string[,] Parameters)
        {
            int OtherUserID = int.Parse(Parameters[0, 0]);
            int Item_ID     = int.Parse(Parameters[1, 0]);

            if (Session == null)
            {
                return;
            }
            if (Session.User == null)
            {
                return;
            }
            if (Session.User.Sala == null)
            {
                return;
            }
            if (Session.User.Sala.Ring != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Cocos != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Sendero != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Camino != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.id == 2)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.anti_efecto == true)
            {
                NotificacionesManager.NotifiChat(Session, "Sabio: Los efectos estan desactivados en esta Sala."); Packet_143(Session); return;
            }
            mysql   client = new mysql();
            DataRow Compra = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE objeto_id = '" + Item_ID + "' AND usuario_id = '" + Session.User.id + "'");

            if (Compra != null)
            {
                SessionInstance OtherSession = UserManager.ObtenerSession(OtherUserID);
                if (OtherSession == null)
                {
                    return;
                }
                if (OtherSession.User.PreLock_Interactuando == true)
                {
                    Packet_143(Session); return;
                }
                if (OtherSession.User.Efecto != 0)
                {
                    Packet_143(Session); return;
                }
                if (OtherSession.User.id == Session.User.id)
                {
                    if (Chat_Colores_Catalogo_ID.Contains(Item_ID))
                    {
                        Chat_Colores(Session, Item_ID); return;
                    }
                    if (Trajes_Catalogo_ID.Contains(Item_ID))
                    {
                        Trajes_Catalago(Session, Item_ID); return;
                    }
                    if (Trajes_Halloween_Catalogo_ID.Contains(Item_ID))
                    {
                        Trajes_Halloween_Catalago(Session, Item_ID); return;
                    }
                    if (Item_ID == 3109)
                    {
                        Colores_Black(Session); return;
                    }

                    Primer_Usuario_Manager(Session, Item_ID, false, "", 0, 0);
                }
                else
                {
                    if (Chat_Colores_Catalogo_ID.Contains(Item_ID))
                    {
                        NotificacionesManager.NotifiChat(Session, "Sabio: Ficha tu personaje para cambiar color de tu chat."); return;
                    }
                    if (Trajes_Catalogo_ID.Contains(Item_ID))
                    {
                        NotificacionesManager.NotifiChat(Session, "Sabio: Ficha tu personaje para ponerte el traje."); return;
                    }
                    if (Trajes_Halloween_Catalogo_ID.Contains(Item_ID))
                    {
                        NotificacionesManager.NotifiChat(Session, "Sabio: Ficha tu personaje para ponerte el traje."); return;
                    }
                    if (Item_ID == 3109)
                    {
                        NotificacionesManager.NotifiChat(Session, "Sabio: Ficha tu personaje para activar Anti Upper."); return;
                    }

                    Otro_Usuario_Manager(Session, Item_ID, OtherSession.User.id, false, "");
                }
            }
        }
Ejemplo n.º 6
0
        private static void Chat_Colores(SessionInstance Session, int ID_Objeto)
        {
            if (Session == null)
            {
                return;
            }
            if (Session.User == null)
            {
                return;
            }
            if (Session.User.Sala == null)
            {
                return;
            }
            if (Session.User.PreLock_Interactuando)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Ring != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Cocos != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Camino != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Sendero != null)
            {
                Packet_143(Session); return;
            }
            if (Session == null)
            {
                return;
            }
            if (Session.User.Efecto != 0)
            {
                Packet_143(Session); return;
            }
            if (Session.User.avatar == 13)
            {
                Packet_143(Session); return;
            }
            if (Session.User.avatar == 14)
            {
                Packet_143(Session); return;
            }
            if (Session.User.ModoNinja == true)
            {
                NotificacionesManager.NotifiChat(Session, "Sabio: Desactiva el traje Ninja para cambiar el color de chat.");
                Packet_143(Session);
                return;
            }
            Session.User.Trayectoria.DetenerMovimiento();
            Session.User.Time_Interactuando = Time.GetCurrentAndAdd(AddType.Segundos, 4);
            string Color_Chat = "";

            if (ID_Objeto == 3117 && Session.User.Color_Chat != 4)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 4; Color_Chat = "Helado";
            }                                                                                                                                                                      //Helado
            else if (ID_Objeto == 3117 && Session.User.Color_Chat == 4)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                           //
            if (ID_Objeto == 3116 && Session.User.Color_Chat != 5)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 5; Color_Chat = "Oscuro";
            }                                                                                                                                                                      //Oscuro
            else if (ID_Objeto == 3116 && Session.User.Color_Chat == 5)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                           //
            if (ID_Objeto == 3044 && Session.User.Color_Chat != 6)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 6; Color_Chat = "Rosa";
            }                                                                                                                                                                    //Rosa
            else if (ID_Objeto == 3044 && Session.User.Color_Chat == 6)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                           //
            if (ID_Objeto == 3045 && Session.User.Color_Chat != 7)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 7; Color_Chat = "Rojo";
            }                                                                                                                                                                    //Rojo
            else if (ID_Objeto == 3045 && Session.User.Color_Chat == 7)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                           //
            if (ID_Objeto == 3046 && Session.User.Color_Chat != 8)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 8; Color_Chat = "Azul";
            }                                                                                                                                                                    //Azul
            else if (ID_Objeto == 3046 && Session.User.Color_Chat == 8)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                           //
            if (ID_Objeto == 3047 && Session.User.Color_Chat != 10)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 10; Color_Chat = "Verde";
            }                                                                                                                                                                       //Verde
            else if (ID_Objeto == 3047 && Session.User.Color_Chat == 10)
            {
                Session.User.Efecto = 42; Session.User.TiempoPocion = 8; Session.User.Color_Chat = 1; Color_Chat = "Normal";
            }                                                                                                                                                                            //
            NotificacionesManager.NotifiChat(Session, "Sabio: has cambiado el color del chat por " + Color_Chat + "");
            Packet_133(Session, string.Format("{0} a cambiado el color de chat.", Session.User.nombre), true);
            Packet_184_120(Session, Session.User.Efecto, "", true);
            Packet_181_120(Session, ID_Objeto);
            PathfindingHandler.Reprar_Mirada_Z(Session);
        }
Ejemplo n.º 7
0
        private static void Mensaje_Pajaro_1(SessionInstance Session, string[,] Parameters)
        {
            int    OtherUserID = int.Parse(Parameters[0, 0]);
            int    Item_ID     = int.Parse(Parameters[1, 0]);
            string Mensaje     = Parameters[2, 0];

            if (Session == null)
            {
                return;
            }
            if (Session.User == null)
            {
                return;
            }
            if (Session.User.Sala == null)
            {
                return;
            }
            if (Session.User.PreLock_Interactuando)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Ring != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Cocos != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Sendero != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Camino != null)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.id == 2)
            {
                Packet_143(Session); return;
            }
            if (Session.User.Sala.Escenario.anti_efecto == true)
            {
                NotificacionesManager.NotifiChat(Session, "Sabio: Los efectos estan desactivados en esta Sala."); Packet_143(Session); return;
            }
            SessionInstance OtherSession = UserManager.ObtenerSession(OtherUserID);

            if (OtherSession == null)
            {
                return;
            }
            if (OtherSession.User.Efecto != 0)
            {
                Packet_143(Session); return;
            }
            if (OtherSession.User.id == Session.User.id)
            {
                Primer_Usuario_Manager(Session, Item_ID, true, Mensaje, 0, 0);
            }
            else
            {
                Otro_Usuario_Manager(Session, Item_ID, OtherSession.User.id, true, Mensaje);
            }
        }
Ejemplo n.º 8
0
        private static void Open_Puertas(SessionInstance Session, string[,] Parameters)
        {
            mysql client = new mysql();

            int[]    llaves  = { 0, 0, 0, 578, 631, 149, 210, 319, 0, 445, 1120, 0, 0 };
            string[] puertas = { "puerta_1", "puerta_2", "puerta_3", "puerta_4", "puerta_5", "puerta_6", "puerta_7", "puerta_8", "puerta_9", "puerta_10", "puerta_11", "puerta_12", "puerta_13" };
            int      id      = Convert.ToInt32(Parameters[0, 0]);

            client.SetParameter("id", llaves[id - 1]);
            client.SetParameter("user", Session.User.id);
            DataRow muchila = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE objeto_id = @id AND usuario_id = @user");

            if (muchila != null)
            {
                client.SetParameter("user", Session.User.id);
                client.SetParameter("sala", Session.User.Sala.id);
                client.ExecuteNonQuery("UPDATE escenarios_privados SET " + puertas[id - 1] + " = 1 WHERE CreadorID = @user AND id = @sala AND modelo = 26");

                client.SetParameter("user", Session.User.id);
                client.SetParameter("objeto", llaves[id - 1]);
                client.ExecuteNonQuery("DELETE FROM objetos_comprados WHERE objeto_id = @objeto AND usuario_id = @user");

                ServerMessage Handler_189_175 = new ServerMessage();
                Handler_189_175.AddHead(189);
                Handler_189_175.AddHead(175);
                Handler_189_175.AppendParameter(1);
                Handler_189_175.AppendParameter(1);
                Session.SendData(Handler_189_175);

                ServerMessage borrar_llave = new ServerMessage();
                borrar_llave.AddHead(189);
                borrar_llave.AddHead(169);
                borrar_llave.AppendParameter(-1);
                borrar_llave.AppendParameter(llaves[id - 1]);
                borrar_llave.AppendParameter(1);
                Session.SendData(borrar_llave);

                ServerMessage server = new ServerMessage();
                server.AddHead(203);
                server.AddHead(120);
                server.AppendParameter(id);
                server.AppendParameter(4);
                server.AppendParameter(0);
                server.AppendParameter(Session.User.Sala.Escenario.id);
                server.AppendParameter("Puerta1");
                server.AppendParameter(1);
                server.AppendParameter(0);
                Session.SendData(server);
                //ServerMessage message2 = new ServerMessage(203, 120);
                //message2.AppendParameter($"{ide}³²4³²0³²{Session.Doors[ide - 1]}³²Puerta1³²1³²0", false);
                //instance.BroadcastMessage(message2);

                SalasManager.Salas_Privadas.Remove(Session.User.Sala.Escenario.id);
                client.SetParameter("id", Session.User.Sala.Escenario.id);
                DataRow           row       = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE id = @id");
                EscenarioInstance Escenario = new EscenarioInstance(row);
                SalasManager.Salas_Privadas.Add(Session.User.Sala.Escenario.id, new SalaInstance(Escenario.id, Escenario));

                NotificacionesManager.NotifiChat(Session, "Sabio: Sal al jardin de casita y vuelve a entrar para poder acceder a la puerta.");
            }
        }