コード例 #1
0
ファイル: masters.php プロジェクト: 4otaku/draft
 public function set_deck($user, $cards)
 {
     $count = (int) Database::join('game_booster', 'gb.id_game_set = gs.id')->get_count('game_set', 'gs.id_game = ? and gb.id_user = ?', array($this->get_id(), $user));
     if ($count < 2) {
         throw new Error();
     }
     parent::set_deck($user, $cards);
 }
コード例 #2
0
ファイル: draft.php プロジェクト: 4otaku/draft
 public function get_action()
 {
     $action = parent::get_action();
     if (!empty($action['type']) && $action['type'] == 'pick') {
         $pick = $action['data'];
         $set = ceil($pick / 15);
         $shift = ($pick - 1) % 15;
         $action['picked'] = Database::join('game_booster', 'gb.id_game_set = gs.id')->join('game_booster_card', 'gbc.id_game_booster = gb.id')->get_table('game_set', 'gbc.id_user', 'gs.id_game = ? and gs.order = ? and gbc.pick = ? and gbc.id_user > 0', array($this->get_id(), $set, $shift + ($set - 1) * 15));
     }
     return $action;
 }
コード例 #3
0
ファイル: sealed.php プロジェクト: 4otaku/draft
 protected function make_booster($id, $set, $user)
 {
     $booster = parent::make_booster($id, $set, $user);
     $booster->set_user($user);
     return $booster;
 }