From d4acad33ea12d080e323468e11baaf4020457cf4 Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 18 Jan 2019 03:01:02 +0900 Subject: [PATCH] =?UTF-8?q?[b422cac734]=EA=B6=8C=ED=95=9C=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_battleCenter.php | 13 ++++++++----- hwe/b_dipcenter.php | 15 ++++++++++----- hwe/b_genList.php | 13 +++++++++---- hwe/c_dipcenter.php | 7 ++++++- hwe/c_myBossInfo.php | 10 +++++++++- hwe/func.php | 9 ++++++--- hwe/func_process_personnel.old.php | 2 +- hwe/func_template.php | 8 +++----- hwe/j_getChiefTurn.php | 18 ++++++++++++++---- hwe/j_msg_submit.php | 6 +++--- hwe/sammo/Engine/Personnel.php | 2 ++ 11 files changed, 71 insertions(+), 32 deletions(-) diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index 17191f36..34232440 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_dipcenter.php b/hwe/b_dipcenter.php index 8b10dd5d..8a9c53ec 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 c1c7389b..ce977a25 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 499d9a97..869bf113 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 2a3b5ce2..18644945 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -428,10 +428,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.old.php b/hwe/func_process_personnel.old.php index 8be9eb0f..9d6cebc6 100644 --- a/hwe/func_process_personnel.old.php +++ b/hwe/func_process_personnel.old.php @@ -581,7 +581,7 @@ function process_45(&$general) { pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 하야"); // 국적 바꾸고 등급 재야로 // 명성/공헌 N*10% 감소 - $query = "update general set resturn='SUCCESS',belong=0,betray=betray+1,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}' 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 be8ad2d8..c57041aa 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_getChiefTurn.php b/hwe/j_getChiefTurn.php index 0e724dfd..aeb0e75f 100644 --- a/hwe/j_getChiefTurn.php +++ b/hwe/j_getChiefTurn.php @@ -12,9 +12,9 @@ $gameStor = KVStorage::getStorage($db, 'game_env'); increaseRefresh("사령부", 1); -$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong FROM general WHERE owner=%i', $userID); +$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID); -[$nationLevel, $secretLimit] = $db->queryFirstList('SELECT level, secretlimit FROM nation WHERE nation = %i', $me['nation']); +$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation = %i', $me['nation']); $con = checkLimit($me['con']); if($con >= 2) { @@ -24,11 +24,21 @@ if($con >= 2) { ]); } -if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $secretLimit)) { +$permission = checkSecretPermission($me); +if($permission < 0){ Json::die([ 'result'=>false, - 'reason'=>'수뇌부가 아니거나 사관년도가 부족합니다' + 'reason'=>'국가에 소속되어있지 않습니다.' ]); + echo '국가에 소속되어있지 않습니다.'; + die(); +} +else if ($permission < 1) { + Json::die([ + 'result'=>false, + 'reason'=>'수뇌부가 아니거나 사관년도가 부족합니다.' + ]); + die(); } $date = TimeUtil::now(); 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 6991a3c0..8f847f5e 100644 --- a/hwe/sammo/Engine/Personnel.php +++ b/hwe/sammo/Engine/Personnel.php @@ -169,6 +169,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']);