Пример #1
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()));
        }
Пример #2
0
        public int AddDisk(SongItem DiskItem)
        {
            uint SongId = (uint)DiskItem.songID;


            if (SongId == 0)
            {
                return(-1);
            }

            SongData SongData = SongManager.GetSong(SongId);

            if (SongData == null)
            {
                return(-1);
            }

            if (mLoadedDisks.ContainsKey(DiskItem.itemID))
            {
                return(-1);
            }

            mLoadedDisks.Add(DiskItem.itemID, DiskItem);

            int NewPlaylistId = mPlaylist.Count;

            lock (mPlaylist)
            {
                mPlaylist.Add(NewPlaylistId, new SongInstance(DiskItem, SongData));
            }

            return(NewPlaylistId);
        }
Пример #3
0
        private static void AddToPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null || !Instance.CheckRights(Session, true) || !Instance.GotMusicController() ||
                Instance.GetRoomMusicController().PlaylistSize >= Instance.GetRoomMusicController().PlaylistCapacity)
            {
                return;
            }

            UserItem DiskUserItem = Session.GetHabbo().GetInventoryComponent().GetItem(Message.ReadUInt32());

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

            SongItem item = new SongItem(DiskUserItem);

            int NewOrder = Instance.GetRoomMusicController().AddDisk(item);

            if (NewOrder < 0)
            {
                return;
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(item.itemID, true);

            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                                                        Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
Пример #4
0
        private static void RemoveFromPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null || !Instance.GotMusicController() || !Instance.CheckRights(Session, true))
            {
                return;
            }

            SongItem TakenItem = Instance.GetRoomMusicController().RemoveDisk(Message.ReadInt32());

            // playlist will skip to the next item automatically if it has to

            if (TakenItem == null)
            {
                return;
            }

            Session.GetHabbo().GetInventoryComponent().AddNewItem(TakenItem.itemID, TakenItem.baseItem.ItemId, new StringData(TakenItem.songID.ToString()), 0, true, true);


            Session.SendMessage(JukeboxComposer.Compose(Session));
            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                                                        Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
Пример #5
0
 public SongInstance(SongItem Item, SongData SongData)
 {
     mDiskItem = Item;
     mSongData = SongData;
 }
Пример #6
0
        internal void LoadMusic()
        {
            DataTable dTable;
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT items_rooms_songs.songid,items.* FROM items_rooms_songs LEFT JOIN items ON items.item_id = items_rooms_songs.itemid WHERE items_rooms_songs.roomid = " + this.RoomId);
                dTable = dbClient.getTable();
            }

            int songID;
            uint itemID;
            int baseID;

            foreach (DataRow dRow in dTable.Rows)
            {
                songID = (int)dRow[0];
                itemID = Convert.ToUInt32(dRow[1]);
                baseID = Convert.ToInt32(dRow[2]);

                SongItem item = new SongItem(itemID, songID, baseID);
                GetRoomMusicController().AddDisk(item);
            }
        }
Пример #7
0
        private static void AddToPlaylist(GameClient Session, ClientMessage Message)
        {
            Room Instance = Session.GetHabbo().CurrentRoom;

            if (Instance == null || !Instance.CheckRights(Session, true) || !Instance.GotMusicController() ||
                Instance.GetRoomMusicController().PlaylistSize >= Instance.GetRoomMusicController().PlaylistCapacity)
            {
                return;
            }

            UserItem DiskUserItem = Session.GetHabbo().GetInventoryComponent().GetItem(Message.ReadUInt32());

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

            SongItem item = new SongItem(DiskUserItem);

            int NewOrder = Instance.GetRoomMusicController().AddDisk(item);

            if (NewOrder < 0)
            {
                return;
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(item.itemID, true);

            Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
                Instance.GetRoomMusicController().Playlist.Values.ToList()));
        }
Пример #8
0
 public SongInstance(SongItem Item, SongData SongData)
 {
     mDiskItem = Item;
     mSongData = SongData;
 }
Пример #9
0
        public int AddDisk(SongItem DiskItem)
        {
            uint SongId = (uint)DiskItem.songID;

            if (SongId == 0)
            {
                return -1;
            }

            SongData SongData = SongManager.GetSong(SongId);

            if (SongData == null)
            {
                return -1;
            }

            if (mLoadedDisks.ContainsKey(DiskItem.itemID))
                return -1;

            mLoadedDisks.Add(DiskItem.itemID, DiskItem);

            int NewPlaylistId = mPlaylist.Count;

            lock (mPlaylist)
            {
                mPlaylist.Add(NewPlaylistId, new SongInstance(DiskItem, SongData));
            }

            return NewPlaylistId;
        }