forked from mascaldotfr/CoRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exploit.py
57 lines (48 loc) · 2.25 KB
/
exploit.py
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
#!/usr/bin/env python3
# Note this is a quick and dirty code for demo with no error checking and stuff
from urllib.request import urlopen
import json
# Need that to know what trees to load
class_type_masks = {
'archer':0x10, 'hunter':0x11, 'marksman':0x12,
'mage':0x20, 'conjurer':0x21, 'warlock':0x22,
'warrior':0x40, 'barbarian':0x41, 'knight':0x42
}
cached_datasets = {}
# get all shared setup data as str type
with urlopen("https://hail.thebus.top/CoRT/collect/data.txt") as response:
db = response.read().decode('utf-8').splitlines()
for setup in db:
print(setup)
shared_dataset = setup.split(" ")
shared_dataset_version = shared_dataset.pop(0)
shared_dataset_class = shared_dataset.pop(0)
shared_dataset_level = shared_dataset.pop(0)
# get trainerdata according to the version of the recorded setup and cache status
trainerdata = None
if shared_dataset_version not in cached_datasets:
with urlopen(f'https://raw.githubusercontent.com/mascaldotfr/CoRT/main/data/trainer/{shared_dataset_version}/trainerdata.json') as response:
trainerdata = json.loads(response.read())
cached_datasets[shared_dataset_version] = trainerdata
print(f"Downloading a new dataset: {shared_dataset_version}")
else:
trainerdata = cached_datasets[shared_dataset_version]
# grab the needed skill trees and infos for that record
base_trees = str(class_type_masks[shared_dataset_class] & 0xF0)
class_trees = str(class_type_masks[shared_dataset_class])
all_trees = trainerdata["class_disciplines"][base_trees]
all_trees = all_trees + trainerdata["class_disciplines"][class_trees]
print(f'Version: {shared_dataset_version}')
print(f'Class: {shared_dataset_class}')
print(f'Level: {shared_dataset_level}\n')
for tree in all_trees:
tree_level = shared_dataset.pop(0)
spell_points = list(shared_dataset.pop(0))
print(f'{tree} ({tree_level}):')
for spell in trainerdata["disciplines"][tree]["spells"]:
# WM tree has empty slots since it has half the skills
if spell["name"].startswith("undefined"):
continue
points = spell_points.pop(0)
print(f'\t{spell["name"]}: {points}')
print("\n")