-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomize.py
executable file
·85 lines (82 loc) · 4.61 KB
/
randomize.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env python3
from argparse import ArgumentParser
from os import remove, scandir, symlink
from os.path import islink
from random import choice
# argument parsing
parser = ArgumentParser(description='randomize your beta slot tracks in MX vs. ATV Reflex')
# required
parser.add_argument('database_dir', nargs='+',
help='the full path to your MX vs. ATV Reflex database folder')
parser.add_argument('sorted_dir', nargs='+',
help='the full path to your sorted Reflex Central archive')
args = parser.parse_args()
database_dir = args.database_dir[0].rstrip('/') + '/'
sorted_dir = args.sorted_dir[0].rstrip('/') + '/'
for i in range(1, 9):
# national
options = [f.path for f in scandir(sorted_dir + 'National/' + str(i)) if f.is_dir()]
try:
track = choice(options)
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database"):
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level"):
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package"):
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene"):
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.database",
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.level",
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.package",
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.scene",
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
except IndexError:
pass
# supercross
options = [f.path for f in scandir(sorted_dir + 'Supercross/' + str(i)) if f.is_dir()]
try:
track = choice(options)
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database"):
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level"):
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package"):
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene"):
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.database",
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.level",
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.package",
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.scene",
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
except IndexError:
pass
# free ride
options = [f.path for f in scandir(sorted_dir + 'Free Ride/' + str(i)) if f.is_dir()]
try:
track = choice(options)
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database"):
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level"):
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package"):
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene"):
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.database",
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.level",
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.package",
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.scene",
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
except IndexError:
pass