Date: 2014/05/06 19:51:13 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
################################################################################
#
# Configurations
'WGRegionMarketConfigurations':
type: task
debug: true
# Each parent node is the default configurations for each config file type
config:
# Version Number DONT TOUCH
version: 0.1
# Price per block when claiming a region
BlockPrice: 0.5
# Percent of BlockPrice to refund when removing a region
Refund: 80
# Remove region from market list when occupied
RemoveFromList:
- sell
- lease
- rent
# Can players extend rent region
CanExtend: true
# Number of times a rental can be extended. -1 for infinite
MaxRentExtend: -1
# Amount of time the player can extend their rent in advance.
MaxRentExtendDuration: 30d
# Tell Player his lease renewed
ShowLeaseRenewMessage: true
# Time before rent expires to remind player
ShowRentExpireWarning: 20
# Rollback region on lease or rent termination
RollbackOnExpire:
- let
- rent
# ------
# IGNORE THIS FOR NOW
# - define keylist 'list of all keys in config'
# - foreach <def[keylist].as_list> {
# - define node
# }
# This helper script fetches default configuration values.
# <proc[WGrgConfigHelper].context[entry|node]>
#
'WGrgConfigHelper':
type: procedure
definitions: 'entry|node'
debug: true
script:
- define key <s@WGRegionMarketConfigurations.constant[%entry%.%node%]>
- if !<def[key].as_list.is_empty> {
- if <def[key].as_list.size> > 1 {
- determine 'Handle a list'
}
else determine 'Handle single value'
}
else determine 'null'
"WGrgInfoCommand":
type: world
debug: false
events:
on rginfo command:
# example: /rginfo value <player.world.name> town3 owners.players
- define type '<c.args.get[1]>'
- define world '<c.args.get[2]>'
- define regionID '<c.args.get[3]>'
- define key '<c.args.get[4]>'
- inject s@WGrgFetch
- narrate "<def[result]>"
- inject s@FinishCommand
on plotsinit command:
- inject s@WGrgConfigInit
- inject s@FinishCommand
on plotsconf command:
- inject s@WGrgConfigInit
- inject s@FinishCommand
"WGrgConfigInit":
#
#
type: task
debug: true
script:
- if !<server.has_file[Plots/config.yml]> {
- narrate "<&b>Creating Plots config.yml ..."
- inject s@WGrgConfigInit p:config
- narrate "<&b>Done!"
- yaml unload id:PlotsConfig
}
else narrate "<&a>config.yml already exists!"
- if !<server.has_file[Plots/limits.yml]> {
- narrate "<&b>Creating Plots limits.yml ..."
- inject s@WGrgConfigInit p:limits
- narrate "<&b>Done!"
- yaml unload id:PlotsLimits
}
else narrate "<&a>limits.yml already exists!"
- foreach <server.list_worlds> {
- define world <def[value].name>
- if !<server.has_file[Plots/Worlds/%world%.yml]> {
- narrate "<&b>Creating Plots Worlds/%world%.yml ..."
- inject s@WGrgConfigInit p:worlds
- narrate "<&b>Done!"
- yaml unload id:PlotsRegions_%world%
}
else narrate "<&a>%world%.yml already exists!"
}
config:
- yaml create id:PlotsConfig
- yaml write:version value:0.1 id:PlotsConfig
- yaml write:BlockPrice value:0.5 split_list id:PlotsConfig
- yaml write:Refund value:80 split_list id:PlotsConfig
- yaml write:RemoveFromList value:rent|lease|sell split_list id:PlotsConfig
- yaml write:CanExtend value:true split_list id:PlotsConfig
- yaml write:MaxRentExtend value:-1 split_list id:PlotsConfig
- yaml write:MaxRentExtendDuration value:30d split_list id:PlotsConfig
- yaml write:ShowLeaseRenewMessage value:true split_list id:PlotsConfig
- yaml write:ShowRentExpireWarning value:20m split_list id:PlotsConfig
- yaml write:RollbackOnExpire value:rent|lease split_list id:PlotsConfig
- yaml write:CanExtend value:true split_list id:PlotsConfig
- yaml savefile:Plots/config.yml id:PlotsConfig
limits:
- yaml create id:PlotsLimits
- yaml write:version value:0.1 split_list id:PlotsLimits
- yaml write:global id:PlotsLimits
- define yamlID 'PlotsLimits'
- define path 'global'
- inject s@WGrgConfigInit p:plotTypeLoop
- yaml write:worlds id:PlotsLimits
- foreach <server.list_worlds> {
- define path worlds.<def[value].name>
- inject s@WGrgConfigInit p:plotTypeLoop
}
- yaml write:groups id:PlotsLimits
- define groups 'citizen|lumberjack|miner|mason|engineer|farmer|alchemist|armorer|blacksmith|enchanter|contractor|electrician|realtor'
- foreach <def[groups].as_list> {
- define groupPath groups.<def[value]>
- define path <def[groupPath]>.global
- inject s@WGrgConfigInit p:plotTypeLoop
- foreach <server.list_worlds> {
- define path <def[groupPath]>.worlds.<def[value].name>
- inject s@WGrgConfigInit p:plotTypeLoop
}
}
- yaml savefile:Plots/limits.yml id:PlotsLimits
worlds:
- yaml create id:PlotsRegions_%world%
- yaml write:version value:0.1 id:PlotsRegions_%world%
- yaml savefile:Plots/Worlds/%world%.yml id:PlotsRegions_%world%
plotTypeLoop:
- define types 'rent|lease|buy|sell'
- foreach <def[types].as_list> {
- yaml write:%path%.%value% value:-1 split_list id:%yamlID%
}
"WGrgFetch":
#
# We can read WorldGuard files! This is just a basic test of how this all works.
#
# - define type <value || keys>
# - define world <w@world.name>
# - define regionID <someRegion>
# - define key <key in regions.yml>
# - inject s@WGrgFetch
# - narrate "do something with <def[result]>"
#
type: task
debug: false
script:
- yaml 'load:../WorldGuard/worlds/%world%/regions.yml' 'id:WorldGuardRegions_%world%'
- if <def[type].is[==].to[value]> define result <yaml[WorldGuardRegions_%world%].read[regions.%regionID%.%key%]>
else if <def[type].is[==].to[keys]> define result <yaml[WorldGuardRegions_%world%].list_keys[regions.%regionID%.%key%]>
else define result "Unknown type"
- yaml unload 'id:WorldGuardRegions_%world%'