[
'name' => 'light',
'items' => [
[5048, 4, 0, 'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1'],
[391, 1, 0, 'useOnLogin=1|musor=1|noremont=1|tr_align=3|srok=86400|nosale=1|sudba=1'],
[4943, 1, 0, 'usefromfile=1|musor=1|noremont=1|tr_align=7|srok=86400|nosale=1|sudba=1'],
],
],
3 => [
'name' => 'dark',
'items' => [
[391, 1, 0, 'useOnLogin=1|musor=1|noremont=1|tr_align=3|srok=86400|nosale=1|sudba=1'],
],
],
7 => [
'name' => 'neytral',
'items' => [
[4943, 1, 0, 'usefromfile=1|musor=1|noremont=1|tr_align=7|srok=86400|nosale=1|sudba=1'],
],
],
];
//items >
// 0 → id,
// 1 → количество использований,
// 2 → [0 => 'на сегодня', 1 => ' всего'] (только отображение),
// 3 → data,
$vnr = [0 => 'на сегодня', 1 => ' всего'];
$itemsString = '';
$linkGET = 'take_item_' . $bonus[(int)$u->info['align']]['name'] . '_panel';
$actionName = $bonus[(int)$u->info['align']]['name'] . '_itm';
Db::sql('delete from actions where uid = ? and time < unix_timestamp(current_date) and vars like ?', [$u->info['id'], $actionName . '%']);
foreach ($bonus[(int)$u->info['align']]['items'] as $bonusItem) {
if ($bonusItem[1] === 0) {
continue;
}
$item = Db::getRow('select * from items_main where id = ?', [$bonusItem[0]]);
if (!$item['id']) {
continue;
}
$bonusItemStock = Db::getValue('select count(*) from actions where uid = ? and time >= unix_timestamp(current_date) and vars = ?', [$u->info['id'], $actionName . $item['id']]);
if ($bonusItem[1] - $bonusItemStock > 0 && intval($_GET[$linkGET]) === $item['id']) {
$nitm = ItemsModel::addItem($item['id'], $u->info['id'], $bonusItem[3]);
ActionModel::new($u->info, '', $actionName . $item['id']);
echo 'Предмет «' . $item['name'] . '» перемещен к Вам в инвентарь!
';
}
//Вывод предметов
$s = ' ';
if ($bonusItem[1] - $bonusItemStock > 0) {
$s = '' . $s . '';
} else {
$s = '' . $s . '';
}
$itemsString .= $s;
}
?>