Date: 2020/10/01 09:36:52 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
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
npc_assignment:
type: assignment
debug: true
actions:
on assignment:
- trigger name:click state:true
interact scripts:
- npc_interact
npc_format:
type: format
format: "<&b><npc.name> <&f>to you<&co> <&2><text>"
npc_interact:
type: interact
debug: true
steps:
1:
click trigger:
script:
- flag player npc_name:<npc.name>
- inventory open d:npc_menu
npc_menu:
type: inventory
inventory: CHEST
title: "Conversando com <player.flag[npc_name]>"
size: 45
slots:
- [] [] [] [] [npc_menu_talk] [] [] [] []
- [] [] [] [] [npc_menu_buy] [] [] [] []
- [] [] [] [] [npc_menu_sell] [] [] [] []
- [] [] [] [] [npc_menu_quest] [] [] [] []
- [] [] [] [] [npc_menu_exit] [] [] [] []
npc_shop:
type: inventory
inventory: CHEST
title: " Loja (pagina <player.flag[page]>)"
size: 45
slots:
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
Procedural Items:
- narrate <player.flag[pages].get[1]>
- determine <yaml[npc_shop].read[<player.flag[pages].get[<player.flag[page]>]>]>
npc_quest:
type: inventory
inventory: CHEST
title: " Missões"
size: 54
slots:
- [npc_menu_back] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
npc_menu_talk:
type: item
material: player_head
display name: Conversar
npc_menu_buy:
type: item
material: hopper_minecart
display name: Comprar
npc_menu_sell:
type: item
material: chest_minecart
display name: Vender
npc_menu_quest:
type: item
material: filled_map
display name: Missões
npc_menu_back:
type: item
material: player_head
mechanisms:
skull_skin: b3d33981-7d91-49b9-8677-b37a32dd1069|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDgzNDhhYTc3ZjlmYjJiOTFlZWY2NjJiNWM4MWI1Y2EzMzVkZGVlMWI5MDVmM2E4YjkyMDk1ZDBhMWYxNDEifX19
display name: Voltar
npc_menu_next_page:
type: item
material: player_head
mechanisms:
skull_skin: 0bba93e1-2401-47c4-88d3-418d7783d2a9|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDlkMzM0YmYzM2YyZTU2NzdmYjE3NGQ0NzJiYjc2MWQ4NzhkMWE2NTc5ZWMxZTdiMjdkOWRkNTQ1Yzk3M2MifX19
display name: Pagina <player.flag[page].add_int[1]>
npc_menu_back_page:
type: item
material: player_head
mechanisms:
skull_skin: 0dfe5685-3a24-4184-8b30-189e737d03ac|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTA2NTM2Y2I2ZGUwZDA4YzJkNzAxMjg1NGVmYTI4MTYyMjUxZWU2ZTlmODFmZTZjY2MyOTk4M2M4NDVkNmI1In19fQ==
display name: Pagina <player.flag[page].sub[1]>
npc_menu_exit:
type: item
material: barrier
display name: Sair
npc_talk:
type: task
definitions: name
script:
- narrate "<&b><[name]> <&f>to you<&co> <&2> hello world"
- flag player npc_name:!
npc_menu_handler:
type: world
events:
on player clicks npc_menu_next_page in npc_shop:
- if <player.flag[pages].size> == <player.flag[page]>:
- stop
- flag player page:++
- inventory open d:npc_shop
on player clicks npc_menu_back_page in npc_shop:
- if <player.flag[page]> == 1:
- stop
- flag player page:--
- inventory open d:npc_shop
on player clicks npc_menu_talk in npc_menu:
- inventory close
- run npc_talk def:<player.flag[npc_name]>
on player clicks npc_menu_buy in npc_menu:
- yaml load:/Shops/npc_shop.yml id:npc_shop
- wait 1t
- flag player page:1
- flag player pages:!|<yaml[npc_shop].list_keys[].filter[contains[buy]]>
- inventory open d:npc_shop
on player clicks npc_menu_sell in npc_menu:
- yaml load:/Shops/npc_shop.yml id:npc_shop
- wait 1t
- flag player page:1
- flag player pages:!|<yaml[npc_shop].list_keys[].filter[contains[sell]]>
- inventory open d:npc_shop
on player clicks npc_menu_quest in npc_menu:
- inventory open d:npc_quest
on player clicks npc_menu_exit in npc_menu:
- inventory close
on player clicks npc_menu_back in npc_shop:
- inventory open d:npc_menu
- flag player pages:!
on player clicks npc_menu_back in npc_quest:
- inventory open d:npc_menu
on player clicks in npc_menu priority:100:
- if <context.inventory> == <context.clicked_inventory>:
- determine cancelled
on player drags in npc_menu priority:100:
- if <context.raw_slots.contains_any[<util.list_numbers_to[53]>]>:
- determine cancelled
- if <context.inventory> == <context.clicked_inventory>:
- determine cancelled
- if <context.item.has_nbt[ShopMenuItem]> || <context.item.has_nbt[Cost]>:
- determine cancelled
on player clicks in npc_quest priority:100:
- if <context.inventory> == <context.clicked_inventory>:
- determine cancelled
on player drags in npc_quest priority:100:
- if <context.raw_slots.contains_any[<util.list_numbers_to[53]>]>:
- determine cancelled
- if <context.inventory> == <context.clicked_inventory>:
- determine cancelled
- if <context.item.has_nbt[ShopMenuItem]> || <context.item.has_nbt[Cost]>:
- determine cancelled
npc_shop_handler:
type: world
events:
on player opens npc_shop:
- inventory set destination:<context.inventory> origin:npc_menu_back slot:1
- if <player.flag[page]> != 1:
- inventory set destination:<context.inventory> origin:npc_menu_back_page slot:37
- if <player.flag[page]> < <player.flag[pages].size>:
- inventory set destination:<context.inventory> origin:npc_menu_next_page slot:45
on player drags in npc_shop:
- if <context.raw_slots.contains_any[<util.list_numbers_to[53]>]>:
- determine cancelled
- if <context.inventory> == <context.clicked_inventory>:
- determine cancelled
- if <context.item.has_nbt[ShopMenuItem]> || <context.item.has_nbt[Cost]>:
- determine cancelled
on player clicks in npc_shop:
- if <context.inventory> == <context.clicked_inventory>:
- determine passively cancelled
- if <context.item.has_nbt[Cost]>:
- if <player.inventory.empty_slots> == 0:
- narrate "Your inventory has no space!"
- stop
- if <context.item.lore.contains_any_text[Sell]>:
- if !<player.inventory.contains.material[<context.item.material>].quantity[<context.item.quantity>]>:
- narrate "You don't have enough item!"
- stop
- else:
- take material:<context.item.material> quantity:<context.item.quantity>
- give money quantity:<context.item.nbt[Cost]>
- narrate "$<context.item.nbt[Cost]> has been deposit to your wallet."
- narrate "<green>Balance: <red>$<player.money>"
- else:
- if <player.money.is[MORE].to[<context.item.nbt[Cost]>]>:
- take money quantity:<context.item.nbt[Cost]>
- define Item <context.item>
- adjust def:Item remove_nbt
- adjust def:Item Lore:<context.item.lore.remove[<context.item.lore.size>]>
- give <[Item]>
- narrate "$<context.item.nbt[Cost]> has been removed from your wallet."
- narrate "<green>Balance: <red>$<player.money>"
- flag player TotalSpent:+:<context.item.nbt[Cost]>
- stop
- else:
- narrate "You don't have enough money! Cost: $<context.item.nbt[Cost]> Your Money: $<player.money>"
- stop