Skip to content

Commit

Permalink
Update bot attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Feb 18, 2024
1 parent ef374e1 commit c6641b5
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 9 deletions.
85 changes: 84 additions & 1 deletion data/game_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2124,5 +2124,88 @@
"224": 1917017591,
"225": 3706527503,
"226": 1033940053
}
},
"body_types_male": [
2130,
2098,
2066,
2386,
2354,
2322,
2642,
2610,
2578,
4178,
4146,
4114,
4434,
4402,
4370,
4690,
4658,
4626,
6226,
6194,
6162,
6482,
6450,
6418,
6738,
6706,
6674
],
"body_types_female": [
2131,
2099,
2067,
2387,
2355,
2323,
2643,
2611,
2579,
4179,
4147,
4115,
4435,
4403,
4371,
4691,
4659,
4627
],
"hair_types": [
25953412,
175379869,
398510584,
659452569,
838618949,
924073005,
1022111028,
1262230565,
1305767757,
1569595897,
1626212425,
1985754517,
2234835005,
2507058825,
3092564365,
3200039653,
3296520581,
3351295312,
3536770137,
4021222889,
4179410997,
4294226781
],
"facial_hair_types": [
248681634,
398510584,
867351826,
1947387842,
2173853954,
3169994930,
4131541011,
4216468066
]
}
4 changes: 3 additions & 1 deletion scripts/get_game_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
'CASTLE CRIT (RUNNING)': 'CASTLE CRIT RUN'
}

with open('../data/game_dictionary.txt') as f:
gd = json.load(f, object_hook=lambda d: {int(k) if k.lstrip('-').isdigit() else k: v for k, v in d.items()})

base_url = 'http://cdn.zwift.com/gameassets/'
filename = 'GameDictionary.xml'
open(filename, 'wb').write(PoolManager().request('GET', base_url + filename).data)
tree = ET.parse(filename)
root = tree.getroot()
gd = {}
gd['headgears'] = [int(x.get('signature')) for x in root.findall("./HEADGEARS/HEADGEAR")]
gd['glasses'] = [int(x.get('signature')) for x in root.findall("./GLASSES/GLASS")]
gd['bikeshoes'] = [int(x.get('signature')) for x in root.findall("./BIKESHOES/BIKESHOE")]
Expand Down
13 changes: 6 additions & 7 deletions standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,6 @@ def play_pace_partners():
if pause > 0: time.sleep(pause)

def load_bots():
body_types = [16, 48, 80, 272, 304, 336, 528, 560, 592]
hair_types = [25953412, 175379869, 398510584, 659452569, 838618949, 924073005, 1022111028, 1262230565, 1305767757, 1569595897, 1626212425, 1985754517, 2234835005, 2507058825, 3092564365, 3200039653, 3296520581, 3351295312, 3536770137, 4021222889, 4179410997, 4294226781]
facial_hair_types = [248681634, 398510584, 867351826, 1947387842, 2173853954, 3169994930, 4131541011, 4216468066]
multiplier = 1
with open(ENABLE_BOTS_FILE) as f:
try:
Expand Down Expand Up @@ -556,12 +553,14 @@ def load_bots():
for item in ['first_name', 'last_name', 'is_male', 'country_code', 'ride_jersey', 'bike_frame', 'bike_wheel_front', 'bike_wheel_rear', 'ride_helmet_type', 'glasses_type', 'ride_shoes_type', 'ride_socks_type']:
if item in rider:
setattr(p, item, rider[item])
p.body_type = random.choice(body_types)
p.hair_type = random.choice(hair_types)
p.hair_type = random.choice(zo.GD['hair_types'])
p.hair_colour = random.randrange(5)
if p.is_male:
p.facial_hair_type = random.choice(facial_hair_types)
p.body_type = random.choice(zo.GD['body_types_male'])
p.facial_hair_type = random.choice(zo.GD['facial_hair_types'])
p.facial_hair_colour = random.randrange(5)
else:
p.body_type += 1
p.body_type = random.choice(zo.GD['body_types_female'])
bot.profile = p
i += 1

Expand Down

0 comments on commit c6641b5

Please sign in to comment.