Размер файла: 8.91Kb
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
require_once './element_function/element_function_item.php';
function generation_money($level) {
return array('gold' => ($level * 100), 'irridyi' => ($level * 10));
}
$wear_item = users_wear_item($user['lost_id']);
$array_type = array('helmet', 'cape','armor', 'zone', 'feet', 'hands', 'shield', 'weapon', 'shoes');
$max_level_comparison = 20;
if ($go == 'upgrade' AND $id) {
$item = cache_item($id);
if ($item['lost_user'] == $user['lost_id'] AND $item['lost_bag'] == 1 AND $item['lost_comparison'] < $max_level_comparison) {
$quality = quality_item_name($item['lost_quality']);
$shoot_item = users_shoot_item($user['lost_id']);
$money = generation_money($item['lost_comparison'] + 1);
//$user['lost_resourse_irridyi'] = 10000;
$title = 'Сравнения';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
$get_comparison = (isset($_GET['comparison']) AND is_numeric($_GET['comparison'])) ? (int)$_GET['comparison'] : false;
if ($get_comparison) {
//$item_id['lost_mesto'] == $item['lost_mesto'] AND $item_id['lost_quality'] == $item['lost_quality']
$qquery = mysql_fetch_array(mysql_query("SELECT `lost_id` FROM `element_item` WHERE `lost_id` = '$get_comparison' AND
`lost_bag` = '0' AND
`lost_mesto` = '$item[lost_mesto]' AND
`lost_quality` = '$item[lost_quality]' AND
`lost_user` = '$user[lost_id]' LIMIT 1"));
if ($qquery) {
if (isset($_GET['ok'])) {
if ($user['lost_money_gold'] < $money['gold']) $error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.nmb_2($money['gold'] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment"><span class="ttl">Купить золото</span></a>';
if ($user['lost_resourse_irridyi'] < $money['irridyi']) $error = '<span class="red">Вам не хватает <img src="/images/icons/irridyi.png">'.nmb_2($money['irridyi'] - $user['lost_resourse_irridyi']).' ирридия</span>';
if (!isset($error)) {
$params = item_generation_params($item['lost_strlen'], $item['lost_heatpoints'], $item['lost_protection'], $item['lost_comparison']);
$user['lost_params_strlen'] = $user['lost_params_strlen'] - $params['strlen'];
$user['lost_params_heatpoints'] = $user['lost_params_heatpoints'] - $params['heatpoints'];
$user['lost_params_protection'] = $user['lost_params_protection'] - $params['protection'];
$item['lost_comparison'] = $item['lost_comparison'] + 1;
$params_new = item_generation_params($item['lost_strlen'], $item['lost_heatpoints'], $item['lost_protection'], $item['lost_comparison']);
$user = SetParams($user, $params_new['strlen'], $params_new['heatpoints'], $params_new['protection'], true);
// Обновляем данные
mysql_query("UPDATE `element_item` SET `lost_comparison` = '$item[lost_comparison]' WHERE `lost_id` = '$id' LIMIT 1");
mysql_query("DELETE FROM `element_item` WHERE `lost_id` = '$get_comparison' LIMIT 1");
unset($shoot_item[$get_comparison]);
update_money_exp($user, 0, 0, -$money['irridyi'], -$money['gold']);
writecache('element_shoot_item_user_id'.$user['lost_id'], $shoot_item);
header('Location: /item/comparison');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else {
echo '<div class="nfl p5 cntr mb5 small mt5 mlra">';
echo '<span class="moderator">Вы уверены что хотите сравнить данную вещь за <img src="/images/icons/gold.png">'.$money['gold'].' золота и <img src="/images/icons/irridyi.png">'.$money['irridyi'].' ирридия?</span>';
echo '<div class="mt5 mb5">
<a class="button w40 mr2" href="/item/comparison?go=upgrade&id='.$id.'&comparison='.$qquery['lost_id'].'&ok">Да</a>
<a class="button w40 ml2" href="/item/comparison?go=upgrade&id='.$id.'">Нет</a>
</div>';
echo '</div>';
}
}
}
echo '<div class="nfl p5 mb5 small mt5 mlra">';
echo '<div class="cntr mb5 small"><a class="yellow1" href="/gain">« Усиления</a></div>';
echo '<div class="mb5 cntr moderator">Сравнивайте свои вещи, и улучшайте их параметры! Каждое сравнение увеличает параметры вещи на +5%. Максимальный уровень сравнения 20</div>';
echo '<div class="hr p5 mb10"></div>';
echo '<div class="mb2 cntr mlra">';
echo '<table class="mlra"><td><img src="'.$item['lost_avatar'].'"></td>';
echo '<td class="small left" valign="top">';
echo '<span class="ml2">'.$quality['image'].' <a class="yellow1 small" href="/item?id='.$item['lost_id'].'">'.$item['lost_name'].'</a></span><br/>';
echo '<span class="ml2 moderator">Сравнение: '.$item['lost_comparison'].' уровень</span><br/>';
echo '<span class="ml2 ccc">'.name_item_mesto($item['lost_mesto']).', '.$quality['name'].'</span>';
echo '</td></table>';
echo '</div>';
echo '<div class="hr p5 mb10"></div>';
echo '<div class="mb5 cntr moderator">Выберите вещь на запчасти:</div>';
$count_shoot = 0;
foreach($shoot_item as $id_item) {
$item_id = cache_item($id_item);
if ($item_id['lost_mesto'] == $item['lost_mesto'] AND $item_id['lost_quality'] == $item['lost_quality']) {
$count_shoot++;
$item_new = ($item_id['lost_new'] == 0) ? 'Новый' : '<span class="ccc">Личный</span>';
$bla = item_params_type($item_id['lost_mesto']);
$enchants = item_enchants_quality($item_id['lost_enchants'], $bla[1]);
echo '<div class="mb2 cntr mb5 mlra">';
echo '<table class="mlra"><td><img src="'.$item_id['lost_avatar'].'"></td>';
echo '<td class="small left" valign="top">';
echo '<span class="ml2">'.$quality['image'].' <a class="yellow1 small" href="/item?id='.$item_id['lost_id'].'">'.$item_id['lost_name'].'</a> '.(($enchants) ? $enchants['image'] : '').'</span><br/>';
echo '<span class="ml2 moderator">'.$item_new.''.(($enchants) ? ', +'.$enchants['params'].' <span class="white">'.$enchants['name'].'</span>' : '').', '.$item_id['lost_comparison'].' ур.</span><br/>';
echo '</td></table>';
echo '<a class="button w60" href="/item/comparison?go=upgrade&id='.$id.'&comparison='.$id_item.'">Сравнить за <img src="/images/icons/gold.png">'.$money['gold'].' и <img src="/images/icons/irridyi.png">'.$money['irridyi'].'</a>';
echo '</div>';
}
}
if ($count_shoot == 0) {
echo '<div class="mb5 cntr red">В вашем рюкзаке не удалось найти похожую вещь: '.name_item_mesto($item['lost_mesto']).', '.$quality['name'].'</div>';
}
echo '</div>';
require_once './element_include/element_foot_user_true.php';
exit;
}
}
$title = 'Сравнения';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 small mt5 mlra">';
echo '<div class="cntr mb5 small"><a class="yellow1" href="/gain">« Усиления</a></div>';
echo '<div class="mb5 cntr moderator">Сравнивайте свои вещи, и улучшайте их параметры! Каждое сравнение увеличает параметры вещи на +5%. Максимальный уровень сравнения 20</div>';
echo '<div class="hr p5 mb10"></div>';
foreach($array_type as $key => $value) {
if (isset($wear_item[$value])) {
$item = cache_item($wear_item[$value]);
$quality = quality_item_name($item['lost_quality']);
echo '<div class="mb2">
<table>
<td>
<img src="'.$item['lost_avatar'].'">
</td>
<td class="small" valign="top">
<span class="ml2">'.$quality['image'].' <a class="yellow1 small" href="/item?id='.$item['lost_id'].'">'.$item['lost_name'].'</a></span><br/>
<span class="ml2 white"> Сравнения: '.$item['lost_comparison'].' уровень</span><br/>
<span class="ml2"><a class="moderator" href="/item/comparison?go=upgrade&id='.$item['lost_id'].'">[Улучшить]</a></span>
</td>
</table>
</div>';
} else {
echo '<div class="mb2">
<table>
<td>
<img src="/images/icons/empty.png">
</td>
<td>
<span class="small white">'.name_item_mesto($value).'</span>
</td>
</table>
</div>';
}
}
echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>