コード例 #1
0
ファイル: MainWindow.cs プロジェクト: drunderscore/Qso
        private void disenchantAllBtn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you wish to continue? All this loot will be lost forever! (a long time!)", "Verify", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
            {
                return;
            }
            var be = 0;
            var oe = 0;

            foreach (var loot in uiLoot)
            {
                if (loot.Type == "CHAMPION_RENTAL" && disenChampionsCheckbox.Checked)
                {
                    be += loot.DisenchantValue;
                    try
                    {
                        QsoApi.CraftRecipe(loot.Name, "CHAMPION_RENTAL_disenchant");
                    }
                    catch (QsoEndpointException)
                    {
                        if (MessageBox.Show($"Failed disenchanting loot item {loot.Name}. Continue?", "Disenchant Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
                else if (loot.Type == "SKIN_RENTAL" && disenSkinsCheckbox.Checked)
                {
                    oe += loot.DisenchantValue; try
                    {
                        QsoApi.CraftRecipe(loot.Name, "SKIN_RENTAL_disenchant");
                    }
                    catch (QsoEndpointException)
                    {
                        if (MessageBox.Show($"Failed disenchanting loot item {loot.Name}. Continue?", "Disenchant Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
                // TODO: Wards
            }
            MessageBox.Show($"Finished! The total disenchant was worth {be}BE and {oe}OE.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: drunderscore/Qso
 private void CraftRecipeUI(bool many)
 {
     if (uiRecipes == null || uiLoot == null)
     {
         MessageBox.Show("You must select an item and a recipe first.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     try
     {
         var item   = uiLoot[allLootCombo.SelectedIndex];
         var recipe = uiRecipes[recipesCombo.SelectedIndex];
         var repeat = many ? 10 : 0;
         var update = QsoApi.CraftRecipe(item, recipe, repeat);
     }
     catch (QsoEndpointException ex)
     {
         MessageBox.Show($"Unable to craft {uiLoot[allLootCombo.SelectedIndex]}: {ex.ErrorResponse.Message}");
     }
 }