From 4400116bdd1ca8f1e737573fc63c75d2f64ba1d2 Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 31 Dec 2021 04:12:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=82=B4=EB=AC=B4=EB=B6=80=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phan/config.php | 1 - hwe/b_dipcenter.php | 269 ----------------- hwe/c_dipcenter.php | 85 ------ hwe/sammo/API/Nation/SetBill.php | 63 ++++ hwe/sammo/API/Nation/SetBlockScout.php | 61 ++++ hwe/sammo/API/Nation/SetBlockWar.php | 61 ++++ hwe/sammo/API/Nation/SetRate.php | 63 ++++ hwe/sammo/API/Nation/SetSecretLimit.php | 63 ++++ hwe/scss/nationStratFinan.scss | 6 + hwe/scss/util.scss | 6 +- hwe/ts/PageNationStratFinan.vue | 381 +++++++++++++++++++++++- hwe/ts/SammoAPI.ts | 5 + hwe/v_nationStratFinan.php | 4 +- 13 files changed, 697 insertions(+), 371 deletions(-) delete mode 100644 hwe/b_dipcenter.php delete mode 100644 hwe/c_dipcenter.php create mode 100644 hwe/sammo/API/Nation/SetBill.php create mode 100644 hwe/sammo/API/Nation/SetBlockScout.php create mode 100644 hwe/sammo/API/Nation/SetBlockWar.php create mode 100644 hwe/sammo/API/Nation/SetRate.php create mode 100644 hwe/sammo/API/Nation/SetSecretLimit.php 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 ?>: 내무부 - ($me['officer_level'] >= 5 || $permission == 4), - 'nationMsg' => $nationStor->notice ?? '', - 'scoutMsg' => $nationStor->scout_msg ?? '', - ]) ?> - - - - - - - - - - - -
내 무 부
- - - - - - - - - - - - - - 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:'>
- - 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); - } - - ?> -
- -
- - - - - - - - - - - - - - -
예 산 & 정 책
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
자금 예산병량 예산
현 재   현 재   
단기수입   +둔전수입   +
세 금   +세 곡   +
수입 / 지출   + / -수입 / 지출   + / -
국고 예산    ()병량 예산    ()
세율 (5 ~ 30%)    name=rate style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=>% name=btn value=세율>봉급 지급률 (20 ~ 200%)    name=bill style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=>% name=btn value=지급률>
기밀 권한 (1 ~ 99년)    name=secretlimit style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=>년 name=btn value=기밀권한>전쟁 허용/금지 변경 가능getValue('available_war_setting_cnt') ?>회(월 +회, 최대회)
- "; - } else { - echo " - "; - } - - if ($nation['war'] == 0) { - echo " - "; - } else { - echo " - "; - } - ?> -
-
기밀 권한이란, 암행부를 열람할 수 있는 일반 장수의 최소 사관 년수를 의미합니다.
- - - - - - - -
- - - \ 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 @@ - - \ 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' => [