-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServerInstance.py
50 lines (32 loc) · 1.11 KB
/
ServerInstance.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
from datetime import datetime
from Shops.GeneralStore import GeneralStore
from Characters.Human import Human
from Cities.NewbieWorld import NewbieWorld
class ServerInstance():
date_started = 0
server_cities = list()
server_characters = list()
quests_started = list()
def __init__(self):
self.server_cities = list([NewbieWorld(), NewbieWorld(), NewbieWorld()])
self.date_started = datetime.utcnow()
self.quests_started = list()
def add_character(self, character):
self.server_characters.append(character)
return True
def list_server_cities(self, json=False):
city_list = list()
for city in self.server_cities:
if json:
city_list.append(city.to_JSON())
else:
city_list.append(city)
return city_list
def list_server_characters(self, json=False):
char_list = list()
for char in self.server_characters:
if json:
char_list.append(char.to_JSON())
else:
char_list.append(char)
return char_list