Introduction of daily tournaments and fixing hall.html issue (after move).
This commit is contained in:
@@ -148,7 +148,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="tabs" width="100%">
|
<div id="tabs" width="100%">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="hall.html#gameHall">Game Hall</a></li>
|
<li><a href="#gameHall">Game Hall</a></li>
|
||||||
<li><a href="includes/gameHistory.html">Game History</a></li>
|
<li><a href="includes/gameHistory.html">Game History</a></li>
|
||||||
<li><a href="includes/tournamentResults.html">Tournaments</a></li>
|
<li><a href="includes/tournamentResults.html">Tournaments</a></li>
|
||||||
<li><a href="includes/leagueResults.html">Leagues</a></li>
|
<li><a href="includes/leagueResults.html">Leagues</a></li>
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import com.gempukku.lotro.logic.timing.GameResultListener;
|
|||||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||||
import com.gempukku.lotro.tournament.*;
|
import com.gempukku.lotro.tournament.*;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReadWriteLock;
|
import java.util.concurrent.locks.ReadWriteLock;
|
||||||
@@ -26,6 +28,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||||||
public class HallServer extends AbstractServer {
|
public class HallServer extends AbstractServer {
|
||||||
private final int _playerInactivityPeriod = 1000 * 20; // 20 seconds
|
private final int _playerInactivityPeriod = 1000 * 20; // 20 seconds
|
||||||
private final long _scheduledTournamentLoadTime = 1000 * 60 * 60 * 24 * 7; // Week
|
private final long _scheduledTournamentLoadTime = 1000 * 60 * 60 * 24 * 7; // Week
|
||||||
|
private final long _repeatTournaments = 1000*60*60*24*2;
|
||||||
|
|
||||||
private ChatServer _chatServer;
|
private ChatServer _chatServer;
|
||||||
private LeagueService _leagueService;
|
private LeagueService _leagueService;
|
||||||
@@ -81,6 +84,26 @@ public class HallServer extends AbstractServer {
|
|||||||
_tournamentQueues.put("expanded_queue", new ImmediateRecurringQueue(635, "expanded",
|
_tournamentQueues.put("expanded_queue", new ImmediateRecurringQueue(635, "expanded",
|
||||||
CollectionType.ALL_CARDS, "expandedQueue-", "Expanded", 8,
|
CollectionType.ALL_CARDS, "expandedQueue-", "Expanded", 8,
|
||||||
true, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("onDemand"), _pairingMechanismRegistry.getPairingMechanism("singleElimination")));
|
true, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("onDemand"), _pairingMechanismRegistry.getPairingMechanism("singleElimination")));
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
_tournamentQueues.put("fotr_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-17 19:30:00").getTime(), _repeatTournaments, "fotrDailyEu-", "Daily EU Fellowship Block", 0,
|
||||||
|
true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
|
||||||
|
"fotr_block", 8));
|
||||||
|
_tournamentQueues.put("fotr_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-18 00:30:00").getTime(), _repeatTournaments, "fotrDailyUs-", "Daily US Fellowship Block", 0,
|
||||||
|
true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
|
||||||
|
"fotr_block", 8));
|
||||||
|
_tournamentQueues.put("movie_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-18 19:30:00").getTime(), _repeatTournaments, "movieDailyEu-", "Daily EU Movie Block", 0,
|
||||||
|
true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
|
||||||
|
"movie", 8));
|
||||||
|
_tournamentQueues.put("movie_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-19 00:30:00").getTime(), _repeatTournaments, "movieDailyUs-", "Daily US Movie Block", 0,
|
||||||
|
true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes("daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
|
||||||
|
"movie", 8));
|
||||||
|
} catch (ParseException exp) {
|
||||||
|
// Ignore, can't happen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.gempukku.lotro.tournament;
|
||||||
|
|
||||||
|
import com.gempukku.lotro.competitive.PlayerStanding;
|
||||||
|
import com.gempukku.lotro.game.CardCollection;
|
||||||
|
import com.gempukku.lotro.game.DefaultCardCollection;
|
||||||
|
|
||||||
|
public class DailyTournamentPrizes implements TournamentPrizes {
|
||||||
|
private String _registryRepresentation;
|
||||||
|
|
||||||
|
public DailyTournamentPrizes(String registryRepresentation) {
|
||||||
|
_registryRepresentation = registryRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CardCollection getPrizeForTournament(PlayerStanding playerStanding, int playersCount) {
|
||||||
|
DefaultCardCollection tournamentPrize = new DefaultCardCollection();
|
||||||
|
if (playerStanding.getStanding() == 1) {
|
||||||
|
tournamentPrize.addItem("(S)Booster Choice", 4);
|
||||||
|
} else if (playerStanding.getStanding() == 2) {
|
||||||
|
tournamentPrize.addItem("(S)Booster Choice", 3);
|
||||||
|
} else if (playerStanding.getStanding() == 3 ||
|
||||||
|
playerStanding.getStanding() == 4) {
|
||||||
|
tournamentPrize.addItem("(S)Booster Choice", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tournamentPrize.getAll().size() == 0)
|
||||||
|
return null;
|
||||||
|
return tournamentPrize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRegistryRepresentation() {
|
||||||
|
return _registryRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPrizeDescription() {
|
||||||
|
return "<div class='prizeHint' value='1st place - 4 boosters, 2nd place - 3 boosters, 3rd and 4th place - 2 boosters each'>4-3-2-2</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,6 @@ public class RecurringScheduledQueue extends AbstractTournamentQueue implements
|
|||||||
_nextStartText = DateUtils.formatDateWithHour(new Date(_nextStart));
|
_nextStartText = DateUtils.formatDateWithHour(new Date(_nextStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStartCondition() {
|
public String getStartCondition() {
|
||||||
return _nextStartText;
|
return _nextStartText;
|
||||||
@@ -46,6 +45,11 @@ public class RecurringScheduledQueue extends AbstractTournamentQueue implements
|
|||||||
return _tournamentQueueName;
|
return _tournamentQueueName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPairingDescription() {
|
||||||
|
return _pairingMechanism.getPlayOffSystem() + ", minimum players: " + _minimumPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJoinable() {
|
public boolean isJoinable() {
|
||||||
return System.currentTimeMillis() >= _nextStart - _signupTimeBeforeStart;
|
return System.currentTimeMillis() >= _nextStart - _signupTimeBeforeStart;
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ public class TournamentPrizeSchemeRegistry {
|
|||||||
if (prizesScheme.equals("onDemand"))
|
if (prizesScheme.equals("onDemand"))
|
||||||
return new SingleEliminationOnDemandPrizes("onDemand");
|
return new SingleEliminationOnDemandPrizes("onDemand");
|
||||||
|
|
||||||
|
if (prizesScheme.equals("daily"))
|
||||||
|
return new DailyTournamentPrizes("daily");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user