diff --git a/hwe/func.php b/hwe/func.php index ffc226c7..154157dd 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1634,7 +1634,8 @@ function nextRuler(General $general) { //npc or npc유저인 경우 후계 찾기 if($general->getVar('npc') > 0) { $candidate = $db->queryFirstRow( - 'SELECT no,name,nation,officer_level,IF(ABS(affinity-%i)>75,150-ABS(affinity-%i),ABS(affinity-%i)) as npcmatch2 from general where nation=%i and officer_level!=12 and npc>0 order by npcmatch2,rand() LIMIT 1', + 'SELECT no,name,officer_level,IF(ABS(affinity-%i)>75,150-ABS(affinity-%i),ABS(affinity-%i)) as npcmatch2 from general where nation=%i and officer_level!=12 and npc>0 order by npcmatch2,rand() LIMIT 1', + $general->getVar('affinity'), $general->getVar('affinity'), $general->getVar('affinity'), $nationID @@ -1669,7 +1670,7 @@ function nextRuler(General $general) { $db->update('general', [ 'officer_level'=>12, 'officer_city'=>0, - ], 'no=%i', $nextRulerID); + ], 'no=%i AND nation=%i', $nextRulerID, $nationID); if($db->affectedRows()==0){ throw new \RuntimeException('선양되지 않음'); } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index cd0a5939..f4b4cb02 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -534,6 +534,7 @@ class General implements iAction{ $officerLevel = $this->getVar('officer_level'); if($officerLevel == 12) { nextRuler($this); + $this->setVar('officer_level', 1); } // 부대 처리