Date: 2015/12/02 21:20:49 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
#####################################
# Created by NLBlackEagle #
# Website: www.craftrealms.org #
# TeamSpeak: ts3.craftrealms.org #
#####################################
Chest100Script:
type: world
default constants:
#The RepopulateCooldown value is in minutes and determines the amount of time before a re-population
#should be executed. This causes no server load since the re-population is player-bound.
#Change the value "300m" to any number you'd like. 300m equals 5 hours.
RepopulateCooldown: 300m
#PopulateAttemts, lower this number to decrease the amount of items in a chest.
PopulateAttemts: 15
#PopulateMinimalItems, Minimal items in a chest upon populating. 0 Makes items more rare but not impossibile to populate.
PopulateMinimalItems: 2
debug: true
events:
on server start:
- yaml load:loottable.yml id:lootcrates
on player opens chest:
- if !<player.has_flag[<context.inventory.location.simple>]> {
- flag player <context.inventory.location.simple>:true duration:<s@chest100script.constant[RepopulateCooldown]>
- if <server.flag[chest].as_list.contains[<context.inventory.location.simple>]> {
- queue clear
}
- repeat <s@chest100script.constant[PopulateMinimalItems]> {
- inventory add d:<context.inventory> o:<yaml[lootcrates].read[loot].random.as_item> slot:<util.random.int[1].to[27]>
}
- repeat <s@chest100script.constant[PopulateAttemts]> {
- if <util.random.int[1].to[5]> == 5 {
- inventory add d:<context.inventory> o:<yaml[lootcrates].read[loot].random.as_item> slot:<util.random.int[1].to[27]>
}
}
}
on player places block:
- if li@chest|trapped_chest contains <context.material.name> {
- flag server chest:->:<context.location.simple>
- execute as_server "denizen save"
}