Paste #50243: Untitled Paste

Date: 2018/10/06 13:34:56 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


on player closes SmallChestInv:
    - if <player.has_flag[LootChest]> {
      - if <yaml[<player.flag[LootChest].get[1]>].read[<player.flag[LootChest].get[2]>.Money]> != 0 {
        - if <yaml[<player.uuid>].read[OpenedChests].contains[<player.flag[LootChest].get[2]>].not> {
          - money give quantity:<yaml[<player.flag[LootChest].get[1]>].read[<player.flag[LootChest].get[2]>.Money]>
          - narrate "You found $<yaml[<player.flag[LootChest].get[1]>].read[<player.flag[LootChest].get[2]>.Money]> in the chest!"
          }
        }
      - yaml id:<player.uuid> set OpenedChests.<player.flag[LootChest].get[2]>.Items:!
      - foreach <context.inventory.list_contents> {
        - yaml id:<player.uuid> set OpenedChests.<player.flag[LootChest].get[2]>.Items:->:<def[value]>
        }
      - yaml savefile:/PlayerData/<player.uuid>.yml id:<player.uuid>
      - yaml unload id:<player.flag[LootChest].get[1]>
      - flag player LootChest:!
      - queue clear
      }
    - if <player.has_flag[RandomChest]> {
      - if <yaml[<player.flag[RandomChest].get[1]>].read[<player.flag[CurrentChest]>.<player.flag[RandomChest].get[2]>.Money]> != 0 {
        - if <yaml[<player.uuid>].read[OpenedChests].contains[<player.flag[CurrentChest].not>]> {
          - money give quantity:<yaml[<player.flag[RandomChest].get[1]>].read[<player.flag[CurrentChest]>.<player.flag[RandomChest].get[2]>.Money]>
          - narrate "You found $<yaml[<player.flag[RandomChest].get[1]>].read[<player.flag[CurrentChest]>.<player.flag[RandomChest].get[2]>.Money]> in the chest!"
        }
      }
      - yaml id:<player.uuid> set OpenedChests.<player.flag[CurrentChest]>.Items:!
      - foreach <context.inventory.list_contents> {
        - yaml id:<player.uuid> set OpenedChests.<player.flag[CurrentChest]>.Items:->:<def[value]>
        }
      - yaml savefile:/PlayerData/<player.uuid>.yml id:<player.uuid>
      - yaml unload id:<player.flag[RandomChest].get[1]>
      - flag player CurrentChest:!
      - flag player RandomChest:!
      - queue clear
      }