기본 커맨드 입력 가능하도록 구현
This commit is contained in:
+2
-1
@@ -430,6 +430,7 @@ function printCommandTable(General $generalObj) {
|
|||||||
<select id='generalCommandList' name='commandtype' size=1 style='height:20px;width:260px;color:white;background-color:black;font-size:12px;'>";
|
<select id='generalCommandList' name='commandtype' size=1 style='height:20px;width:260px;color:white;background-color:black;font-size:12px;'>";
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
//보정(Pros,Cons) 여부.
|
||||||
$getCompensateClassName = function($value){
|
$getCompensateClassName = function($value){
|
||||||
if($value > 0){
|
if($value > 0){
|
||||||
return 'compensatePositive';
|
return 'compensatePositive';
|
||||||
@@ -452,7 +453,7 @@ function printCommandTable(General $generalObj) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<option
|
<option
|
||||||
class='commandBasic <?=$commandObj->getCompensationStyle()?> <?=$commandObj->isReservable()?'':'commandImpossible'?>'
|
class='commandBasic <?=$getCompensateClassName($commandObj->getCompensationStyle())?> <?=$commandObj->isReservable()?'':'commandImpossible'?>'
|
||||||
value='<?=Util::getClassNameFromObj($commandObj)?>'
|
value='<?=Util::getClassNameFromObj($commandObj)?>'
|
||||||
data-reqArg='<?=($commandObj::$reqArg)?'true':'false'?>'
|
data-reqArg='<?=($commandObj::$reqArg)?'true':'false'?>'
|
||||||
><?=$commandObj->getCommandDetailTitle()?><?=$commandObj->isReservable()?'':'(불가)'?></option>
|
><?=$commandObj->getCommandDetailTitle()?><?=$commandObj->isReservable()?'':'(불가)'?></option>
|
||||||
|
|||||||
+44
-19
@@ -29,7 +29,8 @@ function pushGeneralCommand(int $generalID, int $turnCnt=1){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($turnCnt < 0){
|
if($turnCnt < 0){
|
||||||
pullGeneralCommand($generalID, -$turnCnt);
|
pullGeneralCommand($generalID, -$turnCnt);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxTurn){
|
if($turnCnt >= GameConst::$maxTurn){
|
||||||
return;
|
return;
|
||||||
@@ -39,13 +40,13 @@ function pushGeneralCommand(int $generalID, int $turnCnt=1){
|
|||||||
|
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
|
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
|
||||||
], 'general_id=%i', $generalID);
|
], 'general_id=%i ORDER BY turn_idx DESC', $generalID);
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxTurn),
|
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxTurn),
|
||||||
'action'=>'휴식',
|
'action'=>'휴식',
|
||||||
'arg'=>'{}',
|
'arg'=>'{}',
|
||||||
'brief'=>'휴식'
|
'brief'=>'휴식'
|
||||||
], 'general_id=%i AND turn_idx >= %i ORDER BY turn_idx ASC', $generalID, GameConst::$maxTurn);
|
], 'general_id=%i AND turn_idx >= %i', $generalID, GameConst::$maxTurn);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pullGeneralCommand(int $generalID, int $turnCnt=1){
|
function pullGeneralCommand(int $generalID, int $turnCnt=1){
|
||||||
@@ -54,6 +55,7 @@ function pullGeneralCommand(int $generalID, int $turnCnt=1){
|
|||||||
}
|
}
|
||||||
if($turnCnt < 0){
|
if($turnCnt < 0){
|
||||||
pushGeneralCommand($generalID, -$turnCnt);
|
pushGeneralCommand($generalID, -$turnCnt);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxTurn){
|
if($turnCnt >= GameConst::$maxTurn){
|
||||||
return;
|
return;
|
||||||
@@ -84,6 +86,7 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
|||||||
}
|
}
|
||||||
if($turnCnt < 0){
|
if($turnCnt < 0){
|
||||||
pullNationCommand($nationID, $level, -$turnCnt);
|
pullNationCommand($nationID, $level, -$turnCnt);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxChiefTurn){
|
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||||
return;
|
return;
|
||||||
@@ -114,6 +117,7 @@ function pullNationCommand(int $nationID, int $level, int $turnCnt=1){
|
|||||||
}
|
}
|
||||||
if($turnCnt < 0){
|
if($turnCnt < 0){
|
||||||
pushNationCommand($nationID, $level, -$turnCnt);
|
pushNationCommand($nationID, $level, -$turnCnt);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if($turnCnt >= GameConst::$maxChiefTurn){
|
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||||
return;
|
return;
|
||||||
@@ -208,7 +212,9 @@ function setGeneralCommand(int $generalID, array $turnList, string $command, ?ar
|
|||||||
if(!is_int($turnIdx) || $turnIdx < 0 || $turnIdx >= GameConst::$maxTurn){
|
if(!is_int($turnIdx) || $turnIdx < 0 || $turnIdx >= GameConst::$maxTurn){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'올바른 턴이 아닙니다. : '.$turnIdx
|
'reason'=>'올바른 턴이 아닙니다. : '.$turnIdx,
|
||||||
|
'test'=>'turnIdx',
|
||||||
|
'target'=>$turnIdx,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +223,9 @@ function setGeneralCommand(int $generalID, array $turnList, string $command, ?ar
|
|||||||
if($argBasicTestResult !== null){
|
if($argBasicTestResult !== null){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'턴이 입력되지 않았습니다.'
|
'reason'=>'턴이 입력되지 않았습니다.',
|
||||||
|
'test'=>'checkCommandArg',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,28 +241,34 @@ function setGeneralCommand(int $generalID, array $turnList, string $command, ?ar
|
|||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>$e->getMessage(),
|
'reason'=>$e->getMessage(),
|
||||||
|
'test'=>'build',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
catch (\Exception $e){
|
catch (\Exception $e){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>$e->getCode().$e->getMessage()
|
'reason'=>$e->getCode().$e->getMessage(),
|
||||||
|
'test'=>'build',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$commandObj->isArgValid()){
|
if(!$commandObj->isArgValid()){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'arg_test'=>false,
|
'reason'=>'올바르지 않은 argument',
|
||||||
'reason'=>'올바르지 않은 argument'
|
'test'=>'isArgValid',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$commandObj->isReservable()){
|
if(!$commandObj->isReservable()){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'arg_test'=>true,
|
'reason'=>'예약 불가능한 커맨드 :'.$commandObj->testReservable(),
|
||||||
'reason'=>'예약 불가능한 커맨드 :'.$commandObj->testReservable()
|
'test'=>'isReservable',
|
||||||
|
'target'=>'command'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +277,6 @@ function setGeneralCommand(int $generalID, array $turnList, string $command, ?ar
|
|||||||
_setGeneralCommand($generalID, $turnList, $command, $arg, $brief);
|
_setGeneralCommand($generalID, $turnList, $command, $arg, $brief);
|
||||||
return [
|
return [
|
||||||
'result'=>true,
|
'result'=>true,
|
||||||
'arg_test'=>true,
|
|
||||||
'reason'=>'success'
|
'reason'=>'success'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -274,7 +287,9 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
|
|||||||
if(!is_int($turnIdx) || $turnIdx < 0 || $turnIdx >= GameConst::$maxChiefTurn){
|
if(!is_int($turnIdx) || $turnIdx < 0 || $turnIdx >= GameConst::$maxChiefTurn){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'올바른 턴이 아닙니다. : '.$turnIdx
|
'reason'=>'올바른 턴이 아닙니다. : '.$turnIdx,
|
||||||
|
'test'=>'turnIdx',
|
||||||
|
'target'=>$turnIdx,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +298,9 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
|
|||||||
if($argBasicTestResult !== null){
|
if($argBasicTestResult !== null){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'턴이 입력되지 않았습니다.'
|
'reason'=>'턴이 입력되지 않았습니다.',
|
||||||
|
'test'=>'checkCommandArg',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,32 +323,40 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
|
|||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>$e->getMessage(),
|
'reason'=>$e->getMessage(),
|
||||||
|
'test'=>'build',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
catch (\Exception $e){
|
catch (\Exception $e){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>$e->getCode().$e->getMessage()
|
'reason'=>$e->getCode().$e->getMessage(),
|
||||||
|
'test'=>'build',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$commandObj->isArgValid()){
|
if(!$commandObj->isArgValid()){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'arg_test'=>false,
|
'reason'=>'올바르지 않은 argument',
|
||||||
'reason'=>'올바르지 않은 argument'
|
'test'=>'isArgValid',
|
||||||
|
'target'=>'arg'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$commandObj->isReservable()){
|
if(!$commandObj->isReservable()){
|
||||||
return [
|
return [
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'arg_test'=>true,
|
'reason'=>'예약 불가능한 커맨드 :'.$commandObj->testReservable(),
|
||||||
'reason'=>'예약 불가능한 커맨드 :'.$commandObj->testReservable()
|
'test'=>'isReservable',
|
||||||
|
'target'=>'command'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
_setNationCommand($general->getNationID(), $general->getVar('level'), $turnList, $command, $arg);
|
$brief = $commandObj->getBrief();
|
||||||
|
|
||||||
|
_setNationCommand($general->getNationID(), $general->getVar('level'), $turnList, $command, $arg, $brief);
|
||||||
return [
|
return [
|
||||||
'result'=>true,
|
'result'=>true,
|
||||||
'arg_test'=>true,
|
'arg_test'=>true,
|
||||||
|
|||||||
+17
-5
@@ -270,7 +270,7 @@ else if($session->userGrade == 4){
|
|||||||
<tr>
|
<tr>
|
||||||
<td style='width:650px;' align=right>
|
<td style='width:650px;' align=right>
|
||||||
<font color=cyan><b>←</b> Ctrl, Shift, 드래그로 복수선택 가능 반복&수정<b>→</b></font>
|
<font color=cyan><b>←</b> Ctrl, Shift, 드래그로 복수선택 가능 반복&수정<b>→</b></font>
|
||||||
<select name=sel size=1 style=color:white;background-color:black;font-size:13px;>
|
<select id='repeatAmount' name=sel size=1 style=color:white;background-color:black;font-size:13px;>
|
||||||
<option value=1>1턴</option>
|
<option value=1>1턴</option>
|
||||||
<option value=2>2턴</option>
|
<option value=2>2턴</option>
|
||||||
<option value=3>3턴</option>
|
<option value=3>3턴</option>
|
||||||
@@ -283,13 +283,25 @@ else if($session->userGrade == 4){
|
|||||||
<option value=10>10턴</option>
|
<option value=10>10턴</option>
|
||||||
<option value=11>11턴</option>
|
<option value=11>11턴</option>
|
||||||
<option value=12>12턴</option>
|
<option value=12>12턴</option>
|
||||||
</select><input type=button style='background-color:<?=GameConst::$basecolor2?>;color:white;width:70px;font-size:13px;margin-left:1ch;margin-right:2ch;' value='반복' onclick='refreshing(this, 2,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px; value='▼미루기' onclick='refreshing(this, 2,1)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px; value='▲당기기' onclick='refreshing(this, 2,2)'>
|
</select
|
||||||
</td>
|
><input type=button value='반복' id='repeatTurn'
|
||||||
|
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:70px;font-size:13px;margin-left:1ch;margin-right:2ch;'
|
||||||
|
><input type=button value='▼미루기' id='pushTurn'
|
||||||
|
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
|
||||||
|
><input type=button value='▲당기기' id='pullTurn'
|
||||||
|
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
|
||||||
|
></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align=right style="'width:650px;border:none;">
|
<td align=right style="'width:650px;border:none;"><br>
|
||||||
<?php printCommandTable($generalObj)?>
|
<?php printCommandTable($generalObj)?>
|
||||||
<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 id='do_refresh' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick="location.replace('../')"><br>
|
<input type=button value='실 행' id="reserveTurn"
|
||||||
|
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
|
||||||
|
><input type=button value='갱 신' id='refreshPage'
|
||||||
|
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
|
||||||
|
><input type=button value='로비로' onclick="location.replace('../')"
|
||||||
|
style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px;
|
||||||
|
>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
@@ -8,40 +8,44 @@ $session = Session::requireGameLogin([])->setReadOnly();
|
|||||||
|
|
||||||
$generalID = $session->generalID;
|
$generalID = $session->generalID;
|
||||||
|
|
||||||
|
|
||||||
$action = Util::getReq('action', 'string');
|
$action = Util::getReq('action', 'string');
|
||||||
$arg = Json::decode(Util::getReq('arg', 'string'));
|
$arg = Json::decode(Util::getReq('arg', 'string'));
|
||||||
$turnList = Json::decode(Util::getReq('turnList', 'string'));
|
$turnList = Util::getReq('turnList', 'array_int');
|
||||||
|
|
||||||
if(!is_array($turnList) || !$turnList){
|
if(!is_array($turnList) || !$turnList){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'턴이 입력되지 않았습니다.'
|
'reason'=>'턴이 입력되지 않았습니다.',
|
||||||
|
'test'=>'post'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$action){
|
if(!$action){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'action이 입력되지 않았습니다.'
|
'reason'=>'action이 입력되지 않았습니다.',
|
||||||
|
'test'=>'post'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($arg === null || !is_array($arg)){
|
if(!in_array($action, Util::array_flatten(GameConst::$availableGeneralCommand))){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'올바른 arg 형태가 아닙니다.'
|
'reason'=>'사용할 수 없는 커맨드입니다.',
|
||||||
|
'test'=>'post'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = setGeneralCommand($generalID, $turnList, $action, $arg);
|
if($arg === null){
|
||||||
if(!key_exists('result', $result)){
|
$arg = [];
|
||||||
$result['result'] = false;
|
|
||||||
}
|
}
|
||||||
if(!key_exists('arg_test', $result)){
|
|
||||||
$result['arg_test'] = false;
|
if(!is_array($arg)){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'올바른 arg 형태가 아닙니다.',
|
||||||
|
'test'=>'post'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
if(!key_exists('reason', $result)){
|
|
||||||
throw new MustNotBeReachedException('reason이 왜 없어?');
|
Json::die(setGeneralCommand($generalID, $turnList, $action, $arg));
|
||||||
}
|
|
||||||
Json::die($result);
|
|
||||||
+25
-1
@@ -6,4 +6,28 @@ include "func.php";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$session = Session::requireGameLogin([])->setReadOnly();
|
$session = Session::requireGameLogin([])->setReadOnly();
|
||||||
|
|
||||||
|
$generalID = $session->generalID;
|
||||||
|
|
||||||
|
$turnAmount = Util::getReq('amount', 'int');
|
||||||
|
|
||||||
|
if($turnAmount == null){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'턴이 입력되지 않았습니다.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(abs($turnAmount) >= GameConst::$maxTurn){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'턴 숫자가 올바르지 않습니다.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pushGeneralCommand($generalID, $turnAmount);
|
||||||
|
Json::die([
|
||||||
|
'result'=>true,
|
||||||
|
'reason'=>'success',
|
||||||
|
]);
|
||||||
+55
-8
@@ -1,6 +1,6 @@
|
|||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
|
|
||||||
$('#do_refresh').click(function(){
|
$('#refreshPage').click(function(){
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -56,18 +56,65 @@ function myclock() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(!$clock.attr('data-time-diff')){
|
|
||||||
var base_clock = moment($clock.attr('data-server-time'));
|
|
||||||
$clock.attr('data-time-diff', base_clock.diff(now_clock));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var game_clock = now_clock.add(parseInt($clock.data('time-diff')), 'milliseconds');
|
var game_clock = now_clock.add(parseInt($clock.data('time-diff')), 'milliseconds');
|
||||||
|
|
||||||
$('#clock').val(game_clock.format('YYYY-MM-DD HH:mm:ss'));
|
$('#clock').val(game_clock.format('YYYY-MM-DD HH:mm:ss'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushTurn(pushAmount){
|
||||||
|
$.post({
|
||||||
|
url:'j_turn.php',
|
||||||
|
dataType:'json',
|
||||||
|
data:{
|
||||||
|
amount:pushAmount
|
||||||
|
}
|
||||||
|
}).then(function(data){
|
||||||
|
if(!data.result){
|
||||||
|
alert(data.reason);
|
||||||
|
}
|
||||||
|
reloadCommandList();
|
||||||
|
}, errUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#pullTurn').click(function(){
|
||||||
|
pushTurn(-parseInt($('#repeatAmount').val()));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#pushTurn').click(function(){
|
||||||
|
pushTurn(parseInt($('#repeatAmount').val()));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function reserveTurn(turnList, command){
|
||||||
|
console.log(turnList, command);
|
||||||
|
$.post({
|
||||||
|
url:'j_set_general_command.php',
|
||||||
|
dataType:'json',
|
||||||
|
data:{
|
||||||
|
action:command,
|
||||||
|
turnList:turnList
|
||||||
|
}
|
||||||
|
}).then(function(data){
|
||||||
|
if(!data.result){
|
||||||
|
alert(data.reason);
|
||||||
|
}
|
||||||
|
reloadCommandList();
|
||||||
|
}, errUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#reserveTurn').click(function(){
|
||||||
|
var turnList = $('#generalTurnSelector').val().map(function(v){return parseInt(v);});
|
||||||
|
var $command = $('#generalCommandList option:selected');
|
||||||
|
/*if($command.data('reqarg')){
|
||||||
|
alert('TODO!');
|
||||||
|
}
|
||||||
|
else*/{
|
||||||
|
reserveTurn(turnList, $command.val());
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
setInterval(myclock, 500);
|
setInterval(myclock, 500);
|
||||||
reloadCommandList();
|
reloadCommandList();
|
||||||
});
|
});
|
||||||
@@ -224,7 +224,6 @@ abstract class BaseCommand{
|
|||||||
//0 : Neutral
|
//0 : Neutral
|
||||||
//-1 : Negative
|
//-1 : Negative
|
||||||
//null : can't calculate
|
//null : can't calculate
|
||||||
//TODO: 구현
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,13 @@ class che_상업투자 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
return [$reqGold, $reqRice];
|
return [$reqGold, $reqRice];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCompensationStyle():?int{
|
||||||
|
$develCost = $this->env['develcost'];
|
||||||
|
$reqGold = $this->getCost()[0];
|
||||||
|
return $develCost <=>$reqGold;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn():int{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ class che_정착장려 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
return [$reqGold, $reqRice];
|
return [$reqGold, $reqRice];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCompensationStyle():?int{
|
||||||
|
$develCost = $this->env['develcost'] * 2;
|
||||||
|
$reqGold = $this->getCost()[1];
|
||||||
|
return $develCost <=>$reqGold;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn():int{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ class che_주민선정 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
return [$reqGold, $reqRice];
|
return [$reqGold, $reqRice];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCompensationStyle():?int{
|
||||||
|
$develCost = $this->env['develcost'] * 2;
|
||||||
|
$reqGold = $this->getCost()[1];
|
||||||
|
return $develCost <=>$reqGold;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn():int{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class che_첩보 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
return [$env['develcost'], 0];
|
return [$env['develcost'], $env['develcost']];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn():int{
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ class GameConstBase
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array[string] 선택 가능한 커맨드 */
|
/** @var array 선택 가능한 커맨드 */
|
||||||
public static $availableGeneralCommand = [
|
public static $availableGeneralCommand = [
|
||||||
''=>[
|
''=>[
|
||||||
'휴식',
|
'휴식',
|
||||||
|
|||||||
Reference in New Issue
Block a user