diff --git a/hwe/a_vote.php b/hwe/a_vote.php
index 3b232d31..d2cc36c3 100644
--- a/hwe/a_vote.php
+++ b/hwe/a_vote.php
@@ -328,7 +328,7 @@ if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
continue;
}
- $per = round($nationVote[$nation['nation']][$k]??0 / $memCount * 100, 1);
+ $per = round(($nationVote[$nation['nation']][$k]??0) / $memCount * 100, 1);
if($i == $voteTypeCount-1){
$per = 100-$totalPer;
diff --git a/hwe/func.php b/hwe/func.php
index 58bf2ba8..3d1babb5 100644
--- a/hwe/func.php
+++ b/hwe/func.php
@@ -1,4 +1,5 @@
0,
- 'name'=>'재야',
- 'color'=>'#000000',
- 'type'=>GameConst::$neutralNationType,
- 'level'=>0,
- 'capital'=>0,
- 'gold'=>0,
- 'rice'=>2000,
- 'tech'=>0,
- 'gennum'=>1,
- 'power'=>1
+ 'nation' => 0,
+ 'name' => '재야',
+ 'color' => '#000000',
+ 'type' => GameConst::$neutralNationType,
+ 'level' => 0,
+ 'capital' => 0,
+ 'gold' => 0,
+ 'rice' => 2000,
+ 'tech' => 0,
+ 'gennum' => 1,
+ 'power' => 1
];
}
- if($nationList === null){
+ if ($nationList === null) {
$nationAll = DB::db()->query("select nation, name, color, type, level, capital, gennum, power from nation");
$nationList = Util::convertArrayToDict($nationAll, "nation");
}
- if($nationID === -1){
+ if ($nationID === -1) {
return $nationList;
}
- if(isset($nationList[$nationID])){
+ if (isset($nationList[$nationID])) {
return $nationList[$nationID];
}
return null;
@@ -88,8 +89,9 @@ function getAllNationStaticInfo()
return getNationStaticInfo(-1);
}
-function GetImageURL($imgsvr, $filepath='') {
- if($imgsvr == 0) {
+function GetImageURL($imgsvr, $filepath = '')
+{
+ if ($imgsvr == 0) {
return ServConfig::getSharedIconPath($filepath);
} else {
return AppConf::getUserIconPathWeb($filepath);
@@ -100,35 +102,38 @@ function GetImageURL($imgsvr, $filepath='') {
* @param null|int $con 장수의 벌점
* @param null|int $conlimit 최대 벌점
*/
-function checkLimit($con = null) {
+function checkLimit($con = null)
+{
$session = Session::getInstance();
- if($session->userGrade>=4){
+ if ($session->userGrade >= 4) {
return 0;
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
- if($con === null){
+ if ($con === null) {
$con = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', Session::getUserID());
}
$conlimit = $gameStor->conlimit;
- if($con > $conlimit) {
+ if ($con > $conlimit) {
return 2;
- //접속제한 90%이면 경고문구
- } elseif($con > $conlimit * 0.9) {
+ //접속제한 90%이면 경고문구
+ } elseif ($con > $conlimit * 0.9) {
return 1;
} else {
return 0;
}
}
-function getBlockLevel() {
+function getBlockLevel()
+{
return DB::db()->queryFirstField('select block from general where no = %i', Session::getInstance()->generalID);
}
-function getRandGenName() {
+function getRandGenName()
+{
$firstname = Util::choiceRandom(GameConst::$randGenFirstName);
$middlename = Util::choiceRandom(GameConst::$randGenMiddleName);
$lastname = Util::choiceRandom(GameConst::$randGenLastName);
@@ -138,7 +143,8 @@ function getRandGenName() {
-function cityInfo(General $generalObj) {
+function cityInfo(General $generalObj)
+{
$db = DB::db();
// 도시 정보
@@ -147,7 +153,7 @@ function cityInfo(General $generalObj) {
$nation = getNationStaticInfo($city['nation']);
- if(!$nation){
+ if (!$nation) {
$nation = getNationStaticInfo(0);
}
@@ -158,12 +164,12 @@ function cityInfo(General $generalObj) {
$city['levelText'] = CityConst::$levelMap[$city['level']];
$officerName = [
- 2=>'-',
- 3=>'-',
- 4=>'-'
+ 2 => '-',
+ 3 => '-',
+ 4 => '-'
];
- foreach($db->query('SELECT `officer_level`, `name`, npc, no FROM general WHERE officer_city = %i', $cityID) as $officer){
+ foreach ($db->query('SELECT `officer_level`, `name`, npc, no FROM general WHERE officer_city = %i', $cityID) as $officer) {
$officerName[$officer['officer_level']] = getColoredName($officer['name'], $officer['npc']);
}
@@ -174,117 +180,146 @@ function cityInfo(General $generalObj) {
return $templates->render('mainCityInfo', $city);
}
-function myNationInfo() {
+function myNationInfo()
+{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
- $connect=$db->get();
+ $connect = $db->get();
$userID = Session::getUserID();
- $admin = $gameStor->getValues(['startyear','year']);
+ $admin = $gameStor->getValues(['startyear', 'year']);
$query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$me = MYDB_fetch_array($result);
$query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,strategic_cmd_limit,surlimit,tech,level,type from nation where nation='{$me['nation']}'";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$nation = MYDB_fetch_array($result);
$query = "select COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop_max) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$city = MYDB_fetch_array($result);
$query = "select COUNT(*) as cnt, SUM(crew) as totcrew,SUM(leadership)*100 as maxcrew from general where nation='{$nation['nation']}'"; // 장수 목록
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$general = MYDB_fetch_array($result);
$query = "select name from general where nation='{$nation['nation']}' and officer_level='12'";
- $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $genresult = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$level12 = MYDB_fetch_array($genresult);
$query = "select name from general where nation='{$nation['nation']}' and officer_level='11'";
- $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $genresult = MYDB_query($query, $connect) or Error(__LINE__ . MYDB_error($connect), "");
$level11 = MYDB_fetch_array($genresult);
echo "
| 【재 야】"; }
- else { echo "style='color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;text-align:center'>국가【 {$nation['name']} 】"; }
+ if ($me['nation'] == 0) {
+ echo "style='color:white;background-color:000000;font-weight:bold;font-size:13px;text-align:center;'>【재 야】";
+ } else {
+ echo "style='color:" . newColor($nation['color']) . ";background-color:{$nation['color']};font-weight:bold;font-size:13px;text-align:center'>국가【 {$nation['name']} 】";
+ }
echo "
|
| 성 향 |
- ".getNationType($nation['type'])." (".getNationType2($nation['type']).") |
+ " . getNationType($nation['type']) . " (" . getNationType2($nation['type']) . ") |
- | ".getOfficerLevelText(12, $nation['level'])." |
- ";echo $level12?$level12['name']:"-"; echo " |
- ".getOfficerLevelText(11, $nation['level'])." |
- ";echo $level11?$level11['name']:"-"; echo " |
+ " . getOfficerLevelText(12, $nation['level']) . " |
+ ";
+ echo $level12 ? $level12['name'] : "-";
+ echo " |
+ " . getOfficerLevelText(11, $nation['level']) . " |
+ ";
+ echo $level11 ? $level11['name'] : "-";
+ echo " |
| 총주민 |
- ";echo $me['nation']==0?"해당 없음":"{$city['totpop']}/{$city['maxpop']}";echo " |
+ ";
+ echo $me['nation'] == 0 ? "해당 없음" : "{$city['totpop']}/{$city['maxpop']}";
+ echo " |
총병사 |
- ";echo $me['nation']==0?"해당 없음":"{$general['totcrew']}/{$general['maxcrew']}"; echo " |
+ ";
+ echo $me['nation'] == 0 ? "해당 없음" : "{$general['totcrew']}/{$general['maxcrew']}";
+ echo " |
| 국 고 |
- ";echo $me['nation']==0?"해당 없음":"{$nation['gold']}";echo " |
+ ";
+ echo $me['nation'] == 0 ? "해당 없음" : "{$nation['gold']}";
+ echo " |
병 량 |
- ";echo $me['nation']==0?"해당 없음":"{$nation['rice']}";echo " |
+ ";
+ echo $me['nation'] == 0 ? "해당 없음" : "{$nation['rice']}";
+ echo " |
| 지급률 |
";
- if($me['nation'] == 0) {
+ if ($me['nation'] == 0) {
echo "해당 없음";
} else {
- echo $nation['bill']==0?"0 %":"{$nation['bill']} %";
+ echo $nation['bill'] == 0 ? "0 %" : "{$nation['bill']} %";
}
echo "
|
세 율 |
";
- if($me['nation'] == 0) {
+ if ($me['nation'] == 0) {
echo "해당 없음";
} else {
- echo $nation['rate']==0?"0 %":"{$nation['rate']} %";
+ echo $nation['rate'] == 0 ? "0 %" : "{$nation['rate']} %";
}
$techCall = getTechCall($nation['tech']);
- if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $nation['tech'] = "".floor($nation['tech']).""; }
- else { $nation['tech'] = "".floor($nation['tech']).""; }
+ if (TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) {
+ $nation['tech'] = "" . floor($nation['tech']) . "";
+ } else {
+ $nation['tech'] = "" . floor($nation['tech']) . "";
+ }
$nation['tech'] = "$techCall / {$nation['tech']}";
-
- if($me['nation']==0){
+
+ if ($me['nation'] == 0) {
$nation['strategic_cmd_limit'] = "해당 없음";
$nation['surlimit'] = "해당 없음";
$nation['scout'] = "해당 없음";
$nation['war'] = "해당 없음";
$nation['power'] = "해당 없음";
} else {
- if($nation['strategic_cmd_limit'] != 0) { $nation['strategic_cmd_limit'] = "{$nation['strategic_cmd_limit']}턴"; }
- else { $nation['strategic_cmd_limit'] = "가 능"; }
-
- if($nation['surlimit'] != 0) { $nation['surlimit'] = "{$nation['surlimit']}턴"; }
- else { $nation['surlimit'] = "가 능"; }
-
- if($nation['scout'] != 0) { $nation['scout'] = "금 지"; }
- else { $nation['scout'] = "허 가"; }
-
- if($nation['war'] != 0) { $nation['war'] = "금 지"; }
- else { $nation['war'] = "허 가"; }
-
-
+ if ($nation['strategic_cmd_limit'] != 0) {
+ $nation['strategic_cmd_limit'] = "{$nation['strategic_cmd_limit']}턴";
+ } else {
+ $nation['strategic_cmd_limit'] = "가 능";
+ }
+
+ if ($nation['surlimit'] != 0) {
+ $nation['surlimit'] = "{$nation['surlimit']}턴";
+ } else {
+ $nation['surlimit'] = "가 능";
+ }
+
+ if ($nation['scout'] != 0) {
+ $nation['scout'] = "금 지";
+ } else {
+ $nation['scout'] = "허 가";
+ }
+
+ if ($nation['war'] != 0) {
+ $nation['war'] = "금 지";
+ } else {
+ $nation['war'] = "허 가";
+ }
}
echo "
@@ -292,15 +327,21 @@ function myNationInfo() {
|
| 속 령 |
- ";echo $me['nation']==0?"-":"{$city['cnt']}"; echo " |
+ ";
+ echo $me['nation'] == 0 ? "-" : "{$city['cnt']}";
+ echo " |
장 수 |
- ";echo $me['nation']==0?"-":"{$general['cnt']}"; echo " |
+ ";
+ echo $me['nation'] == 0 ? "-" : "{$general['cnt']}";
+ echo " |
| 국 력 |
{$nation['power']} |
기술력 |
- ";echo $me['nation']==0?"-":"{$nation['tech']}"; echo " |
+ ";
+ echo $me['nation'] == 0 ? "-" : "{$nation['tech']}";
+ echo " |
| 전 략 |
@@ -318,60 +359,55 @@ function myNationInfo() {
";
}
-function checkSecretMaxPermission($penalty){
+function checkSecretMaxPermission($penalty)
+{
$secretMax = 4;
- if($penalty['noTopSecret']??false){
+ if ($penalty['noTopSecret'] ?? false) {
$secretMax = 1;
- }
- else if($penalty['noChief']??false){
+ } else if ($penalty['noChief'] ?? false) {
$secretMax = 1;
- }
- else if($penalty['noAmbassador']??false){
+ } else if ($penalty['noAmbassador'] ?? false) {
$secretMax = 2;
}
return $secretMax;
}
-function checkSecretPermission(array $me, $checkSecretLimit=true){
- if(!key_exists('penalty', $me) || !key_exists('permission', $me)){
- trigger_error ('canAccessSecret() 함수에 필요한 인자가 부족');
+function checkSecretPermission(array $me, $checkSecretLimit = true)
+{
+ if (!key_exists('penalty', $me) || !key_exists('permission', $me)) {
+ trigger_error('canAccessSecret() 함수에 필요한 인자가 부족');
}
- $penalty = Json::decode($me['penalty'])??[];
+ $penalty = Json::decode($me['penalty']) ?? [];
$permission = $me['permission'];
- if(!$me['nation']){
+ if (!$me['nation']) {
return -1;
}
- if($me['officer_level'] == 0){
+ if ($me['officer_level'] == 0) {
return -1;
}
-
- if($penalty['noSecret']??false){
+
+ if ($penalty['noSecret'] ?? false) {
return 0;
}
$secretMin = 0;
$secretMax = checkSecretMaxPermission($me, $penalty);
-
- if($me['officer_level'] == 12){
+
+ if ($me['officer_level'] == 12) {
$secretMin = 4;
- }
- else if($me['permission'] == 'ambassador'){
+ } else if ($me['permission'] == 'ambassador') {
$secretMin = 4;
- }
- else if($me['permission'] == 'auditor'){
+ } else if ($me['permission'] == 'auditor') {
$secretMin = 3;
- }
- else if($me['officer_level'] >= 5){
+ } else if ($me['officer_level'] >= 5) {
$secretMin = 2;
- }
- else if($me['officer_level'] > 1){
+ } else if ($me['officer_level'] > 1) {
$secretMin = 1;
- }
- else if($checkSecretLimit){
+ } else if ($checkSecretLimit) {
$db = DB::db();
$secretLimit = $db->queryFirstField('SELECT secretlimit FROM nation WHERE nation = %i', $me['nation']);
if ($me['belong'] >= $secretLimit) {
@@ -382,9 +418,10 @@ function checkSecretPermission(array $me, $checkSecretLimit=true){
return min($secretMin, $secretMax);
}
-function addCommand($typename, $value, $valid = 1, $color=0) {
- if($valid == 1) {
- switch($color) {
+function addCommand($typename, $value, $valid = 1, $color = 0)
+{
+ if ($valid == 1) {
+ switch ($color) {
case 0:
echo "
";
@@ -404,8 +441,9 @@ function addCommand($typename, $value, $valid = 1, $color=0) {
}
}
-function commandGroup($typename, $type=0) {
- if($type == 0) {
+function commandGroup($typename, $type = 0)
+{
+ if ($type == 0) {
echo "