diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index b7835eef..fdd0fe60 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -47,11 +47,14 @@ if ($con >= 2) { exit(); } -//재야인 경우 -$meLevel = $me['level']; -if ($meLevel == 0 || ($meLevel == 1 && $me['belong'] < $nation['secretlimit'])) { - echo "수뇌부가 아니거나 사관년도가 부족합니다."; - exit(); +$permission = checkSecretPermission($me); +if($permission < 0){ + echo '국가에 소속되어있지 않습니다.'; + die(); +} +else if ($permission < 1) { + echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다."; + die(); } //잘못된 접근 diff --git a/hwe/b_chiefcenter.php b/hwe/b_chiefcenter.php index aa1a1359..70b8f167 100644 --- a/hwe/b_chiefcenter.php +++ b/hwe/b_chiefcenter.php @@ -17,16 +17,17 @@ $query = "select no,nation,level,con,turntime,belong from general where owner='{ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$query = "select secretlimit from nation where nation='{$me['nation']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$nation = MYDB_fetch_array($result); - $con = checkLimit($me['con']); if($con >= 2) { printLimitMsg($me['turntime']); exit(); } -if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { - echo "수뇌부가 아니거나 사관년도가 부족합니다."; - exit(); +$permission = checkSecretPermission($me); +if($permission < 0){ + echo '국가에 소속되어있지 않습니다.'; + die(); +} +else if ($permission < 1) { + echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다."; + die(); } if($me['level'] >= 5) { $btn = "submit"; $btn2 = "button"; } diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php index 77a805c2..4cd4903b 100644 --- a/hwe/b_dipcenter.php +++ b/hwe/b_dipcenter.php @@ -15,7 +15,7 @@ increaseRefresh("내무부", 1); $me = $db->queryFirstRow('SELECT no, nation, level, con, turntime, belong FROM general WHERE owner=%i', $userID); -$nation = $db->queryFirstRow('SELECT secretlimit, msg, scoutmsg FROM nation WHERE nation = %i', $me['nation']); +$nation = $db->queryFirstRow('SELECT msg, scoutmsg FROM nation WHERE nation = %i', $me['nation']); $con = checkLimit($me['con']); if ($con >= 2) { @@ -23,9 +23,14 @@ if ($con >= 2) { exit(); } -if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { - echo "수뇌부가 아니거나 사관년도가 부족합니다."; - exit(); +$permission = checkSecretPermission($me); +if($permission < 0){ + echo '국가에 소속되어있지 않습니다.'; + die(); +} +else if ($permission < 1) { + echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다."; + die(); } if ($me['level'] >= 5) { @@ -45,7 +50,7 @@ if ($me['level'] >= 5) { <?=UniqueConst::$serverName?>: 내무부 diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 6166d500..604eb05e 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -23,7 +23,7 @@ $query = "select no,nation,level,con,turntime,belong from general where owner='{ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); -$query = "select level,secretlimit from nation where nation='{$me['nation']}'"; +$query = "select level from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $nation = MYDB_fetch_array($result); @@ -33,9 +33,14 @@ if ($con >= 2) { exit(); } -if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { - echo "수뇌부가 아니거나 사관년도가 부족합니다."; - exit(); +$permission = checkSecretPermission($me); +if($permission < 0){ + echo '국가에 소속되어있지 않습니다.'; + die(); +} +else if ($permission < 1) { + echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다."; + die(); } $sel = []; diff --git a/hwe/c_dipcenter.php b/hwe/c_dipcenter.php index fe00dcfe..71f3b4ce 100644 --- a/hwe/c_dipcenter.php +++ b/hwe/c_dipcenter.php @@ -21,7 +21,12 @@ $db = DB::db(); $me = $db->queryFirstRow('SELECT `no`,nation,`level` FROM general WHERE `owner`=%i', $userID); //내가 수뇌부이어야함 -if($me['level'] < 5) { +$permission = checkSecretPermission($me); +if($permission < 0){ + header('location:b_myBossInfo.php'); + exit(); +} +else if ($me['level'] < 5 && $permission != 4) { header('location:b_myBossInfo.php'); exit(); } diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index a7b7212e..bbfaa219 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -59,7 +59,7 @@ if($btn == "임명") { header('location:b_myBossInfo.php'); exit(); } - $query = "select no,name,gold,rice,nation,troop,level,npc,picture,imgsvr from general where no='$outlist'"; + $query = "select no,name,gold,rice,nation,troop,level,npc,picture,imgsvr,permission,penalty from general where no='$outlist'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); @@ -74,6 +74,13 @@ if($btn == "임명") { exit(); } + //추방할사람이 외교권자이면 불가 + $permission = checkSecretPermission($general); + if($permission == 4){ + header('location:b_myBossInfo.php'); + exit(); + } + //NPC 부대장 추방 불가 if($general['npc'] == 5){ header('location:b_myBossInfo.php'); @@ -148,6 +155,7 @@ if($btn == "추방") { else{ $db->update('general', [ 'level'=>0, + 'permission'=>'normal', 'nation'=>0, 'belong'=>0, 'makelimit'=>12, diff --git a/hwe/func.php b/hwe/func.php index 1b742452..98526f78 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -432,10 +432,13 @@ function checkSecretPermission($me){ $secretMax = 2; } - if($me['permission'] == 'auditor' || $me['permission'] == 'ambassador'){ - $secretMin = 3; + if($me['level'] == 12){ + $secretMin = 4; } - else if($me['level'] == 12){ + else if($me['permission'] == 'ambassador'){ + $secretMin = 4; + } + else if($me['permission'] == 'auditor'){ $secretMin = 3; } else if($me['level'] >= 5){ diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 9b71744b..f4ed7e0c 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -595,7 +595,7 @@ function process_45(&$general) { pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 하야"); // 국적 바꾸고 등급 재야로 // 명성/공헌 N*10% 감소 - $query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}',betray=betray+1 where no='{$general['no']}'"; + $query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,permission='normal',experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}',betray=betray+1 where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } diff --git a/hwe/func_template.php b/hwe/func_template.php index aa19fda6..239d0e65 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -138,7 +138,7 @@ function commandButton() { $db = DB::db(); $me = $db->queryFirstRow("select no,nation,level,belong from general where owner=%i", $userID); - $nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i",$me['nation'])??[ + $nation = $db->queryFirstRow("select permission,penalty,nation,level,color,secretlimit from nation where nation=%i",$me['nation'])??[ 'nation'=>0, 'level'=>0, 'secretlimit'=>99, @@ -150,15 +150,13 @@ function commandButton() { $templates = new \League\Plates\Engine(__dir__.'/templates'); $showSecret = false; - if($me['level'] >= 2){ + $permission = checkSecretPermission($me); + if($permission >= 1){ $showSecret = true; } else if($me['level']== 0){ $showSecret = false; } - else if($me['belong'] >= $nation['secretlimit']){ - $showSecret = true; - } return $templates->render('commandButton', [ 'bgColor'=>$bgColor, diff --git a/hwe/j_msg_submit.php b/hwe/j_msg_submit.php index a4b54bcb..eae1f9f0 100644 --- a/hwe/j_msg_submit.php +++ b/hwe/j_msg_submit.php @@ -49,7 +49,7 @@ $now = new \DateTime(); $unlimited = new \DateTime('9999-12-31'); $db = DB::db(); -$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` FROM general WHERE `owner`=%i', $userID); +$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID); if(!$me){ $session->logoutGame(); @@ -70,7 +70,7 @@ if($con >= 2) { } $me['icon'] = GetImageURL($me['imgsvr'], $me['picture']); - +$permission = checkSecretPermission($me); $srcNation = getNationStaticInfo($me['nation']); $src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']); @@ -99,7 +99,7 @@ if($mailbox == Message::MAILBOX_PUBLIC) { // 국가 메세지 if($mailbox >= Message::MAILBOX_NATIONAL) { - if($me['level'] < 5){ + if($me < 3){ $destNationID = $me['nation']; } else{ diff --git a/hwe/sammo/Engine/Personnel.php b/hwe/sammo/Engine/Personnel.php index d50f431e..eaa0934e 100644 --- a/hwe/sammo/Engine/Personnel.php +++ b/hwe/sammo/Engine/Personnel.php @@ -191,6 +191,8 @@ class Personnel{ $setValues['killturn'] = $this->killturn; } + $setValues['permission'] = 'normal'; + $db->update('general', $setValues, 'no=%i', $generalID); $db->update('general', $setSenderValues, 'no=%i', $this->senderID); $db->update('nation', $setOriginalNationValues, 'nation=%i', $general['nation']);