diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 387ab906..9fae56ed 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -23,9 +23,7 @@ $query = "select no,nation,level,con,turntime,belong,permission,penalty from gen $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); -$query = "select level from nation where nation='{$me['nation']}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); -$nation = MYDB_fetch_array($result); +$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation=%i', $me['nation']); $con = checkLimit($me['con']); if ($con >= 2) { @@ -47,7 +45,6 @@ $sel = []; $sel[$type] = "selected"; $templates = new \League\Plates\Engine('templates'); - ?> @@ -130,7 +127,7 @@ foreach ($generals as &$general) { $genCntEff += 1; } - $lbonus = calcLeadershipBonus($general['level'], $nationlevel[$general['nation']]); + $lbonus = calcLeadershipBonus($general['level'], $nationLevel); if ($lbonus > 0) { $lbonusText = "+{$lbonus}"; } else { @@ -165,7 +162,7 @@ foreach ($generals as &$general) { if ($general['npc'] < 2) { - foreach($generalTurnList[$generalObj->getID()] as $turnRawIdx=>$turn){ + foreach($generalTurnList[$general['no']] as $turnRawIdx=>$turn){ $turn = StringUtil::subStringForWidth($turn, 0, 41); $turnIdx = $turnRawIdx+1; $turntext[] = " $turnIdx : $turn"; diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index b7c0734c..47591559 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -119,7 +119,11 @@ class che_포상 extends Command\NationCommand{ $resName = $isGold?'금':'쌀'; $destGeneral = $this->destGeneralObj; - $amount = Util::valueFit($amount, 0, $nation[$resKey] - ($isGold?GameConst::$basegold:GameConst::$baserice)); + $amount = Util::valueFit( + $amount, + 0, + $nation[$resKey] - ($isGold?GameConst::$basegold:GameConst::$baserice) + ); $amountText = number_format($amount, 0); $logger = $general->getLogger(); diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 2fed19ab..2b1b0b3a 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -413,7 +413,7 @@ class GeneralAI{ ['che_포상', [ 'destGeneralID' => $this->npcCivilGenerals[0]->id, 'isGold'=>$resName=='gold', - 'amount'=>$this->baseDevelCost + 'amount'=>round($this->baseDevelCost,-2) ]], 1 ]; @@ -430,7 +430,7 @@ class GeneralAI{ if($targetNpcWarGeneral->$resName < $reqMoney){ //국고 1/5과 '충분한 금액'의 기하평균 - $payAmount = sqrt(($enoughMoney - $reqMoney) * ($remainResource[$resName] / 5)); + $payAmount = sqrt(($enoughMoney - $targetNpcWarGeneral->$resName) * ($remainResource[$resName] / 5)); if ($remainResource[$resName] >= $payAmount / 2) { $candidateCommand[] = [ ['che_포상', [ @@ -454,7 +454,7 @@ class GeneralAI{ if($targetNpcWarGeneral->$resName < $reqMoney){ //국고와 '충분한 금액'의 기하평균 - $payAmount = sqrt(($enoughMoney - $reqMoney) * $remainResource[$resName]); + $payAmount = sqrt(($enoughMoney - $targetNpcWarGeneral->$resName) * $remainResource[$resName]); if($remainResource[$resName] >= $payAmount / 2){ $candidateCommand[] = [ @@ -476,7 +476,7 @@ class GeneralAI{ $enoughMoney = $this->baseDevelCost * 1.5; if($targetNpcCivilGeneral->$resName >= $tooMuchMoney){ - $returnAmount = $this->npcCivilGenerals - $enoughMoney; + $returnAmount = $targetNpcCivilGeneral->$resName - $enoughMoney; $candidateCommand[] = [ ['che_몰수', [ 'destGeneralID' => $targetNpcCivilGeneral->id, @@ -699,7 +699,8 @@ class GeneralAI{ if((($isWarUser || $resName == 'gold') && $compUser->$resName < 21000) || ($compUser->$resName < 5000)){ if($work){ - $amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*10 + 10); + //TODO: 새로 구현한 코드로 이전 + $amount = min(10000, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*1000 + 1000); $commandList[] = [['che_포상', [ 'destGeneralID'=>$userGenerals[0]->no, 'isGold'=>$resName=='gold', @@ -707,7 +708,7 @@ class GeneralAI{ ]], 10]; // 금,쌀 1000단위 포상 } else{ - $amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 5000)*10 + 10); + $amount = min(10000, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 5000)*1000 + 1000); $commandList[] = [['che_포상', [ 'destGeneralID'=>$userGenerals[0]->no, 'isGold'=>$resName=='gold', @@ -739,10 +740,10 @@ class GeneralAI{ if($targetGeneral){ if($targetGeneral === $compNpcCivil){ - $amount = intdiv($targetGeneral->$resName - $minRes * 3, 100); + $amount = round($targetGeneral->$resName - $minRes * 3, -2); } else{ - $amount = min(100, intdiv($targetGeneral->$resName, 5000)*10 + 10); + $amount = min(10000, intdiv($targetGeneral->$resName, 5000)*1000 + 1000); } if($amount > 0){