Esempio n. 1
0
class PenguinFlooring(db.Model):
    __tablename__ = 'penguin_flooring'

    penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                           nullable=False)
    flooring_id = db.Column(db.ForeignKey('flooring.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                            nullable=False)
Esempio n. 2
0
class PenguinIgloo(db.Model):
    __tablename__ = 'penguin_igloo'

    penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                           nullable=False)
    igloo_id = db.Column(db.ForeignKey('igloo.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                         nullable=False)
Esempio n. 3
0
class Permission(db.Model):
    __tablename__ = 'permission'

    name = db.Column(db.String(50), nullable=False, primary_key=True)
    enabled = db.Column(db.Boolean,
                        nullable=False,
                        server_default=db.text("true"))
Esempio n. 4
0
class QuestAwardItem(db.Model):
    __tablename__ = 'quest_award_item'

    quest_id = db.Column(db.ForeignKey('quest.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                         nullable=False)
    item_id = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                        nullable=False)
Esempio n. 5
0
class PenguinTrack(db.Model):
    __tablename__ = 'penguin_track'

    id = db.Column(db.Integer,
                   primary_key=True,
                   server_default=db.text(
                       "nextval('\"penguin_track_id_seq\"'::regclass)"))
    name = db.Column(db.String(12),
                     nullable=False,
                     server_default=db.text("''::character varying"))
    owner_id = db.Column(db.ForeignKey('penguin.id',
                                       ondelete='CASCADE',
                                       onupdate='CASCADE'),
                         nullable=False)
    sharing = db.Column(db.Boolean,
                        nullable=False,
                        server_default=db.text("false"))
    pattern = db.Column(db.Text, nullable=False)

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self._likes = 0

    @property
    def likes(self):
        return self._likes

    @likes.setter
    def likes(self, like_count):
        self._likes = like_count
Esempio n. 6
0
class PenguinLocation(db.Model):
    __tablename__ = 'penguin_location'

    penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                           nullable=False)
    location_id = db.Column(db.ForeignKey('location.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                            nullable=False)
Esempio n. 7
0
class QuestAwardPuffleItem(db.Model):
    __tablename__ = 'quest_award_puffle_item'

    quest_id = db.Column(db.ForeignKey('quest.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                         nullable=False)
    puffle_item_id = db.Column(db.ForeignKey('puffle_item.id', ondelete='CASCADE', onupdate='CASCADE'),
                               primary_key=True, nullable=False)
    quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
Esempio n. 8
0
class DanceSong(db.Model):
    __tablename__ = 'dance_song'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), nullable=False)
    song_length_millis = db.Column(db.Integer, nullable=False)
    song_length = db.Column(db.Integer, nullable=False)
    millis_per_bar = db.Column(db.Integer, nullable=False)
Esempio n. 9
0
class QuestTask(db.Model):
    __tablename__ = 'quest_task'

    id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"quest_id_seq\"'::regclass)"))
    quest_id = db.Column(db.ForeignKey('quest.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False)
    description = db.Column(db.String(50), nullable=False)
    room_id = db.Column(db.ForeignKey('room.id', ondelete='CASCADE', onupdate='CASCADE'))
    data = db.Column(db.String(50))
Esempio n. 10
0
class PenguinQuestTask(db.Model):
    __tablename__ = 'penguin_quest_task'

    task_id = db.Column(db.ForeignKey('quest_task.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False,
                        primary_key=True)
    penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False,
                           primary_key=True)
    complete = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
Esempio n. 11
0
class QuestAwardFurniture(db.Model):
    __tablename__ = 'quest_award_furniture'

    quest_id = db.Column(db.ForeignKey('quest.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                         nullable=False)
    furniture_id = db.Column(db.ForeignKey('furniture.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                             nullable=False)
    quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
Esempio n. 12
0
class StampGroup(db.Model):
    __tablename__ = 'stamp_group'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    parent_id = db.Column(
        db.ForeignKey('stamp_group.id', ondelete='CASCADE',
                      onupdate='CASCADE'))
Esempio n. 13
0
class RoomWaddle(db.Model):
    __tablename__ = 'room_waddle'

    id = db.Column(db.Integer, primary_key=True, nullable=False)
    room_id = db.Column(db.ForeignKey('room.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    seats = db.Column(db.SmallInteger,
                      nullable=False,
                      server_default=db.text("2"))
    game = db.Column(db.String(20), nullable=False)

    def __init__(self, *args, **kwargs):
        self.temporary = kwargs.pop('temporary', False)
        self.penguins = []
        self.logic = None
        self.room = None

        super().__init__(*args, **kwargs)

    async def add_penguin(self, p):
        seat_id = self.penguins.index(None)
        self.penguins[seat_id] = p
        await p.send_xt('jw', seat_id)
        await p.room.send_xt('uw', self.id, seat_id, p.safe_name, p.id)

        p.waddle = self

        if self.penguins.count(None) == 0:
            game_instance = self.logic(self)

            await game_instance.start()

            await self.reset()

            if self.temporary:
                del self.room.waddles[self.id]

    async def remove_penguin(self, p):
        seat_id = self.get_seat_id(p)
        self.penguins[seat_id] = None
        await p.room.send_xt('uw', self.id, seat_id)

        p.waddle = None

        if self.temporary and self.penguins.count(None) == self.seats:
            del self.room.waddles[self.id]

    async def reset(self):
        for seat_id, penguin in enumerate(self.penguins):
            if penguin:
                self.penguins[seat_id] = None
                await penguin.room.send_xt('uw', self.id, seat_id)

    def get_seat_id(self, p):
        return self.penguins.index(p)
Esempio n. 14
0
class IglooLike(db.Model):
    __tablename__ = 'igloo_like'

    igloo_id = db.Column(db.ForeignKey('penguin_igloo_room.id', ondelete='CASCADE', onupdate='CASCADE'),
                         primary_key=True, nullable=False)
    player_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
                          nullable=False)
    count = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
    date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()"))
Esempio n. 15
0
class Postcard(db.Model):
    __tablename__ = 'postcard'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    cost = db.Column(db.Integer, nullable=False, server_default=db.text("10"))
    enabled = db.Column(db.Boolean,
                        nullable=False,
                        server_default=db.text("false"))
Esempio n. 16
0
class PenguinGameData(db.Model):
    __tablename__ = 'penguin_game_data'

    penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='RESTRICT', onupdate='CASCADE'), primary_key=True,
                           nullable=False)
    room_id = db.Column(db.ForeignKey('room.id', ondelete='RESTRICT', onupdate='CASCADE'), primary_key=True,
                        nullable=False, index=True)
    index = db.Column(db.Integer, primary_key=True, index=True)
    data = db.Column(db.Text, nullable=False, server_default=db.text("''"))
Esempio n. 17
0
class Character(db.Model):
    __tablename__ = 'character'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30), nullable=False)
    gift_id = db.Column(
        db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE'))
    stamp_id = db.Column(
        db.ForeignKey('stamp.id', ondelete='CASCADE', onupdate='CASCADE'))
Esempio n. 18
0
class ActivationKey(db.Model):
    __tablename__ = 'activation_key'

    penguin_id = db.Column(db.ForeignKey('penguin.id',
                                         ondelete='CASCADE',
                                         onupdate='CASCADE'),
                           primary_key=True,
                           nullable=False)
    activation_key = db.Column(db.CHAR(255), primary_key=True, nullable=False)
Esempio n. 19
0
class PenguinAttribute(db.Model):
    __tablename__ = 'penguin_attribute'

    penguin_id = db.Column(db.ForeignKey('penguin.id',
                                         ondelete='CASCADE',
                                         onupdate='CASCADE'),
                           primary_key=True,
                           nullable=False)
    name = db.Column(db.Text, primary_key=True, nullable=False)
    value = db.Column(db.Text)
Esempio n. 20
0
class EpfComMessage(db.Model):
    __tablename__ = 'epf_com_message'

    message = db.Column(db.Text, nullable=False)
    character_id = db.Column(db.ForeignKey('character.id',
                                           ondelete='RESTRICT',
                                           onupdate='CASCADE'),
                             nullable=False)
    date = db.Column(db.DateTime,
                     nullable=False,
                     server_default=db.text("now()"))
Esempio n. 21
0
class RedemptionAwardIgloo(db.Model):
    __tablename__ = 'redemption_award_igloo'
    code_id = db.Column(db.ForeignKey('redemption_code.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    igloo_id = db.Column(db.ForeignKey('igloo.id',
                                       ondelete='CASCADE',
                                       onupdate='CASCADE'),
                         primary_key=True,
                         nullable=False)
Esempio n. 22
0
class RedemptionAwardFurniture(db.Model):
    __tablename__ = 'redemption_award_furniture'
    code_id = db.Column(db.ForeignKey('redemption_code.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    furniture_id = db.Column(db.ForeignKey('furniture.id',
                                           ondelete='CASCADE',
                                           onupdate='CASCADE'),
                             primary_key=True,
                             nullable=False)
Esempio n. 23
0
class CfcDonation(db.Model):
    __tablename__ = 'cfc_donation'

    penguin_id = db.Column(db.ForeignKey('penguin.id',
                                         ondelete='CASCADE',
                                         onupdate='CASCADE'),
                           nullable=False)
    coins = db.Column(db.Integer, nullable=False)
    charity = db.Column(db.Integer, nullable=False)
    date = db.Column(db.DateTime,
                     nullable=False,
                     server_default=db.text("now()"))
Esempio n. 24
0
class RedemptionAwardPuffleItem(db.Model):
    __tablename__ = 'redemption_award_puffle_item'
    code_id = db.Column(db.ForeignKey('redemption_code.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    puffle_item_id = db.Column(db.ForeignKey('puffle_item.id',
                                             ondelete='CASCADE',
                                             onupdate='CASCADE'),
                               primary_key=True,
                               nullable=False)
Esempio n. 25
0
class RedemptionAwardLocation(db.Model):
    __tablename__ = 'redemption_award_location'
    code_id = db.Column(db.ForeignKey('redemption_code.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    location_id = db.Column(db.ForeignKey('location.id',
                                          ondelete='CASCADE',
                                          onupdate='CASCADE'),
                            primary_key=True,
                            nullable=False)
Esempio n. 26
0
class BuddyRequest(db.Model):
    __tablename__ = 'buddy_request'
    penguin_id = db.Column(db.ForeignKey('penguin.id',
                                         ondelete='CASCADE',
                                         onupdate='CASCADE'),
                           primary_key=True,
                           nullable=False)
    requester_id = db.Column(db.ForeignKey('penguin.id',
                                           ondelete='CASCADE',
                                           onupdate='CASCADE'),
                             primary_key=True,
                             nullable=False)
Esempio n. 27
0
class PenguinPermission(db.Model):
    __tablename__ = 'penguin_permission'

    penguin_id = db.Column(db.ForeignKey(u'penguin.id',
                                         ondelete=u'CASCADE',
                                         onupdate=u'CASCADE'),
                           primary_key=True)
    permission_name = db.Column(db.ForeignKey(u'permission.name',
                                              ondelete=u'CASCADE',
                                              onupdate=u'CASCADE'),
                                nullable=False,
                                primary_key=True)
Esempio n. 28
0
class RedemptionAwardFlooring(db.Model):
    __tablename__ = 'redemption_award_flooring'
    code_id = db.Column(db.ForeignKey('redemption_code.id',
                                      ondelete='CASCADE',
                                      onupdate='CASCADE'),
                        primary_key=True,
                        nullable=False)
    flooring_id = db.Column(db.ForeignKey('flooring.id',
                                          ondelete='CASCADE',
                                          onupdate='CASCADE'),
                            primary_key=True,
                            nullable=False)
Esempio n. 29
0
class PuffleTreasurePuffleItem(db.Model):
    __tablename__ = 'puffle_treasure_puffle_item'

    puffle_id = db.Column(db.ForeignKey('puffle.id',
                                        ondelete='CASCADE',
                                        onupdate='CASCADE'),
                          primary_key=True,
                          nullable=False)
    puffle_item_id = db.Column(db.ForeignKey('puffle_item.id',
                                             ondelete='CASCADE',
                                             onupdate='CASCADE'),
                               primary_key=True,
                               nullable=False)
Esempio n. 30
0
class PuffleTreasureFurniture(db.Model):
    __tablename__ = 'puffle_treasure_furniture'

    puffle_id = db.Column(db.ForeignKey('puffle.id',
                                        ondelete='CASCADE',
                                        onupdate='CASCADE'),
                          primary_key=True,
                          nullable=False)
    furniture_id = db.Column(db.ForeignKey('furniture.id',
                                           ondelete='CASCADE',
                                           onupdate='CASCADE'),
                             primary_key=True,
                             nullable=False)