def initPenguinIglooRoom(self, penguin_id): penguin = ( yield Penguin.find(penguin_id) ) if penguin_id != self.penguin['id'] else self.penguin.dbpenguin if penguin is None: returnValue(None) iglooRoom = self.penguin.engine.iglooCrumbs.getPenguinIgloo(penguin_id) currentIgloo = int(penguin.igloo) igloo = yield Igloo.find(currentIgloo) if igloo is None: igloo = Igloo(penguin_id=penguin_id) yield igloo.save() currentIgloo = penguin.igloo = int(igloo.id) yield penguin.save() yield igloo.refresh() if iglooRoom is None: iglooRoom = IglooRoom(self.penguin.engine.roomHandler, (1000 + penguin_id), '{} igloo'.format(penguin_id), "{}'s Igloo".format(penguin.nickname), 100, False, False, None) self.penguin.engine.iglooCrumbs.penguinIgloos.append(iglooRoom) self.penguin.engine.roomHandler.rooms.append(iglooRoom) iglooRoom.owner = int(penguin_id) iglooRoom.opened = not bool(igloo.locked) iglooRoom._id = int(igloo.id) returnValue(iglooRoom)
def handleAddLayout(client, data): if len(client['data'].igloos) > 6: returnValue(None) if not client['member']: returnValue(client.send('e', 999)) igloo = Igloo(penguin_id=client['id']) yield igloo.save() client['RefreshHandler'].forceRefresh() details = [igloo.id, len(client['data'].igloos)+1, 0, int(bool(igloo.locked)), igloo.music, igloo.floor, igloo.location, igloo.type, 0, ''] client.send('al', client['id'], ':'.join(map(str, details)))