Exemplo 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;
    }
Exemplo n.º 2
0
 /**
  * Spin slot
  *
  * @param array $params = array('bet'=>int, 'denomination'=>float, 'lines'=>int)
  * @return array | FALSE
  */
 public function spin($params)
 {
     if (!$this->_checkGame()) {
         return false;
     }
     if ($this->_game->getBonusCount() <= 0) {
         $this->_game->setBonusGame(false);
     }
     if (!$this->_game->getIsBonus()) {
         $this->_lines_count = intval($params['lines']);
         $this->_bet = $params['bet'];
         $this->_denomination = $params['denomination'];
     }
     $lines_count = $this->_lines_count;
     $bet = $this->_bet;
     $denomination = $this->_denomination;
     if ($this->_game->checkBet($bet, $denomination, $lines_count)) {
         $bet = new ItemBet($this->_client->get_user()->getAPI(), $this->_game, $denomination, $bet, $lines_count);
         if ($bet->save()) {
             $this->_game->spin($lines_count);
             if (!$bet->won($this->_game->getWins())) {
                 $this->pushError($bet);
             }
             if ($this->_game->getIsBonus()) {
                 if (!$bet->won($this->_game->getBonusWins(), true)) {
                     $this->pushError($bet);
                 }
             }
         }
     }
     $this->pushError($bet);
     if (!$this->hasErrors()) {
         $res = $this->_game->getScreenArray();
         if ($this->_game->getIsBonus()) {
             $res['bonus_won'] = $bet->getBonusWinningAmount();
             $this->_bonus_won = $res['bonus_won'];
         }
         $res['won'] = $bet->getWinningAmount();
         $this->_won = $res['won'];
         $res['balance'] = $this->_client->get_user()->getAPI()->get_balance();
         return $res;
     }
     return false;
 }