From 22fac8efc0eb3d4019f8cda8c3dfa5b185381dd5 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:26:55 -0300 Subject: [PATCH] Match bots rear and front wheels --- zwift_offline.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/zwift_offline.py b/zwift_offline.py index d0aaa861..3b2553a1 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -412,8 +412,16 @@ def load_game_dictionary(): gd['bikeshoes'] = [int(x.get('signature')) for x in root.findall("./BIKESHOES/BIKESHOE")] gd['socks'] = [int(x.get('signature')) for x in root.findall("./SOCKS/SOCK")] gd['jerseys'] = [int(x.get('signature')) for x in root.findall("./JERSEYS/JERSEY")] - gd['bikefrontwheels'] = [int(x.get('signature')) for x in root.findall("./BIKEFRONTWHEELS/BIKEFRONTWHEEL")] - gd['bikerearwheels'] = [int(x.get('signature')) for x in root.findall("./BIKEREARWHEELS/BIKEREARWHEEL")] + frontwheels = {} + for x in root.findall("./BIKEFRONTWHEELS/BIKEFRONTWHEEL"): + frontwheels[x.get('name')] = int(x.get('signature')) + rearwheels = {} + for x in root.findall("./BIKEREARWHEELS/BIKEREARWHEEL"): + rearwheels[x.get('name')] = int(x.get('signature')) + gd['wheels'] = [] + for wheel in rearwheels: + if wheel in frontwheels: + gd['wheels'].append((rearwheels[wheel], frontwheels[wheel])) gd['runshirts'] = [int(x.get('signature')) for x in root.findall("./RUNSHIRTS/RUNSHIRT")] gd['runshorts'] = [int(x.get('signature')) for x in root.findall("./RUNSHORTS/RUNSHORT")] gd['runshoes'] = [int(x.get('signature')) for x in root.findall("./RUNSHOES/RUNSHOE")] @@ -1966,8 +1974,7 @@ def random_profile(p): p.ride_shoes_type = random.choice(GD['bikeshoes']) p.ride_socks_type = random.choice(GD['socks']) p.ride_jersey = random.choice(GD['jerseys']) - p.bike_wheel_front = random.choice(GD['bikefrontwheels']) - p.bike_wheel_rear = random.choice(GD['bikerearwheels']) + p.bike_wheel_rear, p.bike_wheel_front = random.choice(GD['wheels']) p.bike_frame = random.choice(list(GD['bikeframes'].keys())) p.run_shirt_type = random.choice(GD['runshirts']) p.run_shorts_type = random.choice(GD['runshorts'])