-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat-player.sk
More file actions
109 lines (77 loc) · 3.37 KB
/
stat-player.sk
File metadata and controls
109 lines (77 loc) · 3.37 KB
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
#플레이어를 접속한 플레이어 목록에 추가합니다.
function rpp_addPlayerToPlayerList(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
set {%{_id}%.PlayerList::%{_uuid}%} to {_p}
#서버에 한번이라도 접속한 플레이어의 목록을 반환합니다.
function rpp_GetPlayerList() :: offlineplayers:
set {_id} to rpp_GetID_U()
return {%{_id}%.PlayerList::*}
#서버에 한번이라도 접속한 플레이어의 UUID 목록을 반환합니다.
function rpp_GetUUIDList() :: strings:
set {_id} to rpp_GetID_U()
loop {%{_id}%.PlayerList::*}:
add loop-index to {_uuid::*}
return {_uuid::*}
#플레이어가 서버에 최초 접속한 시간을 저장합니다.
function rpp_SetFirstJoin(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
set {%{_id}%.FirstJoin::%{_uuid}%} to now
#플레이어가 서버에 최초 접속한 시간을 반환합니다.
function rpp_GetFirstJoin(p:offlineplayer) :: date:
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
return {%{_id}%.FirstJoin::%{_uuid}%}
#플레이어의 최근 접속 시간을 저장합니다.
function rpp_SetLastJoin(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
set {%{_id}%.LastJoin::%{_uuid}%} to now #플레이어의 최근 접속 시간을 저장합니다.
#플레이어의 최근 접속 시간을 반환합니다.
function rpp_GetLastJoin(p:offlineplayer) :: date:
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
return {%{_id}%.LastJoin::%{_uuid}%} # 플레이어의 최근 접속 시간을 반환합니다.
#플레이어의 퇴장 시간을 저장합니다.
function rpp_SetQuit(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
set {%{_id}%.Quit::%{_uuid}%} to now
#플레이어의 퇴장 시간을 반환합니다.
function rpp_GetQuit(p:offlineplayer) :: date:
if {_p} is online: # 플레이어가 접속중이라면 현재 시간을 반환합니다.
return now
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
return {%{_id}%.Quit::%{_uuid}%} # 플레이어의 퇴장 시간을 반환합니다.
#플레이어의 플레이타임을 저장합니다.
function rpp_SetPlayTime(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
set {_join} to rpp_GetLastJoin({_p})
set {_diff} to difference between {_join} and now
add {_diff} to {%{_id}%.PlayTime::%{_uuid}%}
#플레이어의 플레이타임을 반환합니다.
function rpp_GetPlayTime(p:offlineplayer) :: timespan:
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
if {_p} is online: # 플레이어가 접속중이라면 현재 시간까지의 플레이타임을 반환
set {_join} to rpp_GetLastJoin({_p})
set {_diff} to difference between {_join} and now
set {_time} to {%{_id}%.PlayTime::%{_uuid}%}
add {_diff} to {_time}
return {_time}
return {%{_id}%.PlayTime::%{_uuid}%} # 플레이어가 오프라인이라면 설정된 플레이타임을 반환
#플레이어의 접속 기록이 존재하는지 조회합니다.
function rpp_IsPlayed(p:offlineplayer) :: boolean:
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
if {%{_id}%.FirstJoin::%{_uuid}%} is set:
return true
return false
#최초 접속 기록 삭제 // 디버그
function rpp_RemoveFirstJoin(p:offlineplayer):
set {_id} to rpp_GetID_U()
set {_uuid} to uuid of {_p}
delete {%{_id}%.FirstJoin::%{_uuid}%}