diff --git a/hwe/b_chiefcenter.php b/hwe/b_chiefcenter.php
index 7cebc28a..b8a643ea 100644
--- a/hwe/b_chiefcenter.php
+++ b/hwe/b_chiefcenter.php
@@ -7,64 +7,6 @@ include "func.php";
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
-$db = DB::db();
-$gameStor = KVStorage::getStorage($db, 'game_env');
-
-increaseRefresh("사령부", 1);
-
-$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong FROM general WHERE owner=%i', $userID);
-
-[$nationLevel, $secretLimit] = $db->queryFirstList('SELECT level, secretlimit FROM nation WHERE nation = %i', $me['nation']);
-
-$con = checkLimit($me['con']);
-if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
-
-if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $secretLimit)) {
- echo "수뇌부가 아니거나 사관년도가 부족합니다.";
- exit();
-}
-
-if($me['level'] >= 5) { $btn = "submit"; $btn2 = "button"; }
-else { $btn = "hidden"; $btn2 = "hidden"; }
-
-$date = TimeUtil::now();
-
-// 명령 목록
-$admin = $gameStor->getValues(['year','month','turnterm']);
-
-$lv = getNationChiefLevel($nationLevel);
-$turn = [];
-
-$generals = [];
-foreach($db->query('SELECT no,name,turntime,npc,city,nation,level FROM general WHERE nation = %i AND level >= 5') as $rawGeneral){
- $generals[$rawGeneral['level']] = new General($rawGeneral, null, $admin['year'], $admin['month'], false);
-}
-
-$nationTurnList = [];
-
-foreach(
- $db->queryAllLists(
- 'SELECT level, turn_idx, action, arg FROM nation_turn WHERE nation_id = %i ORDER BY level DESC, turn_idx ASC',
- $me['nation']
- ) as [$level, $turn_idx, $action, $arg]
-){
- if(!key_exists($level, $nationTurnList)){
- $nationTurnList[$level] = [];
- }
- $nationTurnList[$level][$turn_idx] = [$action, Json::decode($arg)];
-}
-
-$nationTurnBrief = [];
-foreach($nationTurnList as $level=>$turnList){
- if(!key_exists($level, $generals)){
- $general = Util::array_first($generals);
- }
- else{
- $general = $generals[$level];
- }
- $nationTurnBrief[$level] = getNationTurnBrief($general, $turnList);
-}
-
?>
@@ -79,107 +21,77 @@ foreach($nationTurnList as $level=>$turnList){
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../d_shared/common.css')?>
=WebUtil::printCSS('css/common.css')?>
+=WebUtil::printCSS('css/chiefCenter.css')?>
- | 수뇌부 일정 |
- |
-= $lv; $i--) {
- $totaldate[$i] = $gen[$i]['turntime'];
- $turntime[$i] = substr($gen[$i]['turntime'], 14);
-}
-
-//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
-//TODO: 새롭게 제작한 $nationTurnBrief와 $generals를 이용하여 출력. div로 변경(사실상 새로 짜라!)
-for($k=0; $k < 2; $k++) {
- $l4 = 12 - $k; $l3 = 10 - $k; $l2 = 8 - $k; $l1 = 6 - $k;
-
- if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; }
- elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "".($gen[$l4]['name']??'').""; }
- if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; }
- elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "".($gen[$l3]['name']??'').""; }
- if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; }
- elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "".($gen[$l2]['name']??'').""; }
- if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; }
- elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "".($gen[$l1]['name']??'').""; }
-
- echo "
- |
- | . |
- ".getLevel($l4, $nationLevel)." : ".($gen[$l4]['name']??'')." |
- ".getLevel($l3, $nationLevel)." : ".($gen[$l3]['name']??'')." |
- ".getLevel($l2, $nationLevel)." : ".($gen[$l2]['name']??'')." |
- ".getLevel($l1, $nationLevel)." : ".($gen[$l1]['name']??'')." |
- . |
+| 수뇌부 일정 |
+
+
+ | . |
+ - : |
+ - : |
+ - : |
+ - : |
+ . |
+
+
+
+
+ |
+ - |
+ |
+ - |
+ |
+ - |
+ |
+ - |
+
- ";
-
- for($i=0; $i < 12; $i++) {
- $turndate[$l4] = substr($totaldate[$l4]??'', 11, 5);
- $turndate[$l3] = substr($totaldate[$l3]??'', 11, 5);
- $turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
- $turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
- $j = $i + 1;
- $td4 = $turndate[$l4]??"-";
- $td3 = $turndate[$l3]??"-";
- $td2 = $turndate[$l2]??"-";
- $td1 = $turndate[$l1]??"-";
- $tn4 = $turn[$l4][$i]??"-";
- $tn3 = $turn[$l3][$i]??"-";
- $tn2 = $turn[$l2][$i]??"-";
- $tn1 = $turn[$l1][$i]??"-";
- echo "
-
- | $j |
- $td4 |
- $tn4 |
- $td3 |
- $tn3 |
- $td2 |
- $tn2 |
- $td1 |
- $tn1 |
- $j |
+
+
+ |
+ =chiefTurnTable()?>
+ |
+
+ ;color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
+ ;color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
+
+ =chiefCommandTable()?>
+
+ |
+
+
+ | . |
+ - : |
+ - : |
+ - : |
+ - : |
+ . |
+
+
+
+
+ |
+ - |
+ |
+ - |
+ |
+ - |
+ |
+ - |
+
- ";
- if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
- if($totaldate[$l3]??'') { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
- if($totaldate[$l2]??'') { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
- if($totaldate[$l1]??'') { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
- }
- if($k == 0) {
- echo "";
- }
-}
-
-?>
+
+
| =backButton()?> |
diff --git a/hwe/css/battle_simulator.css b/hwe/css/battle_simulator.css
index a7539a41..732a90a3 100644
--- a/hwe/css/battle_simulator.css
+++ b/hwe/css/battle_simulator.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
#container{
width:1024px;
margin:auto;
diff --git a/hwe/css/chiefCenter.css b/hwe/css/chiefCenter.css
new file mode 100644
index 00000000..eb2b14e0
--- /dev/null
+++ b/hwe/css/chiefCenter.css
@@ -0,0 +1,55 @@
+@charset "UTF-8";
+
+#chiefTurnSelector{
+ width:50px;
+ color:white;
+ background-color:black;
+ font-size:13px;
+}
+
+
+.chiefTurnTable{
+ display:flex;
+ flex-flow:row nowrap;
+}
+
+.chiefTurnTable .flexDisplay{
+ justify-content: center;
+}
+
+.chiefTurnBox{
+ width:240px;
+}
+
+.chiefTurnBox .turnHeader{
+ font-weight: bold;
+ text-align: center;
+}
+
+.chiefTurnBox .turnList{
+
+}
+
+.chiefNamePlate{
+ font-weight: bold;
+ text-align: center;
+
+}
+
+.turnIdxHeader{
+ font-weight: bold;
+ text-align: center;
+ width:20px;
+}
+
+.chiefTurnTime{
+ font-weight: bold;
+ background: black;
+ text-align: center;
+ width:43px;
+}
+
+.chiefTurnText{
+ table-layout: fixed;
+ width:192px;
+}
\ No newline at end of file
diff --git a/hwe/css/dipcenter.css b/hwe/css/dipcenter.css
index a6f787cb..e05cabb7 100644
--- a/hwe/css/dipcenter.css
+++ b/hwe/css/dipcenter.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
#scoutMsgForm .viewer{
max-height:200px;
overflow: hidden;
diff --git a/hwe/css/hallOfFame.css b/hwe/css/hallOfFame.css
index dc3caffa..6ccb3da0 100644
--- a/hwe/css/hallOfFame.css
+++ b/hwe/css/hallOfFame.css
@@ -1,3 +1,4 @@
+@charset "UTF-8";
.rankView {
width:1100px;
diff --git a/hwe/css/main.css b/hwe/css/main.css
index 05cee077..c5b9c91b 100644
--- a/hwe/css/main.css
+++ b/hwe/css/main.css
@@ -67,4 +67,11 @@ color:white;
.nation_info td{
height:18px;
+}
+
+#generalTurnSelector{
+ width:50px;
+ color:white;
+ background-color:black;
+ font-size:13px;
}
\ No newline at end of file
diff --git a/hwe/css/map.css b/hwe/css/map.css
index 935458c6..bb82e79a 100644
--- a/hwe/css/map.css
+++ b/hwe/css/map.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
.world_map{
width:700px;
background:black;
diff --git a/hwe/css/select_npc.css b/hwe/css/select_npc.css
index bced4ddb..9c51541a 100644
--- a/hwe/css/select_npc.css
+++ b/hwe/css/select_npc.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
.container{
width:1000px;
margin:0 auto;
diff --git a/hwe/css/troops.css b/hwe/css/troops.css
index 060d2d1c..d86a7477 100644
--- a/hwe/css/troops.css
+++ b/hwe/css/troops.css
@@ -1,3 +1,5 @@
+@charset "UTF-8";
+
#troop_list .cityText{
display:none;
}
diff --git a/hwe/func.php b/hwe/func.php
index 0d08c2f3..e82cef61 100644
--- a/hwe/func.php
+++ b/hwe/func.php
@@ -485,7 +485,7 @@ function printCommandTable() {
get();
diff --git a/hwe/func_command.php b/hwe/func_command.php
index 101787be..c9444d45 100644
--- a/hwe/func_command.php
+++ b/hwe/func_command.php
@@ -83,7 +83,7 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
if($turnCnt < 0){
pullNationCommand($nationID, $level, -$turnCnt);
}
- if($turnCnt >= GameConst::$maxNationTurn){
+ if($turnCnt >= GameConst::$maxChiefTurn){
return;
}
@@ -93,10 +93,10 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
], 'nation_id=%i AND level=%i', $nationID, $level);
$db->update('general_turn', [
- 'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxNationTurn),
+ 'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
'action'=>'휴식',
'arg'=>'{}'
- ], 'nation_id=%i AND level=%i AND turn_idx >= %i', $nationID, $level, GameConst::$maxNationTurn);
+ ], 'nation_id=%i AND level=%i AND turn_idx >= %i', $nationID, $level, GameConst::$maxChiefTurn);
}
function pullNationCommand(int $nationID, int $level, int $turnCnt=1){
@@ -112,14 +112,14 @@ function pullNationCommand(int $nationID, int $level, int $turnCnt=1){
if($turnCnt < 0){
pushNationCommand($nationID, $level, -$turnCnt);
}
- if($turnCnt >= GameConst::$maxNationTurn){
+ if($turnCnt >= GameConst::$maxChiefTurn){
return;
}
$db = DB::db();
$db->update('general_turn', [
- 'turn_idx'=>$db->sqleval('turn_idx + %i', GameConst::$maxNationTurn),
+ 'turn_idx'=>$db->sqleval('turn_idx + %i', GameConst::$maxChiefTurn),
'action'=>'휴식',
'arg'=>'{}'
], 'nation_id=%i AND level=%i AND turn_idx < %i', $nationID, $level, $turnCnt);
diff --git a/hwe/func_converter.php b/hwe/func_converter.php
index d45593d2..d27e8bde 100644
--- a/hwe/func_converter.php
+++ b/hwe/func_converter.php
@@ -925,7 +925,23 @@ function getItemCost($weap) : int {
return $weapcost;
}
-
+function getNameColor(int $npcType):?string{
+ if($npcType >= 2){
+ return 'cyan';
+ }
+ if($npcType == 1){
+ return 'skyblue';
+ }
+ return null;
+}
+function getColoredName(string $name, int $npcType):string{
+ $color = nameColor($npcType);
+ if($color === null){
+ return $name;
+ }
+ //TODO: font 폐기.
+ return "{$name}";
+}
function ConvertLog(?string $str, $type=1) : string {
if(!$str){
diff --git a/hwe/func_template.php b/hwe/func_template.php
index 669298b6..a4d5a933 100644
--- a/hwe/func_template.php
+++ b/hwe/func_template.php
@@ -12,54 +12,39 @@ namespace sammo;
function turnTable() {
+
+ $turnList = [];
+ $turnList[] = "";
+ foreach(range(1, GameConst::$maxTurn - 1) as $turnIdx){
+ $turnText = $turnIdx + 1;
+ $turnList[] = "";
+ }
+
+ $turnText = join("\n", $turnList);
+
return "
-
diff --git a/hwe/j_getChiefTurn.php b/hwe/j_getChiefTurn.php
new file mode 100644
index 00000000..4236d234
--- /dev/null
+++ b/hwe/j_getChiefTurn.php
@@ -0,0 +1,80 @@
+setReadOnly();
+$userID = Session::getUserID();
+
+$db = DB::db();
+$gameStor = KVStorage::getStorage($db, 'game_env');
+
+increaseRefresh("사령부", 1);
+
+$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong FROM general WHERE owner=%i', $userID);
+
+[$nationLevel, $secretLimit] = $db->queryFirstList('SELECT level, secretlimit FROM nation WHERE nation = %i', $me['nation']);
+
+$con = checkLimit($me['con']);
+if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
+
+if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $secretLimit)) {
+ Json::die([
+ 'result'=>false,
+ 'reason'=>'수뇌부가 아니거나 사관년도가 부족합니다'
+ ]);
+}
+
+$date = TimeUtil::now();
+
+// 명령 목록
+[$year, $month, $turnterm] = $gameStor->getValuesAsArray(['year', 'month', 'turnterm']);
+$lv = getNationChiefLevel($nationLevel);
+$turn = [];
+
+$generals = [];
+foreach($db->query('SELECT no,name,turntime,npc,city,nation,level FROM general WHERE nation = %i AND level >= 5') as $rawGeneral){
+ $generals[$rawGeneral['level']] = new General($rawGeneral, null, $year, $month, false);
+}
+
+$nationTurnList = [];
+
+foreach(
+ $db->queryAllLists(
+ 'SELECT level, turn_idx, action, arg FROM nation_turn WHERE nation_id = %i ORDER BY level DESC, turn_idx ASC',
+ $me['nation']
+ ) as [$level, $turn_idx, $action, $arg]
+){
+ if(!key_exists($level, $nationTurnList)){
+ $nationTurnList[$level] = [];
+ }
+ $nationTurnList[$level][$turn_idx] = [$action, Json::decode($arg)];
+}
+
+$nationTurnBrief = [];
+foreach($nationTurnList as $level=>$turnList){
+ if(!key_exists($level, $generals)){
+ $general = Util::array_first($generals);
+ }
+ else{
+ $general = $generals[$level];
+ }
+ $nationTurnBrief[$level] = [
+ 'name'=>$general->getName(),
+ 'turnTime'=>substr($general->getVar('turntime'), 11, 5),
+ 'levelText'=>getLevel($general->getVar('level'), $nationLevel),
+ 'npcType'=>$general->getVar('npc'),
+ 'turn'=>getNationTurnBrief($general, $turnList)
+ ];
+}
+
+$date = substr(TimeUtil::now(), 14);
+
+Json::die([
+ 'result'=>true,
+ 'reason'=>'success',
+ 'date'=>$date,
+ 'nationTurnBrief'=>$nationTurnBrief,
+ 'isChief'=>($me['level'] > 4)
+]);
\ No newline at end of file
diff --git a/hwe/js/main.js b/hwe/js/main.js
index ed502349..e69de29b 100644
--- a/hwe/js/main.js
+++ b/hwe/js/main.js
@@ -1,85 +0,0 @@
-
-if (document.all) {
- document.onkeydown = function () {
- var key_f5 = 116; // 116 = F5
- var key_enter = 13; // 13 = 엔터
- if (key_f5 == event.keyCode) {
- event.keyCode=0;
- refreshing(null, 0,0);
- return false;
- } else if(key_enter == event.keyCode) {
- event.keyCode=0;
- refreshing(null, 4,message);
- return false;
- }
- return true;
- }
-}
-
-function refreshing(obj, arg1, arg2) {
- if(obj !== null){
- var $obj = $(obj);
- if($obj.find('button:disabled').length > 0){
- console.log('locked');
- return;
- }
- }
-// if(term <= 0) {
- switch(arg1) {
- case 0: location.reload(); break;
- case 1: go(arg2); break;
- case 2: turn(arg2); break;
- case 3: arg2.submit(); break;
- case 4:
- arg2.submit();
- message.msg.value = "";
- document.getElementById("msg").value = "";
- message.msg.focus();
- break;
- }
-}
-
-function moveProcessing(commandtype, turn){
- console.log(commandtype, turn);
- $.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post');
-}
-
-function go(type) {
- if(type == 1) location.replace('b_nationboard.php');
- else if(type == 2) location.replace('b_troop.php');
- else if(type == 3) location.replace('b_nationrule.php');
- else if(type == 4) location.replace('b_chiefboard.php');
- else if(type == 5) location.replace('b_chiefcenter.php');
- else if(type == 6) window.open('b_genList.php');
- else if(type == 7) location.replace('b_myKingdomInfo.php');
- else if(type == 8) location.replace('b_myCityInfo.php');
- else if(type == 9) location.replace('b_myGenInfo.php');
- else if(type == 10) location.replace('b_myBossInfo.php');
- else if(type == 11) location.replace('b_currentCity.php');
- else if(type == 12) location.replace('b_myPage.php');
- else if(type == 13) location.replace('b_dipcenter.php');
- else if(type == 14) location.replace('b_diplomacy.php');
- else if(type == 15) window.open('b_tournament.php');
- else if(type == 16) window.open('b_betting.php');
- else if(type == 17) window.open('b_auction.php');
- else if(type == 18) window.open('b_battleCenter.php');
-}
-
-function turn(type) {
- num = form2.sel.value;
- commandlist.location.replace('turn.php?type=' + type + '&sel=' + num);
-}
-
-jQuery(function($){
- $('#message').submit(function(event){
- var $this = $(this);
- var target = $('[name="genlist"]').val();
- var msg = $('#msg').val();
- console.log(target, msg);
- return false;
- });
-
- $('#mainBtnSubmit').click(function(){
-
- });
-});
\ No newline at end of file
diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php
index d7e35a26..6f6fea3d 100644
--- a/hwe/sammo/GameConstBase.php
+++ b/hwe/sammo/GameConstBase.php
@@ -98,7 +98,7 @@ class GameConstBase
/** @var int 최대 턴 */
public static $maxTurn = 30;
- public static $maxNationTurn = 12;
+ public static $maxChiefTurn = 12;
public static $statGradeLevel = 5;