lib = $lib; $this->db = $this->lib->game->db; $this->msgs = $this->lib->game->getLib('beta5/msg'); } public function run($playerID, $breakType) { // Get protection level and system ID $q = $this->db->query( "SELECT s.id, s.prot FROM system s " . "WHERE s.id IN (SELECT DISTINCT p.system FROM planet p WHERE p.owner = $playerID) " . "FOR UPDATE" ); if (dbCount($q) != 1) { return 0; } list($systemID, $protLevel) = dbFetchArray($q); if ($protLevel == 0) { return; } // Set the system's protection level to 0 $this->db->query("UPDATE system SET prot = 0 WHERE id = $systemID"); $this->db->query("DELETE FROM pk_sys_status WHERE system = $systemID"); // Send message $this->msgs->call('send', $playerID, 'endprotection', array( 'end_type' => $breakType )); } } ?>