[질문] 계급(레벨) 경험치바 오류 정보
[질문] 계급(레벨) 경험치바 오류본문
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=54897&sca=&sfl=&stx=&spt=&page=
위 경험치바 스킨 사용하고 있습니다.
그리고 기존에 포인트 500점 단위로 1계급씩 상승하게 했었습니다.
$level = ceil($point / 500); //반올림을 하여 레벨을 구함.
그런데 이번에 500점 단위로 상승하던것을
if($mb_point <= 200){$level = 1;}
else if($mb_point <= 600){$level = 2;}
else if($mb_point <= 1000){$level = 3;}
else if($mb_point <= 1500){$level = 4;}
else if($mb_point <= 2500){$level = 5;}
else if($mb_point <= 4000){$level = 6;}
else if($mb_point <= 6000){$level = 7;}
else if($mb_point <= 9000){$level = 8;}
else if($mb_point <= 15000){$level = 9;}
else if($mb_point <= 25000){$level = 10;}
else if($mb_point <= 40000){$level = 11;}
else if($mb_point <= 60000){$level = 12;}
else if($mb_point <= 100000){$level = 13;}
else if($mb_point <= 150000){$level = 14;}
else if($mb_point <= 200000){$level = 15;}
else if($mb_point <= 300000){$level = 16;}
else if($mb_point <= 500000){$level = 17;}
else if($mb_point <= 800000){$level = 18;}
else if($mb_point <= 1000000){$level = 19;}
else if($mb_point <= 2000000){$level = 20;}
이렇게 변경하였습니다.
그랬더니 경험치바가 이상해졌습니다. 아예 경험치 게이지가 나오지 않거나 -21% 이런식으로 나옵니다.
어떻게 변경해야 할까요? 좀 도와주세요.
//포인트 상태바
function exp_bar($mb_id,$mb_point,$option) {
global $g4;
$is_admin = is_admin($mb_id);
$point = $mb_point;
// $level = ceil($point / 500); //반올림을 하여 레벨을 구함.
if($mb_point <= 200){$level = 1;}
else if($mb_point <= 600){$level = 2;}
else if($mb_point <= 1000){$level = 3;}
else if($mb_point <= 1500){$level = 4;}
else if($mb_point <= 2500){$level = 5;}
else if($mb_point <= 4000){$level = 6;}
else if($mb_point <= 6000){$level = 7;}
else if($mb_point <= 9000){$level = 8;}
else if($mb_point <= 15000){$level = 9;}
else if($mb_point <= 25000){$level = 10;}
else if($mb_point <= 40000){$level = 11;}
else if($mb_point <= 60000){$level = 12;}
else if($mb_point <= 100000){$level = 13;}
else if($mb_point <= 150000){$level = 14;}
else if($mb_point <= 200000){$level = 15;}
else if($mb_point <= 300000){$level = 16;}
else if($mb_point <= 500000){$level = 17;}
else if($mb_point <= 800000){$level = 18;}
else if($mb_point <= 1000000){$level = 19;}
else if($mb_point <= 2000000){$level = 20;}
if($mb_id)if($level <= 1) $level = 1; // 위 반올림에서 렙1미만 회원에게 레벨1을 줌, (비회원은 0)
if ($level > 20){$level = 20;} //최대 레벨 설정
$no = sprintf("%03d", $level);
$max = $level * 500;
if(!$level){$max=500; $a_max=500; $a_min=0;}else{$a_max = (int)($max / $level);$a_min = (int)($point - (500 * ($level-1)));} //레벨이 없으면 최대값, 있으면 레벨에 맞는 최대값을 구함
if($is_admin == 'super'){$max=500; $a_max=500; $a_min=0;} //관리자는 기본세팅
$bar = (int)($a_min / $a_max * 100);
if($bar > 100) $bar = 0;
$graph = $bar."%"; //등급, 경험치바 표시
if($level == 0){$level = "0";} // 레벨값을 이용해 레벨대신 표시
if($level == 20){$level = "Top";} // 레벨값을 이용해 레벨대신 표시
if($option == 0){
echo "<table width='80' border='0' cellspacing='0' cellpadding='0'><tr><td><font style='font-size:9px;'>Level. $level</font></td><td align='right'><font style='font-size:9px;'>$graph</font></td></tr></table><table width='80' border='0' cellspacing='0' cellpadding='0' background='$g4[path]/img/exp_bar.gif'><tr height='1'><td rowspan='3' width='1'></td><td width='77'></td><td rowspan='3' width='2'></td></td></tr><tr height='6'><td><img src='$g4[path]/img/exp_in.gif' width='$graph' height='6'></td></tr><tr height='2'><td></td></tr></table>";
}
if($option == 1){
echo "<table width='100' border='0' cellspacing='0' cellpadding='0'><td width='17'><img src='$g4[path]/img/level/{$no}.jpg' title='등급 {$level} / ".number_format($mb_point)."점'></td><td width='3'></td><td width='80'><table width='80' border='0' cellspacing='0' cellpadding='0'><tr><td><font style='font-size:9px;'>Level. $level</font></td><td align='right'><font style='font-size:9px;'>$graph</font></td></tr></table><table width='80' border='0' cellspacing='0' cellpadding='0' background='$g4[path]/img/exp_bar.gif'><tr height='1'><td rowspan='3' width='1'></td><td width='77'></td><td rowspan='3' width='2'></td></td></tr><tr height='6'><td><img src='$g4[path]/img/exp_in.gif' width='$graph' height='6'></td></tr><tr height='2'><td></td></tr></table></td></tr></table>";
}
/*if($option == 0){
echo "<table width='133' border='0' cellspacing='0' cellpadding='0' align='center'><tr height='25'><td width='30'><img src='$g4[path]/img/class.gif'></td><td width='17'><img src='$g4[path]/img/lev/{$no}.jpg' title='등급 {$level} / ".number_format($mb_point)."점'></td><td align='right'><!-- <font color='#D4B3F8'>$point</font>/$max<br> --><font color='#B3D4F8'>$a_min</font>/$a_max</td></tr><tr><td colspan='2'><img src='$g4[path]/img/exp.gif'></td><td align='right'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar_133.gif'><table width='133' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='3'></td></tr><tr height='8'><td width='1'></td><td width='130'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr height='2' colspan='3'></table></td></tr></table>";
}if($option == 1){
echo "<table width='103' border='0' cellspacing='0' cellpadding='0' align='center'><tr><td width='33'><img src='$g4[path]/img/class.gif'></td><td width='35'> $level</td><td align='right' width='35'>$graph</td></tr><tr height='11'><td colspan='3' background='$g4[path]/img/exp_bar_103.gif'><table width='103' height='11' border='0' cellspacing='0' cellpadding='0'><tr height='1'><td colspan='3'></td></tr><tr height='8'><td width='1'></td><td width='100'><img src='$g4[path]/img/exp_in.gif' width='$graph' height='8'></td><td width='2'></td></tr><tr height='2'><td colspan='3'></td></tr></table></td></tr><tr><td colspan='3' height='5'></td></tr></table>";
}*/
댓글 전체

if(!$level){$max=500; $a_max=500; $a_min=0;}else{$a_max = (int)($max / $level);$a_min = (int)($point - (500 * ($level-1)));}
이 부분에서 $a_max, $a_min을 설정하는 건 500점 단위로 끊어주게 그대로 놔두셔서 그렇네요. 이 부분을 수정하셔야 할텐데, 귀찮아서 다음 분에게 패스~