-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
94 lines (75 loc) · 2.37 KB
/
main.py
File metadata and controls
94 lines (75 loc) · 2.37 KB
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
86
87
88
89
90
91
92
93
94
import os
os.system('cls')
from utils import *
from information.pages import pages
from information.classes import classes
from information.spells import spells
from information.features import features
characterFileName = None
def Start():
global characterFileName
characters = {}
os.system('cls')
index = 1
for filename in os.listdir('characters'):
f = os.path.join('characters', filename)
# checking if it is a file and is json
if os.path.isfile(f) and f.lower().endswith(('.json')):
characters[index] = getData(str(index))
index += 1
for _index in characters:
data = characters[_index]
string = f"{color.BOLD}[{color.RED}{str(_index)}{color.END}] - {data['name']}{color.END}"
print(string)
print(f"{color.BOLD}[{color.RED}{str(index)}{color.END}] - Make a new character{color.END}")
selectedCharacter = input(f"Character [{color.RED}#{color.END}] - ")
try:
if characters.get(int(selectedCharacter)):
data = characters[int(selectedCharacter)]
elif int(selectedCharacter) == index:
data = "new"
else:
Start()
return
except:
Start()
return
if data == "new":
print("insert character creator here")
else:
characterFileName = selectedCharacter
Header()
selectedPage = 1
def Header():
global selectedPage
os.system('cls')
charNum = 2 # Set this to how many EXTRA - you want.
for page in pages:
pageInfo = pages[page]
if page == selectedPage:
string = f"{color.BOLD}[{color.RED}{str(page)}{color.END}] - {color.RED}{pageInfo['Name']}{color.END}{color.END} "
else:
string = f"[{str(page)}] - {pageInfo["Name"]} "
charNum += len('['+str(page)+'] - '+pageInfo["Name"])
print(string, end=' ')
print("")
for _ in range(charNum):
print("-",end='')
print("")
args = {
"overview": {
1: characterFileName
}
}
pages[selectedPage]["Func"](args)
# Test code to test if basic code worked or not!
#print("")
#newPage = input("Page #: ")
#
#try:
# pages[int(newPage)] # checking if its valid lol
# selectedPage = int(newPage)
#except:
# selectedPage = selectedPage
#initNewPage()
Start()