사령부 밀기 당기기 추가, 기존 코드 삭제

This commit is contained in:
2020-03-08 13:26:56 +09:00
parent d291d38b38
commit d7989ab34d
9 changed files with 67 additions and 88 deletions
+2 -2
View File
@@ -67,8 +67,8 @@ var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
?></div
><div style='width:400px;display: flex;justify-content: center;flex-direction: column;'
><div
><input type='button' id='turnPush' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='미루기▼' onclick='turn(0)'
><input type='button' id='turnPull' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='▲당기기' onclick='turn(1)'
><input type='button' id='turnPush' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='미루기▼'
><input type='button' id='turnPull' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='▲당기기'
></div
><div
><?=chiefCommandTable($generalObj)
+1 -1
View File
@@ -130,7 +130,7 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
$db->update('nation_turn', [
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
], 'nation_id=%i AND level=%i', $nationID, $level);
], 'nation_id=%i AND level=%i ORDER BY turn_idx DESC', $nationID, $level);
$db->update('nation_turn', [
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
'action'=>'휴식',
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$turnAmount = Util::getReq('amount', 'int');
$db = DB::db();
$me = $db->queryFirstRow('SELECT no,nation,level FROM general WHERE owner=%i', $userID);
if($me['nation'] == 0){
Json::die([
'result'=>false,
'reason'=>'국가에 소속되어 있지 않습니다.',
]);
}
if($me['level'] < 5){
Json::die([
'result'=>false,
'reason'=>'수뇌가 아닙니다.',
]);
}
if($turnAmount > 0){
pushNationCommand($me['nation'], $me['level']);
}
else{
pullNationCommand($me['nation'], $me['level']);
}
Json::die([
'result'=>true,
'reason'=>'success',
]);
+23
View File
@@ -117,6 +117,21 @@ function reserveTurn(turnList, command){
}, errUnknown);
}
function pushTurn(turnCnt){
$.post({
url:'j_chief_turn.php',
dataType:'json',
data:{
amount:turnCnt
}
}).then(function(data){
if(!data.result){
alert(data.reason);
}
reloadTable();
}, errUnknown);
}
jQuery(function($){
chiefTableObj= genChiefTableObj();
@@ -138,5 +153,13 @@ $('#setCommand').click(function(){
}
return false;
});
$('#turnPush').click(function(){
pushTurn(1);
});
$('#turnPull').click(function(){
pushTurn(-1);
});
})
+2 -2
View File
@@ -75,7 +75,7 @@ function myclock() {
function pushTurn(pushAmount){
$.post({
url:'j_turn.php',
url:'j_general_turn.php',
dataType:'json',
data:{
amount:pushAmount
@@ -90,7 +90,7 @@ function pushTurn(pushAmount){
function repeatTurn(repeatAmount){
$.post({
url:'j_turn.php',
url:'j_general_turn.php',
dataType:'json',
data:{
amount:repeatAmount,
-49
View File
@@ -1,49 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$type = Util::getReq('type', 'int', 0);
$sel = Util::getReq('sel', 'int', 1);
if($sel <= 0 || $sel > 12){
$sel = 1;
}
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$generalID = $session->generalID;
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("턴반복", 1);
$myActionCnt = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', $userID);
$con = checkLimit($myActionCnt);
if($con >= 2) {
header('location:commandlist.php', true, 303);
exit();
}
switch($type) {
case 0://반복
$valueMap = [];
foreach(range($sel, GameConst::$maxTurn - 1) as $idx){
$src = $idx % $sel;
$valueMap['turn'.$idx] = $db->sqleval('%b', 'turn'.$src);
}
$db->update('general', $valueMap, 'owner=%i', $userID);
break;
case 1://미루기
pushGeneralCommand($generalID, $sel);
break;
case 2://당기기
pullGeneralCommand($generalID, $sel);
break;
}
header('location:commandlist.php', true, 303);
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$me = $db->queryFirstRow('SELECT no,nation,level FROM general WHERE owner=%i', $userID);
if($me['level'] >= 5 && $me['nation'] > 0){
pullNationCommand($me['nation'], $me['level']);
}
header('location:b_chiefcenter.php', true, 303);
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$me = $db->queryFirstRow('SELECT no,nation,level FROM general WHERE owner=%i', $userID);
if($me['level'] >= 5 && $me['nation'] > 0){
pushNationCommand($me['nation'], $me['level']);
}
header('location:b_chiefcenter.php', true, 303);