-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsaveloader.py
52 lines (47 loc) · 1.48 KB
/
saveloader.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
import csv
import os
import re
editedLine = 0
def detectSave():
savefileexists = os.path.exists("./save.pcsf")
if savefileexists == True:
print('Save file detected.')
else:
print('Save file not found. Would you like to create one? (Y/N)')
saveDataCreation = input("> ")
if saveDataCreation == "Y" or saveDataCreation == "y":
f = open('save.pcsf', 'a')
f.write("Progressbar 95,1")
f.close()
else:
print('Aborting.')
exit()
def loadSystemSave(systemname):
with open('save.pcsf') as f:
csv_reader = csv.reader(f, delimiter=',')
for line in csv_reader:
if line[0] == systemname:
systemleve = line[1]
systemlevel = int(systemleve)
return systemlevel
return False
def editSystemSave(system, level):
global editedLine
editedLine = 0
level2 = str(level)
with open('save.pcsf') as f:
csv_reader = csv.reader(f, delimiter=',')
for line in csv_reader:
if line[0] == system:
break
editedLine = editedLine + 1
f = open('save.pcsf', 'r')
filesaver = f.readlines()
filesaver[editedLine] = system+","+level2+"\n"
x = open("save.pcsf", "w")
x.writelines(filesaver)
x.close()
def addSystemSave(system):
x = open("save.pcsf", "a")
x.writelines(system+",1\n")
x.close()