diff --git a/setup/tools/sqlgen/item_stats.func.php b/setup/tools/sqlgen/item_stats.func.php index 94fece832..7deaad643 100644 --- a/setup/tools/sqlgen/item_stats.func.php +++ b/setup/tools/sqlgen/item_stats.func.php @@ -99,6 +99,8 @@ public function writeStatsTable() } } + $isPhp8OrHigher = version_compare(PHP_VERSION, '8.0.0', '>='); + // collect data and write to DB foreach ($this->iterate() as $__) { @@ -109,7 +111,14 @@ public function writeStatsTable() if (!in_array($k, $this->statCols) || !$v || $k == 'id') continue; - $updateFields[$k] = number_format($v, 2, '.', ''); + if ($isPhp8OrHigher) + { + $updateFields[$k] = number_format((float)$v, 2, '.', ''); + } + else + { + $updateFields[$k] = number_format($v, 2, '.', ''); + } } if (isset($this->itemMods[$this->id])) @@ -118,8 +127,18 @@ public function writeStatsTable() { if (!$v) continue; + if ($str = Game::$itemMods[$k]) - $updateFields[$str] = number_format($v, 2, '.', ''); + { + if ($isPhp8OrHigher) + { + $updateFields[$str] = number_format((float)$v, 2, '.', ''); + } + else + { + $updateFields[$str] = number_format($v, 2, '.', ''); + } + } } }