diff --git a/.phan/config.php b/.phan/config.php index 4c2b5fee..56676933 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -52,7 +52,6 @@ return [ 'hwe/v_chiefCenter.php', 'hwe/b_currentCity.php', 'hwe/v_nationStratFinan.php', - 'hwe/b_diplomacy.php', 'hwe/b_genList.php', 'hwe/b_myBossInfo.php', 'hwe/b_myCityInfo.php', diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php deleted file mode 100644 index e3b15e70..00000000 --- a/hwe/b_diplomacy.php +++ /dev/null @@ -1,236 +0,0 @@ -setReadOnly(); -$userID = Session::getUserID(); - -$db = DB::db(); -$gameStor = KVStorage::getStorage($db, 'game_env'); - -increaseRefresh("중원정보", 1); - -$me = $db->queryFirstRow('SELECT no,nation FROM general WHERE owner=%i', $userID); -$myNationID = $me['nation']; - -$nations = array_filter(getAllNationStaticInfo(), function (array $nation) { - return $nation['level']; -}); -uasort($nations, function (array $lhs, array $rhs) { - return - ($lhs['power'] <=> $rhs['power']); -}); -$nationCnt = count($nations); - -foreach ($db->queryAllLists('SELECT nation, count(city) FROM city WHERE nation != 0 GROUP BY nation') as [$nationID, $cityCnt]) { - $nations[$nationID]['city_cnt'] = $cityCnt; -} - -$realConflict = []; -foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE conflict!=%s', '{}') as [ - $cityID, - $cityName, - $rawConflict -]) { - $rawConflict = Json::decode($rawConflict); - if (count($rawConflict) < 2) { - continue; - } - - $sum = array_sum($rawConflict); - - - $conflict = []; - foreach ($rawConflict as $nationID => $killnum) { - $conflict[$nationID] = [ - 'killnum' => $killnum, - 'percent' => round(100 * $killnum / $sum, 1), - 'name' => $nations[$nationID]['name'], - 'color' => $nations[$nationID]['color'] - ]; - } - - $realConflict[] = [$cityID, $cityName, $conflict]; -}; - -$diplomacyList = []; -foreach ($db->queryAllLists('SELECT me, you, state FROM diplomacy') as [$me, $you, $state]) { - if (!key_exists($me, $diplomacyList)) { - $diplomacyList[$me] = []; - } - - $diplomacyList[$me][$you] = $state; -} - -$cellWidth = intdiv(888, max(1, $nationCnt)); - - -$defaultStateChar = '?'; -$sameNationStateChar = '\'; -$infomativeStateCharMap = [ - 0 => '', - 1 => '', - 2 => 'ㆍ', - 7 => '@' -]; -$neutralStateCharMap = [ - 0 => '', - 1 => '' -]; - -?> - - - - - - - - <?= UniqueConst::$serverName ?>: 중원 정보 - - - - - - - [ - 'serverNick' => DB::prefix(), - 'serverID' => UniqueConst::$serverID, - 'unitSet' => GameConst::$unitSet, - 'mapName' => GameConst::$mapName, - ], - ]) ?> - - - - - - - - -
중 원 정 보
-
- - - - - - - - - - - $meNation) : ?> - - - - - - - - - - -
align=center bgcolor=blue>외 교 현 황
;>  style='background-color:;color:'>
;color:'>>userGrade >= 5) { - echo $infomativeStateCharMap[$diplomacyList[$me][$you]] ?? $defaultStateChar; - } else { - echo $neutralStateCharMap[$diplomacyList[$me][$you]] ?? $defaultStateChar; - } - ?>
align=center>불가침 : @, 통상 : ㆍ, 선포 : , 교전 : -
- - - -
- - - - - - - - - - - - - -
분 쟁 현 황
- - - - - - - - -
;background-color:;'>  -
%;background-color:;'> 
-
- -
- - - -
- - - - - - - - -
- 중 원 지 도 -
- - - - - - - - - - - - - - - - - - - - - - -
국명국력장수속령
;background-color:'>
-
-
- - - - - - - - -
- - - - \ No newline at end of file diff --git a/hwe/sammo/API/Global/GetDiplomacy.php b/hwe/sammo/API/Global/GetDiplomacy.php index 39b45574..347898ea 100644 --- a/hwe/sammo/API/Global/GetDiplomacy.php +++ b/hwe/sammo/API/Global/GetDiplomacy.php @@ -99,7 +99,7 @@ class GetDiplomacy extends \sammo\BaseAPI return [ 'result' => true, - 'nations' => $nations, + 'nations' => array_values($nations), 'conflict' => $realConflict, 'diplomacyList' => $diplomacyList, 'myNationID' => $myNationID, diff --git a/hwe/sammo/API/Global/GetMap.php b/hwe/sammo/API/Global/GetMap.php index 57fc3ae9..4cc3a6ca 100644 --- a/hwe/sammo/API/Global/GetMap.php +++ b/hwe/sammo/API/Global/GetMap.php @@ -14,8 +14,8 @@ class GetMap extends \sammo\BaseAPI public function validateArgs(): ?string { $v = new Validator($this->args); - $v->rule('boolean', 'neutralView') - ->rule('boolean', 'showMe'); + $v->rule('in', 'neutralView', [0, 1]) + ->rule('in', 'showMe', [0, 1]); if (!$v->validate()) { return $v->errorStr(); } diff --git a/hwe/templates/commandButton.php b/hwe/templates/commandButton.php index 834c55e4..13341621 100644 --- a/hwe/templates/commandButton.php +++ b/hwe/templates/commandButton.php @@ -11,7 +11,7 @@ '>세력 정보 '>세력 도시 '>세력 장수 -중원 정보 +중원 정보 현재 도시 '>감 찰 부 유산 관리 diff --git a/hwe/ts/PageGlobalDiplomacy.vue b/hwe/ts/PageGlobalDiplomacy.vue new file mode 100644 index 00000000..af78caed --- /dev/null +++ b/hwe/ts/PageGlobalDiplomacy.vue @@ -0,0 +1,221 @@ + + + + + + diff --git a/hwe/ts/SammoAPI.ts b/hwe/ts/SammoAPI.ts index 5f5f3d39..2984cf5c 100644 --- a/hwe/ts/SammoAPI.ts +++ b/hwe/ts/SammoAPI.ts @@ -58,7 +58,10 @@ const apiRealPath = { NumVar('month', GET as APICallT ))), GetCurrentHistory: GET as APICallT, - GetMap: GET as APICallT, + GetMap: GET as APICallT<{ + neutralView?: 0 | 1, + showMe?: 0 | 1, + }, MapResult>, GetCachedMap: GET as APICallT, GetDiplomacy: GET as APICallT, }, diff --git a/hwe/ts/build_exports.json b/hwe/ts/build_exports.json index a2200c25..3a93000e 100644 --- a/hwe/ts/build_exports.json +++ b/hwe/ts/build_exports.json @@ -32,6 +32,7 @@ "v_nationStratFinan": "v_nationStratFinan.ts", "v_processing": "v_processing.ts", "v_nationBetting": "v_nationBetting.ts", - "v_nationGeneral": "v_nationGeneral.ts" + "v_nationGeneral": "v_nationGeneral.ts", + "v_globalDiplomacy": "v_globalDiplomacy" } } \ No newline at end of file diff --git a/hwe/ts/v_globalDiplomacy.ts b/hwe/ts/v_globalDiplomacy.ts new file mode 100644 index 00000000..fbaca91d --- /dev/null +++ b/hwe/ts/v_globalDiplomacy.ts @@ -0,0 +1,16 @@ +import "@scss/history.scss"; +import { createApp } from 'vue' +import PageGlobalDiplomacy from '@/PageGlobalDiplomacy.vue'; +import { BootstrapVue3, BToastPlugin } from 'bootstrap-vue-3' +import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest'; +import { auto500px } from "./util/auto500px"; +import { htmlReady } from "./util/htmlReady"; +import { insertCustomCSS } from "./util/customCSS"; + +setAxiosXMLHttpRequest(); +auto500px(); + +htmlReady(() => { + insertCustomCSS(); +}); +createApp(PageGlobalDiplomacy).use(BootstrapVue3).use(BToastPlugin).mount('#app'); \ No newline at end of file diff --git a/hwe/v_globalDiplomacy.php b/hwe/v_globalDiplomacy.php new file mode 100644 index 00000000..d616cde2 --- /dev/null +++ b/hwe/v_globalDiplomacy.php @@ -0,0 +1,35 @@ +setReadOnly(); +$mapName = GameConst::$mapName; +?> + + + + + <?= UniqueConst::$serverName ?>:중원정보 + + + + + + + [ + 'serverNick' => DB::prefix(), + 'serverID' => UniqueConst::$serverID, + ], + ]) ?> + + + + +
+ + + \ No newline at end of file