2018-12-13 14:52:02 +00:00
|
|
|
<?php
|
|
|
|
require_once "../config.php";
|
|
|
|
// Осталось понять что делает, зачем написан и какой интервал запуска.
|
|
|
|
// 4 hours: time() + 14400;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-12-13 14:52:02 +00:00
|
|
|
$q = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "?s"', 'pole_random')->fetch_assoc();
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-12-13 14:52:02 +00:00
|
|
|
for ($i = 0; $i < 41; $i++) {
|
|
|
|
$rand = mt_rand(1, 9);
|
|
|
|
if ($rand == 1) $h = 100;
|
|
|
|
elseif ($rand == 2) $h = 80;
|
|
|
|
elseif ($rand == 3) $h = 70;
|
|
|
|
elseif ($rand == 4) $h = 60;
|
|
|
|
elseif ($rand == 5) $h = 50;
|
|
|
|
elseif ($rand == 6) $h = 40;
|
|
|
|
elseif ($rand == 7 || $rand == 8 || $rand == 9) $h = 0;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-12-13 14:52:02 +00:00
|
|
|
$h += $h * mt_rand(1, 11) / 10;
|
|
|
|
$rekr = 0.1 + mt_rand(1, 13) / 100;
|
2018-01-28 16:40:49 +00:00
|
|
|
|
2018-12-13 14:52:02 +00:00
|
|
|
db::c()->query('UPDATE `pole` SET `type` = ?i, `heals` = ?i, `ekr` = ?i WHERE `id` = ?i', $rand, $h, $rekr, $i);
|
2018-01-28 16:40:49 +00:00
|
|
|
}
|
2018-12-13 14:52:02 +00:00
|
|
|
|
|
|
|
if (empty($q['value']))
|
|
|
|
db::c()->query('UPDATE `variables` SET `value` = ?i WHERE `var` = "?s"', (time() + 14400), 'pole_random');
|
|
|
|
elseif ($q['value'] < time())
|
|
|
|
db::c()->query('UPDATE `variables` SET `value` = `value` + 14400 WHERE `var` = "?s"', 'pole_random');
|