Date: 2017/02/16 16:27:55 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
##############################
## ##
## Flip Cards ##
## by ##
## ~Peashooter101 ##
## ##
##############################
## Denizen Script Info:
## Scripted by Peashooter101
## Scripted for the DragonPeas SMP Server
## Version: 0.1 (Pre-Initial Release)
##############################
## Flip Cards:
## - CoinFlips (Released v0.1)
##############################
##############################
## FC Give ##
##############################
FCGiveCommand:
type: command
name: FCGive
description: Gives/Takes cards to the player.
usage: /fcgive <<>CardName<>> <<>Quantity<>> <<>Player<>>
allowed help:
- determine <player.is_op||<context.server>>
script:
##Operator Check
- if !<player.is_op||<context.server>> {
- narrate "<red>/fcgive <gold>>> <dark_red>You're not allowed to use this command!"
- queue clear
}
##Too Many Arguments
- if <context.args.size> > 3 {
- narrate "<gold>[Flip Cards] <light_purple>Invalid Command, too many arguments."
- queue clear
}
- choose <context.args.get[1]||null>:
##No Arguments
- case null:
- narrate "<gold>[Flip Cards] <light_purple>You need to provide a CardName and Quantity at minimum."
##CoinFlips
- case CoinFlips:
##No Quantity
- if <context.args.get[2]||null> = null {
- narrate "<gold>[Flip Cards] <light_purple>You need to provide a Quantity."
- queue clear
}
##Not a Number
- if <context.args.get[2]||null> !matches number {
- narrate "<gold>[Flip Cards] <light_purple>Invalid Argument, specify a number."
- queue clear
}
##Decimal Number
- if <context.args.get[2]> !== <context.args.get[2].round_down> {
- narrate "<gold>[Flip Cards] <light_purple>Invalid Argument, specify a whole number."
- queue clear
}
##No Player Input
- if <context.args.get[3]||null> == null {
- flag <player> FCCoinFlips:+:<context.args.get[2]>
- narrate "<gold>[Flip Cards] <light_purple>You have received <yellow><context.args.get[2]> <light_purple>CoinFlips Cards."
- queue clear
}
- if <context.args.get[3]||null> == all {
- foreach <server.list_players> {
- flag <def[value]> FCCoinFlips:+:<context.args.get[2]>
- narrate "<gold>[Flip Cards] <light_purple>You have received <yellow><context.args.get[2]> <light_purple>Coin Flips Cards." target:<def[value]>
}
- narrate "<gold>[Flip Cards] <light_purple>All players have been given <yellow><context.args.get[2]> <light_purple>Coin Flips Cards."
- queue clear
}
- define playerTarget <server.match_offline_player[<context.args.get[3]||null>]||false>
##Invalid Player
- if <def[playerTarget]> == false {
- narrate "<gold>[Flip Cards] <light_purple><context.args.get[3]> is not a valid player."
- queue clear
}
##Valid Player
- flag <def[playerTarget]> FCCoinFlips:+:<context.args.get[2]>
- narrate "<gold>[Flip Cards] <light_purple><def[playerTarget].name> has received <yellow><context.args.get[2]> <light_purple>CoinFlips Cards."
- queue clear
- default:
- narrate "<gold>[Flip Cards] <light_purple>That isn't a CardName, use <red>/fcplay <gold>to see all applicable cards."
##############################
## FC Play Card ##
##############################
FCPlayCardCommand:
type: command
name: FCPlayCard
description: Choose a card to play.
usage: /fcplaycard <<>CardName<>>
script:
##Too Many Arguments
- if <context.args.size> > 1 {
- narrate "<gold>[Flip Cards] <light_purple>Invalid Command, too many arguments."
- queue clear
}
##No Arguments (Check Cards)
- if <context.args.size> > = 0 {
- narrate "<gold>[Flip Cards] <light_purple>You have the following cards:"
- narrate "<gold>CoinFlips: <yellow><player.flag[FCCoinFlips]>"
- queue clear
}
##Card Selected
- choose <context.args.get[1]||null>:
##Null Value
- case null:
- narrate "<gold>[Flip Cards] <light_purple>You have the following cards:"
- narrate "<gold>CoinFlips: <yellow><player.flag[FCCoinFlips]>"
- queue clear
##Coin Flips
- case CoinFlips:
##Has Enough Cards
- if <player.flag[FCCoinFlips]> > 0 {
- flag <player> FCCoinFlips:-:1
- narrate "<gold>[Flip Cards] <light_purple>Good Luck!"
- flag <player> FCCoinFlipsActions:0
- flag <player> FCCoinFlipsIronWin:0
- flag <player> FCCoinFlipsGoldWin:0
- wait 1s
- note in@FCCoinFlipsGUI as:<player.uuid>_temporary_inventory
- inventory open d:in@<player.uuid>_temporary_inventory
- queue clear
}
##Not Enough Cards
else {
- narrate "<gold>[Flip Cards] <light_purple>You do not have any of these cards."
- queue clear
}
##Invalid CardName Input
- default:
- narrate "<gold>[Flip Cards] <light_purple>That is not a Flip Card, use <red>/fcplay <gold>to see all applicable cards."
- queue clear
##############################
## FC Blank ##
##############################
## Remember to use in all FCs
##############################
FCBlank:
type: item
material: black_stained_glass_pane
display name: <black>
##############################
## FC All GUI Handler ##
##############################
## Checks all FCs
##############################
FCAllGUIHandler:
type: world
events:
on player clicks in inventory:
- if !<context.inventory.notable_name.ends_with[_temporary_inventory]> {
- queue clear
}
- determine cancelled
on player drags in inventory:
- if !<context.inventory.notable_name.ends_with[_temporary_inventory]> {
- queue clear
}
- determine cancelled
##############################
## ##
## Coin Flips ##
## ##
##############################
## Flip Card Info:
## Name - Coin Flips
## CardID - CoinFlips
## Designed by - Peashooter101
## Design Completed - 2FEB2017
##############################
## Win Conditions - Prizes:
## 2/3 Gold -
## 3/3 Iron -
## 3/3 Gold -
##############################
FCCoinFlipsGUI:
type: inventory
title: <dark_blue><bold>|FC| <gold><bold>Coin Flips
size: 27
slots:
- "[i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCCoinFlipsInfo] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank]"
- "[i@FCBlank] [i@FCBlank] [i@FCCoinFlipsCoin] [i@FCBlank] [i@FCCoinFlipsCoin] [i@FCBlank] [i@FCCoinFlipsCoin] [i@FCBlank] [i@FCBlank]"
- "[i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank] [i@FCBlank]"
FCCoinFlipsCoin:
type: item
material: sunflower
display name: <yellow><bold>Coin
lore:
- <aqua>Flip Me!
FCCoinFlipsIron:
type: item
material: iron_ingot
display name: <gray><bold>Iron
FCCoinFlipsGold:
type: item
material: gold_ingot
display name: <yellow><bold>Gold
FCCoinFlipsInfo:
type: item
material: paper
display name: <yellow>Coin Flips Card
lore:
- <red><bold>DO NOT EXIT THIS GUI, YOU WILL LOSE YOUR CARD!
- <red>
- <gold><bold>Win Conditions
- <aqua>2/3 Gold
- <aqua>3/3 Iron
- <aqua>3/3 Gold
FCCoinFlipsGUIHandler:
type: world
events:
##Clicks Coin
on player clicks FCCoinFlipsCoin in inventory:
- if !<context.inventory.notable_name.ends_with[_temporary_inventory]> {
- queue clear
}
- define slotClicked <context.raw_slot>
##Coin Spin Sequence
- repeat 5 {
- inventory set destination:<context.inventory> origin:i@FCCoinFlipsIron slot:<def[slotClicked]>
- playsound <player> sound:ENTITY_PLAYER_ATTACK_SWEEP
- wait 2t
- inventory set destination:<context.inventory> origin:i@FCCoinFlipsGold slot:<def[slotClicked]>
- playsound <player> sound:ENTITY_PLAYER_ATTACK_SWEEP
- wait 2t
}
- flag <player> FCCoinFlipsActions:+:1
##Result of Coin
- define win <util.random.int[1].to[2]>
- if <def[win]> == 1 {
- inventory set destination:<context.inventory> origin:i@FCCoinFlipsIron slot:<def[slotClicked]>
- inventory update destination:<context.inventory>
- flag <player> FCCoinFlipsIronWin:+:1
- playsound <player> sound:ENTITY_PLAYER_LEVELUP
}
- if <def[win]> == 2 {
- inventory set destination:<context.inventory> origin:i@FCCoinFlipsGold slot:<def[slotClicked]>
- inventory update destination:<context.inventory>
- flag <player> FCCoinFlipsGoldWin:+:1
- playsound <player> sound:ENTITY_PLAYER_LEVELUP
}
##Win Analyzer
- if <player.flag[FCCoinFlipsActions]> == 3 {
##2/3 Gold
- if <player.flag[FCCoinFlipsGoldWin]> == 2 {
- wait 2s
- inventory close d:in@FCCoinFlipsGUI
- narrate "<yellow>YOU WON TWO GOLD!"
- queue clear
}
##3/3 Iron
- if <player.flag[FCCoinFlipsIronWin]> == 3 {
- wait 2s
- inventory close d:in@FCCoinFlipsGUI
- narrate "<gray>YOU WON THREE IRON!"
- queue clear
}
##3/3 Gold
- if <player.flag[FCCoinFlipsGoldWin]> == 3 {
- wait 2s
- inventory close d:in@FCCoinFlipsGUI
- narrate "<yellow>YOU WON THREE GOLD!"
- queue clear
}
##No Wins
- wait 2s
- inventory close d:in@FCCoinFlipsGUI
- narrate "<red>BETTER LUCK NEXT TIME!"
}
##Not Yet Done
- queue clear
- determine cancelled