Paste #67638: Gold Exchange Enderzon

Date: 2020/04/17 21:23:20 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


gold_broker_handler:
    type: world
    events:
        on player clicks in gold_broker_inventory priority:3:
        - if <context.raw_slot> < 46:
            - determine cancelled
        on player double clicks in gold_broker_inventory priority:3:
        - if <context.raw_slot> < 46:
            - determine cancelled
        on player drags in gold_broker_inventory priority:3:
        - if <context.raw_slot> < 46:
            - determine cancelled
        on player left clicks goldnugget1 in gold_broker_inventory priority:1:
        - if <player.money> >= <server.flag[nuggetvalue]>:
            - narrate "<green>You have purchased 1<gold> Gold Nugget<green> for $<server.flag[nuggetvalue]>"
            - money take quantity:<server.flag[nuggetvalue]>
            - give GOLD_NUGGET 1
            - log "<player.name> bought 1 gold nugget for $<server.flag[nuggetvalue]>" type:info file:bank.log
        - else:
            - narrate "<red>You do not have enough money to purchase <gold>Gold Nugget."
        on player right clicks goldnugget1 in gold_broker_inventory priority:1:
        - if <player.inventory.contains.material[GOLD_NUGGET].quantity[1]> = true
            - narrate "<green>You have sold 1<gold> Gold Nugget<green> for $<server.flag[nuggetvalue]>"
            - money give quantity:<server.flag[nuggetvalue]>
            - take GOLD_NUGGET quantity:1
            - log "<player.name> sold 1 gold nugget for $<server.flag[nuggetvalue]>" type:info file:bank.log
        - else:
            - narrate "<red>You do not have enough <gold>Gold Nuggets<red> to sell!"
        on player left clicks goldnugget2 in gold_broker_inventory priority:1:
        - if <player.money> >= <server.flag[nuggetvalue]>:
            - narrate "<green>You have purchased 1<gold> Gold Nugget<green> for $<server.flag[nuggetvalue]>"
            - money take quantity:<server.flag[nuggetvalue]>
            - give GOLD_NUGGET 1
            - log "<player.name> bought 1 gold nugget for $<server.flag[nuggetvalue]>" type:info file:bank.log
        - else:
            - narrate "<red>You do not have enough money to purchase <gold>Gold Nugget."
        on player right clicks goldnugget2 in gold_broker_inventory priority:1:
        - if <player.inventory.contains.material[GOLD_NUGGET].quantity[1]> = true
            - narrate "<green>You have sold 1<gold> Gold Nugget<green> for $<server.flag[nuggetvalue]>"
            - money give quantity:<server.flag[nuggetvalue]>
            - take GOLD_NUGGET quantity:1
            - log "<player.name> sold 1 gold nugget for $<server.flag[nuggetvalue]>" type:info file:bank.log
        - else:
            - narrate "<red>You do not have enough <gold>Gold Nuggets<red> to sell!"
        on player double_click clicks in inventory:
        - determine cancelled
gold_broker:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
    interact scripts:
    - gold_broker_interact

gold_broker_interact:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - inventory open d:Gold_Broker_Inventory
gold_broker_inventory:
    type: inventory
    inventory: chest
    title: Gold Exchange
    size: 45
    definitions:
        guivoid:
        gold:
    slots:
    - [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid]
    - [i@guivoid] [i@guivoid] [i@goldnugget1] [i@guivoid] [i@goldingot1] [i@guivoid] [i@goldblock1] [i@guivoid] [i@guivoid]
    - [i@guivoid] [i@guivoid] [i@goldnugget2] [i@guivoid] [i@goldingot2] [i@guivoid] [i@goldblock2] [i@guivoid] [i@guivoid]
    - [i@guivoid] [i@guivoid] [i@goldnugget3] [i@guivoid] [i@goldingot3] [i@guivoid] [i@goldblock3] [i@guivoid] [i@guivoid]
    - [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid] [i@guivoid]
guivoid:
    type: item
    material: LIGHT_GRAY_STAINED_GLASS_PANE
    display name: "<red>"
goldnugget1:
    type: item
    material: GOLD_NUGGET
    display name: "<&6>Left Click to <&a>buy <&e>1 <&6>Gold Nugget"
    lore:
    - "<green>For $<server.flag[nuggetvalue]>"
    - "<gold>Right Click to <&a>sell <yellow>1<gold> Gold Nugget"
    - "<green>For $<server.flag[nuggetvalue]>"
goldnugget2:
    type: item
    material: GOLD_NUGGET
    display name: "<&6>Left Click to <&a>buy <&e>16 <&6>Gold Nugget"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[16]>"
    - "<gold>Right Click to <&a>sell <yellow>16<gold> Gold Nugget"
    - "<green>For $<server.flag[nuggetvalue].mul[16]>"
goldnugget3:
    type: item
    material: GOLD_NUGGET
    display name: "<&6>Left Click to <&a>buy <&e>64 <&6>Gold Nuggets"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[64]>"
    - "<gold>Right Click to <&a>sell <yellow>64<gold> Gold Nuggets"
    - "<green>For $<server.flag[nuggetvalue].mul[64]>"
goldingot1:
    type: item
    material: GOLD_INGOT
    display name: "<&6>Left Click to <&a>buy <&e>1 <&6>Gold Ingot"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9]>"
    - "<gold>Right Click to <&a>sell <yellow>1<gold> Gold Ingot"
    - "<green>For $<server.flag[nuggetvalue].mul[9]>"
goldingot2:
    type: item
    material: GOLD_INGOT
    display name: "<&6>Left Click to <&a>buy <&e>16 <&6>Gold Ingots"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[16]>"
    - "<gold>Right Click to <&a>sell <yellow>16<gold> Gold Ingots"
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[16]>"
goldingot3:
    type: item
    material: GOLD_INGOT
    display name: "<&6>Left Click to <&a>buy <&e>64 <&6>Gold Ingots"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[64]>"
    - "<gold>Right Click to <&a>sell <yellow>64<gold> Gold Ingots"
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[64]>"
goldblock1:
    type: item
    material: GOLD_BLOCK
    display name: "<&6>Left Click to <&a>buy <&e>1 <&6>Gold Block"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9]>"
    - "<gold>Right Click to <&a>sell <yellow>1<gold> Gold Block"
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9]>"
goldblock2:
    type: item
    material: GOLD_BLOCK
    display name: "<&6>Left Click to <&a>buy <&e>16 <&6>Gold Blocks"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9].mul[16]>"
    - "<gold>Right Click to <&a>sell <yellow>16<gold> Gold Blocks"
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9].mul[16]>"
goldblock3:
    type: item
    material: GOLD_BLOCK
    display name: "<&6>Left Click to <&a>buy <&e>64 <&6>Gold Blocks"
    lore:
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9].mul[64]>"
    - "<gold>Right Click to <&a>sell <yellow>64<gold> Gold Blocks"
    - "<green>For $<server.flag[nuggetvalue].mul[9].mul[9].mul[64]>"
cchat2:
    type: format
    format: "<&b><npc.name><&c><&co> <&a><text>"