Date: 2014/06/24 17:04:44 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
on click:
- if <player.item_in_hand> == "i@shopping bag" {
- if <in@<player.name>_shopping_bag.qty> == 0 {
- narrate "your shopping bag is empty!"
} else {
- flag player delay duration:3s
- chat "ok let's total these items up for you then!"
- define total_price 0
- foreach <in@<player.name>_shopping_bag.list_contents> {
- if <server.flag[<%value%.MATERIAL.id>]> == null {
- flag server <%value%.MATERIAL.id>:1.00
}
- define price <yaml[prices].read[prices.<%value%.MATERIAL.id>].mul[2].mul[<server.flag[<%value%.material.id>]>].mul[<%value%.qty>].as_int>
- define total_price <el@val[%total_price%].add[%price%]>
}
- if <player.money> < %total_price% {
- narrate "YOU NEED MONEYS D="
- queue clear
}
- note 'in@player bag' as:<player.name>_item_bag
- take money qty:%total_price%
- run itemgiver delay:1s
- take 'i@shopping bag'
- narrate "<green>The shopkeeper takes <red>%total_price% coins"
- narrate "<gold>You are all checked out. have a great day!"
- narrate "<red>Do not open your item bag until you are ready to take all the items out"
- foreach <in@<player.name>_shopping_bag.list_contents> {
- flag server <%value%.material.id>adjust:+:1
- run script:price_adjuster def:<%value%.material.id>
}
}
- if <player.item_in_hand> == "i@selling bag" {
- flag player delay duration:3s
- if <in@<player.name>_selling_bag.qty> == 0 {
- narrate "your selling bag is empty!"
} else if <in@<player.name>_selling_bag.contains['i@shopping bag']> {
- chat "i am sorry but i do not buy back my shopping bags."
} else {
- chat "ok let's total these items up for you then!"
- define total_price 0
- foreach <in@<player.name>_selling_bag.list_contents> {
- define price <yaml[prices].read[prices.<%value%.MATERIAL.id>].mul[<%value%.qty>].as_int>
- define total_price <el@val[%total_price%].add[%price%]>
}
- note 'in@player bag' as:<player.name>_selling_bag
- give money qty:%total_price%
- take 'i@selling bag'
- narrate "<green>The shopkeeper gives you <red>%total_price% coins"
- foreach <in@<player.name>_shopping_bag.list_contents> {
- flag server <%value%.material.id>adjust:-:1
- run script:price_adjuster def:<%value%.material.id>
}
}
- run tutorialinquiry delay:1s
tutorialinquiry:
type: task
script:
- if <player.flag[delay]> == null {
- if <player.item_in_hand> != 'i@shopping bag' || <player.item_in_hand> != 'i@selling bag' || <player.item_in_hand> != 'i@item_bag' {
- chat "if you would like to learn how to use our stores please type 'TUTORIAL'."
}
}