示例#1
0
        public void RemoveCdToJuke()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }

            var currentRoom = Session.GetHabbo().CurrentRoom;

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

            var musicController = currentRoom.GetRoomMusicController();

            var item = musicController.RemoveDisk(Request.PopWiredInt32());

            if (item == null)
            {
                return;
            }

            item.RemoveFromDatabase();
            Session.GetHabbo().GetInventoryComponent().AddNewItem((uint)item.itemID, item.baseItem.ItemId, item.songID.ToString(), true, true, false, item.baseItem.Name, Session.GetHabbo().Id, (uint)item.songID);
            Session.GetHabbo().GetInventoryComponent().UpdateItems(false);

            Session.SendMessage(JukeboxDiscksComposer.SerializeSongInventory(Session.GetHabbo().GetInventoryComponent().songDisks));
            Session.SendMessage(JukeboxDiscksComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList()));
        }
示例#2
0
 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().GetInventoryComponent().GetItemById((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().GetInventoryComponent().method_12((uint)num, 0u, true);
                         Session.GetHabbo().GetInventoryComponent().method_9(true);
                         Session.SendMessage(JukeboxDiscksComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
                     }
                 }
             }
         }
     }
 }
示例#3
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            /*ServerMessage Message = new ServerMessage(334u);
             * Message.AppendInt32(20);
             * Message.AppendInt32(16);
             * for (int i = 1; i <= 16; i++)
             * {
             *      Message.AppendInt32(i);
             *      Message.AppendInt32(i);
             * }
             * Session.SendMessage(Message);*/

            Room currentRoom = Session.GetHabbo().CurrentRoom;
            RoomMusicController roomMusicController = currentRoom.GetRoomMusicController();

            Session.SendMessage(JukeboxDiscksComposer.Compose(roomMusicController.PlaylistCapacity, roomMusicController.Playlist.Values.ToList <SongInstance>()));
        }
示例#4
0
        public void LoadJukeSongs()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }

            var currentRoom = Session.GetHabbo().CurrentRoom;

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

            var musicController = currentRoom.GetRoomMusicController();

            Session.SendMessage(JukeboxDiscksComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList()));
        }
示例#5
0
        public void AddNewCdToJuke()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return;
            }

            var currentRoom = Session.GetHabbo().CurrentRoom;

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

            var musicController = currentRoom.GetRoomMusicController();

            if (musicController.PlaylistSize >= musicController.PlaylistCapacity)
            {
                return;
            }

            var itemId = Request.PopWiredInt32();
            var item   = Session.GetHabbo().GetInventoryComponent().GetItem((uint)itemId);

            if (item == null || item.mBaseItem.InteractionType != InteractionType.musicdisc)
            {
                return;
            }

            var sitem = new SongItem(item);

            var NewOrder = musicController.AddDisk(sitem);

            if (NewOrder < 0)
            {
                return;
            }

            sitem.SaveToDatabase((int)currentRoom.RoomId);
            Session.GetHabbo().GetInventoryComponent().RemoveItem((uint)itemId, true);
            Session.SendMessage(JukeboxDiscksComposer.SerializeSongInventory(Session.GetHabbo().GetInventoryComponent().songDisks));
            Session.SendMessage(JukeboxDiscksComposer.Compose(musicController.PlaylistCapacity, musicController.Playlist.Values.ToList()));
        }
 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>()));
             }
         }
     }
 }
示例#7
0
        public void GetMusicData()
        {
            try
            {
                var Amount = Request.PopWiredInt32();
                var Songs  = new List <SongData>();

                for (var i = 0; i < Amount; i++)
                {
                    var Song = SongManager.GetSong(Request.PopWiredInt32());
                    if (Song == null)
                    {
                        continue;
                    }
                    Songs.Add(Song);
                }
                Session.SendMessage(JukeboxDiscksComposer.Compose(Songs));

                Songs.Clear();
            }
            catch { }
        }