Skip to content

Commit

Permalink
Merge branch 'zoffline:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm authored Sep 3, 2024
2 parents f37efde + f0ea459 commit f8c7e98
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 83 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ zoffline can be installed on the same machine as Zwift or another local machine.
<details><summary>Windows Instructions</summary>

* Install Zwift
* If your Zwift version is 1.0.134595, you're all set.
* If your Zwift version is 1.0.134871, you're all set.
* If Zwift is not installed, install it before installing zoffline.
* If your Zwift version is newer than 1.0.134595 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file.
* If your Zwift version is newer than 1.0.134595 and zoffline is not running from source: wait for zoffline to be updated.
* If your Zwift version is newer than 1.0.134871 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file.
* If your Zwift version is newer than 1.0.134871 and zoffline is not running from source: wait for zoffline to be updated.
* __NOTE:__ instead of performing the steps below you can instead just run the __configure_client__ script from https://github.com/oldnapalm/zoffline-helper/releases/latest
* On your Windows machine running Zwift, copy the following files in this repo to a known location:
* [ssl/cert-zwift-com.p12](https://github.com/zoffline/zwift-offline/raw/master/ssl/cert-zwift-com.p12)
Expand All @@ -124,9 +124,9 @@ to generate your own certificates and do the same.
<details><summary>macOS Instructions</summary>

* Install Zwift
* If your Zwift version is 1.0.134595, you're all set.
* If your Zwift version is 1.0.134871, you're all set.
* If Zwift is not installed, install it before installing zoffline.
* If your Zwift version is newer than 1.0.134595: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file.
* If your Zwift version is newer than 1.0.134871: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file.
* On your Mac machine running Zwift, copy the file [ssl/cert-zwift-com.pem](https://github.com/zoffline/zwift-offline/raw/master/ssl/cert-zwift-com.pem) in this repo to a known location.
* Open Keychain Access, select "System" under "Keychains", select "Certificates" under "Category"
* Click "File - Import Items..." and import cert-zwift-com.pem
Expand Down Expand Up @@ -342,15 +342,7 @@ To enable support for multiple users perform the steps below:
* If multiplayer is enabled, access ``https://<zoffline_ip>/login/``, check "Enable ghosts" and click "Start Zwift" to save the option.
* When you save an activity, the ghost will be saved in ``storage/<player_id>/ghosts/<world>/<route>``. Next time you ride the same route, the ghost will be loaded.
* Type ``.regroup`` in chat to regroup the ghosts.
* Equipment ("bike_frame", "bike_wheel_front", "bike_wheel_rear", "ride_jersey", "ride_helmet_type", "glasses_type", "ride_shoes_type" and "ride_socks_type") can be customized by creating a file ``ghost_profile.txt`` inside the ``storage`` folder. Values (signature) can be found in [GameDictionary](http://cdn.zwift.com/gameassets/GameDictionary.xml).

Example:
``` json
{
"ride_jersey": 90433914,
"bike_frame": 1456463855
}
```
* Equipment can be customized by creating a file ``ghost_profile.txt`` inside the ``storage`` folder. The script ``find_equip.py`` can be used to populate this file.

#### Bots

Expand Down Expand Up @@ -379,6 +371,10 @@ To enable support for multiple users perform the steps below:
* You can teleport to a bookmark using the teleport icon on the action bar.
</details>

### All-time leaderboards

To enable all-time leaderboards (override 60 minutes live results and 90 days personal records), create a file ``all_time_leaderboards.txt`` in the ``storage`` directory.

## Community Discord server and Strava club

Please join the community supported [Discord](https://discord.gg/GMdn8F8) server and [Strava](https://www.strava.com/clubs/zoffline) club.
Expand Down
2 changes: 1 addition & 1 deletion cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Zwift version="1.0.134595" sversion="1.72.2 (134595)" gbranch="rc/1.72.2" gcommit="451573555ef11709e60461ac84f368a122f14ddc" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.134595_ce35793d_manifest.xml" manifest_checksum="-1057907904" ver_cur_checksum="-1100226285"/>
<Zwift version="1.0.134871" sversion="1.73.0 (134871)" gbranch="rc/1.73.0" gcommit="b3dc433ed3deac8fc0fbd392ed7024a100d25665" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.134871_5f0303f9_manifest.xml" manifest_checksum="373345836" ver_cur_checksum="2077541851"/>
2 changes: 1 addition & 1 deletion cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Zwift version="1.0.134595" sversion="1.72.2 (134595)" gbranch="rc/1.72.2" gcommit="451573555ef11709e60461ac84f368a122f14ddc" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.134595_ce35793d_manifest.xml" manifest_checksum="-1185758442" ver_cur_checksum="-390452429"/>
<Zwift version="1.0.134871" sversion="1.73.0 (134871)" gbranch="rc/1.73.0" gcommit="b3dc433ed3deac8fc0fbd392ed7024a100d25665" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.134871_5f0303f9_manifest.xml" manifest_checksum="-1883941091" ver_cur_checksum="889064577"/>
28 changes: 0 additions & 28 deletions data/events.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,34 +272,6 @@
"course": 6,
"sport": 0
},
{
"name": "Watopia - Mayan 8",
"route": 4084028627,
"distance": 26148.6,
"course": 6,
"sport": 0
},
{
"name": "Watopia - Navig8",
"route": 806114032,
"distance": 66136.7,
"course": 6,
"sport": 0
},
{
"name": "Watopia - Power to the Tower",
"route": 2064290391,
"distance": 45648.9,
"course": 6,
"sport": 0
},
{
"name": "Watopia - Radio Rendezvous",
"route": 4102513789,
"distance": 23598.1,
"course": 6,
"sport": 0
},
{
"name": "Watopia - Road To Ruins Reverse",
"route": 2967612381,
Expand Down
2 changes: 1 addition & 1 deletion data/game_info.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions data/start_lines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@
"road": 0,
"time": 909256
},
"-1367316000": {
"name": "Makuri Islands - Makuri Pretzel",
"road": 4,
"time": 731960
},
"1366943680": {
"name": "Makuri Islands - Mech Isle Loop",
"road": 129,
Expand Down
46 changes: 28 additions & 18 deletions data/variants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"value": true,
"values": {}
},
{
"name": "dynamic_ftp_estimation",
"values": {}
},
{
"name": "fitness_widget",
"values": {
Expand Down Expand Up @@ -490,7 +494,7 @@
"boolValue": false
},
"UseEventAssets": {
"varintValue": "2"
"varintValue": "0"
},
"allowPortalRoadDifficultySelection": {
"boolValue": true
Expand Down Expand Up @@ -1001,11 +1005,6 @@
"value": true,
"values": {}
},
{
"name": "game_1_62_batch_load_tapi_workouts",
"value": true,
"values": {}
},
{
"name": "game_1_62_tapi_workouts",
"value": true,
Expand Down Expand Up @@ -1046,19 +1045,11 @@
"values": {
"fields": {
"hero_carousel_id": {
"stringValue": "home_page_hero_carousel_1_72"
"stringValue": "home_page_hero_carousel"
}
}
}
},
{
"name": "game_1_64_override_run_free_incline_control",
"values": {}
},
{
"name": "game_1_64_override_run_free_negative_incline",
"values": {}
},
{
"name": "game_1_64_rubberbanding_v3",
"value": true,
Expand Down Expand Up @@ -1201,6 +1192,7 @@
},
{
"name": "game_1_67_tp_cards",
"value": true,
"values": {}
},
{
Expand Down Expand Up @@ -1234,6 +1226,7 @@
},
{
"name": "game_1_69_fix_riding_offset",
"value": true,
"values": {}
},
{
Expand Down Expand Up @@ -1295,6 +1288,7 @@
},
{
"name": "game_1_71_prevent_sending_ble_messages_prior_com_setup",
"value": true,
"values": {}
},
{
Expand All @@ -1315,6 +1309,15 @@
"name": "game_1_72_reset_route_manager_on_logout",
"values": {}
},
{
"name": "game_1_73_sweeper_check",
"values": {}
},
{
"name": "game_1_73_ui_scheduler",
"value": true,
"values": {}
},
{
"name": "game_3second_power_average_smoothing",
"value": true,
Expand Down Expand Up @@ -1469,7 +1472,7 @@
"stringValue": "dlc_asset"
},
"build_id": {
"stringValue": "david.brickhill.20240813065321"
"stringValue": "david.brickhill.20240903071851"
},
"canary_test": {
"boolValue": true
Expand Down Expand Up @@ -1497,6 +1500,9 @@
},
"tenant": {
"stringValue": "production"
},
"use_startup": {
"boolValue": false
}
}
}
Expand Down Expand Up @@ -1525,7 +1531,7 @@
"boolValue": true
},
"game_minimap_graph_update": {
"boolValue": true
"boolValue": false
},
"optimized_tss_calculation": {
"boolValue": true
Expand All @@ -1534,7 +1540,7 @@
"boolValue": true
},
"standard_minimap_direction": {
"boolValue": true
"boolValue": false
}
}
}
Expand Down Expand Up @@ -1638,6 +1644,10 @@
"value": true,
"values": {}
},
{
"name": "game_workout_downloader",
"values": {}
},
{
"name": "game_zc_pairing_transfer",
"values": {}
Expand Down
85 changes: 85 additions & 0 deletions scripts/find_equip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#! /usr/bin/env python

# pip install country-converter fuzzywuzzy
#
# use to find and print entries from http://cdn.zwift.com/gameassets/GameDictionary.xml
# scripts/find_equip.py -p emonda -s sworks -o blue -j zwift -e kask

import urllib.request
import json
import country_converter as coco
import argparse
import os
import sys
import xml.etree.ElementTree as ET
from fuzzywuzzy import process
from fuzzywuzzy import fuzz

cc = coco.CountryConverter()

gd_file = 'GameDictionary.xml'
if not os.path.isfile(gd_file):
open(gd_file, 'wb').write(urllib.request.urlopen('http://cdn.zwift.com/gameassets/%s' % gd_file).read())
tree = ET.parse(gd_file)

def get_item(location, item, json_name):
items = {}
for x in tree.findall(location):
items[x.get('name')] = int(x.get('signature'))
best_match = process.extractOne(item, items.keys(), scorer=fuzz.token_set_ratio)
equip = {}
equip[json_name] = items[best_match[0]]
equip[json_name+'_name'] = best_match[0]
return equip

def main(argv):
global args

parser = argparse.ArgumentParser(description='Print out json for bot.txt or ghost_profile.txt')
megroup = parser.add_mutually_exclusive_group()
parser.add_argument('-n', '--nation', help='Specify nation', default=False)
parser.add_argument('-j', '--jersey', help='Get jersey', default=False)
megroup.add_argument('-b', '--bike', help='Get bike', default=False)
parser.add_argument('-w', '--wheels', help='Get wheels', default=False)
parser.add_argument('-e', '--helmet', help='Get helmet', default=False)
parser.add_argument('-s', '--shoes', help='Get shoes', default=False)
parser.add_argument('-o', '--socks', help='Get socks', default=False)
parser.add_argument('-g', '--glasses', help='Get glasses', default=False)
megroup.add_argument('-p', '--paintjob', help='Get paintjob', default=False)
args = parser.parse_args()

total_data = {}
if args.nation:
total_data['country_code'] = cc.convert(names=args.nation, to='ISOnumeric')
if args.jersey:
total_data.update(get_item("./JERSEYS/JERSEY", args.jersey, 'ride_jersey'))
if args.bike:
total_data.update(get_item("./BIKEFRAMES/BIKEFRAME", args.bike, 'bike_frame'))
if args.wheels:
total_data.update(get_item("./BIKEFRONTWHEELS/BIKEFRONTWHEEL", args.wheels, 'bike_wheel_front'))
total_data.update(get_item("./BIKEREARWHEELS/BIKEREARWHEEL", args.wheels, 'bike_wheel_rear'))
if args.helmet:
total_data.update(get_item("./HEADGEARS/HEADGEAR", args.helmet, 'ride_helmet_type'))
if args.socks:
total_data.update(get_item("./SOCKS/SOCK", args.socks, 'ride_socks_type'))
if args.shoes:
total_data.update(get_item("./BIKESHOES/BIKESHOE", args.shoes, 'ride_shoes_type'))
if args.glasses:
total_data.update(get_item("./GLASSES/GLASS", args.glasses, 'glass_type'))
if args.paintjob:
total_data.update(get_item("./PAINTJOBS/PAINTJOB", args.paintjob, 'bike_frame_colour'))
total_data['bike_frame_colour'] <<= 32
total_data.update(get_item("./BIKEFRAMES/BIKEFRAME", total_data['bike_frame_colour_name'].split('-')[0], 'bike_frame'))

data = json.dumps(total_data, indent=2)
print(data)
open('ghost_profile.txt', 'w').write(data)

if __name__ == '__main__':
try:
main(sys.argv)
except KeyboardInterrupt:
pass
except SystemExit as se:
print("ERROR:", se)

8 changes: 5 additions & 3 deletions scripts/get_pro_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import json
import country_converter as coco
import argparse
import getpass
import os
import sys
import xml.etree.ElementTree as ET
Expand Down Expand Up @@ -589,7 +588,7 @@ def get_pros(url, male, get_jersey, get_equipment, team_abbrv):
if 'bike_signature' in team:
tmp['bike_frame'] = team['bike_signature']
if 'bike_frame_colour_signature' in team:
tmp['bike_frame_colour'] = (team['bike_frame_colour_signature'] << 32)
tmp['bike_frame_colour'] = team['bike_frame_colour_signature'] << 32
if 'front_wheel_signature' in team:
tmp['bike_wheel_front'] = team['front_wheel_signature']
if 'rear_wheel_signature' in team:
Expand All @@ -601,7 +600,10 @@ def get_pros(url, male, get_jersey, get_equipment, team_abbrv):

return data

tree = ET.fromstring(urllib.request.urlopen('http://cdn.zwift.com/gameassets/GameDictionary.xml').read())
gd_file = 'GameDictionary.xml'
if not os.path.isfile(gd_file):
open(gd_file, 'wb').write(urllib.request.urlopen('http://cdn.zwift.com/gameassets/%s' % gd_file).read())
tree = ET.parse(gd_file)
jerseys = {}
for x in tree.findall("./JERSEYS/JERSEY"):
jerseys[x.get('name')] = int(x.get('signature'))
Expand Down
Loading

0 comments on commit f8c7e98

Please sign in to comment.