- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2014/11/26 23:00:19 UTC-08:00
ByGuest
Other
Paste
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
104500
StorekeeperPlayerOwned:
  type: assignment
  debug: true

  default constants:
    server_price_requirment: true
    store open hour: 5
    store close hour: 18
    store greetings: li@Welcome to my store!|Feel free to look around!|Just give me a click if you need something!

  actions:

    # Just some setup of the triggers
    on remove:
    - flag server playerstore:<-:<npc.flag[playerstore]>
    on assignment:
    - trigger name:proximity toggle:true radius:30 cooldown:3s
    - trigger name:click toggle:true
    - trigger name:chat toggle:true
    - trigger name:damage toggle:true
    - flag npc cashregister:5
    on enter proximity:
    - foreach <npc.flag[playerstore].as_cuboid.list_entities> {
      - if !<def[value].has_framed_item> {
        - adjust %value% framed:<npc.flag[storeitems].get[<npc.flag[storeitemlocations].find[<def[value].location>]>]>
        }
      }

    - define name <player.name>
    - if <player.location.is_within[<npc.flag[playerstore].as_cuboid>]> {
      - flag player storekeepernpc:<npc>
      }
    - if !<npc.flag[playerstore].as_cuboid.is_within[<player.location>]> && '<player.inventory.contains[i@shopping bag]>' {
      - inventory add o:in@def[name]_shopping_bag d:<def[keeper].inventory>
      - take "i@shopping bag"
      - narrate "<dark_red>No stealing items from my store!!"
      }
    - if <player.name> == <npc.owner> && <npc.can_see[<player>]||null> && !<player.flag[greeted]||null> {
      - narrate "<dark_purple>Hello <player.name> just ask for <green>'help' <dark_purple>if you need a command refresher for your shop"
      - flag player greeted duration:5m
      } else if !<player.flag[greeted]> && <npc.can_see[<player>]||null> {
      - if !<npc.flag[greeting]||null> == null {
        - narrate "<aqua><npc.flag[greeting].random>"
        }
        else {
        - narrate "<aqua><el@val[<npc.constant[store greetings]>].as_list.random>"
        }
      - flag player greeted duration:30s
      }
    on damage:
    - define name <player.name>
    - if <player.name> == <npc.owner> {
      - narrate "<dark_purple> The balance is <green><npc.flag[cashregister].as_int||null>"
      - narrate "<dark_purple>would you like to <green>'give' <dark_purple>money to your store or <green>'take' <dark_purple>money from your store?"
      } else if '!<player.inventory.contains[i@shopping bag]>' && '!<player.inventory.contains[i@selling_bag]||>' {
      - note 'in@player bag' as:<player.name>_shopping_bag
      - animate <npc> arm_swing
      - flag player storekeepernpc:<npc>
      - narrate '<aqua>Here, have a complimentary shopping bag!'
      - give <player> 'i@shopping bag'
      } else if <player.item_in_hand> == 'i@shopping bag' && <npc.owner> == server {
      - define total_price 0
      - foreach <in@%name%_shopping_bag.list_contents> {
        - adjust %value% quantity:1 save:item2
        - if <server.flag[<entry[item2].result.full.escaped>]||null> == null {
          - flag server <entry[item2].result.full.escaped>:1.00
          }
        - adjust %value% quantity:1 save:item
        - define price <yaml[prices].read[prices.<entry[item].result.full.escaped>].mul[2].mul[<server.flag[<entry[item].result.full.escaped>]>].mul[<def[value].qty>]||null>
        - define total_price <el@val[%total_price%].add[%price%]||null>
        }
      - narrate "<aqua>Ready to check out? Just click me with your bag!"
      - narrate "<aqua>your total price is <green>%total_price%"
      } else if <player.item_in_hand> == 'i@shopping bag' {
      - define total_price 0
      - define name <player.name>
      - foreach <in@%name%_shopping_bag.list_contents> {
        - if !<npc.flag[sell_<def[value].full.escaped>].mul[<%value%.qty>]||null> == null {
          - define price <npc.flag[sell_<def[value].full.escaped>].mul[<def[value].qty>]||null>
          }
          else {
          - define price <el@val[<npc.flag[sell_<def[value].full.escaped>]>].mul[<def[value].qty>]||null>
          - define total_price <el@val[%total_price%].add[%price%]||null>
          }
        }
      - narrate "<aqua>Ready to check out? Just click me with your bag!"
      - narrate "<aqua>your total price is <green>%total_price%"
      } else if <player.item_in_hand> == 'i@selling_bag' && <npc.owner> == server {
      - define total_price 0
      - foreach <in@%name%_selling_bag.list_contents> {
        - adjust %value% quantity:1 save:item
        - define price <yaml[prices].read[prices.<entry[item].result.full.escaped>].mul[<def[value].qty>]>
        - define total_price <el@val[%total_price%].add[%price%]>
        }
      - narrate "<aqua>Ready to sell items? Just right click me with your bag!"
      - narrate "<aqua>your total price is <green>%total_price%"
      } else if <player.item_in_hand> == 'i@selling_bag' {
      - define total_price 0
      - foreach <in@%name%_selling_bag.list_contents> {
        - define price <npc.flag[buy_%value%].as_int||null>
        - define total_price <el@val[%total_price%].add[%price%]||null>
        }
      - narrate "<aqua>Ready to sell items? Just right click me with your bag!"
      - narrate "<aqua>your total price is <green>%total_price%"
      }
      else {
      - flag player storekeepernpc:n@<npc>
      }

    on chat:
    - if <context.message> == greeting && <player.name> == <npc.owner> {
      - narrate "<dark_purple>Would you like to <green>add <dark_purple>or <green>remove<dark_purple> a greeting?"
      - flag player greeting d:15s
      - narrate "<dark_purple>Your current greetings are<&co>"
      - foreach <npc.flag[greeting].as_list||null> {
          - narrate "%loop_index%=%value%"
          }
      - determine cancelled
      }
    - if <player.flag[greeting]> == true && <player.name> == <npc.owner> {
      - if <context.message> == add {
        - if <npc.flag[greeting].as_list.size||0> > 4 {
          - narrate "You cannot exceed five greetings!"
          - flag player greeting:!
          - determine cancelled
          - queue clear
          }
          else {
          - narrate "<dark_purple>Please say the greeting you would like to add to your store"
          - flag player greeting:!
          - flag player addgreeting
          - determine cancelled
          }
        }
        else if <context.message> == remove && <npc.owner> == <player.name> {
        - flag player greeting:!
        - flag player removegreeting
        - narrate "What line number would you like to remove?"
        - foreach <npc.flag[greeting].as_list||null> {
          - narrate "%loop_index%=%value%"
          }
        - determine cancelled
        }
      }
    - if <player.flag[removegreeting]||null> == true && <player.name> == <npc.owner> {
      - narrate "<npc.flag[greeting].get[<context.message>]>"
      - narrate "Has been removed"
      - flag npc greeting[<context.message>]:<-
      - flag player removegreeting:!
      - determine cancelled
      }
    - if <player.flag[addgreeting]||null> == true && <player.name> == <npc.owner> {
      - flag npc greeting:->:<context.message>
      - flag player addgreeting:!
      - narrate "<dark_purple>You added a new greeting to your list. Your new greeting is"
      - narrate "<green><context.message>"
      - determine cancelled
      }
    - if <context.message> == expand && <player.name> == <npc.owner> {
      - execute as_op "npc select"
      - flag server playerstore:<-:<npc.flag[playerstore]>
      - give i@storelocationstick
      - narrate "<dark_purple>please reselect the bottom and top corners of your cuboid then drop the selector"
      - determine cancelled
      }
    - if <context.message> == help && <player.name> == <npc.owner> {
      - narrate "<dark_purple>your shop commands are <green> Greeting, items, give, take, set, unset, expand."
      - narrate "<dark_purple>Click the npc with an item to set a price for it"
      - narrate "<dark_purple>Right click the npc without an item to view inventory for the store"
      - determine cancelled
      }
    - if <context.message> == items && <player.name> == <npc.owner> {
      - if <npc.flag[buyback]||null> == null {
        - narrate "<aqua>No items have been sold to your shop"
        }
        else {
        - give <npc.flag[buyback]>
        - flag npc buyback:!
        - determine cancelled
        }
      }
    - if <player.flag[givingtocashregister]||null> == true && <player.name> == <npc.owner> {
      - flag npc cashregister:+:<context.message>
      - take money qty:<context.message>
      - narrate "<dark_purple>You give <green><context.message> <dark_purple>to the cash register. The balance is now <green><npc.flag[cashregister].as_int||null>"
      - flag player givingtocashregister:!
      - determine cancelled
      }
    - if <context.message> == give && <player.name> == <npc.owner> {
      - flag player givingtocashregister
      - narrate "<dark_purple>How much would you like to give to the store?"
      - determine cancelled
      }
    - if <context.message> == take && <player.name> == <npc.owner> {
      - flag player takingfromcashregister
      - narrate "<dark_purple>How much would you like to take from the store?"
      - determine cancelled
      }
    - if <player.flag[takingfromcashregister]||null> == true && <player.name> == <npc.owner> {
      - if <npc.flag[cashregister]> > <context.message> {
        - flag npc cashregister:-:<context.message>
        - give money qty:<context.message>
        - narrate "<dark_purple>You take <green><context.message> <dark_purple>from the cash register. The balance is now <green><npc.flag[cashregister].as_int||null>"
        - flag player takingfromcashregister:!
        - determine cancelled
        }
        else if <npc.flag[cashregister]||null> < <context.message> {
        - narrate "<dark_red>You havnt got that much money in your cashregister!"
        }
      }
    - if <context.message> == unset && <player.name> == <npc.owner> {
      - flag server playerstore:<-:<npc.flag[playerstore]>
      - narrate "<dark_red>your store is now unprotected! tell the npc to 'set' the store back up when you are done editing"
      - determine cancelled
      }
    - if <context.message> == sell {
      - if <npc.owner> == server {
        - note 'in@selling bag' as:<player.name>_selling_bag
        - animate <npc> arm_swing
        - narrate '<aqua>Here is your item selling bag!'
        }
        else {
        - note 'in@player bag' as:<player.name>_selling_bag
        - animate <npc> arm_swing
        - narrate '<aqua>Here is your item selling bag!'
        - narrate "<aqua>We buy the following items that you have"
        - foreach <player.inventory.list_contents.simple> {
          - if !<npc.flag[buy_<%value%.full.escaped>]||null> == null {
            - if <%value%.display||null> == null {
              - narrate "<aqua>We buy <green><%value%.material.name||null> <aqua>for <green><npc.flag[buy_<%value%.escaped||null>]||null> coins a piece"
              }
              else {
              - narrate "<aqua>We buy <green><%value%.display||null> <aqua>for <green><npc.flag[buy_<%value%.full.escaped||null>]||null> coins a piece"
              }
            }
          }
        }
      - drop 'i@selling_bag' <npc.location.add[<npc.location.direction.vector.mul[2]||null>].add[0,1,0]||null>
      - determine cancelled
      }
    - if <context.message> == set && <player.name> == <npc.owner> && !<server.flag[playerstore].as_list||null> contains <npc.flag[playerstore]||null> {
      - narrate "<&b>your store is now open for business!"
      - flag npc stock:!
      - flag server playerstore:->:<npc.flag[playerstore]||null>
      - flag npc storeitems:!
      - foreach <npc.flag[playerstore].as_cuboid.list_entities||null> {
        - if <def[value].entity_type> == item_frame {
          - flag npc storeitems:->:<def[value].framed_item||null>
          - flag npc storeitemlocations:->:<def[value].location||null>
          }
        }
      - wait 1t
      - foreach <npc.flag[playerstore].as_cuboid.get_blocks[m@chest,5|m@chest,4|m@chest,3|m@chest,2]||null> {
        - flag npc stock:->:<def[value].inventory||null>
        }
      - flag npc stock:->:<npc.inventory>
      - determine cancelled
      }
    - if <context.message> == buying && <player.name> == <npc.owner> {
      - if <npc.constant[server_price_requirment]> == true {
        - narrate "<dark_purple>please set a price below <green><yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> <dark_purple>for that item."
        - flag player settype:buy
        - determine cancelled
        }
        else {
        - flag player settype:buy
        - narrate "<dark_purple>please set a price for that item"
        - determine cancelled
        }
      }
    - if <context.message> == selling && <player.name> == <npc.owner> {
      - if <npc.constant[server_price_requirment]||false> == true {
        - narrate "<dark_purple>please set a price above <green><yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> <dark_purple>for that item."
        - flag player settype:sell
        - determine cancelled
        }
        else {
        - flag player settype:sell
        - narrate "<dark_purple>please set a price for that item"
        - determine cancelled
        }
      }
    - if !<npc.flag[currentitem]||null> == null && <player.name> == <npc.owner> {
      - if <player.flag[settype]||null> == buy && <npc.constant[server_price_requirment]||false> == true {
        - if <context.message> > <yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> && <context.message.is[matches].to[integer]||false> {
          - narrate "<dark_red>your price needs to be below the base price. this price will not be set for this item."
          - flag npc currentitem:!
          - flag player settype:!
          - determine cancelled
          }
          else if <context.message> < <yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> && <context.message.is[matches].to[integer]||false> {
          - flag npc <player.flag[settype]||null>_<npc.flag[currentitem]||null>:<context.message>
          - if <npc.flag[currentitem].unescaped.display||null> == null {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.as_item.material.name||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
            else {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.display||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
          - flag npc currentitem:!
          - flag player settype:!
          - determine cancelled
          }
          else {
          - narrate "<dark_red>That doesnt not match a valid number! please set a proper number for a price"
          - determine cancelled
          }
        }
      }
    - if !<npc.flag[currentitem]||null> == null && <player.name> == <npc.owner> {
      - if <player.flag[settype]||null> == sell && <npc.constant[server_price_requirment]||null> == true {
        - if <context.message> < <yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> && <context.message.is[matches].to[integer]||false> {
          - narrate "<dark_red>your price needs to be above the base price. this price will not be set for this item."
          - flag npc currentitem:!
          - flag player settype:!
          - determine cancelled
          }
          else if <context.message> > <yaml[prices].read[prices.<npc.flag[currentitem]||null>]||null> && <context.message.is[matches].to[integer]||false> {
          - flag npc <player.flag[settype]||null>_<npc.flag[currentitem]||null>:<context.message>
          - if <npc.flag[currentitem].unescaped.display||null> == null {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.as_item.material.name||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
            else {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.display||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
          - flag npc currentitem:!
          - flag player settype:!
          - determine cancelled
          }
          else {
          - narrate "<dark_red>That doesn not match a valid number! please set a proper number for a price"
          - determine cancelled
          }
        }
      }
    - if !<npc.flag[currentitem]> == null && <player.name> == <npc.owner> {
      - if !<npc.constant[server_price_requirment]||false> == true {
        - if <context.message.is[matches].to[integer]||false> {
          - flag npc <player.flag[settype]||null>_<npc.flag[currentitem]||null>:<context.message>
          - if <npc.flag[currentitem].unescaped.display||null> == null {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.material.name||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
            else {
            - narrate "<dark_purple><npc.flag[currentitem].unescaped.display||null> <player.flag[settype]||null> price is now set to <green><context.message>"
            }
          - flag npc currentitem:!
          - flag player settype:!
          - determine cancelled
          }
          else {
          - narrate "<dark_red>That is not a valid number. please select a valid number for the price"
          - determine cancelled
          }
        }
    on click:
    - define name <player.name>
    - if <player.name> == <npc.owner> && !<player.item_in_hand> == i@air {
      - adjust <player.item_in_hand> quantity:1 save:item8
      - flag npc currentitem:<entry[item8].result.full.escaped>
      - narrate "<dark_purple>will you be <green>'selling' <dark_purple>or <green>'buying' <dark_purple>for this item?"
      - queue clear
      - determine cancelled
      }
      else if <player.name> == <npc.owner> && <player.item_in_hand> == i@air {
      - inventory open d:<npc.inventory>
      }

    - if <player.item_in_hand> == "i@shopping bag" {
      - if <in@%name%_shopping_bag.qty> == 0 {
        - narrate "<aqua>your shopping bag is empty!"
        } else if <npc.owner> == server {
        - flag player delay duration:3s
        - chat "ok let's total these items up for you then!"
        - define total_price 0
        - foreach <in@%name%_shopping_bag.list_contents> {
          - adjust %value% quantity:1 save:item2
          - if <server.flag[<entry[item2].result.full.escaped>]||null> == null {
            - flag server <entry[item2].result.full.escaped>:1.00
            }
          - adjust %value% quantity:1 save:item
          - define price <yaml[prices].read[prices.<entry[item].result.full.escaped||null>].mul[2].mul[<server.flag[<entry[item].result.full.escaped||null>]||null>].mul[<%value%.qty||null>]>
          - define total_price <el@val[%total_price%].add[%price%]||null>
          }
        - if <player.money> < %total_price% {
          - narrate "<dark_red>YOU NEED MONEYS D="
          - queue clear
          }
        - flag player bagnumber:+:1
        - note "in@player bag" "as:<player.name> <player.flag[bagnumber].as_int>_item_bag"
        - take money qty:%total_price%
        - run "itemgiverPlayer Owned" delay:1s
        - take 'i@shopping bag'
        - narrate "<aqua>The shopkeeper takes <green>%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@%name%_shopping_bag.list_contents.full.escaped> {
          - adjust %value% quantity:1 save:item9
          - flag server <entry[item9].result>adjust:+:<def[value].qty>
          - run script:price_adjuster def:<entry[item9].result>
          }
        }
        else {
        - flag player delay duration:3s
        - chat "ok let's total these items up for you then!"
        - define total_price 0
        - foreach <in@%name%_shopping_bag.list_contents> {
          - adjust %value% quantity:1 save:item2
          - if <server.flag[<<entry[item2].result>.full.escaped>]> == null {
            - flag server <<entry[item2].result>.full.escaped>:1.00
            }
          - define price <el@val[<npc.flag[sell_<entry[item2].result.full.escaped>]>].mul[<%value%.qty>]>
          - define total_price <el@val[%total_price%].add[%price%]>
          }
        - if <player.money> < %total_price% {
          - narrate "<dark_red>YOU NEED MONEYS D="
          - queue clear
          }
        - if <npc.inventory.list_contents.simple> contains <in@<player.name>_shopping_bag.list_contents.simple> {
          - narrate "<aqua>I am sorry but we just ran out of some of those items!"
          - queue clear
          }
        - flag player bagnumber:+:1
        - note "in@player bag" "as:<player.name> <player.flag[bagnumber].as_int>_item_bag"
        - take money qty:%total_price%
        - flag npc cashregister:+:%total_price%
        - run "itemgiverPlayer Owned" delay:1s
        - take 'i@shopping bag'
        - narrate "<aqua>The shopkeeper takes <green>%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@%name%_shopping_bag.list_contents.full.escaped> {
          - adjust %value% quantity:1 save:item9
          - flag server <entry[item9].result>adjust:+:<def[value].qty>
          - run script:price_adjuster def:<entry[item9].result>
          }
        }
      } else if <player.item_in_hand> == "i@selling_bag" {
      - flag player delay duration:3s
      - if <in@%name%_selling_bag.qty> == 0 {
        - narrate "<dark_red>your selling bag is empty!"
        }
        else if <in@%name%_selling_bag.contains['i@shopping bag']> {
        - chat "i am sorry but i do not buy back my shopping bags."
        }
        else if <npc.owner> == server {
        - chat "ok let's total these items up for you then!"
        - define total_price 0
        - foreach <in@%name%_selling_bag.list_contents> {
          - adjust %value% quantity:1 save:item
          - define price <yaml[prices].read[prices.<entry[item].result.full.escaped>].mul[<def[value].qty>]||null>
          - define total_price <el@val[%total_price%].add[%price%]||null>
          }
        - note as:<player.name>_selling_bag remove
        - give money qty:%total_price%
        - take 'i@selling_bag'
        - narrate "<aqua>The shopkeeper gives you <green>%total_price% coins"
        - foreach <in@%name%_shopping_bag.list_contents.full.escaped> {
          - adjust %value% quantity:1 save:item9
          - flag server <entry[item9].result>adjust:-:<def[value].qty>
          - run script:price_adjuster def:<entry[item9].result>
          }
        - queue clear
        }
        else {
        - chat "ok let's total these items up for you then!"
        - define total_price 0
        - foreach <in@%name%_selling_bag.list_contents> {
          - adjust %value% quantity:! save:item
          - define price <el@val[<npc.flag[buy_<def[item].full.escaped>]>].mul[<def[value].qty>]>
          - define total_price <el@val[%total_price%].add[%price%]||null>
          }
        - if %total_price% < <npc.flag[wallet].as_int||null> {
          - flag npc buyback:->:<in@%name%_selling_bag.list_contents>
          - note 'in@player bag' as:<player.name>_selling_bag
          - give money qty:%total_price%
          - flag npc cashregister:-:%total_price%
          - take 'i@selling_bag'
          - narrate "<aqua>The shopkeeper gives you <green>%total_price% coins"
          - foreach <in@%name%_shopping_bag.list_contents.full.escaped> {
            - adjust %value% quantity:1 save:item9
            - flag server <entry[item9].result>adjust:-:<def[value].qty>
            - run script:price_adjuster def:<entry[item9].result>
            }
          - queue clear
          }
          else {
          - narrate "<aqua>I am sorry I don't have the funds to buy all of that back!"
          }
        }
      }
      else if <player.inventory> contains 'i@shopping bag' || <player.inventory> contains 'i@selling_bag' {
      - queue clear
      }
      else if <player.name> == <npc.owner> {
      - queue clear
      }
      else {
      - chat "Please visit http://youtu.be/2f3Dk4cPCXs for a short tutorial of how to use our stores."
      }
    }

itemgiverPlayer Owned:
  type: task
  debug: true
  script:
  - define name <player.name>
  - inventory add o:in@%name%_shopping_bag 'd:in@<player.name> <player.flag[bagnumber].as_int>_item_bag'
  - ^adjust 'i@item_bag' "lore:<player.name> <player.flag[bagnumber].as_int>" save:playersbag
  - give <entry[playersbag].result.full>
Item Frame Shop Player Owned:
  type: world
  debug: true
  constants:
    permission_for_prices: null
  events:
    on server start:
    - yaml load:prices.yml id:prices
    on price command:
    - if <player.is_op> {
      - adjust <player.item_in_hand.full> quantity:1 save:item3
      - if !<yaml[prices].contains[prices.<entry[item3].result.full.escaped>]||null> {
        - flag player setpriceserver:<entry[item3].result.full.escaped>
        - narrate "<dark_purple>what is the base price you want for that item?"
        - determine cancelled
        }
        else {
        - narrate "<dark_purple>That item already has a current price of <green><yaml[prices].read[prices.<entry[item3].result.full.escaped>]||null>"
        - narrate "<dark_purple>To adjust that items price use the /adjust_price command"
        - determine cancelled
        }
      }
    on adjust_price command:
    - adjust <player.item_in_hand.full> quantity:1 save:item3
    - yaml id:prices set prices.<entry[item3].result.full.escaped>:!
    - flag player setpriceserver:<entry[item3].result.full.escaped>
    - narrate "<dark_purple>what is the base price you want for that item?"
    - determine fulfilled
    on player chats:
    - if <player.is_op> && !<player.flag[setpriceserver]||null> == null {
      - if <context.message.is[matches].to[integer]||false> {
        - yaml id:prices set prices.<player.flag[setpriceserver]>:<context.message>
        - yaml savefile:prices.yml id:prices
        - narrate "<dark_purple><player.flag[setpriceserver].unescaped.display> price is now set to <green><yaml[prices].read[prices.<player.flag[setpriceserver]>]||null>"
        - flag setpriceserver:!
        - determine cancelled
        }
        else {
        - narrate "<dark_red>That is not a valid number"
        - narrate "<dark_purple>what is the base price you want for that item?"
        - determine cancelled
        }
      }
    on stop command:
    - foreach <server.flag[storenpcs].as_list> {
      - flag %value% playerstoreinventory:<def[value].inventory.list_contents>
      }
    on player teleports:
    - if '!<player.inventory.contains[i@shopping bag]||null>' {
      - queue clear
      }
      else if '<player.inventory.contains[i@shopping bag]>' {
      - inventory add o:in@<player.name>_shopping_bag d:<player.flag[storekeepernpc].inventory>
      - take "i@shopping bag"
      - narrate "<dark_red>No stealing items from my store!!"
      }
    on player quits:
    - if '<player.inventory.contains[i@shopping bag]>' {
      - inventory add o:in@<player.name>_shopping_bag d:<player.flag[storekeepernpc].as_npc.inventory>
      - take "i@shopping bag"
      - narrate "<dark_red>No stealing items from my store!!"
      }
    on store_setup command:
    - give <player> i@playerstorekeeperegg
    - determine fulfilled
    on player clicks with i@playerstorekeeperegg:
    - if <global.flag[playerstore].escape_contents||null> == null {
      - create player storekeeper <player.location.cursor_on.add[0.5,1,0.5]>
      - execute as_op "npc select"
      - narrate "<dark_purple>please select the bottom and top corners of your cuboid then drop the selector"
      - take i@playerstorekeeperegg
      - lookclose <player.selected_npc> state:true
      - wait 1t
      - assignment set npc:<player.selected_npc> script:StorekeeperPlayerOwned
      - give <player> "i@storelocationstick"
      - queue clear
      }
    - foreach <global.flag[playerstore].escape_contents> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - narrate "you cannot place your store inside of someone another store"
        - determine cancelled
        }
      }
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if !<def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - create player storekeeper <player.location.cursor_on.add[0.5,1,0.5]>
        - execute as_op "npc select"
        - narrate "<dark_purple>please select the bottom and top corners of your cuboid then drop the selector"
        - take i@playerstorekeeperegg
        - lookclose <player.selected_npc> state:true
        - wait 1t
        - assignment set npc:<player.selected_npc> script:StorekeeperPlayerOwned
        - give <player> "i@storelocationstick"
        - queue clear
        }
      }
    on item_frame damaged by entity_explosion:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.entity.location>]||null> {
        - determine cancelled
        }
      }
    on item_frame damaged by block_explosion:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.entity.location>]||null> {
        - determine cancelled
        }
      }
    on player right clicks with i@storelocationstick:
    - if <global.flag[playerstore].escape_contents||null> == null {
      - flag player location1:<context.location>
      - narrate "<dark_purple>Cuboid location 1 selected"
      - determine passively cancelled
      - wait 1t
      - showfake m@red_wool <c.location> to:<player> d:10s
      }
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - determine cancelled
        }
        else {
        - flag player location1:<context.location>
        - narrate "<dark_purple>Cuboid location 1 selected"
        - determine passively cancelled
        - wait 1t
        - showfake m@red_wool <c.location> to:<player> d:10s
        }
      }
    on player left clicks with i@storelocationstick:
    - if <global.flag[playerstore].escape_contents||null> == null {
      - flag player location2:<context.location>
      - narrate "<dark_purple>Cuboid location 2 selected"
      - determine passively cancelled
      - wait 1t
      - showfake m@red_wool <c.location> to:<player> d:10s
      }
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]> {
        - determine cancelled
        }
        else {
        - flag player location2:<context.location>
        - narrate "<dark_purple>Cuboid location 2 selected"
        - determine passively cancelled
        - wait 1t
        - showfake m@red_wool <c.location> to:<player> d:10s
        }
      }
    on player drops i@storelocationstick:
    - execute as_op "npc owner <player.name> --id <player.selected_npc.id>"
    - flag <player.selected_npc> playerstore:cu@<player.flag[location1]>|<player.flag[location2]>
    - flag player location1:!
    - flag player location2:!
    - flag server storenpcs:->:<npc>
    - narrate "<dark_purple>tell the npc <green>'SET' <dark_purple>to set the items in the frame"
    - determine passively cancelled
    - wait 1t
    - take i@storelocationstick
    on player right clicks e@item_frame:
    - define name <player.name>
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - determine passively cancelled
        - if <player.item_in_hand.scriptname> == 'shopping bag' {
          - if <in@%name%_shopping_bag.stacks> >= 18 {
            - narrate "<aqua>Your shopping bag is full!"
            } else if <player.flag[storekeepernpc].as_npc.owner> == server && <yaml[prices].read[prices.<context.entity.framed_item.full.escaped>]||null> == null {
            - foreach <server.list_online_players> {
              - if !'<def[value].has_permission[<script.constant[permission_for_prices]>]||null>' == null {
                - narrate "<red>Warning<&co><dark_purple><c.entity.framed_item> has no price! please set a price for this item by holding it in your hand ant typing /price" target:%value%
                }
                else if !<server.flag[pricemessage].contains[<c.entity.framed_item>]> {
                - flag server pricemessage:->:<c.entity.framed_item>
                }
              }
            - narrate "<dark_red>This item has no price. please contact the servers administrators to let them know"
            - determine cancelled
            }
            else if <player.flag[storekeepernpc].as_npc.owner> == server {
            - inventory add o:<c.entity.framed_item> d:in@<player.name>_shopping_bag
            - if <c.entity.framed_item.display||null> != null {
              - narrate "<aqua>You add a <green><c.entity.framed_item.display> <aqua>to your shopping bag."
              }
              else {
              - narrate "<aqua>You add <green><c.entity.framed_item.material.name.replace[_].with[ ]> <aqua>to your shopping bag."
              - playsound <player> sound:DIG_GRASS
              }
            }
            else if <player.flag[storekeepernpc].as_npc.flag[sell_<context.entity.framed_item.full.escaped>]||null> == null {
            - if <player.flag[storekeepernpc].as_npc.owner.as_player.is_online> == true {
              - narrate "<red>Warning<&co><dark_purple><context.entity.framed_item.display.name||<context.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>> does not have a price set for it! Please set a price in your shop for this item" targets:<player.flag[storekeepernpc].as_npc.owner.as_player>
              }
              else {
              - if <player.flag[storekeepernpc].as_npc.owner.as_player.flag[storepricemessage].contains[<context.entity.framed_item>]||true> {
                - flag <player.flag[storekeepernpc].as_npc.owner.as_player> "storepricemessage:->:<context.entity.framed_item.display||<c.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>>"
                }
              }
            - narrate "<dark_red>This item has no price and cannot be sold till a price is set for it."
            - determine cancelled
            }
            else { 
            - foreach <player.flag[storekeepernpc].as_npc.flag[stock].as_list> {
              - if <def[value].contains[<context.entity.framed_item>]> {
                - inventory add o:<c.entity.framed_item> d:in@<player.name>_shopping_bag
                - take <c.entity.framed_item> from:<def[value]>
                - narrate "<aqua>You add a <green><context.entity.framed_item.display.name||<context.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>> <aqua>to your shopping bag."
                - playsound <player> sound:DIG_GRASS
                - define true true
                - foreach stop
                }
              - if %loop_index% == <player.flag[storekeepernpc].as_npc.flag[stock].as_list.size> && <def[true]||false> == false {
                - if <player.flag[storekeepernpc].as_npc.owner.as_player.is_online> == true {
                  - narrate "<red>Warning<&co><dark_purple><context.entity.framed_item.display.name||<context.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>> is out of stock! Please restock this item." targets:<player.flag[storekeepernpc].as_npc.owner.as_player>
                  }
                  else {
                  - if <player.flag[storekeepernpc].as_npc.owner.as_player.flag[storestockmessage].contains[<context.entity.framed_item>]||true> {
                    - flag <player.flag[storekeepernpc].as_npc.owner.as_player> "storestockmessage:->:<context.entity.framed_item.display||<c.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>>"
                    }
                  }
                - narrate "<dark_red>That item is out of stock! Please check back later"
                }
              }
            }
          - determine cancelled
          }
        }
      }
    on player places block:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - if <player.is_sneaking> && <player.is_op> {
          - queue clear
          }
          else {
          - determine cancelled
          }
        }
      }
    on player breaks e@item_frame:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - if <player.is_sneaking> && <player.is_op> {
          - queue clear
          }
          else {
          - if <c.hanging.framed_item.display||null> != null {
            - narrate "It's a <c.hanging.framed_item.display>."
            }
            else {
            - narrate "It's <c.hanging.framed_item.material.formatted>."
            }
          - narrate "Right click it with your shopping bag to add it to your transaction."
          - determine cancelled
          }
        }
      }

    on player breaks block:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]||null> {
        - if <player.is_sneaking> && <player.is_op> {
          - queue clear
          } else {
          - determine cancelled
          }
        - if <player.flag[storekeeper_warned]||null> == null {
            - narrate '<aqua>[storekeeper] -> You<&co> <dark_red>Hey! <aqua>You break it, you buy it! <dark_red>Be careful!'
            - flag <player> storekeeper_warned duration:5s
          }
        }
      }

    on entity damages e@item_frame:
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.entity.location>]||null> {
        - if <player.is_sneaking> && <player.is_op> {
          - queue clear
          }
          else {
          - foreach <global.flag[playerstore].escape_contents||null> {
            - if <def[value].unescaped.as_cuboid.is_within[<context.entity.location>]||null> {
              - if <server.flag[<context.entity.framed_item.full.escaped>]||null> == null {
                - flag server <context.entity.framed_item.full.escaped>:1.00
                - determine cancelled
                } else if <player.flag[storekeepernpc].as_npc.owner> == server && <yaml[prices].read[prices.<context.entity.framed_item.full.escaped>]||null> == null {
                - foreach <server.list_online_players> {
                  - if !'<def[value].has_permission[<script.constant[permission_for_prices]>]||null>' == null {
                    - narrate "<red>Warning<&co><dark_purple><c.entity.framed_item> has no price! please set a price for this item by holding it in your hand ant typing /price" target:%value%
                    }
                    else if !<server.flag[pricemessage].contains[<c.entity.framed_item>]> {
                    - flag server pricemessage:->:<c.entity.framed_item>
                    }
                  }
                - narrate "<dark_red>This item has no price. please contact the servers administrators to let them know"
                - determine cancelled
                }
                else if <player.flag[storekeepernpc].as_npc.owner> == server {
                - define price <yaml[prices].read[prices.<context.entity.framed_item.full.escaped>].mul[2].mul[<server.flag[<context.entity.framed_item.full.escaped>]>].as_int||null>
                - narrate "<green>%price%"
                - determine cancelled
                }
                else if <player.flag[storekeepernpc].as_npc.flag[sell_<context.entity.framed_item.full.escaped>]||null> == null {
                - if <player.flag[storekeepernpc].as_npc.owner.as_player.is_online> == true {
                  - narrate "<red>Warning<&co><dark_purple><context.entity.framed_item.display.name||<context.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>> does not have a price set for it! Please set a price in your shop for this item" targets:<player.flag[storekeepernpc].as_npc.owner.as_player>
                  }
                  else {
                  - if <player.flag[storekeepernpc].as_npc.owner.as_player.flag[storepricemessage].contains[<context.entity.framed_item>]||true> {
                    - flag <player.flag[storekeepernpc].as_npc.owner.as_player> "storepricemessage:->:<context.entity.framed_item.display||<c.entity.framed_item.scriptname||<context.entity.framed_item.material.name>>>"
                    }
                  }
                - narrate "<dark_red>This item has no price and cannot be sold till a price is set for it."
                - determine cancelled
                }
                else {
                - define price <player.flag[storekeepernpc].as_npc.flag[sell_<context.entity.framed_item.full.escaped>]||null>
                - narrate "<green>%price%"
                - determine cancelled
                }
              }
            }
          }
        }
      }

    on player joins:
    - if !<player.flag[storepricemessage]||null> == null {
      - wait 5s
      - foreach <player.flag[storepricemessage].as_list> {
        - wait 3t
        - narrate "<red>Warning<&co><dark_purple>%value% does not have a price set for it! Please set a price in your shop for this item"
        - flag player storepricemessage:<-:%value%
        }
      }
    - if !<player.flag[storestockmessage]||null> == null {
      - wait 8s
      - foreach <player.flag[storestockmessage].as_list> {
        - wait 3t
        - narrate "<red>Warning<&co><dark_purple>%value% is out of stock! Please restock this item."
        - flag player storestockmessage:<-:%value%
        }
      }
    - if '<player.has_permission[<script.constant[permission_for_prices]>]>' {
      - wait 12s
      - foreach <server.flag[pricemessage].as_list> {
        - narrate "<red>Warning<&co><dark_purple>%value% has no price! please set a price for this item by holding it in your hand and typing /price"
        - flag server pricemessage:<-:%value%
        }
      }
    on player right clicks entity with i@shopping bag:
    - if <context.entity.is_npc||null> {
      - flag player shopkeeper:<npc>
      }
    on player places item_frame:
    - foreach <global.flag[playerstore].escape_contents> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]> {
        - if <player.is_sneaking> && <player.is_op> {
          - queue clear
          }
          else {
          - determine cancelled
          }
        }
      }
    on player right clicks with i@shopping bag:
    - define name <player.name>
    - define is_shopping false
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <player.location.is_within[<def[value].unescaped>]> {
        - define is_shopping true
        - foreach stop
        }
      }
    - if !<player.inventory.qty[i@shopping bag]> >= 2 {
      - take 'i@shopping bag' qty:36
      - note 'in@player bag' as:<player.name>_shopping_bag
      }
    - if !%is_shopping% {
      - inventory clear d:in@<player.name>_shopping_bag
      - take 'i@shopping bag'
      - narrate '<dark_red>You are not shopping right now!'
      }
      else if in@<player.name>_shopping_bag == null && %is_shopping% {
      - note 'in@player bag' as:<player.name>_shopping_bag
      }
      else if %is_shopping% {
      - narrate '<aqua>You take a look in your shopping bag...'
      - inventory open d:in@<player.name>_shopping_bag
      }
    - determine cancelled

    on player right clicks with i@selling_bag:
    - define name <player.name>
    - define is_shopping false
    - foreach <global.flag[playerstore].escape_contents||null> {
      - if <player.location.is_within[<def[value].unescaped>]> {
        - define is_shopping true
        - foreach stop
        }
      }
    - if !%is_shopping% {
      - define name <player.name>
      - foreach <in@%name%_selling_bag.list_contents> {
        - drop %value% <player.location>
        }
      - inventory clear d:in@<player.name>_selling_bag
      - narrate '<dark_red>You are not in a shop right now!'
      - take 'i@selling_bag'
      - determine cancelled
      }
      else if <in@%name%_shopping_bag||null> == null && %is_shopping% {
      - note 'in@player bag' as:<player.name>_selling_bag
      - inventory open d:in@<player.name>_selling_bag
      - determine cancelled
      }
      else if %is_shopping% {
      - inventory open d:in@<player.name>_selling_bag
      - determine cancelled
      }
    - determine cancelled

    on player right clicks with i@item_bag:
    - foreach <global.flag[playerstore].escape_contents> {
      - if <def[value].unescaped.as_cuboid.is_within[<context.location>]> && <player.location.facing[<player.flag[shopkeeper]>]> {
        }
        else {
        - narrate '<aqua>You take a look in your shopping bag...'
        - inventory open "d:in@<context.item.lore.as_string.strip_color>_item_bag"
        }
      - determine cancelled
      }
    on player drops i@shopping bag:
    - narrate '<aqua>You ditch your shopping bag.'
    - if !<player.flag[storekeepernpc].as_npc.owner> == server {
      - inventory add o:in@<player.name>_shopping_bag 'd:<player.flag[storekeepernpc].as_npc.inventory>'
      }
    - determine passively cancelled
    - wait 1t
    - take 'i@shopping bag'
    on player drops i@selling_bag:
    - define name <player.name>
    - foreach <in@%name%_selling_bag.list_contents> {
      - drop %value% <player.location>
      }
    - narrate '<aqua>You ditch your selling bag.'
    - note in@<player.name>_selling_bag remove
    - determine passively cancelled
    - wait 1t
    - take 'i@selling_bag'
    on player clicks in inventory:
    - define name <player.name>
    - if <c.inventory> == 'in@<player.name>_shopping_bag' && <player.item_in_hand> == 'i@shopping bag' {
      - determine passively cancelled
      - inventory update d:<player.inventory>
      }
    - if <c.inventory> == 'in@<player.name>_shopping_bag' && <player.item_in_hand> == 'i@shopping bag' {
      - if <context.is_shift_click> {
        - determine passively cancelled
        - inventory update d:<player.inventory>
        }
      }
    - if <c.inventory> == 'in@<player.name>_selling_bag' {
      - if "li@i@shopping bag|i@selling_bag|i@item_bag" contains <context.item> {
        - inventory update
        - determine cancelled
        }
      }
    on player picks up i@shopping bag:
    - if '<player.inventory.contains[i@shopping bag]>' {
      - determine cancelled
      }
      else {
      - note 'in@player bag' as:<player.name>_shopping_bag
      - narrate "<aqua>You pick up a brand new shopping bag. It's empty!"
      }

    on player closes inventory:
    - if <player.item_in_hand> == 'i@item_bag' {
      - if <context.inventory> == <player.inventory> {
        }
        else {
        - define item <player.item_in_hand.lore.as_string.strip_color>
        - foreach <in@%item%_item_bag.list_contents> {
          - drop %value% <player.location>
          }
        - narrate "<dark_red>your shopping bag ripped"
        - take iteminhand
        }
      }

    on player picks up i@playerstorekeeperegg:
    - narrate "<aqua>To learn how to set up the frame shop please visit <green>https://www.youtube.com/watch?v=FlYEog5-KxU"
    on player clicks i@playerstorekeeperegg in inventory:
    - narrate "<aqua>To learn how to set up the frame shop please visit <green>https://www.youtube.com/watch?v=FlYEog5-KxU"
'player bag':
  type: inventory
  size: 18

  # It's empty!
'selling bag':
  type: inventory
  size: 18

'shopping bag':
  type: item
  material: boat
  display name: shopping bag
  lore:
  - Give this to a shopkeeper to check out
  - by right clicking him with it.
  - Right click to see the contents.
  - Left click the shopkeeper to see the price.

'item_bag':
  type: item
  material: boat
  display name: item bag
  lore:
  - <red>this bag contains the items you bought

'selling_bag':
  type: item
  material: boat
  lore:
  - <green>Right click the shopkeeper with this bag to sell the items in it.
  - <green>Left click the shopkeeper with this bag to see what the
  - <green>total price of your items will be.

storelocationstick:
  type: item
  material: m@iron_hoe
  display name: store_selector_tool

playerstorekeeperegg:
  type: item
  material: m@monster_egg
  display name: shop_keeper



RawRaw



Pastes made: 57256