-
Notifications
You must be signed in to change notification settings - Fork 1
/
constants.py
719 lines (689 loc) · 23.8 KB
/
constants.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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
# Lemonade stand is Licensed under the Don't Be A Dick License
# (dbad-license). This license is an extension of the Apache License.
#
# If you do not wish to comply with the restrictions of the Don't Be A Dick
# License, this software is also available under the terms of the
# GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# The text of the Don't Be A Dick License is available at at
# <http://dbad-license.org/license>, while the GNU General Public License
# is available at <http://www.gnu.org/licenses/>.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # under the License.
#
# Authors:
# Justin Lewis <[email protected]>
# Nathaniel Case <[email protected]>
import gettext
class constants:
def __init__(self, language):
lang = gettext.translation(
'org.laptop.Lemonade',
'locale/',
languages=[language])
self._ = lang.ugettext
self.starting_money = [1500, 1250, 1000, 750]
self.starting_price = 150
self.max_msg = 18
# Dictionary of lists of the amount of starting items
# the player is given depending on difficulty
self.starting_items = {
'lemonade': {
'cup': [12, 10, 5, 0],
'lemon': [18, 15, 5, 0],
'sugar': [20, 10, 5, 0],
#'strawberry': [0, 0, 0, 0],
#'icecube': [0, 0, 0, 0]
},
'ice cream': {
'cone': [12, 10, 5, 0],
'ice cream': [18, 15, 2, 0],
'sprinkles': [20, 10, 5, 0]
},
'noodle soup': {
'bowl': [12, 10, 5, 0],
'egg': [18, 15, 2, 0],
'veggie': [20, 10, 5, 0]
}
}
self.rep_values = {
'gain': [4, 3, 2, 1],
'lose': [1, 1, 2, 2]
}
self.challenge_mode = {
}
self.upgrades = {
'lemonade': [
{
'name': self._('Cooler'),
'cost': 25,
'capacity': 20,
'level': 1,
'saves': 'lemon',
'info':
[
[
self._("Stores lemons."),
self._("Helps prevent lemons"),
self._("from decaying.")
],
[
self._("Stores more lemons."),
self._("Helps prevent animals"),
self._("from stealing.")
],
[
self._("Stores more lemons.")
]
]
},
{
'name': self._('Sugar Jar'),
'cost': 35,
'capacity': 20,
'level': 1,
'saves': 'sugar',
'info':
[
[
self._("Stores sugar."),
self._("Helps prevent ants"),
self._("from stealing sugar.")
],
[
self._("Stores more sugar."),
self._("Helps prevent sugar"),
self._("from getting wet.")
],
[
self._("Stores more sugar.")
]
]
},
{
'name': self._('Cup Container'),
'cost': 15,
'capacity': 20,
'level': 1,
'saves': 'cup',
'info':
[
[
self._("Stores cups."),
self._("Helps prevent wind"),
self._("from blowing cups.")
],
[
self._("Stores more cups."),
self._("Helps prevent cups"),
self._("from breaking.")
],
[
self._("Stores more cups.")
]
]
}
],
'ice cream': [
{
'name': self._('Cooler'),
'cost': 2000,
'prevents_losing': 'ice cream',
'capacity': 20,
'level': 1,
'saves': 'ice cream',
'info':
[
[
self._("Stores ice cream."),
self._("Helps prevent ice"),
self._("cream from melting")
],
[
self._("Stores more ice cream.")
]
]
},
{
'name': self._('Sprinkle Jar'),
'cost': 1500,
'capacity': 20,
'level': 1,
'saves': 'sprinkles',
'info':
[
[
self._("Stores sprinkles,"),
self._("Helps prevent sprinkles"),
self._("from being stolen.")
],
[
self._("Stores more sprinkles")
]
]
}
],
'noodle soup': [
{
'name': self._('Cooler'),
'cost': 2000,
'capacity': 20,
'level': 1,
'saves': 'egg',
'info':
[
[
self._("Stores eggs."),
self._("Helps prevent eggs"),
self._("from going bad.")
],
[
self._("Stores more eggs.")
]
]
},
{
'name': self._('Veggie Jar'),
'cost': 1500,
'capacity': 20,
'level': 1,
'saves': 'veggie',
'info':
[
[
self._("Stores veggies,"),
self._("Helps prevent veggies"),
self._("from being stolen.")
],
[
self._("Stores more veggies")
]
]
}
]
}
self.serving_item = {
'lemonade': self._('cup'),
'noodle soup': self._('bowl'),
'ice cream': self._('cone')
}
self.items = {
'lemonade': {
'cup': {
'name': self._('Cup'),
'cost': [5, 10, 15, 30],
'decay': 0,
'bulk': 1,
'min': 1
},
'lemon': {
'name': self._('Lemon'),
'cost': [15, 35, 55, 105],
'decay': 5,
'bulk': 1
},
'sugar': {
'name': self._('Sugar'),
'cost': [2, 5, 8, 15],
'decay': 0,
'bulk': 1
#},
#'strawberry': {
# 'name': self._('Strawberry'),
# 'cost': [25, 50, 75, 150],
# 'decay': 3,
# 'bulk': 1
#},
#'icecube': {
# 'name': self._('Ice Cube'),
# 'cost': [1, 2, 5, 10],
# 'decay': 0,
# 'bulk': 1
}
},
'ice cream': {
'cone': {
'name': self._('Cone'),
'cost': [5, 10, 15, 30],
'decay': 0,
'bulk': 1,
'min': 1
},
'ice cream': {
'name': self._('Ice cream'),
'cost': [15, 35, 55, 105],
'decay': 5,
'bulk': 1
},
'sprinkles': {
'name': self._('Sprinkle'),
'cost': [2, 5, 8, 15],
'decay': 0,
'bulk': 1
}
},
'noodle soup': {
'bowl': {
'name': self._('Bowl'),
'cost': [5, 10, 15, 30],
'decay': 0,
'bulk': 1
},
'egg': {
'name': self._('Egg'),
'cost': [15, 35, 55, 105],
'decay': 5,
'bulk': 1
},
'veggie': {
'name': self._('Veggie'),
'cost': [2, 5, 8, 15],
'decay': 0,
'bulk': 1
}
}
}
self.weather = [self._("cloudy"), self._("nice"), self._("hot")]
self.weather_name = ["cloudy", "nice", "hot"]
self.bad_odds = [5, 12, 38, 45]
self.good_odds = [45, 38, 12, 5]
# Need to be in ascending order
self.event_keys = ['10', '30', '60', '100']
self.bad_event_dict = {
'10': {
'lemonade': [
{
'text': self._("A small animal takes some lemons!"),
'item': 'lemon',
'change': -2,
'level': 2
},
{
'text': self._(
"A strong wind blows away some of your cups!"),
'item': 'cup',
'change': -2,
'level': 1
},
{
'text': self._("Ants steal some of your supplies!"),
'item': 'sugar',
'change': -2,
'level': 1
}
#{
# 'text': self._("Your strawberries are infested!"),
# 'item': 'strawberry',
# 'change': -2
#},
#{
# 'text': self._("Your ice melts!"),
# 'item': 'icecube',
# 'change': -2
#}
]},
'30': {
'lemonade': [
{
'text': self._(
"Your friend has eaten some of your lemons!"),
'item': 'lemon',
'change': 10,
'level': 0
},
{
'text': self._("A batch of cups have cracked!"),
'item': 'cup',
'change': 10,
'level': 2
},
{
'text': self._("You sneeze and blow away some sugar!"),
'item': 'sugar',
'change': 10,
'level': 1
}
#{
# 'text': self._("A bird takes your strawberries!"),
# 'item': 'strawberry',
# 'change': 10
#},
#{
# 'text': self._("Your ice is contaminated!"),
# 'item': 'icecube',
# 'change': 10
#}
]},
'60': {
'lemonade': [
{
'text': self._("You sat on some of your lemons!"),
'item': 'lemon',
'change': 5,
'level': 0
},
{
'text': self._("You stepped on some cups!"),
'item': 'cup',
'change': 5,
'level': 2
},
{
'text': self._("Your sugar gets wet and ruined!"),
'item': 'sugar',
'change': 5,
'level': 2
}
#{
# 'text': self._("Your strawberries got trampled!"),
# 'item': 'strawberry',
# 'change': 5
#},
#{
# 'text': self._("Your friend eats some of your ice!"),
# 'item': 'icecube',
# 'change': 5
#}
]},
'100': {
'lemonade': [
{
'text': self._(
"Some of your lemons are Lemonzilla eggs!"),
'item': 'lemon',
'change': 2,
'level': 0
},
{
'text': self._("You mother takes some of your cups!"),
'item': 'cup',
'change': 2,
'level': 0
},
{
'text': self._("You used too much sugar in one cup!"),
'item': 'sugar',
'change': 2,
'level': 0
}
#{
# 'text': self._(
# "Your friend eats some of your strawberries!"),
# 'item': 'strawberry',
# 'change': 2
#},
#{
# 'text': self._("Some ice cubes dissapeared!"),
# 'item': 'icecube',
# 'change': 2
#}
]}
}
self.good_event_dict = {
'10': {
'lemonade': [
{
'text': self._("You find a baby Lemonzilla!"),
'item': 'lemon',
'change': -5
},
{
'text': self._(
"You rub a cup and your"
"wish for cups is granted!"),
'item': 'cup',
'change': -5
},
{
'text': self._(
"A sugar farm would"
"like to invest in your stand!"),
'item': 'sugar',
'change': -5
}
#{
# 'text': self._("A happy customer give you a gift!"),
# 'item': 'strawberry',
# 'change': -5
#},
#{
# 'text': self._("It begins to hail!"),
# 'item': 'icecube',
# 'change': -5
#}
]},
'30': {
'lemonade': [
{
'text': self._(
"A lemon truck crashes in front of your stand!"),
'item': 'lemon',
'change': 100
},
{
'text': self._("It starts raining cups!"),
'item': 'cup',
'change': 100
},
{
'text': self._(
"You find a bag of sugar on the sidewalk!"),
'item': 'sugar',
'change': 100
}
#{
# 'text': self._("You find a strawberry bush!"),
# 'item': 'strawberry',
# 'change': 100
#},
#{
# 'text': self._("A restaurant wants to support you!"),
# 'item': 'icecube',
# 'change': 100
#}
]},
'60': {
'lemonade': [
{
'text': self._("Your parents give you some lemons!"),
'item': 'lemon',
'change': 10
},
{
'text': self._(
"A friendly neighbor gives you some cups!"),
'item': 'cup',
'change': 10
},
{
'text': self._(
"A sugar salesman gives you some free samples!"),
'item': 'sugar',
'change': 10
}
#{
# 'text': self._(
# "Your friend brings you a gift to make up!"),
# 'item': 'strawberry',
# 'change': 10
#},
#{
# 'text': self._(
# "You break your icecubes into smaller pieces!"),
# 'item': 'icecube',
# 'change': 10
#}
]},
'100': {
'lemonade': [
{
'text': self._("You find extra lemons in your bag!"),
'item': 'lemon',
'change': 5
},
{
'text': self._(
"Something hits you in the back of the head!"),
'item': 'cup',
'change': 5
},
{
'text': self._(
"Some customers didn't notice"
"you forgot the sugar!"),
'item': 'sugar',
'change': 5
}
#{
# 'text': self._("Free give away at the farm!"),
# 'item': 'strawberry',
# 'change': 5
#},
#{
# 'text': self._("A upset customer throws ice at you!"),
# 'item': 'icecube',
# 'change': 5
#}
]}
}
self.locations = {
'neighborhood': {
'base': 3,
'multiple': 2,
'cap': 50
}
}
self.scale = [.2, .4, .6, .8]
#List of languages
self.language = [
"English",
"Espanol"
]
# List of difficulty types
self.difficulty = [
self._("Easy"),
self._("Normal"),
self._("Hard"),
self._("Impossible")
]
# List of menu items
self.menu = [
self._("Play"),
self._("Challenge"),
self._("Tutorial")
]
# TODO: How to Localize data structures
self.currency = {
self._('Dollars'): 100,
self._('Quarters'): 25,
self._('Dimes'): 10,
self._('Nickels'): 5,
self._('Pennies'): 1
}
self.recipes = {
'lemonade': {
'basic': {
'name': self._("basic"),
'cup': 1,
'lemon': 2,
'sugar': 3,
'cost': [100, 175, 250, 350]
},
'iced': {
'name': self._("iced"),
'cup': 1,
'lemon': 2,
'sugar': 3,
'icecube': 3,
'cost': [100, 200, 275, 390]
},
'icedjuce': {
'name': self._("iced juice"),
'cup': 1,
'strawberry': 2,
'sugar': 3,
'icecube': 3,
'cost': [130, 240, 340, 506]
},
'juice': {
'name': self._("juice"),
'cup': 1,
'strawberry': 2,
'sugar': 3,
'cost': [120, 230, 315, 470]
},
'strawberry': {
'name': self._("strawberry"),
'cup': 1,
'lemon': 2,
'sugar': 3,
'strawberry': 2,
'cost': [180, 350, 490, 731]
},
'icedstrawberry': {
'name': self._("iced strawberry"),
'cup': 1,
'lemon': 2,
'strawberry': 2,
'sugar': 3,
'icecube': 3,
'cost': [210, 365, 500, 820]
},
'epic': {
'name': self._("epic"),
'cup': 2,
'lemon': 3,
'sugar': 5,
'cost': [130, 275, 400, 550]
},
'custom': {
'name': self._("custom"),
'cost': [0, 0, 0, 0]
}
},
'ice cream': {
'basic': {
'name': self._("basic"),
'cone': 1,
'ice cream': 2,
'sprinkles': 3,
'cost': [100, 175, 250, 350]
},
'epic': {
'name': self._("epic"),
'cone': 2,
'ice cream': 3,
'sprinkles': 5,
'cost': [130, 275, 400, 550]
},
'custom': {
'name': self._("custom"),
'cost': [0, 0, 0, 0]
}
},
'noodle soup': {
'basic': {
'name': self._("basic"),
'bowl': 1,
'egg': 2,
'veggie': 3,
'cost': [100, 175, 250, 350]
}
}
}
import locale
locale.setlocale(locale.LC_ALL, '')
CURRENCY = {
'Dollars': 100,
'Quarters': 25,
'Dimes': 10,
'Nickels': 5,
'Pennies': 1
}
def format_money(value):
return locale.currency(value / 100.0, grouping=True)