public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int _page = 5;

            if (Session.GetHabbo().lastLayout.Equals("loyalty_vip_buy"))
            {
                _page = int.Parse(NeonEnvironment.GetDBConfig().DBData["catalog.hcbuy.id"]);
            }

            if (!NeonEnvironment.GetGame().GetCatalog().TryGetPage(_page, out CatalogPage page))
            {
                return;
            }

            ServerPacket Message = new ServerPacket(ServerPacketHeader.GetClubComposer);

            Message.WriteInteger(page.Items.Values.Count);

            foreach (CatalogItem catalogItem in page.Items.Values)
            {
                catalogItem.SerializeClub(Message, Session);
            }

            Message.WriteInteger(Packet.PopInt());

            Session.SendMessage(Message);
        }
Exemplo n.º 2
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int goal        = int.Parse(NeonEnvironment.GetDBConfig().DBData["usersconcurrent_goal"]);;
            int UsersOnline = NeonEnvironment.GetGame().GetClientManager().Count;

            foreach (GameClient Target in NeonEnvironment.GetGame().GetClientManager().GetClients.ToList())
            {
                if (UsersOnline < goal)
                {
                    int type = 1;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else if (!Target.GetHabbo().GetStats().PurchaseUsersConcurrent&& UsersOnline >= goal)
                {
                    int type = 2;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else if (Target.GetHabbo().GetStats().PurchaseUsersConcurrent&& UsersOnline >= goal)
                {
                    int type = 3;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else
                {
                    int type = 0;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
            }
        }
Exemplo n.º 3
0
        public BonusRareMessageComposer(GameClient Session)
            : base(ServerPacketHeader.BonusRareMessageComposer)
        {
            string product = NeonEnvironment.GetDBConfig().DBData["bonus_rare_productdata_name"];
            int    baseid  = int.Parse(NeonEnvironment.GetDBConfig().DBData["bonus_rare_item_baseid"]);
            int    score   = Convert.ToInt32(NeonEnvironment.GetDBConfig().DBData["bonus_rare_total_score"]);

            base.WriteString(product);
            base.WriteInteger(baseid);
            base.WriteInteger(score);
            base.WriteInteger(Session.GetHabbo().BonusPoints >= score ? score : score - Session.GetHabbo().BonusPoints); //Total To Gain
            if (Session.GetHabbo().BonusPoints >= score)
            {
                Session.GetHabbo().BonusPoints -= score;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().BonusPoints, score, 101));
                Session.SendMessage(new RoomCustomizedAlertComposer("Has completado tu Bonus Rare ¡ya tienes tu premio en el inventario! Recibirás otro cuando vuelvas a acumular 120 puntos."));
                if (!NeonEnvironment.GetGame().GetItemManager().GetItem((baseid), out ItemData Item))
                {
                    // No existe este ItemId.
                    return;
                }

                Item GiveItem = ItemFactory.CreateSingleItemNullable(Item, Session.GetHabbo(), "", "");
                if (GiveItem != null)
                {
                    Session.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);

                    Session.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1));
                    Session.SendMessage(new FurniListUpdateComposer());
                }

                Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
            }
        }
Exemplo n.º 4
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("¡Ingrese el usuario que desea recompensar!", 34);
                return;
            }

            GameClient Target = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (Target == null)
            {
                Session.SendWhisper("¡Vaya, no pudimos encontrar a ese usuario!", 34);
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Target.GetHabbo().Id);

            if (TargetUser == null)
            {
                Session.SendWhisper("Usuario no encontrado! Quizás no esté en línea o en esta sala.", 34);
                return;
            }

            if (Target.GetHabbo().Username == Session.GetHabbo().Username)
            {
                string product = NeonEnvironment.GetDBConfig().DBData["bonus_rare_productdata_name"];
                int    baseid  = int.Parse(NeonEnvironment.GetDBConfig().DBData["bonus_rare_item_baseid"]);
                int    score   = Convert.ToInt32(NeonEnvironment.GetDBConfig().DBData["bonus_rare_total_score"]);

                Session.GetHabbo().BonusPoints += 1;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().BonusPoints, score, 101));
                Session.SendMessage(new RoomNotificationComposer("Felicidades ¡Has recibido un punto extra! Tienes ahora: (" + Session.GetHabbo().BonusPoints + ") bono(s)"));
                Session.SendMessage(new BonusRareMessageComposer(Session));
                return;
            }
            if (Target.GetHabbo().Username != Session.GetHabbo().Username)
            {
                string product = NeonEnvironment.GetDBConfig().DBData["bonus_rare_productdata_name"];
                int    baseid  = int.Parse(NeonEnvironment.GetDBConfig().DBData["bonus_rare_item_baseid"]);
                int    score   = Convert.ToInt32(NeonEnvironment.GetDBConfig().DBData["bonus_rare_total_score"]);

                Target.GetHabbo().BonusPoints += 1;
                Target.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().BonusPoints, score, 101));
                Target.SendMessage(new RoomNotificationComposer("Felicidades ¡Has recibido un punto extra! Tienes ahora: (" + Target.GetHabbo().BonusPoints + ") bono(s)"));
                Target.SendMessage(new BonusRareMessageComposer(Target));
                Session.SendMessage(new RoomNotificationComposer("Felicidades ¡Has ganado con éxito los puntos de bonificación!"));
            }
        }
Exemplo n.º 5
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().GetStats().PurchaseUsersConcurrent)
            {
                Session.SendMessage(new RoomCustomizedAlertComposer("Ya has recibido este premio."));
            }

            string badge   = NeonEnvironment.GetDBConfig().DBData["usersconcurrent_badge"];
            int    pixeles = int.Parse(NeonEnvironment.GetDBConfig().DBData["usersconcurrent_pixeles"]);

            Session.GetHabbo().GOTWPoints = Session.GetHabbo().GOTWPoints + pixeles;
            Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().GOTWPoints, pixeles, 103));
            Session.GetHabbo().GetBadgeComponent().GiveBadge(badge, true, Session);
            Session.SendMessage(new RoomCustomizedAlertComposer("Has recibido una placa y " + pixeles + " pixeles."));
            Session.GetHabbo().GetStats().PurchaseUsersConcurrent = true;
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor escribe el mensaje a enviar");
                return;
            }
            string Message = CommandManager.MergeParams(Params, 1);

            if (NeonEnvironment.GetDBConfig().DBData["hotel.name"] == "Habbi")
            {
                NeonEnvironment.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("Mensaje de " + Session.GetHabbo().Username + ":", "<font size =\"11\">Querido usuario de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ", el usuario " + Session.GetHabbo().Username + " tiene un mensaje para todo el hotel:</font><br><br><font size =\"11\" color=\"#B40404\">" + Message + "</font><br><br><font size =\"10\" color=\"#0B4C5F\">Recuerda estar atent@ a las redes sociales para mantenerte siempre al d\x00eda de las actualizaciones en Habbi Hotel:<br><br><b>FACEBOOK</b>: @EsHabbiHotel<br><b>TWITTER</b>: @EsHabbi<br><b>INSTAGRAM:</b> @EsHabbi</font>", "alertz", ""));
            }
            else
            {
                NeonEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(NeonEnvironment.GetGame().GetLanguageLocale().TryGetValue("hotelalert_text") + Message + "\r\n- " + Session.GetHabbo().Username, ""));
            }

            return;
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }


            if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room))
            {
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                return;
            }

            if (NeonEnvironment.GetDBConfig().DBData["exchange_enabled"] != "1")
            {
                Session.SendNotification("De momento no puedes canjear tus monedas para llevarlo a su monedero.");
                return;
            }

            Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt());

            if (Exchange == null)
            {
                return;
            }

            if (Exchange.GetBaseItem().ItemName.StartsWith("CF_"))
            {
                string[] Split = Exchange.GetBaseItem().ItemName.Split('_');
                int      Value = int.Parse(Split[1]);

                if (Value > 0)
                {
                    Session.GetHabbo().Credits += Value;
                    Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                }
            }

            if (Exchange.GetBaseItem().ItemName.StartsWith("CFC_"))
            {
                string[] Split = Exchange.GetBaseItem().ItemName.Split('_');
                int      Value = int.Parse(Split[1]);

                if (Value > 0)
                {
                    Session.GetHabbo().Duckets += Value;
                    Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Value));
                    Session.SendMessage(RoomNotificationComposer.SendBubble("duckets", "Has convertido correctamente " + Value + " Duckets, haz click aquí para abrir la tienda.", "catalog/open"));
                }
            }

            if (Exchange.GetBaseItem().ItemName.StartsWith("DF_"))
            {
                string[] Split = Exchange.GetBaseItem().ItemName.Split('_');
                int      Value = int.Parse(Split[1]);

                if (Value > 0)
                {
                    Session.GetHabbo().Diamonds += Value;
                    Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, Value, 5));
                    Session.SendMessage(RoomNotificationComposer.SendBubble("diamantes", "Has convertido correctamente " + Value + " diamantes, haz click aquí para abrir la tienda.", "catalog/open"));
                }
            }

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Exchange.Id + "' LIMIT 1");
            }

            Session.SendMessage(new FurniListUpdateComposer());
            Room.GetRoomItemHandler().RemoveFurniture(null, Exchange.Id, false);
            Session.GetHabbo().GetInventoryComponent().RemoveItem(Exchange.Id);
        }
Exemplo n.º 8
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Usted debe escribir un ID Efecto");
                return;
            }

            RoomUser ThisUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (ThisUser == null)
            {
                return;
            }

            if (ThisUser.RidingHorse)
            {
                Session.SendWhisper("No se puede activar un efecto mientras montas un caballo");
                return;
            }
            else if (ThisUser.Team != TEAM.NONE)
            {
                return;
            }
            else if (ThisUser.isLying)
            {
                return;
            }

            if (!int.TryParse(Params[1], out int EffectId))
            {
                return;
            }

            if (EffectId > int.MaxValue || EffectId < int.MinValue)
            {
                return;
            }

            if (Session.GetHabbo().Rank > 8)
            {
                Session.GetHabbo().LastEffect = EffectId;
                Session.GetHabbo().Effects().ApplyEffect(EffectId);
                return;
            }

            // Staff Effects
            if (EffectId == 102 && Session.GetHabbo().Rank < 5 || EffectId == 187 && Session.GetHabbo().Rank < 5 || EffectId == 593 && Session.GetHabbo().Rank < 5 || EffectId == 596 && Session.GetHabbo().Rank < 5 || EffectId == 598 && Session.GetHabbo().Rank < 5)
            {
                Session.SendWhisper("Lo sentimos, lamentablemente sólo los staff pueden activar este efecto."); return;
            }

            // Guide Effects
            if (EffectId == 592 && Session.GetHabbo()._guidelevel < 3 || EffectId == 595 && Session.GetHabbo()._guidelevel < 2 || EffectId == 597 && Session.GetHabbo()._guidelevel < 1)
            {
                Session.SendWhisper("Lo sentimos, no perteneces al equipo guía, es por ello que no puedes usar este efecto."); return;
            }

            // Croupier Effect
            if (EffectId == 594 && Session.GetHabbo()._croupier < 1)
            {
                Session.SendWhisper("Lo sentimos, este enable es sólo para el equipo Croupier de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + "."); return;
            }

            // BAW Effect
            if (EffectId == 599 && Session.GetHabbo()._builder < 1)
            {
                Session.SendWhisper("Lo sentimos, este enable es sólo para el equipo BAW de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + "."); return;
            }

            // Publicista Effect
            if (EffectId == 600 && Session.GetHabbo()._publicistalevel < 1)
            {
                Session.SendWhisper("Lo sentimos, este enable es sólo para los publicistas."); return;
            }

            // VIP Effect
            if (EffectId == 601 && Session.GetHabbo().Rank < 2)
            {
                Session.SendWhisper("Lo sentimos, este enable es sólo para los VIP."); return;
            }

            // Ambassador & Rookies Effect
            if (EffectId == 178 && Session.GetHabbo().Rank < 3)
            {
                Session.SendWhisper("Lo sentimos, este enable es sólo para los embajadores y rookies."); return;
            }

            Session.GetHabbo().LastEffect = EffectId;
            Session.GetHabbo().Effects().ApplyEffect(EffectId);
        }
Exemplo n.º 9
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Debe introducir algo para actualizar, e.g. :update catalog");
                return;
            }


            string UpdateVariable = Params[1];

            switch (UpdateVariable.ToLower())
            {
            case "calendar":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rewards"))
                {
                    Session.SendWhisper("Oops, ha surgido un error.");
                    break;
                }

                NeonEnvironment.GetGame().GetCalendarManager().Init();
                Session.SendWhisper("Calendario actualizado.");
                break;
            }

            case "ecotron":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rewards"))
                {
                    Session.SendWhisper("Oops, ha surgido un error.");
                    break;
                }

                NeonEnvironment.GetGame().GetFurniMaticRewardsMnager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                Session.SendWhisper("Premios ecotrón actualizados.");
                break;
            }

            case "grupos":
            case "groups":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los grupos.");
                    break;
                }

                _ = CommandManager.MergeParams(Params, 2);

                NeonEnvironment.GetGame().GetGroupManager().Init();

                break;
            }

            case "cata":
            case "catalog":
            case "catalogue":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar el catálogo.");
                    break;
                }

                string Message = CommandManager.MergeParams(Params, 2);

                NeonEnvironment.GetGame().GetCatalogFrontPageManager().LoadFrontPage();
                NeonEnvironment.GetGame().GetCatalog().Init(NeonEnvironment.GetGame().GetItemManager());
                NeonEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer());
                NeonEnvironment.GetGame().GetClientManager().SendMessage(RoomNotificationComposer.SendBubble("catalogue", "¡El catálogo ha sido actualizado, échale un vistazo!", "catalog/open/" + Message + ""));

                break;
            }

            case "goals":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar el LandingCommunityGoalVS.");
                    break;
                }

                _ = CommandManager.MergeParams(Params, 2);

                NeonEnvironment.GetGame().GetCommunityGoalVS().LoadCommunityGoalVS();

                Session.SendWhisper("Has actualizado satisfactoriamente los LandingCommunityGoalVS.", 34);

                break;
            }

            case "pinatas":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los premios de las piñatas.");
                    break;
                }

                NeonEnvironment.GetGame().GetPinataManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                NeonEnvironment.GetGame().GetClientManager().SendMessage(RoomNotificationComposer.SendBubble("catalogue", "Se han actualizado los premios de las piñatas.", ""));
                break;
            }

            case "polls":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los premios de las piñatas.");
                    break;
                }
                NeonEnvironment.GetGame().GetPollManager().Init();
                break;
            }

            case "list":
            {
                StringBuilder List = new StringBuilder("");
                List.AppendLine("Lista de comandos para actualizar");
                List.AppendLine("---------------------------------");
                List.AppendLine(":update catalog = Actualizar el cátalogo.");
                List.AppendLine(":update items = Actualiza los ítems, si cambias algo en 'furniture'");
                List.AppendLine(":update models = Por si añades algun modelo de sala manualmente");
                List.AppendLine(":update promotions = Actualiza las noticias que estan en vista hotel 'Server Landinds'");
                List.AppendLine(":update filter = Actualiza el filtro, 'siempre ejecutar si se añade una palabra'");
                List.AppendLine(":update navigator = Actualiza el Navegador");
                List.AppendLine(":update rights = Actualiza los Permisos");
                List.AppendLine(":update configs = Actualiza la configuracion del hotel");
                List.AppendLine(":update bans = Actualiza los baneados");
                List.AppendLine(":update tickets = Actualiza los tickets de mod");
                List.AppendLine(":update badge_definitions = Actualiza las placas agregadas");
                List.AppendLine(":update vouchers = Actualiza los vouchers agregados");
                List.AppendLine(":update characters = Actualiza los carácteres del filtro.");
                List.AppendLine(":update offers = Actualiza las ofertas relámpago del hotel.");
                List.AppendLine(":update nux = Actualiza los premios nux del hotel.");
                List.AppendLine(":update polls = Actualiza los polls del hotel.");
                Session.SendMessage(new MOTDNotificationComposer(List.ToString()));
                break;
            }

            case "nux":
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar esto.");
                    break;
                }

                NeonEnvironment.GetGame().GetNuxUserGiftsListManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                NeonEnvironment.GetGame().GetNuxUserGiftsManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                Session.SendWhisper("Has recargado los nux gifts.");
                break;

            case "characters":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_filter"))
                {
                    Session.SendWhisper("Oops, Usted no tiene permiso para actualizar los carácteres del filtro");
                    break;
                }

                NeonEnvironment.GetGame().GetChatManager().GetFilter().InitCharacters();
                Session.SendWhisper("Carácteres del filtro actualiza2 correctamente.");
                break;
            }

            case "items":
            case "furni":
            case "furniture":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los furnis");
                    break;
                }

                NeonEnvironment.GetGame().GetItemManager().Init();
                Session.SendWhisper("Items actualizados correctamente.");
                break;
            }

            case "crafting":
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar el crafting.");
                    break;
                }

                NeonEnvironment.GetGame().GetCraftingManager().Init();
                Session.SendWhisper("Crafting actualizado correctamente.");
                break;

            case "offers":
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los furnis");
                    break;
                }

                NeonEnvironment.GetGame().GetTargetedOffersManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                Session.SendWhisper("Ofertas relámpago actualizadas correctamente.");
                break;

            case "songs":
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar las canciones.");
                    break;
                }

                NeonEnvironment.GetGame().GetMusicManager().Init();
                Session.SendWhisper("Has recargado todas las canciones.");
                break;

            case "models":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_models"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los Models");
                    break;
                }

                NeonEnvironment.GetGame().GetRoomManager().LoadModels();
                Session.SendWhisper("Modelos de sala actualizados correctamente.");
                break;
            }

            case "promotions":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_promotions"))
                {
                    Session.SendWhisper("Oops, usted no tiene permisos para actualizar las promociones.");
                    break;
                }

                NeonEnvironment.GetGame().GetLandingManager().LoadPromotions();
                Session.SendWhisper("Noticias de vista al Hotel actualizadas correctamente.");
                break;
            }

            case "youtube":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_youtube"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los videos de Youtube TV.");
                    break;
                }

                NeonEnvironment.GetGame().GetTelevisionManager().Init();
                Session.SendWhisper("Youtube television actualizado correctamente");
                break;
            }

            case "filter":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_filter"))
                {
                    Session.SendWhisper("Oops, Usted no tiene permiso para actualizar el filtro");
                    break;
                }

                NeonEnvironment.GetGame().GetChatManager().GetFilter().InitWords();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("filters", Session.GetHabbo().Username + " ha actualizado el filtro del hotel.", ""));
                break;
            }

            case "navigator":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_navigator"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar el navegador.");
                    break;
                }

                NeonEnvironment.GetGame().GetNavigator().Init();
                NeonEnvironment.GetGame().GetClientManager().SendMessage(RoomNotificationComposer.SendBubble("newuser", Session.GetHabbo().Username + " ha modificado las salas públicas del hotel.", ""));
                break;
            }

            case "ranks":
            case "rights":
            case "permissions":
            case "commands":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rights"))
                {
                    Session.SendWhisper("Oops, usted no tiene derecho para actualizar los derechos y permisos.");
                    break;
                }

                NeonEnvironment.GetGame().GetPermissionManager().Init();

                foreach (GameClient Client in NeonEnvironment.GetGame().GetClientManager().GetClients.ToList())
                {
                    if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().GetPermissions() == null)
                    {
                        continue;
                    }

                    Client.GetHabbo().GetPermissions().Init(Client.GetHabbo());
                }

                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha actualizado todos los permisos, comandos y rangos del hotel.", ""));
                break;
            }

            case "config":
            case "configs":
            case "settings":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_configuration"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar la configuracion del Hotel");
                    break;
                }

                NeonEnvironment.ConfigData = new ConfigData();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha recargado la configuración del hotel.", ""));
                break;
            }

            case "bans":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bans"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar la lista de baneados");
                    break;
                }

                NeonEnvironment.GetGame().GetModerationManager().ReCacheBans();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha actualizado la lista de baneos de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ".", ""));
                break;
            }

            case "quests":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_quests"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar las misiones.");
                    break;
                }

                NeonEnvironment.GetGame().GetQuestManager().Init();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha actualizado todas las misiones y retos de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ".", ""));
                break;
            }

            case "achievements":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_achievements"))
                {
                    Session.SendWhisper("Oops, usted no tiene permiso para actualizar los logros.");
                    break;
                }

                NeonEnvironment.GetGame().GetAchievementManager().LoadAchievements();
                NeonEnvironment.GetGame().GetClientManager().SendMessage(new BadgeDefinitionsComposer(NeonEnvironment.GetGame().GetAchievementManager()._achievements));
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha recargado todos los desafíos y achievements del hotel satisfactoriamente.", ""));
                break;
            }



            case "moderation":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_moderation"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_moderation' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetModerationManager().Init();
                NeonEnvironment.GetGame().GetClientManager().ModAlert("Moderation presets have been updated. Please reload the client to view the new presets.");
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha actualizado la configuración de los permisos de moderación.", ""));
                break;
            }

            //case "tickets":
            //    {
            //        if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_tickets"))
            //        {
            //            Session.SendWhisper("Oops, No tiene permisos para actualizar los tickets");
            //            break;
            //        }

            //        if (NeonEnvironment.GetGame().GetModerationTool().Tickets.Count > 0)
            //            NeonEnvironment.GetGame().GetModerationTool().Tickets.Clear();

            //        NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("tickets", Session.GetHabbo().Username + " ha actualizado y vaciado todos los tickets de Habbi.", ""));
            //        break;
            //    }

            case "vouchers":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_vouchers"))
                {
                    Session.SendWhisper("Oops, no tienes los permisos suficientes para actualizar los vouchers.");
                    break;
                }

                NeonEnvironment.GetGame().GetCatalog().GetVoucherManager().Init();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", Session.GetHabbo().Username + " ha actualizado los códigos voucher del hotel.", ""));
                break;
            }

            case "gc":
            case "games":
            case "gamecenter":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_game_center"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_game_center' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetGameDataManager().Init();
                NeonEnvironment.GetGame().GetLeaderBoardDataManager().Init();
                Session.SendWhisper("Game Center cache successfully updated.");
                break;
            }

            case "pet_locale":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_pet_locale"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_pet_locale' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetChatManager().GetPetLocale().Init();
                Session.SendWhisper("Pet locale cache successfully updated.");
                break;
            }

            case "locale":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_locale"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_locale' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetLanguageLocale().Init();
                Session.SendWhisper("Locale cache successfully updated.");
                break;
            }

            case "mutant":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_anti_mutant"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_anti_mutant' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetAntiMutant().Init();
                Session.SendWhisper("Anti mutant successfully reloaded.");
                break;
            }

            case "bots":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bots"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_bots' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetBotManager().Init();
                Session.SendWhisper("Bot recargados correctamente");
                break;
            }

            case "rewards":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rewards"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_rewards' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetRewardManager().Reload();
                Session.SendWhisper("Rewards managaer successfully reloaded.");
                break;
            }

            case "chat_styles":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_chat_styles"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_chat_styles' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetChatManager().GetChatStyles().Init();
                Session.SendWhisper("Chat Styles successfully reloaded.");
                break;
            }

            case "badges":
            case "badge_definitions":
            {
                if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_badge_definitions"))
                {
                    Session.SendWhisper("Oops, you do not have the 'command_update_badge_definitions' permission.");
                    break;
                }

                NeonEnvironment.GetGame().GetBadgeManager().Init();
                NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("definitions", Session.GetHabbo().Username + " ha actualizado las definiciones de placas.", ""));
                break;
            }

            default:
                Session.SendWhisper("'" + UpdateVariable + "' es un comando invalido, escribelo correctamente");
                break;
            }
        }
Exemplo n.º 10
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            string Message = CommandManager.MergeParams(Params, 1);

            NeonEnvironment.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("¿Qué está pasando en " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + "...?",
                                                                                                  "Algo está ocurriendo en Habbi, Custom, HiddenKey y Root han desaparecido en medio de la ceremonia...<br><br>Un ente susurra y pide ayuda a todo Habbi, parece que los espíritus reclaman la presencia de todos nuestros usuarios.<br></font></b><br>Si quieres colaborar haz click en el botón inferior y sigue las instrucciones.<br><br></font>", "2mesex", "¡A la aventura!", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
        }
Exemplo n.º 11
0
        internal void ReceiveCrackableReward(RoomUser user, Room room, Item item)
        {
            if (room == null || item == null)
            {
                return;
            }

            if (item.GetBaseItem().InteractionType != InteractionType.PINATA && item.GetBaseItem().InteractionType != InteractionType.PINATATRIGGERED && item.GetBaseItem().InteractionType != InteractionType.RPGNEON && item.GetBaseItem().InteractionType != InteractionType.MAGICEGG && item.GetBaseItem().InteractionType != InteractionType.MAGICCHEST)
            {
                return;
            }

            if (!Crackable.ContainsKey(item.GetBaseItem().Id))
            {
                return;
            }

            Crackable.TryGetValue(item.GetBaseItem().Id, out CrackableItem crackable);
            if (crackable == null)
            {
                return;
            }

            int x = item.GetX, y = item.GetY;

            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
            int level = 0;
            int rand  = new Random().Next(0, 100);

            if (rand >= 95)
            {
                level = 5;                   // 005% de probabilidad de que salga nivel 5
            }
            else if (rand >= 85 && rand < 95)
            {
                level = 4; // 010% de probabilidad de que salga nivel 4
            }
            else if (rand >= 65 && rand < 85)
            {
                level = 3; // 020% de probabilidad de que salga nivel 3
            }
            else if (rand >= 35 && rand < 65)
            {
                level = 2; // 030% de probabilidad de que salga nivel 2
            }
            else
            {
                level = 1;                              // 035% de probabilidad de que salga nivel 1
            }
            // 100%

            List <CrackableRewards> possibleRewards = GetRewardsByLevel((int)crackable.ItemId, level);
            CrackableRewards        reward          = possibleRewards[new Random().Next(0, (possibleRewards.Count - 1))];

            Task.Run(() =>
            {
                using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    #region REWARD TYPES
                    switch (reward.CrackableRewardType)
                    {
                        #region NORMAL ITEMS REWARD
                    case "item":
                        goto ItemType;
                        #endregion

                        #region CREDITS REWARD
                    case "credits":
                        {
                            user.GetClient().GetHabbo().Credits += int.Parse(reward.CrackableReward);
                            user.GetClient().SendMessage(new CreditBalanceComposer(user.GetClient().GetHabbo().Credits));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("cred", "Acabas de ganar " + int.Parse(reward.CrackableReward) + " créditos en la piñata.", ""));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));
                            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                            dbClient.runFastQuery("DELETE FROM items WHERE id = " + item.Id);
                            return;
                        }
                        #endregion

                        #region DUCKETS REWARD
                    case "duckets":
                        {
                            user.GetClient().GetHabbo().Duckets += int.Parse(reward.CrackableReward);
                            user.GetClient().SendMessage(new HabboActivityPointNotificationComposer(user.GetClient().GetHabbo().Duckets, user.GetClient().GetHabbo().Duckets));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("duckets", "Acabas de ganar " + int.Parse(reward.CrackableReward) + " duckets en la piñata.", ""));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));
                            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                            dbClient.runFastQuery("DELETE FROM items WHERE id = " + item.Id);
                            return;
                        }
                        #endregion

                        #region DIAMONDS REWARD
                    case "diamonds":
                        {
                            user.GetClient().GetHabbo().Diamonds += int.Parse(reward.CrackableReward);
                            user.GetClient().SendMessage(new HabboActivityPointNotificationComposer(user.GetClient().GetHabbo().Diamonds, 0, 5));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("diamonds", "Acabas de ganar " + int.Parse(reward.CrackableReward) + " diamantes en la piñata.", ""));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));
                            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                            dbClient.runFastQuery("DELETE FROM items WHERE id = " + item.Id);
                            return;
                        }
                        #endregion

                        #region HONOR REWARD
                    case "honors":
                        {
                            user.GetClient().GetHabbo().GOTWPoints += int.Parse(reward.CrackableReward);
                            user.GetClient().SendMessage(new HabboActivityPointNotificationComposer(user.GetClient().GetHabbo().GOTWPoints, 0, 103));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("honor", "Acabas de ganar " + int.Parse(reward.CrackableReward) + " " + NeonEnvironment.GetDBConfig().DBData["seasonal.currency.name"] + " en la piñata.", ""));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));
                            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                            dbClient.runFastQuery("DELETE FROM items WHERE id = " + item.Id);
                            return;
                        }
                        #endregion

                        #region BADGE REWARD
                    case "badge":
                        {
                            if (user.GetClient().GetHabbo().GetBadgeComponent().HasBadge(reward.CrackableReward))
                            {
                                return;
                            }

                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de ganar la placa: " + reward.CrackableReward + ".", ""));
                            user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));

                            user.GetClient().GetHabbo().GetBadgeComponent().GiveBadge(reward.CrackableReward, true, user.GetClient());
                            room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                            dbClient.runFastQuery("DELETE FROM items WHERE id = " + item.Id);
                            return;
                        }
                        #endregion
                    }
                    #endregion

                    ItemType:
                    room.GetRoomItemHandler().RemoveFurniture(user.GetClient(), item.Id);
                    dbClient.runFastQuery("UPDATE items SET base_item = " + int.Parse(reward.CrackableReward) + ", extra_data = '' WHERE id = " + item.Id);
                    item.BaseItem = int.Parse(reward.CrackableReward);
                    item.ResetBaseItem();
                    item.ExtraData = string.Empty;
                    if (!room.GetRoomItemHandler().SetFloorItem(user.GetClient(), item, item.GetX, item.GetY, item.Rotation, true, false, true))
                    {
                        dbClient.runFastQuery("UPDATE items SET room_id = 0 WHERE id = " + item.Id);
                        user.GetClient().GetHabbo().GetInventoryComponent().UpdateItems(true);
                    }
                }

                user.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Acabas de sacar un " + rand + " en los dados. ¡Enhorabuena!", ""));
            });
        }
Exemplo n.º 12
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            int userId = Packet.PopInt();

            if (userId == 0 || userId == Session.GetHabbo().Id)
            {
                return;
            }

            string message = Packet.PopString();

            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendWhisper("Oops, has sido silenciado durante 15 segundos, no podrás enviar mensajes durante este lapso de tiempo.", 34);
                return;
            }

            if (message.Contains("&#1º;") || message.Contains("&#1º") || message.Contains("&#"))
            {
                Session.SendMessage(new MassEventComposer("habbopages/spammer.txt")); return;
            }

            if (Session.GetHabbo().LastMessage == message)
            {
                Session.GetHabbo().LastMessageCount++;
                if (Session.GetHabbo().LastMessageCount > 3)
                {
                    NeonEnvironment.GetGame().GetClientManager().RepeatAlert(new RoomInviteComposer(int.MinValue, "Repeat: " + Session.GetHabbo().Username + " / Frase: " + message + " / Veces: " + Session.GetHabbo().LastMessageCount + "."));
                    Session.GetHabbo().LastMessageCount = 0;
                }
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                NeonEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(message, out string word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.GetHabbo().TimeMuted = 15;
                    Session.SendNotification("Acabas de mencionar una palabra prohibida en el filtro de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ", tal vez pueda tratarse de un error. Asegúrate de no volver a repetirla, este sistema está hecho para evitar publicistas. Recuerda que se acaba de advertir a los miembros del equipo, si no se trata de un caso de publicidad no te asustes. Aviso " + Session.GetHabbo().BannedPhraseCount + " / 10");
                    NeonEnvironment.GetGame().GetClientManager().StaffAlert1(new RoomInviteComposer(int.MinValue, "Spammer: " + Session.GetHabbo().Username + " / Frase: " + message + " / Palabra: " + word.ToUpper() + " / Fase: " + Session.GetHabbo().BannedPhraseCount + " / 10."));
                    NeonEnvironment.GetGame().GetClientManager().StaffAlert2(new RoomNotificationComposer("Alerta de publicista:",
                                                                                                          "<b><font color=\"#B40404\">Por favor, recuerda investigar bien antes de recurrir a una sanción.</font></b><br><br>Palabra: <b>" + word.ToUpper() + "</b>.<br><br><b>Frase:</b><br><i>" + message +
                                                                                                          "</i>.<br><br><b>Tipo:</b><br>Chat de sala.\r\n" + "<b>Usuario: " + Session.GetHabbo().Username + "</b><br><b>Secuencia:</b> " + Session.GetHabbo().BannedPhraseCount + "/ 10.", "foto", "Investigar", "event:navigator/goto/" +
                                                                                                          Session.GetHabbo().CurrentRoomId));
                    return;
                }
                if (Session.GetHabbo().BannedPhraseCount >= 10)
                {
                    NeonEnvironment.GetGame().GetModerationManager().BanUser("Neon", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer spam con la Frase (" + message + ")", (NeonEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                return;
            }

            Session.GetHabbo().LastMessage = message;
            Session.GetHabbo().GetMessenger().SendInstantMessage(userId, message);
        }
Exemplo n.º 13
0
 public CalendarManager()
 {
     CampaignName = NeonEnvironment.GetDBConfig().DBData["advent.calendar.campaign"];
     StartUnix    = 0;
     CalendarDays = new Dictionary <int, CalendarDay>();
 }
Exemplo n.º 14
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            if (!NeonEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out ChatStyle Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (NeonEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Room.CheckRights(Session, false) && Room.muteSignalEnabled == true)
            {
                Session.SendWhisper("La sala está silenciada, no puedes hablar en ella hasta tanto el dueño o alguien con permisos en ella lo permita.", 34);
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oops, usted se encuentra silenciad@.", 34);
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                if (User.IncrementAndCheckFlood(out int MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Session.GetHabbo().LastMessage == Message)
            {
                Session.GetHabbo().LastMessageCount++;
                if (Session.GetHabbo().LastMessageCount > 3)
                {
                    NeonEnvironment.GetGame().GetClientManager().RepeatAlert(new RoomInviteComposer(int.MinValue, "Repeat: " + Session.GetHabbo().Username + " / Frase: " + Message + " / Veces: " + Session.GetHabbo().LastMessageCount + "."));
                    Session.GetHabbo().LastMessageCount = 0;
                }
            }

            if (Message.Contains("&#1º;") || Message.Contains("&#1º") || Message.Contains("&#"))
            {
                Session.SendMessage(new MassEventComposer("habbopages/spammer.txt")); return;
            }

            Room.GetFilter().CheckMessage(Message);
            if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSays, Session.GetHabbo(), Message.ToLower()))
            {
                return;
            }
            if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSaysCommand, Session.GetHabbo(), Message.ToLower()))
            {
                return;
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && NeonEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            NeonEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Neon.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                NeonEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out string word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.SendWhisper("¡Has mencionado una palabra no apta para el código de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + "! Aviso " + Session.GetHabbo().BannedPhraseCount + "/10", 34);

                    NeonEnvironment.GetGame().GetClientManager().StaffAlert1(new RoomInviteComposer(int.MinValue, "Spammer: " + Session.GetHabbo().Username + " / Frase: " + Message + " / Palabra: " + word.ToUpper() + " / Fase: " + Session.GetHabbo().BannedPhraseCount + " / 10."));
                    NeonEnvironment.GetGame().GetClientManager().StaffAlert2(new RoomNotificationComposer("Alerta de publicista:",
                                                                                                          "<b><font color=\"#B40404\">Por favor, recuerda investigar bien antes de recurrir a una sanción.</font></b><br><br>Palabra: <b>" + word.ToUpper() + "</b>.<br><br><b>Frase:</b><br><i>" + Message +
                                                                                                          "</i>.<br><br><b>Tipo:</b><br>Chat de sala.\r\n" + "<b>Usuario: " + Session.GetHabbo().Username + "</b><br><b>Secuencia:</b> " + Session.GetHabbo().BannedPhraseCount + "/10.", "foto", "Investigar", "event:navigator/goto/" +
                                                                                                          Session.GetHabbo().CurrentRoomId));
                    return;
                }
                if (Session.GetHabbo().BannedPhraseCount >= 10)
                {
                    NeonEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer spam con la frase (" + Message + ")", (NeonEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                Session.SendMessage(new ShoutComposer(User.VirtualId, "Mensaje Inapropiado", 0, Colour));
                return;
            }

            Session.GetHabbo().LastMessage = Message;
            NeonEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.UnIdle();
            User.OnChat(User.LastBubble, Message, true);
        }
Exemplo n.º 15
0
        public override void OnUserSay(RoomUser User, string Message)
        {
            if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null)
            {
                return;
            }

            if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8)
            {
                return;
            }

            // Notice that the bet is off to the users.
            if (BetsOpen == false)
            {
                GetRoomUser().Chat("Las apuestas están cerradas para esta partida, debes esperar todavía " + GameLength + " segundos para apostar.", false, 33);
                return;
            }

            if (User.GetClient().GetHabbo().Duckets >= 2 && BetsOpen == true)
            {
                // Define all the betting variables.
                string Multiplier = Message.Split(' ')[0];
                string Bet        = Message.Split(' ')[2];

                // Check if the multiplier is a number.
                if (!int.TryParse(Multiplier, out int IntMultiplier))
                {
                    GetRoomUser().Chat(Multiplier + " no es un valor apto para la apuesta.", false, 33);
                    return;
                }

                // Check if the bet is a number.
                if (!int.TryParse(Bet, out int IntBet))
                {
                    GetRoomUser().Chat(Bet + " no es un valor apto para la apuesta.", false, 33);
                    return;
                }

                // Check if the bet doesn't exceed the limits.
                if (IntBet < 0 || IntBet > 36)
                {
                    GetRoomUser().Chat("Debes apostar entre el 0 y el 36, no puedes salir de esos límites.", false, 33);
                    return;
                }

                User.GetClient().GetHabbo().GOTWPoints = User.GetClient().GetHabbo().GOTWPoints - IntMultiplier;
                User.GetClient().SendMessage(new HabboActivityPointNotificationComposer(User.GetClient().GetHabbo().GOTWPoints, -IntMultiplier, 103));
                User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("eventoxx", User.GetClient().GetHabbo().Username + ", acabas de apostar " + IntMultiplier + "  " + NeonEnvironment.GetDBConfig().DBData["seasonal.currency.name"] + " al " + IntBet + ".\n\n Buena suerte y apuesta con cabeza.", "catalog/open/habbiween"));

                GetRoomUser().Chat("Apuesta de " + IntMultiplier + "  " + NeonEnvironment.GetDBConfig().DBData["seasonal.currency.name"] + " realizada al " + IntBet + " por " + User.GetClient().GetHabbo().Username + ".", false, 33);

                offerMultiplier += .2;

                CasinoDataLocura data = new CasinoDataLocura
                {
                    bet      = IntBet,
                    quantity = IntMultiplier,
                    userId   = User.GetClient().GetHabbo().Id
                };


                Data1.Add(Bets, data);

                // Notify BET Id to the user.
                User.GetClient().SendShout(Bets + " es tu número de apuesta.", 33);

                Bets++;
            }
        }
Exemplo n.º 16
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            string VoucherCode = Packet.PopString().Replace("\r", "");

            if (!NeonEnvironment.GetGame().GetCatalog().GetVoucherManager().TryGetVoucher(VoucherCode, out Voucher Voucher))
            {
                Session.SendMessage(new VoucherRedeemErrorComposer(0));
                return;
            }

            if (Voucher.CurrentUses >= Voucher.MaxUses)
            {
                Session.SendNotification("¡Este Código voucher se ha usado en su maximo de veces Permitidas!");
                return;
            }

            DataRow GetRow = null;

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `user_vouchers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `voucher` = @Voucher LIMIT 1");
                dbClient.AddParameter("Voucher", VoucherCode);
                GetRow = dbClient.getRow();
            }

            if (GetRow != null)
            {
                Session.SendNotification("¡Ya usted ha usado este código Voucher!!");
                return;
            }
            else
            {
                using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `user_vouchers` (`user_id`,`voucher`) VALUES ('" + Session.GetHabbo().Id + "', @Voucher)");
                    dbClient.AddParameter("Voucher", VoucherCode);
                    dbClient.RunQuery();
                }
            }

            Voucher.UpdateUses();

            if (Voucher.Type == VoucherType.CREDIT)
            {
                Session.GetHabbo().Credits += Voucher.Value;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                Session.SendMessage(RoomNotificationComposer.SendBubble("voucher", "Acabas de recibir un premio voucher por el valor de " + Voucher.Value + " créditos. ¡Úsalos con cabeza, " + Session.GetHabbo().Username + ".", ""));
            }
            else if (Voucher.Type == VoucherType.DUCKET)
            {
                Session.GetHabbo().Duckets += Voucher.Value;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Voucher.Value));
                Session.SendMessage(RoomNotificationComposer.SendBubble("voucher", "Acabas de recibir un premio voucher por el valor de " + Voucher.Value + " duckets. ¡Úsalos con cabeza, " + Session.GetHabbo().Username + ".", ""));
            }
            else if (Voucher.Type == VoucherType.DIAMOND)
            {
                Session.GetHabbo().Diamonds += Voucher.Value;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, Voucher.Value, 5));
                Session.SendMessage(RoomNotificationComposer.SendBubble("voucher", "Acabas de recibir un premio voucher por el valor de " + Voucher.Value + " diamantes. ¡Úsalos con cabeza, " + Session.GetHabbo().Username + ".", ""));
            }
            else if (Voucher.Type == VoucherType.HONOR)
            {
                Session.GetHabbo().GOTWPoints += Voucher.Value;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().GOTWPoints, Voucher.Value, 103));
                Session.SendMessage(RoomNotificationComposer.SendBubble("voucher", "Acabas de recibir un premio voucher por el valor de " + Voucher.Value + " " + NeonEnvironment.GetDBConfig().DBData["seasonal.currency.name"] + ". ¡Úsalos con cabeza, " + Session.GetHabbo().Username + ".", ""));
            }
            else if (Voucher.Type == VoucherType.ITEM)
            {
                if (!NeonEnvironment.GetGame().GetItemManager().GetItem((Voucher.Value), out ItemData Item))
                {
                    // No existe este ItemId.
                    return;
                }

                Item GiveItem = ItemFactory.CreateSingleItemNullable(Item, Session.GetHabbo(), "", "");
                if (GiveItem != null)
                {
                    Session.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);

                    Session.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1));
                    Session.SendMessage(new FurniListUpdateComposer());
                    Session.SendMessage(RoomNotificationComposer.SendBubble("voucher", "Acabas de recibir un objeto raro desde un voucher. ¡Corre, " + Session.GetHabbo().Username + ", revisa tu inventario, hay algo nuevo al parecer!", ""));
                }

                Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
            }

            Session.SendMessage(new VoucherRedeemOkComposer());
        }
Exemplo n.º 17
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking

                //Let's have a quick search for a ban before we successfully authenticate..
                ModerationBan BanRecord;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (NeonEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                {
                    if (NeonEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                    {
                        Disconnect();
                        return(false);
                    }
                }

                #endregion

                NeonEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                _habbo = userData.user;


                if (_habbo != null)
                {
                    ssoTicket = AuthTicket;
                    userData.user.Init(this, userData);


                    SendMessage(new AuthenticationOKComposer());
                    SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects));
                    SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom));
                    SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingAllParts));
                    SendMessage(new UserRightsComposer(_habbo));
                    SendMessage(new AvailabilityStatusComposer());
                    SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints));


                    //var habboClubSubscription = new ServerPacket(ServerPacketHeader.HabboClubSubscriptionComposer);
                    //habboClubSubscription.WriteString("club_habbo");
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(2);
                    //habboClubSubscription.WriteBoolean(false);
                    //habboClubSubscription.WriteBoolean(false);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //habboClubSubscription.WriteInteger(0);
                    //SendMessage(habboClubSubscription);

                    SendMessage(new BuildersClubMembershipComposer());
                    SendMessage(new CfhTopicsInitComposer());

                    SendMessage(new BadgeDefinitionsComposer(NeonEnvironment.GetGame().GetAchievementManager()._achievements));
                    SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState)));

                    if (GetHabbo().GetMessenger() != null)
                    {
                        GetHabbo().GetMessenger().OnStatusChanged(true);
                    }

                    if (_habbo.Rank < 2 && !NeonStaticGameSettings.HotelOpenForUsers)
                    {
                        SendMessage(new SendHotelAlertLinkEventComposer("Actualmente solo el Equipo Adminsitrativo puede entrar al hotel para comprobar que todo está bien antes de que los usuarios puedan entrar. Vuelve a intentarlo en unos minutos, podrás encontrar más información en nuestro Facebook.", NeonEnvironment.GetDBConfig().DBData["facebook_url"]));
                        Thread.Sleep(10000);
                        Disconnect();
                        return(false);
                    }

                    if (!string.IsNullOrEmpty(MachineId))
                    {
                        if (_habbo.MachineId != MachineId)
                        {
                            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("MachineId", MachineId);
                                dbClient.AddParameter("id", _habbo.Id);
                                dbClient.RunQuery();
                            }
                        }

                        _habbo.MachineId = MachineId;
                    }
                    if (NeonEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup))
                    {
                        if (!string.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    if (NeonEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(_habbo.VIPRank, out SubscriptionData SubData))
                    {
                        if (!string.IsNullOrEmpty(SubData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this);
                            }
                        }
                    }

                    if (!NeonEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        NeonEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    GetHabbo()._lastitems = new Dictionary <int, CatalogItem>();
                    //ICollection<MessengerBuddy> Friends = new List<MessengerBuddy>();
                    //foreach (MessengerBuddy Buddy in this.GetHabbo().GetMessenger().GetFriends().ToList())
                    //{
                    //    if (Buddy == null)
                    //        continue;

                    //    GameClient Friend = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Buddy.Id);
                    //    if (Friend == null)
                    //        continue;
                    //    string figure = this.GetHabbo().Look;


                    //    Friend.SendMessage(RoomNotificationComposer.SendBubble("usr/look/" + this.GetHabbo().Username + "", this.GetHabbo().Username + " se ha conectado a " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ".", ""));

                    //}

                    if (GetHabbo()._NUX)
                    {
                        SendMessage(new MassEventComposer("habbopages/bienvenida.txt"));
                    }
                    else
                    {
                        SendMessage(new MassEventComposer("habbopages/welk.txt?249"));
                    }


                    if (NeonEnvironment.GetDBConfig().DBData["pin.system.enable"] == "0")
                    {
                        GetHabbo().StaffOk = true;
                    }

                    if (GetHabbo().StaffOk)
                    {
                        if (GetHabbo().GetPermissions().HasRight("mod_tickets"))
                        {
                            SendMessage(new ModeratorInitComposer(
                                            NeonEnvironment.GetGame().GetModerationManager().UserMessagePresets,
                                            NeonEnvironment.GetGame().GetModerationManager().RoomMessagePresets,
                                            NeonEnvironment.GetGame().GetModerationManager().GetTickets));
                        }
                    }

                    if (GetHabbo().Rank > 5 || GetHabbo()._guidelevel > 0)
                    {
                        HelperToolsManager.AddHelper(_habbo.GetClient(), false, true, true);
                        SendMessage(new HandleHelperToolComposer(true));
                    }

                    //SendMessage(new CampaignCalendarDataComposer(_habbo.calendarGift));
                    //if (int.Parse(NeonEnvironment.GetDBConfig().DBData["advent.calendar.enable"]) == 1) // Tk Custom By Whats
                    //    SendMessage(new MassEventComposer("openView/calendar"));

                    if (NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer != null)
                    {
                        NeonEnvironment.GetGame().GetTargetedOffersManager().Initialize(NeonEnvironment.GetDatabaseManager().GetQueryReactor());
                        TargetedOffers TargetedOffer = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer;

                        if (TargetedOffer.Expire > NeonEnvironment.GetIUnixTimestamp())
                        {
                            if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                            {
                                SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                            }
                        }
                        else if (TargetedOffer.Expire == -1)
                        {
                            if (TargetedOffer.Limit != GetHabbo()._TargetedBuy)
                            {
                                SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
                            }
                        }
                        else
                        {
                            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'");
                            }

                            using (IQueryAdapter dbClient2 = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0");
                            }
                        }
                    }

                    if (_habbo.MysticBoxes.Count == 0 && _habbo.MysticKeys.Count == 0)
                    {
                        int    box      = RandomNumber.GenerateRandom(1, 8);
                        string boxcolor = "";
                        switch (box)
                        {
                        case 1:
                            boxcolor = "purple";
                            break;

                        case 2:
                            boxcolor = "blue";
                            break;

                        case 3:
                            boxcolor = "green";
                            break;

                        case 4:
                            boxcolor = "yellow";
                            break;

                        case 5:
                            boxcolor = "lilac";
                            break;

                        case 6:
                            boxcolor = "orange";
                            break;

                        case 7:
                            boxcolor = "turquoise";
                            break;

                        case 8:
                            boxcolor = "red";
                            break;
                        }

                        int    key      = RandomNumber.GenerateRandom(1, 8);
                        string keycolor = "";
                        switch (key)
                        {
                        case 1:
                            keycolor = "purple";
                            break;

                        case 2:
                            keycolor = "blue";
                            break;

                        case 3:
                            keycolor = "green";
                            break;

                        case 4:
                            keycolor = "yellow";
                            break;

                        case 5:
                            keycolor = "lilac";
                            break;

                        case 6:
                            keycolor = "orange";
                            break;

                        case 7:
                            keycolor = "turquoise";
                            break;

                        case 8:
                            keycolor = "red";
                            break;
                        }

                        _habbo.MysticKeys.Add(keycolor);
                        _habbo.MysticBoxes.Add(boxcolor);

                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery("INSERT INTO user_mystic_data(user_id, mystic_keys, mystic_boxes) VALUES(" + GetHabbo().Id + ", '" + keycolor + "', '" + boxcolor + "');");
                        }
                    }

                    SendMessage(new MysteryBoxDataComposer(_habbo.GetClient()));

                    SendMessage(new HCGiftsAlertComposer());

                    //if(!GetHabbo()._NUX)
                    //{
                    //    DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                    //    dtDateTime = dtDateTime.AddSeconds(GetHabbo().LastOnline);

                    //    if ((DateTime.Now - dtDateTime).TotalDays > 2)
                    //    {
                    //        //NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1, true);
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1);
                    //    }

                    //    else if ((DateTime.Now - dtDateTime).TotalDays > 1 && (DateTime.Now - dtDateTime).TotalDays < 2)
                    //    {
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_Login", 1);
                    //        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_RegistrationDuration", 1);

                    //        if(GetHabbo().Rank > 2 || GetHabbo()._guidelevel > 0)
                    //        {
                    //            NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(_habbo.GetClient(), "ACH_GuideEnrollmentLifetime", 1);
                    //        }
                    //    }
                    //}


                    NeonEnvironment.GetGame().GetRewardManager().CheckRewards(this);

                    if (GetHabbo()._NUX)
                    {
                        NeonEnvironment.GetGame().GetClientManager().StaffAlert(new RoomInviteComposer(int.MinValue, GetHabbo().Username + " acaba de registrarse en Keko."));

                        GetHabbo()._NUX = false;
                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery("UPDATE users SET nux_user = '******' WHERE id = " + GetHabbo().Id + ";");
                        }
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Bug during user login: " + e);
            }
            return(false);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int    PageId      = Packet.PopInt();
            int    ItemId      = Packet.PopInt();
            string Data        = Packet.PopString();
            string GiftUser    = StringCharFilter.Escape(Packet.PopString());
            string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' '));
            int    SpriteId    = Packet.PopInt();
            int    Ribbon      = Packet.PopInt();
            int    Colour      = Packet.PopInt();

            _ = Packet.PopBoolean();

            if (NeonEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1")
            {
                Session.SendNotification("El Administrador tiene desactivado el enviar regalos a todo el Hotel");
                return;
            }

            if (!NeonEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out CatalogPage Page))
            {
                return;
            }

            if (Session.GetHabbo().Rank > 8 && !Session.GetHabbo().StaffOk)
            {
                return;
            }

            if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().CatRank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1))
            {
                return;
            }

            if (!Page.Items.TryGetValue(ItemId, out CatalogItem Item))
            {
                if (Page.ItemOffers.ContainsKey(ItemId))
                {
                    Item = Page.ItemOffers[ItemId];
                    if (Item == null)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (!ItemUtility.CanGiftItem(Item))
            {
                return;
            }

            if (!NeonEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out ItemData PresentData) || PresentData.InteractionType != InteractionType.GIFT)
            {
                return;
            }

            if (Session.GetHabbo().Credits < Item.CostCredits)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false));
                return;
            }

            if (Session.GetHabbo().Duckets < Item.CostPixels)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true));
                return;
            }

            Habbo Habbo = NeonEnvironment.GetHabboByUsername(GiftUser);

            if (Habbo == null)
            {
                Session.SendMessage(new GiftWrappingErrorComposer());
                return;
            }

            if (!Habbo.AllowGifts)
            {
                Session.SendNotification("Oops, este usuario no permite recibir regalos!");
                return;
            }

            if (Session.GetHabbo().Rank < 4)
            {
                if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
                {
                    Session.SendNotification("Estas enviando regalos muy rapido, espere un minimo de 15 segundos para enviar el siguiente!");

                    Session.GetHabbo().GiftPurchasingWarnings += 1;
                    if (Session.GetHabbo().GiftPurchasingWarnings >= 25)
                    {
                        Session.GetHabbo().SessionGiftBlocked = true;
                    }

                    return;
                }
            }


            if (Session.GetHabbo().SessionGiftBlocked)
            {
                return;
            }

            string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour;

            int NewItemId = 0;

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", ED);
                NewItemId = Convert.ToInt32(dbClient.InsertQuery());

                string ItemExtraData = null;
                switch (Item.Data.InteractionType)
                {
                case InteractionType.NONE:
                    ItemExtraData = "";
                    break;

                    #region Pet handling

                case InteractionType.pet0:
                case InteractionType.pet1:
                case InteractionType.pet2:
                case InteractionType.pet3:
                case InteractionType.pet4:
                case InteractionType.pet5:
                case InteractionType.pet6:
                case InteractionType.pet7:
                case InteractionType.pet8:
                case InteractionType.pet9:
                case InteractionType.pet10:
                case InteractionType.pet11:
                case InteractionType.pet12:
                case InteractionType.pet13:     //Caballo
                case InteractionType.pet14:
                case InteractionType.pet15:
                case InteractionType.pet16:     //Mascota agregada
                case InteractionType.pet17:     //Mascota agregada
                case InteractionType.pet18:     //Mascota agregada
                case InteractionType.pet19:     //Mascota agregada
                case InteractionType.pet20:     //Mascota agregada
                case InteractionType.pet21:     //Mascota agregada
                case InteractionType.pet22:     //Mascota agregada
                case InteractionType.pet28:
                case InteractionType.pet29:
                case InteractionType.pet30:

                    try
                    {
                        string[] Bits    = Data.Split('\n');
                        string   PetName = Bits[0];
                        string   Race    = Bits[1];
                        string   Color   = Bits[2];

                        int.Parse(Race);     // to trigger any possible errors

                        if (PetUtility.CheckPetName(PetName))
                        {
                            return;
                        }

                        if (Race.Length > 2)
                        {
                            return;
                        }

                        if (Color.Length != 6)
                        {
                            return;
                        }

                        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1);
                    }
                    catch
                    {
                        return;
                    }

                    break;

                    #endregion

                case InteractionType.FLOOR:
                case InteractionType.WALLPAPER:
                case InteractionType.LANDSCAPE:

                    double Number = 0;
                    try
                    {
                        if (string.IsNullOrEmpty(Data))
                        {
                            Number = 0;
                        }
                        else
                        {
                            Number = double.Parse(Data, NeonEnvironment.CultureInfo);
                        }
                    }
                    catch
                    {
                    }

                    ItemExtraData = Number.ToString().Replace(',', '.');
                    break;     // maintain extra data // todo: validate

                case InteractionType.POSTIT:
                    ItemExtraData = "FFFF33";
                    break;

                case InteractionType.MOODLIGHT:
                    ItemExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.TROPHY:
                    ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data;
                    break;

                case InteractionType.MANNEQUIN:
                    ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Maniqui";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data))
                    {
                        Session.SendMessage(new BroadcastMessageAlertComposer("Oops, al parecer usted no posee esta placa."));
                        return;
                    }

                    ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                    break;

                default:
                    ItemExtraData = Data;
                    break;
                }

                //Insert the present, forever.
                dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData));
                dbClient.RunQuery();

                //Here we're clearing up a record, this is dumb, but okay.
                dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;");
            }


            Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0);
            if (GiveItem != null)
            {
                GameClient Receiver = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id);
                if (Receiver != null)
                {
                    if (Receiver.GetHabbo().Rank <= 5)
                    {
                        Receiver.SendNotification("Usted acaba de recibir un regalo de parte de " + Session.GetHabbo().Username + "");
                    }
                    {
                        Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);
                        Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1));
                        Receiver.SendMessage(new PurchaseOKComposer());
                        Receiver.SendMessage(new FurniListAddComposer(GiveItem));
                        Receiver.SendMessage(new FurniListUpdateComposer());
                    }
                }
                NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1);
                NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1);
                NeonEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS);
                Session.SendNotification("Ha enviado correctamente un regalo");
            }

            Session.SendMessage(new PurchaseOKComposer(Item, PresentData));

            if (Item.CostCredits > 0)
            {
                Session.GetHabbo().Credits -= Item.CostCredits;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            if (Item.CostPixels > 0)
            {
                Session.GetHabbo().Duckets -= Item.CostPixels;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            }

            Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
        }