Paste #105551: a

Date: 2023/01/20 06:59:56 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


upgrader_inventory_logic_world:
    type: world
    debug: true
    events:

        on player clicks in Upgrader_GUI:
        - define inv <context.inventory>
        - define click_inv <context.clicked_inventory>
        - define slot <context.slot>
        - define sh_click <context.is_shift_click>

        - if <[click_inv]> == <[inv]>:
            - if <[slot]> == 21 or <[slot]> == 22 or <[slot]> == 23:
                #- announce "click correct slot"
                - determine cancelled:false
            - else:
                - if <[slot]> == 25:
                    #- narrate "<&[base]>upgrade button clicked!"
                    - run locally path:upgrader_process_logic def:<[inv]>
                    - determine cancelled
                - else:
                   # - narrate "click cancelled"
                    - determine cancelled
        - if <[click_inv]> != <[inv]> && <[sh_click]>:
            #- narrate "shift cancelled"
            - determine cancelled

        on player drags in Upgrader_GUI:
        - define inv <context.inventory>
        - define click_inv <context.clicked_inventory>

        - if <[click_inv]> == <[inv]>:
            - announce "drag cancelled"
            - determine cancelled

        on player closes Upgrader_GUI:
        - drop <context.inventory.slot[21]>
        - drop <context.inventory.slot[22]>
        - drop <context.inventory.slot[23]>

    upgrader_process_logic:
        - define inv <[1]>
        - define phy_dmg <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE]>
        - if <[inv].slot[21].raw_nbt.contains[MMOITEMS_PHYSICAL_DAMAGE]>:
            - narrate "physical damage = <[phy_dmg].replace[double:].with[].add[2.0]>"
        - else:
            - narrate "no physical damage"