using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using Uber.Storage;
using Uber.Util;
using Uber.Messages;

namespace Uber.HabboHotel.Items
{
    class SoundMachine
    {
        public string TraxSong;
        public string TraxMusicName;
        public string TraxOwner;

        public uint TraxRoomId;
        public uint TraxSongId;
        public uint TraxSongLength;

        public int TraxPart_1 = UberEnvironment.GetRandomNumber(100, 300);
        public int TraxPart_2 = UberEnvironment.GetRandomNumber(100, 300);
        public int TraxPart_3 = UberEnvironment.GetRandomNumber(100, 250);
        public int TraxPart_4 = UberEnvironment.GetRandomNumber(100, 150);
        public int TraxPart_5 = UberEnvironment.GetRandomNumber(50, 60);
        public int TraxPart_6 = UberEnvironment.GetRandomNumber(80, 100);

        public SoundMachine(uint mTraxRoomId, string mTraxOwner, uint mTraxSongId, uint mTraxSongLength, string mTraxMusicName)
        {
            this.TraxRoomId = mTraxRoomId;
            this.TraxOwner = mTraxOwner;
            this.TraxSong = "1:" + TraxPart_1 + ",3;" + TraxPart_2 + ",3;" + TraxPart_3 + ",4;" + TraxPart_4 + ",4;" + TraxPart_5 + ",3;" + TraxPart_6 + ",4:2:0,21:3:0,21:4:0,21:";
            this.TraxSongId = mTraxSongId;
            this.TraxSongLength = mTraxSongLength;
            this.TraxMusicName = mTraxMusicName;
        }

        public ServerMessage PrepareSong()
        {
            // DlaWudmooie muziek{2}1:277,3;278,3;275,4;276,4;279,3;274,4:2:0,21:3:0,21:4:0,21:{2}{1} 

            ServerMessage PrepareTraxSong = new ServerMessage(300);
            PrepareTraxSong.AppendUInt(TraxSongId);
            PrepareTraxSong.AppendStringWithBreak(TraxMusicName);
            PrepareTraxSong.AppendStringWithBreak(TraxSong);
            PrepareTraxSong.AppendInt32(1);

            return PrepareTraxSong;
        }

        public ServerMessage Play()
        {
            // ECrm_}ZEIaWudQEmooie muziek{2}vogel-twanio{2}{1} 

            ServerMessage PlayTrax = new ServerMessage(323);
            PlayTrax.AppendUInt(TraxRoomId);
            PlayTrax.AppendInt32(1);
            PlayTrax.AppendUInt(TraxSongId);
            PlayTrax.AppendUInt(TraxSongLength);
            PlayTrax.AppendStringWithBreak(TraxMusicName);
            PlayTrax.AppendStringWithBreak(TraxOwner);
            PlayTrax.AppendInt32(1);

            return PlayTrax;
        }
    }
}