Refresh room handler

This commit is contained in:
Ben 2019-08-23 21:49:47 +01:00
parent 2f0da637d2
commit c51dfc12d8
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,9 @@ class Room(db.Model):
p.frame = 1
p.toy = None
async def refresh(self, p):
await p.send_xt('grs', self.id, await self.get_string())
async def get_string(self):
return '%'.join([await p.string for p in self.penguins])

View File

@ -51,3 +51,8 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
async def handle_join_room(p, room: Room, x: int, y: int):
p.x, p.y = x, y
await p.join_room(room)
@handlers.handler(XTPacket('j', 'grs'))
async def handle_refresh_room(p):
await p.room.refresh(p)