From e45ab46b61baf6de51a30625fd9b42532bd25af2 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 9 Oct 2019 01:14:54 +0100 Subject: [PATCH] Add IglooRoom collection to Penguin data model --- houdini/data/penguin.py | 3 +++ houdini/data/room.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/houdini/data/penguin.py b/houdini/data/penguin.py index 65afa55..9df5d7a 100644 --- a/houdini/data/penguin.py +++ b/houdini/data/penguin.py @@ -11,6 +11,7 @@ from houdini.data.ninja import CardCrumbsCollection from houdini.data.pet import PuffleCrumbsCollection, PuffleItemCrumbsCollection from houdini.data.buddy import BuddyListCollection, BuddyRequestCollection, CharacterBuddyCollection, \ IgnoreListCollection +from houdini.data.room import PenguinIglooRoomCollection class Penguin(db.Model): @@ -91,6 +92,7 @@ class Penguin(db.Model): self.inventory = None self.permissions = None self.igloos = None + self.igloo_rooms = None self.furniture = None self.flooring = None self.locations = None @@ -109,6 +111,7 @@ class Penguin(db.Model): self.inventory = await ItemCrumbsCollection.get_collection(self.id) self.permissions = await PermissionCrumbsCollection.get_collection(self.id) self.igloos = await IglooCrumbsCollection.get_collection(self.id) + self.igloo_rooms = await PenguinIglooRoomCollection.get_collection(self.id) self.furniture = await FurnitureCrumbsCollection.get_collection(self.id) self.flooring = await FlooringCrumbsCollection.get_collection(self.id) self.locations = await LocationCrumbsCollection.get_collection(self.id) diff --git a/houdini/data/room.py b/houdini/data/room.py index aedd778..a10c3b6 100644 --- a/houdini/data/room.py +++ b/houdini/data/room.py @@ -158,6 +158,16 @@ class PenguinIglooRoom(db.Model, RoomMixin): del p.server.igloos_by_penguin_id[self.penguin_id] +class PenguinIglooRoomCollection(BaseCrumbsCollection): + + def __init__(self, inventory_id=None): + super().__init__(model=PenguinIglooRoom, + key='id', + inventory_model=PenguinIglooRoom, + inventory_key='penguin_id', + inventory_value='id', + inventory_id=inventory_id) + class RoomTable(db.Model): __tablename__ = 'room_table'