버그 수정
This commit is contained in:
+1
-1
@@ -1510,7 +1510,7 @@ function tryUniqueItemLottery(General $general, string $acquireType='아이템')
|
|||||||
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
|
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
|
||||||
|
|
||||||
$nationName = $general->getStaticNation()['name'];
|
$nationName = $general->getStaticNation()['name'];
|
||||||
$generalName = $general->getNation();
|
$generalName = $general->getName();
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
$itemName = getItemName($itemCode);
|
$itemName = getItemName($itemCode);
|
||||||
$josaUl = JosaUtil::pick($itemName, '을');
|
$josaUl = JosaUtil::pick($itemName, '을');
|
||||||
|
|||||||
@@ -54,7 +54,14 @@ $('#commonSubmit').click(function(){
|
|||||||
return parseInt($obj.eq(0).val());
|
return parseInt($obj.eq(0).val());
|
||||||
},
|
},
|
||||||
'boolean':function($obj){
|
'boolean':function($obj){
|
||||||
return !!($obj.eq(0).val());
|
switch ($obj.eq(0).val().toLowerCase()) {
|
||||||
|
case "true": case "yes": case "1":
|
||||||
|
return true;
|
||||||
|
case "false": case "no": case "0":
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
throw new Error ("Boolean.parse: Cannot convert string to boolean.");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'integerArray':function($obj){
|
'integerArray':function($obj){
|
||||||
return $obj.map(function(){
|
return $obj.map(function(){
|
||||||
|
|||||||
@@ -168,23 +168,22 @@ class che_강행 extends Command\GeneralCommand{
|
|||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
$currentCityID = $this->generalObj->getCityID();
|
$currentCityID = $this->generalObj->getCityID();
|
||||||
|
|
||||||
$form = [];
|
|
||||||
$form[] = \sammo\getMapHtml();
|
|
||||||
$currentCityName = CityConst::byID($currentCityID)->name;
|
$currentCityName = CityConst::byID($currentCityID)->name;
|
||||||
|
|
||||||
$form[] = <<<EOT
|
ob_start();
|
||||||
|
?>
|
||||||
|
<?=\sammo\getMapHtml()?><br>
|
||||||
선택된 도시로 강행합니다.<br>
|
선택된 도시로 강행합니다.<br>
|
||||||
최대 3칸내 도시로만 강행이 가능합니다.<br>
|
최대 3칸내 도시로만 강행이 가능합니다.<br>
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||||
{$currentCityName} => <select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
<?=$currentCityName?> => <select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'><br>
|
||||||
EOT;
|
<?=\sammo\optionsForCities()?><br>
|
||||||
$form[] = \sammo\optionsForCities();
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
$form[] = '</select> <input type=button id="commonSubmit" value="강행">';
|
<br>
|
||||||
$form[] = '';
|
<br>
|
||||||
$form[] = printCitiesBasedOnDistance($currentCityID, 3);
|
<?=printCitiesBasedOnDistance($currentCityID, 3)?>
|
||||||
|
<?php
|
||||||
return join("<br>\n",$form);
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,13 @@ class che_건국 extends Command\GeneralCommand{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBrief(): string
|
||||||
|
{
|
||||||
|
$nationName = $this->arg['nationName'];
|
||||||
|
$josaUl = JosaUtil::pick($nationName, '을');
|
||||||
|
return "【{$nationName}】{$josaUl} 건국";
|
||||||
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
@@ -211,44 +218,42 @@ class che_건국 extends Command\GeneralCommand{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$form = [];
|
ob_start();
|
||||||
|
?>
|
||||||
|
현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.<br>
|
||||||
|
|
||||||
$form[] = '현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.<br><br>';
|
<?php foreach(GameConst::$availableNationType as $nationType):
|
||||||
|
|
||||||
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];
|
||||||
$form[] = "- $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>
|
||||||
$form[] = <<<EOT
|
<?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'>
|
||||||
EOT;
|
|
||||||
foreach(GetNationColors() as $idx=>$color) {
|
<?php foreach(GetNationColors() as $idx=>$color):
|
||||||
/*
|
/*
|
||||||
if($colorUsed[$color] > 0){
|
if($colorUsed[$color] > 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$form[] = "<option value={$idx} style='background-color:{$color};color:".newColor($color)."';>국가명</option>";
|
?>
|
||||||
}
|
<option value="<?=$idx?>" style='background-color:<?=$color?>;color:<?=newColor($color)?>';>국가명</option>
|
||||||
$form[] = <<<EOT
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
성향 : <select class='formInput' name='nationType' id='nationType' size='1'>
|
성향 : <select class='formInput' name='nationType' id='nationType' size='1'>
|
||||||
EOT;
|
|
||||||
foreach(GameConst::$availableNationType as $nationType){
|
|
||||||
$nationClass = buildNationTypeClass($nationType);
|
|
||||||
|
|
||||||
$name = $nationClass->getName();
|
<?php foreach(GameConst::$availableNationType as $nationType):
|
||||||
$form[] = "<option value='{$nationType}' style=background-color:black;color:white;>{$name}</option>";
|
$nationTypeName = buildNationTypeClass($nationType)->getName();
|
||||||
|
?>
|
||||||
}
|
<option value='<?=$nationType?>' style=background-color:black;color:white;><?=$nationTypeName?></option>
|
||||||
$form[] = '</select>';
|
<?php endforeach; ?>
|
||||||
$form[] = '<input type=button id="commonSubmit" value="'.$this->getName().'">';
|
</select>
|
||||||
|
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
||||||
return join("\n",$form);
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
if(!is_bool($buyRice)){
|
if(!is_bool($buyRice)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$buyRice = boolval($buyRice);
|
||||||
$amount = $this->arg['amount']??null;
|
$amount = $this->arg['amount']??null;
|
||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
@@ -53,6 +54,12 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBrief(): string
|
||||||
|
{
|
||||||
|
$buyRiceText = $this->arg['buyRice']?'구입':'판매';
|
||||||
|
return "군량 {$this->arg['amount']}을 {$buyRiceText}";
|
||||||
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init(){
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
@@ -174,5 +181,42 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getForm(): string
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
자신의 군량을 사거나 팝니다.<br>
|
||||||
|
<select id='buyRice' name="buyRice" size=1 style=color:white;background-color:black>
|
||||||
|
<option value='false'>팜</option>
|
||||||
|
<option value='true'>삼</option>
|
||||||
|
</select>
|
||||||
|
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
||||||
|
<option value=100>100</option>
|
||||||
|
<option value=200>200</option>
|
||||||
|
<option value=300>300</option>
|
||||||
|
<option value=400>400</option>
|
||||||
|
<option value=500>500</option>
|
||||||
|
<option value=600>600</option>
|
||||||
|
<option value=700>700</option>
|
||||||
|
<option value=800>800</option>
|
||||||
|
<option value=900>900</option>
|
||||||
|
<option value=1000>1000</option>
|
||||||
|
<option value=1200>1200</option>
|
||||||
|
<option value=1500>1500</option>
|
||||||
|
<option value=2000>2000</option>
|
||||||
|
<option value=2500>2500</option>
|
||||||
|
<option value=3000>3000</option>
|
||||||
|
<option value=4000>4000</option>
|
||||||
|
<option value=5000>5000</option>
|
||||||
|
<option value=6000>6000</option>
|
||||||
|
<option value=7000>7000</option>
|
||||||
|
<option value=8000>8000</option>
|
||||||
|
<option value=9000>9000</option>
|
||||||
|
<option value=10000>10000</option>
|
||||||
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ class che_등용 extends Command\GeneralCommand{
|
|||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation();
|
$this->setNation(['gennum', 'scout']);
|
||||||
|
|
||||||
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation'], 0);
|
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation'], 0);
|
||||||
$this->setDestGeneral($destGeneral);
|
$this->setDestGeneral($destGeneral);
|
||||||
@@ -153,14 +153,7 @@ class che_등용 extends Command\GeneralCommand{
|
|||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$form = [];
|
|
||||||
|
|
||||||
$form[] = <<<EOT
|
|
||||||
재야나 타국의 장수를 등용합니다.<br>
|
|
||||||
서신은 개인 메세지로 전달됩니다.<br>
|
|
||||||
등용할 장수를 목록에서 선택하세요.<br>
|
|
||||||
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
|
||||||
EOT;
|
|
||||||
$destGenerals = [];
|
$destGenerals = [];
|
||||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||||
foreach($destRawGenerals as $destGeneral){
|
foreach($destRawGenerals as $destGeneral){
|
||||||
@@ -172,25 +165,28 @@ EOT;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nationList = array_merge([0=>getNationStaticInfo(0)], getAllNationStaticInfo());
|
$nationList = array_merge([0=>getNationStaticInfo(0)], getAllNationStaticInfo());
|
||||||
foreach($nationList as $destNation){
|
|
||||||
$form[] = "<option style='color:{$destNation['color']}'>【 {$destNation['name']} 】</option>";
|
|
||||||
$destNationID = $destNation['nation'];
|
|
||||||
if(!key_exists($destNationID, $destGenerals)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($destGenerals[$destNationID] as $destGeneral){
|
ob_start();
|
||||||
|
?>
|
||||||
|
재야나 타국의 장수를 등용합니다.<br>
|
||||||
|
서신은 개인 메세지로 전달됩니다.<br>
|
||||||
|
등용할 장수를 목록에서 선택하세요.<br>
|
||||||
|
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
||||||
|
<?php foreach($nationList as $destNation): ?>
|
||||||
|
<optgroup style='color:<?=$destNation['color']?>'>【<?=$destNation['name']?>】
|
||||||
|
<?php foreach($destGenerals[$destNation['nation']]??[] as $destGeneral):
|
||||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
||||||
if($nameColor){
|
if($nameColor){
|
||||||
$nameColor = " style='color:{$nameColor}'";
|
$nameColor = " style='color:{$nameColor}'";
|
||||||
}
|
}
|
||||||
$form[] = "<option value='{$destGeneral['no']}' {$nameColor}>{$destGeneral['name']}</option>";
|
?>
|
||||||
}
|
<option value='<?=$destGeneral['no']?>' <?=$nameColor?>><?=$destGeneral['name']?></option>
|
||||||
}
|
<?php endforeach; ?>
|
||||||
|
</optgroup>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
$form[] = '</select>';
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
$form[] = '<input type="submit" value="등용">';
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
return join("\n",$form);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,22 +166,21 @@ class che_이동 extends Command\GeneralCommand{
|
|||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
$currentCityID = $this->generalObj->getCityID();
|
$currentCityID = $this->generalObj->getCityID();
|
||||||
|
|
||||||
$form = [];
|
|
||||||
$form[] = \sammo\getMapHtml();
|
|
||||||
$currentCityName = CityConst::byID($currentCityID)->name;
|
$currentCityName = CityConst::byID($currentCityID)->name;
|
||||||
|
|
||||||
$form[] = <<<EOT
|
ob_start();
|
||||||
|
?>
|
||||||
|
<?=\sammo\getMapHtml()?><br>
|
||||||
선택된 도시로 이동합니다.<br>
|
선택된 도시로 이동합니다.<br>
|
||||||
인접 도시로만 이동이 가능합니다.<br>
|
인접 도시로만 이동이 가능합니다.<br>
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||||
{$currentCityName} => <select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
<?=$currentCityName?> => <select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'><br>
|
||||||
EOT;
|
<?=\sammo\optionsForCities()?><br>
|
||||||
$form[] = \sammo\optionsForCities();
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
$form[] = '</select> <input type=button id="commonSubmit" value="이동">';
|
<br>
|
||||||
$form[] = '';
|
<br>
|
||||||
$form[] = printCitiesBasedOnDistance($currentCityID, 1);
|
<?=printCitiesBasedOnDistance($currentCityID, 1)?>
|
||||||
|
<?php
|
||||||
return join("<br>\n",$form);
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,13 +7,15 @@ use \sammo\{
|
|||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst, GameUnitConst,
|
GameConst, GameUnitConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
Command
|
Command,
|
||||||
|
Json
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
use function \sammo\{
|
use function \sammo\{
|
||||||
tryUniqueItemLottery,
|
tryUniqueItemLottery,
|
||||||
getInvitationList
|
getInvitationList,
|
||||||
|
getNationStaticInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
@@ -93,7 +95,7 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
|
|
||||||
$this->runnableConstraints=[
|
$this->runnableConstraints=[
|
||||||
ConstraintHelper::ReqEnvValue('join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'),
|
ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'),
|
||||||
ConstraintHelper::BeNeutral(),
|
ConstraintHelper::BeNeutral(),
|
||||||
ConstraintHelper::ExistsDestNation(),
|
ConstraintHelper::ExistsDestNation(),
|
||||||
ConstraintHelper::AllowJoinDestNation($relYear),
|
ConstraintHelper::AllowJoinDestNation($relYear),
|
||||||
@@ -113,6 +115,13 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBrief():string{
|
||||||
|
$commandName = $this->getName();
|
||||||
|
$destNationName = getNationStaticInfo($this->arg['destNationID'])['name'];
|
||||||
|
$josaRo = JosaUtil::pick($destNationName, '로');
|
||||||
|
return "【{$destNationName}】{$josaRo} {$commandName}";
|
||||||
|
}
|
||||||
|
|
||||||
public function run():bool{
|
public function run():bool{
|
||||||
if(!$this->isRunnable()){
|
if(!$this->isRunnable()){
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
@@ -153,7 +162,7 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
$general->setVar('city', $this->destGeneralObj->getCityID());
|
$general->setVar('city', $this->destGeneralObj->getCityID());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$targetCityID = $db->queryFirstField('SELECT city FROM nation WHERE nation = %i AND level=12', $destNationID);
|
$targetCityID = $db->queryFirstField('SELECT city FROM general WHERE nation = %i AND level=12', $destNationID);
|
||||||
$general->setVar('city', $targetCityID);
|
$general->setVar('city', $targetCityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,18 +196,13 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$joinedNations = Json::decode($db->queryFirstField('SELECT nations FROM general WHERE no = %i', $generalObj->getID()));
|
$joinedNations = \sammo\Json::decode($db->queryFirstField('SELECT nations FROM general WHERE no = %i', $generalObj->getID()));
|
||||||
|
|
||||||
$nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation');
|
$nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation');
|
||||||
shuffle($nationList);
|
shuffle($nationList);
|
||||||
|
|
||||||
$onlyRandom = $env['join_mode'] == 'onlyRandom';
|
|
||||||
|
|
||||||
foreach($nationList as &$nation){
|
foreach($nationList as &$nation){
|
||||||
if ($onlyRandom && TimeUtil::IsRangeMonth($env['init_year'], $env['init_month'], 1, $env['year'], $env['month']) && $nation['gennum'] >= GameConst::$initialNationGenLimitForRandInit) {
|
if($env['year'] < $env['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
|
||||||
$nation['availableJoin'] = false;
|
|
||||||
}
|
|
||||||
else if($env['year'] < $env['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
|
|
||||||
$nation['availableJoin'] = false;
|
$nation['availableJoin'] = false;
|
||||||
}
|
}
|
||||||
else if($nation['scout'] == 1) {
|
else if($nation['scout'] == 1) {
|
||||||
@@ -213,26 +217,22 @@ class che_임관 extends Command\GeneralCommand{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($nation);
|
unset($nation);
|
||||||
|
ob_start();
|
||||||
$form[] = <<<EOT
|
?>
|
||||||
국가에 임관합니다.<br>
|
국가에 임관합니다.<br>
|
||||||
이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.<br>
|
이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.<br>
|
||||||
바로 군주의 위치로 이동합니다.<br>
|
바로 군주의 위치로 이동합니다.<br>
|
||||||
임관할 국가를 목록에서 선택하세요.<br>
|
임관할 국가를 목록에서 선택하세요.<br>
|
||||||
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
||||||
EOT;
|
<?php foreach($nationList as $nation): ?>
|
||||||
foreach($nationList as $nation){
|
<option
|
||||||
$css = "color:{$nation['color']};";
|
value='<?=$nation['nation']?>'
|
||||||
if(!$nation['availableJoin']){
|
style='color:<?=$nation['color']?><?=$nation['availableJoin']?'':'background-color:red;'?>'
|
||||||
$css.= 'background-color:red;';
|
>【<?=$nation['name']?> 】</option>
|
||||||
}
|
<?php endforeach; ?>
|
||||||
$form[] = "<option value='{$nation['nation']}' style='$css'>【 {$nation['name']} 】</option>";
|
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
||||||
}
|
<?=getInvitationList($nationList)?>
|
||||||
$form[] = <<<EOT
|
<?php
|
||||||
</select>
|
return ob_get_clean();
|
||||||
<input type=submit value='임관'>
|
|
||||||
EOT;
|
|
||||||
$form[] = getInvitationList($nationList);
|
|
||||||
return join("\n",$form);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,34 +159,30 @@ class che_증여 extends Command\GeneralCommand{
|
|||||||
{
|
{
|
||||||
//TODO: 암행부처럼 보여야...
|
//TODO: 암행부처럼 보여야...
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$form = [];
|
|
||||||
|
|
||||||
$form[] = <<<EOT
|
$destRawGenerals = $db->query('SELECT no,name,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();
|
||||||
|
?>
|
||||||
자신의 자금이나 군량을 다른 장수에게 증여합니다.<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;'>
|
||||||
EOT;
|
<?php foreach($destRawGenerals as $destGeneral):
|
||||||
$destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
$color = \sammo\getNameColor($destGeneral['npc']);
|
||||||
foreach($destRawGenerals as $destGeneral){
|
if($color){
|
||||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
$color = " style='color:{$color}'";
|
||||||
if($nameColor){
|
|
||||||
$nameColor = " style='color:{$nameColor}'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $destGeneral['name'];
|
$name = $destGeneral['name'];
|
||||||
if($destGeneral['level'] >= 5){
|
if($destGeneral['level'] >= 5){
|
||||||
$name = "*{$name}*";
|
$name = "*{$name}*";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
$form[] = "<option value='{$destGeneral['no']}' {$nameColor}>{$name}(금:{$destGeneral['gold']}, 쌀:{$destGeneral['rice']})</option>";
|
<option value='<?=$destGeneral['no']?>' <?=$color?>><?=$name?>(금:<?=$destGeneral['gold']?>, 쌀:<?=$destGeneral['rice']?>)</option>
|
||||||
}
|
<?php endforeach; ?>
|
||||||
$form[] = <<<EOT
|
|
||||||
</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>
|
|
||||||
<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;'>
|
||||||
<option value=1>100</option>
|
<option value=1>100</option>
|
||||||
<option value=2>200</option>
|
<option value=2>200</option>
|
||||||
@@ -210,9 +206,8 @@ EOT;
|
|||||||
<option value=80>8000</option>
|
<option value=80>8000</option>
|
||||||
<option value=90>9000</option>
|
<option value=90>9000</option>
|
||||||
<option value=100>10000</option>
|
<option value=100>10000</option>
|
||||||
</select>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<input type="submit" value="증여">
|
<?php
|
||||||
EOT;
|
return ob_get_clean();
|
||||||
return join("\n",$form);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,13 @@ class che_헌납 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBrief(): string
|
||||||
|
{
|
||||||
|
$resText = $this->arg['isGold']?'금':'쌀';
|
||||||
|
$name = $this->getName();
|
||||||
|
return "{$resText} {$this->arg['amount']}을 {$name}";
|
||||||
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle():string{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
return "{$name}(통솔경험)";
|
return "{$name}(통솔경험)";
|
||||||
@@ -137,42 +144,38 @@ class che_헌납 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
//TODO: 암행부처럼 보여야...
|
ob_start();
|
||||||
$form = [];
|
?>
|
||||||
|
|
||||||
$form[] = <<<EOT
|
|
||||||
자신의 자금이나 군량을 국가 재산으로 헌납합니다.<br>
|
자신의 자금이나 군량을 국가 재산으로 헌납합니다.<br>
|
||||||
<select class='formInput' name="isGold" id="isGold" size='1' style='color:white;background-color:black;'>
|
<select id='isGold' name="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>
|
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
<option value=100>100</option>
|
||||||
<option value=1>100</option>
|
<option value=200>200</option>
|
||||||
<option value=2>200</option>
|
<option value=300>300</option>
|
||||||
<option value=3>300</option>
|
<option value=400>400</option>
|
||||||
<option value=4>400</option>
|
<option value=500>500</option>
|
||||||
<option value=5>500</option>
|
<option value=600>600</option>
|
||||||
<option value=6>600</option>
|
<option value=700>700</option>
|
||||||
<option value=7>700</option>
|
<option value=800>800</option>
|
||||||
<option value=8>800</option>
|
<option value=900>900</option>
|
||||||
<option value=9>900</option>
|
<option value=1000>1000</option>
|
||||||
<option value=10>1000</option>
|
<option value=1200>1200</option>
|
||||||
<option value=12>1200</option>
|
<option value=1500>1500</option>
|
||||||
<option value=15>1500</option>
|
<option value=2000>2000</option>
|
||||||
<option value=20>2000</option>
|
<option value=2500>2500</option>
|
||||||
<option value=25>2500</option>
|
<option value=3000>3000</option>
|
||||||
<option value=30>3000</option>
|
<option value=4000>4000</option>
|
||||||
<option value=40>4000</option>
|
<option value=5000>5000</option>
|
||||||
<option value=50>5000</option>
|
<option value=6000>6000</option>
|
||||||
<option value=60>6000</option>
|
<option value=7000>7000</option>
|
||||||
<option value=70>7000</option>
|
<option value=8000>8000</option>
|
||||||
<option value=80>8000</option>
|
<option value=9000>9000</option>
|
||||||
<option value=90>9000</option>
|
<option value=10000>10000</option>
|
||||||
<option value=100>10000</option>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
</select>
|
<?php
|
||||||
<input type="submit" value="헌납">
|
return ob_get_clean();
|
||||||
EOT;
|
|
||||||
return join("\n",$form);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,8 @@ use \sammo\{
|
|||||||
|
|
||||||
|
|
||||||
use function \sammo\{
|
use function \sammo\{
|
||||||
searchDistance
|
searchDistance,
|
||||||
|
printCitiesBasedOnDistance
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
@@ -320,22 +321,23 @@ class che_화계 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
public function getForm(): string
|
public function getForm(): string
|
||||||
{
|
{
|
||||||
$form = [];
|
$currentCityID = $this->generalObj->getCityID();
|
||||||
$form[] = \sammo\getMapHtml();
|
$commandName = $this->getName();
|
||||||
|
$josaUl = JosaUtil::pick($commandName, '을');
|
||||||
|
|
||||||
$josaUl = JosaUtil::pick($this->getName(), '을');
|
ob_start();
|
||||||
|
?>
|
||||||
$form[] = <<<EOT
|
<?=\sammo\getMapHtml()?><br>
|
||||||
선택된 도시에 {$this->getName()}{$josaUl} 실행합니다.<br>
|
선택된 도시에 <?=$commandName?><?=$josaUl?> 실행합니다.<br>
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'><br>
|
||||||
EOT;
|
<?=\sammo\optionsForCities()?><br>
|
||||||
$form[] = \sammo\optionsForCities();
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
$form[] = '</select>';
|
<br>
|
||||||
$form[] = "<input type=submit value='{$this->getName()}>";
|
<br>
|
||||||
$form[] = printCitiesBasedOnDistance($this->generalObj->getCityID(), 2);
|
<?=printCitiesBasedOnDistance($currentCityID, 2)?>
|
||||||
|
<?php
|
||||||
return join("\n",$form);
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ class AllowJoinDestNation extends Constraint{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('scout', $this->nation)){
|
if(!key_exists('scout', $this->destNation)){
|
||||||
if(!$throwExeception){return false; }
|
if(!$throwExeception){return false; }
|
||||||
throw new \InvalidArgumentException("require scout in nation");
|
throw new \InvalidArgumentException("require scout in nation");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('gennum', $this->nation)){
|
if(!key_exists('gennum', $this->destNation)){
|
||||||
if(!$throwExeception){return false; }
|
if(!$throwExeception){return false; }
|
||||||
throw new \InvalidArgumentException("require gennum in nation");
|
throw new \InvalidArgumentException("require gennum in nation");
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class AllowJoinDestNation extends Constraint{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$joinedNations = Json::decode($this->general['nations']);
|
$joinedNations = \sammo\Json::decode($this->general['nations']);
|
||||||
if(in_array($this->destNation['nation'], $joinedNations)){
|
if(in_array($this->destNation['nation'], $joinedNations)){
|
||||||
$this->reason = "이미 임관했었던 국가입니다.";
|
$this->reason = "이미 임관했었던 국가입니다.";
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ class GameConstBase
|
|||||||
'che_이동',
|
'che_이동',
|
||||||
'che_강행',
|
'che_강행',
|
||||||
'che_인재탐색',
|
'che_인재탐색',
|
||||||
|
'che_등용',
|
||||||
'che_집합',
|
'che_집합',
|
||||||
'che_귀환',
|
'che_귀환',
|
||||||
'che_임관',
|
'che_임관',
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ class GeneralAI{
|
|||||||
|
|
||||||
if($targetNpcWarGeneral->$resName < $reqMoney){
|
if($targetNpcWarGeneral->$resName < $reqMoney){
|
||||||
//국고 1/5과 '충분한 금액'의 기하평균
|
//국고 1/5과 '충분한 금액'의 기하평균
|
||||||
$payAmount = sqrt($enoughMoney - $reqMoney, $remainResource[$resName] / 5);
|
$payAmount = sqrt(($enoughMoney - $reqMoney) * ($remainResource[$resName] / 5));
|
||||||
if ($remainResource[$resName] >= $payAmount / 2) {
|
if ($remainResource[$resName] >= $payAmount / 2) {
|
||||||
$candidateCommand[] = [
|
$candidateCommand[] = [
|
||||||
['che_포상', [
|
['che_포상', [
|
||||||
@@ -454,7 +454,7 @@ class GeneralAI{
|
|||||||
|
|
||||||
if($targetNpcWarGeneral->$resName < $reqMoney){
|
if($targetNpcWarGeneral->$resName < $reqMoney){
|
||||||
//국고와 '충분한 금액'의 기하평균
|
//국고와 '충분한 금액'의 기하평균
|
||||||
$payAmount = sqrt($enoughMoney - $reqMoney, $remainResource[$resName]);
|
$payAmount = sqrt(($enoughMoney - $reqMoney) * $remainResource[$resName]);
|
||||||
|
|
||||||
if($remainResource[$resName] >= $payAmount / 2){
|
if($remainResource[$resName] >= $payAmount / 2){
|
||||||
$candidateCommand[] = [
|
$candidateCommand[] = [
|
||||||
@@ -672,7 +672,7 @@ class GeneralAI{
|
|||||||
$isWarUser = null;
|
$isWarUser = null;
|
||||||
|
|
||||||
foreach($userGenerals as $compUser){
|
foreach($userGenerals as $compUser){
|
||||||
if($compUser['leadership'] >= 50){
|
if($compUser->leadership >= 50){
|
||||||
$isWarUser = true;
|
$isWarUser = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -686,7 +686,7 @@ class GeneralAI{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$compRes = $compUser[$resName];
|
$compRes = $compUser->$resName;
|
||||||
|
|
||||||
$work = false;
|
$work = false;
|
||||||
if(!$isWarUser){
|
if(!$isWarUser){
|
||||||
@@ -697,7 +697,7 @@ class GeneralAI{
|
|||||||
$work = true;
|
$work = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((($isWarUser || $resName == 'gold') && $compUser[$resName] < 21000) || ($compUser[$resName] < 5000)){
|
if((($isWarUser || $resName == 'gold') && $compUser->$resName < 21000) || ($compUser->$resName < 5000)){
|
||||||
if($work){
|
if($work){
|
||||||
$amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*10 + 10);
|
$amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*10 + 10);
|
||||||
$commandList[] = [['che_포상', [
|
$commandList[] = [['che_포상', [
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ trait LazyVarUpdater{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateVar(string $key, $value){
|
function updateVar(string $key, $value){
|
||||||
if($this->raw[$key] === $value){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!key_exists($key, $this->updatedVar)){
|
if(!key_exists($key, $this->updatedVar)){
|
||||||
$this->updatedVar[$key] = $this->raw[$key];
|
$this->updatedVar[$key] = $this->raw[$key];
|
||||||
}
|
}
|
||||||
|
if($this->raw[$key] === $value){
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->raw[$key] = $value;
|
$this->raw[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user