private void bOk_Click(object sender, EventArgs e) { //form.editQuestReward.Reputation.Clear(); form.editQuestReward.Fractions.Clear(); foreach (DataGridViewRow row in dataFractions.Rows) { int id = int.Parse(row.Cells[0].FormattedValue.ToString()); bool rew = false; if (row.Cells[2].FormattedValue.ToString() != "") { rew = bool.Parse(row.Cells[2].FormattedValue.ToString()); } if (rew == true) { form.editQuestReward.Fractions.Add(id); //.Reputation.Add(id, rew); } } if (unlimitedCheckBox.Checked) { form.editQuestReward.Unlimited = 1; } else { form.editQuestReward.Unlimited = 0; } form.checkRewardIndicates(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { List <int> typeOfItems = new List <int>(); List <int> numOfItems = new List <int>(); List <int> attrOfItems = new List <int>(); Dictionary <int, QuestItemInfo> itemsInfo = new Dictionary <int, QuestItemInfo>(); foreach (DataGridViewRow row in itemGridView.Rows) { string typeName = row.Cells[0].FormattedValue.ToString(); if (!typeName.Equals("")) { int quantity = int.Parse(row.Cells[2].FormattedValue.ToString()); if (quantity >= 1) { int typeID = parent.itemConst.getIDOnDescription(typeName); string attrName = row.Cells[1].FormattedValue.ToString(); int attr; string title = row.Cells[3].FormattedValue.ToString(); string description = row.Cells[4].FormattedValue.ToString(); string activation = row.Cells[5].FormattedValue.ToString(); if (attrName.Equals("Квестовый")) { attr = 1; try { itemsInfo.Add(typeID, new QuestItemInfo(title, description, activation)); } catch { MessageBox.Show("Есть идентичные квестовые предметы.", "Ошибка."); return; } } else { attr = 0; } typeOfItems.Add(typeID); numOfItems.Add(quantity); attrOfItems.Add(attr); } } } if (formType == this.ITEM_QUESTRULES) { parentForm.editQuestRules.TypeOfItems.Clear(); parentForm.editQuestRules.TypeOfItems = typeOfItems; parentForm.editQuestRules.NumOfItems.Clear(); parentForm.editQuestRules.NumOfItems = numOfItems; parentForm.editQuestRules.AttrOfItems.Clear(); parentForm.editQuestRules.AttrOfItems = attrOfItems; parentForm.checkQuestRulesIndicates(); } else if (formType == this.ITEM_REWARD) { parentForm.editQuestReward.TypeOfItems.Clear(); parentForm.editQuestReward.TypeOfItems = typeOfItems; parentForm.editQuestReward.NumOfItems.Clear(); parentForm.editQuestReward.NumOfItems = numOfItems; parentForm.editQuestReward.AttrOfItems.Clear(); parentForm.editQuestReward.AttrOfItems = attrOfItems; parentForm.checkRewardIndicates(); } else if (formType == this.ITEM_LOCALIZATION_RULES || formType == this.ITEM_LOCALIZATION_REWARD) { if (this.translate == 1) { parseLocale(); } parentForm2.cur_locale_quest.QuestInformation.Items = this.locale; } if (parentForm != null) { parentForm.editInformation.Items.Clear(); parentForm.editInformation.Items = itemsInfo; } this.Close(); }