Пример #1
0
 public void Handle(GameClient Session, ClientMessage Event)
 {
     if (((Session != null) && (Session.GetHabbo() != null)) && (Session.GetHabbo().CurrentRoom != null))
     {
         Room currentRoom = Session.GetHabbo().CurrentRoom;
         if (currentRoom.CheckRights(Session, true))
         {
             RoomMusicController roomMusicController = currentRoom.GetRoomMusicController();
             if (roomMusicController.PlaylistSize < roomMusicController.PlaylistCapacity)
             {
                 int      num  = Event.PopWiredInt32();
                 UserItem item = Session.GetHabbo().GetInventoryComponent().GetItemById((uint)num);
                 if ((item != null) && (item.method_1().InteractionType == "musicdisc"))
                 {
                     SongItem diskItem = new SongItem(item);
                     if (roomMusicController.AddDisk(diskItem) >= 0)
                     {
                         //diskItem.SaveToDatabase((int)currentRoom.Id); // <-- old
                         diskItem.SaveToDatabase((int)roomMusicController.LinkedItemId); // <-- new
                         Session.GetHabbo().GetInventoryComponent().method_12((uint)num, 0u, true);
                         Session.GetHabbo().GetInventoryComponent().method_9(true);
                         Session.SendMessage(JukeboxDiscksComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
                     }
                 }
             }
         }
     }
 }
Пример #2
0
        internal void AddPlaylistItem()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }

            Room currentRoom = Session.GetHabbo().CurrentRoom;

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

            RoomMusicController musicController = currentRoom.GetRoomMusicController();


            if (musicController.PlaylistSize >= musicController.PlaylistCapacity)
            {
                return;
            }

            uint     itemID = Request.ReadUInt32();
            UserItem item   = Session.GetHabbo().GetInventoryComponent().GetItem(itemID);

            if (item == null || item.GetBaseItem().InteractionType != InteractionType.musicdisc)
            {
                return;
            }

            //RoomItem roomItem = new RoomItem(item.Id, currentRoom.RoomId, item.BaseItem, ((StringData)item.data).Data, 0, 0, 0, 0, currentRoom);
            SongItem sitem = new SongItem(item);

            int NewOrder = musicController.AddDisk(sitem);

            if (NewOrder < 0)
            {
                return;
            }
            sitem.SaveToDatabase(currentRoom.RoomId);
            Session.GetHabbo().GetInventoryComponent().RemoveItem(itemID, true);
            Session.SendMessage(JukeboxComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList()));
        }
Пример #3
0
        /// <summary>
        /// Adds the playlist item.
        /// </summary>
        internal void AddPlaylistItem()
        {
            if (this.Session == null || this.Session.GetHabbo() == null || this.Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;

            if (!currentRoom.CheckRights(this.Session, true, false))
            {
                return;
            }
            RoomMusicController roomMusicController = currentRoom.GetRoomMusicController();

            if (roomMusicController.PlaylistSize >= roomMusicController.PlaylistCapacity)
            {
                return;
            }
            uint     num  = this.Request.GetUInteger();
            UserItem item = this.Session.GetHabbo().GetInventoryComponent().GetItem(num);

            if (item == null || item.BaseItem.InteractionType != Interaction.MusicDisc)
            {
                return;
            }
            var songItem = new SongItem(item);
            int num2     = roomMusicController.AddDisk(songItem);

            if (num2 < 0)
            {
                return;
            }
            songItem.SaveToDatabase(currentRoom.RoomId);
            this.Session.GetHabbo().GetInventoryComponent().RemoveItem(num, true);
            using (IQueryAdapter queryReactor = global::Plus.Plus.GetDatabaseManager().GetQueryReactor())
                queryReactor.RunFastQuery(string.Format("UPDATE items_rooms SET user_id='0' WHERE id={0} LIMIT 1", num));
            this.Session.SendMessage(JukeboxComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
        }