<?php include "key.php"; $login = $_SESSION['login']; if ($db["orden"] == 1 && $db["admin_level"] >= 10) { if ($_POST["startBattle"]) { $query = mysql_fetch_Array(mysql_query("SELECT count(*) FROM zayavka WHERE type=23")); if ($query[0]) { echo "Поединок идет..."; } else { $res = mysql_fetch_Array(mysql_query("SELECT users.login,id,level,users.remote_ip FROM online LEFT JOIN users on users.login=online.login WHERE users.battle=0 and zayavka=0 and online.room='room4' and level>=9 ORDER BY level DESC LIMIT 1")); if ($res) { $prototype = "Исчадие Хаоса"; mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','23','3','" . $res["id"] . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over,leader) VALUES('" . $res["login"] . "','1','" . $res["remote_ip"] . "','" . $res["id"] . "','0','0','1')"); addBot($res["login"], $res["id"], $prototype, $prototype); goBattle($res["login"]); say("toall_news", "<font color=\"#ff0000\">Объявления:</font> <font color=darkblue><b>Началась Битва между " . $res["login"] . " и Исчадием Хаоса</b></font>", $res["login"]); echo "OK"; } else { echo "NO USERS"; } } } if ($_POST["heal"]) { $query = mysql_fetch_Array(mysql_query("SELECT * FROM zayavka WHERE type=23")); if ($query) { $res = mysql_fetch_array(mysql_Query("SELECT * FROM battles WHERE creator_id=" . $query["creator"])); $have_bot = mysql_fetch_array(mysql_Query("SELECT * FROM bot_temp WHERE battle_id=" . $res["id"] . " and team=2")); $hp_add = 50000; $new_hp = $have_bot["hp"] + $hp_add;
function attack_bot($who) { $mine_id = $who['id']; $ip = $who['remote_ip']; if (!$who["battle"]) { $bot_var = mysql_fetch_array(mysql_query("SELECT * FROM bot_temp WHERE bot_name='Злой Демон'")); if (!$bot_var) { mysql_query("INSERT INTO zayavka(status, type, timeout, creator) VALUES('3', '80', '3', '" . $mine_id . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over) VALUES('" . $who["login"] . "','1','" . $ip . "','" . $mine_id . "','0','0')"); $prototype = "Злой Демон"; $name = "Злой Демон"; addBot($who["login"], $mine_id, $prototype, $name); goBattle($who["login"]); } else { $bat = mysql_fetch_Array(mysql_query("SELECT * FROM battles WHERE id='" . $bot_var['battle_id'] . "'")); $creator = $bat['creator_id']; mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over) VALUES('" . $who["login"] . "','1','" . $ip . "','" . $creator . "','0','0')"); $date = date("H:i"); $att = "<span class=date2>{$date}</span> <b>" . $who["login"] . "</b> вмешался в поединок!</b></b><hr>"; battle_log($bat['id'], $att); goBattle($who["login"]); } } }
* @since 05-26-2014 */ $selectBot = ''; $curBot = array(); $post_vars = filter_input_array(INPUT_POST); if (isset($post_vars['action']) && $post_vars['action'] == "update") { $selectBot .= getChangeList(); $msg = updateBotSelection(); $selectBot .= getSelectedBot(); } elseif (isset($post_vars['action']) && $post_vars['action'] == "change") { $bot_id = $post_vars['bot_id']; changeBot(); $selectBot .= getChangeList(); $selectBot .= getSelectedBot(); } elseif (isset($post_vars['action']) && $post_vars['action'] == "add") { $selectBot .= addBot(); $selectBot .= getChangeList(); $selectBot .= getSelectedBot(); } else { $selectBot .= getChangeList(); $selectBot .= getSelectedBot(); } $bot_format = isset($curBot['format']) ? $curBot['format'] : $format; $_SESSION['poadmin']['format'] = $bot_format; $topNav = $template->getSection('TopNav'); $leftNav = $template->getSection('LeftNav'); $main = $template->getSection('Main'); $navHeader = $template->getSection('NavHeader'); $FooterInfo = getFooter(); $errMsgClass = !empty($msg) ? "ShowError" : "HideError"; $errMsgStyle = $template->getSection($errMsgClass);
function startTrain($who) { $ip = $who['remote_ip']; $prototype = $who['login']; $mine_id = $who['id']; $me = $who['login']; $name = "Тень"; mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','1','3','" . $mine_id . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over) VALUES('" . $me . "','1','" . $ip . "','" . $mine_id . "','0','0')"); addBot($me, $mine_id, $prototype, $name); goBattle($me); }