Файл: monst/core/pag/param.php
Строк: 119
<?
upd_loc('up parameters');
?>
<div class='op_top_im'>
<img src='/core/i/pic/training.jpg' alt='' class='title_img' /><br/>
</div>
<div class='padding'>
<div style='text-align: center; co2lor: <?=$user['theme_color']?>; border-top: 1px solid #999;'>
<?=$lang['param.php']['desc']?><br/>
</div>
</div>
<br/>
<?
$cost = [];
$cost_type = [];
$cost_text = [];
$max_level = 100;
// q
foreach ( $quest as $q ) {
if ( $q['type'] == 'param' ) {
$e = $user['param_'.$q['uniq_id'].'_level'];
if ( $quest_db[$q['id']]['count'] != $e ) {
$quest_db[$q['id']]['count'] = $e;
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'quest' => $quest_db,
]
]
);
}
}
}
//$_users -> update(
// [
// 'id' => $user['id']
// ],
//
// [
// '$set' => [
// 'gold' => 1000,
// 'silver' => 10000,
// 'param_st_level' => 0,
// ]
// ]
//);
$array = ['st', 'hp', 'armor'];
foreach ( $array as $stat ) {
$cost[$stat] = ( $user['param_'.$stat.'_level'] + 1 ) * 200 * ( ceil(($user['param_'.$stat.'_level'] + 1) / 10) );
$cost_type[$stat] = 'silver';
if ( ($user['param_'.$stat.'_level'] + 1) % 5 == 0 ) {
$cost[$stat] = floor(( ( $user['param_'.$stat.'_level'] + 1 ) / 5) * 25 ) ;
$cost_type[$stat] = 'gold';
}
if ( $cost_type[$stat] == 'silver' ) {
$cost_text[$stat] = '<img src="'.$silver_icon.'" alt="" width="15"/><span class="silver_color">' . ($cost[$stat]) . '</span>';
} elseif ( $cost_type[$stat] == 'gold' ) {
$cost_text[$stat] = '<img src="'.$gold_icon.'" alt="" width="15"/><span class="gold_color">' . num($cost[$stat]) . '</span>';
}
}
if ( isset($_GET['upgrade']) ) {
$upgrade = $_GET['upgrade'];
if ( in_array($upgrade, ['st', 'hp', 'armor']) ) {
// quest
foreach ( $quest as $q ) {
if ( $q['type'] == 'param' ) {
if ( !$q['uniq_id'] ) {
$quest_db[$q['id']]['count'] += 1;
} else {
if ( $q['uniq_id'] == $upgrade ) {
$quest_db[$q['id']]['count'] += 1;
}
}
}
}
//
if ( !isset($_GET['gold']) ) {
if ( $user[$cost_type[$upgrade]] >= $cost[$upgrade] ) {
if ( $upgrade != 'hp' ) {
$upd = $_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
$upgrade => $user[$upgrade] + 3,
'param_'.$upgrade.'_level' => $user['param_'.$upgrade.'_level'] + 1,
$cost_type[$upgrade] => $user[$cost_type[$upgrade]] - $cost[$upgrade],
'quest' => $quest_db,
]
]
);
} else {
$upd = $_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
$upgrade => $user[$upgrade] + 3,
'hpf' => $user['hpf'] + 3,
'param_'.$upgrade.'_level' => $user['param_'.$upgrade.'_level'] + 1,
$cost_type[$upgrade] => $user[$cost_type[$upgrade]] - $cost[$upgrade],
'quest' => $quest_db,
]
]
);
}
g('/param?stat_up='.$upgrade);
} else {
$gold_cost = round($cost[$upgrade] / 100);
if ( $cost_type[$upgrade] == 'gold' ) {
?>
<div class='error_box'>
<?=$lang['param.php']['no_gold']?><br/>
<div style='text-align: center;'>
<a href='/gold'><?=$lang['param.php']['buy_gold']?> <img src="<?=$gold_icon?>" alt="" width="15"/></a>
</div>
</div>
<br/>
<?
} else {
?>
<div class='error_box'>
<?=$lang['param.php']['no_silver']?><br/>
<div style='text-align: center;'>
<a href='/param?upgrade=<?=$upgrade?>&gold'><?=$lang['param.php']['training']?> <img src="<?=$gold_icon?>" alt="" width="15"/><span class="gold_color"><?=$gold_cost?></span></a>
</div>
</div>
<br/>
<?
}
}
} else {
if ( $cost_type[$upgrade] == 'gold' ) {
g('/main');
}
$gold_cost = round($cost[$upgrade] / 100);
if ( $user['gold'] >= $gold_cost ) {
if ( $upgrade != 'hp' ) {
$upd = $_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
$upgrade => $user[$upgrade] + 3,
'param_'.$upgrade.'_level' => $user['param_'.$upgrade.'_level'] + 1,
'gold' => $user['gold'] - $gold_cost,
'quest' => $quest_db,
]
]
);
} else {
$upd = $_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
$upgrade => $user[$upgrade] + 3,
'hpf' => $user['hpf'] + 3,
'param_'.$upgrade.'_level' => $user['param_'.$upgrade.'_level'] + 1,
'gold' => $user['gold'] - $gold_cost,
'quest' => $quest_db,
]
]
);
}
g('/param?stat_up='.$upgrade);
} else {
?>
<div class='error_box'>
<?=$lang['param.php']['no_gold']?><br/>
<div style='text-align: center;'>
<a href='/gold'><?=$lang['param.php']['buy_gold']?> <img src="<?=$gold_icon?>" alt="" width="15"/></a>
</div>
</div>
<br/>
<?
}
}
}
}
?>
<div style='background: #000; padding: 10px;'>
<img src='/core/i/user/st.png?3' alt='' width='50' style='float: left; margin-right: 5px;'/>
<span style='color: #756861;'><?=$lang['param.php']['st']?></span> <span style='font-size: 20px; <? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'st' ) print 'color: mediumseagreen;'; ?>'>+<?=( $user['param_st_level'] * 3 )?></span>
<? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'st') print ' <span style="color: yellowgreen; font-size: 20px;">↑</span>'; ?>
<br/>
<?=$lang['param.php']['level']?> <?=$user['param_st_level']?> <?=$lang['param.php']['of']?> <?=$max_level?><br/>
</div>
<div style='clear: both;'></div>
<?
if ( $user['param_st_level'] < $max_level ) {
?>
<a href='/param?upgrade=st'><div class='bt_gray'><?=$lang['param.php']['training']?> <?=$cost_text['st']?></div></a>
<?
}
?>
<br/>
<div style='background: #000; padding: 10px;'>
<img src='/core/i/user/hp.png?3' alt='' width='50' style='float: left;margin-right: 5px;'/>
<span style='color: #756861;'><?=$lang['param.php']['hp']?></span> <span style='font-size: 20px; <? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'hp' ) print 'color: mediumseagreen;'; ?>'>+<?=( $user['param_hp_level'] * 3 )?></span>
<? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'hp') print ' <span style="color: yellowgreen; font-size: 20px;">↑</span>'; ?>
<br/>
<?=$lang['param.php']['level']?> <?=$user['param_hp_level']?> <?=$lang['param.php']['of']?> <?=$max_level?>
</div>
<div style='clear: both;'></div>
<?
if ( $user['param_hp_level'] < $max_level ) {
?>
<a href='/param?upgrade=hp'><div class='bt_gray'><?=$lang['param.php']['training']?> <?=$cost_text['hp']?></div></a>
<?
}
?>
<br/>
<div style='background: #000; padding: 10px;'>
<img src='/core/i/user/armor.png?3' alt='' width='50' style='float: left;margin-right: 5px;'/>
<span style='color: #756861;'><?=$lang['param.php']['armor']?></span> <span style='font-size: 20px; <? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'armor' ) print 'color: mediumseagreen;'; ?>'>+<?=( $user['param_armor_level'] * 3 )?></span>
<? if ( isset($_GET['stat_up']) AND $_GET['stat_up'] == 'armor') print ' <span style="color: yellowgreen; font-size: 20px;">↑</span>'; ?>
<br/>
<?=$lang['param.php']['level']?> <?=$user['param_armor_level']?> <?=$lang['param.php']['of']?> <?=$max_level?>
</div>
<div style='clear: both;'></div>
<?
if ( $user['param_armor_level'] < $max_level ) {
?>
<a href='/param?upgrade=armor'><div class='bt_gray'><?=$lang['param.php']['training']?> <?=$cost_text['armor']?></div></a>
<?
}
?>