options:
kox-max: 1
refill-max: 16
perla-max: 4
totem-max: 1
deposit-name: &6&lSchowek
function reloadStorageGUI(p: player):
set slot 6 of {_p}'s current inventory to enchanted golden apple named "&c&lKoxy" with lore "&6Kliknij i wyplac koxy ze schowka!", "", "&bPosiadasz: &e%{storage::kox::%{_p}%}%", "" and "&7Kliknij &aLPM&7, aby wyplacic!"
set slot 2 of {_p}'s current inventory to golden apple named "&c&lRefille" with lore "&6Kliknij i wyplac refy ze schowka!", "", "&bPosiadasz: &e%{storage::refill::%{_p}%}%", "" and "&7Kliknij &aLPM&7, aby wyplacic!"
set slot 10 of {_p}'s current inventory to totem of undying named "&c&lTotemy" with lore "&6Kliknij i wyplac totemy ze schowka!", "", "&bPosiadasz: &e%{storage::totem::%{_p}%}%", "" and "&7Kliknij &aLPM&7, aby wyplacic!"
set slot 16 of {_p}'s current inventory to ender pearl named "&c&lPerly" with lore "&6Kliknij i wyplac perly ze schowka!", "", "&bPosiadasz: &e%{storage::pearl::%{_p}%}%", "" and "&7Kliknij &aLPM&7, aby wyplacic!"
set slot 22 of {_p}'s current inventory to hopper named "&c&lWypłać Wszystko" with lore "&6Kliknij i wyplac wszystko ze schowka!", "", "&7Kliknij &aLPM&7, aby wyplacic!"
function getItemInStorage(p: player, i: item, n: integer, v: text, t: text) :: boolean:
{_p} has {_n} of {_i}:
send "&cJuz masz &6%{_n}% &c%{_t}%!" to {_p}
return false
{storage::%{_v}%::%{_p}%} is less than 1:
send "&cProbowalem wyplacic kilka %{_t}%, ale masz pusty schowek." to {_p}
return false
{_p} doesn't have enough space for 1 of {_i}:
send "&cProbowalem wyplacic kilka %{_t}%, ale masz pelny ekwipunek." to {_p}
return false
loop {_n} times:
{_p} has {_n} of {_i}:
exit loop
{storage::%{_v}%::%{_p}%} is less than 1:
exit loop
{_p} doesn't have enough space for {_i}:
exit loop
add {_i} to {_p}
remove 1 from {storage::%{_v}%::%{_p}%}
add 1 to {_num}
{_num} is not set:
return false
send "&aWyplacono &6%{_num}% &a%{_t}%!" to {_p}
return true
every 1 second:
set {_i::*} to ender pearl, enchanted golden apple, golden apple, totem of undying
set {_n::*} to {@perla-max}, {@kox-max}, {@refill-max}, {@totem-max}
set {_v::*} to "pearl", "kox", "refill", "totem"
set {_t::*} to "pereł", "koxów", "refilli", "totemów"
loop all players:
loop {_i::*}:
loop-player has ({_n::%loop-index%} + 1) of loop-value-2
add ((amount of loop-value-2 in loop-player's inventory) - {_n::%loop-index%}) to {storage::%{_v::%loop-index%}%::%loop-player%}
remove ((amount of loop-value-2 in loop-player's inventory) - {_n::%loop-index%}) of loop-value-2 from loop-player's inventory
send "&cMiales za duzo %{_t::%loop-index%}%, przeniesiono nadmiar do depozytu!" to loop-player
every 1 second:
set {_n::*} to {@perla-max}
loop all players:
loop {ender pearl::*}:
loop-player has ({_n::%loop-index%} + 1) of loop-value-2
add ((amount of loop-value-2 in loop-player's inventory) - {_n::%loop-index%}) to {storage::%{pearl::%loop-index%}%::%loop-player%}
remove ((amount of loop-value-2 in loop-player's inventory) - {_n::%loop-index%}) of loop-value-2 from loop-player's inventory
send "&cMiales za duzo %{pereł::%loop-index%}%, przeniesiono nadmiar do depozytu!" to loop-player
command /schowek:
executable by: players
trigger:
set {_i::*} to "kox", "refill", "pearl", "totem"
loop {_i::*}:
{storage::%loop-value%::%player%} is not set
set {storage::%loop-value%::%player%} to 0
open chest inventory with 3 row named "{@deposit-name}" to player
set slot (integers between 0 and 26) of player's current inventory to gray glass pane named " "
reloadStorageGUI(player)
on inventory click:
name of player's current inventory is "{@deposit-name}"
clicked inventory is not player's inventory
cancel event
if clicked slot is 6:
getItemInStorage(player, enchanted golden apple, {@kox-max}, "kox", "koxów") is true
reloadStorageGUI(player)
if clicked slot is 2:
getItemInStorage(player, golden apple, {@refill-max}, "refill", "refilli") is true
reloadStorageGUI(player)
if clicked slot is 10:
getItemInStorage(player, totem of undying, {@totem-max}, "totem", "totemów") is true
reloadStorageGUI(player)
if clicked slot is 16:
getItemInStorage(player, ender pearl, {@perla-max}, "pearl", "pereł") is true
reloadStorageGUI(player)
if clicked slot is 22:
getItemInStorage(player, golden apple, {@refill-max}, "refill", "refilli")
getItemInStorage(player, ender pearl, {@perla-max}, "pearl", "pereł") is true
getItemInStorage(player, totem of undying, {@totem-max}, "totem", "totemów")
getItemInStorage(player, enchanted golden apple, {@kox-max}, "kox", "koxów") is true
reloadStorageGUI(player)