Paste #2092: Bits and Pieces v2

Date: 2014/02/18 18:59:42 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


InventoryTrading:
  type: world
  events:
    on player right clicks player:
    - if <player.flag[InventoryTrading.Initiating]||false> run local path:Initiate def:<context.entity>
      else if <player.flag[InventoryTrading.InitAccepting]||false> run local path:Initiated def:<context.entity>
      else if <player.flag[InventoryTrading.InitPending]||false> flag "InventoryTrading.InitAccepting" duration:2s
      else flag "InventoryTrading.Initiating" duration:2s
  Initiate:
    - flag player:<context.entity> "InventoryTrading.InitPending"
    - narrate target:%1% "<&b><player.name> <yellow>has sent you a trade request. Right-click them twice to accept."
  Initiated:
    - flag player:%1% "InventoryTrading.CurrSide:0"
    - flag player "InventoryTrading.CurrSide:1"
    - note in@InventoryTradingInv as:Trade_<context.entity>_<player>
    - inventory open d:in@Trade_<context.entity>_<player>
    - inventory player:<context.entity> open d:in@Trade_<context.entity>_<player>

InventoryTradingInv:
  type: inventory
  inventory: chest
  size: 54
  title: <&b>Player Trading GUI
  definitions:
    accept: i@lime_wool[display_name=<green>Confirm;lore=Click this when you're finished with selecting your items.]
    decline: i@red_wool[display_name=<red>Decline;lore=Click this if you want to cancel the trade.]
    divider: i@rails
  slots:
  - "[] [] [] [] [divider] [] [] [] []"
  - "[] [] [] [] [divider] [] [] [] []"
  - "[] [] [] [] [divider] [] [] [] []"
  - "[] [] [] [] [divider] [] [] [] []"
  - "[] [] [] [] [divider] [] [] [] []"
  - "[] [] [] [accept] [divider] [decline] [] [] []"