<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
//$user['lost_params_training'] = '0:0:0';
//writecache('element_users_id_'.$user['lost_id'],$user);
if ($go == 'training') {
function cena_masters($count) {
$array = array( 100, 124, 148, 185, array(10), 250, 291, 339, 392, array(30),
500, 573, 661, 742, array(50), 800, 891, 994, 1123, array(70),
1300, 1452, 1613, 1794, array(100), 2100, 2324, 2487, 2750, array(150),
3000, 3354, 3719, 4123, array(200), 4500, 4987, 5523, 6246, array(250),
6500, 7345, 8134, 8934, array(300), 10000, 11032, 12134, 13345, array(350),
15000, 16405, 17943, 19943, array(400));
$return = $array[$count];
if (is_array($return)) { $q = 'gold'; $return = $array[$count][0]; } else $q = 'cristall';
return array($q, $return, count($array));
}
$training = explode(':', $user['lost_params_training']);
$title = 'Мастерство';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
if (isset($_GET['up_strlen'])) {
$cena_str = cena_masters($training[0]);
if ($training[0] < $cena_str[2]) {
if ($cena_str[0] == 'cristall') {
if ($user['lost_resourse_cristalls'] < $cena_str[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/cristall.png"> '.($cena_str[1] - $user['lost_resourse_cristalls']).' кристаллов</span><br/><a class="button w40 mt5 mb5" href="/gold"><span class="ttl">Купить кристаллы</span></a>';
if (!isset($error)) {
$training[0] = $training[0] + 1;
$user = SetParams($user, 10, 0, 0, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, -$cena_str[1], 0, 0);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else if ($cena_str[0] == 'gold') {
if ($user['lost_money_gold'] < $cena_str[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.($cena_str[1] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment"><span class="ttl">Купить золото</span></a>';
if (!isset($error)) {
$training[0] = $training[0] + 1;
$user = SetParams($user, 10, 0, 0, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, 0, 0, -$cena_str[1]);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
}
}
}
if (isset($_GET['up_heatpoints'])) {
$cena_hp = cena_masters($training[1]);
if ($training[1] < $cena_hp[2]) {
if ($cena_hp[0] == 'cristall') {
if ($user['lost_resourse_cristalls'] < $cena_hp[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/cristall.png"> '.($cena_hp[1] - $user['lost_resourse_cristalls']).' кристаллов</span><br/><a class="button w40 mt5 mb5" href="/gold"><span class="ttl">Купить кристаллы</span></a>';
if (!isset($error)) {
$training[1] = $training[1] + 1;
$user = SetParams($user, 0, 10, 0, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, -$cena_hp[1], 0, 0);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else if ($cena_hp[0] == 'gold') {
if ($user['lost_money_gold'] < $cena_hp[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.($cena_hp[1] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment"><span class="ttl">Купить золото</span></a>';
if (!isset($error)) {
$training[1] = $training[1] + 1;
$user = SetParams($user, 0, 10, 0, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, 0, 0, -$cena_hp[1]);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
}
}
}
if (isset($_GET['up_protection'])) {
$cena_pr = cena_masters($training[2]);
if ($training[2] < $cena_pr[2]) {
if ($cena_pr[0] == 'cristall') {
if ($user['lost_resourse_cristalls'] < $cena_pr[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/cristall.png"> '.($cena_pr[1] - $user['lost_resourse_cristalls']).' кристаллов</span><br/><a class="button w40 mt5 mb5" href="/gold"><span class="ttl">Купить кристаллы</span></a>';
if (!isset($error)) {
$training[2] = $training[2] + 1;
$user = SetParams($user, 0, 0, 10, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, -$cena_pr[1], 0, 0);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
} else if ($cena_pr[0] == 'gold') {
if ($user['lost_money_gold'] < $cena_pr[1])
$error = '<span class="red">Вам не хватает <img src="/images/icons/gold.png">'.($cena_pr[1] - $user['lost_money_gold']).' золота</span><br/><a class="button w40 mt5 mb5" href="/payment"><span class="ttl">Купить золото</span></a>';
if (!isset($error)) {
$training[2] = $training[2] + 1;
$user = SetParams($user, 0, 0, 10, true);
$user['lost_params_training'] = implode(':',$training);
update_money_exp($user, 0, 0, 0, -$cena_pr[1]);
header('Location: /gain?go=training');
exit;
} else echo '<div class="nfl p5 mb5 cntr small mlra">'.$error.'</div>';
}
}
}
echo '<div class="nfl p5 mb5 mt5 mlra small cntr">';
echo '<div class="small"><a class="yellow1" href="/gain">« Усиления</a></div>';
echo '<div class="mt5 mb5 cntr small mlra">';
$cena_str = cena_masters($training[0]);
echo '<div class="mt5 mb5">';
echo '<div class="moderator mb5 bold"><img src="/images/icons/strlen.png"> Сила: '.(($training[0] > 0) ? (10 * $training[0]) : 0 ).'</div>';
echo '<span class="bl mb5 prg-bar"><span class="bl fl prg-green" style="width:'.(int)(($training[0] / $cena_str[2]) * 100).'%"> </span></span>';
echo '<div class="white mt5">Чем больше силы, тем больше урона Вы нанесёте в бою!</div>';
echo ($training[0] < $cena_str[2]) ? '<a class="button w70 mt5" href="/gain?go=training&up_strlen"><span class="ttl">Улучшить за <img src="/images/icons/'.$cena_str[0].'.png">'.$cena_str[1].'</span></a>' : '';
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
$cena_hp = cena_masters($training[1]);
echo '<div class="mt5 mb5">';
echo '<div class="moderator mb5 bold"><img src="/images/icons/heatpoints.png"> Здоровье: '.(($training[1] > 0) ? (10 * $training[1]) : 0 ).'</div>';
echo '<span class="bl mb5 prg-bar"><span class="bl fl prg-green" style="width:'.(int)(($training[1] / $cena_hp[2]) * 100).'%"> </span></span>';
echo '<div class="white mt5">Чем больше здоровья, тем труднее убить Вас в бою!</div>';
echo ($training[1] < $cena_hp[2]) ? '<a class="button w70 mt5" href="/gain?go=training&up_heatpoints"><span class="ttl">Улучшить за <img src="/images/icons/'.$cena_hp[0].'.png">'.$cena_hp[1].'</span></a>' : '';
echo '</div>';
echo '<div class="hr mt5 mb5"></div>';
$cena_pr = cena_masters($training[2]);
echo '<div class="mt5 mb5">';
echo '<div class="moderator mb5 bold"><img src="/images/icons/protection.png"> Защита: '.(($training[2] > 0) ? (10 * $training[2]) : 0 ).'</div>';
echo '<span class="bl mb5 prg-bar"><span class="bl fl prg-green" style="width:'.(int)(($training[2] / $cena_pr[2]) * 100).'%"> </span></span>';
echo '<div class="white mt5">Защита поглащает урон противника!</div>';
echo ($training[2] < $cena_pr[2]) ? '<a class="button w70 mt5" href="/gain?go=training&up_protection"><span class="ttl">Улучшить за <img src="/images/icons/'.$cena_pr[0].'.png">'.$cena_pr[1].'</span></a>' : '';
echo '</div>';
echo '<div class="hr mt5 mb55"></div>';
echo '</div>';
echo '<div class="yellow1">Мастер поможет Вам прокачать Ваши параметры.<br/> Одно улучшение: +10 к параметрам</div>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
} else {
$title = 'Усиления';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
echo '<div class="nfl p5 mb5 mt5 mlra">';
echo '<div class="ml5 mr5 cntr">
<a class="bl p5 block odd" href="/abilities?id='.$user['lost_id'].'">
<span class="yellow1 small">Умения</span><br/>
<span class="small white">Прокачивай свои умения и становись сильнее в бою!</span>
</a>
</div>';
echo '<div class="ml5 mr5 cntr">
<a class="bl p5 block" href="/item/enchants">
<span class="yellow1 small">Чародей</span><br/>
<span class="small white">Чародей поможет Вам установить чары на ваши вещи</span>
</a>
</div>';
echo '<div class="ml5 mr5 cntr">
<a class="bl p5 block odd" href="/item/comparison">
<span class="yellow1 small">Сравнения</span><br/>
<span class="small white">Сравнивай свои вещи и увеличивай их параметры!</span>
</a>
</div>';
echo '<div class="ml5 mr5 cntr">
<a class="bl p5 block" href="/gain?go=training">
<span class="yellow1 small">Мастер</span><br/>
<span class="small white">Мастер поможет Вам прокачать параметры!</span>
</a>
</div>';
//$bla = (int)((102 / 100) * 450);
//echo $bla.' | ';
//echo (int)(($bla / 100) * 5);
//echo ' | '.(22 * 0.05);
echo '</div>';
require_once './element_include/element_foot_user_true.php';
}
?>