Файл: element_item_enchants.php
Строк: 230
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
require_once './element_function/element_function_item.php';
$wear_item = users_wear_item($user['lost_id']);
$array_type = array('helmet', 'cape','armor', 'zone', 'feet', 'hands', 'shield', 'weapon', 'shoes');
if ($go == 'upgrade' AND $id) {
$item = cache_item($id);
// Если моя вещь, и она одета
if ($item['lost_user'] == $user['lost_id'] AND $item['lost_bag'] == 1) {
$title = 'Чародей';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
$enchants_id = (isset($_GET['enchants']) AND is_numeric($_GET['enchants'])) ? (int)$_GET['enchants'] : false;
$quality = quality_item_name($item['lost_quality']);
$n_name = $array_1[$item['lost_mesto']];
$bla = item_params_type($item['lost_mesto']);
$enchants = item_enchants_quality($item['lost_enchants'], $bla[1]);
if ($enchants_id) {
$myrrow = mysql_fetch_array(mysql_query("SELECT * FROM `element_enchants` WHERE `lost_id` = '$enchants_id' LIMIT 1"));
if ($myrrow) {
$quality = quality_item_name($myrrow['lost_quality']);
if (isset($_GET['ok'])) {
if ($user['lost_money_gold'] < $myrrow['lost_gold']) $error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.nmb_2($myrrow['lost_gold'] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment"><span class="ttl">Купить золото</span></a>';
if ($item['lost_enchants'] == $myrrow['lost_quality']) $error = '<span class="red">У Вас уже установлен этот тип чар</span>';
if (!isset($error)) {
if ($item['lost_enchants'] >= 0) {
$it_enn = item_enchants_quality($item['lost_enchants'], '');
$user[$n_name[0]] = $user[$n_name[0]] - $it_enn['params'];
$user['lost_params_summa'] = $user['lost_params_summa'] - $it_enn['params'];
}
$item['lost_enchants'] = $myrrow['lost_quality'];
$it_en = item_enchants_quality($myrrow['lost_quality'], '');
if ($n_name[0] == 'lost_params_strlen') $user = SetParams($user, $it_en['params'], 0, 0, true);
if ($n_name[0] == 'lost_params_heatpoints') $user = SetParams($user, 0, $it_en['params'], 0, true);
if ($n_name[0] == 'lost_params_protection') $user = SetParams($user, 0, 0, $it_en['params'], true);
update_money_exp($user, 0, 0, 0, -$myrrow['lost_gold']);
mysql_query("UPDATE `element_item` SET `lost_enchants` = '$myrrow[lost_quality]' WHERE `lost_id` = '$id' LIMIT 1");
header('Location: /item/enchants');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else {
echo '<div class="nfl p5 mb5 cntr small yellow1 mt5 mlra">';
echo 'Вы действительно хотите установить '.$quality['image'].' <span class="moderator">'.$quality_name[$myrrow['lost_quality']].' зачарование +'.$myrrow['lost_params'].'</span> '.$n_name[1].' за <img src="/images/icons/gold.png"><span class="moderator">'.nmb_2($myrrow['lost_gold']).'</span>?';
echo '<div class="mt5">';
echo '<a class="button w40 mr2" href="/item/enchants?go=upgrade&id='.$id.'&enchants='.$enchants_id.'&ok">Да</a> ';
echo '<a class="button w40 ml2" href="/item/enchants?go=upgrade&id='.$id.'">Нет</a>';
echo '</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">При покупле любого зачарования Вы можете получить подарок - более качественные чары за те же деньги!</div>';
echo '<div class="hr mt5 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 ($enchants) ? '<span class="ml2 moderator">'.$enchants['image'].' +'.$enchants['params'].' '.$enchants['name'].'</span>' : '';
echo '</td></table>';
echo '</div>';
$query = mysql_query("SELECT * FROM `element_enchants`");
while ($myrrow = mysql_fetch_array($query)) {
$quality = quality_item_name($myrrow['lost_quality']);
if ($item['lost_enchants'] != $myrrow['lost_quality']) {
echo '<div class="mb2 white cntr">';
echo '<div class="hr w70 mlra p5 mb5"></div>';
echo '<div class="">';
echo $quality['image'].'<span class=""> <span class="moderator"> '.$quality_name[$myrrow['lost_quality']].' качество<br/>+'.$myrrow['lost_params'].'</span> '.$n_name[1].'</span><br/>';
echo '<a class="button w70 mt5" href="/item/enchants?go=upgrade&id='.$id.'&enchants='.$myrrow['lost_id'].'">Установить за <img src="/images/icons/gold.png"><span class="moderator">'.nmb_2($myrrow['lost_gold']).'</span></a>';
echo '</div>';
echo '</div>';
}
}
echo '<div class="mb5"></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">При покупле любого зачарования Вы можете получить подарок - более качественные чары за те же деньги!</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']);
$enchants = item_enchants_quality($item['lost_enchants'], $array_1[$item['lost_mesto']][1]);
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> '.(($enchants) ? $enchants['image'] : '').'</span><br/>
<span class="ml2 white"> '.(($enchants) ? '<span class="moderator">+'.$enchants['params'].'</span> '.$enchants['name'].'' : 'Не установлено').'</span><br/>
<span class="ml2"><a class="moderator" href="/item/enchants?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';
?>