Объединение панелей склонностей.

This commit is contained in:
Ivor Barhansky 2023-06-22 16:53:42 +03:00
parent 7270ec2004
commit 802f0a2ad0
8 changed files with 117 additions and 280 deletions

View File

@ -40,12 +40,16 @@ class ActionModel
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]); Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
} }
public static function new(array $user, string $vals, string $vars) public static function new(array $user, string $vals, string $vars, int $time = 0)
{ {
if (!$time) {
$time = time();
}
Db::sql( Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),?,?,?,?,?,?)', 'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)',
[ [
$user['id'], $user['id'],
$time,
$user['city'], $user['city'],
$user['room'], $user['room'],
$vars, $vars,
@ -56,8 +60,10 @@ class ActionModel
); );
} }
public static function getAll(): array public static function getAll(string $filter = ''): array
{ {
return Db::getRows('select * from actions'); return Db::getRows('select * from actions');
} }
} }

View File

@ -4,6 +4,7 @@ use Core\Config;
use Core\ConversionHelper; use Core\ConversionHelper;
use Core\Database; use Core\Database;
use Core\Db; use Core\Db;
use Model\ActionModel;
use User\ItemsModel; use User\ItemsModel;
class User class User
@ -2257,18 +2258,12 @@ class User
public function addAction($time, $vars, $vls, $uid = null): bool public function addAction($time, $vars, $vls, $uid = null): bool
{ {
if ($uid == null) { $info = $this->info;
$uid = $this->info['id']; if ($uid) {
$info['id'] = $uid;
} }
$ins = mysql_query( ActionModel::new($info, $vls, $vars, $time);
'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $uid . '","' . $time . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . mysql_real_escape_string( return true;
$vars
) . '","' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '","' . mysql_real_escape_string(
$vls
) . '")'
);
return (bool)$ins;
} }
public function testAction($filter, $tp) public function testAction($filter, $tp)
@ -6958,11 +6953,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$pl['rep'] = 2; $pl['rep'] = 2;
} }
} }
$is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',' . $pl['rep'] . ');">Выбрать</a>'; $is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',' . $pl['rep'] . ')">Выбрать</a>';
} elseif ($type == 14) { } elseif ($type == 14) {
$is1 .= '<a href="javascript:void(0);" onclick="massTakeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',0);">Выбрать</a>'; $is1 .= '<a href="javascript:void(0);" onclick="massTakeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',0)">Выбрать</a>';
} elseif ($type == 12) { } elseif ($type == 12) {
$is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',1);">Выбрать</a>'; $is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',1)">Выбрать</a>';
} elseif ($type == 10) { } elseif ($type == 10) {
//Общага (отображение предметов в общаге (под стеклом)) //Общага (отображение предметов в общаге (под стеклом))
$is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">В рюкзак</a>'; $is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">В рюкзак</a>';
@ -7164,7 +7159,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$inv1 = 'inv=1&'; $inv1 = 'inv=1&';
} }
if ($pl['item_id'] == 74) { if ($pl['item_id'] == 74) {
$is1 .= '<a onclick="top.addNewSmile(' . $pl['id'] . ',0); return false;" href="javascript:void(0)" title="Использовать">исп-ть</a>'; $is1 .= '<a onclick="top.addNewSmile(' . $pl['id'] . ',0) return false;" href="javascript:void(0)" title="Использовать">исп-ть</a>';
} else { } else {
$useUrl = ''; $useUrl = '';
if ($pl['magic_inc'] == '') { if ($pl['magic_inc'] == '') {
@ -7192,7 +7187,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
} }
if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) { if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) {
$is1 .= '<a onclick="top.addNewText(' . $pl['id'] . ',' . ($pl['max_text'] - $pl['use_text']) . ',' . $pl['inRazdel'] . '); return false;" href="javascript:void(0)" title="Записать текст на предмете">Записать</a><br>'; $is1 .= '<a onclick="top.addNewText(' . $pl['id'] . ',' . ($pl['max_text'] - $pl['use_text']) . ',' . $pl['inRazdel'] . ') return false;" href="javascript:void(0)" title="Записать текст на предмете">Записать</a><br>';
} }
if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) { if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) {
if ($d[2] == 1) { if ($d[2] == 1) {
@ -8622,7 +8617,7 @@ LIMIT 1'
if ($i1 == 0 && $u['battle'] == 0) { if ($i1 == 0 && $u['battle'] == 0) {
$rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time( $rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time(
) - $u['regHP']) . ',' . (time( ) - $u['regHP']) . ',' . (time(
) - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1);</script>'; ) - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1)</script>';
} }
if ($ivv == 0 && $i1 == 0) { if ($ivv == 0 && $i1 == 0) {
$rt[0] .= $this->info_remont(); $rt[0] .= $this->info_remont();

View File

@ -975,20 +975,20 @@ $u->stats = $u->getStats($u->info['id'], 0);
<?php <?php
if ($u->info['align'] >= 1 && $u->info['align'] < 2) { ?> if ($u->info['align'] >= 1 && $u->info['align'] < 2) { ?>
<td style="width: 30px"> <td style="width: 30px">
<img onClick="top.getUrl('main','main.php?1_panel=1&rnd='+c.rnd);" class="db cp" title="Панель света" <img onClick="top.getUrl('main','main.php?ap=1&rnd='+c.rnd);" class="db cp" title="Панель света"
src="<?= Config::img() ?>/i/buttons/chatBtn15.gif" alt=""></td> src="<?= Config::img() ?>/i/buttons/chatBtn15.gif" alt=""></td>
<?php <?php
} }
if ($u->info['align'] >= 3 && $u->info['align'] < 4) { ?> if ($u->info['align'] >= 3 && $u->info['align'] < 4) { ?>
<td style="width: 30px"> <td style="width: 30px">
<img onClick="top.getUrl('main','main.php?3_panel=1&rnd='+c.rnd);" class="db cp" title="Панель тьмы" <img onClick="top.getUrl('main','main.php?ap=1&rnd='+c.rnd);" class="db cp" title="Панель тьмы"
src="<?= Config::img() ?>/i/buttons/chatBtn10.gif" alt="Панель тьмы"> src="<?= Config::img() ?>/i/buttons/chatBtn10.gif" alt="Панель тьмы">
</td> </td>
<?php <?php
} }
if ($u->info['align'] == 7) { ?> if ($u->info['align'] == 7) { ?>
<td style="width: 30px"> <td style="width: 30px">
<img onClick="top.getUrl('main','main.php?7_panel=1&rnd='+c.rnd);" class="db cp" title="Панель нейтралитета" <img onClick="top.getUrl('main','main.php?ap=1&rnd='+c.rnd);" class="db cp" title="Панель нейтралитета"
src="<?= Config::img() ?>/i/buttons/a___neutral.gif" alt="Панель нейтралитета"> src="<?= Config::img() ?>/i/buttons/a___neutral.gif" alt="Панель нейтралитета">
</td> </td>
<?php <?php

View File

@ -409,18 +409,11 @@ if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) {
} elseif (isset($_GET['alh']) && !isset($u->tfer['id'])) { } elseif (isset($_GET['alh']) && !isset($u->tfer['id'])) {
require_once('modules_data/_alh.php'); require_once('modules_data/_alh.php');
} elseif ($u->info['clan'] > 0 && isset($_GET['clan']) && !isset($u->tfer['id'])) { } elseif ($u->info['clan'] > 0 && isset($_GET['clan']) && !isset($u->tfer['id'])) {
require_once('modules_data/_clan.php'); require_once('modules_data/_clan.php'); //Панель кланов
} elseif (isset($_GET['alhp']) && ($u->info['admin'] == 1 || $u->info['align'] == 50 || $u->info['align2'] == 50) && !isset($u->tfer['id'])) { } elseif (isset($_GET['alhp']) && ($u->info['admin'] == 1 || $u->info['align'] == 50) && !isset($u->tfer['id'])) {
require_once('modules_data/_alhp.php'); require_once('modules_data/_alhp.php'); //Панель алхимиков
//Панель светлого } elseif ($u->info['align'] > 0 && !isset($u->tfer['id']) && !empty($_GET['ap'])) {
} elseif ($u->info['align'] >= 1 && $u->info['align'] < 2 && isset($_GET['1_panel']) && !isset($u->tfer['id'])) { require_once('modules_data/alignPanel.php'); //Панель склонностей, GET чтобы вызывать по ссылке.
require_once('modules_data/1_panel.php');
//Панель темного
} elseif ($u->info['align'] >= 3 && $u->info['align'] < 4 && isset($_GET['3_panel']) && !isset($u->tfer['id'])) {
require_once('modules_data/3_panel.php');
//Панель темного
} elseif ($u->info['align'] >= 7 && $u->info['align'] < 8 && isset($_GET['7_panel']) && !isset($u->tfer['id'])) {
require_once('modules_data/7_panel.php');
} elseif ($u->info['battle'] != 0) { } elseif ($u->info['battle'] != 0) {
//поединок //поединок
if ((!isset($btl_last['id']) || $u->info['battle'] > 0) && !isset($u->info['battle_lsto'])) { if ((!isset($btl_last['id']) || $u->info['battle'] > 0) && !isset($u->info['battle_lsto'])) {

View File

@ -1,75 +0,0 @@
<?php
/**
* @var user $u
* @var array $c from _config.php
* @var array $vt
*/
use Core\Db;
if (!defined('GAME') || (int)$u->info['align'] !== 1) {
exit();
}
if ($u->error) {
echo '<b style="color: red">' . $u->error . '</b><br>';
}
//Абилки $item_light
$item_light = [
[5048, 1, 0, 0, 0, 'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1', 1],
];
$vi = [];
$vnr = [0 => 'на сегодня', 1 => ' всего'];
$seet = '';
foreach ($item_light as $item) {
if (!$item[1]) {
continue;
}
$itm = Db::getRow('select * from items_main where id = ?', [$item[0]]);
if (!$itm['id']) {
continue;
}
$vix = 0;
if ($item[4] === 0) {
$vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . strtotime('now 00:00:00') . ' AND `vars` = "dark_itm' . $itm['id'] . '"',
2);
} else {
$vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . $vt['timeUse'] . ' AND `vars` = "dark_itm' . $itm['id'] . '" ',
2);
}
$vix = $vix[0];
if ($item[1] - $vix > 0 && $_GET['take_item_light_panel'] == $itm['id']) {
$nitm = \User\ItemsModel::addItem($itm['id'], $u->info['id'], $item[5]);
$u->addAction(time(), 'dark_itm' . $itm['id'], '');
echo '<span style="color: red">Предмет &quot;<b>' . $itm['name'] . '</b>&quot; перемещен к Вам в инвентарь!</span><br><br>';
}
//Вывод предметов
$seet0 = '<img ' . $vix . ' title="' . $itm['name'] . '
(Осталось ' . $vnr[$item[4]] . ': ' . ($item[1] - $vix) . ' шт.)" src="https://' . $c['img'] . '/i/items/' . $itm['img'] . '"> ';
if ($item[1] - $vix > 0) {
$seet0 = '<a href="main.php?1_panel=1&take_item_light_panel=' . $itm['id'] . '">' . $seet0 . '</a>';
} else {
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; opacity: 0.20;">' . $seet0 . '</span>';
}
$seet .= $seet0;
}
?>
<link href="//img.new-combats.tech/css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/clu0b.css"/>
<link rel="stylesheet" type="text/css" href="css/windows.css"/>
<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
<h3>Светлая Сила с нами, собрат <?= $u->microLogin($u->info['id'], 1) ?></h3>
<div style="text-align: right;">
<input type="button" class="btn" value="Обновить" onclick="location='main.php?1_panel=1';">
<input type="button" class="btn" value="Вернуться" onclick="location='main.php';">
</div>
<div style="text-align: center;">
<div><strong>Абилки:</strong><br/><sup>(Чтобы забрать предмет просто нажмите на его изображение)</sup></div>
<div><?= $seet ?></div>
</div>

View File

@ -1,85 +0,0 @@
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
if(!defined('GAME'))
{
die();
}
if($u->info['align']>=3 && $u->info['align'] <4) {
if($u->error!='')
{
echo '<font color="red"><b>'.$u->error.'</b></font><br>';
}
$vu = array(0,0,0,0,0,0,0);
//Абилки $item_dark
$item_dark = array(
"" => array(
//array(4398,1,0,0,0,'useOnLogin=1|onlyOne=1|oneType=37|noremont=1|musor=1|tr_align=3|sudba='.$u->info['login'].'|srok=86400|nosale=1|sudba=1',1),
array(2391,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|tr_align=3|sudba='.$u->info['login'].'|srok=86400|nosale=1|sudba=1',1)
),
);
$vi = array(
);
?>
<link href="//img.new-combats.tech/css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/clu0b.css" />
<link rel="stylesheet" type="text/css" href="css/windows.css" />
<?php
?>
<table width="100%">
<tr>
<center><h3>Темная Сила с нами, собрат <?=$u->microLogin($u->info['id'],1)?></center></h3>
<td width="150" align="right"><input type="button" class="btn" value="Обновить" onclick="location='main.php?3_panel=1';" /> </div> <input type="button" class="btn" value="Вернуться" onclick="location='main.php';" /></td>
</table>
<center><p><b>Абилки:</b><br /><small>(Чтобы забрать предмет просто нажмите на его изображение)</small></p>
<p>
<?php
$i = 0; $seet = '';
$vnr = array(0 => 'на сегодня',1 => ' всего');
while($i < count($item_dark[$dark_panel])) {
if($item_dark[$dark_panel][$i][1]>0) {
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_dark[$dark_panel][$i][0].'" LIMIT 1'));
if(isset($itm['id'])) {
$vix = 0;
if($item_dark[$dark_panel][$i][4] == 0) {
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "dark_itm'.$itm['id'].'"',2);
$vix = $vix[0];
}else{
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "dark_itm'.$itm['id'].'" ',2);
$vix = $vix[0];
}
if($item_dark[$dark_panel][$i][1]-$vix > 0) {
if(isset($_GET['take_item_dark_panel']) && $_GET['take_item_dark_panel'] == $itm['id']) {
$nitm = \User\ItemsModel::addItem($itm['id'],$u->info['id'],$item_dark[$dark_panel][$i][5]);
if($item_dark[$dark_panel][6]>0) {
}
$u->addAction(time(),'dark_itm'.$itm['id'],'');
echo '<font color="red">Предмет &quot;<b>'.$itm['name'].'</b>&quot; перемещен к Вам в инвентарь!</font><br><br>';
}
}
$seet0 = '';
//Вывод предметов
$seet0 .= '<img '.$vix.' title="'.$itm['name'].'
(Осталось '.$vnr[$item_dark[$i][4]].': '.($item_dark[$dark_panel][$i][1]-$vix).' шт.)" src="https://'.$c['img'].'/i/items/'.$itm['img'].'"> ';
if($item_dark[$dark_panel][$i][1]-$vix > 0) {
$seet0 = '<a href="main.php?3_panel=1&take_item_dark_panel='.$itm['id'].'">'.$seet0.'</a>';
}else{
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">'.$seet0.'</span>';
}
$seet .= $seet0;
}
}
$i++;
}
}
echo $seet;
?>
</p></td></center>
</tr>
</table>

View File

@ -1,85 +0,0 @@
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
if(!defined('GAME'))
{
die();
}
if($u->info['align']==7) {
if($u->error!='')
{
echo '<font color="red"><b>'.$u->error.'</b></font><br>';
}
$vu = array(0,0,0,0,0,0,0);
//Абилки $item_neytral
$item_neytral = array(
"" => array(
//array(5050,1,0,0,0,'tr_s1=10|tr_s2=10|tr_s3=10|tr_s4=25|onlyOne=1|oneType=74|tr_align=7|noremont=1|musor=1|srok=86400|nosale=1|sudba=1',1),
array(4943,1,0,0,0,'usefromfile=1|musor=1|noremont=1|sudba=1|tr_align=7|srok=86400|nosale=1|sudba=1',1)
),
);
$vi = array(
);
?>
<link href="//img.new-combats.tech/css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/clu0b.css" />
<link rel="stylesheet" type="text/css" href="css/windows.css" />
<?php
?>
<table width="100%">
<tr>
<center><h3>Нейтральная Сила с нами, собрат <?=$u->microLogin($u->info['id'],1)?></center></h3>
<td width="150" align="right"><input type="button" class="btn" value="Обновить" onclick="location='main.php?7_panel=1';" /> </div> <input type="button" class="btn" value="Вернуться" onclick="location='main.php';" /></td>
</table>
<center><p><b>Абилки:</b><br /><small>(Чтобы забрать предмет просто нажмите на его изображение)</small></p>
<p>
<?php
$i = 0; $seet = '';
$vnr = array(0 => 'на сегодня',1 => ' всего');
while($i < count($item_neytral[$neytral_panel])) {
if($item_neytral[$neytral_panel][$i][1]>0) {
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_neytral[$neytral_panel][$i][0].'" LIMIT 1'));
if(isset($itm['id'])) {
$vix = 0;
if($item_neytral[$neytral_panel][$i][4] == 0) {
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "dark_itm'.$itm['id'].'"',2);
$vix = $vix[0];
}else{
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "dark_itm'.$itm['id'].'" ',2);
$vix = $vix[0];
}
if($item_neytral[$neytral_panel][$i][1]-$vix > 0) {
if(isset($_GET['take_item_neytral_panel']) && $_GET['take_item_neytral_panel'] == $itm['id']) {
$nitm = \User\ItemsModel::addItem($itm['id'],$u->info['id'],$item_neytral[$neytral_panel][$i][5]);
if($item_neytral[$neytral_panel][6]>0) {
}
$u->addAction(time(),'dark_itm'.$itm['id'],'');
echo '<font color="red">Предмет &quot;<b>'.$itm['name'].'</b>&quot; перемещен к Вам в инвентарь!</font><br><br>';
}
}
$seet0 = '';
//Вывод предметов
$seet0 .= '<img '.$vix.' title="'.$itm['name'].'
(Осталось '.$vnr[$item_neytral[$i][4]].': '.($item_neytral[$neytral_panel][$i][1]-$vix).' шт.)" src="https://'.$c['img'].'/i/items/'.$itm['img'].'"> ';
if($item_neytral[$neytral_panel][$i][1]-$vix > 0) {
$seet0 = '<a href="main.php?7_panel=1&take_item_neytral_panel='.$itm['id'].'">'.$seet0.'</a>';
}else{
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">'.$seet0.'</span>';
}
$seet .= $seet0;
}
}
$i++;
}
}
echo $seet;
?>
</p></td></center>
</tr>
</table>

View File

@ -0,0 +1,88 @@
<?php
/* @var User $u */
use Core\Config;
use Core\Db;
use Model\ActionModel;
use User\ItemsModel;
$bonus = [
1 => [
'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 '<span style="color: red">Предмет «<b>' . $item['name'] . '</b>» перемещен к Вам в инвентарь!</span><br><br>';
}
//Вывод предметов
$s = '<img title="' . $item['name'] . ' (Осталось ' . $vnr[$bonusItem[2]] . ': ' . ($bonusItem[1] - $bonusItemStock) . ' шт.)" src="' . Config::img() . '/i/items/' . $item['img'] . '"> ';
if ($bonusItem[1] - $bonusItemStock > 0) {
$s = '<a href="main.php?ap=1&' . $linkGET . '=' . $item['id'] . '">' . $s . '</a>';
} else {
$s = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; opacity: 0.20;">' . $s . '</span>';
}
$itemsString .= $s;
}
?>
<link href="<?= Config::img() ?>/css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/clu0b.css"/>
<link rel="stylesheet" type="text/css" href="/css/windows.css"/>
<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
<h3>Проходи, <?= $u->microLogin($u->info['id']) ?>, угощайся!</h3>
<div style="text-align: right;">
<input type="button" class="btn" value="Обновить" onclick="location='main.php?ap=1';">
<input type="button" class="btn" value="Вернуться" onclick="location='main.php';">
</div>
<div style="text-align: center;">
<div><strong>Абилки:</strong><br/><sup>(Чтобы забрать предмет просто нажмите на его изображение)</sup></div>
<div><?= $itemsString ?></div>
</div>