명령 입력턴에 select2 적용
This commit is contained in:
+131
-127
@@ -1,127 +1,131 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
include "lib.php";
|
include "lib.php";
|
||||||
include "func.php";
|
include "func.php";
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
|
|
||||||
$commandType = Util::getReq('command', 'string');
|
$commandType = Util::getReq('command', 'string');
|
||||||
$turnList = array_map('intval', explode('_', Util::getReq('turnList', 'string', '0')));
|
$turnList = array_map('intval', explode('_', Util::getReq('turnList', 'string', '0')));
|
||||||
$isChiefTurn = Util::getReq('is_chief', 'bool', false);
|
$isChiefTurn = Util::getReq('is_chief', 'bool', false);
|
||||||
|
|
||||||
function die_redirect()
|
function die_redirect()
|
||||||
{
|
{
|
||||||
global $isChiefTurn;
|
global $isChiefTurn;
|
||||||
if(!$isChiefTurn){
|
if(!$isChiefTurn){
|
||||||
header('location:index.php', true, 303);
|
header('location:index.php', true, 303);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
header('location:b_chiefcenter.php', true, 303);
|
header('location:b_chiefcenter.php', true, 303);
|
||||||
}
|
}
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$turnList || !$commandType){
|
if(!$turnList || !$commandType){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
if(!is_array($turnList)){
|
if(!is_array($turnList)){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
$session = Session::requireGameLogin()->setReadOnly();
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
if(!$isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableGeneralCommand))){
|
if(!$isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableGeneralCommand))){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableChiefCommand))){
|
if($isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableChiefCommand))){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env')->turnOnCache();
|
$gameStor = KVStorage::getStorage($db, 'game_env')->turnOnCache();
|
||||||
$env = $gameStor->getAll();
|
$env = $gameStor->getAll();
|
||||||
$general = General::createGeneralObjFromDB($session->generalID);
|
$general = General::createGeneralObjFromDB($session->generalID);
|
||||||
|
|
||||||
if(!$isChiefTurn){
|
if(!$isChiefTurn){
|
||||||
$commandObj = buildGeneralCommandClass($commandType, $general, $env);
|
$commandObj = buildGeneralCommandClass($commandType, $general, $env);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if($general->getVar('officer_level') < 5){
|
if($general->getVar('officer_level') < 5){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
$commandObj = buildNationCommandClass($commandType, $general, $env, new LastTurn());
|
$commandObj = buildNationCommandClass($commandType, $general, $env, new LastTurn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($commandObj->isArgValid()){
|
if($commandObj->isArgValid()){
|
||||||
//인자가 필요없는 타입의 경우 processing에서 '전혀' 처리하지 않음!
|
//인자가 필요없는 타입의 경우 processing에서 '전혀' 처리하지 않음!
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$commandObj->hasPermissionToReserve()){
|
if(!$commandObj->hasPermissionToReserve()){
|
||||||
die_redirect();
|
die_redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$jsList = $commandObj->getJSFiles();
|
$jsList = $commandObj->getJSFiles();
|
||||||
$cssList = $commandObj->getCSSFiles();
|
$cssList = $commandObj->getCSSFiles();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title><?=$commandObj->getName()?></title>
|
<title><?=$commandObj->getName()?></title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=1024" />
|
<meta name="viewport" content="width=1024" />
|
||||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||||
<?=WebUtil::printJS('js/common.js')?>
|
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||||
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
<?=WebUtil::printJS('js/common.js')?>
|
||||||
<?=WebUtil::printJS('js/map.js')?>
|
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
||||||
<?=WebUtil::printJS('js/processing.js')?>
|
<?=WebUtil::printJS('js/map.js')?>
|
||||||
<script>
|
<?=WebUtil::printJS('js/processing.js')?>
|
||||||
window.serverNick = '<?=DB::prefix()?>';
|
<script>
|
||||||
window.serverID = '<?=UniqueConst::$serverID?>';
|
window.serverNick = '<?=DB::prefix()?>';
|
||||||
window.command = '<?=$commandType?>';
|
window.serverID = '<?=UniqueConst::$serverID?>';
|
||||||
window.turnList = [<?=join(', ',$turnList)?>];
|
window.command = '<?=$commandType?>';
|
||||||
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
window.turnList = [<?=join(', ',$turnList)?>];
|
||||||
</script>
|
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
||||||
<?php
|
</script>
|
||||||
foreach($jsList as $js){
|
<?php
|
||||||
print(WebUtil::printJS($js));
|
foreach($jsList as $js){
|
||||||
}
|
print(WebUtil::printJS($js));
|
||||||
?>
|
}
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||||
<?=WebUtil::printCSS('css/main.css')?>
|
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||||
<?=WebUtil::printCSS('css/map.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
<?php
|
<?=WebUtil::printCSS('css/common.css')?>
|
||||||
foreach($cssList as $css){
|
<?=WebUtil::printCSS('css/main.css')?>
|
||||||
print(WebUtil::printCSS($css));
|
<?=WebUtil::printCSS('css/map.css')?>
|
||||||
}
|
<?=WebUtil::printCSS('css/processing.css')?>
|
||||||
?>
|
<?php
|
||||||
</head>
|
foreach($cssList as $css){
|
||||||
<body class="img_back">
|
print(WebUtil::printCSS($css));
|
||||||
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
|
}
|
||||||
<tr><td class="bg1" style='text-align:center;'><?=$commandObj->getName()?></td></tr>
|
?>
|
||||||
<tr><td>
|
</head>
|
||||||
<input type=button value='돌아가기' onclick="history.back();"><br>
|
<body class="img_back">
|
||||||
</td></tr></table>
|
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
|
||||||
|
<tr><td class="bg1" style='text-align:center;'><?=$commandObj->getName()?></td></tr>
|
||||||
<div class="tb_layout bg0" style="width:1000px;margin:auto;padding-bottom:2em;border:solid 1px gray;">
|
<tr><td>
|
||||||
<?=$commandObj->getForm()?>
|
<input type=button value='돌아가기' onclick="history.back();"><br>
|
||||||
</div>
|
</td></tr></table>
|
||||||
|
|
||||||
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
|
<div class="tb_layout bg0" style="width:1000px;margin:auto;padding-bottom:2em;border:solid 1px gray;">
|
||||||
<tr><td>
|
<?=$commandObj->getForm()?>
|
||||||
<input type=button value='돌아가기' onclick="history.back();"><br>
|
</div>
|
||||||
<?=banner()?>
|
|
||||||
</td></tr></table>
|
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
|
||||||
|
<tr><td>
|
||||||
|
<input type=button value='돌아가기' onclick="history.back();"><br>
|
||||||
</body>
|
<?=banner()?>
|
||||||
</html>
|
</td></tr></table>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#amount {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#colorType {
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-padding .select2-results__option {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
+242
-101
@@ -1,102 +1,243 @@
|
|||||||
function reserveTurn(turnList, command, arg){
|
function reserveTurn(turnList, command, arg) {
|
||||||
var target;
|
var target;
|
||||||
if(isChiefTurn){
|
if (isChiefTurn) {
|
||||||
target = 'j_set_chief_command.php';
|
target = 'j_set_chief_command.php';
|
||||||
}
|
} else {
|
||||||
else{
|
target = 'j_set_general_command.php';
|
||||||
target = 'j_set_general_command.php';
|
}
|
||||||
}
|
$.post({
|
||||||
$.post({
|
url: target,
|
||||||
url:target,
|
dataType: 'json',
|
||||||
dataType:'json',
|
data: {
|
||||||
data:{
|
action: command,
|
||||||
action:command,
|
turnList: turnList,
|
||||||
turnList:turnList,
|
arg: JSON.stringify(arg)
|
||||||
arg:JSON.stringify(arg)
|
}
|
||||||
}
|
}).then(function(data) {
|
||||||
}).then(function(data){
|
if (!data.result) {
|
||||||
if(!data.result){
|
alert(data.reason);
|
||||||
alert(data.reason);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
if (!isChiefTurn) {
|
||||||
if(!isChiefTurn){
|
window.location.href = './';
|
||||||
window.location.href = './';
|
} else {
|
||||||
}
|
window.location.href = 'b_chiefcenter.php';
|
||||||
else{
|
}
|
||||||
window.location.href = 'b_chiefcenter.php';
|
|
||||||
}
|
}, errUnknown);
|
||||||
|
}
|
||||||
}, errUnknown);
|
|
||||||
}
|
jQuery(function($) {
|
||||||
|
|
||||||
jQuery(function($){
|
window.submitAction = function() {
|
||||||
|
|
||||||
window.submitAction = function(){
|
//checkCommandArg 참고
|
||||||
|
var availableArgumentList = {
|
||||||
//checkCommandArg 참고
|
'string': [
|
||||||
var availableArgumentList = {
|
'nationName', 'optionText', 'itemType', 'nationType', 'itemCode',
|
||||||
'string':[
|
],
|
||||||
'nationName', 'optionText', 'itemType', 'nationType', 'itemCode',
|
'int': [
|
||||||
],
|
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
||||||
'int':[
|
'amount', 'colorType',
|
||||||
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
'year', 'month',
|
||||||
'amount', 'colorType',
|
'srcArmType', 'destArmType', //숙련전환 전용
|
||||||
'year', 'month',
|
],
|
||||||
'srcArmType', 'destArmType', //숙련전환 전용
|
'boolean': [
|
||||||
],
|
'isGold', 'buyRice',
|
||||||
'boolean':[
|
],
|
||||||
'isGold', 'buyRice',
|
'integerArray': [
|
||||||
],
|
'destNationIDList', 'destGeneralIDList', 'amountList'
|
||||||
'integerArray':[
|
]
|
||||||
'destNationIDList', 'destGeneralIDList', 'amountList'
|
}
|
||||||
]
|
|
||||||
}
|
var handlerList = {
|
||||||
|
'string': function($obj) {
|
||||||
var handlerList = {
|
return $.trim($obj.eq(0).val());
|
||||||
'string':function($obj){
|
},
|
||||||
return $.trim($obj.eq(0).val());
|
'int': function($obj) {
|
||||||
},
|
return parseInt($obj.eq(0).val());
|
||||||
'int':function($obj){
|
},
|
||||||
return parseInt($obj.eq(0).val());
|
'boolean': function($obj) {
|
||||||
},
|
switch ($obj.eq(0).val().toLowerCase()) {
|
||||||
'boolean':function($obj){
|
case "true":
|
||||||
switch ($obj.eq(0).val().toLowerCase()) {
|
case "yes":
|
||||||
case "true": case "yes": case "1":
|
case "1":
|
||||||
return true;
|
return true;
|
||||||
case "false": case "no": case "0":
|
case "false":
|
||||||
return false;
|
case "no":
|
||||||
default:
|
case "0":
|
||||||
throw new Error ("Boolean.parse: Cannot convert string to boolean.");
|
return false;
|
||||||
}
|
default:
|
||||||
},
|
throw new Error("Boolean.parse: Cannot convert string to boolean.");
|
||||||
'integerArray':function($obj){
|
}
|
||||||
return $obj.map(function(){
|
},
|
||||||
return parseInt($(this).val());
|
'integerArray': function($obj) {
|
||||||
});
|
return $obj.map(function() {
|
||||||
}
|
return parseInt($(this).val());
|
||||||
}
|
});
|
||||||
|
}
|
||||||
var argument = {};
|
}
|
||||||
for (var typeName in availableArgumentList) {
|
|
||||||
availableArgumentList[typeName].forEach(function(argName){
|
var argument = {};
|
||||||
var $obj = $('#'+argName);
|
for (var typeName in availableArgumentList) {
|
||||||
if($obj.length == 0){
|
availableArgumentList[typeName].forEach(function(argName) {
|
||||||
$obj = $('.'+argName);
|
var $obj = $('#' + argName);
|
||||||
if($obj.length == 0){
|
if ($obj.length == 0) {
|
||||||
return;
|
$obj = $('.' + argName);
|
||||||
}
|
if ($obj.length == 0) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
argument[argName] = handlerList[typeName]($obj);
|
}
|
||||||
});
|
|
||||||
}
|
argument[argName] = handlerList[typeName]($obj);
|
||||||
|
});
|
||||||
console.log(argument);
|
}
|
||||||
reserveTurn(turnList, command, argument);
|
|
||||||
};
|
console.log(argument);
|
||||||
|
reserveTurn(turnList, command, argument);
|
||||||
$('#commonSubmit').click(submitAction);
|
};
|
||||||
|
|
||||||
|
$('#commonSubmit').click(submitAction);
|
||||||
|
|
||||||
|
var $colorType = $('#colorType');
|
||||||
|
if ($colorType.length) {
|
||||||
|
$colorType.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "색상을 선택해 주세요.",
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
templateSelection: function(item) {
|
||||||
|
if (item.disabled) {
|
||||||
|
return item.text;
|
||||||
|
}
|
||||||
|
var bgcolor = item.element.dataset.color;
|
||||||
|
var fgcolor = item.element.dataset.fontColor;
|
||||||
|
return $("<span><span style='background-color:{0};color:{1};'> </span> {2}</span>".format(
|
||||||
|
bgcolor, fgcolor, item.text
|
||||||
|
));
|
||||||
|
},
|
||||||
|
templateResult: function(item) {
|
||||||
|
if (item.disabled) {
|
||||||
|
return item.text;
|
||||||
|
}
|
||||||
|
var bgcolor = item.element.dataset.color;
|
||||||
|
var fgcolor = item.element.dataset.fontColor;
|
||||||
|
return $("<div style='padding: 0.75rem 0.375rem; background-color:{0};color:{1};'>{2}</div>".format(
|
||||||
|
bgcolor, fgcolor, item.text
|
||||||
|
));
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'no-padding simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $nationType = $('#nationType');
|
||||||
|
if ($nationType.length) {
|
||||||
|
$nationType.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $destCityID = $('#destCityID');
|
||||||
|
if ($destCityID.length) {
|
||||||
|
$destCityID.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "도시를 선택해 주세요.",
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $destNationID = $('#destNationID');
|
||||||
|
if ($destNationID.length) {
|
||||||
|
$destNationID.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "국가를 선택해 주세요.",
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $destGeneralID = $('#destGeneralID');
|
||||||
|
if ($destGeneralID.length) {
|
||||||
|
$destGeneralID.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "장수를 선택해 주세요.",
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $isGold = $('#isGold');
|
||||||
|
if ($isGold.length) {
|
||||||
|
$isGold.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "분량을 지정해 주세요.",
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
minimumResultsForSearch: -1,
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var $amount = $('#amount:not([type=hidden])');
|
||||||
|
if ($amount.length) {
|
||||||
|
$amount.select2({
|
||||||
|
theme: 'bootstrap4',
|
||||||
|
placeholder: "분량을 지정해 주세요.",
|
||||||
|
allowClear: false,
|
||||||
|
language: "ko",
|
||||||
|
containerCss: {
|
||||||
|
display: "inline-block !important",
|
||||||
|
color: 'white !important',
|
||||||
|
},
|
||||||
|
tags: true,
|
||||||
|
sorter: function(items) {
|
||||||
|
items.sort(function(lhs, rhs) {
|
||||||
|
return parseInt(lhs.id) - parseInt(rhs.id);
|
||||||
|
})
|
||||||
|
return items;
|
||||||
|
},
|
||||||
|
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
dropdownCssClass: 'select2-only-number simple-select2-align-center bg-secondary text-secondary',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('keypress', '.select2-only-number .select2-search__field', function() {
|
||||||
|
$(this).val($(this).val().replace(/[^\d].+/, ""));
|
||||||
|
if ((event.which < 48 || event.which > 57)) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -1,287 +1,287 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\General;
|
namespace sammo\Command\General;
|
||||||
|
|
||||||
use\sammo\{
|
use\sammo\{
|
||||||
DB,
|
DB,
|
||||||
Util,
|
Util,
|
||||||
JosaUtil,
|
JosaUtil,
|
||||||
General,
|
General,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
GameUnitConst,
|
GameUnitConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
Command,
|
Command,
|
||||||
Json
|
Json
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
use function\sammo\{
|
use function\sammo\{
|
||||||
tryUniqueItemLottery,
|
tryUniqueItemLottery,
|
||||||
getAllNationStaticInfo
|
getAllNationStaticInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
use sammo\CityConst;
|
use sammo\CityConst;
|
||||||
use function sammo\buildNationTypeClass;
|
use function sammo\buildNationTypeClass;
|
||||||
use function sammo\refreshNationStaticInfo;
|
use function sammo\refreshNationStaticInfo;
|
||||||
use function sammo\GetNationColors;
|
use function sammo\GetNationColors;
|
||||||
use function sammo\newColor;
|
use function sammo\newColor;
|
||||||
|
|
||||||
|
|
||||||
class che_건국 extends Command\GeneralCommand
|
class che_건국 extends Command\GeneralCommand
|
||||||
{
|
{
|
||||||
static protected $actionName = '건국';
|
static protected $actionName = '건국';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest(): bool
|
protected function argTest(): bool
|
||||||
{
|
{
|
||||||
if ($this->arg === null) {
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$nationName = $this->arg['nationName'] ?? null;
|
$nationName = $this->arg['nationName'] ?? null;
|
||||||
$nationType = $this->arg['nationType'] ?? null;
|
$nationType = $this->arg['nationType'] ?? null;
|
||||||
$colorType = $this->arg['colorType'] ?? null;
|
$colorType = $this->arg['colorType'] ?? null;
|
||||||
|
|
||||||
if ($nationName === null || $nationType === null || $colorType === null) {
|
if ($nationName === null || $nationType === null || $colorType === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_string($nationName) || !is_string($nationType) || !is_int($colorType)) {
|
if (!is_string($nationName) || !is_string($nationType) || !is_int($colorType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb_strwidth($nationName) > 18 || $nationName == '') {
|
if (mb_strwidth($nationName) > 18 || $nationName == '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key_exists($colorType, GetNationColors())) {
|
if (!key_exists($colorType, GetNationColors())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$nationTypeClass = buildNationTypeClass($nationType);
|
$nationTypeClass = buildNationTypeClass($nationType);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'nationName' => $nationName,
|
'nationName' => $nationName,
|
||||||
'nationType' => $nationType,
|
'nationType' => $nationType,
|
||||||
'colorType' => $colorType
|
'colorType' => $colorType
|
||||||
];
|
];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['gennum', 'aux']);
|
$this->setNation(['gennum', 'aux']);
|
||||||
|
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
|
|
||||||
$this->minConditionConstraints = [
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::BeOpeningPart($relYear + 1),
|
ConstraintHelper::BeOpeningPart($relYear + 1),
|
||||||
ConstraintHelper::ReqNationValue('level', '국가규모', '==', 0, '정식 국가가 아니어야합니다.')
|
ConstraintHelper::ReqNationValue('level', '국가규모', '==', 0, '정식 국가가 아니어야합니다.')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initWithArg()
|
protected function initWithArg()
|
||||||
{
|
{
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
|
|
||||||
$nationName = $this->arg['nationName'];
|
$nationName = $this->arg['nationName'];
|
||||||
$nationType = $this->arg['nationType'];
|
$nationType = $this->arg['nationType'];
|
||||||
$colorType = $this->arg['colorType'];
|
$colorType = $this->arg['colorType'];
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::BeLord(),
|
ConstraintHelper::BeLord(),
|
||||||
ConstraintHelper::WanderingNation(),
|
ConstraintHelper::WanderingNation(),
|
||||||
ConstraintHelper::ReqNationValue('gennum', '수하 장수', '>=', 2),
|
ConstraintHelper::ReqNationValue('gennum', '수하 장수', '>=', 2),
|
||||||
ConstraintHelper::BeOpeningPart($relYear + 1),
|
ConstraintHelper::BeOpeningPart($relYear + 1),
|
||||||
ConstraintHelper::CheckNationNameDuplicate($nationName),
|
ConstraintHelper::CheckNationNameDuplicate($nationName),
|
||||||
ConstraintHelper::AllowJoinAction(),
|
ConstraintHelper::AllowJoinAction(),
|
||||||
ConstraintHelper::ConstructableCity(),
|
ConstraintHelper::ConstructableCity(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief(): string
|
public function getBrief(): string
|
||||||
{
|
{
|
||||||
$nationName = $this->arg['nationName'];
|
$nationName = $this->arg['nationName'];
|
||||||
$josaUl = JosaUtil::pick($nationName, '을');
|
$josaUl = JosaUtil::pick($nationName, '을');
|
||||||
return "【{$nationName}】{$josaUl} 건국";
|
return "【{$nationName}】{$josaUl} 건국";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
{
|
{
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn(): int
|
public function getPreReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn(): int
|
public function getPostReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
if (!$this->hasFullConditionMet()) {
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
$generalName = $general->getName();
|
$generalName = $general->getName();
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
$nationName = $this->arg['nationName'];
|
$nationName = $this->arg['nationName'];
|
||||||
$nationType = $this->arg['nationType'];
|
$nationType = $this->arg['nationType'];
|
||||||
$colorType = GetNationColors()[$this->arg['colorType']];
|
$colorType = GetNationColors()[$this->arg['colorType']];
|
||||||
|
|
||||||
$cityName = $this->city['name'];
|
$cityName = $this->city['name'];
|
||||||
|
|
||||||
$josaUl = JosaUtil::pick($nationName, '을');
|
$josaUl = JosaUtil::pick($nationName, '을');
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
$nationTypeClass = buildNationTypeClass($nationType);
|
$nationTypeClass = buildNationTypeClass($nationType);
|
||||||
$nationTypeName = $nationTypeClass->getName();
|
$nationTypeName = $nationTypeClass->getName();
|
||||||
|
|
||||||
|
|
||||||
$logger->pushGeneralActionLog("<D><b>{$nationName}</b></>{$josaUl} 건국하였습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("<D><b>{$nationName}</b></>{$josaUl} 건국하였습니다. <1>$date</>");
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <G><b>{$cityName}</b></>에 국가를 건설하였습니다.");
|
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <G><b>{$cityName}</b></>에 국가를 건설하였습니다.");
|
||||||
|
|
||||||
$josaNationYi = JosaUtil::pick($nationName, '이');
|
$josaNationYi = JosaUtil::pick($nationName, '이');
|
||||||
$logger->pushGlobalHistoryLog("<Y><b>【건국】</b></>{$nationTypeName} <D><b>{$nationName}</b></>{$josaNationYi} 새로이 등장하였습니다.");
|
$logger->pushGlobalHistoryLog("<Y><b>【건국】</b></>{$nationTypeName} <D><b>{$nationName}</b></>{$josaNationYi} 새로이 등장하였습니다.");
|
||||||
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 건국");
|
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 건국");
|
||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>{$josaUl} 건국");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>{$josaUl} 건국");
|
||||||
|
|
||||||
$exp = 1000;
|
$exp = 1000;
|
||||||
$ded = 1000;
|
$ded = 1000;
|
||||||
|
|
||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$general->addDedication($ded);
|
$general->addDedication($ded);
|
||||||
|
|
||||||
$aux = Json::decode($this->nation['aux'])??[];
|
$aux = Json::decode($this->nation['aux'])??[];
|
||||||
$aux['can_국기변경'] = 1;
|
$aux['can_국기변경'] = 1;
|
||||||
|
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
'nation' => $general->getNationID(),
|
'nation' => $general->getNationID(),
|
||||||
'conflict' => '{}'
|
'conflict' => '{}'
|
||||||
], 'city=%i', $general->getCityID());
|
], 'city=%i', $general->getCityID());
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'name' => $nationName,
|
'name' => $nationName,
|
||||||
'color' => $colorType,
|
'color' => $colorType,
|
||||||
'level' => 1,
|
'level' => 1,
|
||||||
'type' => $nationType,
|
'type' => $nationType,
|
||||||
'capital' => $general->getCityID(),
|
'capital' => $general->getCityID(),
|
||||||
'aux' => Json::encode($aux)
|
'aux' => Json::encode($aux)
|
||||||
], 'nation=%i', $general->getNationID());
|
], 'nation=%i', $general->getNationID());
|
||||||
|
|
||||||
refreshNationStaticInfo();
|
refreshNationStaticInfo();
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery($general, '건국');
|
tryUniqueItemLottery($general, '건국');
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSFiles(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'js/colorSelect.js'
|
'js/colorSelect.js'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
|
|
||||||
if (count(getAllNationStaticInfo()) >= $this->env['maxnation']) {
|
if (count(getAllNationStaticInfo()) >= $this->env['maxnation']) {
|
||||||
return '더 이상 건국은 불가능합니다.';
|
return '더 이상 건국은 불가능합니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//NOTE: 새로운 방법이 생기기 전까진 아무색이나 선택 가능하도록 하자.
|
//NOTE: 새로운 방법이 생기기 전까진 아무색이나 선택 가능하도록 하자.
|
||||||
/*
|
/*
|
||||||
foreach(GetNationColors() as $color){
|
foreach(GetNationColors() as $color){
|
||||||
$colorUsed[$color] = 0;
|
$colorUsed[$color] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(getAllNationStaticInfo() as $nation){
|
foreach(getAllNationStaticInfo() as $nation){
|
||||||
if($nation['level'] <= 0){
|
if($nation['level'] <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$colorUsed[$nation['color']]++;
|
$colorUsed[$nation['color']]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorUsedCnt = 0;
|
$colorUsedCnt = 0;
|
||||||
foreach($colorUsed as $color=>$used){
|
foreach($colorUsed as $color=>$used){
|
||||||
if($used){
|
if($used){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$colorUsedCnt += 1;
|
$colorUsedCnt += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//색깔이 다 쓰였으면 그냥 모두 허용
|
//색깔이 다 쓰였으면 그냥 모두 허용
|
||||||
if($colorUsedCnt === count($colorUsed)){
|
if($colorUsedCnt === count($colorUsed)){
|
||||||
foreach(array_keys($colorUsed) as $color){
|
foreach(array_keys($colorUsed) as $color){
|
||||||
$colorUsed[$color] = 0;
|
$colorUsed[$color] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.<br>
|
현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.<br>
|
||||||
|
|
||||||
<?php foreach (GameConst::$availableNationType as $nationType) :
|
<?php foreach (GameConst::$availableNationType as $nationType) :
|
||||||
$nationClass = buildNationTypeClass($nationType);
|
$nationClass = buildNationTypeClass($nationType);
|
||||||
|
|
||||||
[$name, $pros, $cons] = [$nationClass->getName(), $nationClass::$pros, $nationClass::$cons];
|
[$name, $pros, $cons] = [$nationClass->getName(), $nationClass::$pros, $nationClass::$cons];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
- <?= $name ?> : <span style='color:cyan;'><?= $pros ?></span> <span style='color:magenta;'><?= $cons ?></span><br>
|
- <?= $name ?> : <span style='color:cyan;'><?= $pros ?></span> <span style='color:magenta;'><?= $cons ?></span><br>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<br>
|
<br>
|
||||||
국명 : <input type='text' class='formInput' name="nationName" id="nationName" size='18' maxlength='18' style='color:white;background-color:black;'>
|
국명 : <input type='text' class='formInput' name="nationName" id="nationName" size='18' maxlength='18' style='color:white;background-color:black;'>
|
||||||
색상 : <select class='formInput' name='colorType' id='colorType' size='1'>
|
색상 : <select class='formInput' name='colorType' id='colorType' size='1'>
|
||||||
|
|
||||||
<?php foreach (GetNationColors() as $idx => $color) :
|
<?php foreach (GetNationColors() as $idx => $color) :
|
||||||
/*
|
/*
|
||||||
if($colorUsed[$color] > 0){
|
if($colorUsed[$color] > 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<option value="<?= $idx ?>" style='background-color:<?= $color ?>;color:<?= newColor($color) ?>;'>국가명(<?=$color?>)</option>
|
<option value="<?= $idx ?>" data-color="<?= $color ?>" data-font-color="<?=newColor($color)?>" style='background-color:<?= $color ?>;color:<?= newColor($color) ?>;'>국가명(<?=$color?>)</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
성향 : <select class='formInput' name='nationType' id='nationType' size='1'>
|
성향 : <select class='formInput' name='nationType' id='nationType' size='1'>
|
||||||
|
|
||||||
<?php foreach (GameConst::$availableNationType as $nationType) :
|
<?php foreach (GameConst::$availableNationType as $nationType) :
|
||||||
$nationTypeName = buildNationTypeClass($nationType)->getName();
|
$nationTypeName = buildNationTypeClass($nationType)->getName();
|
||||||
?>
|
?>
|
||||||
<option value='<?= $nationType ?>' style=background-color:black;color:white;><?= $nationTypeName ?></option>
|
<option value='<?= $nationType ?>' style=background-color:black;color:white;><?= $nationTypeName ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<input type=button id="commonSubmit" value="<?= $this->getName() ?>">
|
<input type=button id="commonSubmit" value="<?= $this->getName() ?>">
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,222 +1,222 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\General;
|
namespace sammo\Command\General;
|
||||||
|
|
||||||
use\sammo\{
|
use\sammo\{
|
||||||
DB,
|
DB,
|
||||||
Util,
|
Util,
|
||||||
JosaUtil,
|
JosaUtil,
|
||||||
General,
|
General,
|
||||||
DummyGeneral,
|
DummyGeneral,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
GameUnitConst,
|
GameUnitConst,
|
||||||
Command
|
Command
|
||||||
};
|
};
|
||||||
|
|
||||||
use function\sammo\{
|
use function\sammo\{
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
tryUniqueItemLottery
|
tryUniqueItemLottery
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
|
|
||||||
|
|
||||||
class che_증여 extends Command\GeneralCommand
|
class che_증여 extends Command\GeneralCommand
|
||||||
{
|
{
|
||||||
static protected $actionName = '증여';
|
static protected $actionName = '증여';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest(): bool
|
protected function argTest(): bool
|
||||||
{
|
{
|
||||||
if ($this->arg === null) {
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//NOTE: 사망 직전에 '증여' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음
|
//NOTE: 사망 직전에 '증여' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음
|
||||||
if (!key_exists('isGold', $this->arg)) {
|
if (!key_exists('isGold', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!key_exists('amount', $this->arg)) {
|
if (!key_exists('amount', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!key_exists('destGeneralID', $this->arg)) {
|
if (!key_exists('destGeneralID', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$isGold = $this->arg['isGold'];
|
$isGold = $this->arg['isGold'];
|
||||||
$amount = $this->arg['amount'];
|
$amount = $this->arg['amount'];
|
||||||
$destGeneralID = $this->arg['destGeneralID'];
|
$destGeneralID = $this->arg['destGeneralID'];
|
||||||
if (!is_numeric($amount)) {
|
if (!is_numeric($amount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::round($amount, -2);
|
$amount = Util::round($amount, -2);
|
||||||
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
||||||
if ($amount <= 0) {
|
if ($amount <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_bool($isGold)) {
|
if (!is_bool($isGold)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_int($destGeneralID)) {
|
if (!is_int($destGeneralID)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($destGeneralID <= 0) {
|
if ($destGeneralID <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($destGeneralID == $this->generalObj->getID()) {
|
if ($destGeneralID == $this->generalObj->getID()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'isGold' => $isGold,
|
'isGold' => $isGold,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'destGeneralID' => $destGeneralID
|
'destGeneralID' => $destGeneralID
|
||||||
];
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation();
|
$this->setNation();
|
||||||
|
|
||||||
$this->minConditionConstraints = [
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initWithArg()
|
protected function initWithArg()
|
||||||
{
|
{
|
||||||
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], 1);
|
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], 1);
|
||||||
$this->setDestGeneral($destGeneral);
|
$this->setDestGeneral($destGeneral);
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::NotBeNeutral(),
|
ConstraintHelper::NotBeNeutral(),
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
ConstraintHelper::ExistsDestGeneral(),
|
ConstraintHelper::ExistsDestGeneral(),
|
||||||
ConstraintHelper::FriendlyDestGeneral()
|
ConstraintHelper::FriendlyDestGeneral()
|
||||||
];
|
];
|
||||||
if ($this->arg['isGold']) {
|
if ($this->arg['isGold']) {
|
||||||
$this->fullConditionConstraints[] = ConstraintHelper::ReqGeneralGold(GameConst::$generalMinimumGold);
|
$this->fullConditionConstraints[] = ConstraintHelper::ReqGeneralGold(GameConst::$generalMinimumGold);
|
||||||
} else {
|
} else {
|
||||||
$this->fullConditionConstraints[] = ConstraintHelper::ReqGeneralRice(GameConst::$generalMinimumRice);
|
$this->fullConditionConstraints[] = ConstraintHelper::ReqGeneralRice(GameConst::$generalMinimumRice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
public function getCommandDetailTitle(): string
|
||||||
{
|
{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
return "{$name}(통솔경험)";
|
return "{$name}(통솔경험)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
{
|
{
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn(): int
|
public function getPreReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn(): int
|
public function getPostReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief(): string
|
public function getBrief(): string
|
||||||
{
|
{
|
||||||
$destGeneralName = $this->destGeneralObj->getName();
|
$destGeneralName = $this->destGeneralObj->getName();
|
||||||
$resText = $this->arg['isGold'] ? '금' : '쌀';
|
$resText = $this->arg['isGold'] ? '금' : '쌀';
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
return "【{$destGeneralName}】에게 {$resText} {$this->arg['amount']}을 {$name}";
|
return "【{$destGeneralName}】에게 {$resText} {$this->arg['amount']}을 {$name}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
if (!$this->hasFullConditionMet()) {
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$isGold = $this->arg['isGold'];
|
$isGold = $this->arg['isGold'];
|
||||||
$amount = $this->arg['amount'];
|
$amount = $this->arg['amount'];
|
||||||
$resKey = $isGold ? 'gold' : 'rice';
|
$resKey = $isGold ? 'gold' : 'rice';
|
||||||
$resName = $isGold ? '금' : '쌀';
|
$resName = $isGold ? '금' : '쌀';
|
||||||
$destGeneral = $this->destGeneralObj;
|
$destGeneral = $this->destGeneralObj;
|
||||||
|
|
||||||
$amount = Util::valueFit($amount, 0, $general->getVar($resKey) - ($isGold ? GameConst::$generalMinimumGold : GameConst::$generalMinimumRice));
|
$amount = Util::valueFit($amount, 0, $general->getVar($resKey) - ($isGold ? GameConst::$generalMinimumGold : GameConst::$generalMinimumRice));
|
||||||
$amountText = number_format($amount, 0);
|
$amountText = number_format($amount, 0);
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
$destGeneral->increaseVarWithLimit($resKey, $amount);
|
$destGeneral->increaseVarWithLimit($resKey, $amount);
|
||||||
$general->increaseVarWithLimit($resKey, -$amount, 0);
|
$general->increaseVarWithLimit($resKey, -$amount, 0);
|
||||||
|
|
||||||
$destGeneral->getLogger()->pushGeneralActionLog("<Y>{$general->getName()}</>에게서 {$resName} <C>{$amountText}</>을 증여 받았습니다.", ActionLogger::PLAIN);
|
$destGeneral->getLogger()->pushGeneralActionLog("<Y>{$general->getName()}</>에게서 {$resName} <C>{$amountText}</>을 증여 받았습니다.", ActionLogger::PLAIN);
|
||||||
$logger->pushGeneralActionLog("<Y>{$destGeneral->getName()}</>에게 {$resName} <C>$amountText</>을 증여했습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("<Y>{$destGeneral->getName()}</>에게 {$resName} <C>$amountText</>을 증여했습니다. <1>$date</>");
|
||||||
|
|
||||||
$exp = 70;
|
$exp = 70;
|
||||||
$ded = 100;
|
$ded = 100;
|
||||||
|
|
||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$general->addDedication($ded);
|
$general->addDedication($ded);
|
||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
$destGeneral->applyDB($db);
|
$destGeneral->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
//TODO: 암행부처럼 보여야...
|
//TODO: 암행부처럼 보여야...
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)', $this->generalObj->getNationID(), $this->generalObj->getID());
|
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)', $this->generalObj->getNationID(), $this->generalObj->getID());
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
자신의 자금이나 군량을 다른 장수에게 증여합니다.<br>
|
자신의 자금이나 군량을 다른 장수에게 증여합니다.<br>
|
||||||
장수를 선택하세요.<br>
|
장수를 선택하세요.<br>
|
||||||
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach ($destRawGenerals as $destGeneral) :
|
<?php foreach ($destRawGenerals as $destGeneral) :
|
||||||
$color = \sammo\getNameColor($destGeneral['npc']);
|
$color = \sammo\getNameColor($destGeneral['npc']);
|
||||||
if ($color) {
|
if ($color) {
|
||||||
$color = " style='color:{$color}'";
|
$color = " style='color:{$color}'";
|
||||||
}
|
}
|
||||||
$name = $destGeneral['name'];
|
$name = $destGeneral['name'];
|
||||||
if ($destGeneral['officer_level'] >= 5) {
|
if ($destGeneral['officer_level'] >= 5) {
|
||||||
$name = "*{$name}*";
|
$name = "*{$name}*";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<option value='<?= $destGeneral['no'] ?>' <?= $color ?>><?= $name ?>(금:<?= $destGeneral['gold'] ?>, 쌀:<?= $destGeneral['rice'] ?>)</option>
|
<option value='<?= $destGeneral['no'] ?>' <?= $color ?>><?= $name ?>(금:<?= $destGeneral['gold'] ?>, 쌀:<?= $destGeneral['rice'] ?>)</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
<select class='formInput' name="isGold" id="isGold" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="isGold" id="isGold" size='1' style='color:white;background-color:black;'>
|
||||||
<option value="true">금</option>
|
<option value="true">금</option>
|
||||||
<option value="false">쌀</option>
|
<option value="false">쌀</option>
|
||||||
</select>
|
</select>
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach (GameConst::$resourceActionAmountGuide as $amount) : ?>
|
<?php foreach (GameConst::$resourceActionAmountGuide as $amount) : ?>
|
||||||
<option value='<?= $amount ?>'><?= $amount ?></option>
|
<option value='<?= $amount ?>'><?= $amount ?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,191 +1,191 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\Nation;
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
use\sammo\{
|
use\sammo\{
|
||||||
DB,
|
DB,
|
||||||
Util,
|
Util,
|
||||||
JosaUtil,
|
JosaUtil,
|
||||||
General,
|
General,
|
||||||
DummyGeneral,
|
DummyGeneral,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
GameUnitConst,
|
GameUnitConst,
|
||||||
Command,
|
Command,
|
||||||
MessageTarget,
|
MessageTarget,
|
||||||
Message,
|
Message,
|
||||||
CityConst,
|
CityConst,
|
||||||
Json,
|
Json,
|
||||||
};
|
};
|
||||||
|
|
||||||
use function\sammo\{
|
use function\sammo\{
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
GetImageURL,
|
GetImageURL,
|
||||||
getNationStaticInfo,
|
getNationStaticInfo,
|
||||||
GetNationColors,
|
GetNationColors,
|
||||||
newColor,
|
newColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
use sammo\Event\Action;
|
use sammo\Event\Action;
|
||||||
|
|
||||||
class che_국기변경 extends Command\NationCommand
|
class che_국기변경 extends Command\NationCommand
|
||||||
{
|
{
|
||||||
static protected $actionName = '국기변경';
|
static protected $actionName = '국기변경';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest(): bool
|
protected function argTest(): bool
|
||||||
{
|
{
|
||||||
if ($this->arg === null) {
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key_exists('colorType', $this->arg)) {
|
if (!key_exists('colorType', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$colorType = $this->arg['colorType'];
|
$colorType = $this->arg['colorType'];
|
||||||
if (!key_exists($colorType, GetNationColors())) {
|
if (!key_exists($colorType, GetNationColors())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'colorType' => $colorType,
|
'colorType' => $colorType,
|
||||||
];
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['aux']);
|
$this->setNation(['aux']);
|
||||||
|
|
||||||
$actionName = $this->getName();
|
$actionName = $this->getName();
|
||||||
|
|
||||||
$this->minConditionConstraints = [
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", 0, '>', 0, '더이상 변경이 불가능합니다.')
|
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", 0, '>', 0, '더이상 변경이 불가능합니다.')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initWithArg()
|
protected function initWithArg()
|
||||||
{
|
{
|
||||||
$actionName = $this->getName();
|
$actionName = $this->getName();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", 0, '>', 0, '더이상 변경이 불가능합니다.')
|
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", 0, '>', 0, '더이상 변경이 불가능합니다.')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn(): int
|
public function getPreReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn(): int
|
public function getPostReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief(): string
|
public function getBrief(): string
|
||||||
{
|
{
|
||||||
$color = GetNationColors()[$this->arg['colorType']];
|
$color = GetNationColors()[$this->arg['colorType']];
|
||||||
return "【<span style='color:{$color};'>국기</span>】를 변경";
|
return "【<span style='color:{$color};'>국기</span>】를 변경";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
if (!$this->hasFullConditionMet()) {
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$actionName = $this->getName();
|
$actionName = $this->getName();
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$generalID = $general->getID();
|
$generalID = $general->getID();
|
||||||
$generalName = $general->getName();
|
$generalName = $general->getName();
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$colorType = $this->arg['colorType'];
|
$colorType = $this->arg['colorType'];
|
||||||
$color = GetNationColors()[$colorType];
|
$color = GetNationColors()[$colorType];
|
||||||
|
|
||||||
|
|
||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
$nationName = $this->nation['name'];
|
$nationName = $this->nation['name'];
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
|
||||||
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
$josaYiNation = JosaUtil::pick($nationName, '이');
|
$josaYiNation = JosaUtil::pick($nationName, '이');
|
||||||
|
|
||||||
$aux = Json::decode($this->nation['aux']);
|
$aux = Json::decode($this->nation['aux']);
|
||||||
$aux["can_{$actionName}"] = 0;
|
$aux["can_{$actionName}"] = 0;
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'color'=>$color,
|
'color'=>$color,
|
||||||
'aux'=>Json::encode($aux)
|
'aux'=>Json::encode($aux)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$logger->pushGeneralActionLog("<span style='color:{$color};'><b>국기</b></span>를 변경하였습니다 <1>$date</>");
|
$logger->pushGeneralActionLog("<span style='color:{$color};'><b>국기</b></span>를 변경하였습니다 <1>$date</>");
|
||||||
$logger->pushGeneralHistoryLog("<span style='color:{$color};'><b>국기</b></span>를 변경");
|
$logger->pushGeneralHistoryLog("<span style='color:{$color};'><b>국기</b></span>를 변경");
|
||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다");
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다");
|
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다");
|
||||||
$logger->pushGlobalHistoryLog("<S><b>【국기변경】</b></><D><b>{$nationName}</b></>{$josaYiNation} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다.");
|
$logger->pushGlobalHistoryLog("<S><b>【국기변경】</b></><D><b>{$nationName}</b></>{$josaYiNation} <span style='color:{$color};'><b>국기</b></span>를 변경하였습니다.");
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSFiles(): array
|
public function getJSFiles(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'js/colorSelect.js'
|
'js/colorSelect.js'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
국기를 변경합니다. 단 1회 가능합니다.<br>
|
국기를 변경합니다. 단 1회 가능합니다.<br>
|
||||||
색상 : <select class='formInput' name='colorType' id='colorType' size='1'>
|
색상 : <select class='formInput' name='colorType' id='colorType' size='1'>
|
||||||
|
|
||||||
<?php foreach (GetNationColors() as $idx => $color) :
|
<?php foreach (GetNationColors() as $idx => $color) :
|
||||||
/*
|
/*
|
||||||
if($colorUsed[$color] > 0){
|
if($colorUsed[$color] > 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<option value="<?= $idx ?>" style='background-color:<?= $color ?>;color:<?= newColor($color) ?>;'>국가명(<?=$color?>)</option>
|
<option value="<?= $idx ?>" data-color=<?=$color?> data-font-color="<?=newColor($color)?>" style='background-color:<?= $color ?>;color:<?= newColor($color) ?>;'>국가명(<?=$color?>)</option>
|
||||||
<?php endforeach; ?> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
<?php endforeach; ?> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
||||||
<br>
|
<br>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user