군주가 지정되지 않더라도 안전하게 동작

This commit is contained in:
2018-05-29 01:49:06 +09:00
parent c337ff2f67
commit 398f54cced
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -173,7 +173,7 @@ class NPC{
$experience = $age * 100;
$dedication = $age * 100;
$level = $this->level;
if(!$level){
if(!$level || $isNewGeneral){
$level = $nationID?1:0;
}
+7
View File
@@ -137,6 +137,13 @@ class Nation{
'gennum'=>$npc_cnt,
'totaltech'=>$this->tech*$npc_cnt
], 'nation=%i', $this->id);
//군주가 없는지 확인
$hasRuler = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i AND level=12');
if(!$hasRuler){
$newRuler = $db->queryFirstField('SELECT `no` FROM general WHERE nation=1 ORDER BY leader+power+intel DESC LIMIT 1');
$db->update('general',['level'=>12], 'no=%i', $newRuler);
}
}
public function getBrief(){