Файл: lib/level.php
Строк: 17
<?php
$llvl1 = $user['level']-1;
$llvl = mysql_fetch_assoc(mysql_query("SELECT * FROM `l2_game` WHERE `level`='$llvl1'"));
$lvl = mysql_fetch_assoc(mysql_query("SELECT * FROM `l2_game` WHERE `level`='$user[level]'"));
$nlvl1 = $user['level']+1;
$nlvl = mysql_fetch_assoc(mysql_query("SELECT * FROM `l2_game` WHERE `level`='$nlvl1'"));
if($user['exp']>=$nlvl['need_exp'] && $user['level']==$lvl['level']){$new_lvl='yes';}
if($new_lvl=='yes'){
$hp=53;
$mp=37;
$cp=44;
if($spec=='war'){$patt=6;$pdef=5;$matt=2;$mdef=1;}else{$patt=3;$pdef=3;$matt=5;$mdef=2;}
mysql_query("UPDATE `l2_user` SET
`level`=`level`+'1',
`hpall`=`hpall`+'$hp',
`mpall`=`mpall`+'$mp',
`cpall`=`cpall`+'$cp',
`patt`=`patt`+'$patt',
`pdef`=`pdef`+'$pdef',
`matt`=`matt`+'$matt',
`mdef`=`mdef`+'$mdef' WHERE `id`='$uid'");
setsession('new_lvl', "Вы достигли $nlvl1 уровня");
}
if($user['level']>='85'){
if($user['exp']<$lvl['need_exp']){
mysql_query("UPDATE `l2_user` SET `level`=`level`-'1' WHERE `id`='$uid'");
}
}
$exp=round((($user['exp']-$llvl['need_exp'])/($nlvl['need_exp']-$llvl['need_exp']))*100, 2);
if($exp>='100'){$exp=100;}
if($exp<='0'){$exp=0;}