2008-08-04 05:44:28 +02:00
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#This file contains methods to store hands into the db. decides to move this
#into a seperate file since its ugly, fairly long and just generally in the way.
import fpdb_simple
#stores a stud/razz hand into the database
2008-12-02 01:15:50 +01:00
def ring_stud ( db , cursor , base , category , site_hand_no , gametype_id , hand_start_time , names , player_ids , start_cashes , antes , card_values , card_suits , winnings , rakes , action_types , allIns , action_amounts , actionNos , hudImportData , maxSeats , tableName , seatNos ) :
2008-09-01 06:41:58 +02:00
fpdb_simple . fillCardArrays ( len ( names ) , base , category , card_values , card_suits )
2008-08-04 05:44:28 +02:00
2008-12-02 01:15:50 +01:00
hands_id = fpdb_simple . storeHands ( db , cursor , site_hand_no , gametype_id , hand_start_time , names , tableName , maxSeats )
2008-08-04 05:44:28 +02:00
2008-10-09 06:30:09 +02:00
#print "before calling store_hands_players_stud, antes:", antes
2008-12-02 01:15:50 +01:00
hands_players_ids = fpdb_simple . store_hands_players_stud ( db , cursor , hands_id , player_ids ,
2008-09-02 02:00:43 +02:00
start_cashes , antes , card_values , card_suits , winnings , rakes , seatNos )
2008-08-04 05:44:28 +02:00
2008-09-02 02:00:43 +02:00
fpdb_simple . storeHudCache ( cursor , base , category , gametype_id , player_ids , hudImportData )
2008-08-04 05:44:28 +02:00
2008-10-07 03:21:43 +02:00
fpdb_simple . storeActions ( cursor , hands_players_ids , action_types , allIns , action_amounts , actionNos )
2008-08-19 00:53:25 +02:00
return hands_id
2008-08-04 05:44:28 +02:00
#end def ring_stud
2008-12-02 01:15:50 +01:00
def ring_holdem_omaha ( db , cursor , base , category , site_hand_no , gametype_id , hand_start_time , names , player_ids , start_cashes , positions , card_values , card_suits , board_values , board_suits , winnings , rakes , action_types , allIns , action_amounts , actionNos , hudImportData , maxSeats , tableName , seatNos ) :
2008-08-15 05:28:51 +02:00
""" stores a holdem/omaha hand into the database """
2008-09-01 06:41:58 +02:00
fpdb_simple . fillCardArrays ( len ( names ) , base , category , card_values , card_suits )
2008-08-04 05:44:28 +02:00
fpdb_simple . fill_board_cards ( board_values , board_suits )
2008-12-02 01:15:50 +01:00
hands_id = fpdb_simple . storeHands ( db , cursor , site_hand_no , gametype_id , hand_start_time , names , tableName , maxSeats )
2008-08-04 05:44:28 +02:00
2008-12-02 01:15:50 +01:00
hands_players_ids = fpdb_simple . store_hands_players_holdem_omaha ( db , cursor , category , hands_id , player_ids , start_cashes , positions , card_values , card_suits , winnings , rakes , seatNos )
2008-08-04 05:44:28 +02:00
2008-09-02 02:00:43 +02:00
fpdb_simple . storeHudCache ( cursor , base , category , gametype_id , player_ids , hudImportData )
2008-08-04 05:44:28 +02:00
fpdb_simple . store_board_cards ( cursor , hands_id , board_values , board_suits )
2008-10-06 05:26:59 +02:00
fpdb_simple . storeActions ( cursor , hands_players_ids , action_types , allIns , action_amounts , actionNos )
2008-08-19 00:53:25 +02:00
return hands_id
2008-08-04 05:44:28 +02:00
#end def ring_holdem_omaha
2008-12-02 01:15:50 +01:00
def tourney_holdem_omaha ( db , cursor , base , category , siteTourneyNo , buyin , fee , knockout , entries , prizepool , tourney_start , payin_amounts , ranks , tourneyTypeId , siteId , #end of tourney specific params
2008-10-07 03:21:43 +02:00
site_hand_no , gametype_id , hand_start_time , names , player_ids , start_cashes , positions , card_values , card_suits , board_values , board_suits , winnings , rakes , action_types , allIns , action_amounts , actionNos , hudImportData , maxSeats , tableName , seatNos ) :
2008-08-15 05:28:51 +02:00
""" stores a tourney holdem/omaha hand into the database """
2008-09-01 06:41:58 +02:00
fpdb_simple . fillCardArrays ( len ( names ) , base , category , card_values , card_suits )
2008-08-04 05:44:28 +02:00
fpdb_simple . fill_board_cards ( board_values , board_suits )
2008-08-18 07:27:37 +02:00
tourney_id = fpdb_simple . store_tourneys ( cursor , tourneyTypeId , siteTourneyNo , entries , prizepool , tourney_start )
2008-08-04 05:44:28 +02:00
tourneys_players_ids = fpdb_simple . store_tourneys_players ( cursor , tourney_id , player_ids , payin_amounts , ranks , winnings )
2008-12-02 01:15:50 +01:00
hands_id = fpdb_simple . storeHands ( db , cursor , site_hand_no , gametype_id , hand_start_time , names , tableName , maxSeats )
2008-08-04 05:44:28 +02:00
2008-12-02 01:15:50 +01:00
hands_players_ids = fpdb_simple . store_hands_players_holdem_omaha_tourney ( db , cursor , category , hands_id , player_ids , start_cashes , positions , card_values , card_suits , winnings , rakes , seatNos , tourneys_players_ids )
2008-08-04 05:44:28 +02:00
2008-09-02 02:00:43 +02:00
fpdb_simple . storeHudCache ( cursor , base , category , gametype_id , player_ids , hudImportData )
2008-08-04 05:44:28 +02:00
fpdb_simple . store_board_cards ( cursor , hands_id , board_values , board_suits )
2008-10-07 03:21:43 +02:00
fpdb_simple . storeActions ( cursor , hands_players_ids , action_types , allIns , action_amounts , actionNos )
2008-08-19 00:53:25 +02:00
return hands_id
2008-08-04 05:44:28 +02:00
#end def tourney_holdem_omaha
2008-12-02 01:15:50 +01:00
def tourney_stud ( db , cursor , base , category , siteTourneyNo , buyin , fee , knockout , entries , prizepool , tourneyStartTime , payin_amounts , ranks , tourneyTypeId , siteId ,
2008-10-09 08:17:18 +02:00
siteHandNo , gametypeId , handStartTime , names , playerIds , startCashes , antes , cardValues , cardSuits , winnings , rakes , actionTypes , allIns , actionAmounts , actionNos , hudImportData , maxSeats , tableName , seatNos ) :
2008-08-04 05:44:28 +02:00
#stores a tourney stud/razz hand into the database
2008-10-09 08:17:18 +02:00
fpdb_simple . fillCardArrays ( len ( names ) , base , category , cardValues , cardSuits )
2008-08-04 05:44:28 +02:00
2008-10-09 08:17:18 +02:00
tourney_id = fpdb_simple . store_tourneys ( cursor , tourneyTypeId , siteTourneyNo , entries , prizepool , tourneyStartTime )
2008-08-04 05:44:28 +02:00
2008-10-09 08:17:18 +02:00
tourneys_players_ids = fpdb_simple . store_tourneys_players ( cursor , tourney_id , playerIds , payin_amounts , ranks , winnings )
2008-08-04 05:44:28 +02:00
2008-12-02 01:15:50 +01:00
hands_id = fpdb_simple . storeHands ( db , cursor , siteHandNo , gametypeId , handStartTime , names , tableName , maxSeats )
2008-08-04 05:44:28 +02:00
2008-12-02 01:15:50 +01:00
hands_players_ids = fpdb_simple . store_hands_players_stud_tourney ( db , cursor , hands_id , playerIds , startCashes , antes , cardValues , cardSuits , winnings , rakes , seatNos , tourneys_players_ids )
2008-08-04 05:44:28 +02:00
2008-10-09 08:17:18 +02:00
fpdb_simple . storeHudCache ( cursor , base , category , gametypeId , playerIds , hudImportData )
2008-08-04 05:44:28 +02:00
2008-10-09 08:17:18 +02:00
fpdb_simple . storeActions ( cursor , hands_players_ids , actionTypes , allIns , actionAmounts , actionNos )
2008-08-19 00:53:25 +02:00
return hands_id
2008-08-04 05:44:28 +02:00
#end def tourney_stud