コード例 #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 LoadInvSongs()
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            Session.SendMessage(JukeboxDiscksComposer.SerializeSongInventory(Session.GetHabbo().GetInventoryComponent().songDisks));
        }
コード例 #3
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()));
        }
コード例 #4
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) && 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>()));
             }
         }
     }
 }