버그 수정

This commit is contained in:
2020-04-19 06:18:35 +09:00
parent 17d9853e90
commit e63b46b004
7 changed files with 38 additions and 45 deletions
+2 -2
View File
@@ -114,14 +114,14 @@ $generalObj = General::createGeneralObjFromDB($gen);
정렬순서 :
<select name=type size=1>
<?php foreach($queryMap as $queryType => [$queryTypeText,]): ?>
<option <?=$queryKey==$reqQueryType?'selected':''?> value='<?=$queryKey?>'><?=$queryTypeText?></option>
<option <?=$queryType==$reqQueryType?'selected':''?> value='<?=$queryType?>'><?=$queryTypeText?></option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='정렬하기'>
대상장수 :
<select name=gen size=1>
<?php foreach($generalBasicList as $general): ?>
<option <?=$gen==$general['no']?'selected':''?>><?=getNationStaticInfo($general['nation'])['name']?> - <?=$general['name']?> (<?=$general['turntime']?>)</option>
<option <?=$gen==$general['no']?'selected':''?> value='<?=$general['no']?>'><?=$general['name']?> (<?=$general['turntime']?>)</option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='조회하기'>
+13 -20
View File
@@ -54,17 +54,10 @@ increaseRefresh("감찰부", 2);
TurnExecutionHelper::executeAllCommand();
$gameStor->resetCache();
$query = "select nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$general = MYDB_fetch_array($result);
$testGeneralNationID = $db->queryFirstField('SELECT nation FROM general WHERE no = %i', $gen);
$query = "select no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result);
$query = "select secretlimit from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nation = MYDB_fetch_array($result);
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner=%i', $userID);
$nationID = $me['nation'];
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -83,7 +76,7 @@ else if ($permission < 1) {
}
//잘못된 접근
if ($general['nation'] != $me['nation']) {
if ($testGeneralNationID != $nationID) {
$gen = 0;
}
@@ -94,24 +87,24 @@ if ($btn == '정렬하기') {
[$queryTypeText, $reqArgType, $comp] = $queryMap[$reqQueryType];
if($reqArgType===0){
$generalBasicList = $db->query('SELECT no, name, npc, turntime FROM general');
$generalBasicList = $db->query('SELECT no, name, npc, turntime FROM general WHERE nation = %i', $nationID);
}
else if($reqArgType===1){
$generalBasicList = $db->query('SELECT no, name, npc, turntime, %b FROM general', $reqQueryType);
$generalBasicList = $db->query('SELECT no, name, npc, turntime, %b FROM general WHERE nation = %i', $reqQueryType, $nationID);
}
else if($reqArgType===2){
$generalBasicList = $db->query('SELECT no, name, npc, turntime, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
WHERE rank_data.type = %b',
$reqQueryType, $reqQueryType
WHERE rank_data.type = %b AND general.nation = %i',
$reqQueryType, $reqQueryType, $nationID
);
}
else if($reqArgType===3){
$generalBasicList = array_map(function($arr){
$arr['aux'] = Json::decode($arr['aux']);
return $arr;
}, $db->query('SELECT no, name, npc, turntime, aux FROM general'));
}, $db->query('SELECT no, name, npc, turntime, aux FROM general WHERE nation = %i', $nationID));
}
else{
throw new \sammo\MustNotBeReachedException();
@@ -148,16 +141,16 @@ $showGeneral = General::createGeneralObjFromDB($gen);
<tr><td>
<form name=form1 method=post>
정렬순서 :
<select name=type size=1>
<select name='query_type' size=1>
<?php foreach($queryMap as $queryType => [$queryTypeText,]): ?>
<option <?=$queryKey==$reqQueryType?'selected':''?> value='<?=$queryKey?>'><?=$queryTypeText?></option>
<option <?=$queryType==$reqQueryType?'selected':''?> value='<?=$queryType?>'><?=$queryTypeText?></option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='정렬하기'>
대상장수 :
<select name=gen size=1>
<?php foreach($generalBasicList as $general): ?>
<option <?=$gen==$general['no']?'selected':''?>><?=$general['name']?> (<?=$general['turntime']?>)</option>
<option <?=$gen==$general['no']?'selected':''?> value='<?=$general['no']?>'><?=$general['name']?> (<?=$general['turntime']?>)</option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='조회하기'>
@@ -189,7 +182,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
<?=formatHistoryToHTML(getBatResRecent($gen, 24))?>
</td>
</tr>
<?php if($npc > 1 || $permission >= 2): ?>
<?php if($showGeneral->getVar('npc') > 1 || $permission >= 2): ?>
<tr>
<td align=center id=bg1><font color=orange size=3>개인 기록</font></td>
<td align=center id=bg1><font color=orange size=3>&nbsp;</font></td>
+3 -2
View File
@@ -39,7 +39,7 @@ class AutorunGeneralPolicy{
static public $priority = [
static public $default_priority = [
'NPC사망대비',
'귀환',
'금쌀구매',
@@ -114,7 +114,8 @@ class AutorunGeneralPolicy{
}
function __construct(General $general, $aiOptions){
//TODO: 국가 정책을 받아와야함
$this->priority = static::$default_priority;
if($general->getVar('npc') >= 2){
$this->doNPCState($general);
@@ -38,7 +38,7 @@ class che_군량매매 extends Command\GeneralCommand{
if(!is_int($amount)){
return false;
}
$amount = Util::valueFit($amount, 100, GameConst::$maxIncentiveAmount);
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
$this->arg = [
'buyRice'=>$buyRice,
+2 -3
View File
@@ -165,12 +165,11 @@ class che_징병 extends Command\GeneralCommand{
$currCrewType = $this->currCrewType;
$crewTypeName = $reqCrewType->name;
$josaUl = JosaUtil::pick($crewTypeName, '을');
$logger = $general->getLogger();
if($reqCrewType->id == $currCrewType->id && $currCrew > 0){
$logger->pushGeneralActionLog("{$crewTypeName}{$josaUl} <C>{$reqCrewText}</>명을 추가{$this->getName()}했습니다. <1>$date</>");
$logger->pushGeneralActionLog("{$crewTypeName} <C>{$reqCrewText}</>명을 추가{$this->getName()}했습니다. <1>$date</>");
$train = ($currCrew * $general->getVar('train') + $reqCrew * static::$defaultTrain) / ($currCrew + $reqCrew);
$atmos = ($currCrew * $general->getVar('atmos') + $reqCrew * static::$defaultAtmos) / ($currCrew + $reqCrew);
@@ -179,7 +178,7 @@ class che_징병 extends Command\GeneralCommand{
$general->setVar('atmos', $atmos);
}
else{
$logger->pushGeneralActionLog("{$crewTypeName}{$josaUl} <C>{$reqCrewText}</>명을 {$this->getName()}했습니다. <1>$date</>");
$logger->pushGeneralActionLog("{$crewTypeName} <C>{$reqCrewText}</>명을 {$this->getName()}했습니다. <1>$date</>");
$general->setVar('crewtype', $reqCrewType->id);
$general->setVar('crew', $reqCrew);
$general->setVar('train', static::$defaultTrain);
+16 -16
View File
@@ -85,7 +85,7 @@ class GeneralAI
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$this->env = $gameStor->getValues(['startyear', 'year', 'month', 'turnterm', 'killturn', 'scenario', 'gold_rate', 'rice_rate', 'develcost', 'autorun_user']);
$this->env = $gameStor->getAll(true);
$this->baseDevelCost = $this->env['develcost'] * 12;
$this->general = $general;
if ($general->getRawCity() === null) {
@@ -1684,6 +1684,10 @@ class GeneralAI
}
}
if(!$cmdList){
return null;
}
return Util::choiceRandomUsingWeightPair($cmdList);
}
@@ -2093,7 +2097,7 @@ class GeneralAI
}
}
if(!$cmd){
if(!$cmdList){
return null;
}
return Util::choiceRandomUsingWeightPair($cmdList);
@@ -2251,7 +2255,7 @@ class GeneralAI
return null;
}
if($this->general['crew'] >= $this->nationPolicy->minWarCrew){
if($this->general->getVar('crew') >= $this->nationPolicy->minWarCrew){
return null;
}
@@ -2427,8 +2431,9 @@ class GeneralAI
protected function do귀환(GeneralCommand $reservedCommand): ?GeneralCommand
{
$cityID = $this->general->getCityID();
if(key_exists($cityID, $this->supplyCities)){
$general = $this->general;
$city = $this->city;
if($city['nation'] == $general->getNationID() && $city['supply']){
return null;
}
@@ -2456,7 +2461,7 @@ class GeneralAI
$general = $this->general;
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0');
$nationCities = $db->queryFirstColumn('SELECT city a FROM city WHERE nation != 0');+
$nationCities = $db->queryFirstColumn('SELECT city a FROM city WHERE nation != 0');
$occupiedCities = [];
foreach ($lordCities as $tCityId) {
@@ -2636,7 +2641,7 @@ class GeneralAI
return null;
}
protected function NPC사망대비(): ?GeneralCommand
protected function doNPC사망대비(): ?GeneralCommand
{
$general = $this->getGeneralObj();
@@ -2865,7 +2870,7 @@ class GeneralAI
$this->chooseNonLordPromotion();
}
if($reservedCommand->isRunnable()){
if(!($reservedCommand instanceof Command\NationCommand\휴식) && $reservedCommand->isRunnable()){
return $reservedCommand;
}
@@ -2911,11 +2916,6 @@ class GeneralAI
$npcType = $general->getVar('npc');
$nationID = $general->getNationID();
$cmd = $this->NPC사망대비();
if($cmd){
return $cmd;
}
//특별 메세지 있는 경우 출력 하루 4번
$term = $this->env['turnterm'];
if ($general->getVar('npcmsg') && Util::randBool($term / (6 * 60))) {
@@ -2955,14 +2955,14 @@ class GeneralAI
return $this->do집합($reservedCommand);
}
if($reservedCommand->isRunnable()){
if(!($reservedCommand instanceof Command\General\휴식) && $reservedCommand->isRunnable()){
return $reservedCommand;
}
if ($general->getVar('injury') > 10) {
return buildGeneralCommandClass('che_요양', $general, $this->env);
}
if($npcType == 2 && $nationID == 0){
$result = $this->do거병($reservedCommand);
if($result !== null){
@@ -2977,7 +2977,7 @@ class GeneralAI
}
return $this->do중립($reservedCommand);
}
if($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']){
//방랑군 건국
$result = $this->do건국($reservedCommand);
+1 -1
View File
@@ -269,7 +269,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
}
$generalCommandObj = $ai->chooseGeneralTurn($generalCommandObj); // npc AI 처리
LogText("turn", "General: {$general->getName()}[{$general->getID()},{$general->getStaticNation()['name']}]; run; {$generalCommandObj->getBrief()}");
}
if(!$turnObj->processBlocked()){