Date: 2014/05/09 04:17:31 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
################################################################################
# #
# Configurations #
# #
# These are the default configurations. They will be used to build the user #
# level config files on first run. Each parent node defines the file type and #
# the child nodes that follow are the configurations for that config file type.#
# #
#______________________________________________________________________________#
# #
#__________DO_NOT_EDIT_THIS_FILE___EVERYTHING_IS_CONFIGURABLE_IN_GAME__________#
# #
#______________________________________________________________________________#
'WGRegionMarketConfigurations':
type: task
debug: false
# Where you save this script file
scriptPath: 'scripts/Network/Utilities/WGRegionInfo.yml'
# ------ The main config file ------ #
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
# ------
# ------ The limits config file ------ #
limits:
global:
rent: -1
lease: -1
buy: -1
sell: -1
worlds:
world:
rent: -1
lease: -1
buy: -1
sell: -1
groups:
default:
global:
rent: -1
lease: -1
buy: -1
sell: -1
worlds:
world:
rent: -1
lease: -1
buy: -1
sell: -1
# ------
################################################################################
#
# WorldGuard Region Market Config Helper
#
#
# This script tells the s@ConfigFileGenerator which files to generate based on
# the configs above.
#
"WGRegionMarketConfigHelper":
type: task
debug: true
script:
- ^define scriptPath '<s@WGRegionMarketConfigurations.constant[scriptPath]>'
- ^define readID 'WGRegionMarket'
- ^yaml 'load:<def[scriptPath]>' 'id:%readID%'
- ^define keylist '<yaml[%readID%].list_keys[WGRegionMarketConfigurations].exclude[type|debug|scriptPath]>'
- foreach <def[keylist]> {
- define node <def[value]>
- if !<server.has_file[Plots/%node%.yml]> {
- narrate "<&a>Generating default %node%.yml file..."
- define path 'WGRegionMarketConfigurations.%node%'
- define writeID 'WGRegionMarket_%node%'
- yaml create 'id:%writeID%'
- inject s@ConfigFileGenerator
- narrate "<&b>Done!"
- yaml savefile:Plots/%node%.yml 'id:%writeID%'
- yaml unload 'id:%writeID%'
}
else narrate "<&a>%node%.yml already exists!"
}
- narrate "<&6>Done!"
- yaml unload 'id:%readID%'
################################################################################
#
# Configuration File Generator
#
#
# This script generates default config files based on the definitions passed to
# it. It should be flexible enough to handle any script.
#
# - run s@ConfigFileGenerator def:%readID%|%writeID%|%path%
#
'ConfigFileGenerator':
type: task
debug: true
definitions: readID|writeID|path
script:
- ^define keylist '<yaml[%readID%].list_keys[%path%]>'
- if <def[dryrun]> {
- narrate "<&a>keylist<&co> <&b>%keylist%"
}
- ^if <def[keylist].is[==].to[null]> {
- define entry '<yaml[%readID%].read[%path%].as_list>'
- if <def[dryrun]> {
- narrate "<&a>entry<&co> <&b>%entry%"
}
- if !<def[entry].is_empty> {
- foreach <def[entry]> {
- if <def[dryrun]> {
- narrate "<&a>%path%.%entry%<&co> <&b>%value%"
}
else yaml set '%path%.%entry%':->:<def[value]> 'id:%writeID%'
}
}
else {
- define entry '<yaml[%readID%].read[%path%]>'
- if <def[dryrun]> {
- narrate "<&a>%path%.%entry%<&co> <&c>EMPTY"
}
else yaml 'write:%path%.%entry%' 'id:%writeID%'
}
}
else {
- foreach <def[keylist]> {
- define key '<def[value]>'
- define path '%path%.%key%'
- inject s@ConfigFileGenerator
}
}
#
################################################################################
"WGRegionMarketCommandHandler":
type: world
debug: false
events:
on wgrminit command:
- define dryrun true
- inject s@WGRegionMarketConfigHelper
- inject s@FinishCommand