예제 #1
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            string directory = Path.Combine(PathUtils.ApplicationDirectory, "Input");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            if (this.client != null)
            {
                this.client.Dispose();
                this.client = null;
            }

            OpenTibia.Core.Version version = (OpenTibia.Core.Version) this.inputVersionComboBox.SelectedItem;
            string datPath = Path.Combine(directory, "Tibia.dat");
            string sprPath = Path.Combine(directory, "Tibia.spr");

            try
            {
                this.client = new ClientImpl();
                this.client.ClientLoaded    += new EventHandler(this.ClientLoaded_Handler);
                this.client.ProgressChanged += new ProgressHandler(this.ClientProgress_Handler);
                this.client.ClientCompiled  += new EventHandler(this.ClientCompiled_Handler);
                this.client.Load(datPath, sprPath, version);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Selected client: " + version + ".\n\n" + ex.Message);
                Application.Exit();
            }
        }
예제 #2
0
        private void CompileButton_Click(object sender, EventArgs e)
        {
            string directory = Path.Combine(PathUtils.ApplicationDirectory, "Output");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            OpenTibia.Core.Version version = (OpenTibia.Core.Version) this.outputVersionComboBox.SelectedItem;
            string         datPath         = Path.Combine(directory, "Tibia.dat");
            string         sprPath         = Path.Combine(directory, "Tibia.spr");
            ClientFeatures features        = ClientFeatures.PatternZ | ClientFeatures.Extended;

            features |= this.outputFrameDurationsCheckBox.Checked ? ClientFeatures.FrameDurations : features;
            features |= this.outputFrameGroupsCheckBox.Checked ? ClientFeatures.FrameGroups : features;

            try
            {
                this.compileButton.Enabled = false;
                this.client.Save(datPath, sprPath, version, features);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Application.Exit();
            }
        }
예제 #3
0
        private void LoadClient()
        {
            if (m_client.Loaded)
            {
                return;
            }

            string directory = Path.Combine(PathUtils.ApplicationDirectory, "Input");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            string datPath = Path.Combine(directory, "Tibia.dat");
            string sprPath = Path.Combine(directory, "Tibia.spr");

            try
            {
                OpenTibia.Core.Version version = versionsComboBox.SelectedItem as OpenTibia.Core.Version;
                m_client.Load(datPath, sprPath, version);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            itemsListBox.AddRange(m_client.GetAllItems());
            outfitsListBox.AddRange(m_client.GetAllOutfits());
            effectsListBox.AddRange(m_client.GetAllEffects());
            missilesListBox.AddRange(m_client.GetAllMissiles());
        }
예제 #4
0
 private void OutputVersionComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     OpenTibia.Core.Version version = (OpenTibia.Core.Version) this.outputVersionComboBox.SelectedItem;
     this.outputFrameDurationsCheckBox.Checked = (ushort)version.Format >= (ushort)DatFormat.Format_1050;
     this.outputFrameDurationsCheckBox.Enabled = (ushort)version.Format >= (ushort)DatFormat.Format_1050;
     this.outputFrameGroupsCheckBox.Checked    = (ushort)version.Format >= (ushort)DatFormat.Format_1057;
     this.outputFrameGroupsCheckBox.Enabled    = (ushort)version.Format >= (ushort)DatFormat.Format_1057;
 }