Date: 2020/09/27 12:54:34 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
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:
- yaml load:/Shops/npc_shop.yml id:npc_buy
- wait 1t
- define shop d:npc_shop
- inventory open <[shop]>
- yaml unload id:npc_buy
npc_shop:
type: inventory
inventory: CHEST
title: Loja
size: 45
slots:
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
Procedural Items:
- determine <yaml[npc_shop].read[npc_buy]>
npc_shop_handler:
type: world
events:
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
on player clicks in npc_shop:
- if <context.inventory> == <context.clicked_inventory>:
- determine passively cancelled
- if <context.item.has_nbt[Cost]>:
- if <player.money.is[MORE].to[<context.item.nbt[Cost]>]>:
- if <player.inventory.empty_slots> == 0:
- narrate "Your inventory has no space!"
- stop
- take money quantity:<context.item.nbt[Cost]>
- define Item <context.item>
- adjust 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."
- 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