diff --git a/.phan/config.php b/.phan/config.php
index 682743e3..95126d58 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -64,7 +64,6 @@ return [
'hwe/b_tournament.php',
'hwe/b_troop.php',
'hwe/c_auction.php',
- 'hwe/c_dipcenter.php',
'hwe/c_tournament.php',
'hwe/c_vote.php',
'hwe/func_auction.php',
diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php
deleted file mode 100644
index 2300cf45..00000000
--- a/hwe/b_dipcenter.php
+++ /dev/null
@@ -1,269 +0,0 @@
-setReadOnly();
-$userID = Session::getUserID();
-
-$db = DB::db();
-$gameStor = KVStorage::getStorage($db, 'game_env');
-
-increaseRefresh("내무부", 1);
-
-$me = $db->queryFirstRow('SELECT no, nation, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
-
-$nationID = $me['nation'];
-$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID);
-
-$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
-
-$con = checkLimit($me['con']);
-if ($con >= 2) {
- printLimitMsg($me['turntime']);
- exit();
-}
-
-$permission = checkSecretPermission($me);
-if ($permission < 0) {
- echo '국가에 소속되어있지 않습니다.';
- die();
-} else if ($permission < 1) {
- echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
- die();
-}
-
-if ($me['officer_level'] >= 5) {
- $btn = "submit";
- $read = "";
-} else {
- $btn = "hidden";
- $read = "readonly";
-}
-
-$nationStor->cacheValues(['notice', 'scout_msg', 'available_war_setting_cnt']);
-
-?>
-
-
-
-
-
-
-
- = UniqueConst::$serverName ?>: 내무부
- = WebUtil::printStaticValues([
- 'editable' => ($me['officer_level'] >= 5 || $permission == 4),
- 'nationMsg' => $nationStor->notice ?? '',
- 'scoutMsg' => $nationStor->scout_msg ?? '',
- ]) ?>
- = WebUtil::printJS('../d_shared/common_path.js') ?>
- = WebUtil::printCSS('../d_shared/common.css') ?>
-
- = WebUtil::printDist('vue', 'v_dipcenter', true) ?>
-
-
-
-
-
- 내 무 부 = backButton() ?> |
-
-
-
-
- | 외 교 관 계 |
-
-
- | 국 가 명 |
- 국력 |
- 장수 |
- 속령 |
- 상태 |
- 기간 |
- 종 료 시 점 |
-
- getValues(['year', 'month']);
-
- $cityCntList = Util::convertPairArrayToDict($db->queryAllLists('SELECT nation, count(city) FROM city GROUP BY nation'));
- $dipStateList = Util::convertArrayToDict($db->query('SELECT you,state,term FROM diplomacy WHERE me = %i', $nationID), 'you');
-
- $nationsList = getAllNationStaticInfo();
- uasort($nationsList, function (array $lhs, array $rhs) {
- return - ($lhs['power'] <=> $rhs['power']);
- });
-
- foreach ($nationsList as $staticNation) :
- //속령수
- $staticNationID = $staticNation['nation'];
- $cityCnt = $cityCntList[$staticNation['nation']] ?? 0;
-
- $dipStateText = '-';
- $dipTermText = '-';
- $dipEndDateText = '-';
- if ($staticNationID !== $nationID) {
- $diplomacyState = $dipStateList[$staticNationID];
-
- $dipStateText = [
- 0 => "교 전",
- 1 => "선포중",
- 2 => "통 상",
- 7 => "불가침",
- ][$diplomacyState['state']];
-
- if ($diplomacyState['term']) {
- $dipEndMonth = $admin['month'] + $diplomacyState['term'] - 1;
- $dipEndYear = $admin['year'] + intdiv($dipEndMonth, 12);
- $dipEndMonth = $dipEndMonth % 12 + 1;
-
- $dipTermText = $diplomacyState['term'] . '개월';
- $dipEndDateText = "{$dipEndYear}年 {$dipEndMonth}月";
- }
- }
- ?>
-
-
- | ;background-color:= $staticNation['color'] ?>'>= $staticNation['name'] ?> |
- = $staticNation['power'] ?> |
- = $staticNation['gennum'] ?> |
- = $cityCnt ?> |
- = $dipStateText ?> |
- = $dipTermText ?> |
- = $dipEndDateText ?> |
-
-
-
-
- query('SELECT * FROM city WHERE nation=%i', $nationID);
- $dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
-
- $goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
- $warIncome = getWarGoldIncome($nation['type'], $cityList);
- $totalGoldIncome = $goldIncome + $warIncome;
-
- $riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
- $wallIncome = getWallIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
- $totalRiceIncome = $riceIncome + $wallIncome;
-
- $outcome = getOutcome($nation['bill'], $dedicationList);
-
- $budgetgold = $nation['gold'] + $totalGoldIncome - $outcome;
- $budgetrice = $nation['rice'] + $totalRiceIncome - $outcome;
- $budgetgolddiff = $totalGoldIncome - $outcome;
- $budgetricediff = $totalRiceIncome - $outcome;
-
- if ($budgetgolddiff > 0) {
- $budgetgolddiff = '+' . number_format($budgetgolddiff);
- } else {
- $budgetgolddiff = number_format($budgetgolddiff);
- }
- if ($budgetricediff > 0) {
- $budgetricediff = '+' . number_format($budgetricediff);
- } else {
- $budgetricediff = number_format($budgetricediff);
- }
-
- ?>
-
-
-
-
-
-
- | = backButton() ?> |
-
-
- | = banner() ?> |
-
-
-
-
-
\ No newline at end of file
diff --git a/hwe/c_dipcenter.php b/hwe/c_dipcenter.php
deleted file mode 100644
index 19785b1d..00000000
--- a/hwe/c_dipcenter.php
+++ /dev/null
@@ -1,85 +0,0 @@
-setReadOnly();
-$userID = Session::getUserID();
-
-$db = DB::db();
-
-$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
-
-//내가 수뇌부이어야함
-$permission = checkSecretPermission($me);
-if ($permission < 0) {
- header('location:b_myBossInfo.php', true, 303);
- exit();
-} else if ($me['officer_level'] < 5 && $permission != 4) {
- header('location:b_myBossInfo.php', true, 303);
- exit();
-}
-
-$nationID = $me['nation'];
-$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
-
-/*if ($btn == "국가방침 수정") {
- $msg = mb_substr($msg, 0, 16384);
- //$msg = StringUtil::
- $nationStor->notice = WebUtil::htmlPurify($msg);
-} elseif ($btn == "임관 권유문 수정") {
- $scoutmsg = mb_substr($scoutmsg, 0, 1000);
- $nationStor->scout_msg = WebUtil::htmlPurify($scoutmsg);
-} else*/if ($btn == "세율") {
- $rate = Util::valueFit($rate, 5, 30);
- $db->update('nation', [
- 'rate' => $rate,
- ], 'nation=%i', $nationID);
-} elseif ($btn == "지급률") {
- $bill = Util::valueFit($bill, 20, 200);
- $db->update('nation', [
- 'bill' => $bill
- ], 'nation=%i', $nationID);
-} elseif ($btn == "기밀권한") {
- $secretlimit = Util::valueFit($secretlimit, 1, 99);
- $db->update('nation', [
- 'secretlimit' => $secretlimit
- ], 'nation=%i', $nationID);
-} elseif ($btn == "임관 금지") {
- $db->update('nation', [
- 'scout' => 1
- ], 'nation=%i', $nationID);
-} elseif ($btn == "임관 허가") {
- $db->update('nation', [
- 'scout' => 0
- ], 'nation=%i', $nationID);
-} elseif ($btn == "전쟁 금지") {
- $avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
- if ($avilableCnt > 0) {
- $db->update('nation', [
- 'war' => 1
- ], 'nation=%i', $nationID);
- $nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
- }
-} elseif ($btn == "전쟁 허가") {
- $avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
- if ($avilableCnt > 0) {
- $db->update('nation', [
- 'war' => 0
- ], 'nation=%i', $nationID);
- $nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
- }
-}
-
-header('location:b_dipcenter.php');
diff --git a/hwe/sammo/API/Nation/SetBill.php b/hwe/sammo/API/Nation/SetBill.php
new file mode 100644
index 00000000..04895b97
--- /dev/null
+++ b/hwe/sammo/API/Nation/SetBill.php
@@ -0,0 +1,63 @@
+args);
+ $v->rule('required', [
+ 'amount',
+ ])
+ ->rule('integer', 'amount')
+ ->rule('min', 'amount', 20)
+ ->rule('max', 'amount', 200);
+
+ if (!$v->validate()) {
+ return $v->errorStr();
+ }
+ return null;
+ }
+
+ public function getRequiredSessionMode(): int
+ {
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
+ }
+
+ public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
+ {
+ $amount = $this->args['amount'];
+ $userID = $session->userID;
+ $db = DB::db();
+ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
+
+ $permission = checkSecretPermission($me, false);
+ if($permission < 0){
+ return "권한이 부족합니다.";
+ }
+ if ($me['officer_level'] < 5 && $permission != 4){
+ return "권한이 부족합니다.";
+ }
+
+
+ $nationID = $me['nation'];
+
+ $db->update('nation', [
+ 'bill' => $amount
+ ], 'nation=%i', $nationID);
+
+ return [
+ 'result' => true
+ ];
+ }
+}
diff --git a/hwe/sammo/API/Nation/SetBlockScout.php b/hwe/sammo/API/Nation/SetBlockScout.php
new file mode 100644
index 00000000..4b8967d3
--- /dev/null
+++ b/hwe/sammo/API/Nation/SetBlockScout.php
@@ -0,0 +1,61 @@
+args);
+ $v->rule('required', [
+ 'value',
+ ])
+ ->rule('boolean', 'value');
+
+ if (!$v->validate()) {
+ return $v->errorStr();
+ }
+ return null;
+ }
+
+ public function getRequiredSessionMode(): int
+ {
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
+ }
+
+ public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
+ {
+ $value = $this->args['value'];
+ $userID = $session->userID;
+ $db = DB::db();
+ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
+
+ $permission = checkSecretPermission($me, false);
+ if($permission < 0){
+ return "권한이 부족합니다.";
+ }
+ if ($me['officer_level'] < 5 && $permission != 4){
+ return "권한이 부족합니다.";
+ }
+
+
+ $nationID = $me['nation'];
+
+ $db->update('nation', [
+ 'scout' => $value?1:0,
+ ], 'nation=%i', $nationID);
+
+ return [
+ 'result' => true
+ ];
+ }
+}
diff --git a/hwe/sammo/API/Nation/SetBlockWar.php b/hwe/sammo/API/Nation/SetBlockWar.php
new file mode 100644
index 00000000..46e0815b
--- /dev/null
+++ b/hwe/sammo/API/Nation/SetBlockWar.php
@@ -0,0 +1,61 @@
+args);
+ $v->rule('required', [
+ 'value',
+ ])
+ ->rule('boolean', 'value');
+
+ if (!$v->validate()) {
+ return $v->errorStr();
+ }
+ return null;
+ }
+
+ public function getRequiredSessionMode(): int
+ {
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
+ }
+
+ public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
+ {
+ $value = $this->args['value'];
+ $userID = $session->userID;
+ $db = DB::db();
+ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
+
+ $permission = checkSecretPermission($me, false);
+ if($permission < 0){
+ return "권한이 부족합니다.";
+ }
+ if ($me['officer_level'] < 5 && $permission != 4){
+ return "권한이 부족합니다.";
+ }
+
+
+ $nationID = $me['nation'];
+
+ $db->update('nation', [
+ 'war' => $value?1:0,
+ ], 'nation=%i', $nationID);
+
+ return [
+ 'result' => true
+ ];
+ }
+}
diff --git a/hwe/sammo/API/Nation/SetRate.php b/hwe/sammo/API/Nation/SetRate.php
new file mode 100644
index 00000000..e3e811a0
--- /dev/null
+++ b/hwe/sammo/API/Nation/SetRate.php
@@ -0,0 +1,63 @@
+args);
+ $v->rule('required', [
+ 'amount',
+ ])
+ ->rule('integer', 'amount')
+ ->rule('min', 'amount', 5)
+ ->rule('max', 'amount', 30);
+
+ if (!$v->validate()) {
+ return $v->errorStr();
+ }
+ return null;
+ }
+
+ public function getRequiredSessionMode(): int
+ {
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
+ }
+
+ public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
+ {
+ $amount = $this->args['amount'];
+ $userID = $session->userID;
+ $db = DB::db();
+ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
+
+ $permission = checkSecretPermission($me, false);
+ if($permission < 0){
+ return "권한이 부족합니다.";
+ }
+ if ($me['officer_level'] < 5 && $permission != 4){
+ return "권한이 부족합니다.";
+ }
+
+
+ $nationID = $me['nation'];
+
+ $db->update('nation', [
+ 'rate' => $amount
+ ], 'nation=%i', $nationID);
+
+ return [
+ 'result' => true
+ ];
+ }
+}
diff --git a/hwe/sammo/API/Nation/SetSecretLimit.php b/hwe/sammo/API/Nation/SetSecretLimit.php
new file mode 100644
index 00000000..f735c999
--- /dev/null
+++ b/hwe/sammo/API/Nation/SetSecretLimit.php
@@ -0,0 +1,63 @@
+args);
+ $v->rule('required', [
+ 'amount',
+ ])
+ ->rule('integer', 'amount')
+ ->rule('min', 'amount', 1)
+ ->rule('max', 'amount', 99);
+
+ if (!$v->validate()) {
+ return $v->errorStr();
+ }
+ return null;
+ }
+
+ public function getRequiredSessionMode(): int
+ {
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
+ }
+
+ public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
+ {
+ $amount = $this->args['amount'];
+ $userID = $session->userID;
+ $db = DB::db();
+ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
+
+ $permission = checkSecretPermission($me, false);
+ if($permission < 0){
+ return "권한이 부족합니다.";
+ }
+ if ($me['officer_level'] < 5 && $permission != 4){
+ return "권한이 부족합니다.";
+ }
+
+
+ $nationID = $me['nation'];
+
+ $db->update('nation', [
+ 'bill' => $amount
+ ], 'nation=%i', $nationID);
+
+ return [
+ 'result' => true
+ ];
+ }
+}
diff --git a/hwe/scss/nationStratFinan.scss b/hwe/scss/nationStratFinan.scss
index b68cde2a..aebd76cb 100644
--- a/hwe/scss/nationStratFinan.scss
+++ b/hwe/scss/nationStratFinan.scss
@@ -2,6 +2,7 @@
@import "@scss/game_bg.scss";
@import "@scss/util.scss";
@import "@scss/editor_component.scss";
+@import "@scss/common_legacy.scss";
.diplomacyTitle {
background-color: $blue;
@@ -32,6 +33,11 @@
overflow: hidden;
}
+#scoutMsgForm .ProseMirror{
+ max-height: 200px;
+ overflow-y: hidden;
+}
+
@include media-1000px {
#container {
width: 1000px;
diff --git a/hwe/scss/util.scss b/hwe/scss/util.scss
index 67f0d4e2..6fee028f 100644
--- a/hwe/scss/util.scss
+++ b/hwe/scss/util.scss
@@ -9,4 +9,8 @@
.s-border-tb {
border-top: gray solid 1px;
border-bottom: gray solid 1px;
-}
\ No newline at end of file
+}
+
+.avoid-wrap {
+ display: inline-block;
+}
diff --git a/hwe/ts/PageNationStratFinan.vue b/hwe/ts/PageNationStratFinan.vue
index d1795de6..ede4dc5d 100644
--- a/hwe/ts/PageNationStratFinan.vue
+++ b/hwe/ts/PageNationStratFinan.vue
@@ -1,4 +1,5 @@
+
외교관계
@@ -114,20 +115,206 @@
예산&정책
+
+
+
+
자금 예산
+
현 재
+
{{ gold.toLocaleString() }}
+
단기수입
+
{{ income.gold.war.toLocaleString() }}
+
세 금
+
+ {{ Math.floor(incomeGoldCity).toLocaleString() }}
+
+
수입/지출
+
+ +{{ Math.floor(incomeGold).toLocaleString() }} /
+ {{ Math.floor(-outcomeByBill).toLocaleString() }}
+
+
국고 예산
+
+ {{ Math.floor(gold + incomeGold - outcomeByBill).toLocaleString() }}
+ ({{ incomeGold >= outcomeByBill ? "+" : ""
+ }}{{ Math.floor(incomeGold - outcomeByBill).toLocaleString() }})
+
+
+
+
+
+
군량 예산
+
현 재
+
{{ rice.toLocaleString() }}
+
둔점수입
+
+ {{ Math.floor(income.rice.wall).toLocaleString() }}
+
+
세 금
+
+ {{ Math.floor(incomeRiceCity).toLocaleString() }}
+
+
수입/지출
+
+ +{{ Math.floor(incomeRice).toLocaleString() }} /
+ {{ Math.floor(-outcomeByBill).toLocaleString() }}
+
+
국고 예산
+
+ {{ Math.floor(rice + incomeRice - outcomeByBill).toLocaleString() }}
+ ({{ incomeRice >= outcomeByBill ? "+" : ""
+ }}{{ Math.floor(incomeRice - outcomeByBill).toLocaleString() }})
+
+
+
+
+
+
+
+
+
+
+
추가 설정
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/hwe/ts/SammoAPI.ts b/hwe/ts/SammoAPI.ts
index db2338c9..f9fe713a 100644
--- a/hwe/ts/SammoAPI.ts
+++ b/hwe/ts/SammoAPI.ts
@@ -40,6 +40,11 @@ const apiRealPath = {
Nation: {
SetNotice: done,
SetScoutMsg: done,
+ SetBill: done,
+ SetRate: done,
+ SetSecretLimit: done,
+ SetBlockWar: done,
+ SetBlockScout: done,
},
} as const;
diff --git a/hwe/v_nationStratFinan.php b/hwe/v_nationStratFinan.php
index 1ccba237..926b994d 100644
--- a/hwe/v_nationStratFinan.php
+++ b/hwe/v_nationStratFinan.php
@@ -98,7 +98,7 @@ $wallIncome = getWallIncome(
$cityList
);
-$incomes = [
+$income = [
'gold' => [
'city' => $goldIncome,
'war' => $warIncome,
@@ -132,7 +132,7 @@ $outcome = getOutcome(100, $dedicationList);
'gold' => $nation['gold'],
'rice' => $nation['rice'],
- 'income' => $incomeList,
+ 'income' => $income,
'outcome' => $outcome,
'policy' => [