Paste #62579: Inventory Scripts

Date: 2019/12/06 14:07:52 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


CustomGUI_CustomWeapon_Main:
    type: inventory
    debug: false
    title: <&c><bold>Custom Weapons Main Page
    size:  27
    slots:
    - [CustomGUI_Tier1] [CustomGUI_Tier2] [CustomGUI_Tier3] [CustomGUI_Tier4] [CustomGUI_Tier5] [CustomGUI_Tier6] [CustomGUI_Tier7] [CustomGUI_Tier8] [CustomGUI_Tier9]
    - [] [] [] [] [CustomGUI_Tier10] [] [] [] []
    - [CustomGUI_PlayerBalance] [] [] [] [] [] [] [] [CustomGUI_Clicktobuy]
CustomGUI_PlayerBalance:
    type: item
    debug: false
    material: player_head
    mechanisms:
        skull_skin: <player.uuid>
    display name: <&f><&e><bold>Your Balance<&co>
    lore:
    - <&2><bold>$ <player.money>
CustomGUI_Back:
    type: item
    debug: false
    material: red_wool
    display name: <&e><bold>Previous Page
CustomGUI_Next:
    type: item
    debug: false
    material: green_wool
    display name: <&e><bold>Next Page
CustomGUI_Clicktobuy:
    type: item
    material: gold_block
    display name: <&e><bold>Click Options
    lore:
    - <&6><bold>Left click to purchase the item!
    - <&a><bold>Right click to view the item!
CustomGUI_Tier1:
    type: item
    debug: false
    material: gray_wool
    display name: <&8><bold>Tier 1
    lore:
    - Click here to view the
    - Tier 1 weapons!
CustomGUI_Tier1_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 1 - Page 1
    size: 54
    slots:
    - [CustomWeapon_KitsuneOutfit] [CustomWeapon_VampireCape] [CustomWeapon_WitchsHat] [CustomWeapon_SilverEmeraldCrown] [CustomWeapon_FlowerCrown] [CustomWeapon_Navi] [CustomWeapon_Guitar] [CustomWeapon_Harp] [CustomWeapon_GoldenRubyCrown]
    - [CustomWeapon_BunnyEars] [CustomWeapon_CatEars] [CustomWeapon_MagicOrb] [CustomWeapon_WitchsBroom] [CustomWeapon_SpartanHelm] [CustomWeapon_DiamondRing] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier1_Page2:
    type: inventory
    debug: false
    title: <&c><bold>Tier 1 - Page 2
    size: 54
    slots:
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] []
CustomGUI_Tier2:
    type: item
    debug: false
    material: light_gray_wool
    display name: <&7><bold>Tier 2
    lore:
    - Click here to view the
    - Tier 2 weapons!
CustomGUI_Tier2_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 2 - Page 1
    size: 54
    slots:
    - [CustomWeapon_EmeraldScepter] [CustomWeapon_RubyScepter] [CustomWeapon_VikingClub] [CustomWeapon_Scepter] [CustomWeapon_JoustingLance] [CustomWeapon_SpikedMace] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier3:
    type: item
    debug: false
    material: lime_wool
    display name: <&a><bold>Tier 3
    lore:
    - Click here to view the
    - Tier 3 weapons!
CustomGUI_Tier3_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 3 - Page 1
    size: 54
    slots:
    - [CustomWeapon_OnyxScepter] [CustomWeapon_StrawberryStaff] [CustomWeapon_Reinlich] [CustomWeapon_BrassKnuckles] [CustomWeapon_Pugiona] [CustomWeapon_FlangedMace] [CustomWeapon_Igiturus] [CustomWeapon_PiratesCompanion] [CustomWeapon_IronDagger]
    - [CustomWeapon_Scweizersabel] [CustomWeapon_InfinityBlade] [CustomWeapon_Ellaborus] [CustomWeapon_Brus] [CustomWeapon_FarmingScythe] [CustomWeapon_Jiganemaru] [CustomWeapon_RoughClaws] [CustomWeapon_Backbiter] [CustomWeapon_Swashbuckler]
    - [CustomWeapon_Valeria] [CustomWeapon_Joyeux] [CustomWeapon_AmberScepter] [CustomWeapon_OpalScepter] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier4:
    type: item
    debug: false
    material: green_wool
    display name: <&2><bold>Tier 4
    lore:
    - Click here to view the
    - Tier 4 weapons!
CustomGUI_Tier4_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 4 - Page 1
    size: 54
    slots:
    - [CustomWeapon_SapphireScepter] [CustomWeapon_LapisScepter] [CustomWeapon_CrystalStaff] [CustomWeapon_AnnealBlade] [CustomWeapon_BattleAxe] [CustomWeapon_Claymore] [CustomWeapon_HoarFrost] [CustomWeapon_Halberd] [CustomWeapon_Ostium]
    - [CustomWeapon_FrostAxe] [CustomWeapon_KnightsBane] [CustomWeapon_ScytheOfTheSea] [CustomWeapon_BiClaw] [CustomWeapon_IronWarHammer] [CustomWeapon_Bloodless] [CustomWeapon_SwordOfDecay] [CustomWeapon_EnergyClaws] [CustomWeapon_SolarSword]
    - [CustomWeapon_AtlastBlade] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier5:
    type: item
    debug: false
    material: orange_wool
    display name: <&6><bold>Tier 5
    lore:
    - Click here to view the
    - Tier 5 weapons!
CustomGUI_Tier5_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 5 - Page 1
    size: 54
    slots:
    - [CustomWeapon_RoseQuartzScepter] [CustomWeapon_AmethystScepter] [CustomWeapon_PoleAxe] [CustomWeapon_VineWhip] [CustomWeapon_Malleus] [CustomWeapon_StaffOfFire] [CustomWeapon_CrescentScythe] [CustomWeapon_Virgamux] [CustomWeapon_RubyStaff]
    - [CustomWeapon_HeavenlyVoid] [CustomWeapon_AncientGemStaff] [CustomWeapon_ToxicWaste] [CustomWeapon_StaffOfTheUndead] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier6:
    type: item
    debug: false
    material: red_wool
    display name: <&4><bold>Tier 6
    lore:
    - Click here to view the
    - Tier 6 weapons!
CustomGUI_Tier6_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 6 - Page 1
    size: 54
    slots:
    - [CustomWeapon_FrozenCrescent] [CustomWeapon_TopazScepter] [CustomWeapon_PeridotScepter] [CustomWeapon_CorruptedMagesStaff] [CustomWeapon_Nocturne] [CustomWeapon_DragonsBreath] [CustomWeapon_Piercer] [CustomWeapon_Oakrune] [CustomWeapon_BlueBlood]
    - [CustomWeapon_DiabloAzul] [CustomWeapon_TigersClaw] [CustomWeapon_ElementalAxe] [CustomWeapon_SpiritWarhammer] [CustomWeapon_DualBladeOfShock] [CustomWeapon_DragonboneAxe] [CustomWeapon_OceanBlade] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier7:
    type: item
    debug: false
    material: light_blue_wool
    display name: <&b><bold>Tier 7
    lore:
    - Click here to view the
    - Tier 7 weapons!
CustomGUI_Tier7_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 7 - Page 1
    size: 54
    slots:
    - [CustomWeapon_GarnetScepter] [CustomWeapon_Malakies] [CustomWeapon_SummerRose] [CustomWeapon_HellAxe] [CustomWeapon_BloodFlame] [CustomWeapon_AbbadonsPike] [CustomWeapon_GuiltyThorn] [CustomWeapon_ScytheOfDespair] [CustomWeapon_FrozenMenace]
    - [CustomWeapon_EdgeOfBrisingr] [CustomWeapon_ChaoticCrusader] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier8:
    type: item
    debug: false
    material: cyan_wool
    display name: <&3><bold>Tier 8
    lore:
    - Click here to view the
    - Tier 8 weapons!
CustomGUI_Tier8_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 8 - Page 1
    size: 54
    slots:
    - [CustomWeapon_RubyHatchet] [CustomWeapon_Icealic] [CustomWeapon_Tenebris] [CustomWeapon_NaughtSieger] [CustomWeapon_Hellflame] [CustomWeapon_Bloodbane] [CustomWeapon_AzrealsClockwork] [CustomWeapon_MenacingWingedScepter] [CustomWeapon_OccultWoodenStaff]
    - [CustomWeapon_BloodyCleaver] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier9:
    type: item
    debug: false
    material: blue_wool
    display name: <&9><bold>Tier 9
    lore:
    - Click here to view the
    - Tier 9 weapons!
CustomGUI_Tier9_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 9 - Page 1
    size: 54
    slots:
    - [CustomWeapon_DemonicEbonyScythe] [CustomWeapon_LightWingedScepter] [CustomWeapon_MasterSword] [CustomWeapon_EbonyArmingSword] [CustomWeapon_HeavensWrath] [CustomWeapon_NotisDracon] [CustomWeapon_LightningRod] [CustomWeapon_FireBone] [CustomWeapon_HellsBlood]
    - [CustomWeapon_DawnHammer] [CustomWeapon_MagmaOfMorroc] [CustomWeapon_BloodyEater] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_Tier10:
    type: item
    debug: false
    material: diamond_block
    display name: <&8><bold>Tier 10
    lore:
    - Click here to view the
    - Tier 10 weapons!
CustomGUI_Tier10_Page1:
    type: inventory
    debug: false
    title: <&c><bold>Tier 10 - Page 1
    size: 54
    slots:
    - [CustomWeapon_Excalibur] [CustomWeapon_LanceOfMichael] [CustomWeapon_AngelBlade] [CustomWeapon_Archblade] [CustomWeapon_Auroria] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []
    - [CustomGUI_Back] [] [] [] [CustomGUI_PlayerBalance] [] [] [] [CustomGUI_Next]
CustomGUI_ConfirmPurchase:
    type: inventory
    debug: false
    title: <&c><bold>Confirm your purchase
    size: 9
    slots:
    - [CustomGUI_Confirm] [] [] [] [<player.flag[weapon_selection]||<item[stone]>>] [] [] [] [CustomGUI_Deny]
CustomGUI_Confirm:
    type: item
    debug: false
    material: emerald_block
    display name: <&c><bold>Confirm
    lore:
    - <&2><bold>Click here to confirm the purchase
    - <&e><bold>Cost<&7><&co> <&a><player.flag[weapon_cost]||0>
CustomGUI_Deny:
    type: item
    debug: false
    material: redstone_block
    display name: <&c><bold>Deny Transaction
    lore:
    - <&2><bold>Click here to deny the transaction
CustomGUI_CustomWeapon_Main_Events:
    type: world
    debug: true
    events:
        on player clicks CustomGUI* in CustomGUI_CustomWeapon_Main:
            - determine cancelled passively
            - if <context.item.simple.contains[Tier]>:
                - define Tier <context.item.simple.after[Tier]>
                #- narrate <[Tier]>
                #- define inv CustomGUI_Tier<[Tier]>
                - inventory open d:CustomGUI_Tier<[Tier]>_Page1
        on player clicks CustomGUI_PlayerBalance in CustomGUI*:
            - determine cancelled
        on player clicks CustomGUI_Next in CustomGUI_Tier*:
            - determine cancelled passively
            #- narrate <context.inventory>
            #- define inv <inventory[<context.inventory>].script_name>
            - define inv <context.inventory.script_name>
            #- narrate <[inv]>
            - define next_page Page<element[<[inv].after[page]>].add[1]>
            - define next_inv <[inv].before[_Page]>_<[next_page]>
            - if <server.list_scripts.filter[contains[CustomGUI_Tier]].contains[s@<[next_inv]>]>:
                - inventory open d:<[next_inv]>
        on player clicks CustomGUI_Back in CustomGUI_Tier*:
            - determine cancelled passively
            - define inv <context.inventory.script_name>
            - define inv_page <[inv].after[Page]>
            - if <[inv_page]> == "1":
                - inventory open d:CustomGUI_CustomWeapon_Main
                - stop
            - define prev_page Page<element[<[inv].after[page]>].sub[1]>
            - define prev_inv <[inv].before[_Page]>_<[prev_page]>
            - inventory open d:<[prev_inv]>
        on player RIGHT clicks CustomWeapon* in CustomGUI_Tier*:
            - determine cancelled passively
            - define Tier <element[<context.item.nbt[Tier]>]>
            #########- define cost <element[10000].mul[<
            - define slot <player.inventory.first_empty>
            - inventory close
            - fakeitem <context.item> slot:<[slot]> duration:5s
            - adjust <player> item_slot:<[slot]>
            - flag player fake_item duration:5s
        on player LEFT clicks CustomWeapon* in CustomGUI_Tier*:
            - determine cancelled passively
            - flag player weapon_selection:<context.item>
            - define Tier <item[<player.flag[weapon_selection]>].nbt[Tier]>
            - define cost <element[10000].mul[<proc[FactorialProc].context[<[Tier].add[1]>]>]>
            - flag player weapon_cost:<[cost]>
            - inventory open d:CustomGUI_ConfirmPurchase
        on player clicks CustomWeapon* in CustomGUI_ConfirmPurchase:
            - determine cancelled
        on player clicks CustomGUI_Confirm in CustomGUI_ConfirmPurchase:
            - determine cancelled passively
            #- inventory close
            - define Tier <item[<player.flag[weapon_selection]>].nbt[Tier]>
            - define cost <element[10000].mul[<proc[FactorialProc].context[<[Tier].add[1]>]>]>
            - if <[cost].is[more].to[<player.money||0>]>:
                - inventory close
                - narrate "You do not have enough money to buy this item! You need <[cost].sub[<player.money||0>]> more!"
            #- give <player.flag[weapon_selection]>
            #- flag player weapon_selection:!
            - else:
                - give <player.flag[weapon_selection]>
                - money take quantity:<[cost]>
                - narrate "<&2>Your previous balance was <&6><player.money.add[<[cost]>]> <&2>but is now <&6><player.money>"
                - narrate "Enjoy your new item!"
            - flag player weapon_selection:!
        on player clicks in CustomGUI*:
            - if <context.is_shift_click>:
                - if <player.is_op>:
                    - narrate "Bypassing the safeguards.."
                    - stop
                - determine cancelled
        on player clicks CustomGUI_Deny in CustomGUI_ConfirmPurchase:
            - determine cancelled passively
            - inventory open d:CustomGUI_CustomWeapon_Main
        on player scrolls their hotbar flagged:fake_item:
            - determine cancelled
        on player drops item:
            - if <player.has_flag[fake_item]:
                - determine cancelled passively


FactorialProc:
    type: procedure
    debug: false
    definitions: Tier
    script:
        - define va 1
        - repeat <[Tier]||0>:
            - if <[Tier].is[more].to[1]>:
                - define va <[va].mul[<[Tier]>]>
                - define Tier <[Tier].sub[1]>
        - determine <[va]>