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 Report(db.Model): __tablename__ = 'report' id = db.Column( db.Integer, primary_key=True, server_default=db.text("nextval('\"report_ID_seq\"'::regclass)")) penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) reporter_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) report_type = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) server_id = db.Column(db.Integer, nullable=False) room_id = db.Column(db.ForeignKey('room.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False)
class Furniture(db.Model): __tablename__ = 'furniture' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False) type = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) sort = 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")) 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")) bait = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) max_quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("100")) innocent = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
class PenguinPostcard(db.Model): __tablename__ = 'penguin_postcard' id = db.Column(db.Integer, primary_key=True, server_default=db.text( "nextval('\"penguin_postcard_id_seq\"'::regclass)")) penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False, index=True) sender_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), index=True) postcard_id = db.Column(db.ForeignKey('postcard.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) send_date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) details = db.Column(db.String(255), nullable=False, server_default=db.text("''::character varying")) has_read = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
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
class PenguinIglooRoom(db.Model): __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("false"))
class Puffle(db.Model): __tablename__ = 'puffle' id = db.Column(db.Integer, primary_key=True) parent_id = db.Column(db.ForeignKey('puffle.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) name = db.Column(db.String(50), nullable=False, server_default=db.text("''::character varying")) member = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) favourite_food = db.Column(db.ForeignKey('puffle_item.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) runaway_postcard = db.Column( db.ForeignKey('postcard.id', ondelete='CASCADE', onupdate='CASCADE')) max_food = db.Column(db.SmallInteger, nullable=False, server_default=db.text("100")) max_rest = db.Column(db.SmallInteger, nullable=False, server_default=db.text("100")) max_clean = db.Column(db.SmallInteger, nullable=False, server_default=db.text("100"))
class Stamp(db.Model): __tablename__ = 'stamp' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False) group_id = db.Column(db.ForeignKey('stamp_group.id', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) member = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) rank = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1")) description = db.Column(db.String(255), nullable=False, server_default=db.text("''::character varying"))
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"))
class Flooring(db.Model): __tablename__ = 'flooring' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) cost = db.Column(db.Integer, nullable=False, server_default=db.text("0")) patched = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
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 = db.Column(db.Integer, nullable=False, server_default=db.text("100000")) millis_per_bar = db.Column(db.Integer, nullable=False, server_default=db.text("2000"))
class Permission(db.Model): __tablename__ = 'permission' id = db.Column( db.Integer, primary_key=True, server_default=db.text("nextval('\"permission_id_seq\"'::regclass)")) name = db.Column(db.String(50), nullable=False, unique=True) enabled = db.Column(db.Boolean, nullable=False, server_default=db.text("true"))
class CoverItem(db.Model): __tablename__ = 'cover_item' penguin_id = db.Column(db.ForeignKey('penguin.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) x = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) y = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) rotation = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) depth = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0"))
class ChatFilterRule(db.Model): __tablename__ = 'chat_filter_rule' word = db.Column(db.Text, primary_key=True) filter = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) warn = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) ban = 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 RedemptionCode(db.Model): __tablename__ = 'redemption_code' id = db.Column(db.Integer, primary_key=True, server_default=db.text( "nextval('\"redemption_code_id_seq\"'::regclass)")) code = db.Column(db.String(16), nullable=False, unique=True) type = db.Column(db.String(8), nullable=False, server_default=db.text("'BLANKET'::character varying")) coins = db.Column(db.Integer, nullable=False, server_default=db.text("0")) expires = db.Column(db.DateTime)
class Location(db.Model): __tablename__ = 'location' 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("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 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"))
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 PuffleQuest(db.Model): __tablename__ = 'puffle_quest' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) task_id = db.Column(db.SmallInteger, primary_key=True, nullable=False) completion_date = db.Column(db.DateTime) item_collected = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) coins_collected = 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")) 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()")) 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 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 PenguinStamp(db.Model): __tablename__ = 'penguin_stamp' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) stamp_id = db.Column(db.ForeignKey('stamp.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) recent = db.Column(db.Boolean, nullable=False, server_default=db.text("true"))
class PenguinCard(db.Model): __tablename__ = 'penguin_card' penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False, index=True) card_id = db.Column(db.ForeignKey('card.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
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.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)
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 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) RoomMixin.__init__(self, *args, **kwargs) @property def external_id(self): return self.penguin_id + PenguinIglooRoom.internal_id async def add_penguin(self, p): await RoomMixin.add_penguin(self, p) await p.send_xt('jr', self.external_id, await self.get_string(f=stealth_mod_filter(p.id))) if not p.stealth_moderator: await self.send_xt('ap', await p.string) p.server.igloos_by_penguin_id[self.penguin_id] = self async def remove_penguin(self, p): await RoomMixin.remove_penguin(self, p) if not self.penguins_by_id: del p.server.igloos_by_penguin_id[self.penguin_id]
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 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()"))
class RedemptionBookWord(db.Model): __tablename__ = 'redemption_book_word' question_id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"redemption_book_word_question_id_seq\"'::regclass)")) book_id = db.Column(db.ForeignKey('redemption_book.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, nullable=False) page = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("1")) line = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("1")) word_number = db.Column(db.SmallInteger, primary_key=True, nullable=False, server_default=db.text("1")) answer = db.Column(db.String(20), nullable=False)
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()"))