mirror of
https://github.com/solero/houdini.git
synced 2025-01-23 04:37:00 +00:00
Support for handlers to depend on specific packets
This commit is contained in:
parent
4c673ea089
commit
5abc62ed1d
@ -217,6 +217,16 @@ def check_for_packet(listener, p):
|
|||||||
|
|
||||||
allow_once = check(check_for_packet)
|
allow_once = check(check_for_packet)
|
||||||
|
|
||||||
|
|
||||||
|
def depends_on_packet(*packets):
|
||||||
|
def check_for_packets(_, p):
|
||||||
|
for packet in packets:
|
||||||
|
if packet not in p.received_packets:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
return check(check_for_packets)
|
||||||
|
|
||||||
|
|
||||||
def player_attribute(**attrs):
|
def player_attribute(**attrs):
|
||||||
def check_for_attributes(_, p):
|
def check_for_attributes(_, p):
|
||||||
for attr, value in attrs.items():
|
for attr, value in attrs.items():
|
||||||
|
@ -17,6 +17,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
@handlers.handler(XMLPacket('login'))
|
@handlers.handler(XMLPacket('login'))
|
||||||
@handlers.allow_once
|
@handlers.allow_once
|
||||||
|
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
||||||
async def handle_login(p, credentials: Credentials):
|
async def handle_login(p, credentials: Credentials):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ handle_random_key = login.handle_random_key
|
|||||||
|
|
||||||
@handlers.handler(XMLPacket('login'))
|
@handlers.handler(XMLPacket('login'))
|
||||||
@handlers.allow_once
|
@handlers.allow_once
|
||||||
|
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
||||||
async def handle_login(p, credentials: WorldCredentials):
|
async def handle_login(p, credentials: WorldCredentials):
|
||||||
tr = p.server.redis.multi_exec()
|
tr = p.server.redis.multi_exec()
|
||||||
tr.get('{}.lkey'.format(credentials.id))
|
tr.get('{}.lkey'.format(credentials.id))
|
||||||
|
Loading…
Reference in New Issue
Block a user