-
Notifications
You must be signed in to change notification settings - Fork 1
/
generator.py
126 lines (104 loc) · 3.1 KB
/
generator.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
import io, json, random
import json
dictd = {}
with open('db.json', "r", encoding="utf-8") as file:
jsonfile = file.read()
dictd = json.loads(jsonfile)
print("Profiles database is succefully parsed")
# print(dictd)
# for key in dictd.keys():
# values = dictd[key].split('.')
# val = random.choice(values)
# print(f'{key} : {val}')
# def randomize_bunker():
# string = ''
# area = random.choice(50, 300)
# food_water = random.choice(dictd["Еда и питье"].split('.'))
# area = random.choice(50, 300)
# need_time = random.choice(dictd["Время нахождения в убежище"].split('.'))
# key = 'Карты'
# val = random.choice(dictd[key].split('.'))
# string = string + f'{key}: {val}\n'
# # print(string)
# return string
def randomize_profile():
string = 'Вот твои хараеткристики:\n'
string += randomize_profession()
string += randomize_bio()
string += randomize_health()
string += randomize_mind()
string += randomize_hobby()
string += randomize_phobies()
string += randomize_bagage()
string += randomize_skill()
string += randomize_card()
string += randomize_card()
return string
def randomize_card():
key = 'ACTIONCARDS'
items = dictd[key]
val = random.choice(items)
string =f'Карта действия: {val}\n'
return string
def randomize_profession():
key = 'PROF'
items = dictd[key]
val = random.choice(items)
string = f'Профессия: {val}\n'
return string
def randomize_bagage():
key = 'INV'
items = dictd[key]
val = random.choice(items)
string = f'Багаж: {val}\n'
return string
def randomize_health():
key = 'HEALTH'
items = dictd[key]
val = random.choice(items)
string = f'Здоровье: {val}\n'
return string
def randomize_mind():
key = 'CHARACTER'
items = dictd[key]
val = random.choice(items)
string = f'Характер: {val}\n'
return string
def randomize_hobby():
key = 'HOBBIES'
items = dictd[key]
val = random.choice(items)
string = f'Хобби: {val}\n'
return string
def randomize_phobies():
key = 'PHOBIES'
items = dictd[key]
val = random.choice(items)
string = f'Фобия: {val}\n'
return string
def randomize_skill():
key = 'SKILLS'
items = dictd[key]
val = random.choice(items)
string = f'Умение: {val}\n'
return string
def randomize_bio():
PLAYERINFO = dictd['PLAYERINFO']
sex = random.choice(PLAYERINFO['GENDER'])
age = random.choice(PLAYERINFO['AGE'])
plod = random.choice(PLAYERINFO['SEX'])
string = f'Пол: {sex}, Возраст : {age}, Плодовитость : {plod}.\n'
return string
def randomize_apocalypse():
string = random.choice(dictd['APOCALYPSES'])
return string
def create_profiles(count):
profiles = []
for index in range(count):
profiles.append(randomize_profile())
return profiles
# test
# new = randomize_apocalypse()
# print(new + '\n')
# new = randomize_profile()
# print(new)