Уменьшил. Убрал deprecated.
This commit is contained in:
parent
0714838bf9
commit
fad59398f1
@ -1,74 +1,27 @@
|
||||
<?
|
||||
include("config.php");
|
||||
$nowtime = time();
|
||||
<?php
|
||||
require_once "../config.php";
|
||||
// Осталось понять что делает, зачем написан и какой интервал запуска.
|
||||
// 4 hours: time() + 14400;
|
||||
|
||||
$info_pole = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'pole_random' LIMIT 1"));
|
||||
$q = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "?s"', 'pole_random')->fetch_assoc();
|
||||
|
||||
$ff_time = time();
|
||||
$f_time = $ff_time + 14400;
|
||||
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;
|
||||
|
||||
if($info_pole['value'] == '') {
|
||||
for($i = 0; $i < 41; $i++) {
|
||||
$hrand = rand(1, 11)/10;
|
||||
$rand = rand(1, 9);
|
||||
$rekrr = 30/30;
|
||||
$rekr = rand(1, $rekrr)/10;
|
||||
$bonus = rand(1, 13)/10;
|
||||
$bonuss = $rekr*$bonus;
|
||||
$rekrr = $rekr+$bonuss;
|
||||
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;
|
||||
}
|
||||
$h += $h * mt_rand(1, 11) / 10;
|
||||
$rekr = 0.1 + mt_rand(1, 13) / 100;
|
||||
|
||||
$hh = $h*$hrand;
|
||||
$h = $h+$hh;
|
||||
mysql_query("UPDATE `pole` SET `type` = '".$rand."', `heals` = '".$h."', `ekr` = '".$rekrr."' WHERE `id` = '".$i."' LIMIT 1");
|
||||
}
|
||||
mysql_query("UPDATE `variables` SET `value` = '".$f_time."' WHERE `var` = '".$info_pole['var']."' LIMIT 1");
|
||||
} else{
|
||||
|
||||
if($info_pole['value'] < $nowtime){
|
||||
for($i = 0; $i < 41; $i++) {
|
||||
$hrand = rand(1, 11)/10;
|
||||
$rand = rand(1, 9);
|
||||
$rekrr = 30/30;
|
||||
$rekr = rand(1, $rekrr)/10;
|
||||
$bonus = rand(1, 13)/10;
|
||||
$bonuss = $rekr*$bonus;
|
||||
$rekrr = $rekr+$bonuss;
|
||||
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;
|
||||
}
|
||||
|
||||
$hh = $h * $hrand;
|
||||
$h = $h + $hh;
|
||||
mysql_query("UPDATE `pole` SET `type` = '".$rand."', `heals` = '".$h."', `ekr` = '".$rekrr."' WHERE `id` = '".$i."' LIMIT 1");
|
||||
}
|
||||
mysql_query("UPDATE `variables` SET `value` = `value`+'14400' WHERE `var` = '".$info_pole['var']."' LIMIT 1");
|
||||
}
|
||||
db::c()->query('UPDATE `pole` SET `type` = ?i, `heals` = ?i, `ekr` = ?i WHERE `id` = ?i', $rand, $h, $rekr, $i);
|
||||
}
|
||||
?>
|
||||
|
||||
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');
|
Loading…
Reference in New Issue
Block a user