public static void GenerateDamageResults(Dictionary <string, DamageResult> damageResults, List <string> times, bool healing = false) { Dictionary <string, DamageData> totalResults = healing ? totalHealingResults : totalDamageResults; lock (totalResults) { foreach (KeyValuePair <string, DamageData> kvp in totalResults) { DamageResult result = new DamageResult(); string player = kvp.Key; DamageData data = kvp.Value; int damage = 0; int minutes = 0; foreach (string t in times) { if (data.damagePerMinute.ContainsKey(t)) { foreach (var creatureDamage in data.damagePerMinute[t].targetDamage) { string cr = creatureDamage.Key; int dmg = creatureDamage.Value; if (!result.damagePerCreature.ContainsKey(cr)) { result.damagePerCreature.Add(cr, dmg); } else { result.damagePerCreature[cr] += dmg; } } damage += data.damagePerMinute[t].damage; minutes++; } } if (damage > 0) { result.damagePerSecond = damage / (minutes * 60.0); result.totalDamage = data.totalDamage; damageResults.Add(player, result); } } } }
public static void GenerateDamageTakenResults(Dictionary <string, DamageResult> damageResults, List <string> times) { Dictionary <string, DamageData> totalResults = totalDamageResults; lock (totalResults) { foreach (KeyValuePair <string, DamageData> kvp in totalResults) { string damageSource = kvp.Key; DamageData data = kvp.Value; foreach (string t in times) { if (data.damagePerMinute.ContainsKey(t)) { foreach (var creatureDamage in data.damagePerMinute[t].targetDamage) { string target = creatureDamage.Key; int dmg = creatureDamage.Value; if (!damageResults.ContainsKey(target)) { damageResults.Add(target, new DamageResult()); } DamageResult result = damageResults[target]; if (!result.damagePerCreature.ContainsKey(damageSource)) { result.damagePerCreature.Add(damageSource, dmg); } else { result.damagePerCreature[damageSource] += dmg; } result.totalDamage += dmg; } } } } } }
public static void GenerateDamageResults(Dictionary<string, DamageResult> damageResults, List<string> times, bool healing = false) { Dictionary<string, DamageData> totalResults = healing ? totalHealingResults : totalDamageResults; lock (totalResults) { foreach (KeyValuePair<string, DamageData> kvp in totalResults) { DamageResult result = new DamageResult(); string player = kvp.Key; DamageData data = kvp.Value; int damage = 0; int minutes = 0; foreach (string t in times) { if (data.damagePerMinute.ContainsKey(t)) { foreach(var creatureDamage in data.damagePerMinute[t].targetDamage) { string cr = creatureDamage.Key; int dmg = creatureDamage.Value; if (!result.damagePerCreature.ContainsKey(cr)) { result.damagePerCreature.Add(cr, dmg); } else { result.damagePerCreature[cr] += dmg; } } damage += data.damagePerMinute[t].damage; minutes++; } } if (damage > 0) { result.damagePerSecond = damage / (minutes * 60.0); result.totalDamage = data.totalDamage; damageResults.Add(player, result); } } } }