diff --git a/README.md b/README.md index 5d89901..221a53e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Features * Converts pokernow.club csv files to Pokerstars hand history file text format ### Known Limitations +* Only cash games and no tournaments are yet supported * Player names containing parantheses '(' or ')' are not supported without mapping in name-mappings.properties Quick Start @@ -17,10 +18,10 @@ You need a more or less recent Java SE Runtime Environment to run the released p For a quick start you can unzip the release version (without subdirectory, but directly all three files) in a folder where you've already got one or more csv's from pokernow.club. -Execute from the directory with containing 'handhistory-converter-0.2.1-jar-with-dependencies.jar' and the two properties files: +Execute from the directory with containing 'handhistory-converter-0.2.2-jar-with-dependencies.jar' and the two properties files: ``` -java -jar handhistory-converter-0.2.1-jar-with-dependencies.jar +java -jar handhistory-converter-0.2.2-jar-with-dependencies.jar ``` The csv files from pokernow.club in the directory should then get converted. diff --git a/conversion.properties b/conversion.properties index d12dfad..5d61d77 100644 --- a/conversion.properties +++ b/conversion.properties @@ -11,7 +11,7 @@ yourUniqueName = yourUniqueName # Which of the supported game types are converted, true ones get converted false ones are skipped convertOmahaHiHands = true convertOmahaHiLoHands = true -convertTexasHands = false +convertTexasHands = true # Amount factor of reduction of bet sizes, can be used to support Hold'em Manager Micro Stakes # An example would be converting a pokernow 0.5 / 1 Blind game to $0.05/$0.1 by using 10 instead of 1 here diff --git a/pom.xml b/pom.xml index b1f7287..77dc0c8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,9 @@ - + 4.0.0 ch.evolutionsoft.poker.pokernow handhistory-converter - 0.2.1 + 0.2.2 UTF-8 diff --git a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java index 984f356..3eef38e 100644 --- a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java +++ b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java @@ -27,7 +27,8 @@ private PokernowConstants() { public static final String BUTTON_PREFIX = "dealer: "; public static final int BUTTON_PREFIX_LENGTH = BUTTON_PREFIX.length(); - + + public static final String ANTE_PREFIX = " posts an ante of "; public static final String SMALL_BLIND_PREFIX = " posts a small blind of "; public static final String BIG_BLIND_PREFIX = " posts a big blind of "; public static final String STRADDLE_PREFIX = " posts a straddle of"; diff --git a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java index 5226279..795776b 100644 --- a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java +++ b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java @@ -22,7 +22,7 @@ public class PokernowSingleHandConverter { String lastButtonPlayerName = StringUtils.EMPTY; String lastButtonPlayerSeat = StringUtils.EMPTY; - + double smallBlindAmount = 1; double bigBlindAmount = 1; double straddleAmount = 2; @@ -69,7 +69,7 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws String gameType = singleHandHistoryLine.substring( singleHandHistoryLine.indexOf('(') + 1, singleHandHistoryLine.indexOf(')')); String timeString = singleHandHistoryLine.substring( - singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.indexOf('.')); + singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.lastIndexOf('.')); timeString = timeString.replace("-", FORWARD_SLASH); timeString = timeString.replace(TIME_PREFIX, StringUtils.SPACE); String pokerstarsHandLine1 = POKER_STARS_HAND + handIdPrefix + handNumber + DOUBLE_POINT + StringUtils.SPACE + @@ -133,6 +133,21 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws singleHandHistoryLine = bufferedReader.readLine(); } + + String anteLines = StringUtils.EMPTY; + while (singleHandHistoryLine.contains(ANTE_PREFIX)) { + + singleHandHistoryLine = singleHandHistoryLine.replace(AND_GO_ALL_IN + StringUtils.SPACE, StringUtils.EMPTY); + String anteLine = singleHandHistoryLine. + replaceAll(ANTE_PREFIX + ONE_OR_MORE_DIGITS_GROUP_REGEX, ": posts the ante \\$" + FIRST_AND_SECOND_REGEX_GROUP_MATCH); + + anteLine = ConversionUtils.stripDateAndEntryOrderFromCsv(anteLine); + + anteLines += anteLine + System.lineSeparator(); + + singleHandHistoryLine = bufferedReader.readLine(); + + } int indexOfSmallBlindPoster = singleHandHistoryLine.indexOf(SMALL_BLIND_PREFIX); String smallBlindLine = StringUtils.EMPTY; @@ -206,6 +221,12 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws singleHandHistoryLine = bufferedReader.readLine(); } + if (!anteLines.isEmpty()) { + + convertedSingleHandHistory += anteLines; + + } + if (!smallBlindLine.isEmpty()) { convertedSingleHandHistory += smallBlindLine + System.lineSeparator(); @@ -227,9 +248,15 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws if (!missingBigBlindLine.isEmpty()) { convertedSingleHandHistory += missingBigBlindLine + System.lineSeparator(); - } + } convertedSingleHandHistory += HOLE_CARDS; + + if (this.readYourHoleCards && !this.yourHoleCards.isEmpty()) { + + convertedSingleHandHistory += DEALT_TO_HERO + this.yourUniqueName + + StringUtils.SPACE + yourHoleCards + System.lineSeparator(); + } String endBoard = StringUtils.EMPTY; @@ -288,12 +315,6 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws } while (null != singleHandHistoryLine && !singleHandHistoryLine.contains(COLLECTED)); - if (this.readYourHoleCards && !this.yourHoleCards.isEmpty()) { - - convertedSingleHandHistory += this.yourUniqueName + DOUBLE_POINT + - SHOWS_ACTION + yourHoleCards + System.lineSeparator(); - } - convertedSingleHandHistory += SHOWDOWN; List winningAmounts = new ArrayList<>(); @@ -453,7 +474,7 @@ String handleShowCardsAction(String showdownAction) { String showedHand; showedHand = showdownAction.substring( showdownAction.indexOf(SHOWS_ACTION) + SHOWS_ACTION.length(), - showdownAction.indexOf('.')); + showdownAction.indexOf('.', showdownAction.indexOf(SHOWS_ACTION))); showedHand = OPEN_BRACKET + showedHand + CLOSED_BRACKET; showdownAction = showdownAction.substring(0, showdownAction.indexOf(SHOWS_ACTION) + SHOWS_ACTION.length()) + diff --git a/src/main/java/ch/evolutionsoft/poker/pokernow/PokerstarsConstants.java b/src/main/java/ch/evolutionsoft/poker/pokernow/PokerstarsConstants.java index 6e166f3..aae561e 100644 --- a/src/main/java/ch/evolutionsoft/poker/pokernow/PokerstarsConstants.java +++ b/src/main/java/ch/evolutionsoft/poker/pokernow/PokerstarsConstants.java @@ -22,6 +22,7 @@ private PokerstarsConstants() { public static final String POKER_STARS_HAND = "PokerStars Hand #"; + public static final String DEALT_TO_HERO = "Dealt to "; public static final String FOLDS = " folds"; public static final String CHECKS = " checks"; public static final String CALLS = " calls ";