Add IglooRoom collection to Penguin data model

This commit is contained in:
Ben 2019-10-09 01:14:54 +01:00
parent 198a015c70
commit e45ab46b61
2 changed files with 13 additions and 0 deletions

View File

@ -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)

View File

@ -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'