From 1231c975b3d35a301982768628bbc3da34f7ff51 Mon Sep 17 00:00:00 2001 From: Basilisk3 <126026384+Basilisk3@users.noreply.github.com> Date: Sun, 12 May 2024 12:33:31 +0200 Subject: [PATCH] Prevent dividing by zero --- www/res/scripts/calculations.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/res/scripts/calculations.php b/www/res/scripts/calculations.php index bbe0f87..4fd69f5 100644 --- a/www/res/scripts/calculations.php +++ b/www/res/scripts/calculations.php @@ -71,6 +71,8 @@ function calculateDps($stdClassWeapon, $unitID, $Projectile){ /// BTW - SpookyDB uses round(), not floor(), based on the values seen there. Values will not match between DBs. floor() is the correct method. if(isset($weapon["RateOfFire"])) { $trueReload = max(0.1*floor(10 / $weapon["RateOfFire"]), 0.1); + } else { + $trueReload = 1; } $trueReload = max( ($weapon["RackSalvoChargeTime"] ?? 0) + ($weapon["RackSalvoReloadTime"] ?? 0) +