-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenu_devtest.py
More file actions
301 lines (225 loc) · 9.07 KB
/
Copy pathmenu_devtest.py
File metadata and controls
301 lines (225 loc) · 9.07 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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
from globals import *
#This document contains screens for:
# devTest
# devTestCreateDefaults
# devTestWorldMap
# devTestFiefPlacement
# devTestPlotAllFiefs
# devTestPlotAllStrongholds
# devTestGenerateWorld
# devTestAddGold
# devTestWorldMapDiagnostics
# devTestRiverTool
def DevTestMenu(screen, userStronghold):
#This is the new devtest menu with all the devtest commands sorted out and neat
#------------------------------------------------------------------------------
if screen == "devTest":
os.system("clear")
headerStripped()
print("\n")
print(' Welcome to the dev test menu. This should only be used for testing purposes.')
print('\n')
art_devBricks()
print(" Avalible Commands:")
print(' -------------------------------------------------------')
print(' {1}: Return to Stronghold')
print(' {2}: Create Default Fiefs')
print(' {3}: Generate World Map (Must do this before 4-6)')
print(' {4}: Add Fief Tool')
print(' {5}: Add all Fiefs Tool')
print(' {6}: Add all Strongholds Tool')
print(' {7}: Quick Generate World (DO NOT USE if 3-6 were used!)')
print(' {8}: Add Resources Tool (for testing!)')
print(' {9}: World Map Diagnostic (Only run after step 3 or 7)')
print(' {10}: World Map River Tool')
print(' --------------------------------------------------------')
print(' Note: To quick generate a world, just hit 7. To go step ')
print(' by step, start at 3 and proceed without using 7! ')
print('')
command = input(" Enter your command: ")
if command == '1':
currentPage = 1
return "stronghold"
if command == '2':
return 'devTestCreateDefaults'
if command == '3':
return 'devTestWorldMap'
if command == '4':
return 'devTestFiefPlacement'
if command == '5':
return 'devTestPlotAllFiefs'
if command == '6':
return 'devTestPlotAllStrongholds'
if command == '7':
return 'devTestGenerateWorld'
if command == '8':
return 'devTestAddResources'
if command == '9':
return 'devTestWorldMapDiagnostics'
if command == '10':
return 'devTestRiverTool'
if command == 't':
screen = 'testScreen1'
if command == 't2':
screen = 'testScreen2'
#This is a "secret" page that you can use to create default Fiefdoms
#to seed your installation with land that can be taken.
#
#It should be taken out if you ever open this game up to many players
#----------------------------------------------------------------------------------
if screen == "devTestCreateDefaults":
os.system("clear")
headerStripped()
print(' Seeding the world with default fiefdoms')
names = ['Razor Hills', 'Stormgrove',
'Dreadwall', 'Bellhollow', 'Howling Plains',
'Knoblands', 'Kestrel Keep', 'Direbrook',
'Greystone', 'Midgar']
for x in names:
currentFief = Fiefdom()
currentFief.name = x
currentFief.defenders = random.randint(10, 100)
currentFief.gold = random.randint(500, 3100)
currentFief.write()
time.sleep(2)
print(' Seeding Complete')
currentPage = 1
return "fiefdoms"
#This is another "secret" page that can be used to add funds for testing purposes
#
#It should be taken out if you ever open this game up to many players
#----------------------------------------------------------------------------------
if screen == "devTestAddResources":
os.system("clear")
headerStripped()
print(' Adding Resources!...')
userStronghold.gold = str(int(userStronghold.gold) + 1000000)
userStronghold.food = str(int(userStronghold.food) + 10000)
userStronghold.wood = str(int(userStronghold.wood) + 10000)
userStronghold.stone = str(int(userStronghold.stone) + 10000)
userStronghold.ore = str(int(userStronghold.ore) + 1000)
userStronghold.write()
time.sleep(0.5)
print(' ...Resources Added!')
time.sleep(0.5)
return 'stronghold'
#This is a devtool for making the world map for a server
#
#It eventually needs to be accessed in another way
#----------------------------------------------------------------------------------
if screen == "devTestWorldMap":
os.system("clear")
headerStripped()
serverMap.name = 'serverMap'
serverMap.seed = GenerateSeed()
serverMap.height = MAP_HEIGHT
serverMap.width = MAP_WIDTH
serverMap.worldMap = GenerateWorldMap(serverMap.seed)
SetBiomeCounts(serverMap)
serverMap.write()
print('\n')
PrintColorMap(serverMap.worldMap)
nothing = input('\n Continue:')
return 'devTest'
#This is currently just a test page to see if fief placement in the world map works as intended
#----------------------------------------------------------------------------------
if screen == "devTestFiefPlacement":
os.system("clear")
headerStripped()
fief = Fiefdom()
command = input(' Enter a fief name to input: ')
fileFief = 'fiefs/' + command + '.txt'
try:
with open(fileFief, 'r') as f:
fief.name = f.readline().strip()
fief.read()
except:
print (' No file found')
PlaceFiefInWorldMap(fief, serverMap)
nothing = input(' Continue:')
return 'devTest'
#This plots all fiefs on the server at once
#----------------------------------------------------------------------------------
if screen == "devTestPlotAllFiefs":
os.system("clear")
headerStripped()
PlotAllFiefs(serverMap)
nothing = input(' Continue:')
return 'devTest'
#This plots all strongholds on the server at once
#----------------------------------------------------------------------------------
if screen == "devTestPlotAllStrongholds":
os.system("clear")
headerStripped()
PlotAllStrongholds(serverMap)
nothing = input(' Continue:')
return 'devTest'
#This impelments all the map related functions in one go
#----------------------------------------------------------------------------------
if screen == "devTestGenerateWorld":
os.system("clear")
headerStripped()
serverMap.name = 'serverMap'
serverMap.seed = GenerateSeed()
serverMap.height = MAP_HEIGHT
serverMap.width = MAP_WIDTH
serverMap.worldMap = SilentlyGenerateWorldMap(serverMap.seed)
SetBiomeCounts(serverMap)
serverMap.write()
os.system("clear")
PlotAllFiefs(serverMap)
os.system("clear")
PlotAllStrongholds(serverMap)
os.system("clear")
print(' World Generation Complete!')
print('')
PrintColorMap(serverMap.worldMap)
nothing = input(' Continue:')
return 'devTest'
#This impelments all the map related functions in one go
#----------------------------------------------------------------------------------
if screen == "devTestWorldMapDiagnostics":
os.system("clear")
headerStripped()
serverMap.selfDiagnostic()
# print('\n')
# PrintLegend()
print('\n')
PrintColorMap(serverMap.worldMap)
nothing = input(' Continue:')
return 'devTest'
#This allows you to add rivers to a map
#-----------------------------------------------------------------------------------
if screen == "devTestRiverTool":
os.system("clear")
headerStripped()
serverMap.read()
GenerateRivers(serverMap)
nothing = input(' Continue:')
return 'devTest'
#This is a test screen for quickly testing out formatting and the like.
#-----------------------------------------------------------------------------------
if screen == "testScreen1":
os.system("clear")
headerStripped()
pas_c1_1()
pas_c1_2()
# serverArmies.AddBattalion("Crimson Somethings", "y", "200", "1", "1", "1", "200", "5", "5")
# serverArmies.AddBattalion("Cool Dudes", "y", "105", "1", "1", "1", "120", "6", "6")
# serverArmies.AddBattalion("Neato Banditos", "y", "160", "1", "1", "1", "120", "7", "7")
# # for i in range(len(serverArmies.battalions)):
# print(*serverArmies.GetBattalions())
# serverArmies.write()
# serverArmies.read()
nothing = input(' Continue:')
return 'devTest'
if screen == "testScreen2":
os.system("clear")
headerStripped()
print("Attempting to read!")
serverMarket.read()
serverMarket.ListGoods()
nothing = input(' Continue:')
return 'devTest'
return screen
#eof