コード例 #1
0
class GameActionTracker(db.Model):
    gameActionTrackerId = db.Column(db.Integer,
                                    primary_key=True,
                                    unique=True,
                                    nullable=False)
    gameId = db.Column(db.Integer,
                       db.ForeignKey("game.gameId", ondelete="CASCADE"),
                       nullable=True)
    performedByPlayerId = db.Column(
        db.Integer,
        db.ForeignKey("player.playerId",
                      use_alter=True,
                      name='fk_game_action_player_id',
                      ondelete='CASCADE'))
    isGameActionCompleted = db.Column(db.Boolean,
                                      nullable=False,
                                      default=False)
    gamePlayActionId = db.Column(
        db.Integer,
        db.ForeignKey(GamePlayAction.gamePlayActionId,
                      use_alter=True,
                      name='fk_game_Action_id'))
    tradeTransaction = db.relationship("TradeTransaction")
    gameCardId = db.Column(db.Integer,
                           db.ForeignKey(GameCards.gameCardId),
                           nullable=True)
コード例 #2
0
class RentCard(db.Model):
    rentCardId = db.Column(db.Integer, primary_key=True, nullable=False)
    primaryColourId = db.Column(db.Enum(Enum.Colours),
                                db.ForeignKey(PropertiesColour.colourId),
                                nullable=True)
    secondaryColourId = db.Column(db.Enum(Enum.Colours),
                                  db.ForeignKey(PropertiesColour.colourId),
                                  nullable=True)
    payee = db.Column(db.Enum(Enum.Payee), nullable=False)
    price = db.Column(db.Integer, nullable=False)
    primaryColourDetails = db.relationship(
        PropertiesColour,
        primaryjoin=primaryColourId == PropertiesColour.colourId)
    secondaryColourDetails = db.relationship(
        PropertiesColour,
        primaryjoin=secondaryColourId == PropertiesColour.colourId)
コード例 #3
0
class TradePayeeTransaction(db.Model):
    tradePayeeTransactionId = db.Column(db.Integer,
                                        primary_key=True,
                                        unique=True,
                                        nullable=False)
    tradeTransactionId = db.Column(db.Integer,
                                   db.ForeignKey(
                                       TradeTransaction.tradeTransactionId),
                                   nullable=True)
    targetPlayerId = db.Column(db.Integer,
                               db.ForeignKey("player.playerId",
                                             ondelete="CASCADE"),
                               nullable=True)
    isTransactionCompleted = db.Column(db.Boolean,
                                       nullable=False,
                                       default=False)
    requestedGameCardIds = db.Column(db.String)
    responseGameCardIds = db.Column(db.String)
コード例 #4
0
class GamePlayerMoves(db.Model):
    gameId = db.Column(db.Integer,
                       db.ForeignKey("game.gameId", ondelete="CASCADE"),
                       primary_key=True,
                       nullable=True)
    currentPlayerId = db.Column(db.Integer, db.ForeignKey(Player.playerId))
    numberOfMovesPlayed = db.Column(db.Integer, nullable=False, default=0)
    totalGameMoveCount = db.Column(db.Integer, nullable=False, default=0)
    gameMoveStatus = db.Column(
        db.Enum(Enum.GameMoveStatus),
        nullable=False,
        default=Enum.GameMoveStatus.WaitingForPlayerToBeginMove)
    gameActionTrackerId = db.Column(db.Integer,
                                    db.ForeignKey(
                                        GameActionTracker.gameActionTrackerId),
                                    nullable=True)
    gameActionTracker = db.relationship(GameActionTracker)
    currentPlayer = db.relationship(
        Player, primaryjoin=currentPlayerId == Player.playerId)
コード例 #5
0
class Player(db.Model):
    __table_args__ = (db.UniqueConstraint('gameId',
                                          'playerName',
                                          name='unique_player'), )
    playerId = db.Column(db.Integer,
                         primary_key=True,
                         unique=True,
                         nullable=False)
    playerPassCode = db.Column(db.String, nullable=False)
    imageId = db.Column(db.Integer, nullable=False)
    gameId = db.Column(db.Integer,
                       db.ForeignKey("game.gameId"),
                       nullable=False)
    gamePassCode = db.Column(db.String,
                             db.ForeignKey("game.gamePassCode"),
                             nullable=False)
    playerName = db.Column(db.String)
    playerGameOrder = db.Column(db.Integer)
    playerCards = db.relationship(GameCards,
                                  primaryjoin=playerId == GameCards.playerId)
コード例 #6
0
class Cards(db.Model):
    cardId = db.Column(db.Integer,
                       primary_key=True,
                       unique=True,
                       nullable=False)
    cardType = db.Column(db.Enum(Enum.CardTypes))
    propertiesCardId = db.Column(
        db.Integer, db.ForeignKey("properties_card.propertiesCardId"))
    cashCardId = db.Column(db.Integer, db.ForeignKey("cash_card.cashCardId"))
    rentCardId = db.Column(db.Integer, db.ForeignKey("rent_card.rentCardId"))
    actionCardId = db.Column(db.Integer,
                             db.ForeignKey("action_card.actionCardId"))
    properties = db.relationship(
        PropertiesCard,
        primaryjoin=propertiesCardId == PropertiesCard.propertiesCardId)
    cash = db.relationship(CashCard,
                           primaryjoin=cashCardId == CashCard.cashCardId)
    rent = db.relationship(RentCard,
                           primaryjoin=rentCardId == RentCard.rentCardId)
    action = db.relationship(
        ActionCard, primaryjoin=actionCardId == ActionCard.actionCardId)
コード例 #7
0
class GameCards(db.Model):
    __table_args__ = (db.UniqueConstraint('gameId',
                                          'cardId',
                                          name='unique_game_card'), )
    gameCardId = db.Column(db.Integer,
                           primary_key=True,
                           unique=True,
                           nullable=False)
    gameId = db.Column(db.Integer,
                       db.ForeignKey("game.gameId", ondelete="CASCADE"),
                       nullable=True)
    cardId = db.Column(db.Integer,
                       db.ForeignKey("cards.cardId"),
                       nullable=True)
    playerId = db.Column(db.Integer,
                         db.ForeignKey("player.playerId", ondelete="CASCADE"),
                         nullable=True)
    cardStatus = db.Column(db.Enum(Enum.GameCardLocationStatus),
                           nullable=False,
                           default=Enum.GameCardLocationStatus.IsNotDrawn)
    isCardRightSideUp = db.Column(db.Boolean, nullable=False, default=True)
    assignedColourId = db.Column(db.Enum(Enum.Colours), nullable=True)
    card = db.relationship(Cards, primaryjoin=cardId == Cards.cardId)
コード例 #8
0
class TradeTransaction(db.Model):
    tradeTransactionId = db.Column(db.Integer,
                                   primary_key=True,
                                   unique=True,
                                   nullable=False)
    gameActionTrackerId = db.Column(
        db.Integer, db.ForeignKey(GameActionTracker.gameActionTrackerId))
    gameId = db.Column(db.Integer,
                       db.ForeignKey("game.gameId", ondelete="CASCADE"),
                       nullable=True)
    isTransactionCompleted = db.Column(db.Boolean,
                                       nullable=False,
                                       default=False)
    sourcePlayerId = db.Column(
        db.Integer,
        db.ForeignKey("player.playerId",
                      use_alter=True,
                      name='fk_trade_transaction_player_id',
                      ondelete='CASCADE'))
    payee = db.Column(db.Enum(Enum.Payee), nullable=False)
    total = db.Column(db.Integer)
    tradeTypes = db.Column(db.Enum(Enum.TradeTypes), nullable=True)
    tradePayeeTransactions = db.relationship("TradePayeeTransaction")