class PenguinIglooRoom(db.Model, RoomMixin): __tablename__ = 'penguin_igloo_room' id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"penguin_igloo_room_id_seq\"'::regclass)")) penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) type = db.Column(db.ForeignKey('igloo.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) flooring = db.Column(db.ForeignKey('flooring.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) music = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) location = db.Column(db.ForeignKey('location.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) locked = db.Column(db.Boolean, nullable=False, server_default=db.text("true")) competition = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) internal_id = 2000 name = 'Igloo' member = False max_users = 80 required_item = None game = False blackhole = False spawn = False stamp_group = None @property def external_id(self): return self.penguin_id + PenguinIglooRoom.internal_id def __init__(self, *args, **kwargs): RoomMixin.__init__(self, *args, **kwargs) super().__init__(*args, **kwargs)
class Login(db.Model): __tablename__ = 'login' id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"login_id_seq\"'::regclass)")) penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) ip_hash = db.Column(db.CHAR(255), nullable=False) minutes_played = db.Column(db.Integer, nullable=False, server_default=db.text("0"))
class Igloo(db.Model): __tablename__ = 'igloo' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False) cost = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) patched = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) legacy_inventory = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) vanilla_inventory = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
class PenguinMembership(db.Model): __tablename__ = 'penguin_membership' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) start = db.Column(db.DateTime, primary_key=True, nullable=False) expires = db.Column(db.DateTime) start_aware = db.Column(db.Boolean, server_default=db.text("false")) expires_aware = db.Column(db.Boolean, server_default=db.text("false")) expired_aware = db.Column(db.Boolean, server_default=db.text("false"))
class IglooFurniture(db.Model): __tablename__ = 'igloo_furniture' igloo_id = db.Column(db.ForeignKey('penguin_igloo_room.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False, index=True) furniture_id = db.Column(db.ForeignKey('furniture.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) x = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("0")) y = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("0")) frame = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("0")) rotation = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("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()"))
class CharacterBuddy(db.Model): __tablename__ = 'character_buddy' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) character_id = db.Column(db.ForeignKey('character.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) best_buddy = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
class BuddyList(db.Model): __tablename__ = 'buddy_list' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) buddy_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False, index=True) best_buddy = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
class Item(db.Model): __tablename__ = 'item' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) type = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) cost = db.Column(db.Integer, nullable=False, server_default=db.text("0")) member = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) bait = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) patched = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) legacy_inventory = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) vanilla_inventory = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) epf = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) tour = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) release_date = db.Column(db.Date, nullable=False, server_default=db.text("now()")) treasure = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) innocent = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) def is_color(self): return self.type == 1 def is_head(self): return self.type == 2 def is_face(self): return self.type == 3 def is_neck(self): return self.type == 4 def is_body(self): return self.type == 5 def is_hand(self): return self.type == 6 def is_feet(self): return self.type == 7 def is_flag(self): return self.type == 8 def is_photo(self): return self.type == 9 def is_award(self): return self.type == 10
class Furniture(db.Model): __tablename__ = 'furniture' id = db.Column(db.Integer, primary_key=True) vanilla_inventory = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
class Penguin(db.Model): __tablename__ = 'penguin' id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"penguin_id_seq\"'::regclass)")) username = db.Column(db.String(12), nullable=False, unique=True) nickname = db.Column(db.String(30), nullable=False) password = db.Column(db.CHAR(60), nullable=False) email = db.Column(db.String(255), nullable=False, index=True) registration_date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) active = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) safe_chat = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) last_paycheck = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) minutes_played = db.Column(db.Integer, nullable=False, server_default=db.text("0")) moderator = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) stealth_moderator = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) character = db.Column(db.ForeignKey('character.id', ondelete='CASCADE', onupdate='CASCADE')) igloo = db.Column(db.ForeignKey('penguin_igloo_room.id', ondelete='CASCADE', onupdate='CASCADE')) coins = db.Column(db.Integer, nullable=False, server_default=db.text("500")) color = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) head = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) face = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) neck = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) body = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) hand = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) feet = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) photo = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) flag = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE')) permaban = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) book_modified = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) book_color = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) book_highlight = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) book_pattern = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) book_icon = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) agent_status = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) field_op_status = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) career_medals = db.Column(db.Integer, nullable=False, server_default=db.text("0")) agent_medals = db.Column(db.Integer, nullable=False, server_default=db.text("0")) last_field_op = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) com_message_read_date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) ninja_rank = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) ninja_progress = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) fire_ninja_rank = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) fire_ninja_progress = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) water_ninja_rank = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) water_ninja_progress = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) ninja_matches_won = db.Column(db.Integer, nullable=False, server_default=db.text("0")) fire_matches_won = db.Column(db.Integer, nullable=False, server_default=db.text("0")) water_matches_won = db.Column(db.Integer, nullable=False, server_default=db.text("0")) rainbow_adoptability = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) has_dug = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) puffle_handler = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) nuggets = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) walking = db.Column(db.ForeignKey('penguin_puffle.id', ondelete='CASCADE', onupdate='CASCADE')) opened_playercard = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) special_wave = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) special_dance = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) special_snowball = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) map_category = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) status_field = db.Column(db.Integer, nullable=False, server_default=db.text("0")) timer_active = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) timer_start = db.Column(db.Time, nullable=False, server_default=db.text("'00:00:00'::time without time zone")) timer_end = db.Column(db.Time, nullable=False, server_default=db.text("'23:59:59'::time without time zone")) timer_total = db.Column(db.Interval, nullable=False, server_default=db.text("'01:00:00'::interval")) grounded = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_en = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_pt = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_fr = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_es = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_de = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) approval_ru = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_en = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_pt = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_fr = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_es = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_de = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rejection_ru = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) sid = db.Column(db.String(255), nullable=True) def __init__(self, *args, **kwargs): self.inventory = None self.permissions = None self.attributes = None self.igloos = None self.igloo_rooms = None self.furniture = None self.flooring = None self.locations = None self.stamps = None self.cards = None self.puffles = None self.puffle_items = None self.buddies = None self.buddy_requests = None self.character_buddies = None self.ignore = None super().__init__(*args, **kwargs) @lru_cache() def safe_nickname(self, language_bitmask): return self.nickname if self.approval & language_bitmask else "P" + str(self.id) async def status_field_set(self, field_bitmask): if (self.status_field & field_bitmask) == 0: await self.update(status_field=self.status_field ^ field_bitmask).apply() def status_field_get(self, field_bitmask): return (self.status_field & field_bitmask) != 0 @property @lru_cache() def age(self): return (datetime.now() - self.registration_date).days @property @lru_cache() def approval(self): return int(f'{self.approval_ru * 1}{self.approval_de * 1}0{self.approval_es * 1}' f'{self.approval_fr * 1}{self.approval_pt * 1}{self.approval_en * 1}', 2) @property @lru_cache() def rejection(self): return int(f'{self.rejection_ru * 1}{self.rejection_de * 1}0{self.rejection_es * 1}' f'{self.rejection_fr * 1}{self.rejection_pt * 1}{self.rejection_en * 1}', 2)
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()"))