2023-03-31 18:42:06 +00:00
< ? php
2024-01-08 01:33:20 +00:00
use Core\Config ;
use Core\Db ;
use Helper\Conversion ;
use Model\Constant\Stat ;
2023-08-14 15:15:05 +00:00
if ( ! defined ( 'GAME' )) {
die ();
2022-06-06 21:30:34 +00:00
}
2024-01-08 01:33:20 +00:00
/** @var User $u */
$shadows = Db :: getRows (
" select * from obraz where
sex = ? and
level <= ? and
( login = '' or login = ? ) and
( uid = 0 or uid = ? ) and
( align = '0' or align = ? ) and
( clan = 0 or clan = ? ) order by level , img " ,
[ $u -> info [ 'sex' ], $u -> info [ 'level' ], $u -> info [ 'login' ], $u -> info [ 'id' ], $u -> info [ 'align' ], $u -> info [ 'clan' ]]
);
$statnames = new Stat ();
$statnames -> getRequirement ();
$code = PassGen :: intCode ();
$imgsrc = Config :: img ();
$str2 = '' ;
foreach ( $shadows as $shadow ) {
$tr = true ;
$str = '' ;
$data = Conversion :: dataStringToArray ( $shadow [ 'tr' ]);
if ( $shadow [ 'level' ] > 0 ) {
$str .= " \r • Уровень персонажа: { $shadow [ 'level' ] } " ;
}
if ( ! empty ( $shadow [ 'itm' ])) {
$needItems = [];
foreach ( explode ( ',' , $shadow [ 'itm' ]) as $itemId ) {
if ( $itemId < 1 ) {
continue ;
}
$item = Db :: getRow ( 'select item_id as id, name from items_users left join items_main on item_id = items_main.id where item_id = ? and inodet > 0 and inshop = 0 and uid = ?' , [ $itemId , $u -> info [ 'id' ]]);
if ( ! $item [ 'id' ]) {
$tr = false ;
}
$needItems [] = " « { $item [ 'name' ] } » " ;
}
if ( ! empty ( $needItems )) {
$str .= " \r • Предметы: " . implode ( ', ' , $needItems );
}
}
foreach ( $statnames -> sysRequirementNames as $srn ) {
if ( ! isset ( $data [ 'tr_' . $srn ])) {
continue ;
}
$str .= " \r • $statnames->requirementNames [ $srn ]: " . $data [ 'tr_' . $srn ];
if ( $data [ 'tr_' . $srn ] <= $u -> stats [ $srn ]) {
continue ;
}
$tr = false ;
}
if (( ! empty ( $shadow [ 'tr' ]) || ! empty ( $shadow [ 'itm' ])) && ! $tr ) {
continue ;
}
if ( ! empty ( $str )) {
$str = " Требуется минимальное: $str " ;
}
$str2 .= <<< HTML
< a href = " /main.php?inv=1&obr_sel= { $shadow [ 'id' ] } &rnd= $code " >
< img class = " obrsl1 " title = " $str " src = " $imgsrc /obraz/ { $shadow [ 'sex' ] } / { $shadow [ 'img' ] } " width = " 120 " height = " 220 " alt = " " >
</ a >
HTML ;
}
2022-06-06 21:30:34 +00:00
?>
2024-01-08 01:33:20 +00:00
< script >
const elem = document . getElementById ( 'se-pre-con' );
elem . parentNode . removeChild ( elem );
</ script >
2022-06-06 21:30:34 +00:00
< style >
2023-08-14 15:15:05 +00:00
. obrsl1 {
border : 1 px solid #888;
padding : 1 px ;
}
. obrsl1 : hover {
background - color : #F00;
width : 118 px ;
height : 216 px ;
margin - bottom : 2 px ;
margin - left : 1 px ;
margin - right : 1 px ;
}
2022-06-06 21:30:34 +00:00
</ style >
2024-01-08 01:33:20 +00:00
< table style = " width: 100%; border-spacing: 0; " >
< caption >< ? = User :: getLogin ( $u -> info [ 'id' ]) ?> </caption>
< tr >
< td style = " vertical-align: top; width: 1px; height: 5px; padding: 0; " ></ td >
< td style = " vertical-align: top; text-align: right; padding: 0; " >
< form method = " post " action = " /main.php?inv " >
2023-08-14 15:15:05 +00:00
< input type = " button " onClick = " location.href='/main.php?obraz'; " class = " btn " value = " Обновить " />
< input type = " submit " class = " btn " name = " edit " value = " Вернуться " />
2024-01-08 01:33:20 +00:00
</ form >
< br >
< hr >
< br >
</ td >
</ tr >
< tr >
< td style = " text-align:center; padding: 0; " colspan = " 2 " >< ? = $str2 ?> </td>
</ tr >
2022-06-06 21:30:34 +00:00
</ table >