-
Notifications
You must be signed in to change notification settings - Fork 1
/
shopfunctions.py
325 lines (288 loc) · 12.9 KB
/
shopfunctions.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
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
import TextBasedAdventureFunctions
import townsquare
import shopinfo
import os
import items
import bank
import character_info
import yaml
with open('shopinfos/ragniarmorshop.yaml', 'r') as file:
ragni_armor_shop = yaml.load(file, Loader=yaml.FullLoader)
#Calling inventory from character_info
inventory = character_info.inventory
#Calling balance from character_info
balance = character_info.balance
store = ()
def armor_shop(city):
TextBasedAdventureFunctions.blank_line(1)
print ("Welcome to the " + city + " Armor shop!")
print ("How can we help you today?")
print ("""---------------------------------------------
1. Buy
2. Sell
3. Back
---------------------------------------------""")
TextBasedAdventureFunctions.blank_line(1)
if city == ("Ragni"):
input_ragni_weapon_shop = int(input("Pick an action: "))
global balance
if input_ragni_weapon_shop == 1:
store = shopinfo.ragni_armor_shop()
store.print_all_armor_ragni()
purchase = int(input("Which item catches your eye? "))
if purchase == 1:
if balance >= 10:
balance = balance - 10
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Tattered Leather Chestplate!")
TextBasedAdventureFunctions.blank_line(1)
#tatteredleatherchestplate = ragni_armor_shop.get(items)
#Not sure how to call a list from a list
inventory.append(ragniarmorshop.items)
itemname = inventory.tattered_leather_chestplate.get["name"]
print (itemname)
armor_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
elif purchase == 2:
if balance >= 2:
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Tattered Leather Helm!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
elif purchase == 3:
if balance >= 3:
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Tattered Leather Shoes!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
elif purchase == 4:
if balance >= 6:
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Tattered Leather Pants!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
elif purchase == 5:
if balance >= 8:
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Cracked Barrel Top!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
armor_shop(city)
elif purchase == 6:
armor_shop(city)
elif input_ragni_weapon_shop == 2:
print ("Do you think I'm made of money?! Get lost!")
armor_shop(city)
elif input_ragni_weapon_shop == 3:
townsquare.ragni_square()
elif city == ("Detlas"):
print ("Detlas armor shop doesn't exist yet")
elif city == ("Almuj"):
print ("Almuj armor shop doesn't exist yet")
elif city == ("Nemract"):
print ("Nemract armor shop doesn't exist yet")
elif city == ("Nesaak"):
print ("Nesaak armor shop doesn't exist yet")
elif city == ("Troms"):
print ("Troms armor shop doesn't exist yet")
elif city == ("Rymek"):
print ("Rymek armor shop doesn't exist yet")
else:
print ("Something went very wrong. Darn.")
def weapons_shop(city):
TextBasedAdventureFunctions.blank_line(1)
print ("Welcome to the " + city + " Weapon shop!")
print ("How can we help you today?")
print ("""---------------------------------------------
1. Buy
2. Sell
3. Back
---------------------------------------------""")
TextBasedAdventureFunctions.blank_line(1)
while True:
if city == ("Ragni"):
input_ragni_weapon_shop = int(input("Pick an action: "))
global balance
if input_ragni_weapon_shop == 1:
store = shopinfo.ragni_weapon_shop()
store.print_all_weapons_ragni()
purchase = int(input("Which item catches your eye? "))
if purchase == 1:
if balance >= 15:
balance = balance - 15
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Spiky Stick!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
elif purchase == 2:
if balance >= 15:
balance = balance - 15
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Sparkly Stick!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
continue
elif purchase == 3:
if balance >= 15:
balance = balance - 15
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Sharp Spoon!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
elif purchase == 4:
if balance >= 15:
balance = balance - 15
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Bendy Stick!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
weapons_shop(city)
elif purchase == 5:
weapons_shop(city)
elif input_ragni_weapon_shop == 2:
print ("Do you think I'm made of money?! Get lost!")
armor_shop(city)
elif input_ragni_weapon_shop == 3:
townsquare.ragni_square()
elif city == ("Detlas"):
print ("Detlas armor shop doesn't exist yet")
elif city == ("Almuj"):
print ("Almuj armor shop doesn't exist yet")
elif city == ("Nemract"):
print ("Nemract armor shop doesn't exist yet")
elif city == ("Nesaak"):
print ("Nesaak armor shop doesn't exist yet")
elif city == ("Troms"):
print ("Troms armor shop doesn't exist yet")
elif city == ("Rymek"):
print ("Rymek armor shop doesn't exist yet")
else:
print ("Something went very wrong. Darn.")
def potion_shop(city):
TextBasedAdventureFunctions.blank_line(1)
print ("Welcome to the " + city + " Potion shop!")
print ("How can we help you today?")
print ("""---------------------------------------------
1. Buy
2. Sell
3. Back
---------------------------------------------""")
TextBasedAdventureFunctions.blank_line(1)
while True:
if city == ("Ragni"):
input_ragni_potion_shop = int(input("Pick an action: "))
global balance
if input_ragni_potion_shop == 1:
store = shopinfo.ragni_potion_shop()
store.print_all_potions_ragni()
purchase = int(input("Which item catches your eye? "))
if purchase == 1:
if balance >= 5:
balance = balance - 5
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Healing Potion I!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
elif purchase == 2:
if balance >= 5:
balance = balance - 5
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Mana Potion I!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
continue
elif purchase == 3:
if balance >= 7:
balance = balance - 7
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Healing Potion II!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
elif purchase == 4:
if balance >= 7
balance = balance - 7
TextBasedAdventureFunctions.blank_line(1)
print ("You bought the Mana Potion II!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
else:
TextBasedAdventureFunctions.blank_line(1)
print ("You cannot afford this item!")
TextBasedAdventureFunctions.blank_line(1)
potion_shop(city)
elif purchase == 5:
potion_shop(city)
elif input_ragni_potion_shop == 2:
print ("Do you think I'm made of money?! Get lost!")
potion_shop(city)
elif input_ragni_potion_shop == 3:
townsquare.ragni_square()
elif city == ("Detlas"):
print ("Detlas potion shop doesn't exist yet")
elif city == ("Almuj"):
print ("Almuj potion shop doesn't exist yet")
elif city == ("Nemract"):
print ("Nemract potion shop doesn't exist yet")
elif city == ("Nesaak"):
print ("Nesaak potion shop doesn't exist yet")
elif city == ("Troms"):
print ("Troms potion shop doesn't exist yet")
elif city == ("Rymek"):
print ("Rymek potion shop doesn't exist yet")
else:
print ("Something went very wrong. Darn.")