Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
function shop(p: player, n: text):
wait a ticks
set {_size} to size of {Shop.%{_n}%::*}
if {_size} is between 0 and 7:
set {_r} to 1
else if {_size} is between 8 and 16:
set {_r} to 2
else if {_size} is between 17 and 25:
set {_r} to 3
else if {_size} is between 26 and 34:
set {_r} to 4
else if {_size} is between 35 and 43:
set {_r} to 5
else:
set {_r} to 6
open chest with {_r} rows named "&9Shop %{_n}%" to {_p}
set {_s} to 0
loop {Shop.%{_n}%::*}:
set {_pr::*} to loop-value split at ":"
if {_pr::2} is not set:
set {_pr::2} to "Not sellable"
if {_pr::1} is not set:
set {_pr::1} to "Not buyable"
if {_pr::1} is "0":
set {_pr::1} to "Not buyable"
if {_pr::2} is "0":
set {_pr::2} to "Not sellable"
set {_i} to loop-index
replace every "object:" with "" in {_i}
set {_i} to "%{_i}%" parsed as item
#send "%loop-index%" to {_p}
set slot {_s} of {_p}'s current inventory to {_i} with lore "&8------------||&r||&9Item: &e%loop-index%||&9Buyprice: &e%{_pr::1}%$||&9Sellprice: &e%{_pr::2}%$||&r||&8Rightclick to buy||&8Leftclick to sell||&r||&8------------"
add 1 to {_s}
if {_r} is 1:
set {_s} to 8
if {_r} is 2:
set {_s} to 17
if {_r} is 3:
set {_s} to 26
if {_r} is 4:
set {_s} to 35
if {_r} is 5:
set {_s} to 44
if {_r} is 6:
set {_s} to 53
set slot {_s} of {_p}'s current inventory to red stained glass pane named "&c<<< Back"
command /shop [<text>] [<text>] [<text>]:
trigger:
if arg-1 is not set:
set {_size} to size of {Shop.Menu::*}
if {_size} is between 0 and 8:
set {_r} to 1
else if {_size} is between 9 and 17:
set {_r} to 2
else if {_size} is between 18 and 26:
set {_r} to 3
else if {_size} is between 27 and 35:
set {_r} to 4
else if {_size} is between 36 and 45:
set {_r} to 5
else:
set {_r} to 6
open chest with {_r} rows named "&6Shop Menu" to player
set {_s} to 0
loop {Shop.Menu::*}:
set slot {_s} of player's current inventory to loop-value named "&6%loop-index%" with lore "&9Click here to open %loop-index% Shop."
add 1 to {_s}
else if arg-1 is "menu":
if player has permission "shop.add":
if arg-2 is "add":
if player's held item is air:
send "&cSorry. But you need held some items for GUI. (Icons)"
else:
if arg-3 is not set:
send "&cSorry, But you need set name for GUI. Example: Blocks."
else if arg-3 is "menu":
send "&cSorry, but dont use this name!"
else:
if {Shop.Menu::%arg-3%} is set:
send "&cSorry, but this name is already set."
else:
set {Shop.Menu::%arg-3%} to player's held item
send "&aSucessfully for Shop Menu added."
else if arg-2 is "remove":
if arg-3 is not set:
send "&cSorry, but enter the Name, Do you want removed it."
else:
if {Shop.Menu::%arg-3%} is set:
delete {Shop.Menu::%arg-3%}
delete {Shop.%arg-3%::*}
send "&aSucessfully removed."
else:
send "&a%arg-3% can't found it."
else:
send "&cSorry, you have no permission for it."
else if arg-1 is not "help":
if player has permission "Shop":
if {Shop.Menu::%arg-1%} is set:
if player's held item is air:
send "&cSorry. But you need held some items for selling/removed from %arg-1%."
else:
if arg-2 is "add":
if arg-3 is set:
set {_i} to "%player's held item%:%data value of player's held item%"
set {Shop.%arg-1%::%{_i}%} to "%arg-3%"
send "&aScuessfully added!"
else:
send "&cPlease enter the Price."
else if arg-2 is "remove":
set {_i} to "%player's held item%:%data value of player's held item%"
if {Shop.%arg-1%::%{_i}%} is set:
delete {Shop.%arg-1%::%{_i}%}
send "&aSucessfully removed."
else:
send "&cThe Items cannot found on %arg-1%"
else:
send "&cSorry, but you need add first &e%arg-1% &cto &eMenu&c."
else:
send "&cSorry, but you have no Permission."
else if arg-1 is "help":
send "&9 Info &8--------------- &e Example"
send "&9Add a Icons to Menu: &e/shop menu add Blocks"
send "&9Add a Items to selling/Buying: &e/shop blocks add 100:20"
send "&9Remove a Icons from Menu: &e/Shop menu remove Blocks"
send "&9Remove a Items from selling/Buying: &e/shop blocks remove"
send "&c(You need hold some items do you want to removed it)"
on inventory click:
if inventory name of player's current inventory is "&6Shop Menu":
cancel event
set {_name} to "%uncolored clicked item name%"
if {Shop.Menu::%{_name}%} is set:
shop(player, {_name})
else if inventory name of player's current inventory contains "&9Shop":
cancel event
set {_name} to "%uncolored clicked item name%"
if {_name} is "<<< Back":
close player's inventory
wait a ticks
make player execute command "/shop"
else:
set {_l::*} to uncolored clicked item lore split at ","
replace every " Item: " with "" in {_l::3}
replace every " Buyprice: " with "" in {_l::4}
replace every "$" with "" in {_l::4}
replace every " Sellprice: " with "" in {_l::5}
replace every "$" with "" in {_l::5}
set {_i} to {_l::3} parsed as item
if click type is "LEFT":
if {_l::4} is "Not buyable":
send "&cThis is not buyable"
else:
set {_b} to {_l::4} parsed as integer
if player's money is more than or equal to {_b}:
remove {_b} from player's money
give player {_i}
send "&aYou scuessfully buying %{_i}%"
else:
send "&cSorry, you have low Money..."
else if click type is "RIGHT":
if {_l::5} is "Not sellable":
send "&cThis is not sellable"
else:
set {_s} to {_l::5} parsed as integer
if player has 1 of {_i}:
remove {_i} from player's inventory
add {_s} to player's money
send "&aYou scuessfully selling %{_i}%"
else:
send "&cSorry, but you have no %{_i}% more..."