군주가 지정되지 않더라도 안전하게 동작
This commit is contained in:
@@ -173,7 +173,7 @@ class NPC{
|
|||||||
$experience = $age * 100;
|
$experience = $age * 100;
|
||||||
$dedication = $age * 100;
|
$dedication = $age * 100;
|
||||||
$level = $this->level;
|
$level = $this->level;
|
||||||
if(!$level){
|
if(!$level || $isNewGeneral){
|
||||||
$level = $nationID?1:0;
|
$level = $nationID?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,13 @@ class Nation{
|
|||||||
'gennum'=>$npc_cnt,
|
'gennum'=>$npc_cnt,
|
||||||
'totaltech'=>$this->tech*$npc_cnt
|
'totaltech'=>$this->tech*$npc_cnt
|
||||||
], 'nation=%i', $this->id);
|
], '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(){
|
public function getBrief(){
|
||||||
|
|||||||
Reference in New Issue
Block a user