diff --git a/hwe/a_kingdomList.php b/hwe/a_kingdomList.php index 7d146e73..be050a1a 100644 --- a/hwe/a_kingdomList.php +++ b/hwe/a_kingdomList.php @@ -86,7 +86,7 @@ for($i=1; $i <= $count; $i++) { $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $level5 = MYDB_fetch_array($genresult); - $query = "select npc,name from general where nation='{$nation['nation']}' order by dedication desc"; // 장수 목록 + $query = "select npc,name from general where nation='{$nation['nation']}' and npc != 5 order by dedication desc"; // 장수 목록 $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gencount = MYDB_num_rows($genresult); diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index 64466644..499d9a97 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -214,22 +214,25 @@ if($btn == "추방") { $msg->send(); } - $gencount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $general['nation']); - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; - - if($admin['year'] < $admin['startyear']+3) { //초반엔 군주 부상 증가(엔장 임관지양) - $query = "update general set injury=injury+1 where no='{$ruler['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('general', [ + 'injury'=>$db->sqleval('injury + 1'), + ], 'no=%i', $ruler['no']); - $query = "update nation set gennum='$gennum',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$db->sqleval('gennum - 1'), + 'gold'=>$db->sqleval('gold + %i', $gold), + 'rice'=>$db->sqleval('rice + %i', $rice), + ], 'nation = %i', $general['nation']); } else { //이번분기는 추방불가(초반 제외) - $query = "update nation set l{$meLevel}set=1,gennum='$gennum',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + "l{$meLevel}set"=>1, + 'gennum'=>$db->sqleval('gennum - 1'), + 'gold'=>$db->sqleval('gold + %i', $gold), + 'rice'=>$db->sqleval('rice + %i', $rice), + ], 'nation = %i', $general['nation']); } list($year, $month) = $gameStor->getValuesAsArray(['year','month']); diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 675364cb..73f76e99 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -762,7 +762,6 @@ function checkMerge() { pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합"); $newGenCount = $gencount + $gencount2; - if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; } $newTech = ($younation['tech']*$gencount + $mynation['tech']*$gencount2)/$newGenCount; // 국가 백업 @@ -919,7 +918,6 @@ function checkSurrender() { $oldNation['aux'] = Json::decode($oldNation['aux']); $newGenCount = $gencount + $gencount2; - if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; } $newTech = ($younation['tech'] * $gencount + $mynation['tech'] * $gencount2) / $newGenCount; // 자금 통합, 외교제한 5년, 기술유지 $db->update('nation', [ @@ -1002,7 +1000,7 @@ function updateNationState() { $history = array(); $admin = $gameStor->getValues(['year', 'month', 'fiction', 'startyear', 'show_img_level', 'turnterm']); - foreach($db->query('SELECT nation,name,level,gennum,tech FROM nation') as $nation) { + foreach($db->query('SELECT nation,name,level,tech FROM nation') as $nation) { //TODO: level이 진관수이소중대특 체계를 벗어날 수 있음 $citycount = $db->queryFirstField('SELECT count(*) FROM city WHERE nation=%i AND level>=4', $nation['nation']); @@ -1103,12 +1101,6 @@ function updateNationState() { refreshNationStaticInfo(); } - - $gencount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $nation['nation']); - - $db->update('nation', [ - 'gennum'=>$gencount - ], 'nation=%i', $nation['nation']); } pushWorldHistory($history, $admin['year'], $admin['month']); } diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index a069ab6b..580b36ed 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -792,7 +792,7 @@ function process_71(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -800,10 +800,7 @@ function process_71(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dipCount = MYDB_num_rows($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 10); //if($term2 == 0) { $term2 = 1; } @@ -900,7 +897,7 @@ function process_72(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -915,10 +912,7 @@ function process_72(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dipCount = MYDB_num_rows($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 20); //if($term2 == 0) { $term2 = 1; } @@ -1017,7 +1011,7 @@ function process_73(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -1036,10 +1030,7 @@ function process_73(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dip = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 20); //if($term2 == 0) { $term2 = 1; } @@ -1150,7 +1141,7 @@ function process_74(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -1169,10 +1160,7 @@ function process_74(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dip = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 20); //if($term2 == 0) { $term2 = 1; } @@ -1296,7 +1284,7 @@ function process_75(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -1311,10 +1299,7 @@ function process_75(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dip = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 40); //if($term2 == 0) { $term2 = 1; } @@ -1424,14 +1409,11 @@ function process_76(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); //$term2 = Util::round($genCount / 10); //if($term2 == 0) { $term2 = 1; } @@ -1634,7 +1616,7 @@ function process_77(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -1649,10 +1631,7 @@ function process_77(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dip = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); $term2 = 1; $term3 = Util::round(sqrt($genCount*16)*10); @@ -1764,7 +1743,7 @@ function process_78(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $city = MYDB_fetch_array($result); - $query = "select nation,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; + $query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -1779,10 +1758,7 @@ function process_78(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dip = MYDB_fetch_array($result); - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $genCount = MYDB_num_rows($result); - if($genCount < GameConst::$initialNationGenLimit) { $genCount = GameConst::$initialNationGenLimit; } + $genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit); $term2 = 1; $term3 = Util::round(sqrt($genCount*16)*10); diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index a989e32f..a0e3f623 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -65,7 +65,7 @@ class che_등용 extends Command\GeneralCommand{ $relYear = $this->env['year'] - $this->env['startyear']; $this->runnableConstraints=[ - ConstraintHelper::ReqEnvValue('join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'), + ConstraintHelper::ReqEnvValue('join_mode', '장수 수', '==', 'onlyRandom', '랜덤 임관만 가능합니다'), ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotOpeningPart($relYear), ConstraintHelper::OccupiedCity(), diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index 6496ec26..5059ef3f 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -92,7 +92,7 @@ class che_임관 extends Command\GeneralCommand{ $relYear = $env['year'] - $env['startyear']; $this->runnableConstraints=[ - ConstraintHelper::ReqEnvValue('join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'), + ConstraintHelper::ReqEnvValue('join_mode', '장수 수', '==', 'onlyRandom', '랜덤 임관만 가능합니다'), ConstraintHelper::BeNeutral(), ConstraintHelper::ExistsDestNation(), ConstraintHelper::AllowJoinDestNation($relYear), diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index 4e8ed457..9a2bc7ba 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -49,7 +49,7 @@ class che_출병 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(['war', 'gennum', 'tech', 'gold', 'rice']); $this->setDestCity($this->arg['destCityID'], []); - $this->setDestNation(['nation' ,'level','name','capital','gennum','tech','type','gold','rice']); + $this->setDestNation($this->arg['destNationID'], ['nation' ,'level','name','capital','gennum','tech','type','gold','rice']); [$reqGold, $reqRice] = $this->getCost(); $relYear = $this->env['year'] - $this->env['startyear'];