Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- prefix: &3&lSKYBLOCK
- command /shop [<text>]:
- trigger:
- open virtual chest inventory with size 3 named "&3Shop" for player
- format gui slot 10 of player with grass block named "&7Building Blocks" to run function shop(player, "Building")
- format gui slot 11 of player with redstone dust named "&7Redstone" to run function shop(player, "Redstone")
- format gui slot 12 of player with rotten flesh named "&7Mob Drops" to run function shop(player, "Drops")
- format gui slot 13 of player with wheat named "&7Farming Supplies" to run function shop(player, "Farming")
- format gui slot 14 of player with barrier named "&cComing Soon!"
- format gui slot 15 of player with barrier named "&cComing Soon!"
- function shop(p: player, s: text, page: number=1):
- open virtual chest inventory with size 6 named "&3%{_s}% &7($%convertNum({bal::%{_p}%})%)" for {_p}
- set {_n} to 0
- set {_tPage} to {_page} - 1
- set {_tPage-2} to 45*{_p3}
- set {_uuid} to uuid of {_p2}
- loop {shop::%{_s}%::*}:
- if (loop-index parsed as integer) > {_tPage-2}:
- set {_s::*} to loop-value split at " - "
- set {_i} to "%first element out of {_s::*}%" parsed as item
- set {_van::*} to vanilla name of {_i}
- set {_van} to first element out of {_van::*}
- replace all "minecraft:" in {_van} with ""
- replace all "_" in {_van} with " "
- set {_price} to "%2nd element out of {_s::*}%" parsed as number
- set {_i::*} to ("%{_van}%") split at " "
- loop {_i::*}:
- if {_name} is not set:
- set {_name} to cap(loop-value-2)
- else:
- set {_name} to "%{_name}% %cap(loop-value-2)%"
- format gui slot {_n} of {_p} with {_i} named "&b%{_name}%" lored "&8(&3!&8) &7Price: &b$%convertNum({_price})%" to run function buyitem({_p}, {_i}, {_price}, {_name})
- delete {_name}
- add 1 to {_n}
- if size of {shop::%{_s}%::*} > (45*{_page}):
- format gui slot 53 of {_p} with paper named "&8(&3!&8) &7Next Page" to run:
- shop({_p}, {-s}, {_page} + 1)
- if {_page} > 1:
- format gui slot 45 of {_p} with paper named "&8(&3!&8) &7Previous Page" to run:
- shop({_p}, {-s}, {_page} - 1)
- command /additem [<text>] [<number>]:
- permission: *
- permission message: &cno
- trigger:
- if arg-1 is not set:
- send "{@prefix} &8-- &7Categories: &bBuilding, Redstone, Farming, Drops"
- else if arg-1 is not set:
- send "{@prefix} &8-- &7You need a price... are you okay?"
- else if player's tool is not air:
- if arg-1 is "building" or "farming" or "redstone" or "Drops":
- set {_v} to "%vanilla name of tool%"
- replace all "minecraft:" in {_v} with ""
- replace all "_" in {_v} with " "
- send "{@prefix} &8-- &7Added &b%{_v}% &7to &b%arg-1% &7for &b$%arg-2%&7!"
- add "%player's tool% - %arg-2%" to {shop::%arg-1%::*}
- else:
- send "{@prefix} &8-- &7Invalid category."
- else:
- send "{@prefix} &8-- &7Please hold the item you want to add."
- command /delitem [<text>] [<text>]:
- permission: op
- permission message: &cno
- trigger:
- if arg-1 is not "building" or "farming" or "redstone" or "drops":
- send "{@prefix} &8-- &7Categories: &bBuilding, Redstone, Farming, Drops"
- else if arg-1 is not set:
- send "{@prefix} &8-- &7Choose an item."
- else if {shop::%arg-1%::*} does not contain arg-2:
- send "{@prefix} &8- &7ITEMS IN SHOP:"
- loop {shop::%arg-1%::*}:
- send "&8- &b%loop-value%"
- else:
- remove arg-2 from {shop::%arg-1%::*}
- send "{@prefix} &8- &7Removed the item from shop."
- function buyitem(p: player, i: item, price: number, name: text):
- if {bal::%{_p}%} >= {_price}:
- if {_p} has enough space for {_i}:
- give {_p} {_i}
- subtract {_price} from {bal::%{_p}%}
- send "{@prefix} &8- &7You bought &b%{_name}% &7for &b$%convertNum({_price})%&7!" to {_p}
- else:
- send "{@prefix} &8- &7You don't have enough inventory space!" to {_p}
- else:
- send "{@prefix} &8- &7You're too broke to do that!" to {_p}
- command /addsell [<number>]:
- permission: op
- permission message: &cno
- trigger:
- if arg-1 is not set:
- send "{@prefix} &8- &7Invalid price."
- else if player's tool is air:
- send "{@prefix} &8- &7Choose an item."
- else:
- add "%player's tool% - %arg-1%" to {sell::*}
- send "{@prefix} &8- &7Added your held item to /sell."
- command /delsell [<text>]:
- permission: op
- permission message: &cno
- trigger:
- if arg-1 is not set:
- send "{@prefix} &8- &7Choose an item."
- else:
- if {sell::*} does not contain arg-1:
- send "{@prefix} &8- &7ITEMS IN /SELL:"
- loop {sell::*}:
- send "&8- &b%loop-value%"
- else:
- remove arg-1 from {sell::*}
- send "{@prefix} &8- &7Removed the item from /sell."
- command /sell [<text>]:
- trigger:
- open virtual chest inventory with size 6 named "&3Sell Items &7($%convertNum({bal::%player%})%)" for player
- set {_n} to 0
- loop {sell::*}:
- set {_s::*} to loop-value split at " - "
- set {_i} to "%first element out of {_s::*}%" parsed as item
- set {_price} to "%2nd element out of {_s::*}%" parsed as number
- set {_van::*} to vanilla name of {_i}
- set {_van} to first element out of {_van::*}
- replace all "minecraft:" in {_van} with ""
- replace all "_" in {_van} with " "
- set {_i::*} to ("%{_van}%") split at " "
- loop {_i::*}:
- if {_name} is not set:
- set {_name} to cap(loop-value-2)
- else:
- set {_name} to "%{_name}% %cap(loop-value-2)%"
- format gui slot {_n} of player with {_i} named "&b%{_name}%" lored "&8(&3!&8) &7Price: &b$%convertNum({_price})%" to run function sellitem(player, {_i}, {_price}, {_name})
- delete {_name}
- add 1 to {_n}
- function sellitem(p: player, i: item, price: number, name: text):
- set {_num} to amount of {_i} in {_p}'s inventory
- if {_num} > 0:
- remove {_num} of {_i} from {_p}'s inventory
- add {_price}*{_num} to {bal::%{_p}%}
- send "{@prefix} &8- &7You sold &b%{_name}% &7for &b$%convertNum({_price}*{_num})%&7!" to {_p}
- else:
- send "{@prefix} &8- &7You don't have any &b%{_i}% &7to sell!" to {_p}
- on inventory close:
- custom name of event-inventory contains "&7($":
- wait 1 tick
- player command "/shop"
- on script load:
- set {_letters} to "Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz"
- set {_letter-pairs::*} to {_letters} split at " "
- loop {_letter-pairs::*}:
- set {_pair::*} to loop-value split at ""
- set {_uppercase} to {_pair::1}
- set {_lowercase} to {_pair::2}
- set {letters::uppercase::%{_lowercase}%} to {_uppercase}
- set {letters::lowercase::%{_uppercase}%} to {_lowercase}
- on script unload:
- delete {letters::*}
- function cap(text: text) :: text:
- set {_char} to the first character of {_text}
- set {_char} to {letters::uppercase::%{_char}%}
- set {_remaining} to ""
- set {_remaining} to the last (length of {_text} - 1) characters of {_text}
- return "%{_char}%%{_remaining}%"
- function convertNum(n: number) :: text:
- set {_n} to "%{_n}%"
- set {_n} to regex replace "(?<=\d)(?=(\d{3})+(?!\d))" with "," in {_n}
- return {_n}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement