Date: 2018/06/22 19:22:16 UTC-07: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
#==================#
# DEBUG #=======================================================#
#==================#
dBank_Command:
type: command
name: dBank
description: Open a dBank window.
usage: /dBank [<<>clear<>>]
allowed help: determine <player.is_op>
script:
- if <context.args.size> == 0 {
- run dBank_Core instantly def:<player>
} else if <context.raw_args> == clear {
- run dBank_Reset instantly
} else {
- narrate "<&4>Unknown usage."
}
dBank_Reset:
type: task
script:
- foreach <server.list_players.filter[has_flag[dBank]]> {
- define player <def[value]>
- flag <def[player]> dBank:!
- note remove as:<def[player].UUID>_dBank_inventory
- repeat 9 {
- flag <def[player]> dBank_<def[value]>:!
- note remove as:<def[player].UUID>_dBank_inventory_bag_<def[value]>
}
}
- narrate "<&2>Data cleared."
#==================#
# CONFIG #=======================================================#
#==================#
dBank_config:
type: yaml data
dBank_Default:
type: inventory
inventory type: chest
title: Bank
size: 9
slots:
- "[i@bank_bag[display_name=Bag 1]] [i@bank_buy_restricted] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank]"
dBank_Bag_Default:
type: inventory
inventory type: chest
title: Bag [SLOTNUMBER]
size: 54
slots:
- "[i@bank_back] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[i@bank_buy] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank]"
- "[i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank]"
- "[i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank] [i@bank_blank]"
#==================#
# OPERATIONS #=======================================================#
#==================#
dBank_Core:
type: task
script:
- if <def[1].has_flag[dBank].not> {
- flag <def[1]> dBank
- note in@dBank_Default as:<def[1].UUID>_dBank_inventory
}
- inventory close
- inventory open d:in@<def[1].UUID>_dBank_inventory
dBank_Bag:
type: task
script:
- if <def[1].has_flag[dBank_<def[2]>].not> {
- flag <def[1]> dBank_<def[2]>
- note in@dBank_Bag_Default as:<def[1].UUID>_dBank_inventory_bag_<def[2]>
- adjust in@<def[1].UUID>_dBank_inventory_bag_<def[2]> title:TEST
}
- inventory close
- inventory open d:in@<def[1].UUID>_dBank_inventory_bag_<def[2]>
dBank_Functions:
type: world
debug: false
custom_items:
- i@bank_blank
- i@bank_buy
- i@bank_bag
- i@bank_back
- i@bank_buy_restricted
- i@bank_bag_buy
events:
on player clicks in inventory:
- narrate <context.inventory.notable_name>
- if <context.inventory.notable_name.starts_with[<player.UUID>_dBank]||false> {
- if <script.yaml_key[custom_items].contains[<context.item.simple>]> {
- determine passively cancelled
- if <context.item.simple> == i@bank_back {
- run dBank_Core instantly def:<player>
} else if <context.item.simple> == i@bank_buy {
- narrate pass
- if <CONDITIONS.MET||true> == true {
# - remove funds
- inventory set d:<context.inventory> o:i@air slot:<context.raw_slot>
- if <context.raw_slot> <= 53 {
- inventory set d:<context.inventory> o:i@bank_buy slot:<context.raw_slot.add[1]>
} else if <context.raw_slot> == 54 {
- define unlock <context.inventory.title.after[<&sp>].add[1]>
- if <def[unlock]> <= 8 {
- inventory set d:in@<player.UUID>_dBank_inventory o:i@bank_bag_buy slot:<def[unlock]>
}
- if <def[unlock]> <= 7 {
- inventory set d:in@<player.UUID>_dBank_inventory o:i@bank_buy_restricted slot:<def[unlock].add[1]>
} else if <def[unlock]> == 9 {
- narrate "Congrats. You unlocked all the bags. Woo."
}
}
}
} else if <context.item.simple> == i@bank_bag_buy {
# - remove funds
- inventory set d:<context.inventory> o:i@bank_bag[display_name=Bag<&sp><context.raw_slot>] slot:<context.raw_slot>
} else if <context.item.simple> == i@bank_blank {
- queue clear
} else if <context.item.simple> == i@bank_bag {
- run dBank_Bag instantly def:<player>|<context.raw_slot>
}
}
}
#==================#
# ITEMS #=======================================================#
#==================#
bank_blank:
type: item
material: i@black_stained_glass_pane
display name: <&4>Unavailable
bank_buy:
type: item
material: i@green_stained_glass_pane
display name: <&a>Click to purchase
lore:
- $100
bank_bag:
type: item
material: i@chest
display name: Bag [SLOTNUMBER]
bank_back:
type: item
material: i@barrier
display name: <&8>Go Back
bank_buy_restricted:
type: item
material: i@red_stained_glass_pane
display name: <&c>Not Available Yet
bank_bag_buy:
type: item
material: i@green_stained_glass_pane
display name: <&a>Click to purchase
lore:
- $1000