Date: 2015/12/12 10:38:47 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
treasureHunt:
type: world
events:
on 7:00 in Survival:
- if <server.flag[treasure-days].as_int||0> > 0 {
- flag server treasure-days:--
- queue clear
}
- run newTreasureTask instantly
newTreasureTask:
type: task
default constants:
days: 10
script:
- flag server treasure-days:<script.constants[days]>
- flag server treasure-location:l@<util.random.int[-2500].to[2500]>,0,<util.random.int[-2500].to[2500]>
- flag server treasure-found:!
- announce "The <bold>Treasure Hunt<reset> has begun! First to find it gets extra loot. Type <yellow>/th<reset> to join the adventure."
newTreasureCommand:
type: command
name: thnew
description: Generates new treasure hunt coordinates
permission: treasurehunt.manage
script:
- run newTreasureTask instantly
treasureCommand:
type: command
name: th
description: Checks the treasure hunt coordinates
default constants:
world: Survival
threshold: 5
script:
- if !<server.has_flag[treasure-location]> {
- narrate "<red>There is currently no treasure hunt active, please wait for an announcement."
- queue clear
}
- if <player.has_permission[treasurehunt.manage]> narrate "<&d>The treasure has been found by <server.flag[treasure-found].as_list.size||0> players."
- define timeRemaining <server.flag[treasure-days].as_int||0>
- if %timeRemaining% == 0 {
- define timeRemaining "less than one minecraft day"
} else if %timeRemaining% == 1 {
- define timeRemaining "one minecraft day"
} else {
- define timeRemaining "%timeRemaining% minecraft days"
}
- if <server.flag[treasure-found].as_list.contains[<player>]||false> {
- narrate "<red>You have already found this treasure! A new treasure hunt will start in %timeRemaining%."
- queue clear
}
- define location <server.flag[treasure-location]>
- define threshold <script.constants[threshold]>
- if <player.world.name> == <script.constants[world]> && <math.abs:<%location%.x>-<player.location.x>> < %threshold% && <math.abs:<%location%.z>-<player.location.z>> < %threshold% {
- firework <player.location> random
- if !<server.has_flag[treasure-found]> {
- announce "<yellow><player.name><reset> is first to find the treasure! Congratulations."
- if <util.random.int[1].to[3]> == 1 {
- narrate "<&d>You found 500 coins and Rare Pirate Loot!"
- give money qty:500
- random {
- give "i@diamond_sword[display_name=<yellow>Pirate Sword;enchantments=loot_bonus_mobs,3|fire_aspect,2|damage_all,3]"
- give "i@bow[display_name=<yellow>Pirate Bow;enchantments=arrow_infinite,1|arrow_damage,5|arrow_fire,1]"
- give "i@chainmail_helmet[display_name=<yellow>Pirate Helmet;enchantments=water_worker,1|oxygen,3|protection_projectile,3]"
- give "i@chainmail_chestplate[display_name=<yellow>Pirate Chestplate;enchantments=thorns,3|durability,3|protection_environmental,4]"
- give "i@chainmail_leggings[display_name=<yellow>Pirate Leggings;enchantments=protection_explosions,4]"
- give "i@chainmail_boots[display_name=<yellow>Pirate Boots;enchantments=depth_strider,3|protection_fire,4]"
- give "i@fishing_rod[display_name=<yellow>Pirate Rod;enchantments=lure,3|luck,3|knockback,2]"
}
} else {
- narrate "<&d>You found 500 coins and an Enchanted Book!"
- give money qty:500
- random {
- give i@enchanted_book[enchantments=protection_environmental,4]
- give i@enchanted_book[enchantments=oxygen,3]
- give i@enchanted_book[enchantments=depth_strider,3]
- give i@enchanted_book[enchantments=fire_aspect,2]
- give i@enchanted_book[enchantments=loot_bonus_mobs,3]
- give i@enchanted_book[enchantments=dig_speed,5]
- give i@enchanted_book[enchantments=silk_touch,1]
- give i@enchanted_book[enchantments=loot_bonus_blocks,3]
- give i@enchanted_book[enchantments=arrow_damage,5]
- give i@enchanted_book[enchantments=arrow_infinite,1]
}
}
} else {
- announce "<yellow><player.name><reset> has found the treasure! Congratulations."
- narrate "<&d>You found 250 coins!"
- give money qty:250
}
- flag server treasure-found:->:<player>
- queue clear
}
- narrate "There is a treasure in <script.constants[world]> at X:<%location%.x.as_int>, Z:<%location%.z.as_int>. You have %timeRemaining% left to find it. Type /th again once you've arrived at these coordinates."