Ejemplo n.º 1
0
        public int AddDisk(SongItem DiskItem)
        {
            uint songID = DiskItem.songID;

            if (songID == 0u)
            {
                return(-1);
            }
            SongData song = SongManager.GetSong(songID);

            if (song == null)
            {
                return(-1);
            }
            if (this.mLoadedDisks.ContainsKey(DiskItem.itemID))
            {
                return(-1);
            }
            this.mLoadedDisks.Add(DiskItem.itemID, DiskItem);
            int count = this.mPlaylist.Count;

            lock (this.mPlaylist)
            {
                this.mPlaylist.Add(count, new SongInstance(DiskItem, song));
            }
            return(count);
        }
Ejemplo n.º 2
0
        private static void RemoveFromPlaylist(GameClient Session, ClientMessage Message)
        {
            Room currentRoom = Session.GetHabbo().CurrentRoom;

            if (currentRoom == null || !currentRoom.GotMusicController() || !currentRoom.CheckRights(Session, true, false))
            {
                return;
            }
            SongItem songItem = currentRoom.GetRoomMusicController().RemoveDisk(Message.PopWiredInt32());

            if (songItem == null)
            {
                return;
            }
            Session.GetHabbo().GetInventoryComponent().AddNewItem(songItem.itemID, songItem.baseItem.ItemId, songItem.songID.ToString(), 0u, true, true, 0, 0, "");
            Session.SendMessage(JukeboxComposer.Compose(Session));
            Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList <SongInstance>()));
        }
Ejemplo n.º 3
0
        private static void AddToPlaylist(GameClient Session, ClientMessage Message)
        {
            Room currentRoom = Session.GetHabbo().CurrentRoom;

            if (currentRoom == null || !currentRoom.CheckRights(Session, true, false) || !currentRoom.GotMusicController() || currentRoom.GetRoomMusicController().PlaylistSize >= currentRoom.GetRoomMusicController().PlaylistCapacity)
            {
                return;
            }
            UserItem item = Session.GetHabbo().GetInventoryComponent().GetItem(Message.PopWiredUInt());

            if (item == null || item.GetBaseItem().InteractionType != InteractionType.musicdisc)
            {
                return;
            }
            SongItem songItem = new SongItem(item);
            int      num      = currentRoom.GetRoomMusicController().AddDisk(songItem);

            if (num < 0)
            {
                return;
            }
            Session.GetHabbo().GetInventoryComponent().RemoveItem(songItem.itemID, true);
            Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList <SongInstance>()));
        }
Ejemplo n.º 4
0
 public SongInstance(SongItem Item, SongData SongData)
 {
     this.mDiskItem = Item;
     this.mSongData = SongData;
 }
Ejemplo n.º 5
0
		public int AddDisk(SongItem DiskItem)
		{
			uint songID = DiskItem.songID;
			if (songID == 0u)
			{
				return -1;
			}
			SongData song = SongManager.GetSong(songID);
			if (song == null)
			{
				return -1;
			}
			if (this.mLoadedDisks.ContainsKey(DiskItem.itemID))
			{
				return -1;
			}
			this.mLoadedDisks.Add(DiskItem.itemID, DiskItem);
			int count = this.mPlaylist.Count;
			lock (this.mPlaylist)
			{
				this.mPlaylist.Add(count, new SongInstance(DiskItem, song));
			}
			return count;
		}
		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.PopWiredUInt();
			UserItem item = this.Session.GetHabbo().GetInventoryComponent().GetItem(num);
			if (item == null || item.GetBaseItem().InteractionType != InteractionType.musicdisc)
			{
				return;
			}
			SongItem 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 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.runFastQuery("UPDATE items SET user_id='0' WHERE id=" + num + " LIMIT 1");
			}
			this.Session.SendMessage(JukeboxComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList<SongInstance>()));
		}
Ejemplo n.º 7
0
		public SongInstance(SongItem Item, SongData SongData)
		{
			this.mDiskItem = Item;
			this.mSongData = SongData;
		}
Ejemplo n.º 8
0
		private static void AddToPlaylist(GameClient Session, ClientMessage Message)
		{
			Room currentRoom = Session.GetHabbo().CurrentRoom;
			if (currentRoom == null || !currentRoom.CheckRights(Session, true, false) || !currentRoom.GotMusicController() || currentRoom.GetRoomMusicController().PlaylistSize >= currentRoom.GetRoomMusicController().PlaylistCapacity)
			{
				return;
			}
			UserItem item = Session.GetHabbo().GetInventoryComponent().GetItem(Message.PopWiredUInt());
			if (item == null || item.GetBaseItem().InteractionType != InteractionType.musicdisc)
			{
				return;
			}
			SongItem songItem = new SongItem(item);
			int num = currentRoom.GetRoomMusicController().AddDisk(songItem);
			if (num < 0)
			{
				return;
			}
			Session.GetHabbo().GetInventoryComponent().RemoveItem(songItem.itemID, true);
			Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList<SongInstance>()));
		}
Ejemplo n.º 9
0
		internal void LoadMusic()
		{
			DataTable table;
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT items_rooms_songs.songid,items.id,items.base_item FROM items_rooms_songs LEFT JOIN items ON items.id = items_rooms_songs.itemid WHERE items_rooms_songs.roomid = " + this.RoomId);
				table = queryreactor.getTable();
			}

            if (table != null)
            {
                foreach (DataRow dataRow in table.Rows)
                {
                    uint songID = (uint)dataRow[0];
                    uint num = Convert.ToUInt32(dataRow[1]);
                    int baseItem = Convert.ToInt32(dataRow[2]);
                    string songCode = "";
                    string extraData = "";
                    using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                    {
                        queryreactor2.setQuery("SELECT extra_data,songcode FROM items WHERE id = " + num);
                        DataRow row = queryreactor2.getRow();
                        if (row != null)
                        {
                            extraData = (string)row["extra_data"];
                            songCode = (string)row["songcode"];
                        }
                    }
                    SongItem diskItem = new SongItem(num, songID, baseItem, extraData, songCode);
                    this.GetRoomMusicController().AddDisk(diskItem);
                }
            }
		}