Date: 2017/02/02 21:25:08 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
##############################
## ##
## Flip Cards ##
## by ##
## ~Peashooter101 ##
## ##
##############################
## Denizen Script Info:
## Scripted by Peashooter101
## Scripted for the DragonPeas SMP Server
## Version: 1.0 (Initial)
##############################
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."
}
- 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
}
- 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."
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."
}
##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
- inventory open d:in@FCCoinFlipsGUI
- 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
FCBlank:
type: item
material: black_stained_glass_pane
display name:
##############################
## ##
## Coin Flips ##
## ##
##############################
FCCoinFlipsGUI:
type: inventory
title: <dark_blue>Flip Card <black>| <yellow>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>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:
on player clicks in FCCoinFlipsGUI:
- determine cancelled
on player drags in FCCoinFlipsGUI:
- determine cancelled
##Clicks Coin
on player clicks FCCoinFlipsCoin in FCCoinFlipsGUI:
- flag <player> FCCoinFlipsActions:+:1
- define slotClicked <context.slot>
- define loop_index 1
##Coin Spin Sequence
- while <def[loop_index].is[OR_LESS].than[5]> {
- inventory set destination:<player.open_inventory> origin:i@FCCoinFlipsIron slot:<def[slotClicked]>
- playsound <player> sound:ENTITY_PLAYER_ATTACK_SWEEP
- inventory set destination:<player.open_inventory> origin:i@FCCoinFlipsGold slot:<def[slotClicked]>
- playsound <player> sound:ENTITY_PLAYER_ATTACK_SWEEP
- define loop_index <def[loop_index].add[1]>
}
##Result of Coin
- define win <util.random.int[1].to[2]>
- if <def[win]> == 1 {
- inventory set destination:<player.open_inventory> origin:i@FCCoinFlipsIron slot:<def[slotClicked]>
- flag <player> FCCoinFlipsIronWin:+:1
- playsound <player> sound:ENTITY_PLAYER_LEVELUP
}
- if <def[win]> == 2 {
- inventory set destination:<player.open_inventory origin:i@FCCoinFlipsGold slot:<def[slotClicked]>
- 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 {
- inventory close d:in@FCCoinFlipsGUI
- narrate "<yellow>YOU WON TWO GOLD!"
- queue clear
}
##3/3 Iron
- if <player.flag[FCCoinFlipsIronWin]> == 3 {
- inventory close d:in@FCCoinFlipsGUI
- narrate "<gray>YOU WON THREE IRON!"
- queue clear
}
##3/3 Gold
- if <player.flag[FCCoinFlipsGoldWin]> == 3 {
- inventory close d:in@FCCoinFlipsGUI
- narrate "<yellow>YOU WON THREE GOLD!"
- queue clear
}
##No Wins
- inventory close d:in@FCCoinFlipsGUI
- narrate "<red>BETTER LUCK NEXT TIME!"
}
- queue clear