function arcomage_user($char, $player, $money) { global $user_id; $id = $player['user_id']; list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$id}")); $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}")); if ($map['name'] == 'Арена Хаоса') { return ''; } if ($map['dolina'] == 1) { return ''; } list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$user_id}")); $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}")); if ($map['name'] == 'Арена Хаоса') { return ''; } if ($map['dolina'] == 1) { return ''; } if (played_arco($player['user_id']) != 0) { //нельзя нападать на игроков в две башни return 'Игрок играет в Две Башни'; } $r = mt_rand(1, 5); if ($r == 1) { $tower_win = 50; $resource_win = 150; $tower = 10; $wall = 5; $bricks = 10; $gems = 10; $monsters = 10; $bricks_add = 2; $gems_add = 2; $monsters_add = 2; } elseif ($r == 2) { $tower_win = 100; $resource_win = 100; $tower = 20; $wall = 15; $bricks = 15; $gems = 15; $monsters = 15; $bricks_add = 1; $gems_add = 1; $monsters_add = 1; } elseif ($r == 3) { $tower_win = 150; $resource_win = 250; $tower = 30; $wall = 20; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 5; $gems_add = 5; $monsters_add = 5; } elseif ($r == 4) { $tower_win = 100; $resource_win = 300; $tower = 20; $wall = 10; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 3; $gems_add = 3; $monsters_add = 3; } else { $tower_win = 200; $resource_win = 150; $tower = 20; $wall = 20; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 2; $gems_add = 2; $monsters_add = 2; } $nachalo = time(); myquery("DELETE FROM arcomage_call WHERE user_id='{$user_id}'"); myquery("DELETE FROM arcomage_call WHERE user_id='{$id}'"); $ins = myquery("insert into arcomage (hod,tower_win,resource_win,money,timehod,user1, user1_name, user2, user2_name) values (1,'{$tower_win}','{$resource_win}','{$money}', {$nachalo}, {$user_id}, '" . $char['name'] . "', {$id}, '" . $player['name'] . "')"); $uid = mysql_insert_id(); myquery("DELETE FROM arcomage_users WHERE user_id='{$user_id}'"); myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$user_id}'"); $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$user_id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','6',{$nachalo})"); $is = mysql_insert_id(); $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'")); for ($n = 1; $n <= 5; $n++) { $new_card = get_new_card($charboy, 0); $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$user_id}','{$new_card}')"); } myquery("DELETE FROM arcomage_users WHERE user_id='{$id}'"); myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$id}'"); $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','7',{$nachalo})"); $is = mysql_insert_id(); $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'")); for ($n = 1; $n <= 5; $n++) { $new_card = get_new_card($charboy, 0); $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$id}','{$new_card}')"); } set_delay_reason_id($user_id, 10); set_delay_reason_id($id, 10); // Пробный setLocation("arcomage.php"); // Попробуем так забросить противника в бой. Тут есть потенциальные проблемы. // Т.к. точно ли мы уверены, что игрок находится в тех режимах, из которых можно выйти в бой. А мы его форсируем. ForceFunc($id, 4); return ''; }
$users[0]['gems'] = 0; $users[0]['gems_add'] = 0; $users[0]['monsters'] = 0; $users[0]['monsters_add'] = 0; $users[0]['win'] = 0; $users[0]['lose'] = 0; $users[0]['hod'] = 0; $kogo = 0; if ($arcomage['user1'] == $user_id) { $kogo = $arcomage['user2']; } else { $kogo = $arcomage['user1']; } make_action_card($users, $user_id, $kogo, $card); myquery("UPDATE arcomage_users SET bricks=" . $users[$user_id]['bricks'] . ",gems=" . $users[$user_id]['gems'] . ",monsters=" . $users[$user_id]['monsters'] . " WHERE user_id={$user_id}"); $charboy['bricks'] = $users[$user_id]['bricks']; $charboy['gems'] = $users[$user_id]['gems']; $charboy['monsters'] = $users[$user_id]['monsters']; } } //удалим у игрока сходвишую карту myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$user_id}' AND arcomage_id='" . $charboy['arcomage_id'] . "' AND card_id='{$card}'"); //дадим игроку новую карту $new_card = get_new_card($charboy, $hod); myquery("INSERT INTO arcomage_users_cards (arcomage_id,user_id,card_id) VALUES ('" . $charboy['arcomage_id'] . "','{$user_id}','{$new_card}')"); } } } if (function_exists("save_debug")) { save_debug(); }