버그 수정..
This commit is contained in:
@@ -30,6 +30,15 @@ $db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
switch($btn) {
|
||||
case "분당김":
|
||||
$locked = false;
|
||||
for($i = 0; $i < 10; $i++){
|
||||
if(tryLock()){
|
||||
$locked = true;
|
||||
break;
|
||||
}
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
$gameStor->cacheValues(['turntime', 'starttime', 'tnmt_time']);
|
||||
$turntime = (new \DateTimeImmutable($gameStor->turntime))->sub(new \DateInterval("PT{$minute}M"));
|
||||
$starttime = (new \DateTimeImmutable($gameStor->starttime))->sub(new \DateInterval("PT{$minute}M"));
|
||||
@@ -45,8 +54,19 @@ case "분당김":
|
||||
$db->update('auction', [
|
||||
'expire'=>$db->sqleval('DATE_SUB(expire, INTERVAL %i MINUTE)', $minute)
|
||||
], true);
|
||||
if($locked){
|
||||
unlock();
|
||||
}
|
||||
break;
|
||||
case "분지연":
|
||||
$locked = false;
|
||||
for($i = 0; $i < 5; $i++){
|
||||
if(tryLock()){
|
||||
$locked = true;
|
||||
break;
|
||||
}
|
||||
sleep(0.5);
|
||||
}
|
||||
$gameStor->cacheValues(['turntime', 'starttime', 'tnmt_time']);
|
||||
$turntime = (new \DateTimeImmutable($gameStor->turntime))->add(new \DateInterval("PT{$minute}M"));
|
||||
$starttime = (new \DateTimeImmutable($gameStor->starttime))->add(new \DateInterval("PT{$minute}M"));
|
||||
@@ -62,6 +82,9 @@ case "분지연":
|
||||
$db->update('auction', [
|
||||
'expire'=>$db->sqleval('DATE_ADD(expire, INTERVAL %i MINUTE)', $minute)
|
||||
], true);
|
||||
if($locked){
|
||||
unlock();
|
||||
}
|
||||
break;
|
||||
case "토너분당김":
|
||||
$tnmt_time = new \DateTime($gameStor->tnmt_time);
|
||||
|
||||
+2
-2
@@ -150,7 +150,7 @@ function cityInfo(General $generalObj) {
|
||||
$city['nationTextColor'] = newColor($nation['color']);
|
||||
$city['nationColor'] = $nation['color'];
|
||||
$city['region'] = CityConst::$regionMap[$city['region']];
|
||||
$city['level'] = CityConst::$levelMap[$city['level']];
|
||||
$city['levelText'] = CityConst::$levelMap[$city['level']];
|
||||
|
||||
$officerQuery = [];
|
||||
$officerName = [
|
||||
@@ -1151,7 +1151,7 @@ function checkDelay() {
|
||||
$threshold = 3;
|
||||
}
|
||||
else{
|
||||
$threshold = 20;//TODO:디버깅용. 꼭 고칠것. 원래 값은 6이었음.
|
||||
$threshold = 6;
|
||||
}
|
||||
//지연 해야할 밀린 턴 횟수
|
||||
$iter = intdiv($timeMinDiff, $term);
|
||||
|
||||
@@ -191,7 +191,7 @@ function calcCityRiceIncome(array $rawCity, int $officerCnt, bool $isCapital, in
|
||||
|
||||
$trustRatio = $rawCity['trust'] / 200 + 0.5;//0.5 ~ 1
|
||||
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['agri'] / $rawCity['agri'] * $trustRatio / 30;
|
||||
$cityIncome = $rawCity['pop'] * $rawCity['agri'] / $rawCity['agri2'] * $trustRatio / 30;
|
||||
$cityIncome *= 1 + $rawCity['secu']/$rawCity['secu2']/10;
|
||||
$cityIncome *= pow(1.05, $officerCnt);
|
||||
if($isCapital){
|
||||
@@ -238,7 +238,7 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
$cityID = $rawCity['city'];
|
||||
foreach ([2,3,4] as $officerLevel) {
|
||||
$officerCnt = 0;
|
||||
if($officers[$rawCity['officer'.$officerLevel]] == $cityID){
|
||||
if($officers[$rawCity['officer'.$officerLevel]]??0 == $cityID){
|
||||
$officerCnt += 1;
|
||||
}
|
||||
}
|
||||
@@ -261,7 +261,7 @@ function processWarIncome() {
|
||||
continue;
|
||||
}
|
||||
$nationID = $nation['nation'];
|
||||
$income = getWarGoldIncome($nation['type'], $cityListByNation[$nationID]);
|
||||
$income = getWarGoldIncome($nation['type'], $cityListByNation[$nationID]??[]);
|
||||
$db->update('nation', [
|
||||
'gold'=>$db->sqleval('gold + %i', $income)
|
||||
], 'nation=%i', $nationID);
|
||||
@@ -274,7 +274,7 @@ function processWarIncome() {
|
||||
], true);
|
||||
}
|
||||
|
||||
function getWarGoldIncome(string $nationType, $cityList){
|
||||
function getWarGoldIncome(string $nationType, array $cityList){
|
||||
$nationTypeObj = buildNationTypeClass($nationType);
|
||||
|
||||
$cityIncome = 0;
|
||||
@@ -443,7 +443,7 @@ function getWallIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
$cityID = $rawCity['city'];
|
||||
foreach ([2,3,4] as $officerLevel) {
|
||||
$officerCnt = 0;
|
||||
if($officers[$rawCity['officer'.$officerLevel]] == $cityID){
|
||||
if($officers[$rawCity['officer'.$officerLevel]]??0 == $cityID){
|
||||
$officerCnt += 1;
|
||||
}
|
||||
}
|
||||
@@ -605,7 +605,7 @@ function disaster() {
|
||||
function($rawGeneral) use ($city, $year, $month){
|
||||
return new General($rawGeneral, $city, $year, $month, false);
|
||||
},
|
||||
$generalListByCity[$city['city']]
|
||||
$generalListByCity[$city['city']]??[]
|
||||
);
|
||||
|
||||
SabotageInjury($generalList, '재난');
|
||||
|
||||
@@ -49,7 +49,7 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation(['tech']);
|
||||
$this->setDestCity($this->arg['destCityID'], []);
|
||||
$this->setDestCity($this->arg['destCityID'], null);
|
||||
$this->setDestNation($this->destCity['nation'], ['tech']);
|
||||
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
@@ -61,6 +61,11 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
];
|
||||
}
|
||||
|
||||
public function getBrief():string{
|
||||
$cityName = $this->destCity['name'];
|
||||
return "【{$cityName}】에 {$this->getName()} 실행";
|
||||
}
|
||||
|
||||
public function getCommandDetailTitle():string{
|
||||
$name = $this->getName();
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
@@ -121,7 +126,7 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
|
||||
$dist = searchDistance($general->getCityID(), 2, false)[$destCityID]??3;
|
||||
|
||||
$destCityGeneralList = $db->query('SELECT crew, crewtype FROM general WHERE city = %i AND nation = %i');
|
||||
$destCityGeneralList = $db->query('SELECT crew, crewtype FROM general WHERE city = %i AND nation = %i', $destCityID, $destNationID);
|
||||
$totalCrew = Util::arraySum($destCityGeneralList, 'crew');
|
||||
$totalGenCnt = count($destCityGeneralList);
|
||||
$byCrewType = Util::arrayGroupBy($destCityGeneralList, 'crewtype');
|
||||
@@ -207,21 +212,21 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
$form = [];
|
||||
$form[] = \sammo\getMapHtml();
|
||||
|
||||
$form[] = <<<EOT
|
||||
$currentCityID = $this->generalObj->getCityID();
|
||||
ob_start();
|
||||
?>
|
||||
<?=\sammo\getMapHtml()?><br>
|
||||
선택된 도시에 첩보를 실행합니다.<br>
|
||||
인접도시일 경우 많은 정보를 얻을 수 있습니다.<br>
|
||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
||||
EOT;
|
||||
$form[] = \sammo\optionsForCities();
|
||||
$form[] = '</select>';
|
||||
$form[] = '<input type=submit value="첩보">';
|
||||
$form[] = printCitiesBasedOnDistance($this->generalObj->getCityID(), 3);
|
||||
|
||||
return join("\n",$form);
|
||||
<select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'><br>
|
||||
<?=\sammo\optionsForCities()?><br>
|
||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||
<br>
|
||||
<br>
|
||||
<?=printCitiesBasedOnDistance($currentCityID, 3)?>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<table style='width:100%;' class='tb_layout bg2'>
|
||||
<tr><td colspan=8 style='text-align:center;height:20px;color:<?=$nationTextColor?>;background-color:<?=$nationColor?>;font-weight:bold;font-size:13px;'>【 <?=$region?> | <?=$level?> 】 <?=$name?></td></tr>
|
||||
<tr><td colspan=8 style='text-align:center;height:20px;color:<?=$nationTextColor?>;background-color:<?=$nationColor?>'><b><?=$nationName?'공 백 지':"지배 국가 【 {$nationName} 】"?></b></td>
|
||||
<tr><td colspan=8 style='text-align:center;height:20px;color:<?=$nationTextColor?>;background-color:<?=$nationColor?>;font-weight:bold;font-size:13px;'>【 <?=$region?> | <?=$levelText?> 】 <?=$name?></td></tr>
|
||||
<tr><td colspan=8 style='text-align:center;height:20px;color:<?=$nationTextColor?>;background-color:<?=$nationColor?>'><b><?=$nationName?"지배 국가 【 {$nationName} 】":'공 백 지'?></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>주민</b></td>
|
||||
|
||||
Reference in New Issue
Block a user