lib = $lib; $this->db = $this->lib->game->db; $this->msgs = $this->lib->game->getLib('beta5/msg'); } // Accepts a request to join an alliance function run($aid, $pid, $kid) { $q = $this->db->query("SELECT id FROM player WHERE alliance=$aid AND a_status='REQ' AND id=$pid"); if (!($q && dbCount($q) == 1)) { return; } $a = $this->lib->call('get', $aid); if (is_null($a)) { return; } $tag = addslashes($a['tag']); $tm = time(); $this->msgs->call('send', $pid, 'alint', array( "msg_type" => 10, "alliance" => $aid, "tag" => $a['tag'], "player" => $pid, )); $l = $this->lib->call('getKeepers', $aid); foreach ($l as $id) { if ($id == $kid) { continue; } $this->msgs->call('send', $id, 'alint', array( "msg_type" => 11, "alliance" => $aid, "tag" => $a['tag'], "player" => $pid, )); } $this->db->query("UPDATE player SET a_status='IN',a_vote=NULL,a_grade=NULL WHERE id=$pid"); } } ?>