Date: 2016/03/24 19:24:47 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
Shops_World:
type: world
debug: false
events:
on player clicks in inventory:
else if <context.inventory.title.contains_text[Sell]> {
- determine cancelled passively
- if <context.raw_slot> > <context.inventory.size> {
- queue clear
}
- if <context.item.simple> == i@redstone {
- inventory open d:in@<context.item.lore.as_list.get[3].strip_color>
- queue clear
}
- if <context.item> != i@air {
- define payment <proc[Shop_Sell].context[<context.item.simple>|<context.item.quantity>].get[2]>
- if <player.inventory.contains.material[<context.item.material>].quantity[<context.item.quantity>]> {
# - take <player.inventory.list_contents.full.filter[material.is[==].to[grass]]>
# - if <player.inventory.quantity[<context.item.simple>]> >= <context.item.quantity> {
- foreach <player.inventory.list_contents> {
- if <def[value].material.is[=].to[<context.item.material>]> && <def[value].scriptname||null> == null {
# - if <player.inventory.list_contents.count[<def[value]>] THIS IS WHERE I NEED TO CHECK IF ITEM IS EQUIPPED
- take <def[value].full> qty:<context.item.quantity> from:<player.inventory>
- give money qty:<def[payment].as_decimal>
- if <context.item.quantity> > 1 {
- narrate "You sold <context.item.quantity> <context.item.formatted> for <&a>$<def[payment].as_money><&f>!" targets:<player>
}
else {
- narrate "You sold <context.item.formatted> for <&a>$<def[payment].as_money><&f>!" targets:<player>
}
- narrate "Balance: <&a>$<player.money>"
- queue clear
}
}
- narrate "<&c>You don't have that item to sell!"
- queue clear
}
else {
- narrate "<&c>You don't have that item to sell!"
- queue clear
}
}
}