-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod.py
40 lines (37 loc) · 1.27 KB
/
mod.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
class Mod:
modID = 0000
modName = ""
modURL = ""
modGame = ""
def __init__(self, filelocation, filename):
self.filelocation = filelocation
self.filename = filename
def getModID(self):
sep = '-'
try:
unmoddedModID = self.filename.split(sep,1)[1].strip()
except:
print("This mod has no ModID")
return(0)
if unmoddedModID[0] == sep:
unmoddedModID = unmoddedModID[1:].strip()
self.modID = unmoddedModID
self.getModID
elif unmoddedModID[0].isdigit():
modID = unmoddedModID.split(sep,1)[0].strip()
print (f'ModID = {modID}')
return(modID)
else:
try:
unmoddedModID = unmoddedModID.split(sep,1)[1].strip()
if unmoddedModID[0].isdigit():
modID = unmoddedModID.split(sep,1)[0].strip()
print (f'ModID = {modID}')
return(modID)
else:
print("This ModID is broken: " + unmoddedModID)
return(0)
except Exception as e:
print(e)
print("This ModID is broken " + unmoddedModID)
return(0)