-
Notifications
You must be signed in to change notification settings - Fork 0
/
pp__charGen.py
222 lines (187 loc) · 7.73 KB
/
pp__charGen.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#main file, run this one
print("\n==========Program Start==========")
#checks version and fixes raw_input for python 3 makign the code run on both 2.x and 3.x
import sys
if sys.version[0]=="3": raw_input=input
#imports the command for generating random numbers
from random import randint
#sets global/common variable Lines and zeroing
debug=False
invalid=("Invalid selection please try again")
plsEn="Please enter an option:"
blank=""
print("\n==========Checking Modules==========")
#Rule and table placeholder base, sets the false value for class objects that have nto been loaded, states when the user attempts to use a module that is not loaded by name
class nomod(object):
ruleCheck=False
def n(self):
print("\nNo %s Module Loaded" % str(self.moduleName))
return
#Rule and Table Placeholders
#this needs serious fixing, charmenu needs to become more dynamic so I can get rid of a lot of these placeholders
class attributeRolls(nomod):
def __init__(self):self.moduleName="Dice Module"
def moduleCheck(self):return self.n()
def statRolls(self):return self.n()
def displayStatResults(self):return self.n()
dice=attributeRolls()
class raceRules(nomod):
def __init__(self):self.moduleName="Race Module"
race=raceRules()
#this is where a config file check that handles imports would go, IF I HAD ONE
from pp_module_diceRule import dice
#from pp_module_raceRule import race
#rule check method goes here, referenced later for checks
print("\n==========Setting up Menus==========")
def rulecheck(s):
if s.ruleCheck:
ruleCheck=True
print("%s Rules: Present and %s." % (s.moduleName, s.ruleCheck))
return
else:
print("%s Rules: Not Present and %s, please select" % (s.moduleName, s.ruleCheck))
return
#"""Rule Checks"""
#"""Referenced Immediately and as option 5 of overmenu"""
#"""checks to make sure rule has been loaded by checking 'ruleCheck' variable in each class using 'rulecheck' method created earlier in the prototype main file"""
def ruleCheckList():
rulecheck(dice)
rulecheck(race)
return blank
def charmenu(cReadout):
#debug Options
cDebug1=""
cDebug2=""
if debug:
cDebug1="+[11] Check Character Generation Modules\n"
cDebug2="+[12] Check Character Generation Modules\n"
#header
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n==========Character Generation==========\n")
#readout for char
if cReadout==999:print(invalid)
elif cReadout==1:dice.displayCurrent()
#cReadout 1 needs to be expanded to display all current character information
elif cReadout==2:return attributeMenu(0)
elif cReadout==11:ruleCheckList()
elif cReadout==12:print(dice.moduleCheck())
else:print("")
#options list, it references debug options
print("\n[1] Display Current Character Information\n%s%s[2] Attribute Managment\n[/] or [t] Main Menu\n[*] or [q] Quit Program" % (cDebug1, cDebug2))
#CharMenu input
menuSel=raw_input(plsEn)
if menuSel in("t","/"):return mainmenu(0)
elif menuSel=="1":return charmenu(1)
elif menuSel=="2":return charmenu(2)
elif menuSel in ("*", "q"):return quit()
#CharMenu Debug Options
elif menuSel=="11" and debug:return charmenu(11)
elif menuSel=="12" and debug:return charmenu(12)
#Return invalid entry
else:return charmenu(999)
#needs appearance option
#needs inventory option
#-needs to be dynamic with a setting for number of descriptors (name, weight, description etc.)
#-should use dictionary for each entry
#-entry zero should have the descriptor names like name, weight, description
def attributeMenu(attributeReadout):
#header
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n==========Attribute Menu==========\n")
#readout for dice
if attributeReadout==999:print(invalid)
elif attributeReadout==1:dice.displayStatResults()
elif attributeReadout==2:dice.statRolls()
else:print("")
#options list, it references debug options
print("\n[1] Display Current Dice Rolls Information\n[2] Roll for Attributes\n[0] or [r] Character Generation\n[/] or [t] Main Menu\n[*] or [q] Quit Program")
#attributeMenu input
menuSel=raw_input(plsEn)
if menuSel in("t","/"):return mainmenu(0)
elif menuSel=="1": return attributeMenu(1)
elif menuSel=="2":return attributeMenu(2)
elif menuSel in ("0", "r"):return charmenu(0)
elif menuSel in ("*", "q"):return quit()
#Return invalid entry
else:return attributeMenu(999)
def optionsmenu(oReadout):
"""the following line checks the global debug variable so it doesn't freak out for usign a variable not defined in the function"""
global debug
#header
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n==========Options==========\n")
#readout for options
if oReadout==999:print(invalid)
else:print("")
#debug status
if debug:print("\nDebug Options: Active\n")
else:print("\nDebug Options: Inactive\n")
#Options list
print("[1] Toggle Debug\n[/] or [t] Main Menu\n[*] or [q] Quit Program")
#menu input for options
menuSel=raw_input(plsEn)
if menuSel in("t","/"):return mainmenu(0)
elif menuSel=="1":
if debug:debug=False
else:debug=True
return optionsmenu(0)
elif menuSel in ("*", "q"):return quit()
else:return optionsmenu(999)
def utilitymenu(uReadout):
#header
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n==========Utilities==========\n")
#readout for utility
if uReadout==999:print(invalid)
else:print("")
#options list
print("\n[/] or [t] Main Menu\n[*] or [q] Quit Program")
#menu input for utility
menuSel=raw_input(plsEn)
if menuSel in("t","/"):return mainmenu(0)
elif menuSel in ("*", "q"):return quit()
else:return utilitymenu(999)
def mainmenu(mReadout):
#debug readouts
mDebug1=""
if debug:mDebug1="+[11] Check Character Generation Modules\n"
#header
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n==========Main Menu==========\n")
#readout for main
if mReadout==999:print(invalid)
elif mReadout==11:ruleCheckList()
elif mReadout==991:print("%s\n%s" % (ruleCheckList(), dice.moduleCheck()))
else:print("")
#Options list, it references debug options
print("\n[1] Character Generation\n%s[2] Options\n[3] Utilities\n[*] or [q] Quit Program" % (mDebug1))
#menu input for main
menuSel=raw_input(plsEn)
if menuSel in("t","/"):return mainmenu(0)
elif menuSel=="1":return charmenu(0)
elif menuSel=="2":return optionsmenu(0)
elif menuSel=="3":return utilitymenu(0)
#mainmenu debug inputs
elif menuSel=="11" and debug:return mainmenu(11)
elif menuSel in ("*", "q"):return quit()
#Return invalid entry
else:return mainmenu(999)
#may use this if I wish to avoid globals
#def startmenu():
#mainmenu(debug, readout)
def quit():raw_input("\nQuitting Program\nPress Enter to close the program")
mainmenu(991)
raw_input("Nothing left to run, press Enter to close the program")
"""updates 030916"""
#added Debug stuff
#condensed if statements, cleaned up the code, shifted some spacers around to reduce text
"""update 031016"""
#cleaned up a bunch of code because it seemed sloppy an unorganized to me leading me sicne I ahd a hard time reading it
"""update 031516"""
#I decided my dice rolling code was garbage and started rewriting it and may move it to the primary module when it's done
"""Condense Menu if"""
#change if and elif statements to read out as 'if/elif menuSel in ("t", "/"")' instead of 'if (menuSel=="t")or(menuSel=="/")' and 'menuSel in ("*", "q")' instead of '(menuSel=="*")or(menuSel=="q")'
#change debug if and elif statements to read more like 'if menuSel=="11" and debug' instead of having it nested in another if statement under the else statement and using '==True' becasues apparently you don't need that all the time
"""debug outline"""
#Done-main menu 1: lsit modules for character generation
#Done-Char Gen Menu 1: lsit modules for character generation
#Done-Char Gen Menu 2: Values for Dice Rolls
#UDone-tilities 1 Debug
"""importing info"""
#importing as in the following line does not work except for singular instances, just for reference
#import pp_module_diceRule