Date: 2016/10/25 08:14:50 UTC-07:00
Type: Denizen Script
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
## Add features:
# Highest Combo
# Highest Online-Time
# Highest Streak
# Highest Bounty
#
PlayerData_Data:
type: yaml data
config:
save_path: "data/players/"
flags_to_convert:
Kit_Quest_Type1: servers.kitpvp.quests.type.1
Kit_Quest_Type2: servers.kitpvp.quests.type.2
Kit_Quest_Type3: servers.kitpvp.quests.type.3
Kit_Quest_Goal1: servers.kitpvp.quests.goal.1
Kit_Quest_Goal2: servers.kitpvp.quests.goal.2
Kit_Quest_Goal3: servers.kitpvp.quests.goal.3
Kit_Quest_Level: servers.kitpvp.quests.level
KitSystem_Status_AutoKit: servers.kitpvp.config.kit.autokit
KitSystem_Status_AutoArmor: servers.kitpvp.config.kit.autoarmor
KitSystem_sort_config: servers.kitpvp.config.kit.order
kitpvp_kills: servers.kitpvp.stats.kills
kitpvp_death: servers.kitpvp.stats.deaths
kitpvp_bounty: servers.kitpvp.stats.bounty
KITPVP_ICOSA: servers.kitpvp.stats.icosa
online_total: servers.kitpvp.stats.online
Teams_Player_Group: servers.kitpvp.stats.team
# More to come...
# <proc[PD_Proc].context[servers.kitpvp.stats.team|read]>
# - ~run PD_Set instantly player:<player> context:servers.kitpvp.quests.goal.<def[check]>|!
PlayerData_Events:
type: world
debug: false
events:
on shutdown:
- foreach <server.list_online_players> {
- yaml id:<def[value].uuid> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><def[value].uuid>.yml"
- yaml unload id:<def[value].uuid>
}
on player join:
- inject PlayerData_Load
on player quit:
- wait 10t
- if <yaml.list.contains[<player.uuid>]> {
- yaml id:<player.uuid> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><player.uuid>.yml"
- yaml unload id:<player.uuid>
}
# - ~run PD_Set instantly player:<player> context:servers.kitpvp.config.kit.autokit|!
PD_Set:
type: task
definitions: path|data|type
script:
- define data <def[data].as_element.replace[&linje].with[|]>
- if <def[type].exists.not||true> {
- define type set
}
- if <def[path].exists.not||true> {
- queue clear
}
- define player <player>
- if <yaml.list.contains[<def[player].uuid>].not||true> {
- yaml "load:<s@PlayerData_Data.yaml_key[config.save_path]><def[player].uuid>.yml" id:<def[player].uuid>
}
- if <def[type]> == add {
- yaml id:<def[player].uuid> set <def[path]>:->:<def[data]>
}
else if <def[type]> == remove {
- yaml id:<def[player].uuid> set <def[path]>:<-:<def[data]>
}
else if <def[type]> == plus {
- yaml id:<def[player].uuid> set <def[path]>:+:<def[data]>
}
else {
- yaml id:<def[player].uuid> set <def[path]>:<def[data]>
}
- if <def[player].is_online.not> {
- yaml id:<def[player].uuid> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><def[player].uuid>.yml"
- yaml unload id:<def[player].uuid>
}
# <proc[PD_Proc].context[servers.kitpvp.stats.deaths|read|<player>]>
# <proc[PD_Proc].context[servers.kitpvp.stats.team]>
# <proc[PD_Proc].context[servers.kitpvp.stats.team]>
PD_Proc:
type: procedure
debug: false
definitions: path|type|player
script:
- if <def[path].exists.not||true> {
- queue clear
}
# - determine <yaml[<def[player].uuid||<player.uuid>>].read[<def[path]>]||null>
- if <def[type].exists.not||true> {
- define type read
}
- if <def[player].exists.not||true> {
- define player <player>
}
- if <yaml.list.contains[<def[player].uuid||<player.uuid>>].not> {
- if <server.has_file[<s@PlayerData_Data.yaml_key[config.save_path]><def[player].uuid||<player.uuid>>.yml].not||true> {
- determine 0
}
- yaml "load:<s@PlayerData_Data.yaml_key[config.save_path]><def[player].uuid||<player.uuid>>.yml" id:<def[player].uuid||<player.uuid>>
}
- if <def[type]> == list {
- defnie outcome <yaml[<def[player].uuid||<player.uuid>>].list_keys[<def[path]>]||0>
}
else if <def[type]> == has {
- define outcome <yaml[<def[player].uuid||<player.uuid>>].contains[<def[path]>]||false>
}
else {
- define outcome <yaml[<def[player].uuid||<player.uuid>>].read[<def[path]>]||0>
}
- if <def[player].is_online.not> {
- if <yaml.list.contains[<def[player].uuid||<player.uuid>>]> {
- yaml id:<def[player].uuid||<player.uuid>> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><def[player].uuid||<player.uuid>>.yml"
- yaml unload id:<def[player].uuid||<player.uuid>>
}
}
- determine <def[outcome]>
PlayerData_Load:
type: task
debug: false
script:
- if <server.has_file[<s@PlayerData_Data.yaml_key[config.save_path]><player.uuid>.yml].not> {
- yaml create id:<player.uuid>
- define path "name"
- define text "<player.name>"
- yaml id:<player.uuid> set <def[path]>:<def[text]>
- yaml id:<player.uuid> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><player.uuid>.yml"
}
else {
- yaml "load:<s@PlayerData_Data.yaml_key[config.save_path]><player.uuid>.yml" id:<player.uuid>
}
PlayerData_Convert_All:
type: task
script:
- announce "Starting data convert..."
- wait 10t
- define size <server.list_players.size>
- foreach <server.list_players> {
- actionbar "Converting... (<def[loop_index]>/<def[size]>)" targets:<server.list_online_players>
- ~run PlayerData_Convert player:<def[value]> instantly context:<player>
}
- announce "FINISHED"
PlayerData_Convert:
type: task
definitions: converter
script:
- if <def[converter].exists.not||true> {
- define converter <player>
}
- inject PlayerData_Load
- if <player||null> == null {
- queue clear
}
- announce "<&e>Converting for... <player.name>"
- foreach <s@PlayerData_Data.list_keys[config.flags_to_convert]> {
- if <player.has_flag[<def[value]>]> {
- define path <s@PlayerData_Data.yaml_key[config.flags_to_convert.<def[value]>]>
- define text <player.flag[<def[value]>]>
- if <def[text]> == null {
- announce "<&c>Stopped for null<&co> <def[value]>"
- queue clear
}
- yaml id:<player.uuid> set <def[path]>:<def[text]>
- announce "<&a><def[path]><&co><def[text]>"
}
else {
- announce "<&c>Has no <def[value]>"
}
}
- yaml id:<player.uuid> "savefile:<s@PlayerData_Data.yaml_key[config.save_path]><player.uuid>.yml"
- if <player.is_online.not> {
- wait 1t
- yaml unload id:<player.uuid>
}