diff --git a/hwe/c_double.php b/hwe/c_double.php
index e62bfaf1..d61718cd 100644
--- a/hwe/c_double.php
+++ b/hwe/c_double.php
@@ -106,6 +106,31 @@ if($command == 61) {
die();
}
+// 국호변경
+if($command == 82) {
+ $query = "select no,nation,level from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $name = StringUtil::neutralize($name);
+ if($name == "") { $name = "무명"; }
+
+ $db->update('general', [
+ 'makenation'=>$name
+ ], 'owner=%i', $userID);
+
+ $count = count($turn);
+ $str = "type=type";
+ for($i=0; $i < $count; $i++) {
+ $str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'";
+ }
+ $query = "update nation set {$str} where nation='{$me['nation']}'";
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+
+ header('location:b_chiefcenter.php', true, 303);
+ die();
+}
+
//포상, 몰수, 발령, 항복권고, 원조
//선전포고, 종전, 파기, 초토화, 천도, 증축, 감축
//백성동원, 수몰, 허보, 피장파장, 의병모집, 이호경식, 급습
@@ -130,6 +155,8 @@ if($command == 23 || $command == 24 || $command == 27 || $command == 51 || $comm
die();
}
+
+
//일반 턴
$query = [];
foreach($turn as $turnIdx){
diff --git a/hwe/func.php b/hwe/func.php
index 3ab0564e..2695f724 100644
--- a/hwe/func.php
+++ b/hwe/func.php
@@ -759,9 +759,10 @@ function CoreCommandTable() {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
- $query = "select level,can_change_flag from nation where nation='{$me['nation']}'";
+ $query = "select level,can_change_flag,aux from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
+ $nationAux = Json::decode($nation['aux']);
$query = "select no from general where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -831,6 +832,12 @@ function CoreCommandTable() {
} else {
addCommand("국기 변경", 81, 0);
}
+ if($nation['level']==7 && !$nationAux['used_82']??0){
+ addCommand("국호 변경", 82, 1);
+ }
+ else{
+ addCommand("국호 변경", 82, 0);
+ }
commandGroup("", 1);
echo "
diff --git a/hwe/func_command.php b/hwe/func_command.php
index 10348cab..a3bc018b 100644
--- a/hwe/func_command.php
+++ b/hwe/func_command.php
@@ -476,6 +476,9 @@ function getCoreTurn($nation, $level) {
$str[$i] = "【국기】를 변경";
break;
+ case 82: //국호변경
+ $str[$i] = "국호를 변경";
+ break;
default:
$str[$i] = "????";
break;
@@ -552,6 +555,7 @@ function processCommand($no, $reduceTurn) {
case 77: process_77($general); break; //이호경식
case 78: process_78($general); break; //급습
case 81: process_81($general); break; //국기변경
+ case 82: process_82($general); break; //국호변경
case 99: break; //수뇌부휴식
}
diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php
index 7250f2d2..eea543a2 100644
--- a/hwe/func_gamerule.php
+++ b/hwe/func_gamerule.php
@@ -1015,6 +1015,7 @@ function updateNationState() {
$josaUl = JosaUtil::pick(getNationLevel($nationlevel), '을');
$history[] = "●>{$admin['year']}년 {$admin['month']}월:【작위】>{$nation['name']}>의 군주가 ".getNationLevel($nationlevel).">{$josaUl} 자칭하였습니다.";
pushNationHistory($nation, "●>{$admin['year']}년 {$admin['month']}월:{$nation['name']}>의 군주가 ".getNationLevel($nationlevel).">{$josaUl} 자칭");
+ $db->update('nation', ['can_change_flag'=>1], 'nation=%i', $nation['nation']);
break;
case 6:
$history[] = "●>{$admin['year']}년 {$admin['month']}월:【작위】>{$nation['name']}>의 군주가 ".getNationLevel($nationlevel).">에 등극하였습니다.";
diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php
index 599cb7c0..6deaab71 100644
--- a/hwe/func_process_chief.php
+++ b/hwe/func_process_chief.php
@@ -2477,3 +2477,83 @@ function process_81(&$general) {
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
pushGenLog($general, $log);
}
+
+function process_82(&$general) {
+ $db = DB::db();
+ $gameStor = KVStorage::getStorage($db, 'game_env');
+ $connect=$db->get();
+
+ $log = [];
+ $alllog = [];
+ $history = [];
+
+ $date = substr($general['turntime'],11,5);
+
+ $admin = $gameStor->getValues(['year','month']);
+
+ $query = "select nation from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $city = MYDB_fetch_array($result);
+
+ $query = "select nation,name,type,sabotagelimit,aux from nation where nation='{$general['nation']}'";
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $nation = MYDB_fetch_array($result);
+ $nationAux = Json::decode($nation['aux']??'{}');
+ $newNationName = $general['makenation'];
+
+ $nationExists = $db->queryFirstField('SELECT nation FROM nation WHERE name = %s', $newNationName);
+
+ if($nationExists){
+ $log[] = "●>{$admin['month']}월:이미 같은 국호를 가진 곳이 있습니다. 국호변경 실패. <1>$date>";
+ }
+ else if($city['nation'] != $general['nation']) {
+ $log[] = "●>{$admin['month']}월:아국이 아닙니다. 국호변경 실패. <1>$date>";
+ } elseif($general['level'] < 5) {
+ $log[] = "●>{$admin['month']}월:수뇌부가 아닙니다. 국호변경 실패. <1>$date>";
+ } elseif($nationAux['used_82']??0) {
+ $log[] = "●>{$admin['month']}월:더이상 변경이 불가능합니다. 국호변경 실패. <1>$date>";
+ } else {
+ $josaRo = JosaUtil::pick($newNationName, '로');
+ $log[] = "●>{$admin['month']}월:국호를 {$newNationName}{$josaRo}> 변경합니다. <1>$date>";
+ $exp = 10;
+ $ded = 10;
+
+ // 성격 보정
+ $exp = CharExperience($exp, $general['personal']);
+ $ded = CharDedication($ded, $general['personal']);
+
+ $josaYi = JosaUtil::pick($general['name'], '이');
+ $josaYiNation = JosaUtil::pick($nation['name'], '이');
+
+ $query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $cnt = MYDB_num_rows($result);
+ $genlog = ["●>{$general['name']}>{$josaYi} 국호를 {$newNationName}>{$josaRo} 변경합니다."];
+ for($i=0; $i < $cnt; $i++) {
+ $gen = MYDB_fetch_array($result);
+ pushGenLog($gen, $genlog);
+ }
+
+ $alllog[] = "●>{$admin['month']}월:{$general['name']}>{$josaYi} 국호를 {$newNationName}>{$josaRo} 변경합니다.";
+ $history[] = "●>{$admin['year']}년 {$admin['month']}월:【국호변경】>{$nation['name']}>{$josaYiNation} 국호를 {$newNationName}>{$josaRo} 변경합니다.";
+ pushGeneralHistory($general, "●>{$admin['year']}년 {$admin['month']}월:국호를 {$newNationName}>{$josaRo} 변경");
+ pushNationHistory($nation, "●>{$admin['year']}년 {$admin['month']}월:{$general['name']}>{$josaYi} 국호를 {$newNationName}>{$josaRo} 변경");
+
+ $nationAux['used_82'] = 1;
+ //국기변경
+ $db->update('nation', [
+ 'name'=>$newNationName,
+ 'aux'=>Json::encode($nationAux)
+ ], 'nation=%i', $nation['nation']);
+
+ //경험치, 공헌치
+ $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+
+ refreshNationStaticInfo();
+ }
+
+ pushWorldHistory($history, $admin['year'], $admin['month']);
+ pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
+ pushGenLog($general, $log);
+}
\ No newline at end of file
diff --git a/hwe/j_preprocessing.php b/hwe/j_preprocessing.php
index 246490b1..ca100932 100644
--- a/hwe/j_preprocessing.php
+++ b/hwe/j_preprocessing.php
@@ -124,6 +124,7 @@ switch($commandtype) {
// case 78: command_78($turn, 78); break; //급습
// case 81: command_81($turn, 81); break; //국기변경
+// case 82: command_82($turn, 82); break; //국호변경
// case 99: command_99($turn); break; //수뇌부 후식
default: command_Other($turn, $commandtype); break;
diff --git a/hwe/processing.php b/hwe/processing.php
index dedab31f..71a393c4 100644
--- a/hwe/processing.php
+++ b/hwe/processing.php
@@ -117,6 +117,7 @@ switch($commandtype) {
case 77: command_77($turn, 77); break; //이호경식
case 78: command_78($turn, 78); break; //급습
case 81: command_81($turn, 81); break; //국기변경
+ case 82: command_82($turn, 82); break; //국호변경
case 99: command_99($turn); break; //수뇌부 휴식
default:command_Single($turn, 0); break; //휴식
@@ -2620,3 +2621,36 @@ function command_81($turn, $command) {
";
ender(1);
}
+
+function command_82($turn, $command) {
+ $db = DB::db();
+ $gameStor = KVStorage::getStorage($db, 'game_env');
+ $connect=$db->get();
+
+ $userID = Session::getUserID();
+ $nationID = $db->queryFirstField('SELECT nation FROM general WHERE owner = %i', $userID);
+ $nation = $db->queryFirstRow('SELECT level,aux FROM nation WHERE nation = %i', $nationID);
+ $nationAux = Json::decode($nation['aux']??'{}');
+
+ starter("국호변경");
+
+ if($nation && $nation['level'] == 7 && !$nationAux['used_82']??0){
+?>
+나라의 이름을 바꿉니다. 황제가 된 후 1회 가능합니다.
+
+";
+ } else {
+ echo "국호 변경이 불가능합니다.
";
+ }
+ ender();
+}
\ No newline at end of file