Date: 2020/12/17 23:32:18 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
# Monster Items #
string-item:
type: item
material: string
display name: String
lore:
- Valued at <yaml[surplusitems].read[<[stringitem]>.sell]>◈ a piece.
flesh-item:
type: item
material: rotten_flesh
display name: Rotten Flesh
lore:
- Valued at ◈ a piece.
# - Main GUI - #
initial-gui:
type: inventory
inventory: chest
title: Eric's Surplus Buyback
size: 9
slots:
- [voidbutton] [voidbutton] [voidbutton] [monsteritems] [blockitems] [resourceitems] [voidbutton] [voidbutton] [voidbutton]
# - Monster Shops - #
monster-shop:
type: inventory
inventory: chest
title: Monster Surplus
size: 18
slots:
- [flesh-item] [bone-item] [string-item] [spider-item] [blaze-item] [powder-item] [slime-item] [magma-item] [voidButton]
- [backbutton] [voidbutton] [voidbutton] [voidbutton] [amountbutton] [voidbutton] [voidbutton] [voidbutton] [voidButton]
# - Resource Shops - #
resource1-shop:
type: inventory
inventory: chest
title: Resource Surplus Page 1
size: 27
slots:
- [coal-item] [iron-ingot-item] [gold-ingot-item] [lapis-item] [redstone-item] [diamond-item] [emerald-item] [netherite-ingot-item] [voidbutton]
- [raw-pork-item] [cooked-pork-item] [raw-beef-item] [cooked-beef-item] [raw-mutton-item] [cooked-mutton-item] [raw-chicken-item] [cooked-chicken-item] [voidbutton]
- [backbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [nextbutton]
resource2-shop:
type: inventory
inventory: chest
title: Resource Surplus Page 2
size: 27
slots:
- [wheat-seeds-item] [wheat-item] [carrot-item] [berry-item] [potato-item] [baked-potato-item] [poison-potato-item] [voidButton] [voidButton]
- [cod-item] [cooked-cod-item] [salmon-item] [cooked-salmon-item] [kelp-item] [dried-kelp-item] [tropical-fish-item] [voidButton] [voidButton]
- [backbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidButton]
# - Block Shops - #
block-shop:
type: inventory
inventory: chest
title: Block Surplus
size: 27
slots:
- [] [] [] [] [] [] [] [] []
- [] [] [] [] [] [] [] [] []
- [backbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [voidbutton] [nextbutton]
########################### - Handlers - ###########################
eric-npc:
type: assignment
actions:
on assignment:
- trigger name:click eric:true
interact scripts:
- open-initial-gui
open-initial-gui:
type: interact
steps:
1:
click trigger:
script:
- narrate "[<&6>Collector<&f>] Eric: Hey <player.name>! What have you got for me?"
- wait 2s
- ~yaml load:surplusitems.yml id:surplusitems
- inventory open d:initial-gui
cantSell_Eric:
type: task
script:
- determine passively cancelled
- playsound <player> sound:entity_player_hurt pitch:0.5
- narrate "[<&6>Collector<&f>] Eric: Looks like you don't have enough of those."
########################### - Handlers - ###########################
# Amount Button #
on player clicks amountbutton in *-shop priority:3:
- determine passively cancelled
- playsound <player> sound:block_stone_button_click_on pitch:1
- if <player.flag[sellAmount]> >= 513:
- flag <player> sellAmount:16
- narrate "[<&6>Collector<&f>] Eric: Sell <player.flag[sellAmount]> items."
- else:
- flag <player> sellAmount:+:16
- narrate "[<&6>Collector<&f>] Eric: Sell <player.flag[sellAmount]> items."
# - Sell Items/Monster - #
on player clicks flesh-item in monster-shop priority:4:
- if <player.inventory.quantity.material[rotten_flesh]> >= <player.flag[sellAmount]>:
- determine passively cancelled
- playsound <player> sound:block_stone_button_click_on pitch:1
- take material:rotten_flesh quantity:<player.flag[sellAmount]> from:<player.inventory>
- money give quantity:<player.flag[sellAmount].mul[<yaml[surplusitems].read[<[fleshitem]>.sell]>]>
- else:
- inject cantSell_Eric