Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
18 kB
1
Indexable
Never
# FREE 20
# PREMIUM 45
# TOTAL 45 LVLS
# TOTAL 65 REWARDS


#IMPORT
import:
  dev.lone.itemsadder.api.ItemsAdder
  dev.lone.itemsadder.api.FontImages.TexturedInventoryWrapper
  dev.lone.itemsadder.api.FontImages.FontImageWrapper
  org.bukkit.entity.Player

#PLAYER JOIN
on join:
    if {joinedPlayers::*} doesn't contain player's uuid:
        set {points::%player's uuid%} to 0
        set {levels::%player's uuid%} to 0
        add player's uuid to {joinedPlayers::*}
        stop

#BATTLEPASS GUI

function battlepassGUIP1(p: player):
    set {_gui} to fontimage "battlepass:bp_rewards"

    set {_offset} to placeholder "img_offset_-36" from {_p}

    set {_bplocked} to ItemsAdder.getCustomItem("battlepass:reward_locked_gray")

    set {_bpunlocked} to ItemsAdder.getCustomItem("battlepass:reward_unclaimed")

    set {_air} to ItemsAdder.getCustomItem("battlepass:air")

    set {_bpredeemed} to ItemsAdder.getCustomItem("battlepass:reward_claimed")

    set metadata tag "bp_rewards1" of {_p} to chest inventory with 6 row named "%{_offset}%%{_gui}%"

    set {_slot.%{_p}'s uuid%} to 18
    set {_level.%{_p}'s uuid%} to 1
    while {_slot.%{_p}'s uuid%} < 27:
        if {levels::%{_p}'s uuid%} is greater than or equal to {_level.%{_p}'s uuid%}:
            if {redeemedLevels::%{_p}'s uuid%::*} contains "%{_level.%{_p}'s uuid%}%":
                set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards1" of {_p} to {_bpredeemed} named " &f&lᴊᴜʙᴀ ᴠõᴇᴛᴜᴅ " with lore " ", " &7Sa oled selle autasu", " &7juba ära võtnud.", " "
            else:
                set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards1" of {_p} to {_bpunlocked} named " &f&lʟᴀʜᴛɪ " with lore " ", " &7Sa saad selle", " &7autasu lunastada.", " "
        else:
            set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards1" of {_p} to {_bplocked} named " &f&lᴋɪɴɴɪ " with lore " ", " &7Sul ei ole see auhind", " &7veel saavutatud.", " "
        set {_slot.%{_p}'s uuid%} to {_slot.%{_p}'s uuid%} + 1
        set {_level.%{_p}'s uuid%} to {_level.%{_p}'s uuid%} + 1

    set slot 0 of metadata tag "bp_rewards1" of {_p} to paper named "&f&l1000$"
    set slot 36 of metadata tag "bp_rewards1" of {_p} to paper named "&f&l10,000$"

    set slot 45 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "
    set slot 46 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "
    set slot 47 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "

    set slot 51 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "
    set slot 52 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "
    set slot 53 of metadata tag "bp_rewards1" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "

    open (metadata tag "bp_rewards1" of {_p}) to {_p}

    play sound "block.note_block.pling" at volume 1 at pitch 2 to {_p}

function battlepassGUIP2(p: player):
    set {_gui} to fontimage "battlepass:bp_rewards"

    set {_offset} to placeholder "img_offset_-36" from {_p}

    set {_bplocked} to ItemsAdder.getCustomItem("battlepass:reward_locked_gray")

    set {_bpunlocked} to ItemsAdder.getCustomItem("battlepass:reward_unclaimed")

    set {_air} to ItemsAdder.getCustomItem("battlepass:air")

    set {_bpredeemed} to ItemsAdder.getCustomItem("battlepass:reward_claimed")

    set metadata tag "bp_rewards2" of {_p} to chest inventory with 6 row named "%{_offset}%%{_gui}%"

    set {_slot.%{_p}'s uuid%} to 18
    set {_level.%{_p}'s uuid%} to 10
    while {_slot.%{_p}'s uuid%} < 27:
        if {levels::%{_p}'s uuid%} is greater than or equal to {_level.%{_p}'s uuid%}:
            if {redeemedLevels::%{_p}'s uuid%::*} contains "%{_level.%{_p}'s uuid%}%":
                set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards2" of {_p} to {_bpredeemed} named " &f&lᴊᴜʙᴀ ᴠõᴇᴛᴜᴅ " with lore " ", " &7Sa oled selle autasu", " &7juba ära võtnud.", " "
            else:
                set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards2" of {_p} to {_bpunlocked} named " &f&lʟᴀʜᴛɪ " with lore " ", " &7Sa saad selle", " &7autasu lunastada.", " "
        else:
            set slot {_slot.%{_p}'s uuid%} of metadata tag "bp_rewards2" of {_p} to {_bplocked} named " &f&lᴋɪɴɴɪ " with lore " ", " &7Sul ei ole see auhind", " &7veel saavutatud.", " "
        set {_slot.%{_p}'s uuid%} to {_slot.%{_p}'s uuid%} + 1
        set {_level.%{_p}'s uuid%} to {_level.%{_p}'s uuid%} + 1

    set slot 0 of metadata tag "bp_rewards2" of {_p} to paper named "&f&l1000$"
    set slot 36 of metadata tag "bp_rewards2" of {_p} to paper named "&f&l10,000$"

    set slot 45 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "
    set slot 46 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "
    set slot 47 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴛᴀɢᴀꜱɪ " with lore " ", " &7Keera tagasi eelmisele ", " &7leheküljele. ", " "

    set slot 51 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "
    set slot 52 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "
    set slot 53 of metadata tag "bp_rewards2" of {_p} to {_air} named " &f&lᴇᴅᴀꜱɪ " with lore " ", " &7Keera edasi järgmisele ", " &7leheküljele. ", " "

    open (metadata tag "bp_rewards2" of {_p}) to {_p}

    play sound "block.note_block.pling" at volume 1 at pitch 2 to {_p}

#MAIN GUI
command /battlepass:

    trigger:

        set {_gui} to fontimage "battlepass:bp_portal"

        set {_offset} to placeholder "img_offset_-32" from player

        set {_stats} to ItemsAdder.getCustomItem("battlepass:questbook")

        set {_bpicon} to ItemsAdder.getCustomItem("battlepass:reward_locked_green")

        set {_newlevel::%player's uuid%} to {levels::%player's uuid%} + 1

        set metadata tag "bp_portal" of player to chest inventory with 1 row named "%{_offset}%%{_gui}%"

        set slot 2 of metadata tag "bp_portal" of player to {_stats} named " &f&lꜱᴛᴀᴛɪꜱᴛɪᴋᴀ " with lore " " and " &7Points &8&l• <##9e032b>%{points::%player's uuid%}%" and " &7Level &8&l• <##9e032b>%{levels::%player's uuid%}%" and " &7Until next level &8&l• <##9e032b>%{pointsuntil::%{_newlevel::%player's uuid%}%}%" and " "
        set slot 4 of metadata tag "bp_portal" of player to {_bpicon} named " &f&lʙᴀᴛᴛʟᴇᴘᴀꜱꜱ " with lore " " and " &7Vajuta siia, et" and " &7avada battlepass." and " "
        if {battlepass::premiumusers::*} contains player' uuid:
            set {_pluss} to ItemsAdder.getCustomItem("battlepass:unlocked")
            set slot 6 of metadata tag "bp_portal" of player to {_pluss} named " &f&lʙᴀᴛᴛʟᴇᴘᴀꜱꜱ ᴘʟᴜꜱꜱ " with lore " " and " &7Sul on Pluss juba olemas. Täname!" and " <##9e032b>https://artizon.ee/pood" and " "
        else:
            set {_pluss} to ItemsAdder.getCustomItem("battlepass:locked")
            set slot 6 of metadata tag "bp_portal" of player to {_pluss} named " &f&lʙᴀᴛᴛʟᴇᴘᴀꜱꜱ ᴘʟᴜꜱꜱ " with lore " " and " &7Plussi ostmiseks kliki siia." and " <##9e032b>https://artizon.ee/pood" and " "

        open (metadata tag "bp_portal" of player) to player

        play sound "block.note_block.pling" at volume 1 at pitch 2 to player

on inventory click:
    if event-inventory = (metadata tag "bp_portal" of player):
        cancel event
        if index of event-slot is 4:
            close player's inventory 
            battlepassGUIP1(player)
            play sound "block.note_block.pling" at volume 1 at pitch 2 to player
        if index of event-slot is 6:
            close player's inventory
            send formatted " <##9e032b>Battlepass &8&l• &7Kliki siia - <##9e032b><link:https://www.artizon.ee/pood>https://www.artizon.ee/pood" to player
            play sound "block.note_block.pling" at volume 1 at pitch 2 to player
    if event-inventory = (metadata tag "bp_rewards1" of player):
        cancel event
        if name of clicked item is " &f&lʟᴀʜᴛɪ ":
            set {_slot.%player's uuid%} to 18
            set {_level.%player's uuid%} to 1
            while {_slot.%player's uuid%} is not index of event-slot:
                set {_slot.%player's uuid%} to {_slot.%player's uuid%} + 1
                set {_level.%player's uuid%} to {_level.%player's uuid%} + 1
            add "%{_level.%player's uuid%}%" to {redeemedLevels::%player's uuid%::*}
            if {battlepass::premiumusers::*} contains player's uuid:
                set {_premreward} to "%{premiumrewards::%{_level.%player's uuid%}%}%"
                replace all "[player]" with "%player%" in {_premreward}
                execute console command "%{_premreward}%"
            if {freerewardsamount::*} contains "%{_level.%player's uuid%}%":
                set {_frereward} to "%{freerewards::%{_level.%player's uuid%}%}%"
                replace all "[player]" with "%player%" in {_frereward}
                execute console command "%{_frereward}%"
            close player's inventory
            battlepassGUIP1(player)
        if name of clicked item is " &f&lᴛᴀɢᴀꜱɪ ":
            close player's inventory
            execute player command "/battlepass"
        if name of clicked item is " &f&lᴇᴅᴀꜱɪ ":
            close player's inventory
            battlepassGUIP2(player)
    if event-inventory = (metadata tag "bp_rewards2" of player):
        cancel event
        if name of clicked item is " &f&lʟᴀʜᴛɪ ":
            set {_slot.%player's uuid%} to 18
            set {_level.%player's uuid%} to 10
            while {_slot.%player's uuid%} is not index of event-slot:
                set {_slot.%player's uuid%} to {_slot.%player's uuid%} + 1
                set {_level.%player's uuid%} to {_level.%player's uuid%} + 1
            add "%{_level.%player's uuid%}%" to {redeemedLevels::%player's uuid%::*}
            if {battlepass::premiumusers::*} contains player's uuid:
                set {_premreward} to "%{premiumrewards::%{_level.%player's uuid%}%}%"
                replace all "[player]" with "%player%" in {_premreward}
                execute console command "%{_premreward}%"
            if {freerewardsamount::*} contains "%{_level.%player's uuid%}%":
                set {_frereward} to "%{freerewards::%{_level.%player's uuid%}%}%"
                replace all "[player]" with "%player%" in {_frereward}
                execute console command "%{_frereward}%"
            close player's inventory
            battlepassGUIP2(player)
        if name of clicked item is " &f&lᴛᴀɢᴀꜱɪ ":
            close player's inventory
            battlepassGUIP1(player)
        if name of clicked item is " &f&lᴇᴅᴀꜱɪ ":
            close player's inventory

#EARNING LEVELS

#COMMANDS
command /setlevel <number>:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        set {levels::%player's uuid%} to arg 1
        send "new level is %arg 1%" to player

command /setpoints <number>:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        set {points::%player's uuid%} to arg 1
        send "new points amount is %arg 1%" to player

command /level:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        send "%{levels::%player's uuid%}%" to player

command /resetredeemed:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        clear {redeemedLevels::%player's uuid%::*}
        send "redemeed levels cleared." to player

command /setrewards:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        set {freerewardsamount::*} to "1", "15", "45", "37", "9", "10", "40", "32", "25", "20", "14", "29", "26", "36", "12", "31", "2", "7", "41" and "5"
        set {premiumrewards::1} to "/eco give [player] 10000"
        set {freerewards::1} to "/eco give [player] 1000"

command /setpointsuntil:
    permission: artizon.admin
    permission message: <##9e032b> Artizon &8&l• &7Tundmatu käsklus. Abi saamiseks võta ühendust juhtkonnaga kasutades käsklust <##9e032b>/teata <sõnum>&7.
    trigger:
        set {pointsuntil::*} to 500, 1000, 1750, 2500, 4000, 7725, 9000, 11500, 13500, 1600, 18000, 20000, 22500, 25000, 28500, 31000, 34000, 39000, 42500, 50000, 55000, 62000, 65000, 69000, 71500, 7575, 80000, 83000, 87000, 91000, 95000, 100000, 105000, 110000, 120000, 133200, 149184, 168577, 192177, 221003, 256365, 299944, 353933, 421180, 500000

#EARNING POINTS
on death:
    if attacker is player:
        if victim is not player:
            if {battlepass::premiumusers::*} contains attacker's uuid:
                if {killcount::%attacker's uuid%} is not set:
                    set {killcount::%attacker's uuid%} to 1
                else if {killcount::%attacker's uuid%} is greater than or equal to 1:
                    clear {killcount::%attacker's uuid%}
                    set {_newpoints::%attacker's uuid%} to {points::%attacker's uuid%} + 50
                    set {_newlevel::%attacker's uuid%} to {levels::%attacker's uuid%} + 1
                    if {_newpoints::%attacker's uuid%} > {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {_newestpoints::%attacker's uuid%} to {_newpoints::%attacker's uuid%} - {pointsuntil::%{_newlevel::%attacker's uuid%}%}
                        set {levels::%attacker's uuid%} to {_newlevel::%attacker's uuid%}
                        set {points::%attacker's uuid%} to {_newestpoints::%attacker's uuid%}
                        send formatted "<##9e032b> Battlepass &8&l• &7Arenesid levelile <##9e032b>%{levels::%attacker's uuid%}%&7. Lunasta enda autasu kasutades <##9e032b>/battlepass&7." to attacker
                    if {_newpoints::%attacker's uuid%} is equal to {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {points::%attacker's uuid%} to 0
                        set {levels::%attacker's uuid%} to {_newlevel::%attacker's uuid%}
                        send formatted "<##9e032b> Battlepass &8&l• &7Arenesid levelile <##9e032b>%{levels::%attacker's uuid%}%&7. Lunasta enda autasu kasutades <##9e032b>/battlepass&7." to attacker
                    if {_newpoints::%attacker's uuid%} < {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {points::%attacker's uuid%} to {_newpoints::%attacker's uuid%}
            else:
                if {killcount::%attacker's uuid%} is not set:
                    set {killcount::%attacker's uuid%} to 1
                if {killcount::%attacker's uuid%} < 5:
                    set {killcount::%attacker's uuid%} to {killcount::%attacker's uuid%} + 1
                else if {killcount::%attacker's uuid%} is greater than or equal to 5:
                    clear {killcount::%attacker's uuid%}
                    set {_newpoints::%attacker's uuid%} to {points::%attacker's uuid%} + 25
                    set {_newlevel::%attacker's uuid%} to {levels::%attacker's uuid%} + 1
                    if {_newpoints::%attacker's uuid%} > {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {_newestpoints::%attacker's uuid%} to {_newpoints::%attacker's uuid%} - {pointsuntil::%{_newlevel::%attacker's uuid%}%}
                        set {levels::%attacker's uuid%} to {_newlevel::%attacker's uuid%}
                        set {points::%attacker's uuid%} to {_newestpoints::%attacker's uuid%}
                        send formatted "<##9e032b> Battlepass &8&l• &7Arenesid levelile <##9e032b>%{levels::%attacker's uuid%}%&7. Lunasta enda autasu kasutades <##9e032b>/battlepass&7." to attacker
                    if {_newpoints::%attacker's uuid%} is equal to {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {points::%attacker's uuid%} to 0
                        set {levels::%attacker's uuid%} to {_newlevel::%attacker's uuid%}
                        send formatted "<##9e032b> Battlepass &8&l• &7Arenesid levelile <##9e032b>%{levels::%attacker's uuid%}%&7. Lunasta enda autasu kasutades <##9e032b>/battlepass&7." to attacker
                    if {_newpoints::%attacker's uuid%} < {pointsuntil::%{_newlevel::%attacker's uuid%}%}:
                        set {points::%attacker's uuid%} to {_newpoints::%attacker's uuid%}