-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletemods.py
39 lines (35 loc) · 1.24 KB
/
deletemods.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
# Function to delete the Mods of the day from the Users
# Missing Mods list.
def deleteMods(user):
with open("./modfiles/" + user.modfile, "r") as f:
lines = f.readlines()
with open("./modfiles/" + user.modfile, "w") as f:
for line in lines:
if line.strip("\n") in user.missingWeaponMods:
continue
elif line.strip("\n") in user.missingArmorMods:
continue
else:
f.write(line)
f.close()
# If the User mistakingly replied Yes and deleted Mods from their
# list they can Undo once
def undoDeletion(user):
with open("./modfiles/" + user.modfile, "a") as f:
for mod in user.missingWeaponMods:
f.write("\n")
f.write(mod)
for mod in user.missingArmorMods:
f.write("\n")
f.write(mod)
# Allows the user to manually delete a Mod by providing the name of it
def deleteModsManually(user, modName):
with open("./modfiles/" + user.modfile, "r") as f:
lines = f.readlines()
with open("./modfiles/" + user.modfile, "w") as f:
for line in lines:
if line.strip("\n") == modName:
continue
else:
f.write(line)
f.close()