Esempio n. 1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario.");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Vaya, no se puede desbanear este usuario.");
                return;
            }

            string Username  = Habbo.Username;
            string IPAddress = "";

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                IPAddress = dbClient.getString();

                dbClient.runFastQuery("DELETE FROM `bans` WHERE `value` = '" + Habbo.Username + "' or `value` =  '" + IPAddress + "' LIMIT 1");
            }

            Session.SendWhisper("Éxito, usted desbaneo a '" + Username + "'!");
        }
Esempio n. 2
0
        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca un nombre de usuario y una hora válida en segundos (máx 600, nada más se vuelve a establecer en 600).");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Vaya, no se puede mutear ese usuario.");
                return;
            }

            if (double.TryParse(Params[2], out double Time))
            {
                if (Time > 600 && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_limit_override"))
                {
                    Time = 600;
                }

                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `users` SET `time_muted` = '" + Time + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TimeMuted = Time;
                    Habbo.GetClient().SendNotification("Fuiste muteado por un moderador por " + Time + " segundos!");
                }

                Session.SendWhisper("Usted muteo a: " + Habbo.Username + " por " + Time + " segundos.");
            }
            else
            {
                Session.SendWhisper("Por favor, introduzca un número entero válido.");
            }
        }
Esempio n. 3
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (!session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            string Username = packet.PopString();

            Habbo Player = CloudServer.GetHabboByUsername(Username);

            if (Player == null || Player.GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            if (session.GetHabbo().GetIgnores().TryGet(Player.Id))
            {
                return;
            }

            if (session.GetHabbo().GetIgnores().TryAdd(Player.Id))
            {
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `user_ignores` (`user_id`,`ignore_id`) VALUES(@uid,@ignoreId);");
                    dbClient.AddParameter("uid", session.GetHabbo().Id);
                    dbClient.AddParameter("ignoreId", Player.Id);
                    dbClient.RunQuery();
                }

                session.SendMessage(new IgnoreStatusComposer(1, Player.Username));

                CloudServer.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModIgnoreSeen", 1);
            }
        }
Esempio n. 4
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario que desea Ban IP y cuenta de la prohibición.");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos."); //BPU PROGRAMADO POR JOSEMY.
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Oops, no puedes banear este usuario.");
                return;
            }
            int    time     = 1576108800;
            string Reason   = "[bpu] PUBLICISTA";
            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, time);

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }

            Session.SendWhisper("Has baneado a '" + Username + "'  por publicista");
        }
Esempio n. 5
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (!session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            string Username = packet.PopString();

            Habbo Player = CloudServer.GetHabboByUsername(Username);

            if (Player == null)
            {
                return;
            }

            if (!session.GetHabbo().GetIgnores().TryGet(Player.Id))
            {
                return;
            }

            if (session.GetHabbo().GetIgnores().TryRemove(Player.Id))
            {
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("DELETE FROM `user_ignores` WHERE `user_id` = @uid AND `ignore_id` = @ignoreId");
                    dbClient.AddParameter("uid", session.GetHabbo().Id);
                    dbClient.AddParameter("ignoreId", Player.Id);
                    dbClient.RunQuery();
                }

                session.SendMessage(new IgnoreStatusComposer(3, Player.Username));
            }
        }
Esempio n. 6
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario que desea Ban IP y cuenta de la prohibición.");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Vaya, no se puede prohibir que el usuario.");
                return;
            }

            Double Expire = 0;
            string Hours  = Params[2];

            if (String.IsNullOrEmpty(Hours) || Hours == "perm")
            {
                Expire = CloudServer.GetUnixTimestamp() + 78892200;
            }
            else
            {
                Expire = (CloudServer.GetUnixTimestamp() + (Convert.ToDouble(Hours) * 3600));
            }

            string Reason = null;

            if (Params.Length >= 4)
            {
                Reason = CommandManager.MergeParams(Params, 3);
            }
            else
            {
                Reason = "Sin razón especificada.";
            }

            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire);

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }

            Session.SendWhisper("El éxito, usted tiene cuenta prohibido el usuario '" + Username + "' por " + Hours + " hora(s) con la razón: '" + Reason + "'!");
        }
        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();
            bool   dnow        = Packet.PopBoolean();

            if (CloudServer.GetGame().GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1")
            {
                Session.SendNotification("Os gerentes do Hotel desabilitaram presentear!");
                return;
            }

            CatalogPage Page = null;

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

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

            CatalogItem Item = null;

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

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

            ItemData PresentData = null;

            if (!CloudServer.GetGame().GetItemManager().GetGift(SpriteId, out 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 = CloudServer.GetHabboByUsername(GiftUser);

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

            if (!Habbo.AllowGifts)
            {
                Session.SendNotification("Ops! Esse usuário não aceita presentes!");
                return;
            }

            if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
            {
                Session.SendNotification("Você está comprando presentes muito rápido! Aguarde 15 segundos!");

                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 = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)");
                dbClient.AddParameter("baseId", PresentData.Id);
                dbClient.AddParameter("habboId", Habbo.Id);
                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.PET:

                    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;
                        }

                        CloudServer.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, CloudServer.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 Mannequin";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data))
                    {
                        Session.SendMessage(new BroadcastMessageAlertComposer("Ei, parece que esse emblema não é seu!"));
                        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 (@itemId, @baseId, @extra_data)");
                dbClient.AddParameter("itemId", NewItemId);
                dbClient.AddParameter("baseId", Item.Data.Id);
                dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData));
                dbClient.RunQuery();

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


            Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0);
            if (GiveItem != null)
            {
                GameClient Receiver = CloudServer.GetGame().GetClientManager().GetClientByUserID(Habbo.Id);
                if (Receiver != null)
                {
                    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());
                }

                if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage))
                {
                    CloudServer.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1);
                    if (Receiver != null)
                    {
                        CloudServer.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1);
                    }
                    CloudServer.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS);
                }
            }

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

            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;
        }
Esempio n. 8
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario que desea Ban IP y cuenta de la prohibición.");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Vaya, no se puede prohibir que el usuario.");
                return;
            }

            String IPAddress = String.Empty;
            Double Expire    = CloudServer.GetUnixTimestamp() + 78892200;
            string Username  = Habbo.Username;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");

                dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
                IPAddress = dbClient.getString();
            }

            string Reason = null;

            if (Params.Length >= 3)
            {
                Reason = CommandManager.MergeParams(Params, 2);
            }
            else
            {
                Reason = "No hay razón especifica.";
            }

            if (!string.IsNullOrEmpty(IPAddress))
            {
                CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire);
            }
            CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire);

            if (!string.IsNullOrEmpty(Habbo.MachineId))
            {
                CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.MachineId, Reason, Expire);
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }
            Session.SendWhisper("Éxito, la maquina de baneos baneo a: '" + Username + "' por la siguiente razón: '" + Reason + "'!");
        }
Esempio n. 9
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca un nombre de usuario y una longitud válida en días (minuto 1 día, máximo 365 días).");
                return;
            }

            Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]);

            if (Habbo == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos.");
                return;
            }

            if (Convert.ToDouble(Params[2]) == 0)
            {
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TradingLockExpiry = 0;
                    Habbo.GetClient().SendNotification("Su prohibición comercial excepcional se ha eliminado.");
                }

                Session.SendWhisper("Usted ha eliminado con éxito el baneo de tradeo a: " + Habbo.Username + ".");
                return;
            }

            double Days;

            if (double.TryParse(Params[2], out Days))
            {
                if (Days < 1)
                {
                    Days = 1;
                }

                if (Days > 365)
                {
                    Days = 365;
                }

                double Length = (CloudServer.GetUnixTimestamp() + (Days * 86400));
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.runFastQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
                }

                if (Habbo.GetClient() != null)
                {
                    Habbo.TradingLockExpiry = Length;
                    Habbo.GetClient().SendNotification("Se le ha prohibido el tradei por: " + Days + " día(s)!");
                }

                Session.SendWhisper("Usted con éxito ha prohibido el tradeo de " + Habbo.Username + " por " + Days + " día(s).");
            }
            else
            {
                Session.SendWhisper("Por favor, introduzca un número entero válido.");
            }
        }