Файл: monst/core/pag/item.php
Строк: 72
<?
$id = (int)$id;
$item = $_item -> findOne(
[
'id' => $id
]
);
if ( !$item ) {
g('/main');
}
include $HOME . '/core/file/item.php';
if ( isset($_GET['use']) AND $item['user_id'] == $user['id'] ) {
use_item($item['id']);
g('/item'.$item['id']);
}
upd_loc('view item, <a href="/item'.$id.'"><img src="'.$item['icon'].'" alt="" class="item" style="width: 20px;"/></a>');
if ( $item['user_id'] == $user['id'] ) {
foreach ( $quest as $q ) {
if ( $q['type'] == 'item_uses' AND !$q['end'] ) {
$find = $_item -> find(
[
'user_id' => $user['id'],
'use' => 1
]
);
$count = $find -> count();
if ( $count > $q['count'] ) {
$quest_db[$q['id']]['count'] = $count;
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'quest' => $quest_db
]
]
);
}
}
}
}
if ( isset($_GET['sale']) ) {
if ( isset($_GET['1']) ) {
if ( $item['use'] == 1 ) {
use_item($item['id']);
}
$sale_cost = round($item['cost'] / 100 * 30);
$_users -> update(
[
'id' => $user['id'],
],
[
'$set' => [
'gold' => $user['gold'] + $sale_cost
]
]
);
$_item -> remove(
[
'id' => $item['id']
]
);
g('/bag?sale_ok');
} else {
?>
<div class='padding'>
<?=$lang['item.php']['sale_desc']?><br/>
</div>
<a href='/item<?=$id?>?sale&1'><div class='bt_black'><?=$lang['item.php']['confirm']?></div></a>
<a href='/item<?=$id?>'><div class='bt_black'><?=$lang['item.php']['cancel']?></div></a>
<br/><br/>
<?
}
}
?>
<br/>
<div style='text-align: center;'>
<div class='padding'>
<div class='item_fl2oat'>
<img src='<?=$item['icon']?>' alt='' width='150'/>
<br/>
<span style='font-size: 11px;'><?=$item['name']?></span>
</div>
<div style='clear: both;'></div>
<br/>
</div>
</div>
<?
if ( $item['user_id'] == $user['id'] ) {
if ( !$item['use'] ) {
?>
<a href='/item<?=$item['id']?>?use'>
<div class='bt_black' style='text-align: center; color: #999;'>
<?=$lang['item.php']['use']?>
</div>
</a>
<?
} else {
?>
<a href='/item<?=$item['id']?>?use'>
<div class='bt_black' style='text-align: center; color: #999;'>
<?=$lang['item.php']['unuse']?>
</div>
</a>
<?
}
}
?>
<div class='padding'>
<span style='color: #756861; font-size: 30px;'><?=$item['name']?></span><br/>
<?
if ( !empty($item['desc']) ) {
?>
<?=$item['desc']?><br/>
<br/>
<?
}
?>
<?=$ITEM_TYPES[$item['type']]?><br/>
<br/>
<img src='/core/i/user/hp.png?3' alt='' width='15'/><span class='hp_color'><?=num($item['hp'])?></span>
<img src='/core/i/user/st.png?2' alt='' width='15'/><span class='st_color'><?=num($item['st'])?></span>
<img src='/core/i/user/armor.png?2' alt='' width='15'/><span class='armor_color'><?=num($item['armor'])?></span>
<br/>
<br/>
<div style='float: left;'>
<div style='text-align: center;'>
<a href='/id<?=$item['user_id']?>'>
<img src='<?=av($item['user_id'])?>' alt='' width='50' class='av'/><br/>
<?=Name($item['user_id'])?>
</a>
</div>
</div>
<div style='clear: both;'></div>
</div>
<?
if ( $item['user_id'] == $user['id'] ) {
$sale_cost = round($item['cost'] / 100 * 30);
?>
<a href='/item<?=$id?>?sale'><div class='bt_black'><?=$lang['item.php']['sale']?> <img src='<?=$gold_icon?>' alt='' width='20'/><span class='gold_color'><?=$sale_cost?> (30%)</span></div></a>
<?
}
?>
<div style='text-align: center;'>
<a href='/bag'>
<div style='display: inline-block;'>
<img src='/core/i/user/bag.png?1' alt='' width='50'/><br/>
<span class='micon_text'><?=$lang['item.php']['bag']?></span>
</div>
</a>
</div>
<?