private void LoadData() { dictDrugComponents = new Dictionary<string, clsDrugComponent>(); XmlDocument objXmlDocument = XmlManager.Instance.Load("drugcomponents.xml"); foreach (XmlNode objXmlComponent in objXmlDocument.SelectNodes("chummer/drugcomponents/drugcomponent")) { clsDrugComponent objDrugComponent = new clsDrugComponent(); objDrugComponent.Load(objXmlComponent); dictDrugComponents[objDrugComponent.name] = objDrugComponent; } }
private void UpdateCustomDrugStats() { objCustomDrug = new clsDrugComponent(); objCustomDrug.name = txtDrugName.Text; objCustomDrug.category = "Custom Drug"; clsDrugEffect objCustomDrugEffect = new clsDrugEffect(); objCustomDrug.effects.Add(objCustomDrugEffect); foreach (clsNodeData objNodeData in lstChoosenDrugComponents) { clsDrugComponent objDrugComponent = objNodeData.objDrugComponent; int level = objNodeData.level; clsDrugEffect objDrugEffect = objDrugComponent.effects[level]; foreach (var item in objDrugEffect.attributes) { int value; objCustomDrugEffect.attributes.TryGetValue(item.Key, out value); objCustomDrugEffect.attributes[item.Key] = value + item.Value; } foreach (var item in objDrugEffect.limits) { int value; objCustomDrugEffect.limits.TryGetValue(item.Key, out value); objCustomDrugEffect.limits[item.Key] = value + item.Value; } foreach (string quality in objDrugEffect.qualities) { if (!objCustomDrugEffect.qualities.Contains(quality)) { objCustomDrugEffect.qualities.Add(quality); } } foreach (string info in objDrugEffect.infos) { objCustomDrugEffect.infos.Add(info); } objCustomDrugEffect.ini += objDrugEffect.ini; objCustomDrugEffect.iniDice += objDrugEffect.iniDice; objCustomDrugEffect.speed += objDrugEffect.speed; objCustomDrugEffect.duration += objDrugEffect.duration; objCustomDrugEffect.crashDamage += objDrugEffect.crashDamage; objCustomDrug.addictionRating += objDrugComponent.addictionRating; objCustomDrug.addictionThreshold += objDrugComponent.addictionThreshold; objCustomDrug.availability += objDrugComponent.availability; objCustomDrug.cost += objDrugComponent.cost; } }
private void LoadData() { dictDrugComponents = new Dictionary <string, clsDrugComponent>(); XmlDocument objXmlDocument = XmlManager.Instance.Load("drugcomponents.xml"); foreach (XmlNode objXmlComponent in objXmlDocument.SelectNodes("chummer/drugcomponents/drugcomponent")) { clsDrugComponent objDrugComponent = new clsDrugComponent(); objDrugComponent.Load(objXmlComponent); dictDrugComponents[objDrugComponent.name] = objDrugComponent; } }
private void UpdateCustomDrugStats() { objCustomDrug = new clsDrugComponent(); objCustomDrug.name = txtDrugName.Text; objCustomDrug.category = "Custom Drug"; clsDrugEffect objCustomDrugEffect = new clsDrugEffect(); objCustomDrug.effects.Add(objCustomDrugEffect); foreach (clsNodeData objNodeData in lstChoosenDrugComponents) { clsDrugComponent objDrugComponent = objNodeData.objDrugComponent; int level = objNodeData.level; clsDrugEffect objDrugEffect = objDrugComponent.effects[level]; foreach (var item in objDrugEffect.attributes) { int value; objCustomDrugEffect.attributes.TryGetValue(item.Key, out value); objCustomDrugEffect.attributes[item.Key] = value + item.Value; } foreach (var item in objDrugEffect.limits) { int value; objCustomDrugEffect.limits.TryGetValue(item.Key, out value); objCustomDrugEffect.limits[item.Key] = value + item.Value; } foreach (string quality in objDrugEffect.qualities) { if (!objCustomDrugEffect.qualities.Contains(quality)) objCustomDrugEffect.qualities.Add(quality); } foreach (string info in objDrugEffect.infos) { objCustomDrugEffect.infos.Add(info); } objCustomDrugEffect.ini += objDrugEffect.ini; objCustomDrugEffect.iniDice += objDrugEffect.iniDice; objCustomDrugEffect.speed += objDrugEffect.speed; objCustomDrugEffect.duration += objDrugEffect.duration; objCustomDrugEffect.crashDamage += objDrugEffect.crashDamage; objCustomDrug.addictionRating += objDrugComponent.addictionRating; objCustomDrug.addictionThreshold += objDrugComponent.addictionThreshold; objCustomDrug.availability += objDrugComponent.availability; objCustomDrug.cost += objDrugComponent.cost; } }
public clsNodeData(clsDrugComponent objDrugComponent, int level = -1) { this.objDrugComponent = objDrugComponent; this.level = level; }
private void btnCancel_Click(object sender, EventArgs e) { objCustomDrug = null; DialogResult = DialogResult.Cancel; Close(); }