Снятие VIP. Убрал deprecated.
This commit is contained in:
parent
fad59398f1
commit
518e494adf
@ -68,7 +68,7 @@ function getlist($razdel = 1, $level = null, $id = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$zay[$row['id']] = array("team1" => fteam($row['team1']), "team2" => fteam($row['team2']), "coment" => $row['coment'], "type" => $row['type'], "timeout" => $row['timeout'], "start" => $row['start'], "t1min" => $row['t1min'], "t1max" => $row['t1max'], "t2min" => $row['t2min'], "t2max" => $row['t2max'], "t1c" => $row['t1c'], "t2c" => $row['t2c'], "podan" => $row['podan'], "id" => $row['id'], "level" => $row['level'], "blood" => $row['blood'], "bots" => $row['bots']);
|
$zay[$row['id']] = ["team1" => fteam($row['team1']), "team2" => fteam($row['team2']), "coment" => $row['coment'], "type" => $row['type'], "timeout" => $row['timeout'], "start" => $row['start'], "t1min" => $row['t1min'], "t1max" => $row['t1max'], "t2min" => $row['t2min'], "t2max" => $row['t2max'], "t1c" => $row['t1c'], "t2c" => $row['t2c'], "podan" => $row['podan'], "id" => $row['id'], "level" => $row['level'], "blood" => $row['blood'], "bots" => $row['bots']];
|
||||||
}
|
}
|
||||||
return $zayavka;
|
return $zayavka;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ function startbattle($id, $zay, $r)
|
|||||||
|
|
||||||
$bot = 0;
|
$bot = 0;
|
||||||
if ($z['bots'] > 0 && $count_users > 0) {
|
if ($z['bots'] > 0 && $count_users > 0) {
|
||||||
$bots_raw = array(7 => array(10962, 10964, 10965), 8 => array(10962, 10964, 10965), 13 => array(10962, 10964, 10965));
|
$bots_raw = [7 => [10962, 10964, 10965], 8 => [10962, 10964, 10965], 13 => [10962, 10964, 10965]];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i <= count($bots_raw[$z['bots']])) {
|
while ($i <= count($bots_raw[$z['bots']])) {
|
||||||
$bot_id = $bots_raw[$z['bots']][$i];
|
$bot_id = $bots_raw[$z['bots']][$i];
|
||||||
@ -141,15 +141,6 @@ function startbattle($id, $zay, $r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_vip($uid)
|
|
||||||
{
|
|
||||||
mysql_query('UPDATE `users` SET `vip` = "0", `vip_time` = "0" WHERE `id` = "' . $uid . '" LIMIT 1');
|
|
||||||
$abil = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sokr`, `zash`, `invisible`, `attack`, `bloodattack`, `sleep30`, `travmoff`, `daontattack`, `unsleep`, `pers_attack` FROM `abils_vip` WHERE `uid` = "' . $uid . '" LIMIT 1'));
|
|
||||||
if (isset($abil['id'])) {
|
|
||||||
mysql_query('UPDATE `abils_vip` SET `sokr` = 0, `zash` = 0, `invisible` = 0, `attack` = 0, `bloodattack` = 0, `sleep30` = 0, `travmoff` = 0, `daontattack` = 0, `unsleep` = 0, `pers_attack` = 0 WHERE `id` = "' . $abil['id'] . '" LIMIT 1');
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($z['type'] == 4 || $z['type'] == 5) {
|
if ($z['type'] == 4 || $z['type'] == 5) {
|
||||||
foreach ($z['team1'] as $k => $v) {
|
foreach ($z['team1'] as $k => $v) {
|
||||||
@ -171,7 +162,7 @@ function startbattle($id, $zay, $r)
|
|||||||
|
|
||||||
###
|
###
|
||||||
$efs = mysql_query('SELECT * FROM `effects` WHERE `owner` = "' . $pers['id'] . '"');
|
$efs = mysql_query('SELECT * FROM `effects` WHERE `owner` = "' . $pers['id'] . '"');
|
||||||
$travm = array(11, 12, 13, 14);
|
$travm = [11, 12, 13, 14];
|
||||||
while ($row = mysql_fetch_array($efs)) {
|
while ($row = mysql_fetch_array($efs)) {
|
||||||
if (in_array($row['type'], $travm)) {
|
if (in_array($row['type'], $travm)) {
|
||||||
$pers['sila'] += $row['sila'];
|
$pers['sila'] += $row['sila'];
|
||||||
@ -242,7 +233,7 @@ function startbattle($id, $zay, $r)
|
|||||||
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $bt['prototype'] . "' LIMIT 1"));
|
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $bt['prototype'] . "' LIMIT 1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cost[] = array($z['team1'][$i], $gamer[0]);
|
$cost[] = [$z['team1'][$i], $gamer[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$z['team1'] = null;
|
$z['team1'] = null;
|
||||||
@ -274,17 +265,17 @@ function startbattle($id, $zay, $r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$teams = array();
|
$teams = [];
|
||||||
|
|
||||||
foreach ($z['team1'] as $k => $v) {
|
foreach ($z['team1'] as $k => $v) {
|
||||||
foreach ($z['team2'] as $kk => $vv) {
|
foreach ($z['team2'] as $kk => $vv) {
|
||||||
$teams[$v][$vv] = array(0, 0, time());
|
$teams[$v][$vv] = [0, 0, time()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($z['team2'] as $k => $v) {
|
foreach ($z['team2'] as $k => $v) {
|
||||||
foreach ($z['team1'] as $kk => $vv) {
|
foreach ($z['team1'] as $kk => $vv) {
|
||||||
$teams[$v][$vv] = array(0, 0, time());
|
$teams[$v][$vv] = [0, 0, time()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +288,7 @@ function startbattle($id, $zay, $r)
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr = array(3, 4, 5, 7, 10);
|
$arr = [3, 4, 5, 7, 10];
|
||||||
|
|
||||||
if (in_array($z['timeout'], $arr)) {
|
if (in_array($z['timeout'], $arr)) {
|
||||||
|
|
||||||
@ -362,8 +353,8 @@ $battle_bots = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `w
|
|||||||
$zay_bots = mysql_fetch_array(mysql_query('SELECT `id` FROM `zayavka` WHERE `bots` > 0 ORDER BY `id` DESC LIMIT 1'));
|
$zay_bots = mysql_fetch_array(mysql_query('SELECT `id` FROM `zayavka` WHERE `bots` > 0 ORDER BY `id` DESC LIMIT 1'));
|
||||||
|
|
||||||
if (!isset($battle_bots['id']) && !isset($zay_bots['id'])) {
|
if (!isset($battle_bots['id']) && !isset($zay_bots['id'])) {
|
||||||
$haos_match = array();
|
$haos_match = [];
|
||||||
$hm_ok = array(7 => 1);
|
$hm_ok = [7 => 1];
|
||||||
foreach ($hm_ok as $lvl => $flag) {
|
foreach ($hm_ok as $lvl => $flag) {
|
||||||
if ($flag == 1) {
|
if ($flag == 1) {
|
||||||
mysql_query("INSERT INTO `zayavka` (`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `stavka`, `t1min`, `t2min`, `t1max`, `t2max`, `podan`, `blood`, `bots`) VALUES ('" . (time() + 3 * 60) . "', '3', '99', '99', '3', '5', '<u>Бой с силами Хаоса <b>{$lvl}</b> уровня.</u>', '', '', '{$lvl}', '{$lvl}', '{$lvl}', '{$lvl}', '" . date("H:i") . "', '0', '{$lvl}')");
|
mysql_query("INSERT INTO `zayavka` (`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `stavka`, `t1min`, `t2min`, `t1max`, `t2max`, `podan`, `blood`, `bots`) VALUES ('" . (time() + 3 * 60) . "', '3', '99', '99', '3', '5', '<u>Бой с силами Хаоса <b>{$lvl}</b> уровня.</u>', '', '', '{$lvl}', '{$lvl}', '{$lvl}', '{$lvl}', '" . date("H:i") . "', '0', '{$lvl}')");
|
||||||
@ -395,13 +386,14 @@ if (date("H-i") == "03-00") {
|
|||||||
mysql_query("OPTIMIZE `battle`, `delo`");
|
mysql_query("OPTIMIZE `battle`, `delo`");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Снятие VIP.
|
||||||
if (date("H-i") == "00-00") {
|
if (date("H-i") == "00-00") {
|
||||||
$perses = mysql_query('SELECT `id`, `vip`, `vip_time` FROM `users` WHERE `vip` > 0 AND `vip_time` > 0');
|
$q = db::c()->query('SELECT `id`,`vip`,`vip_time` FROM `users` WHERE `vip` > 0 AND `vip_time` > 0');
|
||||||
while ($unvip = mysql_fetch_array($perses)) {
|
|
||||||
if ($unvip['vip'] > 0) {
|
while ($unvip = $q->fetch_assoc()) {
|
||||||
if ($unvip['vip_time'] <= time()) {
|
if ($unvip['vip'] > 0 AND $unvip['vip_time'] <= time()) {
|
||||||
remove_vip($unvip['id']);
|
db::c()->query('UPDATE `users` SET `vip` = 0, `vip_time` = 0 WHERE `id` = ?i', $unvip['id']);
|
||||||
}
|
db::c()->query('UPDATE `abils_vip` SET `sokr` = 0, `zash` = 0, `invisible` = 0, `attack` = 0, `bloodattack` = 0, `sleep30` = 0, `travmoff` = 0, `unsleep` = 0, `pers_attack` = 0 WHERE `uid` = ?i', $unvip['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,9 +426,9 @@ if ($st_ar['value'] <= time()) {
|
|||||||
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $dark['login'] . "', '" . $dark['id'] . "', '', '" . $dark['hp'] . "')");
|
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $dark['login'] . "', '" . $dark['id'] . "', '', '" . $dark['hp'] . "')");
|
||||||
$dark['id_at'] = mysql_insert_id();
|
$dark['id_at'] = mysql_insert_id();
|
||||||
##############
|
##############
|
||||||
$teams = array();
|
$teams = [];
|
||||||
$teams[$dark['id_at']][$light['id_at']] = array(0, 0, time());
|
$teams[$dark['id_at']][$light['id_at']] = [0, 0, time()];
|
||||||
$teams[$light['id_at']][$dark['id_at']] = array(0, 0, time());
|
$teams[$light['id_at']][$dark['id_at']] = [0, 0, time()];
|
||||||
mysql_query("INSERT INTO `battle` (`id`, `coment`, `teams`, `time_m`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`, `aren_of`) VALUES (NULL, '', '" . serialize($teams) . "', '" . time() . "', '3', '1', '0', '" . $dark['id_at'] . "', '" . $light['id_at'] . "', '" . time() . "', '" . time() . "', '1', '1')");
|
mysql_query("INSERT INTO `battle` (`id`, `coment`, `teams`, `time_m`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`, `aren_of`) VALUES (NULL, '', '" . serialize($teams) . "', '" . time() . "', '3', '1', '0', '" . $dark['id_at'] . "', '" . $light['id_at'] . "', '" . time() . "', '" . time() . "', '1', '1')");
|
||||||
$id = mysql_insert_id();
|
$id = mysql_insert_id();
|
||||||
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE (`id` = {$dark['id_at']} OR `id` = {$light['id_at']}) LIMIT 2");
|
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE (`id` = {$dark['id_at']} OR `id` = {$light['id_at']}) LIMIT 2");
|
||||||
@ -591,7 +583,7 @@ if (!$tr && $turnirstart[0] <= time() && $dd[0] >= 2) {
|
|||||||
$lors .= ltrim(",", $lors);
|
$lors .= ltrim(",", $lors);
|
||||||
|
|
||||||
mysql_query("TRUNCATE TABLE `deztow_items`");
|
mysql_query("TRUNCATE TABLE `deztow_items`");
|
||||||
$shmots = array("1", "1", "92", "92", "93", "93", "19", "19", "20", "20", "20", "23", "23", "24", "14", "87", "87", "6", "6", "17", "17", "17", "17", "11", "11", "12", "12", "12", "28", "28", "43", "43", "36", "36", "36", "37", "37", "37", "38", "38", "38", "50", "50", "57", "52", "52", "51", "51", "48", "48", "47", "47", "49", "49", "59", "59", "60", "60", "61", "61", "63", "64", "64", "65", "65", "66", "66", "68", "68", "69", "69", "72", "72", "4", "5", "79", "79", "80", "76", "75", "75", "94", "94", "95", "95", "82", "91", "91", "34", "34", "86", "86", "86", "9", "9", "101", "101", "101", "101", "101", "97", "97", "97", "97", "100", "100", "100", "100", "171", "171", "171", "171", "103", "103", "103", "104", "105", "105", "106", "106", "107", "107", "108", "108", "109", "110", "111", "112", "112", "113", "113", "119", "364", "284", "284", "284", "284", "284", "285", "285", "285", "285", "286", "286", "286", "286");
|
$shmots = ["1", "1", "92", "92", "93", "93", "19", "19", "20", "20", "20", "23", "23", "24", "14", "87", "87", "6", "6", "17", "17", "17", "17", "11", "11", "12", "12", "12", "28", "28", "43", "43", "36", "36", "36", "37", "37", "37", "38", "38", "38", "50", "50", "57", "52", "52", "51", "51", "48", "48", "47", "47", "49", "49", "59", "59", "60", "60", "61", "61", "63", "64", "64", "65", "65", "66", "66", "68", "68", "69", "69", "72", "72", "4", "5", "79", "79", "80", "76", "75", "75", "94", "94", "95", "95", "82", "91", "91", "34", "34", "86", "86", "86", "9", "9", "101", "101", "101", "101", "101", "97", "97", "97", "97", "100", "100", "100", "100", "171", "171", "171", "171", "103", "103", "103", "104", "105", "105", "106", "106", "107", "107", "108", "108", "109", "110", "111", "112", "112", "113", "113", "119", "364", "284", "284", "284", "284", "284", "285", "285", "285", "285", "286", "286", "286", "286"];
|
||||||
while ($sh = array_shift($shmots)) {
|
while ($sh = array_shift($shmots)) {
|
||||||
$shopid = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `img` FROM `shop` WHERE `id` = '" . $sh . "' LIMIT 1"));
|
$shopid = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `img` FROM `shop` WHERE `id` = '" . $sh . "' LIMIT 1"));
|
||||||
if (isset($shopid['id'])) {
|
if (isset($shopid['id'])) {
|
||||||
|
@ -12,7 +12,7 @@ include_once '../functions.php';
|
|||||||
$r = db::c()->query('SELECT `id`, `win` FROM `battle` WHERE `needbb` = 2 AND `win` = 3');
|
$r = db::c()->query('SELECT `id`, `win` FROM `battle` WHERE `needbb` = 2 AND `win` = 3');
|
||||||
$r2 = mysql_query("SELECT `id`, `win` FROM `battle` WHERE `needbb` = 1 AND `win` = 3 AND (`timeout`*90+`to1` < ".time()." OR `timeout`*90+`to2` < ".time().")");
|
$r2 = mysql_query("SELECT `id`, `win` FROM `battle` WHERE `needbb` = 1 AND `win` = 3 AND (`timeout`*90+`to1` < ".time()." OR `timeout`*90+`to2` < ".time().")");
|
||||||
|
|
||||||
if($r->getNumRows() > 0 || mysql_num_rows($r2) > 0) { include_once '../fbattle.php'; }
|
if($r->getNumRows() || mysql_num_rows($r2) > 0) { include_once '../fbattle.php'; }
|
||||||
$battles = array();
|
$battles = array();
|
||||||
while($rec = $r->fetch_assoc()) {
|
while($rec = $r->fetch_assoc()) {
|
||||||
$fbattles = new fbattle($rec['id']);
|
$fbattles = new fbattle($rec['id']);
|
||||||
|
Loading…
Reference in New Issue
Block a user