function attack($who) { $weapons = array('axe', 'fail', 'knife', 'sword', 'spear', 'shot', 'staff', 'kostyl'); $shields = array('shield', 'spear'); $str = ""; $bot_name = array(); $bot_name[0] = "Гигантская крыса"; $bot_name[1] = "Дикий Циклоп"; $bot_name[2] = "Гигантский Червь"; $bot_name[3] = "Дерево убийца"; $bot_name[4] = "Трол"; $bot_name[5] = "Лев"; $bot_name[6] = "Разбойник"; $prototype = $who["login"]; if (in_array($who["hand_r_type"], $weapons) && in_array($who["hand_l_type"], $weapons)) { $two_hands = 1; } if (voin_type($who) == "mag") { $two_hands = 1; } if (in_array($who["hand_l_type"], $shields)) { $shield_hands = 1; } if (!$who["zayavka"] && $who["hp"] > 0) { $bot_count = rand(1, 3); $timeout = time() + 180; $add_hp = ceil($who["hp_all"] * 1.12); mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','55','3','" . $who["id"] . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $who["login"] . "','1','" . $ip . "','" . $who["id"] . "')"); mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('55', '" . $who["id"] . "', '" . $timeout . "')"); $b_id = mysql_insert_id(); for ($i = 1; $i <= $bot_count; $i++) { $name = $bot_name[rand(0, count($bot_name) - 1)]; $name = $name . "(" . $i . ")"; $str .= "<b>" . $name . "</b> "; mysql_query("INSERT INTO bot_temp(bot_name, hp, hp_all, battle_id, prototype, team, two_hands, shield_hands) \n\t\t\tVALUES('" . $name . "','" . $add_hp . "','" . $add_hp . "','" . $b_id . "','" . $prototype . "','2','{$two_hands}','{$shield_hands}')"); } talk($who["login"], "На вас напал " . $str, $who); goBattle($who["login"]); } }
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; if ($new_hp > $have_bot["hp_all"]) {
$timeout = time() + 3 * 60; say("toroom", "<b>" . $login . "</b> напал на <b>" . $res["player"] . "</b>", $login); mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','" . $battle_type . "','3','" . $mine_id . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $db["login"] . "','2','" . $db["last_ip"] . "','" . $mine_id . "')"); mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $res["player"] . "','1','" . $res["last_ip"] . "','" . $mine_id . "')"); mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('" . $battle_type . "', '" . $mine_id . "', '" . $timeout . "')"); goBattle($db["login"]); goBattle($res["player"]); } else { if ($res["battle"] != 0) { $D = mysql_fetch_array(mysql_query("SELECT * FROM teams WHERE player='" . $res["player"] . "'")); if ($D) { mysql_query("INSERT INTO teams(player, team, ip, battle_id) VALUES('" . $login . "','" . ($D["team"] == 1 ? 2 : 1) . "','" . $db["last_ip"] . "','" . $D["battle_id"] . "')"); $att = "<span class=date2>{$date}</span> <script>drwfl('" . $db['login'] . "','" . $db['id'] . "','" . $db['level'] . "','" . $db['dealer'] . "','" . $db['orden'] . "','" . $db['admin_level'] . "','" . $db['clan_short'] . "','" . $db['clan'] . "');</script> вмешался в поединок!</b><hr>"; battle_log($res['battle'], $att); goBattle($login); } } } } } } } } } } ##################Декорации#############################################333 foreach ($Items_Array as $item_info) { if (in_array($step1["fwd_cord"], $item_info)) { $draw_item_fwd = $item_info["type"]; }
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"]); } } }
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); }
if ($res["battle"] != 0) { $Q_TEAM = mysql_query("SELECT * FROM teams WHERE player='" . $res["login"] . "'"); $D = mysql_fetch_array($Q_TEAM); if ($D) { $battle_id = $D["battle_id"]; $team = $D["team"]; mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over) VALUES('" . $_SESSION["login"] . "','" . ($team == 1 ? 2 : 1) . "','" . $db["last_ip"] . "','" . $battle_id . "','0','0')"); $chas = date("H"); $date = date("H:i", mktime($chas)); $log_file = "logs/" . $res['battle'] . ".dis"; $f = fopen($log_file, "a"); include "align.php"; $att = "<span class=date2>{$date}</span> " . drwfl($db['login'], $db['id'], $db['level'], $db['dealer'], $db['orden'], $db['admin_level'], $db['clan_short'], $db['clan']) . " вмешался в поединок!</b></b><hr>"; fputs($f, $att); fclose($f); goBattle($_SESSION["login"]); } } } } } } } } } else { $msg = "Вы не можете кастовать это заклятие находясь в бою!"; } } } // ---------------------------------------------------------------------- if ($_GET[go] == r) {