diff --git a/gemp-lotr/gemp-lotr-server/pom.xml b/gemp-lotr/gemp-lotr-server/pom.xml
index 80b774f66..e82704106 100644
--- a/gemp-lotr/gemp-lotr-server/pom.xml
+++ b/gemp-lotr/gemp-lotr-server/pom.xml
@@ -48,7 +48,7 @@
com.sun.jersey
jersey-server
- 1.8
+ 1.18.1
javax.servlet
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java
index a71fe8f79..f27707260 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java
@@ -138,17 +138,17 @@ public class HallServer extends AbstractServer {
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
- _tournamentQueues.put("fotr_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-15 19:30:00").getTime(), _repeatTournaments, "fotrDailyEu-", "Daily Gondor Fellowship Block", 1000,
- true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
+ _tournamentQueues.put("fotr_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-15 19:30:00").getTime(), _repeatTournaments, "fotrDailyEu-", "Daily Gondor Fellowship Block", 0,
+ true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss-3"),
"fotr_block", 8));
- _tournamentQueues.put("fotr_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-16 00:30:00").getTime(), _repeatTournaments, "fotrDailyUs-", "Daily Rohan Fellowship Block", 1000,
- true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
+ _tournamentQueues.put("fotr_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-16 00:30:00").getTime(), _repeatTournaments, "fotrDailyUs-", "Daily Rohan Fellowship Block", 0,
+ true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss-3"),
"fotr_block", 8));
- _tournamentQueues.put("movie_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-16 19:30:00").getTime(), _repeatTournaments, "movieDailyEu-", "Daily Gondor Movie Block", 1000,
- true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
+ _tournamentQueues.put("movie_daily_eu", new RecurringScheduledQueue(sdf.parse("2013-01-16 19:30:00").getTime(), _repeatTournaments, "movieDailyEu-", "Daily Gondor Movie Block", 0,
+ true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss-3"),
"movie", 8));
- _tournamentQueues.put("movie_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-17 00:30:00").getTime(), _repeatTournaments, "movieDailyUs-", "Daily Rohan Movie Block", 1000,
- true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss"),
+ _tournamentQueues.put("movie_daily_us", new RecurringScheduledQueue(sdf.parse("2013-01-17 00:30:00").getTime(), _repeatTournaments, "movieDailyUs-", "Daily Rohan Movie Block", 0,
+ true, CollectionType.MY_CARDS, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "daily"), _pairingMechanismRegistry.getPairingMechanism("swiss-3"),
"movie", 8));
} catch (ParseException exp) {
// Ignore, can't happen
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/DailyTournamentPrizes.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/DailyTournamentPrizes.java
index d71f6a193..300be4381 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/DailyTournamentPrizes.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/DailyTournamentPrizes.java
@@ -14,17 +14,7 @@ public class DailyTournamentPrizes implements TournamentPrizes {
@Override
public CardCollection getPrizeForTournament(PlayerStanding playerStanding, int playersCount) {
DefaultCardCollection tournamentPrize = new DefaultCardCollection();
- if (playerStanding.getStanding() == 1) {
- tournamentPrize.addItem("(S)Booster Choice", 10);
- } else if (playerStanding.getStanding() == 2) {
- tournamentPrize.addItem("(S)Booster Choice", 8);
- } else if (playerStanding.getStanding() <=4) {
- tournamentPrize.addItem("(S)Booster Choice", 5);
- } else if (playerStanding.getStanding() <=8) {
- tournamentPrize.addItem("(S)Booster Choice", 2);
- } else {
- tournamentPrize.addItem("(S)Booster Choice", 1);
- }
+ tournamentPrize.addItem("(S)Booster Choice", playerStanding.getPoints());
if (tournamentPrize.getAll().size() == 0)
return null;
@@ -43,6 +33,6 @@ public class DailyTournamentPrizes implements TournamentPrizes {
@Override
public String getPrizeDescription() {
- return "10-8-5-2-1
";
+ return "2 boosters per win (or bye), max 3 rounds";
}
}
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/PairingMechanismRegistry.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/PairingMechanismRegistry.java
index b75e36dd3..bfa94e448 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/PairingMechanismRegistry.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/PairingMechanismRegistry.java
@@ -6,6 +6,8 @@ public class PairingMechanismRegistry {
return new SingleEliminationPairing("singleElimination");
if (pairingType.equals("swiss"))
return new SwissPairingMechanism("swiss");
+ if (pairingType.equals("swiss-3"))
+ return new SwissPairingMechanism("swiss-3", 3);
return null;
}
diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SwissPairingMechanism.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SwissPairingMechanism.java
index 258758293..0a9f58daf 100644
--- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SwissPairingMechanism.java
+++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SwissPairingMechanism.java
@@ -2,15 +2,26 @@ package com.gempukku.lotro.tournament;
import com.gempukku.lotro.competitive.PlayerStanding;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class SwissPairingMechanism implements PairingMechanism {
private String _registryRepresentation;
+ private Integer _maxRounds;
public SwissPairingMechanism(String registryRepresentation) {
_registryRepresentation = registryRepresentation;
}
+ public SwissPairingMechanism(String registryRepresentation, int maxRounds) {
+ this(registryRepresentation);
+ _maxRounds = maxRounds;
+ }
+
@Override
public String getRegistryRepresentation() {
return _registryRepresentation;
@@ -28,6 +39,10 @@ public class SwissPairingMechanism implements PairingMechanism {
@Override
public boolean isFinished(int round, Set players, Set droppedPlayers) {
+ if (_maxRounds != null) {
+ if (round >= _maxRounds)
+ return true;
+ }
return round >= getRoundCountBasedOnNumberOfPlayers(players.size());
}
@@ -44,8 +59,9 @@ public class SwissPairingMechanism implements PairingMechanism {
boolean success = tryPairBracketAndFurther(0, new HashSet(), new HashSet(), playersGroupedByBracket, playersWithByes, previouslyPaired, pairingResults, byeResults);
// Managed to pair with this carry over count - proceed with the pairings
- if (success)
+ if (success) {
return false;
+ }
// We can't pair, just finish the tournament
return true;
@@ -67,8 +83,9 @@ public class SwissPairingMechanism implements PairingMechanism {
pairingsResult.put(firstCarryOver, player);
// Lets give it a try
boolean success = tryPairBracketAndFurther(bracketIndex, carryOverPlayers, carryOverFromThisBracket, playersGroupedByBracket, playersWithByes, previouslyPaired, pairingsResult, byes);
- if (success)
+ if (success) {
return true;
+ }
// Naah, it didn't work out
pairingsResult.remove(firstCarryOver);
}
@@ -89,8 +106,9 @@ public class SwissPairingMechanism implements PairingMechanism {
pairingsResult.put(firstPlayer, secondPlayer);
// Lets give it a try
boolean success = tryPairBracketAndFurther(bracketIndex, Collections.emptySet(), carryOverFromThisBracket, playersGroupedByBracket, playersWithByes, previouslyPaired, pairingsResult, byes);
- if (success)
+ if (success) {
return true;
+ }
// Naah, it didn't work out
pairingsResult.remove(firstPlayer);
}
@@ -101,12 +119,12 @@ public class SwissPairingMechanism implements PairingMechanism {
}
// We have to go to next bracket
- if (bracketIndex+1 < playersGroupedByBracket.size()) {
+ if (bracketIndex + 1 < playersGroupedByBracket.size()) {
// Remaining players can't be paired within this bracket
Set carryOverForNextBracket = new HashSet(carryOverFromThisBracket);
carryOverForNextBracket.addAll(playersInBracket);
- return tryPairBracketAndFurther(bracketIndex+1, carryOverForNextBracket, new HashSet(), playersGroupedByBracket, playersWithByes, previouslyPaired, pairingsResult, byes);
+ return tryPairBracketAndFurther(bracketIndex + 1, carryOverForNextBracket, new HashSet(), playersGroupedByBracket, playersWithByes, previouslyPaired, pairingsResult, byes);
} else {
// There is no more brackets left, whatever is left, has to get a bye
Set leftoverPlayers = new HashSet(carryOverFromThisBracket);
@@ -114,9 +132,9 @@ public class SwissPairingMechanism implements PairingMechanism {
// We only accept one bye
int playersLeftWithoutPair = leftoverPlayers.size();
- switch(playersLeftWithoutPair) {
+ switch (playersLeftWithoutPair) {
case 0:
- return true;
+ return true;
case 1: {
String lastPlayer = leftoverPlayers.iterator().next();
if (playersWithByes.contains(lastPlayer)) {
@@ -136,15 +154,17 @@ public class SwissPairingMechanism implements PairingMechanism {
private Set getPlayersWithByes(Map playerByes) {
Set playersWithByes = new HashSet();
for (Map.Entry playerByeCount : playerByes.entrySet()) {
- if (playerByeCount.getValue() != null && playerByeCount.getValue() > 0)
+ if (playerByeCount.getValue() != null && playerByeCount.getValue() > 0) {
playersWithByes.add(playerByeCount.getKey());
+ }
}
return playersWithByes;
}
private void shufflePlayersWithinBrackets(List> playersGroupedByPoints) {
- for (List playersByPoint : playersGroupedByPoints)
+ for (List playersByPoint : playersGroupedByPoints) {
Collections.shuffle(playersByPoint);
+ }
}
private List> groupPlayersByPointBracket(Set droppedPlayers, List currentStandings, int maxNumberOfPoints) {
@@ -164,8 +184,9 @@ public class SwissPairingMechanism implements PairingMechanism {
List> result = new ArrayList>();
for (List playersByPoint : playersByPoints) {
- if (playersByPoint != null)
+ if (playersByPoint != null) {
result.add(playersByPoint);
+ }
}
return result;
@@ -174,8 +195,9 @@ public class SwissPairingMechanism implements PairingMechanism {
private int determineMaximumNumberOfPoints(Set droppedPlayers, List currentStandings) {
int maxNumberOfPoints = 0;
for (PlayerStanding currentStanding : currentStandings) {
- if (!droppedPlayers.contains(currentStanding.getPlayerName()))
+ if (!droppedPlayers.contains(currentStanding.getPlayerName())) {
maxNumberOfPoints = Math.max(currentStanding.getPoints(), maxNumberOfPoints);
+ }
}
return maxNumberOfPoints;
}