Beispiel #1
0
        internal void UpdateBadges()
        {
            Session.GetHabbo().GetBadgeComponent().ResetSlots();

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE user_badges SET badge_slot = 0 WHERE user_id = " + Session.GetHabbo().Id);
            }

            if (Request.RemainingLength > 0)
            {
                while (Request.RemainingLength > 0)
                {
                    int    Slot  = Request.PopWiredInt32();
                    string Badge = Request.PopFixedString();

                    if (Badge.Length == 0)
                    {
                        continue;
                    }

                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5)
                    {
                        return;
                    }

                    Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot;

                    using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                    {
                        dbClient.setQuery("UPDATE user_badges SET badge_slot = " + Slot + " WHERE badge_id = @badge AND user_id = " + Session.GetHabbo().Id + "");
                        dbClient.addParameter("badge", Badge);
                        dbClient.runQuery();
                    }
                }

                ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.PROFILE_BADGE);
            }

            ServerMessage Message = new ServerMessage(228);

            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount);

            foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList.Values)
            {
                if (Badge.Slot <= 0)
                {
                    continue;
                }

                Message.AppendInt32(Badge.Slot);
                Message.AppendStringWithBreak(Badge.Code);
            }

            if (Session.GetHabbo().InRoom&& ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
            {
                ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message);
            }
            else
            {
                Session.SendMessage(Message);
            }
        }
Beispiel #2
0
        internal void AddRoomToSelectionStaff()
        {
            if (!Session.GetHabbo().HasFuse("fuse_add_room_staff"))
            {
                return;
            }

            //if (!OtanixEnvironment.GetGame().GetNewNavigatorManager().CategoryExists(EmuSettings.NAVIGATOR_STAFF_SELECTION))
            //{
            //    Session.SendNotif(LanguageLocale.GetValue("navigator.contains.selection.staff").Replace("{0}", EmuSettings.NAVIGATOR_STAFF_SELECTION));
            //    return;
            //}

            uint     RoomId = Request.PopWiredUInt();
            RoomData Data   = OtanixEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Data == null)
            {
                return;
            }

            bool RemoveRoom = Request.PopWiredBoolean();

            if (RemoveRoom == false)
            {
                if (OtanixEnvironment.GetGame().GetNewNavigatorManager().GetRoomsInCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION).Contains(RoomId))
                {
                    Session.SendNotif(LanguageLocale.GetValue("navigator.contains.room.selection.staff"));
                    return;
                }

                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("INSERT INTO navigator_new_selections VALUES (@id, '" + RoomId + "')");
                    dbClient.addParameter("id", EmuSettings.NAVIGATOR_STAFF_SELECTION);
                    dbClient.runQuery();
                }

                OtanixEnvironment.GetGame().GetNewNavigatorManager().AddRoomToCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION, RoomId);

                Data.Type = "public";
                Data.roomNeedSqlUpdate = true;

                GameClient User = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID((UInt32)Data.OwnerId);
                OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement((UInt32)Data.OwnerId, "ACH_Spr", 1);

                OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "-Selection Staff-", "Added this room:" + RoomId);
            }
            else
            {
                if (!OtanixEnvironment.GetGame().GetNewNavigatorManager().GetRoomsInCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION).Contains(RoomId))
                {
                    Session.SendNotif(LanguageLocale.GetValue("navigator.no.contains.room.selection.staff"));
                    return;
                }

                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.runFastQuery("DELETE FROM navigator_new_selections WHERE room_id = '" + RoomId + "'");
                }

                OtanixEnvironment.GetGame().GetNewNavigatorManager().RemoveRoomToCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION, RoomId);

                Data.Type = "private";
                Data.roomNeedSqlUpdate = true;

                OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "-Selection Staff-", "Removed this room:" + RoomId);
            }

            Room Room = OtanixEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);

            if (Room != null)
            {
                ServerMessage Update = new ServerMessage(Outgoing.UpdateRoom);
                Update.AppendUInt(Room.Id);
                Room.SendMessage(Update);
            }
        }
Beispiel #3
0
        internal void SendInstantInvite()
        {
            var count = Request.PopWiredInt32();

            var UserIds = new List <uint>();

            for (var i = 0; i < count; i++)
            {
                UserIds.Add(Request.PopWiredUInt());
            }

            var message = OtanixEnvironment.FilterInjectionChars(Request.PopFixedString(), true);

            #region Mute
            if (Session.GetHabbo().Rank < 4) // Si no es un staff comprobamos si está muteado.
            {
                int timeToEndGlobalMute = OtanixEnvironment.GetGame().GetMuteManager().HasMuteExpired(Session.GetHabbo().Id);
                if (timeToEndGlobalMute > 0)
                {
                    return;
                }
            }
            #endregion
            #region Flood
            if (!Session.GetHabbo().HasFuse("ignore_flood_filter"))
            {
                TimeSpan SinceLastMessage = DateTime.Now - Session.GetHabbo().spamFloodTime;
                if (SinceLastMessage.Seconds > 3)
                {
                    FloodCount = 0;
                }
                else if (FloodCount > 5)
                {
                    OtanixEnvironment.GetGame().GetMuteManager().AddUserMute(Session.GetHabbo().Id, 0.5);
                    return;
                }
                Session.GetHabbo().spamFloodTime = DateTime.Now;
                FloodCount++;
            }
            #endregion
            #region Filter
            if (!Session.GetHabbo().HasFuse("ignore_spam_filter"))
            {
                if (BlackWordsManager.Check(message, BlackWordType.Hotel, Session, "<Consola Spam>"))
                {
                    return;
                }
            }
            #endregion

            ServerMessage Message = new ServerMessage(Outgoing.InstantInvite);
            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendString(message);

            foreach (var Id in UserIds)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(Id))
                {
                    continue;
                }

                var Client = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(Id);

                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().IgnoreRoomInvitations)
                {
                    return;
                }

                Client.SendMessage(Message);
            }
        }