Esempio n. 1
0
 static void Plantas_Manager()
 {
     foreach (SalaInstance Sala in SalasManager.Salas_Privadas.Values.ToList())
     {
         foreach (BuyObjectInstance Item in Sala.ObjetosEnSala.Values.ToList())
         {
             if (listas.Plantas.Contains(Item.objeto_id))
             {
                 foreach (SessionInstance Session in UserManager.UsuariosOnline.Values)
                 {
                     if (Time.GetDifference(Item.Planta_sol) <= 0 && Time.GetDifference(Item.Planta_agua) > 0)
                     {
                         Item.Planta_agua = 0;
                         Item.Planta_sol  = 0;
                         PlantasManager.planta_sql(Item);
                         PlantasManager.actualizar_planta(Item.id, Item, Session);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
        public void LoadObjects(SessionInstance Session)
        {
            ServerMessage server = new ServerMessage();
            Random        rd     = new Random();

            if (Escenario.es_categoria == 2)
            {
                server.AddHead(128);
                server.AddHead(121);
                server.AddHead(122);
                server.AppendParameter(1);
                if (Escenario.modelo == 2 || Escenario.modelo == 3)
                {
                    server.AppendParameter(1);
                }
                if (Escenario.modelo == 6 || Escenario.modelo == 7)
                {
                    server.AppendParameter(1);
                }
                if (Escenario.modelo == 8)
                {
                    server.AppendParameter(1);
                }
                if (Escenario.modelo == 9)
                {
                    server.AppendParameter(1);
                }
                if (Escenario.modelo == 12 || Escenario.modelo == 13)
                {
                    server.AppendParameter(1);
                }
                server.AppendParameter(0);
            }
            if (Escenario.es_categoria == 1)
            {
                server.AddHead(128);
                server.AddHead(121);
                server.AddHead(120);
                npcManager.ObtenerNPC(server, Session.User.Sala.Escenario.id);
            }
            if (Escenario.es_categoria == 0)
            {
                server.AddHead(128);
                server.AddHead(121);
                server.AddHead(121);
                if (Escenario.categoria == 2)
                {
                    server.AppendParameter(1);
                }
                if (Escenario.categoria == 4)
                {
                    server.AppendParameter(3);
                }
                server.AppendParameter(0);
                server.AppendParameter(Escenario.IslaID);
                server.AppendParameter(Escenario.id);
                server.AppendParameter(Escenario.id);
                server.AppendParameter(Escenario.color_1);
                server.AppendParameter(Escenario.color_2);
                server.AppendParameter(0);
                server.AppendParameter(Escenario.Creador.id);
                server.AppendParameter(new object[] { 1, -1, -1, 4, 5, 6, 7, 8, 9, 10, 0, -1, 13, 14, -1, 16 });
                server.AppendParameter(new object[] { 4, -1, -1, 4, 4, 4, 4, 4, 4, 4, 0, -1, 4, 4, -1, 4 });
                server.AppendParameter(new object[] { 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0 });//Puerta Categoría
                server.AppendParameter(CasasManager.Get_Door_Location_Model(Escenario, Escenario.Creador.id));
                server.AppendParameter(new object[] { "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", "puerta_14", "puerta_15", "puerta_16" });
                server.AppendParameter(CasasManager.Get_Key(Escenario.modelo));
                server.AppendParameter(new object[] { 0, 0, 0, 578, 631, 149, 210, 319, 0, 445, 1120, 0, 0 });//Aqui van las llaves de las casas
                server.AppendParameter(new object[] { Escenario.terreno_something_1, Escenario.object_something_1 });
                server.AppendParameter(new object[] { Escenario.terreno_something_2, Escenario.object_something_2 });
                server.AppendParameter(new object[] { Escenario.terreno_something_3, Escenario.object_something_3 });
                server.AppendParameter(new object[] { Escenario.terreno_config, Escenario.object_config });
                server.AppendParameter(new object[] { Escenario.terreno_colores, Escenario.object_colores });
                server.AppendParameter(new object[] { Escenario.terreno_rgb, Escenario.object_rgb });

                LoadObjects();
                server.AppendParameter(ObjetosEnSala.Count);
                foreach (BuyObjectInstance Item in ObjetosEnSala.Values)
                {
                    if (listas.Plantas.Contains(Item.objeto_id))
                    {
                        PlantasManager.cargar_planta(Session, Item);
                    }
                    server.AppendParameter(Item.id);
                    server.AppendParameter(Item.objeto_id);
                    server.AppendParameter(Item.posX);
                    server.AppendParameter(Item.posY);
                    server.AppendParameter(Item.rotation);//rotation
                    server.AppendParameter(Item.tam);
                    server.AppendParameter(0);
                    if (CatalogoManager.lianas_cocos.Contains(Item.objeto_id))
                    {
                        server.AppendParameter(""); //Espacio Ocupado
                    }
                    else
                    {
                        server.AppendParameter(Item.espacio_ocupado); //Espacio Ocupado
                    }
                    server.AppendParameter(Item.colores_hex);         //color_1
                    server.AppendParameter(Item.colores_rgb);         //color_2
                    server.AppendParameter("0");                      //Data
                    server.AppendParameter("0");                      //Other
                    if (Item.objeto_id == 370)                        //Contador de visitas de islas
                    {
                        mysql client         = new mysql();
                        int   contador_islas = Convert.ToInt32(Item.data) + 1;
                        Item.data = Convert.ToString(contador_islas);
                        client.SetParameter("id", Item.id);
                        client.SetParameter("data", Item.data);
                        client.ExecuteNonQuery("UPDATE objetos_comprados SET data = @data WHERE id = @id");
                        server.AppendParameter(Item.data);
                    }
                    else if (listas.Objetos_Area.Contains(Item.objeto_id))
                    {
                        mysql client = new mysql();
                        client.SetParameter("id", Item.id);
                        DataRow objeto = client.ExecuteQueryRow("SELECT * FROM objetos_comprados WHERE id = @id");
                        if (objeto != null)
                        {
                            client.SetParameter("id", Item.id);
                            DataRow row = client.ExecuteQueryRow("SELECT * FROM escenarios_privados WHERE objeto_id = @id");
                            if (row != null)
                            {
                                Item.open = (int)objeto["open"];
                                server.AppendParameter(new object[] { Item.id, 0, Item.data, Item.open == 0 ? "": "1",
                                                                      Item.data, 12, SalasManager.UsuariosEnSala(new EscenarioInstance(row)) });
                            }
                        }
                    }
                    else
                    {
                        server.AppendParameter(Item.data);
                    }
                }
                server.AppendParameter(0);
                server.AppendParameter(Usuarios.Count);
            }
            foreach (SessionInstance OtherSession in Usuarios.Values)
            {
                server.AppendParameter(OtherSession.User.IDEspacial);
                server.AppendParameter(OtherSession.User.nombre);
                server.AppendParameter((OtherSession.User.ModoNinja ? 12 : OtherSession.User.avatar));
                if (Escenario.tipo_evento == 2 && OtherSession.User.nivel_ninja == 0 && OtherSession.User.NinjaColores_Sala == "" || Escenario.tipo_evento_isla == 2 && OtherSession.User.nivel_ninja == 0 && OtherSession.User.NinjaColores_Sala == "")
                {
                    server.AppendParameter((OtherSession.User.ModoNinja ? OtherSession.User.Colores_traje_blanco(Session) : OtherSession.User.colores));
                }
                else if (OtherSession.User.NinjaColores_Sala != "")
                {
                    server.AppendParameter((OtherSession.User.ModoNinja ? OtherSession.User.NinjaColores_Sala : OtherSession.User.colores));
                }
                else
                {
                    server.AppendParameter((OtherSession.User.ModoNinja ? OtherSession.User.Colores_traje(Session) : OtherSession.User.colores));
                }
                server.AppendParameter(OtherSession.User.Posicion.x);
                server.AppendParameter(OtherSession.User.Posicion.y);
                server.AppendParameter(OtherSession.User.Posicion.z);
                server.AppendParameter("BoomBang");
                server.AppendParameter(OtherSession.User.edad);
                server.AppendParameter(MonthDifference(Convert.ToDateTime(OtherSession.User.fecha_registro), DateTime.Now));//Tiempo registrado   MonthDifference(DateTime.Now, Convert.ToDateTime(Session.User.fecha_registro))
                server.AppendParameter((OtherSession.User.ModoNinja == true ? 1 : 0));
                if (Session.User.Sala.Escenario.tipo_evento == 2 && OtherSession.User.puntos_ninja < 400 || Escenario.tipo_evento_isla == 2 && OtherSession.User.puntos_ninja < 400)
                {
                    server.AppendParameter(12);//traje ninja
                }
                else
                {
                    server.AppendParameter((OtherSession.User.puntos_ninja >= 400 || OtherSession.User.Traje_Ninja_Principal != 0 ? 12 : 0));//traje ninja
                }
                server.AppendParameter(OtherSession.User.UppertSelect);
                server.AppendParameter(OtherSession.User.UppertLevel());
                server.AppendParameter(OtherSession.User.CocoSelect);
                server.AppendParameter(OtherSession.User.nivel_coco);
                server.AppendParameter(new object[] { OtherSession.User.hobby_1, OtherSession.User.hobby_2, OtherSession.User.hobby_3 });
                server.AppendParameter(new object[] { OtherSession.User.deseo_1, OtherSession.User.deseo_2, OtherSession.User.deseo_3 });
                server.AppendParameter(new object[] { OtherSession.User.Votos_Legal, OtherSession.User.Votos_Sexy, OtherSession.User.Votos_Simpatico });
                server.AppendParameter(OtherSession.User.bocadillo);
                server.AppendParameter(new object[] { OtherSession.User.besos_enviados, OtherSession.User.besos_recibidos, OtherSession.User.jugos_enviados, OtherSession.User.jugos_recibidos, OtherSession.User.flores_enviadas, OtherSession.User.flores_recibidas, OtherSession.User.uppers_enviados, OtherSession.User.uppers_recibidos, OtherSession.User.cocos_enviados, OtherSession.User.cocos_recibidos, "0³" + OtherSession.User.rings_ganados + "³1³1³1³" + Session.User.senderos_ganados + "³1³1³" + (OtherSession.User.nivel_coco + 1) + "³" + OtherSession.User.puntos_cocos + "³1³" + OtherSession.User.puntos_coco_limite + "³" + OtherSession.User.nivel_ninja + "³" + OtherSession.User.puntos_ninja + "³1³" + OtherSession.User.puntos_ninja_limite });
                server.AppendParameter((OtherSession.User.toneos_ring >= 2000 && OtherSession.User.vip <= 0 ? 1: OtherSession.User.admin)); //Ficha dorada para las personas con mas de 2k torneos
                server.AppendParameter(OtherSession.User.vip);                                                                              //vip
                server.AppendParameter(OtherSession.User.Cambios);                                                                          //cambios
                server.AppendParameter(Escenario.id == 2 || OtherSession.User.Sala.Ring != null || OtherSession.User.Sala.Cocos != null || OtherSession.User.Sala.Sendero != null || OtherSession.User.Sala.Camino != null ? 0 : OtherSession.User.Efecto);
                server.AppendParameter(OtherSession.User.id);
            }
            if (Escenario.es_categoria == 0)
            {
                server.AppendParameter(0);
                server.AppendParameter(0);
                server.AppendParameter(0);
                server.AppendParameter(0);
                server.AppendParameter(0);
            }
            Session.SendData(server);
            if (Escenario.Clave != "")
            {
                new Thread(() => Cerar_Ceradura(Session, Escenario)).Start();
            }
        }