Beispiel #1
0
 public function save()
 {
     if ($this->_game->getIsBonus() || $this->_user->pay(-($this->_bet * $this->_denomination * $this->_lines_count))) {
         $this->_id = MySQLDBase::$instance->Insert(array('table' => TBL_BETS, 'fields' => array('user_id' => $this->_user->get_id(), 'game_id' => $this->_game->getId(), 'denomination' => mysql_real_escape_string($this->_denomination), 'bet' => mysql_real_escape_string($this->_bet), 'lines_count' => mysql_real_escape_string($this->_lines_count), 'free' => $this->_game->getIsBonus() ? '1' : '0')));
     } else {
         $this->pushError($this->_user);
     }
     return $this->_id;
 }
Beispiel #2
0
 public function getDenominations()
 {
     if ($this->_list === null) {
         $this->_list = array();
         $result = MySQLDBase::$instance->Select('`value` FROM `' . TBL_PARAM_NAMES . '` WHERE `game_id` = \'' . $this->_game->getId() . '\' AND `denomination` = \'1\' ORDER BY `value`', 'value');
         if (is_array($result)) {
             $this->_list = array_keys($result);
         }
     }
     return $this->_list;
 }
Beispiel #3
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;
    }
Beispiel #4
0
 /**
  * Start new game
  *
  * @param array $params = array('id'=>(int))
  * @return bool
  * 
  */
 public function start($params)
 {
     //game already started?
     if ($this->_game && $this->_game->getId() == $params['id']) {
         return true;
     }
     switch ($params['id']) {
         case 1:
             $this->_game = new GameBook_Of_Ra();
             break;
         default:
             $this->_game = null;
             break;
     }
     $balance = 0;
     if ($this->_client->get_user()->getAPI() !== null) {
         $balance = $this->_client->get_user()->getAPI()->get_balance();
     }
     $res = array('started' => $this->_checkGame(), 'balance' => $balance);
     return $res;
 }