-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
70 lines (62 loc) · 2.3 KB
/
constants.py
File metadata and controls
70 lines (62 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import json
import zlib
import requests
GAME_VERSION = "0.12.3.5834"
LAUNCHER_VERSION = "0.9.3.1023"
UNITY_VERSION = "2018.4.13f1"
LAUNCHER_ENDPOINT = "https://launcher.escapefromtarkov.com"
PROD_ENDPOINT = "https://prod.escapefromtarkov.com"
TRADING_ENDPOINT = "https://trading.escapefromtarkov.com"
RAGFAIR_ENDPOINT = "https://ragfair.escapefromtarkov.com"
# Check the current launcher version and update if necessary
def check_launcher_version():
global LAUNCHER_VERSION, LAUNCHER_ENDPOINT
url = "{}/launcher/GetLauncherDistrib".format(LAUNCHER_ENDPOINT)
body = {}
headers = {
'Content-Type': 'application/json',
'User-Agent': 'BSG Launcher {}'.format(LAUNCHER_VERSION)
}
content = None
rsp = requests.post(url, json=body, headers=headers)
try:
content = zlib.decompress(rsp.content).decode()
except:
pass
if not content:
print("check_launcher_version request failed: {}".format(rsp.status_code))
elif rsp.status_code != 200:
print("Could not get launcher version; error: {}".format(content))
else:
content = json.loads(content)
version = content["data"]["Version"]
if version != LAUNCHER_VERSION:
LAUNCHER_VERSION = version
print("Got current launcher version: {}".format(version))
# Check the current game version and update if necessary
def check_game_version():
global LAUNCHER_ENDPOINT, LAUNCHER_VERSION, GAME_VERSION
url = "{}/launcher/GetPatchList?launcherVersion={}&branch=live".format(
LAUNCHER_ENDPOINT, LAUNCHER_VERSION
)
body = {}
headers = {
'Content-Type': 'application/json',
'User-Agent': 'BSG Launcher {}'.format(LAUNCHER_VERSION)
}
content = None
rsp = requests.post(url, json=body, headers=headers)
try:
content = zlib.decompress(rsp.content).decode()
except:
pass
if not content:
print("check_game_version request failed: {}".format(rsp.status_code))
elif rsp.status_code != 200:
print("Could not get game version; error: {}".format(content))
else:
content = json.loads(content)
version = content["data"][0]["Version"]
if version != GAME_VERSION:
GAME_VERSION = version
print("Got current game version: {}".format(GAME_VERSION))