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 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 void Load(XmlNode objXmlData) { objXmlData.TryGetField("name", out name); objXmlData.TryGetField("category", out category); foreach (XmlNode objXmlLevel in objXmlData.SelectNodes("effects/level")) { clsDrugEffect objDrugEffect = new clsDrugEffect(); foreach (XmlNode objXmlEffect in objXmlLevel.SelectNodes("*")) { string effectName; int effectValue; objXmlEffect.TryGetField("name", out effectName, null); objXmlEffect.TryGetField("value", out effectValue, 1); switch (objXmlEffect.Name) { case "attribute": if (effectName != null) objDrugEffect.attributes[effectName] = effectValue; break; case "limit": if (effectName != null) objDrugEffect.limits[effectName] = effectValue; break; case "quality": objDrugEffect.qualities.Add(objXmlEffect.InnerText); break; case "info": objDrugEffect.infos.Add(objXmlEffect.InnerText); break; case "initiative": objDrugEffect.ini = int.Parse(objXmlEffect.InnerText); break; case "initiativedice": objDrugEffect.iniDice = int.Parse(objXmlEffect.InnerText); break; case "crashdamage": objDrugEffect.crashDamage = int.Parse(objXmlEffect.InnerText); break; case "speed": objDrugEffect.speed = int.Parse(objXmlEffect.InnerText); break; case "duration": objDrugEffect.duration = int.Parse(objXmlEffect.InnerText); break; default: Log.Warning(info: string.Format("Unknown drug effect %s in component %s", objXmlEffect.Name, effectName)); break; } } effects.Add(objDrugEffect); } objXmlData.TryGetField("availability", out availability); objXmlData.TryGetField("cost", out cost); objXmlData.TryGetField("rating", out addictionRating); objXmlData.TryGetField("threshold", out addictionThreshold); objXmlData.TryGetField("source", out source); objXmlData.TryGetField("page", out page); }
public void Load(XmlNode objXmlData) { objXmlData.TryGetField("name", out name); objXmlData.TryGetField("category", out category); foreach (XmlNode objXmlLevel in objXmlData.SelectNodes("effects/level")) { clsDrugEffect objDrugEffect = new clsDrugEffect(); foreach (XmlNode objXmlEffect in objXmlLevel.SelectNodes("*")) { string effectName; int effectValue; objXmlEffect.TryGetField("name", out effectName, null); objXmlEffect.TryGetField("value", out effectValue, 1); switch (objXmlEffect.Name) { case "attribute": if (effectName != null) { objDrugEffect.attributes[effectName] = effectValue; } break; case "limit": if (effectName != null) { objDrugEffect.limits[effectName] = effectValue; } break; case "quality": objDrugEffect.qualities.Add(objXmlEffect.InnerText); break; case "info": objDrugEffect.infos.Add(objXmlEffect.InnerText); break; case "initiative": objDrugEffect.ini = int.Parse(objXmlEffect.InnerText); break; case "initiativedice": objDrugEffect.iniDice = int.Parse(objXmlEffect.InnerText); break; case "crashdamage": objDrugEffect.crashDamage = int.Parse(objXmlEffect.InnerText); break; case "speed": objDrugEffect.speed = int.Parse(objXmlEffect.InnerText); break; case "duration": objDrugEffect.duration = int.Parse(objXmlEffect.InnerText); break; default: Log.Warning(info: string.Format("Unknown drug effect %s in component %s", objXmlEffect.Name, effectName)); break; } } effects.Add(objDrugEffect); } objXmlData.TryGetField("availability", out availability); objXmlData.TryGetField("cost", out cost); objXmlData.TryGetField("rating", out addictionRating); objXmlData.TryGetField("threshold", out addictionThreshold); objXmlData.TryGetField("source", out source); objXmlData.TryGetField("page", out page); }