-
Notifications
You must be signed in to change notification settings - Fork 37
/
get_player_info.py
30 lines (28 loc) · 995 Bytes
/
get_player_info.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
from sessions import session, neighbor_session, neighbors
from engine import timestamp_now
def get_player_info(USERID):
# Update last logged in
ts_now = timestamp_now()
session(USERID)["playerInfo"]["last_logged_in"] = ts_now
# player
player_info = {
"result": "ok",
"processed_errors": 0,
"timestamp": ts_now,
"playerInfo": session(USERID)["playerInfo"],
"map": session(USERID)["maps"][0],
"privateState": session(USERID)["privateState"],
"neighbors": neighbors(USERID)
}
return player_info
def get_neighbor_info(userid, map_number):
neighbor_info = {
"result": "ok",
"processed_errors": 0,
"timestamp": timestamp_now(),
"playerInfo": neighbor_session(userid)["playerInfo"],
"map": neighbor_session(userid)["maps"][map_number],
"privateState": neighbor_session(userid)["privateState"],
"neighbors": neighbors(userid)
}
return neighbor_info