true,
];
$vad['recept'] = [
//Б
[897, 3],
[903, 2],
[888, 2],
[892, 1],
[892, 1, 892, 1],
//З
[950, 3],
[904, 2],
[878, 2],
[880, 1],
[880, 1, 892, 1],
//К
[899, 3],
[882, 2],
[908, 2],
[909, 1],
[909, 1, 892, 1],
//Ответа
[899, 3],
[902, 2],
[881, 2],
[893, 1],
[893, 1, 892, 1],
//Отражения
[898, 3],
[890, 2],
[907, 2],
[905, 1],
[905, 1, 892, 1],
];
$vad['test1'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $u->info['dnow'] . '" AND `vars` = "obj_act' . $obj['id'] . '_lab" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
$vad['test2'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $u->info['dnow'] . '" AND `vars` = "obj_act' . $obj['id'] . '_lab" LIMIT 1'
)
);
$vad['i'] = 0;
while ($vad['i'] < count($vad['recept'])) {
//4243 + $vad['i']
$vad['tr_itm'] = $vad['recept'][$vad['i']][0];
if ($vad['tr_itm'] > 0) {
$vad['tr_itm'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(*) FROM `items_users` WHERE `item_id` = "' . $vad['recept'][$vad['i']][0] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inTransfer` = "0" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
if ($vad['tr_itm'][0] >= $vad['recept'][$vad['i']][1]) {
$vad['tr_itm'] = true;
} else {
$vad['tr_itm'] = false;
}
}
if ($vad['recept'][$vad['i']][2] > 0 && $vad['tr_itm'] == true) {
$vad['tr_itm'] = mysql_fetch_array(
mysql_query(
'SELECT COUNT(*) FROM `items_users` WHERE `item_id` = "' . $vad['recept'][$vad['i']][2] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inTransfer` = "0" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
if ($vad['tr_itm'][2] >= $vad['recept'][$vad['i']][3]) {
//все ок
} else {
$vad['tr_itm'] = false;
}
}
if ($vad['tr_itm'] == true) {
$vad['itm'][] = mysql_fetch_array(
mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . (4243 + $vad['i']) . '" LIMIT 1')
);
$vad['tr'][(4243 + $vad['i'])] = [$vad['recept'][$vad['i']][0], $vad['recept'][$vad['i']][1], $vad['recept'][$vad['i']][2], $vad['recept'][$vad['i']][3]];
}
$vad['i']++;
}
$vad['itm'] = $vad['itm'][rand(0, count($vad['itm']) - 1)];
if ($vad['test2'][0] >= 10) {
$r = 'Не удалось воспользоваться лабораторией, не более 10 раз на команду за один поход';
$vad['go'] = false;
} elseif ($vad['test1'][0] >= 3) {
$r = 'Не удалось воспользоваться лабораторией, не более 3 раз на персонажа за один поход';
$vad['go'] = false;
} elseif (!isset($vad['itm']['id'])) {
$r = 'Недостаточно ингридиентов...';
$vad['go'] = false;
}
if ($vad['go'] == true) {
//Выдаем предмет
if ($vad['tr'][$vad['itm']['id']][1] > 0) {
ItemsModel::deleteItemsById($vad['tr'][$vad['itm']['id']][0], $vad['tr'][$vad['itm']['id']][1]);
}
if ($vad['tr'][$vad['itm']['id']][3] > 0) {
ItemsModel::deleteItemsById($vad['tr'][$vad['itm']['id']][2], $vad['tr'][$vad['itm']['id']][3]);
}
mysql_query(
'INSERT INTO `dungeon_actions` (`dn`,`uid`,`time`,`vars`,`x`,`y`) VALUES (
"' . $u->info['dnow'] . '","' . $u->info['id'] . '","' . time(
) . '","obj_act' . $obj['id'] . '_lab","' . $obj['x'] . '","' . $obj['y'] . '"
)'
);
\User\ItemsModel::addItem($vad['itm']['id'], $u->info['id'], '|frompisher=101');
$r = 'Вы создали предмет "' . $vad['itm']['name'] . '"! Расплавив ресурсы ...';
if ($u->info['sex'] == 0) {
$vad['text'] = '' . $u->info['login'] . ' создал предмет "' . $vad['itm']['name'] . '" при помощи "' . $obj['name'] . '".';
} else {
$vad['text'] = '' . $u->info['login'] . ' создала предмет "' . $vad['itm']['name'] . '" при помощи "' . $obj['name'] . '".';
}
$this->sys_chat($vad['text']);
}
}