From a521395e8001de12ca62ea99e9be5743f935aa0e Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 2 Jan 2020 23:13:37 +0000 Subject: [PATCH] Mascot stamp handler --- houdini/handlers/play/stampbook.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/houdini/handlers/play/stampbook.py b/houdini/handlers/play/stampbook.py index 3d55774..0eb2f16 100644 --- a/houdini/handlers/play/stampbook.py +++ b/houdini/handlers/play/stampbook.py @@ -1,6 +1,6 @@ from houdini import handlers from houdini.handlers import XTPacket -from houdini.handlers.play.navigation import handle_join_server +from houdini.handlers.play.navigation import handle_join_server, handle_join_room from houdini.data.stamp import Stamp, CoverStamp, CoverItem, PenguinStampCollection from houdini.data.penguin import Penguin @@ -60,6 +60,21 @@ async def handle_get_stamps(p): await p.send_xt('gps', p.id, await get_player_stamps_string(p, p.id)) +@handlers.handler(XTPacket('j', 'jr'), after=handle_join_room) +async def handle_add_mascot_stamp(p): + if p.character is not None: + character = p.server.characters[p.character] + stamp = p.server.stamps[character.stamp_id] + for penguin in p.room.penguins_by_id.values(): + await penguin.add_stamp(stamp) + + for penguin in p.room.penguins_by_id.values(): + if penguin.character is not None: + character = p.server.characters[penguin.character] + stamp = p.server.stamps[character.stamp_id] + await p.add_stamp(stamp) + + @handlers.handler(XTPacket('st', 'gps')) @handlers.cooldown(1) async def handle_get_player_stamps(p, player_id: int):