사령부 UI 간결화, (구현은 아직), 일부 변수명 변경
This commit is contained in:
+60
-148
@@ -7,64 +7,6 @@ include "func.php";
|
|||||||
$session = Session::requireGameLogin()->setReadOnly();
|
$session = Session::requireGameLogin()->setReadOnly();
|
||||||
$userID = Session::getUserID();
|
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -79,107 +21,77 @@ foreach($nationTurnList as $level=>$turnList){
|
|||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
<?=WebUtil::printCSS('css/common.css')?>
|
||||||
|
<?=WebUtil::printCSS('css/chiefCenter.css')?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function turn(type) {
|
var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
|
||||||
if(type == 0) location.replace('turn_push_core.php');
|
|
||||||
else if(type == 1) location.replace('turn_pop_core.php');
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr><td>사 령 부<input type=button value='갱신' onclick=location.replace('b_chiefcenter.php')><br><?=backButton()?></td></tr>
|
<tr><td>사 령 부<input id='refreshChiefTurn' type=button value='갱신'><br><?=backButton()?></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr><td colspan=10 align=center bgcolor=skyblue>수뇌부 일정</td></tr>
|
<thead><tr><td colspan=10 align=center bgcolor=skyblue>수뇌부 일정</td></tr></thead>
|
||||||
<tr><td colspan=10 align=center>
|
<tbody>
|
||||||
<?php
|
<tr>
|
||||||
$year = $admin['year'];
|
<td class='bg1 center'>.</td>
|
||||||
$month = $admin['month'];
|
<td colspan=2 class='bg1 chiefNamePlate level12'>- :</td>
|
||||||
$date = substr(TimeUtil::now(), 14);
|
<td colspan=2 class='bg1 chiefNamePlate level10'>- :</td>
|
||||||
|
<td colspan=2 class='bg1 chiefNamePlate level8'>- :</td>
|
||||||
$totaldate = [];
|
<td colspan=2 class='bg1 chiefNamePlate level6'>- :</td>
|
||||||
$turntime = [];
|
<td class='bg1 center'>.</td>
|
||||||
$turndate = [];
|
</tr>
|
||||||
|
<?php foreach([12, 10, 8, 6] as $turnIdx): ?>
|
||||||
for($i=12; $i >= $lv; $i--) {
|
<tr class='turnIdx<?=$turnIdx?>'>
|
||||||
$totaldate[$i] = $gen[$i]['turntime'];
|
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
||||||
$turntime[$i] = substr($gen[$i]['turntime'], 14);
|
<td class='chiefTurnTime level12'></td>
|
||||||
}
|
<td class='chiefTurnText level12 bg2'>-</td>
|
||||||
|
<td class='chiefTurnTime level10'></td>
|
||||||
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
|
<td class='chiefTurnText level10 bg2'>-</td>
|
||||||
//TODO: 새롭게 제작한 $nationTurnBrief와 $generals를 이용하여 출력. div로 변경(사실상 새로 짜라!)
|
<td class='chiefTurnTime level8'></td>
|
||||||
for($k=0; $k < 2; $k++) {
|
<td class='chiefTurnText level8 bg2'>-</td>
|
||||||
$l4 = 12 - $k; $l3 = 10 - $k; $l2 = 8 - $k; $l1 = 6 - $k;
|
<td class='chiefTurnTime level6'></td>
|
||||||
|
<td class='chiefTurnText level6 bg2'>-</td>
|
||||||
if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".($gen[$l4]['name']??'')."</font>"; }
|
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
||||||
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".($gen[$l4]['name']??'')."</font>"; }
|
|
||||||
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".($gen[$l3]['name']??'')."</font>"; }
|
|
||||||
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".($gen[$l3]['name']??'')."</font>"; }
|
|
||||||
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".($gen[$l2]['name']??'')."</font>"; }
|
|
||||||
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".($gen[$l2]['name']??'')."</font>"; }
|
|
||||||
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".($gen[$l1]['name']??'')."</font>"; }
|
|
||||||
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".($gen[$l1]['name']??'')."</font>"; }
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<tr>
|
|
||||||
<td align=center id=bg1>.</td>
|
|
||||||
<td colspan=2 align=center id=bg1><b>".getLevel($l4, $nationLevel)." : ".($gen[$l4]['name']??'')."</b></td>
|
|
||||||
<td colspan=2 align=center id=bg1><b>".getLevel($l3, $nationLevel)." : ".($gen[$l3]['name']??'')."</b></td>
|
|
||||||
<td colspan=2 align=center id=bg1><b>".getLevel($l2, $nationLevel)." : ".($gen[$l2]['name']??'')."</b></td>
|
|
||||||
<td colspan=2 align=center id=bg1><b>".getLevel($l1, $nationLevel)." : ".($gen[$l1]['name']??'')."</b></td>
|
|
||||||
<td align=center id=bg1>.</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
";
|
<?php endforeach; ?>
|
||||||
|
<tr>
|
||||||
for($i=0; $i < 12; $i++) {
|
<td colspan="5" style='text-align:right;'>
|
||||||
$turndate[$l4] = substr($totaldate[$l4]??'', 11, 5);
|
<?=chiefTurnTable()?>
|
||||||
$turndate[$l3] = substr($totaldate[$l3]??'', 11, 5);
|
</td>
|
||||||
$turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
|
<td colspan="5" style='text-align:left;'>
|
||||||
$turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
|
<input id='turnPush' type='hidden' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
|
||||||
$j = $i + 1;
|
<input id='turnPull' type='hidden' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
|
||||||
$td4 = $turndate[$l4]??"-";
|
<br>
|
||||||
$td3 = $turndate[$l3]??"-";
|
<?=chiefCommandTable()?>
|
||||||
$td2 = $turndate[$l2]??"-";
|
<input id='setCommand' type='hidden' style='background-color:<?=GameConst::$basecolor2?>;color:white;width:55px;font-size:13px;' value='실 행'>
|
||||||
$td1 = $turndate[$l1]??"-";
|
</td>
|
||||||
$tn4 = $turn[$l4][$i]??"-";
|
</tr>
|
||||||
$tn3 = $turn[$l3][$i]??"-";
|
<tr>
|
||||||
$tn2 = $turn[$l2][$i]??"-";
|
<td class='bg1 center'>.</td>
|
||||||
$tn1 = $turn[$l1][$i]??"-";
|
<td colspan=2 class='bg1 chiefNamePlate level12'>- :</td>
|
||||||
echo "
|
<td colspan=2 class='bg1 chiefNamePlate level10'>- :</td>
|
||||||
<tr>
|
<td colspan=2 class='bg1 chiefNamePlate level8'>- :</td>
|
||||||
<td width=20 align=center id=bg0><b>$j</b></td>
|
<td colspan=2 class='bg1 chiefNamePlate level6'>- :</td>
|
||||||
<td width=43 align=center bgcolor=black><b>$td4</b></td>
|
<td class='bg1 center'>.</td>
|
||||||
<td width=192 align=center height=24 style=table-layout:fixed; id=bg2>$tn4</td>
|
</tr>
|
||||||
<td width=43 align=center bgcolor=black><b>$td3</b></td>
|
<?php foreach([11, 9, 7, 5] as $turnIdx): ?>
|
||||||
<td width=192 align=center height=24 style=table-layout:fixed; id=bg2>$tn3</td>
|
<tr class='turnIdx<?=$turnIdx?>'>
|
||||||
<td width=43 align=center bgcolor=black><b>$td2</b></td>
|
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
||||||
<td width=192 align=center height=24 style=table-layout:fixed; id=bg2>$tn2</td>
|
<td class='chiefTurnTime level11'></td>
|
||||||
<td width=43 align=center bgcolor=black><b>$td1</b></td>
|
<td class='chiefTurnText level11 bg2'>-</td>
|
||||||
<td width=192 align=center height=24 style=table-layout:fixed; id=bg2>$tn1</td>
|
<td class='chiefTurnTime level9'></td>
|
||||||
<td width=20 align=center id=bg0><b>$j</b></td>
|
<td class='chiefTurnText level9 bg2'>-</td>
|
||||||
|
<td class='chiefTurnTime level7'></td>
|
||||||
|
<td class='chiefTurnText level7 bg2'>-</td>
|
||||||
|
<td class='chiefTurnTime level5'></td>
|
||||||
|
<td class='chiefTurnText level5 bg2'>-</td>
|
||||||
|
<td class='bg0 center turnIdxHeader'><?=($turnIdx+1)?></td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
<?php endforeach; ?>
|
||||||
if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
|
</tbody>
|
||||||
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 "<form action=processing.php method=post><tr><td colspan=5 align=right>";
|
|
||||||
echo CoreTurnTable();
|
|
||||||
echo "</td><td colspan=5>
|
|
||||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
|
|
||||||
<input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
|
|
||||||
<br>";
|
|
||||||
CoreCommandTable();
|
|
||||||
echo "<input type={$btn} style=background-color:".GameConst::$basecolor2.";color:white;width:55px;font-size:13px; value='실 행'></td></tr></form>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</table>
|
</table>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr><td><?=backButton()?></td></tr>
|
<tr><td><?=backButton()?></td></tr>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
#container{
|
#container{
|
||||||
width:1024px;
|
width:1024px;
|
||||||
margin:auto;
|
margin:auto;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
#scoutMsgForm .viewer{
|
#scoutMsgForm .viewer{
|
||||||
max-height:200px;
|
max-height:200px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
.rankView {
|
.rankView {
|
||||||
width:1100px;
|
width:1100px;
|
||||||
|
|||||||
@@ -67,4 +67,11 @@ color:white;
|
|||||||
|
|
||||||
.nation_info td{
|
.nation_info td{
|
||||||
height:18px;
|
height:18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#generalTurnSelector{
|
||||||
|
width:50px;
|
||||||
|
color:white;
|
||||||
|
background-color:black;
|
||||||
|
font-size:13px;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
.world_map{
|
.world_map{
|
||||||
width:700px;
|
width:700px;
|
||||||
background:black;
|
background:black;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
.container{
|
.container{
|
||||||
width:1000px;
|
width:1000px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
#troop_list .cityText{
|
#troop_list .cityText{
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -485,7 +485,7 @@ function printCommandTable() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
function CoreCommandTable() {
|
function chiefCommandTable() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
$connect=$db->get();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
|||||||
if($turnCnt < 0){
|
if($turnCnt < 0){
|
||||||
pullNationCommand($nationID, $level, -$turnCnt);
|
pullNationCommand($nationID, $level, -$turnCnt);
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxNationTurn){
|
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,10 +93,10 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
|||||||
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
|
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
|
||||||
], 'nation_id=%i AND level=%i', $nationID, $level);
|
], 'nation_id=%i AND level=%i', $nationID, $level);
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxNationTurn),
|
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
|
||||||
'action'=>'휴식',
|
'action'=>'휴식',
|
||||||
'arg'=>'{}'
|
'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){
|
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){
|
if($turnCnt < 0){
|
||||||
pushNationCommand($nationID, $level, -$turnCnt);
|
pushNationCommand($nationID, $level, -$turnCnt);
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxNationTurn){
|
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'turn_idx'=>$db->sqleval('turn_idx + %i', GameConst::$maxNationTurn),
|
'turn_idx'=>$db->sqleval('turn_idx + %i', GameConst::$maxChiefTurn),
|
||||||
'action'=>'휴식',
|
'action'=>'휴식',
|
||||||
'arg'=>'{}'
|
'arg'=>'{}'
|
||||||
], 'nation_id=%i AND level=%i AND turn_idx < %i', $nationID, $level, $turnCnt);
|
], 'nation_id=%i AND level=%i AND turn_idx < %i', $nationID, $level, $turnCnt);
|
||||||
|
|||||||
+17
-1
@@ -925,7 +925,23 @@ function getItemCost($weap) : int {
|
|||||||
return $weapcost;
|
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 "<font color='{$color}'>{$name}</font>";
|
||||||
|
}
|
||||||
|
|
||||||
function ConvertLog(?string $str, $type=1) : string {
|
function ConvertLog(?string $str, $type=1) : string {
|
||||||
if(!$str){
|
if(!$str){
|
||||||
|
|||||||
+28
-43
@@ -12,54 +12,39 @@ namespace sammo;
|
|||||||
|
|
||||||
|
|
||||||
function turnTable() {
|
function turnTable() {
|
||||||
|
|
||||||
|
$turnList = [];
|
||||||
|
$turnList[] = "<option selected value='0'>1턴</option>";
|
||||||
|
foreach(range(1, GameConst::$maxTurn - 1) as $turnIdx){
|
||||||
|
$turnText = $turnIdx + 1;
|
||||||
|
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$turnText = join("\n", $turnList);
|
||||||
|
|
||||||
return "
|
return "
|
||||||
<select name=turn[] size=11 multiple style=width:50px;color:white;background-color:black;font-size:13px;>
|
<select id='generalTurnSelector' name=turn[] size=11 multiple>
|
||||||
<option value=100>전체</option>
|
<option value='-3'>전체</option>
|
||||||
<option value=99>홀턴</option>
|
<option value='-1'>홀턴</option>
|
||||||
<option value=98>짝턴</option>
|
<option value='-2'>짝턴</option>
|
||||||
<option selected value=0> 1턴</option>
|
{$turnText}
|
||||||
<option value=1> 2턴</option>
|
|
||||||
<option value=2> 3턴</option>
|
|
||||||
<option value=3> 4턴</option>
|
|
||||||
<option value=4> 5턴</option>
|
|
||||||
<option value=5> 6턴</option>
|
|
||||||
<option value=6> 7턴</option>
|
|
||||||
<option value=7> 8턴</option>
|
|
||||||
<option value=8> 9턴</option>
|
|
||||||
<option value=9>10턴</option>
|
|
||||||
<option value=10>11턴</option>
|
|
||||||
<option value=11>12턴</option>
|
|
||||||
<option value=12>13턴</option>
|
|
||||||
<option value=13>14턴</option>
|
|
||||||
<option value=14>15턴</option>
|
|
||||||
<option value=15>16턴</option>
|
|
||||||
<option value=16>17턴</option>
|
|
||||||
<option value=17>18턴</option>
|
|
||||||
<option value=18>19턴</option>
|
|
||||||
<option value=19>20턴</option>
|
|
||||||
<option value=20>21턴</option>
|
|
||||||
<option value=21>22턴</option>
|
|
||||||
<option value=22>23턴</option>
|
|
||||||
<option value=23>24턴</option>
|
|
||||||
</select>
|
</select>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
function CoreTurnTable() {
|
function chiefTurnTable() {
|
||||||
return "
|
$turnList = [];
|
||||||
<select name=turn[] size=3 multiple style=color:white;background-color:black;font-size:13px;>
|
$turnList[] = "<option selected value='0'>1턴</option>";
|
||||||
<option selected value=0> 1턴</option>
|
foreach(range(1, GameConst::$maxChiefTurn - 1) as $turnIdx){
|
||||||
<option value=1> 2턴</option>
|
$turnText = $turnIdx + 1;
|
||||||
<option value=2> 3턴</option>
|
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
|
||||||
<option value=3> 4턴</option>
|
}
|
||||||
<option value=4> 5턴</option>
|
|
||||||
<option value=5> 6턴</option>
|
$turnText = join("\n", $turnList);
|
||||||
<option value=6> 7턴</option>
|
|
||||||
<option value=7> 8턴</option>
|
return "
|
||||||
<option value=8> 9턴</option>
|
<select id='chiefTurnSelector' name=turn[] size=3 multiple>
|
||||||
<option value=9>10턴</option>
|
{$turnText}
|
||||||
<option value=10>11턴</option>
|
|
||||||
<option value=11>12턴</option>
|
|
||||||
</select>
|
</select>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,6 @@ else if($session->userGrade == 4){
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<form name=form2 action=preprocessing.php method=post target=commandlist>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan=3 width=50 valign=top><?=turnTable()?></td>
|
<td rowspan=3 width=50 valign=top><?=turnTable()?></td>
|
||||||
<td style="width:650px;border:none;text-align:center;"><?php cityInfo(); ?></td>
|
<td style="width:650px;border:none;text-align:center;"><?php cityInfo(); ?></td>
|
||||||
@@ -272,7 +271,6 @@ else if($session->userGrade == 4){
|
|||||||
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick=location.replace('../')><br>
|
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick=location.replace('../')><br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
<table class="tb_layout bg0" style="width:1000px;">
|
<table class="tb_layout bg0" style="width:1000px;">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
include "lib.php";
|
||||||
|
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)) {
|
||||||
|
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)
|
||||||
|
]);
|
||||||
@@ -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(){
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -98,7 +98,7 @@ class GameConstBase
|
|||||||
|
|
||||||
/** @var int 최대 턴 */
|
/** @var int 최대 턴 */
|
||||||
public static $maxTurn = 30;
|
public static $maxTurn = 30;
|
||||||
public static $maxNationTurn = 12;
|
public static $maxChiefTurn = 12;
|
||||||
|
|
||||||
public static $statGradeLevel = 5;
|
public static $statGradeLevel = 5;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user