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
|
class Character:
def __init__(self):
self.water = 0.0
self.energie = 0.0
self.calcium = 0.0
self.iron = 0.0
self.magnesium = 0.0
self.phosphorus = 0.0
self.potassium = 0.0
self.sodium = 0.0
self.zinc = 0.0
self.copper = 0.0
self.vit_c = 0.0
self.thiamin = 0.0
self.riboflavin = 0.0
self.niacin = 0.0
self.panto_acid = 0.0
self.vit_b6 = 0.0
self.folate_tot = 0.0
self.vit_b12 = 0.0
self.vit_a = 0.0
self.vit_e = 0.0
self.vit_d = 0.0
self.vit_total = 0.0
self.construction = 0.0
def reset(self, gender=None):
"""
Restore some character properties to its default values.
"""
pass
def load_status(self):
fobj = open('/Users/stefanienobel/Documents/workspace/nutrinoweb/nutrinoweb/controllers/status.txt')
for line in fobj:
zuordnung = line.split("|")
self.water = zuordnung[1]
self.energie = zuordnung[2]
self.calcium = zuordnung[3]
self.iron =zuordnung[4]
self.magnesium = zuordnung[5]
self.phosphorus = zuordnung[6]
self.potassium = zuordnung[7]
self.sodium = zuordnung[8]
self.zinc = zuordnung[9]
self.copper = zuordnung[10]
self.vit_c = zuordnung[11]
self.thiamin = zuordnung[12]
self.riboflavin = zuordnung[13]
self.niacin =zuordnung[14]
self.panto_acid = zuordnung[15]
self.vit_b6 = zuordnung[16]
self.folate_tot = zuordnung[17]
self.vit_b12 = zuordnung[18]
self.vit_a = zuordnung[19]
self.vit_e = zuordnung[20]
self.vit_d = zuordnung[21]
self.vit_total = zuordnung[22]
self.construction = zuordnung[23]
fobj.close()
status = {
"water": self.water,
"energie": self.energie,
"calcium": self.calcium,
"iron" : self.iron,
"magnesium": self.magnesium,
"phosphorus": self.phosphorus,
"potassium": self.potassium,
"sodium": self.sodium,
"zinc": self.zinc,
"copper": self.copper,
"vit_c": self.vit_c,
"thiamin": self.thiamin,
"riboflavin": self.riboflavin,
"niacin": self.niacin,
"panto_acid": self.panto_acid,
"vit_b6": self.vit_b6,
"folate_tot": self.folate_tot,
"vit_b12": self.vit_b12,
"vit_a": self.vit_a,
"vit_e": self.vit_e,
"vit_d": self.vit_d,
"vit_total": self.vit_total,
"construction": self.construction
}
return status
def save_status(self, water, energie, calcium, iron, magnesium, phosphorus, potassium, sodium, zinc, copper, vit_c, thiamin, riboflavin, niacin, panto_acid, vit_b6, folate_tot, vit_b12, vit_a, vit_e, vit_d, vit_total, construction):
fobj = open('/Users/stefanienobel/Documents/workspace/nutrinoweb/nutrinoweb/controllers/status.txt', 'w')
fobj.truncate()
fobj.write('|' + water + '|' + energie + '|' + calcium + '|' + iron + '|' + magnesium + '|' + phosphorus + '|' + potassium + '|' + sodium + '|' + zinc + '|' + copper + '|' + vit_c + '|' + thiamin + '|' + riboflavin + '|' + niacin + '|' + panto_acid + '|' + vit_b6 + '|' + folate_tot + '|' + vit_b12 + '|' + vit_a + '|' + vit_e + '|' + vit_d + '|' + vit_total + '|' + construction)
fobj.close()
|