Esempio n. 1
0
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 '';
}
Esempio n. 2
0
if (isset($arcomage_arco_id) and isset($arcomage_call_zayava)) {
    $arcomage_arco_id = (int) $arcomage_arco_id;
    $sel = myquery("SELECT * FROM arcomage_call WHERE user_id='{$arcomage_arco_id}' AND end>=" . time() . " LIMIT 1");
    if (mysql_num_rows($sel)) {
        $call = mysql_fetch_array($sel);
        $arcomage_online_range = time() - 300;
        $arcomage_result = myquery("SELECT view_active_users.*,IFNULL(combat_users.combat_id,0) as boy FROM view_active_users LEFT JOIN combat_users ON (view_active_users.user_id=combat_users.user_id) WHERE view_active_users.user_id={$arcomage_arco_id} and view_active_users.user_id<>" . $char['user_id'] . " ");
        $player = mysql_fetch_array($arcomage_result);
        if (!mysql_num_rows($arcomage_result)) {
            echo '<script>location.replace("act.php?errror=arcomage_active")</script>';
            if (function_exists("save_debug")) {
                save_debug();
            }
            exit;
        }
        if (played_arco($call['user_id']) != 0) {
            echo '<script>location.replace("act.php?errror=arcomage_active")</script>';
            if (function_exists("save_debug")) {
                save_debug();
            }
            exit;
        }
        if ($call['money'] > 0 and $call['money'] > $char['GP']) {
            echo '<script>location.replace("act.php?errror=arcomage_call_money")</script>';
            if (function_exists("save_debug")) {
                save_debug();
            }
            exit;
        }
        if ($call['money'] > 0 and $call['money'] > $player['GP']) {
            echo '<script>location.replace("act.php?errror=arcomage_player_money")</script>';