From 1b09500fedc6f9acd257c2f1526cb6c8da1b01f4 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 2 Jan 2020 23:00:30 +0000 Subject: [PATCH] Default game data index should be 0 --- houdini/handlers/games/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/houdini/handlers/games/__init__.py b/houdini/handlers/games/__init__.py index e6584be..6d93721 100644 --- a/houdini/handlers/games/__init__.py +++ b/houdini/handlers/games/__init__.py @@ -99,7 +99,7 @@ async def handle_get_game_over(p, score: int): @handlers.handler(XTPacket('ggd', ext='z'), client=ClientType.Vanilla) -async def handle_get_game_data(p, index: int = None): +async def handle_get_game_data(p, index: int = 0): game_data = await PenguinGameData.select('data').where((PenguinGameData.penguin_id == p.id) & (PenguinGameData.room_id == p.room.id) & (PenguinGameData.index == index)).gino.scalar() @@ -108,7 +108,7 @@ async def handle_get_game_data(p, index: int = None): @handlers.handler(XTPacket('sgd', ext='z'), client=ClientType.Vanilla) @handlers.cooldown(5) -async def handle_set_game_data(p, index: OptionalConverter(int) = None, *, game_data: str): +async def handle_set_game_data(p, index: OptionalConverter(int) = 0, *, game_data: str): if p.room.game: data_insert = insert(PenguinGameData).values(penguin_id=p.id, room_id=p.room.id, index=index, data=game_data) data_insert = data_insert.on_conflict_do_update(