Ejemplo n.º 1
0
    public function check()
    {
        $this->tries++;
        $game_id = $this->_game->getId();
        $wins = $this->_game->getWins();
        $count_combination = 0;
        $success_combinations = array();
        $this->_bonus_game = false;
        foreach ($wins as $line => $combination) {
            foreach ($combination as $success_count) {
                echo '<pre>';
                echo '!!!!!!:';
                var_dump($success_count, $this->_game->getSymbols()->getSpecialSymbol()->getId());
                var_dump($success_count->symbol_id);
                var_dump($success_count->symbol_id == $this->_game->getSymbols()->getSpecialSymbol()->getId());
                echo '</pre>';
                $count_combination++;
                if ($success_count->symbol_id == $this->_game->getSymbols()->getSpecialSymbol()->getId()) {
                    $this->_bonus_game = true;
                }
                if (!$this->availCombination($success_count)) {
                    return false;
                } else {
                    $success_combinations[] = $success_count;
                }
            }
        }
        if ($this->_game->getIsBonus()) {
            $this->_game->decBonusCount();
        }
        //save results
        foreach ($success_combinations as $comb) {
            $this->setResult($comb);
        }
        list($sel) = MySQLDBase::$instance->Select(' `count` FROM `' . TBL_GAME_COUNT . '` 
												WHERE `game_id` = \'' . $game_id . '\'');
        if ($sel) {
            MySQLDBase::$instance->Update(array('table' => TBL_GAME_COUNT, 'safe_vals' => 0, 'fields' => array('count' => '`count` + 1'), 'match' => array('game_id' => $game_id)));
        } else {
            MySQLDBase::$instance->Query('INSERT INTO `' . TBL_GAME_COUNT . '` (`game_id`, `count`) 
										VALUES (\'' . $game_id . '\', \'1\')');
        }
        return true;
    }