Пример #1
0
function break_axe(&$action1)
{
    global $user_id;
    myquery("UPDATE game_items SET item_uselife=item_uselife-2 WHERE priznak=0 AND user_id={$user_id} AND used=21");
    list($id_item, $cur_uselife) = mysql_fetch_array(myquery("SELECT id,item_uselife FROM game_items WHERE priznak=0 AND user_id={$user_id} AND used=21"));
    if ($cur_uselife <= 0) {
        $Item = new Item($id_item);
        $Item->down();
        craft_DelFunc($user_id);
        $action1 = 'У тебя сломано кайло!';
    }
}
Пример #2
0
         case $id_resource_mithril_ore:
             $res_id_bullion = $id_resource_mithril_bullion;
             break;
         case $id_resource_gold_nugget:
             $res_id_bullion = $id_resource_gold_bullion;
             break;
     }
     $res_in = mysql_fetch_array(myquery("SELECT * FROM craft_resource WHERE id='" . $res_id_bullion . "' "));
     $Res = new Res($res_in);
     $check = $Res->add_user(0, $user_id);
     if ($check == 1) {
         myquery("UPDATE game_items SET item_uselife=item_uselife-" . mt_rand(400, 600) / 100 . " WHERE user_id={$user_id} AND used=21 AND priznak=0");
         list($id_item, $cur_uselife) = mysql_fetch_array(myquery("SELECT id,item_uselife FROM game_items WHERE priznak=0 AND user_id={$user_id} AND used=21"));
         if ($cur_uselife <= 0) {
             $Item = new Item($id_item);
             $Item->down();
         }
         $mes = 'Получен ресурс: <i>' . $res_in['name'] . '</i> в количестве 1 ед.';
         setCraftTimes($user_id, 10, 3, 1);
         myquery("insert into craft_stat (build_id, gp, res_id, dob, vip, dat, user, type) values (0, 0, {$res_id_bullion}, 0, 1, " . time() . ", {$user_id}, 'z')");
     } else {
         $mes = 'Неудачная попытка работы на плавильне. Проверь, хватает ли у тебя места для новых ресурсов в инвентаре!';
     }
     myquery("DELETE FROM craft_build_founder WHERE user_id={$user_id}");
 } else {
     mt_srand(make_seed());
     $new_nas = mt_rand(1, $founder['nas'] - 10);
     mt_srand(make_seed());
     $new_teplo = mt_rand(1, 100);
     $new_state = $founder['state'] + 1;
     $mes = 'Выполнена ' . $new_state . ' из 3 стадий плавления.';
Пример #3
0
 if ($result_items != false and mysql_num_rows($result_items) > 0) {
     //предмет проверили. дальше идем
     $item = mysql_fetch_array($result_items);
     $breakdown = 0;
     $chance = mt_rand(1, 100);
     if ($item['breakdown'] == 1 and $chance > 1) {
         $breakdown = 1;
     }
     if ($item['type'] == 3) {
         $item['uselife_template'] = 100;
     }
     list($molot_id, $molot_uselife) = mysql_fetch_array($est_molot);
     $break = ($item['uselife_template'] - $item['uselife_now']) / 100;
     if ($molot_uselife <= $break) {
         $molot = new Item($molot_id);
         $molot->down();
         myquery("UPDATE game_items SET item_uselife=0 WHERE id={$molot_id}");
     } else {
         myquery("UPDATE game_items SET item_uselife=item_uselife-{$break} WHERE id={$molot_id}");
     }
     QuoteTable('open');
     echo '<br>';
     if ($item['uselife_max_now'] > 1 or $breakdown == 0) {
         myquery("UPDATE game_items SET item_uselife=" . $item['uselife_template'] . ",item_uselife_max=item_uselife_max-{$breakdown} WHERE id={$nak}");
         echo 'Предмет <span style="font-weight:800;color:red;">' . $item['name'] . '</span> отремонтирован до состояния: ' . $item['uselife_template'] . '%.';
         if ($breakdown > 0) {
             //Выдадим опыт за подход
             add_exp_for_craft($user_id, 12);
             setCraftTimes($user_id, 12, 2, 2);
             echo ' <br />У предмета уменьшена долговечность на ' . $breakdown . '';
         }
Пример #4
0
         echo '<center><font face=verdana color=white size=2><b>Профессия забыта!</b></font><meta http-equiv="refresh" content="4;url=town.php?option=' . $option . '">';
     }
 } elseif (isset($_GET['action']) and $_GET['action'] == 'new_race') {
     $id = 5;
     $cost = check_lr($user_id, $id);
     $attr = $_GET['attr'];
     list($user_race) = mysql_fetch_array(myquery("Select race from game_users where user_id={$user_id}"));
     if ($cost == -1) {
         echo '<center><font face=verdana color=ff0000 size=2>У вас нет Личного Рейтинга на покупку данной услуги!</font><meta http-equiv="refresh" content="4;url=town.php?option=' . $option . '"><br />';
     } elseif ($attr == $user_race) {
         echo '<center><font face=verdana color=ff0000 size=2>Ваша раса совпадает с выбранной!</font><meta http-equiv="refresh" content="4;url=town.php?option=' . $option . '"><br />';
     } else {
         $check = myquery("Select t1.id From game_items as t1 Join game_items_factsheet as t2 on t1.item_id=t2.id Where t1.user_id={$user_id} and t1.used>0 and t2.race<>{$attr} and t2.race<>0");
         while (list($item_id) = mysql_fetch_array($check)) {
             $Item = new Item();
             $Item->down($item_id);
         }
         list($hp, $hp_max, $mp, $mp_max, $stm, $stm_max, $gp, $str, $dex, $vit, $ntl, $pie, $spd) = mysql_fetch_array(myquery("SELECT t1.hp-t2.hp, t1.hp_max-t2.hp_max, t1.mp-t2.mp, t1.mp_max-t2.mp_max, t1.stm-t2.stm, t1.stm_max-t2.stm_max, t1.gp-t2.gp, t1.str-t2.str, t1.dex-t2.dex, t1.vit-t2.vit, t1.ntl-t2.ntl, t1.pie-t2.pie, t1.spd-t2.spd FROM game_har as t1, game_har as t2 WHERE t2.id={$user_race} and t1.id={$attr}"));
         myquery("Update game_users Set race={$attr}, hp_max=hp_max+{$hp_max}, mp_max=mp_max+{$mp_max}, stm_max=stm_max+{$stm_max}, gp=gp+{$gp}, str=str+{$str}, vit=vit+{$vit}, dex=dex+{$dex}, spd=spd+{$spd}, pie=pie+{$pie}, ntl=ntl+{$ntl}, spd_max=spd_max+{$spd}, vit_max=vit_max+{$vit}, str_max=str_max+{$str}, pie_max=pie_max+{$pie}, ntl_max=ntl_max+{$ntl}, dex_max=dex_max+{$dex} where user_id={$user_id}");
         myquery("Insert into game_lr_services_hist (user_id, serv_id, lr, value) Values ({$user_id}, {$id}, {$cost}, {$user_race})");
         echo '<center><font face=verdana color=white size=2><b>Раса изменена!</b></font><meta http-equiv="refresh" content="4;url=town.php?option=' . $option . '">';
     }
 } elseif (isset($_GET['action']) and $_GET['action'] == 'add_clan') {
     $attr = $_GET['attr'];
     if ($attr == '') {
         echo '<center><font face=verdana color=ff0000 size=2>Введены некорректные данные!</font><meta http-equiv="refresh" content="4;url=town.php?option=' . $option . '"><br />';
     } else {
         $id = 6;
         $number = strpos($attr, ";");
         $clan_id = substr($attr, 0, $number);
         $kol = substr($attr, $number + 1);
Пример #5
0
 private function check_item_down($id_items, $user_id)
 {
     if ($id_items == -1) {
         $sel = myquery("SELECT id FROM game_items WHERE used=1 AND priznak=0 AND user_id={$user_id} AND item_uselife<=0");
         while (list($it_id) = mysql_fetch_array($sel)) {
             $Item = new Item($it_id);
             $Item->down();
         }
     } else {
         $sel = myquery("SELECT id FROM game_items WHERE used>0 AND priznak=0 AND user_id={$user_id} AND item_uselife<=0 AND id={$id_items}");
         while (list($it_id) = mysql_fetch_array($sel)) {
             $Item = new Item($it_id);
             $Item->down();
         }
     }
 }
Пример #6
0
    $item_name = mysqlresult(myquery("SELECT name FROM game_items_factsheet WHERE id=" . $item_id . ""), 0, 0);
    $complect_name = mysqlresult(myquery("SELECT name FROM game_items_factsheet WHERE id=" . $complect_id . ""), 0, 0);
    myquery("DELETE FROM game_items_complect WHERE id={$id}");
    $da = getdate();
    $log = myquery("INSERT INTO game_log_adm (adm,dei,cur_time,day,month,year) \n\t VALUES (\n\t '" . $char['name'] . "',\n\t 'Для предмета: <b>" . $item_name . "</b> удалил из комплекта " . $complect_name . ": предмет <b>" . $item_name . "</b>',\n\t '" . time() . "',\n\t '" . $da['mday'] . "',\n\t '" . $da['mon'] . "',\n\t '" . $da['year'] . "')") or die(mysql_error());
    $response = 'ok';
}
// При изменении состава комплекта пересчитать всех игроков.
if (isset($_GET['save']) or isset($_GET['delete'])) {
    $complect_id = (int) $_GET['read'];
    // Снимаем комплект со всех, у кого он был одет.
    $res = myquery("SELECT `id`,`user_id` FROM `game_items` WHERE `priznak`=0 AND `used`=22 AND `item_id` = {$complect_id}");
    while ($list = mysql_fetch_array($res)) {
        $item = new Item($list['id']);
        $item->setChar($list['user_id']);
        $item->down();
    }
    $complect_fact = mysql_fetch_assoc(myquery("SELECT * FROM game_items_factsheet WHERE id={$complect_id}"));
    $complect_fact['weight'] = (double) $complect_fact['weight'];
    $sel_check = myquery("SELECT item_id FROM game_items_complect WHERE complect_id={$complect_id}");
    // Игроки у которых можеь быть одета новая версия комплекта
    $res = myquery("SELECT DISTINCT `user_id` FROM `game_items` WHERE `priznak`=0 AND `used`!=0 AND `item_id` IN (SELECT DISTINCT `item_id` FROM `game_items_complect` WHERE `complect_id` = {$complect_id});");
    while ($list = mysql_fetch_array($res)) {
        //Требования к этому комплекту выполненны?
        $check_user_id = $list['user_id'];
        $est_complect = 0;
        $kol_item_in_complect = 0;
        $kol_item_complect_used = 0;
        mysql_data_seek($sel_check, 0);
        while (list($item_ch_id) = mysql_fetch_array($sel_check)) {
            $kol_item_in_complect++;
Пример #7
0
if ($f_id == '1') {
    if (function_exists("save_debug")) {
        save_debug();
    }
    exit;
}
if (!empty($_GET['inv_option'])) {
    switch ($_GET['inv_option']) {
        case 'equip':
            $id = (int) $_GET['id'];
            $Item = new Item();
            $Item->up($id, 0);
            break;
        case 'unequip':
            $Item = new Item();
            $Item->down($_GET['id']);
            break;
        case 'kleymo_return':
            $Item = new Item();
            $Item->kleymo_return($_GET['id']);
            break;
        case 'use':
            $Item = new Item();
            $Item->use_item($_GET['id']);
            break;
        case 'drop':
            $Item = new Item();
            $Item->drop($_GET['id']);
            break;
        case 'takeres':
            if (!isset($_GET['id']) or !is_numeric($_GET['id']) or !isset($_GET['col']) or $_GET['col'] <= 0 or !is_numeric($_GET['col'])) {
Пример #8
0
    }
    $mas[3][1] = 1249;
    $mas[3][2] = 1250;
    $mas[3][3] = 1251;
    $mas[6][1] = 1266;
    $mas[6][2] = 1267;
    $mas[6][3] = 1268;
    $mas[9][1] = 1237;
    $mas[9][2] = 1238;
    $mas[9][3] = 1239;
    $mas[12][1] = 1272;
    $mas[12][2] = 1273;
    $mas[12][3] = 1274;
    $check = myquery("SELECT id, user_id FROM game_items WHERE used>0 AND priznak=0 AND item_id in ('" . $mas[$cur][1] . "', '" . $mas[$cur][2] . "', '" . $mas[$cur][3] . "')");
    if (mysql_num_rows($check) > 0) {
        while ($item = mysql_fetch_array($check)) {
            $Item = new Item();
            $Item->down($item['id'], $item['user_id']);
        }
    }
    list($weight) = mysql_fetch_array(myquery("SELECT weight FROM game_items_factsheet WHERE id = '" . $mas[$cur][1] . "' "));
    myquery("UPDATE game_users gu SET gu.CW=gu.CW - '" . $weight . "'*(SELECT count(*) \n\t\t\t FROM game_items gi WHERE gu.user_id = gi.user_id and gi.item_id in ('" . $mas[$cur][1] . "', '" . $mas[$cur][2] . "', '" . $mas[$cur][3] . "') and gi.priznak = 0)\n\t\t\t");
    myquery("UPDATE game_users_archive gu SET gu.CW=gu.CW - '" . $weight . "'*(SELECT count(*) \n\t\t\t FROM game_items gi WHERE gu.user_id = gi.user_id and gi.item_id in ('" . $mas[$cur][1] . "', '" . $mas[$cur][2] . "', '" . $mas[$cur][3] . "') and gi.priznak = 0)\n\t\t\t");
    myquery("DELETE FROM game_items WHERE item_id in ('" . $mas[$cur][1] . "', '" . $mas[$cur][2] . "', '" . $mas[$cur][3] . "')");
    myquery("UPDATE game_npc_drop SET items_id = '" . $mas[$next][1] . "' WHERE items_id = '" . $mas[$cur][1] . "' and drop_type = 1");
    myquery("UPDATE game_npc_drop SET items_id = '" . $mas[$next][2] . "' WHERE items_id = '" . $mas[$cur][2] . "' and drop_type = 1");
    myquery("UPDATE game_npc_drop SET items_id = '" . $mas[$next][3] . "' WHERE items_id = '" . $mas[$cur][3] . "' and drop_type = 1");
}
myquery("UPDATE game_cron_log SET step='28. Очищение логов', timecron=" . time() . " WHERE id={$idcronlog}");
myquery("DELETE FROM `game_items_deleted` WHERE action_time<adddate( now( ) , INTERVAL -3 MONTH) ");
myquery("UPDATE game_cron_log SET step='final', timecron=" . time() . " WHERE id={$idcronlog}");