private static int GetWeaponDamage(string[] WeaponParts, int Quality, int LevelIndex) { try { double PenaltyDamage = 0; double BonusDamage = 0; double Multiplier; if (WeaponParts[2] == "gd_weap_repeater_pistol.A_Weapon.WeaponType_repeater_pistol") { Multiplier = 1; } else { Multiplier = Parse.AsDouble(GetPartAttribute(WeaponParts[2], "WeaponDamageFormulaMultiplier"), 1); } int Level = GetEffectiveLevelWeapon(WeaponParts, Quality, LevelIndex); double Power = 1.3; double Offset = 9; for (int i = 3; i < 14; i++) { if (WeaponParts[i].Contains(".")) { double PartDamage = Parse.AsDouble(GetPartAttribute(WeaponParts[i], "WeaponDamage"), 0); if (PartDamage < 0) { PenaltyDamage -= PartDamage; } else { BonusDamage += PartDamage; } } } double DmgScaler = (1 + BonusDamage) / (1 + PenaltyDamage); double BaseDamage = 0.8 * Multiplier * (Math.Pow(Level + 2, Power) + Offset); double ScaledDamage = BaseDamage * DmgScaler; return((int)Math.Truncate(ScaledDamage + 1)); } catch { return(-1); } }
private static double GetExtraStats(string[] WeaponParts, string StatName) { double bonus = 0; double penalty = 0; double value; try { double ExtraDamage = 0; for (int i = 3; i < 14; i++) { string valuestring = GetPartAttribute(WeaponParts[i], StatName); if (valuestring.Contains(',')) { // TODO: I think there are some entries that have two numbers // with a comma between them. Need to figure out how to properly // handle them. This breakpoint will catch it when debugging so // so I can figure it out. //Debugger.Break(); value = Parse.AsDouble(GetPartAttribute(WeaponParts[i], StatName), 0); } else { value = Parse.AsDouble(GetPartAttribute(WeaponParts[i], StatName), 0); } if (value >= 0) { bonus += value; } else { penalty -= value; } } ExtraDamage = ((1 + bonus) / (1 + penalty)) - 1; return(ExtraDamage); } catch { return(-1); } }