Example #1
0
        internal void RemovePlaylistItem()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }

            Room currentRoom = Session.GetHabbo().CurrentRoom;

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

            RoomMusicController musicController = currentRoom.GetRoomMusicController();

            SongItem item = musicController.RemoveDisk(Request.ReadInt32());

            if (item == null)
            {
                return;
            }

            item.RemoveFromDatabase();
            Session.GetHabbo().GetInventoryComponent().AddNewItem(item.itemID, item.baseItem.ItemId, new StringData(item.songID.ToString()), 0, true, true);
            Session.GetHabbo().GetInventoryComponent().UpdateItems(false);

            Session.SendMessage(JukeboxComposer.SerializeSongInventory(Session.GetHabbo().GetInventoryComponent().songDisks));
            Session.SendMessage(JukeboxComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList()));
        }
Example #2
0
        /// <summary>
        /// Removes the playlist item.
        /// </summary>
        internal void RemovePlaylistItem()
        {
            if (this.Session == null || this.Session.GetHabbo() == null || this.Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;

            if (!currentRoom.GotMusicController())
            {
                return;
            }
            RoomMusicController roomMusicController = currentRoom.GetRoomMusicController();
            SongItem            songItem            = roomMusicController.RemoveDisk(this.Request.GetInteger());

            if (songItem == null)
            {
                return;
            }
            songItem.RemoveFromDatabase();
            this.Session.GetHabbo().GetInventoryComponent().AddNewItem(songItem.ItemId, songItem.BaseItem.ItemId, songItem.ExtraData, 0u, false, true, 0, 0, songItem.SongCode);
            this.Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
            using (IQueryAdapter queryReactor = global::Plus.Plus.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.RunFastQuery(string.Format("UPDATE items_rooms SET user_id='{0}' WHERE id='{1}' LIMIT 1;", Session.GetHabbo().Id, songItem.ItemId));
            }
            this.Session.SendMessage(JukeboxComposer.SerializeSongInventory(this.Session.GetHabbo().GetInventoryComponent().SongDisks));
            this.Session.SendMessage(JukeboxComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
        }
 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) && currentRoom.GotMusicController())
         {
             RoomMusicController roomMusicController = currentRoom.GetRoomMusicController();
             SongItem            item = roomMusicController.RemoveDisk(Event.PopWiredInt32());
             if (item != null)
             {
                 item.RemoveFromDatabase();
                 Session.GetHabbo().GetInventoryComponent().method_11((uint)item.itemID, item.baseItem.UInt32_0, item.songID.ToString(), false);
                 Session.GetHabbo().GetInventoryComponent().method_9(true);
                 Session.SendMessage(JukeboxDiscksComposer.SerializeSongInventory(Session.GetHabbo().GetInventoryComponent().songDisks));
                 Session.SendMessage(JukeboxDiscksComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
             }
         }
     }
 }