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.PopWiredInt32()); // 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, TakenItem.songID.ToString(), true, true); Session.SendMessage(JukeboxComposer.Compose(Session)); Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity, Instance.GetRoomMusicController().Playlist.Values.ToList())); }
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.PopWiredUInt()); 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())); }
internal void GetPlaylists() { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null) { return; } Room currentRoom = Session.GetHabbo().CurrentRoom; if (!currentRoom.GotMusicController()) { return; } RoomMusicController musicController = currentRoom.GetRoomMusicController(); Session.SendMessage(JukeboxComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList())); //var song = musicController.Playlist[0]; //ServerMessage message = new ServerMessage(Outgoing.PlayListSongAdded); //message.AppendUInt(song.DiskItem.itemID); //message.AppendUInt(song.SongData.Id); //message.AppendString(song.SongData.Name); //message.AppendString(song.SongData.Data); //Session.SendMessage(message); }
/// <summary> /// Gets the music data. /// </summary> internal void GetMusicData() { int num = this.Request.GetInteger(); var list = new List <SongData>(); { for (int i = 0; i < num; i++) { SongData song = null; try { song = SongManager.GetSong(this.Request.GetUInteger()); } catch (Exception e) { song = null; } if (song != null) { list.Add(song); } } this.Session.SendMessage(JukeboxComposer.Compose(list)); list.Clear(); } }
/// <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>())); }
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())); }
private static void GetPlaylist(GameClient Session, ClientMessage Message) { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom == null || !currentRoom.CheckRights(Session, true, false)) { return; } Session.SendMessage(JukeboxComposer.Compose(currentRoom.GetRoomMusicController().PlaylistCapacity, currentRoom.GetRoomMusicController().Playlist.Values.ToList <SongInstance>())); }
private static void GetPlaylist(GameClient Session, ClientMessage Message) { Room Instance = Session.GetHabbo().CurrentRoom; if (Instance == null || !Instance.CheckRights(Session, true)) { return; } Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity, Instance.GetRoomMusicController().Playlist.Values.ToList())); }
/// <summary> /// Gets the playlists. /// </summary> internal void GetPlaylists() { 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(); this.Session.SendMessage(JukeboxComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>())); }
private static void GetSongData(GameClient Session, ClientMessage Message) { int num = Message.PopWiredInt32(); List <SongData> list = new List <SongData>(); checked { for (int i = 0; i < num; i++) { SongData song = SongManager.GetSong(Message.PopWiredUInt()); if (song != null) { list.Add(song); } } Session.SendMessage(JukeboxComposer.Compose(list)); } }
internal void GetPlaylists() { 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(); Session.SendMessage(JukeboxComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList())); }
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>())); }
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())); }
private static void GetSongData(GameClient Session, ClientMessage Message) { int Amount = Message.PopWiredInt32(); List <SongData> Songs = new List <SongData>(); for (int i = 0; i < Amount; i++) { SongData Song = GetSong(Message.PopWiredUInt()); if (Song == null) { continue; } Songs.Add(Song); } Session.SendMessage(JukeboxComposer.Compose(Songs)); }
/// <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>())); }
internal void GetMusicData() { int Amount = Request.ReadInt32(); List <SongData> Songs = new List <SongData>(); for (int i = 0; i < Amount; i++) { SongData Song = SongManager.GetSong(Request.ReadUInt32()); if (Song == null) { continue; } Songs.Add(Song); } Session.SendMessage(JukeboxComposer.Compose(Songs)); Songs.Clear(); Songs = null; }
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>())); }
private static void GetDisks(GameClient Session, ClientMessage Message) { Session.SendMessage(JukeboxComposer.Compose(Session)); }