-
Notifications
You must be signed in to change notification settings - Fork 1
/
gobridge.sk
135 lines (104 loc) · 3.83 KB
/
gobridge.sk
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
options:
gobridgePos: 108.5, 82, 16
gobridgeDirection: 0, 70
gobridgeWorld: "god"
rooms: 7
distance: 4
length: 20
timeup: 40
commandOnWin: /gobridgehub # This command is executed by player
commandOnWin2: /eco give # Executed by console. Argument of the command will be player and the win amount
maxReward: 50 # Biggest reward that a player can get with gobridge
winBlock: purpur pillar
gobridgeHub: 96, 72, -161
gobridgeHubDirection: 90, 0
command /gobridgehub:
executable by: players
trigger:
if {gobridge.p::%player%} is true:
stop
teleport player to location({@gobridgeHub}, {@gobridgeWorld}, {@gobridgeHubDirection})
command /gobridge:
executable by: players
trigger:
if {gobridge.p::%player%} is true:
send "§4You are already godbridging"
stop
loop {@rooms} times:
#set block 1 below ({@distance} * loop-number) east location({@gobridgePos}, {@gobridgeWorld}) to grass block
if {gobridge.r::%loop-number%} is not set:
set {gobridge.r::%loop-number%} to true
set {gobridge.ur::%player%} to loop-number
set {gobridge.p::%player%} to true
teleport player to position ({@distance} * loop-number - {@distance}) east location({@gobridgePos}, {@gobridgeWorld}, {@gobridgeDirection})
clear player's inventory
give 64 red stained glass to player
set {gobridge.t2::%player%} to Unix Timestamp of now
stop
send "§4Sorry. All the gobridge rooms are currently full."
every 1 second:
loop all players:
{gobridge.p::%loop-player%} is true
if loop-player's y position + 2 < location({@gobridgePos})'s y position:
clear {gobridge.p::%loop-player%}
clear {gobridge.t::%loop-player%}
clear {gobridge.t2::%loop-player%}
clear {gobridge.r::%{gobridge.ur::%loop-player%}%}
clear {gobridge.ur::%loop-player%}
loop-player's world is {@gobridgeWorld}
send "§cGame Over" to loop-player
clear loop-player's inventory
make loop-player execute command "{@commandOnWin}"
else if unix timestamp of now - {gobridge.t2::%loop-player%} > {@timeup}:
clear {gobridge.p::%loop-player%}
clear {gobridge.t::%loop-player%}
clear {gobridge.t2::%loop-player%}
clear {gobridge.r::%{gobridge.ur::%loop-player%}%}
clear {gobridge.ur::%loop-player%}
loop-player's world is {@gobridgeWorld}
send "§cTime Up!" to loop-player
clear loop-player's inventory
make loop-player execute command "{@commandOnWin}"
on block break:
if {gobridge.p::%player%} is true:
cancel event
on block place:
if {gobridge.p::%player%} is true:
set {_yP} to (block at location({@gobridgePos}))'s y position - 1
if event-block's y position is not {_yP} or ({_yP}+1) or ({_yP}+2) or ({_yP}+3):
wait 5 seconds
break event-block
on step on {@winBlock}:
if {gobridge.p::%player%} is true:
set {_t} to unix timestamp of now - {gobridge.t::%player%}
clear {gobridge.p::%player%}
clear {gobridge.t::%player%}
clear {gobridge.t2::%player%}
clear player's inventory
set {_mt} to {@length} * 0.95
set {_amt} to max(round((({_mt} - {_t}) / ({_mt} * 0.8) ) * {@maxReward}), 0)
send "§aYou completed the challenge in %{_t}% seconds%nl%§aReward: %{_amt}%$"
wait 1 second
clear {gobridge.r::%{gobridge.ur::%player%}%}
clear {gobridge.ur::%player%}
player's world is {@gobridgeWorld}
make player execute command "{@commandOnWin}"
execute console command "{@commandOnWin2} %player% %{_amt}%"
on player move:
{gobridge.p::%player%} is true
{gobridge.t::%player%} is not set
set {gobridge.t::%player%} to unix timestamp of now
on quit:
{gobridge.p::%player%} is set
clear {gobridge.p::%player%}
clear {gobridge.t::%player%}
clear {gobridge.t2::%player%}
clear {gobridge.r::%{gobridge.ur::%player%}%}
clear {gobridge.ur::%player%}
on script load:
clear {gobridge.r::*}
command /gbdebug:
permission: gbdebug
trigger:
send "a %{gobridge.r::*}%"
clear {gobridge.r::*}