Merge branch 'chaz' of git://github.com/ChazDazzle/fpdb-chaz
This commit is contained in:
+20
-15
@@ -49,11 +49,14 @@ class Hand(object):
|
||||
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
|
||||
SYMBOL = {'USD': '$', 'EUR': u'$', 'GBP': '$', 'T$': '', 'play': ''}
|
||||
MS = {'horse' : 'HORSE', '8game' : '8-Game', 'hose' : 'HOSE', 'ha': 'HA'}
|
||||
ACTION = {'ante': 1, 'small blind': 2, 'secondsb': 3, 'big blind': 4, 'both': 5, 'calls': 6, 'raises': 7,
|
||||
'bets': 8, 'stands pat': 9, 'folds': 10, 'checks': 11, 'discards': 12, 'bringin': 13, 'completes': 14}
|
||||
|
||||
|
||||
def __init__(self, config, sitename, gametype, handText, builtFrom = "HHC"):
|
||||
#log.debug( _("Hand.init(): handText is ") + str(handText) )
|
||||
self.config = config
|
||||
self.saveActions = self.config.get_import_parameters().get('saveActions')
|
||||
#log = Configuration.get_logger("logging.conf", "db", log_dir=self.config.dir_log)
|
||||
self.sitename = sitename
|
||||
self.siteId = self.config.get_site_id(sitename)
|
||||
@@ -65,6 +68,7 @@ class Hand(object):
|
||||
self.cancelled = False
|
||||
self.dbid_hands = 0
|
||||
self.dbid_pids = None
|
||||
self.dbid_hpid = None
|
||||
self.dbid_gt = 0
|
||||
self.tablename = ""
|
||||
self.hero = ""
|
||||
@@ -262,10 +266,11 @@ db: a connected Database object"""
|
||||
hh['seats'] = len(self.dbid_pids)
|
||||
|
||||
self.dbid_hands = db.storeHand(hh)
|
||||
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers(), printdata = printtest)
|
||||
# TODO HandsActions - all actions for all players for all streets - self.actions
|
||||
# HudCache data can be generated from HandsActions (HandsPlayers?)
|
||||
#db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.stats.getHandsActions(), printdata = printtest)
|
||||
self.dbid_hpid = db.storeHandsPlayers(self.dbid_hands, self.dbid_pids,
|
||||
self.stats.getHandsPlayers(), printdata = printtest)
|
||||
if self.saveActions:
|
||||
db.storeHandsActions(self.dbid_hands, self.dbid_pids, self.dbid_hpid,
|
||||
self.stats.getHandsActions(), printdata = printtest)
|
||||
else:
|
||||
log.info(_("Hand.insert(): hid #: %s is a duplicate") % hh['siteHandNo'])
|
||||
self.is_duplicate = True # i.e. don't update hudcache
|
||||
@@ -350,7 +355,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||
ante = re.sub(u',', u'', ante) #some sites have commas
|
||||
self.bets['BLINDSANTES'][player].append(Decimal(ante))
|
||||
self.stacks[player] -= Decimal(ante)
|
||||
act = (player, 'posts', "ante", ante, self.stacks[player]==0)
|
||||
act = (player, 'ante', Decimal(ante), self.stacks[player]==0)
|
||||
self.actions['BLINDSANTES'].append(act)
|
||||
# self.pot.addMoney(player, Decimal(ante))
|
||||
self.pot.addCommonMoney(player, Decimal(ante))
|
||||
@@ -369,7 +374,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||
if player is not None:
|
||||
amount = re.sub(u',', u'', amount) #some sites have commas
|
||||
self.stacks[player] -= Decimal(amount)
|
||||
act = (player, 'posts', blindtype, amount, self.stacks[player]==0)
|
||||
act = (player, blindtype, Decimal(amount), self.stacks[player]==0)
|
||||
self.actions['BLINDSANTES'].append(act)
|
||||
|
||||
if blindtype == 'both':
|
||||
@@ -402,7 +407,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
|
||||
#self.lastBet[street] = Decimal(amount)
|
||||
self.stacks[player] -= Decimal(amount)
|
||||
#print "DEBUG %s calls %s, stack %s" % (player, amount, self.stacks[player])
|
||||
act = (player, 'calls', amount, self.stacks[player]==0)
|
||||
act = (player, 'calls', Decimal(amount), self.stacks[player]==0)
|
||||
self.actions[street].append(act)
|
||||
self.pot.addMoney(player, Decimal(amount))
|
||||
|
||||
@@ -463,11 +468,11 @@ Add a raise on [street] by [player] to [amountTo]
|
||||
Rb = Rt - C - Bc
|
||||
self._addRaise(street, player, C, Rb, Rt)
|
||||
|
||||
def _addRaise(self, street, player, C, Rb, Rt):
|
||||
def _addRaise(self, street, player, C, Rb, Rt, action = 'raises'):
|
||||
log.debug(_("%s %s raise %s") %(street, player, Rt))
|
||||
self.bets[street][player].append(C + Rb)
|
||||
self.stacks[player] -= (C + Rb)
|
||||
act = (player, 'raises', Rb, Rt, C, self.stacks[player]==0)
|
||||
act = (player, action, Rb, Rt, C, self.stacks[player]==0)
|
||||
self.actions[street].append(act)
|
||||
self.lastBet[street] = Rt # TODO check this is correct
|
||||
self.pot.addMoney(player, C+Rb)
|
||||
@@ -481,7 +486,7 @@ Add a raise on [street] by [player] to [amountTo]
|
||||
self.bets[street][player].append(Decimal(amount))
|
||||
self.stacks[player] -= Decimal(amount)
|
||||
#print "DEBUG %s bets %s, stack %s" % (player, amount, self.stacks[player])
|
||||
act = (player, 'bets', amount, self.stacks[player]==0)
|
||||
act = (player, 'bets', Decimal(amount), self.stacks[player]==0)
|
||||
self.actions[street].append(act)
|
||||
self.lastBet[street] = Decimal(amount)
|
||||
self.pot.addMoney(player, Decimal(amount))
|
||||
@@ -1020,7 +1025,7 @@ class DrawHand(Hand):
|
||||
self.bets['DEAL'][player].append(Decimal(amount))
|
||||
self.stacks[player] -= Decimal(amount)
|
||||
#print "DEBUG %s posts, stack %s" % (player, self.stacks[player])
|
||||
act = (player, 'posts', blindtype, amount, self.stacks[player]==0)
|
||||
act = (player, blindtype, Decimal(amount), self.stacks[player]==0)
|
||||
self.actions['BLINDSANTES'].append(act)
|
||||
self.pot.addMoney(player, Decimal(amount))
|
||||
if blindtype == 'big blind':
|
||||
@@ -1050,10 +1055,10 @@ class DrawHand(Hand):
|
||||
def addDiscard(self, street, player, num, cards):
|
||||
self.checkPlayerExists(player)
|
||||
if cards:
|
||||
act = (player, 'discards', num, cards)
|
||||
act = (player, 'discards', Decimal(num), cards)
|
||||
self.discardDrawHoleCards(cards, player, street)
|
||||
else:
|
||||
act = (player, 'discards', num)
|
||||
act = (player, 'discards', Decimal(num))
|
||||
self.actions[street].append(act)
|
||||
|
||||
def holecardsAsSet(self, street, player):
|
||||
@@ -1246,7 +1251,7 @@ Add a complete on [street] by [player] to [amountTo]
|
||||
Rt = Decimal(amountTo)
|
||||
C = Bp - Bc
|
||||
Rb = Rt - C
|
||||
self._addRaise(street, player, C, Rb, Rt)
|
||||
self._addRaise(street, player, C, Rb, Rt, 'completes')
|
||||
#~ self.bets[street][player].append(C + Rb)
|
||||
#~ self.stacks[player] -= (C + Rb)
|
||||
#~ act = (player, 'raises', Rb, Rt, C, self.stacks[player]==0)
|
||||
@@ -1259,7 +1264,7 @@ Add a complete on [street] by [player] to [amountTo]
|
||||
log.debug(_("Bringin: %s, %s") % (player , bringin))
|
||||
self.bets['THIRD'][player].append(Decimal(bringin))
|
||||
self.stacks[player] -= Decimal(bringin)
|
||||
act = (player, 'bringin', bringin, self.stacks[player]==0)
|
||||
act = (player, 'bringin', Decimal(bringin), self.stacks[player]==0)
|
||||
self.actions['THIRD'].append(act)
|
||||
self.lastBet['THIRD'] = Decimal(bringin)
|
||||
self.pot.addMoney(player, Decimal(bringin))
|
||||
|
||||
Reference in New Issue
Block a user