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().method_23().method_10((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().method_23().method_12((uint)num, 0u, true);
                         Session.GetHabbo().method_23().method_9(true);
                         Session.SendMessage(JukeboxDiscksComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList<SongInstance>()));
                     }
                 }
             }
         }
     }
 }
Пример #2
0
        internal void LoadMusic()
        {
            DataTable table;
            DataTable table2;
            using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
            {
                table = @class.ReadDataTable("SELECT * FROM items_rooms_songs WHERE roomid = '" + uint_0 + "'"); // <-- old
                table2 = @class.ReadDataTable("SELECT * FROM items_jukebox_songs WHERE jukeboxid = '" + this.GetRoomMusicController().LinkedItemId + "'"); // <-- new
            }

            foreach (DataRow row in table.Rows)
            {
                int songID = (int)row["songid"];
                uint num2 = (uint)row["itemid"];
                int baseItem = (int)row["baseitem"];
                SongItem diskItem = new SongItem((int)num2, songID, baseItem);
                diskItem.RemoveFromDatabase();
                diskItem.SaveToDatabase(this.GetRoomMusicController().LinkedItemId);
                this.GetRoomMusicController().AddDisk(diskItem);
            }

            foreach (DataRow row in table2.Rows)
            {
                int songID = (int)row["songid"];
                uint num2 = (uint)row["itemid"];
                int baseItem = (int)row["baseitem"];
                SongItem diskItem = new SongItem((int)num2, songID, baseItem);
                this.GetRoomMusicController().AddDisk(diskItem);
            }
        }