사령부 밀기 당기기 추가, 기존 코드 삭제
This commit is contained in:
@@ -67,8 +67,8 @@ var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
|
|||||||
?></div
|
?></div
|
||||||
><div style='width:400px;display: flex;justify-content: center;flex-direction: column;'
|
><div style='width:400px;display: flex;justify-content: center;flex-direction: column;'
|
||||||
><div
|
><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='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='▲당기기' onclick='turn(1)'
|
><input type='button' id='turnPull' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='▲당기기'
|
||||||
></div
|
></div
|
||||||
><div
|
><div
|
||||||
><?=chiefCommandTable($generalObj)
|
><?=chiefCommandTable($generalObj)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
|||||||
|
|
||||||
$db->update('nation_turn', [
|
$db->update('nation_turn', [
|
||||||
'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 ORDER BY turn_idx DESC', $nationID, $level);
|
||||||
$db->update('nation_turn', [
|
$db->update('nation_turn', [
|
||||||
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
|
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
|
||||||
'action'=>'휴식',
|
'action'=>'휴식',
|
||||||
|
|||||||
@@ -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',
|
||||||
|
]);
|
||||||
@@ -117,6 +117,21 @@ function reserveTurn(turnList, command){
|
|||||||
}, errUnknown);
|
}, 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($){
|
jQuery(function($){
|
||||||
|
|
||||||
chiefTableObj= genChiefTableObj();
|
chiefTableObj= genChiefTableObj();
|
||||||
@@ -139,4 +154,12 @@ $('#setCommand').click(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#turnPush').click(function(){
|
||||||
|
pushTurn(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#turnPull').click(function(){
|
||||||
|
pushTurn(-1);
|
||||||
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
+2
-2
@@ -75,7 +75,7 @@ function myclock() {
|
|||||||
|
|
||||||
function pushTurn(pushAmount){
|
function pushTurn(pushAmount){
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_turn.php',
|
url:'j_general_turn.php',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
data:{
|
data:{
|
||||||
amount:pushAmount
|
amount:pushAmount
|
||||||
@@ -90,7 +90,7 @@ function pushTurn(pushAmount){
|
|||||||
|
|
||||||
function repeatTurn(repeatAmount){
|
function repeatTurn(repeatAmount){
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_turn.php',
|
url:'j_general_turn.php',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
data:{
|
data:{
|
||||||
amount:repeatAmount,
|
amount:repeatAmount,
|
||||||
|
|||||||
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
Reference in New Issue
Block a user