Date: 2024/03/14 08:24:48 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
novashop_handler:
type: world
debug: true
events:
after player clicks item_flagged:price in novashop_inventory:
- define inventory <inventory[novashop_confirm_menu]>
- define price <context.item.flag[price.buy]>
- define lore <context.item.lore>
- define lore <[lore].remove[<[lore].size>]>
- inventory set d:<[inventory]> slot:23 o:<context.item.with[lore=<[lore]>]>
- adjust <[inventory]> title:<&e><context.item.display.if_null[<context.item.material.translated_name>]>
- inventory set d:<[inventory]> slot:5 o:<item[novashop_confirm_purchase].with[lore=<&7>Price: <&e><[price]> <server.economy.currency_name[<[price]>]>].with_flag[confirm:<[price]>]>
- inventory set d:<[inventory]> slot:7 o:<item[novashop_plus_amt].with_flag[plus:1].with[display=<&a>Add +1;lore=<&7>+<[price]> <server.economy.currency_name[<[price]>]>]>
- inventory set d:<[inventory]> slot:16 o:<item[novashop_plus_amt].with_flag[plus:8].with[display=<&a>Add +8;lore=<&7>+<[price].mul[8]> <server.economy.currency_name[<[price].mul[8]>]>]>
- inventory set d:<[inventory]> slot:25 o:<item[novashop_plus_amt].with_flag[plus:16].with[display=<&a>Add +16;lore=<&7>+<[price].mul[16]> <server.economy.currency_name[<[price].mul[16]>]>]>
- inventory set d:<[inventory]> slot:3 o:<item[novashop_minus_amt].with_flag[minus:1].with[display=<&c>Remove +1;lore=<&7>-<[price]> <server.economy.currency_name[<[price]>]>]>
- inventory set d:<[inventory]> slot:12 o:<item[novashop_minus_amt].with_flag[minus:8].with[display=<&c>Remove +8;lore=<&7>-<[price].mul[8]> <server.economy.currency_name[<[price].mul[8]>]>]>
- inventory set d:<[inventory]> slot:21 o:<item[novashop_minus_amt].with_flag[minus:16].with[display=<&c>Remove +16;lore=<&7>-<[price].mul[16]> <server.economy.currency_name[<[price].mul[16]>]>]>
- inventory open d:<[inventory]>
after player clicks item_flagged:plus in novashop_confirm_menu:
- define amt <context.item.flag[plus]>
- define quantity <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].quantity>
- define price <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].flag[price.buy]>
- if <[quantity].add[<[amt]>]> > 64:
- define price <[price].mul[64]>
- else:
- define price <[price].mul[<[quantity].add[<[amt]>]>]>
- define quantity <[quantity].add[<[amt]>]>
- define item <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>]>
- inventory set d:<context.inventory> slot:5 o:<item[novashop_confirm_purchase].with[lore=<&7>Price: <&e><[price]> <server.economy.currency_name[<[price]>]>].with_flag[confirm:<[price]>]>
- inventory adjust d:<context.inventory> slot:23 quantity:<[quantity]>
after player clicks item_flagged:minus in novashop_confirm_menu:
- define amt <context.item.flag[minus]>
- define quantity <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].quantity>
- define price <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].flag[price.buy]>
- if <[quantity].sub[<[amt]>]> <= 1:
- define quantity 1
- else:
- define price <[price].mul[<[quantity].sub[<[amt]>]>]>
- define quantity <[quantity].sub[<[amt]>]>
- define item <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>]>
- inventory set d:<context.inventory> slot:5 o:<item[novashop_confirm_purchase].with[lore=<&7>Price: <&e><[price]> <server.economy.currency_name[<[price]>]>].with_flag[confirm:<[price]>]>
- inventory adjust d:<context.inventory> slot:23 quantity:<[quantity]>
after player clicks item_flagged:confirm in novashop_confirm_menu:
- define price <context.item.flag[confirm]>
- if <player.has_flag[custom_quantity]>:
- define quantity <player.flag[custom_quantity]>
- else:
- define quantity <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].quantity>
- define item <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>]>
- define matchable <[item].script.name.if_null[<[item].material.name>]>
- if <player.money> < <[price]>:
- narrate "<&c>You don't have enough money!"
- playsound <player> sound:block_note_block_bass
- flag <player> customquantity:!
- inventory close
- stop
- if !<player.inventory.can_fit[<[matchable]>].quantity[<[quantity]>]>:
- narrate "<&c>Your inventory can't fit x<[quantity]> <[matchable]>!"
- playsound <player> sound:block_note_block_bass
- flag <player> customquantity:!
- inventory close
- stop
- give <[matchable]> quantity:<[quantity]>
- money take quantity:<[price]>
- narrate "<&7>You've bought <&e>x<[quantity]> <[item].display.if_null[<[item].material.translated_name>]> <&7>for <&a><[price]> <server.economy.currency_name[<[price]>]><&7>."
- playsound <player> sound:entity_experience_orb_pickup
- define category <context.inventory.slot[<context.inventory.find_item[item_flagged:category]>].flag[category]>
- run novashop_pages def.page:1 def.category:<[category]>
- flag <player> customquantity:!
# Make one flag that mentions the quantity and when they finish with confirm, unflag them.
on player clicks custom_quantity in novashop_confirm_menu:
- if <player.name.starts_with[.]>:
- flag <player> ashop:->:<context.inventory.slot[23]>
- inventory close
- wait 5t
- execute as_op "forms open custom_quantity"
- else:
- define inventory <inventory[novashop_java_custom_amt]>
- define price <context.inventory.slot[<context.inventory.find_item[item_flagged:price]>].flag[price]>
- define item <context.inventory.slot[23]>
- narrate <[item]>
- define matchable <[item].script.name.if_null[<[item].material.name>]>
- inventory set d:<[inventory]> slot:1 o:black_wool
- inventory set d:<[inventory]> slot:2 o:<[item]>
#- inventory set d:<[inventory]> slot:2 o:<item[novashop_confirm_purchase].with_flag[confirm]>
- inventory open d:novashop_java_custom_amt
on player prepares anvil craft item:
- if <context.inventory> matches novashop_java_custom_amt:
- inventory update
- determine passively novashop_confirm_purchase