Paste #62479: Untitled Paste

Date: 2019/12/02 15:18:56 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


mSurvivalShopCommand:
  type: command
  name: shop
  usage: /shop
  description: opens a shop gui
  script:
  - inventory open d:mSurvivalShop

mSurvivalShop:
  type: inventory
  debug: false
  title: Shop
  size: 54
  procedural items:
  - determine <s@mSurvivalShopList.yaml_key[items]>
  definitions:
    filler: gray_stained_glass_pane
  slots:
  - "[filler] [filler] [filler] [filler] [questionmark] [filler] [filler] [filler] [filler]"
  - "[filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler]"
  - "[filler] [] [] [] [] [] [] [] [filler]"
  - "[filler] [] [] [] [] [] [] [] [filler]"
  - "[filler] [filler] [filler] [] [] [] [filler] [filler] [filler]"
  - "[filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler] [filler]"

questionmark:
  type: item
  debug: false
  material: "i@player_head[display_name=<&f><&l>How to use;skull_skin=Jep|eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmFkYzA0OGE3Y2U3OGY3ZGFkNzJhMDdkYTI3ZDg1YzA5MTY4ODFlNTUyMmVlZWQxZTNkYWYyMTdhMzhjMWEifX19|wot]"
  lore:
  - "<&e>Left-click <&f>to buy"
  - "<&e>Shift Left-click <&f>to buy 32x"
  - ""
  - "<&e>Right-click <&f>to sell"
  - "<&e>Shift Right-click <&f>to sell 32x"
  price: 1000

mSurvivalShopEvent:
  type: world
  debug: false
  events:
    on player opens mSurvivalShop:
    - playsound <player> sound:BLOCK_CHEST_OPEN volume:0.5
    on player closes mSurvivalShop:
    - playsound <player> sound:BLOCK_CHEST_OPEN volume:0.5 pitch:0.8
    on player drags in mSurvivalShop:
    - determine cancelled
    on player clicks in mSurvivalShop:
    - if <context.clicked_inventory> != in@mSurvivalShop:
      - determine cancelled
    - if <context.item> == i@gray_stained_glass_pane:
      - determine cancelled
    - determine cancelled passively
    - choose <context.click>:
      - case "LEFT":
        - playsound <player> sound:BLOCK_STONE_BUTTON_CLICK_ON volume:0.5
        - if <player.money> >= <context.item.script.yaml_key[price]>:
          - narrate "You bought <&9><context.item.formatted> <&f>for <&9>$<context.item.script.yaml_key[price]>"
          - take money quantity:<context.item.script.yaml_key[price]>
          - give <context.item.script.yaml_key[material]>
        - else:
          - narrate "<&c>You don't have enough money to buy <context.item.formatted>"
      - case "RIGHT":
        - playsound <player> sound:BLOCK_STONE_BUTTON_CLICK_ON volume:0.5 pitch:0.8
        - if <player.inventory.contains[<context.item.script.yaml_key[material]>]>:
          - take <context.item.script.yaml_key[material]>
          - narrate "You sold <&9><context.item.formatted> <&f>for <&9>$<context.item.script.yaml_key[price].mul[0.85]>"
          - give money quantity:<context.item.script.yaml_key[price].mul[0.85]>
        - else:
          - narrate "<&c>You don't have <context.item.formatted> in your inventory"
      - case "SHIFT_LEFT":
        - playsound <player> sound:BLOCK_STONE_BUTTON_CLICK_ON volume:0.5
        - if <player.money> >= <context.item.script.yaml_key[price].mul[32]>:
          - narrate "You bought <&9>32x <&f>of <&9><context.item.formatted> <&f>for <&9>$<context.item.script.yaml_key[price].mul[32]>"
          - take money quantity:<context.item.script.yaml_key[price].mul[32]>
          - give <context.item.script.yaml_key[material]> quantity:32
        - else:
          - narrate "<&c>You don't have enough money to buy 32x of <context.item.formatted>"
      - case "SHIFT_RIGHT":
        - playsound <player> sound:BLOCK_STONE_BUTTON_CLICK_ON volume:0.5 pitch:0.8
        - if <player.inventory.contains[<context.item.script.yaml_key[material]>].quantity[32]>:
          - take <context.item.script.yaml_key[material]> quantity:32
          - narrate "You sold 32 of <&9><context.item.formatted> <&f>for <&9>$<context.item.script.yaml_key[price].mul[32].mul[0.85]>"
          - give money quantity:<context.item.script.yaml_key[price].mul[32].mul[0.85]>
        - else:
          - narrate "<&c>You don't have <context.item.formatted> in your inventory"
      - default:
        - narrate "<&c>Please follow the instructions"


mSurvivalShopList:
  type: yaml data
  items:
  - mBread
  - mApple
  - mStone
  #- mDirt
  - mSand
  - mGravel
  - mGrassBlock
  - mOakLog
  - mCoal
  - mRedstone
  - mIronIngot
  - mGoldIngot
  - mLapisLazuli
  - mBow
  - mIronSword
  - mIronAxe
  - mIronPickAxe


#########################
#
#  item:
#    type: item
#    debug: false
#    material: i@stone
#    lore:
#    - <&7>Price: <&e>$<script.yaml_key[price]>
#    - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
#    price:
#
#########################

mBread:
  type: item
  debug: false
  material: bread
  lore:
  - test <yaml[mBread]>
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 15

mApple:
  type: item
  debug: false
  material: apple
  lore:
  - <&7>Price: <&e>$<ScriptTag.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 20

mStone:
  type: item
  debug: false
  material: stone
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 30

mSand:
  type: item
  debug: false
  material: sand
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 35

mGravel:
  type: item
  debug: false
  material: gravel
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 35

mDirt:
  type: item
  debug: false
  material: dirt
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 25

mGrassBlock:
  type: item
  debug: false
  material: grass_block
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 40

mOakLog:
  type: item
  debug: false
  material: oak_log
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 30

mCoal:
  type: item
  debug: false
  material: coal
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 25

mRedstone:
  type: item
  debug: false
  material: redstone
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 50

mIronIngot:
  type: item
  debug: false
  material: iron_ingot
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 120

mGoldIngot:
  type: item
  debug: false
  material: gold_ingot
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 100

mLapisLazuli:
  type: item
  debug: false
  material: lapis_lazuli
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 200

mBow:
  type: item
  debug: false
  material: bow
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 60

mIronSword:
  type: item
  debug: false
  material: iron_sword
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 40

mIronAxe:
  type: item
  debug: false
  material: iron_axe
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 50

mIronPickAxe:
  type: item
  debug: false
  material: iron_pickaxe
  lore:
  - <&7>Price: <&e>$<script.yaml_key[price]>
  - <&7>Sell price: <&e>$<script.yaml_key[price].mul[0.85]>
  price: 70