Exemplo n.º 1
0
 public CreateCharacter(ClientVersion version,
                        string charname,
                        ClientFlag clientflags,
                        Profession profession,
                        RaceAndGender raceandgender,
                        CharStats stats,
                        SkillValuePair[] startSkills,
                        Hue skincolor,
                        HairStyle hair,
                        Hue haircolor,
                        BeardStyle beard,
                        Hue beardcolor,
                        ushort locationindex,
                        ushort charslotnum,
                        IPAddress clientip,
                        Hue shirtcolor,
                        Hue pantscolor)
     : base(version)
 {
     CharName           = charname;
     ClientFlags        = clientflags;
     LoginCount         = 0; // ?
     Profession         = profession;
     RaceAndGender      = raceandgender;
     Stats              = stats;
     StartSkills        = startSkills;
     SkinColor          = skincolor;
     HairStyle          = hair;
     HairColor          = haircolor;
     FacialHairStyle    = beard;
     FacialHairColor    = beardcolor;
     StartLocationIndex = locationindex;
     CharSlotNum        = charslotnum;
     ClientIP           = clientip;
     ShirtColor         = shirtcolor;
     PantsColor         = pantscolor;
 }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClientFlag flags = ttclient.GetFlags();

            //Audio-tab
            if ((ttclient.Flags & ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX) ==
                ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX)
            {
                ttclient.CloseSoundDuplexDevices();
            }
            else
            {
                ttclient.CloseSoundInputDevice();
                ttclient.CloseSoundOutputDevice();
            }

            ItemData inputItem  = (ItemData)sndinputComboBox.SelectedItem;
            ItemData outputItem = (ItemData)sndoutputComboBox.SelectedItem;

            settings.sndinputid  = inputItem.id;
            settings.sndoutputid = outputItem.id;

            if (duplexCheckBox.Checked)
            {
                if (!ttclient.InitSoundDuplexDevices(settings.sndinputid, settings.sndoutputid))
                {
                    MessageBox.Show("Failed to init sound devices");
                }

                SpeexDSP spxdsp = new SpeexDSP(false);
                ttclient.GetSoundInputPreprocess(ref spxdsp);
                spxdsp.nEchoSuppress           = SpeexDSPConstants.DEFAULT_ECHO_SUPPRESS;
                spxdsp.nEchoSuppressActive     = SpeexDSPConstants.DEFAULT_ECHO_SUPPRESS_ACTIVE;
                spxdsp.bEnableEchoCancellation = echocancelCheckBox.Checked;
                ttclient.SetSoundInputPreprocess(spxdsp);
            }
            else
            {
                if (!ttclient.InitSoundInputDevice(settings.sndinputid))
                {
                    MessageBox.Show("Failed to init sound input device");
                }

                if (!ttclient.InitSoundOutputDevice(settings.sndoutputid))
                {
                    MessageBox.Show("Failed to init sound output device");
                }
            }

            if (wasapiRadioButton.Checked)
            {
                settings.soundsystem = SoundSystem.SOUNDSYSTEM_WASAPI;
            }
            else if (dsoundRadioButton.Checked)
            {
                settings.soundsystem = SoundSystem.SOUNDSYSTEM_DSOUND;
            }
            else if (winmmRadioButton.Checked)
            {
                settings.soundsystem = SoundSystem.SOUNDSYSTEM_WINMM;
            }

            //Video-tab
            if (viddevComboBox.Items.Count > 0)
            {
                VideoCodec codec = new VideoCodec();
                codec.nCodec = Codec.WEBM_VP8_CODEC;
                codec.webm_vp8.nRcTargetBitrate = (int)vidbitrateNumericUpDown.Value;
                codec.webm_vp8.nEncodeDeadline  = WebMVP8CodecConstants.WEBM_VPX_DL_REALTIME;

                VideoFormat capformat = videodevs[viddevComboBox.SelectedIndex].videoFormats[formatComboBox.SelectedIndex];

                if (ttclient.Flags.HasFlag(ClientFlag.CLIENT_VIDEOCAPTURE_READY) &&
                    !(settings.videoid == videodevs[viddevComboBox.SelectedIndex].szDeviceID &&
                      Util.Equals(codec, settings.codec) &&
                      Util.Equals(capformat, settings.capformat)))
                {
                    ttclient.CloseVideoCaptureDevice();
                }

                settings.codec.nCodec = Codec.WEBM_VP8_CODEC;
                settings.codec.webm_vp8.nRcTargetBitrate = (int)vidbitrateNumericUpDown.Value;

                settings.videoid   = videodevs[viddevComboBox.SelectedIndex].szDeviceID;
                settings.capformat = capformat;
                if (!ttclient.Flags.HasFlag(ClientFlag.CLIENT_VIDEOCAPTURE_READY))
                {
                    if (!ttclient.InitVideoCaptureDevice(settings.videoid, settings.capformat))
                    {
                        MessageBox.Show("Failed to initialize video capture device");
                    }
                }
            }

            //Advanced-tab
            if (fwCheckBox.Checked != WindowsFirewall.AppExceptionExists(Application.ExecutablePath))
            {
                if (fwCheckBox.Checked)
                {
                    WindowsFirewall.AddAppException(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    WindowsFirewall.RemoveAppException(Application.ExecutablePath);
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the client flag for this client
 /// </summary>
 /// <param name="nClientFlag"></param>
 public void setClientFlag(ClientFlag nClientFlag)
 {
     m_nClientFlag = nClientFlag;
 }