HHC, Party: Move clearMoneyString into HHC

Make clearMoneyString available to all parsers and fix all calls within Party
This commit is contained in:
Worros 2010-12-20 14:00:09 +08:00
parent d6dc0c535a
commit 0b02b05f67
2 changed files with 13 additions and 12 deletions

View File

@ -675,6 +675,11 @@ or None if we fail to get the info """
# PokerStars: WCOOP 2nd Chance 02: $1,050 NLHE - Tournament 307521826 Table 1 - Blinds $30/$60 # PokerStars: WCOOP 2nd Chance 02: $1,050 NLHE - Tournament 307521826 Table 1 - Blinds $30/$60
return "%s.+Table (\d+)" % (tournament, ) return "%s.+Table (\d+)" % (tournament, )
@staticmethod
def clearMoneyString(money):
"Renders 'numbers' like '1 200' and '2,000'"
return money.replace(' ', '').replace(',', '')
def getTableTitleRe(config, sitename, *args, **kwargs): def getTableTitleRe(config, sitename, *args, **kwargs):
"Returns string to search in windows titles for current site" "Returns string to search in windows titles for current site"
return getSiteHhc(config, sitename).getTableTitleRe(*args, **kwargs) return getSiteHhc(config, sitename).getTableTitleRe(*args, **kwargs)

View File

@ -240,8 +240,8 @@ class PartyPoker(HandHistoryConverter):
info['sb'] = "%.2f" % (sb) info['sb'] = "%.2f" % (sb)
info['currency'] = self.currencies[mg['CURRENCY']] info['currency'] = self.currencies[mg['CURRENCY']]
else: else:
info['sb'] = clearMoneyString(mg['SB']) info['sb'] = self.clearMoneyString(mg['SB'])
info['bb'] = clearMoneyString(mg['BB']) info['bb'] = self.clearMoneyString(mg['BB'])
info['currency'] = 'T$' info['currency'] = 'T$'
return info return info
@ -361,10 +361,10 @@ class PartyPoker(HandHistoryConverter):
if a.group('CASH') > '0': if a.group('CASH') > '0':
#record max known stack for use with players with unknown stack #record max known stack for use with players with unknown stack
maxKnownStack = max(a.group('CASH'),maxKnownStack) maxKnownStack = max(a.group('CASH'),maxKnownStack)
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))) hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), self.clearMoneyString(a.group('CASH')))
else: else:
#zero stacked players are added later #zero stacked players are added later
zeroStackPlayers.append([int(a.group('SEAT')), a.group('PNAME'), clearMoneyString(a.group('CASH'))]) zeroStackPlayers.append([int(a.group('SEAT')), a.group('PNAME'), self.clearMoneyString(a.group('CASH'))])
if hand.gametype['type'] == 'ring': if hand.gametype['type'] == 'ring':
#finds first vacant seat after an exact seat #finds first vacant seat after an exact seat
def findFirstEmptySeat(startSeat): def findFirstEmptySeat(startSeat):
@ -384,7 +384,7 @@ class PartyPoker(HandHistoryConverter):
#if a zero stacked player is just joined the table in this very hand then set his stack to maxKnownStack #if a zero stacked player is just joined the table in this very hand then set his stack to maxKnownStack
for p in zeroStackPlayers: for p in zeroStackPlayers:
if p[1] in match_JoiningPlayers: if p[1] in match_JoiningPlayers:
p[2] = clearMoneyString(maxKnownStack) p[2] = self.clearMoneyString(maxKnownStack)
hand.addPlayer(p[0],p[1],p[2]) hand.addPlayer(p[0],p[1],p[2])
seatedPlayers = list([(f[1]) for f in hand.players]) seatedPlayers = list([(f[1]) for f in hand.players])
@ -401,7 +401,7 @@ class PartyPoker(HandHistoryConverter):
occupiedSeats = list([(f[0]) for f in hand.players]) occupiedSeats = list([(f[0]) for f in hand.players])
occupiedSeats.sort() occupiedSeats.sort()
newPlayerSeat = findFirstEmptySeat(previousBBPosterSeat) newPlayerSeat = findFirstEmptySeat(previousBBPosterSeat)
hand.addPlayer(newPlayerSeat,player,clearMoneyString(maxKnownStack)) hand.addPlayer(newPlayerSeat,player,self.clearMoneyString(maxKnownStack))
def markStreets(self, hand): def markStreets(self, hand):
m = re.search( m = re.search(
@ -491,7 +491,7 @@ class PartyPoker(HandHistoryConverter):
for action in m: for action in m:
acts = action.groupdict() acts = action.groupdict()
playerName = action.group('PNAME') playerName = action.group('PNAME')
amount = clearMoneyString(action.group('BET')) if action.group('BET') else None amount = self.clearMoneyString(action.group('BET')) if action.group('BET') else None
actionType = action.group('ATYPE') actionType = action.group('ATYPE')
if actionType == 'is all-In': if actionType == 'is all-In':
@ -530,7 +530,7 @@ class PartyPoker(HandHistoryConverter):
def readCollectPot(self,hand): def readCollectPot(self,hand):
for m in self.re_CollectPot.finditer(hand.handText): for m in self.re_CollectPot.finditer(hand.handText):
hand.addCollectPot(player=m.group('PNAME'),pot=clearMoneyString(m.group('POT'))) hand.addCollectPot(player=m.group('PNAME'),pot=self.clearMoneyString(m.group('POT')))
def readShownCards(self,hand): def readShownCards(self,hand):
for m in self.re_ShownCards.finditer(hand.handText): for m in self.re_ShownCards.finditer(hand.handText):
@ -554,10 +554,6 @@ class PartyPoker(HandHistoryConverter):
else: else:
return table_name return table_name
def clearMoneyString(money):
"Renders 'numbers' like '1 200' and '2,000'"
return money.replace(' ', '').replace(',', '')
def renderCards(string): def renderCards(string):
"Splits strings like ' Js, 4d '" "Splits strings like ' Js, 4d '"
cards = string.strip().split(' ') cards = string.strip().split(' ')