From 30586157fcac57ea872155fa127306164a334c5f Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 14 Feb 2020 21:52:13 +0000 Subject: [PATCH] Always check player owns their color and the vanilla default inventory --- houdini/handlers/play/item.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/houdini/handlers/play/item.py b/houdini/handlers/play/item.py index e86e5f8..849d7b3 100644 --- a/houdini/handlers/play/item.py +++ b/houdini/handlers/play/item.py @@ -49,11 +49,23 @@ async def items_load(server): server.items = await ItemCollection.get_collection() server.logger.info(f'Loaded {len(server.items)} clothing items') + +DefaultInventory = [1285, 9106] + + +@handlers.handler(XMLPacket('login'), priority=Priority.Low) @handlers.allow_once async def load_inventory(p): p.inventory = await PenguinItemCollection.get_collection(p.id) p.permissions = await PenguinPermissionCollection.get_collection(p.id) + if p.color not in p.inventory: + await p.inventory.insert(item_id=p.color) + + for default_item_id in DefaultInventory: + if default_item_id not in p.inventory: + await p.inventory.insert(item_id=default_item_id) + @handlers.handler(XTPacket('i', 'gi')) @handlers.allow_once