diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index 218b9e7f..46f94952 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -349,19 +349,19 @@ class PartyPoker(HandHistoryConverter): def readPlayerStacks(self, hand): log.debug("readPlayerStacks") m = self.re_PlayerInfo.finditer(hand.handText) - players = [] + maxKnownStack = 0 + zeroStackPlayers = [] for a in m: - hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), - clearMoneyString(a.group('CASH'))) - - # detecting new active players without a seat - # and new active players with zero stack + if a.group('CASH') > '0': + #record max known stack for use with players with unknown stack + maxKnownStack = max(a.group('CASH'),maxKnownStack) + hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))) + else: + #zero stacked players are added later + zeroStackPlayers.append([int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))]) if hand.gametype['type'] == 'ring': - re_JoiningPlayers = re.compile(r"(?P.*) has joined the table") - re_BBPostingPlayers = re.compile(r"(?P.*) posts big blind") - seatedPlayers = list([(f[1]) for f in hand.players]) - + #finds first vacant seat after an exact seat def findFirstEmptySeat(startSeat): while startSeat in occupiedSeats: if startSeat >= hand.maxseats: @@ -369,14 +369,25 @@ class PartyPoker(HandHistoryConverter): startSeat += 1 return startSeat + re_JoiningPlayers = re.compile(r"(?P.*) has joined the table") + re_BBPostingPlayers = re.compile(r"(?P.*) posts big blind") + match_JoiningPlayers = re_JoiningPlayers.findall(hand.handText) match_BBPostingPlayers = re_BBPostingPlayers.findall(hand.handText) - ringLimit = self.re_GameInfoRing.search(hand.handText).groupdict()['RINGLIMIT'] - unseatedActivePlayers = list(set(match_BBPostingPlayers) - set(seatedPlayers)) - for player in seatedPlayers: - if hand.stacks[player] == 0 and player in match_BBPostingPlayers: - hand.stacks[player] = Decimal(ringLimit) + #add every player with zero stack, but: + #if a zero stacked player is just joined the table in this very hand then set his stack to maxKnownStack + for p in zeroStackPlayers: + if p[1] in match_JoiningPlayers: + p[2] = clearMoneyString(maxKnownStack) + hand.addPlayer(p[0],p[1],p[2]) + + seatedPlayers = list([(f[1]) for f in hand.players]) + + #it works for all known cases as of 2010-09-28 + #should be refined with using match_ActivePlayers instead of match_BBPostingPlayers + #as a leaving and rejoining player could be active without posting a BB (sample HH needed) + unseatedActivePlayers = list(set(match_BBPostingPlayers) - set(seatedPlayers)) if unseatedActivePlayers: for player in unseatedActivePlayers: @@ -385,7 +396,7 @@ class PartyPoker(HandHistoryConverter): occupiedSeats = list([(f[0]) for f in hand.players]) occupiedSeats.sort() newPlayerSeat = findFirstEmptySeat(previousBBPosterSeat) - hand.addPlayer(newPlayerSeat,player,clearMoneyString(ringLimit)) + hand.addPlayer(newPlayerSeat,player,clearMoneyString(maxKnownStack)) def markStreets(self, hand): m = re.search( diff --git a/pyfpdb/locale/fpdb-hu_HU.po b/pyfpdb/locale/fpdb-hu_HU.po index 01f6c30b..ecd6c69e 100644 --- a/pyfpdb/locale/fpdb-hu_HU.po +++ b/pyfpdb/locale/fpdb-hu_HU.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.20.905 plus git\n" "POT-Creation-Date: 2010-09-22 20:10+CEST\n" -"PO-Revision-Date: 2010-09-23 11:36+0200\n" +"PO-Revision-Date: 2010-09-28 15:55+0200\n" "Last-Translator: Ferenc Erki \n" "Language-Team: Hungarian \n" "Language: hu\n" @@ -1449,7 +1449,7 @@ msgstr "Sessionök" #: GuiTourneyGraphViewer.py:185 msgid "Tournaments" -msgstr "Verseny3k" +msgstr "Versenyek" #: GuiTourneyGraphViewer.py:212 GuiTourneyGraphViewer.py:225 msgid ""