Date: 2016/02/02 21:28:39 UTC-08: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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
########## Loot Crate script
########## Items and Inventory
RuneItem:
type: item
material: i@nether_star
display name: <&3>Transmutable Rune
lore:
- <&4> Click once only. You have been warned
Loot_Armor:
type: item
material: 311
display name: <&3>Lootable Armor
lore:
- <&3> For all your armor needs
Loot_Block:
type: item
material: 138
display name: <&3> Lootable Blocks
lore:
- <&3> For all your block needs
Loot_Tool:
type: item
material: 285
display name: <&3> Lootable Tools
lore:
- <&3> For all your tool and weapon needs
LootCrate_Inventory:
type: inventory
size: 9
title: A'therys Lootcrate
slots:
- " [] [] [i@Loot_Armor] [] [i@Loot_Block] [] [i@Loot_Tool] [] [] "
########## Loot Admin Tasks
LootLoadTask:
type: task
debug: true
script:
- flag server "Loot_Crate_Common_Weapons:!"
- flag server "Loot_Crate_Common_Weapons:|:<server.list_scripts.parse[name].filter[starts_with[LC_CW]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Common_Weapons].size> Common Weapons Loaded"
- flag server "Loot_Crate_Epic_Weapons:!"
- flag server "Loot_Crate_Epic_Weapons:|:<server.list_scripts.parse[name].filter[starts_with[LC_EW]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Epic_Weapons].size> Epic Weapons Loaded"
- flag server "Loot_Crate_Rare_Weapons:!"
- flag server "Loot_Crate_Rare_Weapons:|:<server.list_scripts.parse[name].filter[starts_with[LC_RW]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Rare_Weapons].size> Rare Weapons Loaded"
- flag server "Loot_Crate_Common_Armor:!"
- flag server "Loot_Crate_Common_Armor:|:<server.list_scripts.parse[name].filter[starts_with[LC_CA]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Common_Armor].size> Common Armor Loaded"
- flag server "Loot_Crate_Epic_Armor:!"
- flag server "Loot_Crate_Epic_Armor:|:<server.list_scripts.parse[name].filter[starts_with[LC_EA]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Epic_Armor].size> Epic Armor Loaded"
- flag server "Loot_Crate_Rare_Armor:!"
- flag server "Loot_Crate_Rare_Armor:|:<server.list_scripts.parse[name].filter[starts_with[LC_RA]].parse[as_item]>"
- narrate "<&3><server.flag[Loot_Crate_Rare_Armor].size> Rare Armor Loaded"
- yaml load:LootBlocks.yml id:LootBlocks
- narrate "<&3>Loot blocks loaded"
######## Admin Commands
Lootitem:
type: command
debug: false
name: lootitem
permission: denizen.lootcrate.admin
usage: lootitem player quantity
script:
- choose <context.args.size>:
- case 1:
- define Player <server.match_offline_player[<context.args.get[1]>]||null>
- if <def[Player]> == null {
- narrate "<&c>No player can be found by that name!"
- queue clear
}
- define Quantity 1
- case 2:
- define Player <server.match_offline_player[<context.args.get[1]>]||null>
- if <def[Player]> == null {
- narrate "<&c>No player can be found by that name!"
- queue clear
}
- define Quantity <context.args.get[2]>
- if <def[Quantity].as_int||null> != <def[Quantity]> {
- narrate "<&c>Quantity must be a whole number!"
- queue clear
}
- default:
- narrate "Usage: /lootitem <<>player<>> (quantity)"
- queue clear
- give i@RuneItem quantity:<def[Quantity]> player:<def[Player]>
- narrate "<&a>Given <def[Player].name> <def[quantity]> Transmutable runes!"
LootGet:
type: command
debug: false
name: lootget
permission: denizen.lootcrate.admin
usage: /lootget player itemname
script:
- choose <context.args.size>:
- case 0:
- narrate "You must enter a player."
- queue clear
- case 2:
- define Player <server.match_offline_player[<context.args.get[1]>]||null>
- if <def[Player]> == null {
- narrate "<&c>No player can be found by that name!"
- queue clear
}
- define Item <context.args.get[2].as_item||null>
- if <def[Item]> == null {
- narrate "<&c>Invalid item entered!"
- queue clear
}
- give <def[Item]> player:<def[Player]>
- narrate "<&a>Given <def[Player].name> a <def[Item].display>!"
LootLoad:
type: command
debug: false
name: lootload
permission: denizen.lootcrate.admin
usage: /lootload
script:
- run LootLoadTask
LootRandom:
type: command
debug: false
name: lootrand
permission: denizen.lootcrate.admin
usage: /lootrand <<>type<>>
script:
- choose <context.args.size>:
- case 1:
- choose <context.args.get[1]>:
- case cw:
- give <server.flag[Loot_Crate_Common_Weapons].as_list.random>
- case ew:
- give <server.flag[Loot_Crate_Epic_Weapons].as_list.random>
- case rw:
- give <server.flag[Loot_Crate_Rare_Weapons].as_list.random>
- case ca:
- give <server.flag[Loot_Crate_Common_Armor].as_list.random>
- case ea:
- give <server.flag[Loot_Crate_Epic_Armor].as_list.random>
- case ra:
- give <server.flag[Loot_Crate_Rare_Armor].as_list.random>
- case cb:
- define Key <yaml[LootBlocks].list_keys[Common].random>
- give <yaml[LootBlocks].read[Common.<def[Key]>.item].as_item> quantity:<yaml[LootBlocks].read[Common.<def[Key]>.quantity]>
- case rb:
- define Key <yaml[LootBlocks].list_keys[Rare].random>
- give <yaml[LootBlocks].read[Rare.<def[Key]>.item].as_item> quantity:<yaml[LootBlocks].read[Rare.<def[Key]>.quantity]>
- case eb:
- define Key <yaml[LootBlocks].list_keys[Epic].random>
- give <yaml[LootBlocks].read[Epic.<def[Key]>.item].as_item> quantity:<yaml[LootBlocks].read[Epic.<def[Key]>.quantity]>
- case lb:
- define Key <yaml[LootBlocks].list_keys[Legend].random>
- give <yaml[LootBlocks].read[Legend.<def[Key]>.item].as_item> quantity:<yaml[LootBlocks].read[Legend.<def[Key]>.quantity]>
- default:
- narrate "<&c>Invalid type specified!"
- default:
- narrate "Usage: /lootrand <<>type<>>"
########### World Events. Ironically, this is all players should ever access
RuneClick:
type: world
debug: true
events:
on player right clicks with nether_star:
- if <context.item.display_name.contains_any_text[transmutable|rune]> {
- determine passively cancelled
- inventory open d:in@LootCrate_Inventory
- take <context.item> qty:1
}
LootCrate_Inventory_Control:
type: world
debug: false
events:
on player clicks in LootCrate_Inventory:
- determine passively cancelled
- if <context.slot> <0 {
- queue clear
}
- inventory close
- define Type <context.item.scriptname.after[Loot_]>
- define Chance <util.random.int[1].to[100]>
- if <def[Type]> == Block {
- if <def[Chance]> < 5 {
- run LootRandomLegend<def[Type]> instantly
}
else if <def[Chance]> < 10 {
- run LootRandomEpic<def[Type]> instantly
}
else if <def[Chance]> < 15 {
- run LootRandomUnique<def[Type]> instantly
}
else if <def[Chance]> < 30 {
- run LootRandomRare<def[Type]> instantly
}
else {
- run LootRandomCommon<def[Type]> instantly
}
}
else if <def[Chance]> < 10 {
- run LootRandomEpic<def[Type]> instantly
}
else if <def[Chance]> < 30 {
- run LootRandomRare<def[Type]> instantly
}
else {
- run LootRandomCommon<def[Type]> instantly
}
######### Task's that deal with the Loot giving
######### Tools and such
LootRandomCommonTool:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Common_Weapons].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- actionbar " <&3> You successfully transmutated the rune and gained <<def[item]>.display>! "
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomRareTool:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Rare_Weapons].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- actionbar " <&3> You successfully transmutated the rune and gained <<def[item]>.display>! "
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomEpicTool:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Epic_Weapons].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- announce "<&3><player.name> successfully transmutated the rune and gained <<def[item]>.display>! "
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
- playeffect HAPPY_VILLAGER qty:10 <player.location.above>
######## Armor
LootRandomCommonArmor:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Common_Armor].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- actionbar " <&3> You successfully transmutated the rune and gained <<def[item]>.display>! "
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomRareArmor:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Rare_Armor].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- actionbar " <&3> You successfully transmutated the rune and gained <<def[item]>.display>! "
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomEpicArmor:
type: task
debug: true
script:
- define item <server.flag[Loot_Crate_Epic_Armor].as_list.random||null>
- if <def[item]> == null {
- queue clear
}
- give <def[item]>
- announce "<&3><player.name> successfully transmutated the rune and gained <<def[item]>.display>! "
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
- playeffect HAPPY_VILLAGER qty:10 <player.location.above>
######## Blocks
LootRandomCommonBlock:
type: task
debug: true
script:
- define bKey <yaml[LootBlocks].list_keys[Common].random||null>
- if <def[bKey]> == null {
- queue clear
}
- define item <yaml[LootBlocks].read[Common.<def[bKey]>.item]>
- define qty <yaml [LootBlocks].read[Common.<def[bKey]>.quantity>
- give <def[item]> quantity:<def[qty]>
- if <def[qty]> == 1{
- actionbar " <&3> You successfully transmutated the rune and gained <i@item.formatted>! "
}
else {
- actionbar " <&3> You successfully transmutated the rune and gained <i@item[quantity=<def[qty]>].formatted>! "
}
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomRareBlock:
type: task
debug: true
script:
- define bKey <yaml[LootBlocks].list_keys[Rare].random||null>
- if <def[bKey]> == null {
- queue clear
}
- define item <yaml[LootBlocks].read[Rare.<def[bKey]>.item]>
- define qty <yaml [LootBlocks].read[Rare.<def[bKey]>.quantity>
- give <def[item]> quantity:<def[qty]>
- if <def[qty]> == 1{
- actionbar " <&3> You successfully transmutated the rune and gained <i@item.formatted>! "
}
else {
- actionbar " <&3> You successfully transmutated the rune and gained <i@item[quantity=<def[qty]>].formatted>! "
}
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomUniqueBlock:
type: task
debug: true
script:
- define bKey <yaml[LootBlocks].list_keys[Unique].random||null>
- if <def[bKey]> == null {
- queue clear
}
- define item <yaml[LootBlocks].read[Unique.<def[bKey]>.item]>
- define qty <yaml [LootBlocks].read[Unique.<def[bKey]>.quantity>
- give <def[item]> quantity:<def[qty]>
- if <def[qty]> == 1{
- actionbar " <&3> You successfully transmutated the rune and gained <i@item.formatted>! "
}
else {
- actionbar " <&3> You successfully transmutated the rune and gained <i@item[quantity=<def[qty]>].formatted>! "
}
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
LootRandomEpicBlock:
type: task
debug: true
script:
- define bKey <yaml[LootBlocks].list_keys[Epic].random||null>
- if <def[bKey]> == null {
- queue clear
}
- define item <yaml[LootBlocks].read[Epic.<def[bKey]>.item]>
- define qty <yaml [LootBlocks].read[Epic.<def[bKey]>.quantity>
- give <def[item]> quantity:<def[qty]>
- if <def[qty]> == 1{
- announce "<&3><player.name> successfully transmutated the rune and gained <i@item.formatted>! "
}
else {
- announce "<&3><player.name> successfully transmutated the rune and gained <i@item[quantity=<def[qty]>].formatted>! "
}
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
- playeffect HAPPY_VILLAGER qty:10 <player.location.above>
LootRandomLegendBlock:
type: task
debug: true
script:
- define bKey <yaml[LootBlocks].list_keys[Legend].random||null>
- if <def[bKey]> == null {
- queue clear
}
- define item <yaml[LootBlocks].read[Legend.<def[bKey]>.item]>
- define qty <yaml [LootBlocks].read[Lengend.<def[bKey]>.quantity>
- give <def[item]> quantity:<def[qty]>
- if <def[qty]> == 1{
- announce "<&3><player.name> successfully transmutated the rune and gained <i@item.formatted>! "
}
else {
- announce "<&3><player.name> successfully transmutated the rune and gained <i@item[quantity=<def[qty]>].formatted>! "
}
- firework <player.location> power:1 type:star primary:RED|BLUE fade:WHITE|PURPLE flicker trail
- playeffect ZOMBIE_DESTROY_DOOR <player.location>
- playeffect HAPPY_VILLAGER qty:10 <player.location.above>