Move remote_items and _start_inventory from world to client (#227)

This commit is contained in:
black-sliver
2022-01-23 06:38:46 +01:00
committed by GitHub
parent 219bcb3521
commit f0cfe30a36
6 changed files with 67 additions and 21 deletions

View File

@@ -118,6 +118,7 @@ class CommonContext():
game = None
ui = None
keep_alive_task = None
items_handling: typing.Optional[int] = None
def __init__(self, server_address, password):
# server state
@@ -247,9 +248,9 @@ class CommonContext():
async def send_connect(self, **kwargs):
payload = {
"cmd": 'Connect',
'cmd': 'Connect',
'password': self.password, 'name': self.auth, 'version': Utils.version_tuple,
'tags': self.tags,
'tags': self.tags, 'items_handling': self.items_handling,
'uuid': Utils.get_unique_identifier(), 'game': self.game
}
if kwargs:
@@ -469,6 +470,8 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
logger.error('Invalid password')
ctx.password = None
await ctx.server_auth(True)
elif 'InvalidItemsHandling' in errors:
raise Exception('The item handling flags requested by the client are not supported')
elif errors:
raise Exception("Unknown connection errors: " + str(errors))
else:
@@ -589,6 +592,7 @@ if __name__ == '__main__':
class TextContext(CommonContext):
tags = {"AP", "IgnoreGame", "TextOnly"}
game = "Archipelago"
items_handling = 0 # don't receive any NetworkItems
async def server_auth(self, password_requested: bool = False):
if password_requested and not self.password: