Paste #38837: NPC Shop

Date: 2017/01/07 20:35:13 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Events:
  type: world
  debug: true
  events:
    on player right clicks npc:
    - choose <npc.id>:
      - case "166":  
        - inventory open d:in@Farmer
    on player clicks in Farmer:
    - determine passively cancelled
    - flag player GUIItem:<context.item.material.name>
    - if <player.flag[GUIItem]> != black_stained_glass_pane {
      - inventory open d:in@Money
      }
    on player clicks in Money:
    - determine passively cancelled
    - choose <context.item.display>:
      - case "<&c>Sell 1":
        - if !<player.inventory.contains[<player.flag[GUIItem]>]> {
          - narrate "<&c>You do not have enough of this item."
          - queue clear
          }
        - take <player.flag[GUIItem]> from:<player.inventory>
        - define itemvalue <yaml[worth].read[<server.list_materials>]>
        - give money quantity:<def[itemvalue]>
        - narrate "<&e><context.item.worth> <&A>has been added to your account."