def new(cls, players, deck, data_store=None, **kwargs): kwargs.update({'players': players, 'deck': deck, 'discards': { 'A': CardHolder.new(None, data_store, sort_method='value'), 'B': CardHolder.new(None, data_store, sort_method='value') } }) return super(Table, cls).new(data_store, **kwargs)
def restore(cls, data_store, data_model, **kwargs): kwargs.update({ 'team': data_model.team, 'hand': CardHolder.restore(data_store, data_model.hand), 'abandoned': data_model.abandoned }) return super(Player, cls).restore(data_store, data_model, **kwargs)
def new(cls, user, team, data_store=None, **kwargs): kwargs.update({ 'team': team, 'hand': CardHolder.new(None, data_store, sort_method='suit') }) return super(Player, cls).new(user, data_store, **kwargs)
def restore(cls, data_store, data_model, **kwargs): kwargs.update({ 'discards': { 'A': CardHolder.restore(data_store, data_model.discards['A']), 'B': CardHolder.restore(data_store, data_model.discards['B'])}, 'kitty': [Card(c) if c else None for c in data_model.kitty], 'active_cards': [Card(c) if c else None for c in data_model.active], 'state': data_model.state, 'player_turn': data_model.player_turn, 'bet_team': data_model.bet_team, 'bet_amount': data_model.bet_amount, '_prev_state': data_model['_prev_state'], 'trump_suit': data_model.trump_suit, 'round_start_player': data_model.round_start_player, 'round': data_model.round, 'deck': Deck.restore(data_store, data_model.deck), 'players': data_model.players }) return super(Table, cls).restore(data_model, data_store, **kwargs)