コード例 #1
0
 protected void createHistoricTournament(MTTStateSupport state, PokerTournamentState pokerState) {
   if (historicId != null) {
     pokerState.setHistoricId(historicId);
   } else {
     historicId =
         storageService.createHistoricTournament(
             state.getName(), state.getId(), pokerState.getTemplateId(), isSitAndGo());
     pokerState.setHistoricId(historicId);
     storageService.statusChanged(
         PokerTournamentStatus.ANNOUNCED.name(), historicId, dateFetcher.now());
   }
 }
コード例 #2
0
  public final void tournamentCreated(MTTState mtt, LobbyAttributeAccessor acc) {
    log.debug("Poker tournament created. MTT: [" + mtt.getId() + "]" + mtt.getName());
    MTTStateSupport stateSupport = ((MTTStateSupport) mtt);
    stateSupport.setGameId(PokerTournamentActivatorImpl.POKER_GAME_ID);
    stateSupport.setSeats(config.getSeatsPerTable());
    stateSupport.setName(config.getName());
    stateSupport.setCapacity(config.getMaxPlayers());
    stateSupport.setMinPlayers(config.getMinPlayers());

    PokerTournamentState pokerState = new PokerTournamentState();
    pokerState.setTiming(config.getTimingType());
    pokerState.setBetStrategy(config.getBetStrategy());
    pokerState.setBlindsStructure(config.getBlindsStructure());
    pokerState.setBuyIn(config.getBuyIn());
    pokerState.setFee(config.getFee());
    pokerState.setPayOutAsBonus(config.isPayOutAsBonus());
    pokerState.setCurrency(cashGamesBackendService.getCurrency(config.getCurrency()));
    pokerState.setPayoutStructure(config.getPayoutStructure(), config.getMinPlayers());

    pokerState.setStartingChips(config.getStartingChips());
    TournamentLifeCycle tournamentLifeCycle = getTournamentLifeCycle();
    pokerState.setLifecycle(tournamentLifeCycle);
    pokerState.setStartDateString(tournamentLifeCycle.getStartTime().toString(datePattern));
    pokerState.setRegistrationStartDate(tournamentLifeCycle.getOpenRegistrationTime());
    pokerState.setMinutesVisibleAfterFinished(getMinutesVisibleAfterFinished());
    pokerState.setTemplateId(getConfigurationTemplateId());
    pokerState.setSitAndGo(isSitAndGo());
    pokerState.setRebuySupport(createRebuySupport(config.getRebuyConfiguration()));
    pokerState.setGuaranteedPrizePool(config.getGuaranteedPrizePool());
    pokerState.getAllowedOperators().addAll(config.getOperatorIds());
    pokerState.setUserRuleExpression(config.getUserRuleExpression());
    pokerState.setVariant(config.getVariant());
    pokerState.setDescription(config.getDescription());

    PokerTournament tournament = new PokerTournament(pokerState);
    stateSupport.setState(tournament);

    acc.setStringAttribute("SPEED", timing.name());
    // TODO: Table size should be configurable.
    acc.setIntAttribute(
        PokerTournamentLobbyAttributes.TABLE_SIZE.name(), config.getSeatsPerTable());
    String opString = getOperatorLobbyIdString();
    acc.setStringAttribute(OPERATOR_IDS.name(), opString);
    String rule = config.getUserRuleExpression();
    acc.setStringAttribute(USER_RULE_EXPRESSION.name(), rule != null ? rule : "");
    acc.setStringAttribute(VARIANT.name(), PokerVariant.TEXAS_HOLDEM.name());
    createHistoricTournament(stateSupport, pokerState);
    tournamentCreated(stateSupport, pokerState, acc);
  }