Обновление вип-способностей. Убрал deprecated.

This commit is contained in:
Igor Barkov [iwork] 2018-12-13 17:41:27 +02:00
parent 518e494adf
commit f057b5b410

View File

@ -96,52 +96,6 @@ function startbattle($id, $zay, $r)
}
}
function upd_vip($u, $type)
{
$abli = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sokr`, `zash`, `invisible`, `attack`, `bloodattack`, `sleep30`, `travmoff`, `dontattack`, `unsleep`, `pers_attack` FROM `abils_vip` WHERE `uid` = "' . $u . '" LIMIT 1'));
if ($type == 1) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . '", `bloodattack` = "' . $abli['bloodattack'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
echo mysql_error();
} elseif ($type == 2) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
$abli['travmoff'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
if ($abli['travmoff'] > 10) {
$abli['travmoff'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . ', `bloodattack` = "' . $abli['bloodattack'] . '", `travmoff` = "' . $abli['travmoff'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
} elseif ($type == 3) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
$abli['travmoff'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
if ($abli['travmoff'] > 10) {
$abli['travmoff'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . ', `bloodattack` = "' . $abli['bloodattack'] . '", `travmoff` = "' . $abli['travmoff'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
}
}
if ($z['type'] == 4 || $z['type'] == 5) {
foreach ($z['team1'] as $k => $v) {
undressall($v);
@ -398,9 +352,22 @@ if (date("H-i") == "00-00") {
}
}
$sp = mysql_query('SELECT `id`, `vip`, `vip_time` FROM `users` WHERE `vip` > 0 AND `vip_time` > "' . time() . '"');
while ($pl = mysql_fetch_array($sp)) {
upd_vip($pl['id'], $pl['vip']);
// Обновление вип-способностей.
$sp = db::c()->query('SELECT `id`,`vip` FROM `users` WHERE `vip` > 0 AND `vip_time` > ?i', time());
while ($pl = $sp->fetch_assoc()) {
$abils = db::c()->query('SELECT `attack`, `bloodattack`, `travmoff` FROM `abils_vip` WHERE `uid` = ?i', $pl['id'])->fetch_assoc();
if ($pl['vip'] == 1) $abils['travmoff'] = 0;
else $abils['travmoff'] += 1;
$abils['attack'] += 1;
$abils['bloodattack'] += 1;
if ($abils['attack'] > 10) $abils['attack'] = 10;
if ($abils['bloodattack'] > 10) $abils['bloodattack'] = 10;
if ($abils['travmoff'] > 10) $abils['travmoff'] = 10;
db::c()->query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = ?i, `bloodattack` = ?i, `travmoff` = ?i WHERE `uid` = ?i', $abils['attack'], $abils['bloodattack'], $abils['travmoff'], $pl['id']);
}
mysql_query('UPDATE `actions` SET `vals` = "end" WHERE `vars` LIKE "start_quest%" AND `vals` = "go" AND `val` <= "' . time() . '"');