Always check player owns their color and the vanilla default inventory

This commit is contained in:
Ben 2020-02-14 21:52:13 +00:00
parent a32f3df56e
commit 30586157fc

View File

@ -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