Пример #1
0
 $select = myquery("select * from craft_resource where id={$b['0']}");
 $build = mysql_fetch_array($select);
 //вычитание у владельца
 $selo = myquery("select * from craft_resource_user where res_id={$b['0']} and user_id={$build_vladel}");
 $resko = mysql_fetch_array($selo);
 if (mysql_num_rows($selo) and $resko['col'] >= $b[1]) {
     if ($admin_build != 1) {
         myquery("update craft_resource_user set col=GREATEST(0,col-{$b['1']}) where user_id={$build_vladel} and res_id={$b['0']}");
         myquery("UPDATE game_users SET CW=CW-" . $build['weight'] * $b[1] . " WHERE user_id={$build_vladel}");
     }
     $chance = 100;
     mt_srand(make_seed());
     $r = mt_rand(0, 100);
     $inc = 0;
     if ($build['spets'] != '') {
         $craft_index = get_craft_index($build['spets']);
         $spetstime = getCraftTimes($user_id, $craft_index);
         $spetslevel = CraftSpetsTimeToLevel($craft_index, $spetstime + 1);
         if ($craft_index == 1) {
             if (getCraftLevel($user_id, $craft_index) < 19) {
                 $chance = 50;
             } else {
                 $chance = min(100, 50 + (getCraftLevel($user_id, $craft_index) - 18) * 2);
             }
             if ($r > $chance) {
                 // промашка при сборе. Навык не увеличиваем
             } else {
                 $inc = 1;
             }
         } else {
             $inc = 1;
Пример #2
0
 $eliksir = 99;
 if ($building['include'] == 'mining') {
     $eliksir = 0;
 }
 $date_rab = time();
 if ($building['include'] == 'sawmill') {
     $date_rab = 0;
     $dlitel = 0;
     $eliksir = 0;
 }
 myquery("INSERT INTO craft_build_rab (user_id, build_id, date_rab, dlit, eliksir) VALUES ('" . $char['user_id'] . "', '" . $build['id'] . "', '" . $date_rab . "', '" . $dlitel . "',{$eliksir})");
 $_SESSION['craft_code'] = '';
 $craft_index = 1;
 $refresh = 5;
 if ($building['include'] != '') {
     $craft_index = get_craft_index($building['include']);
     $refresh = 0;
 } else {
     echo 'Ты ' . echo_sex('устроился', 'устроилась') . ' на работу';
 }
 $id_reason = getDelayReasonCraft($craft_index);
 if (isset($_SESSION['cur_get_mining'])) {
     unset($_SESSION['cur_get_mining']);
 }
 craft_setFunc($user_id, $craft_index);
 set_delay_reason_id($user_id, $id_reason);
 // Попробуем форсировать игрока. Это с точки зрения логичности не совсем верно, но все же.
 // Точнее не верно то, что мы и редиректим его и форсируем.
 ForceFunc($user_id, func_craft);
 if (isset($_GET['mes'])) {
     setLocation("../craft.php?mes=" . $mes);