Options: prefix: rynek: "&7[&aRynek&7] &r" addons: anvil: true #Włacza/wyłącza AnvilGuiSearch [wymagany Addon na serwerze: Skript-AnvilGUI 1.4] function rynek(player: player, page: number, sort: text, costsort: boolean, search: text) :: inventory: set {_strona} to {_page} set {_max} to floor((size of {Rynek::*}/45)-0.001)+1 if {_max} is 0: set {_brak} to true set {_max} to 1 set {_strona} to 1 if {_strona} <= 1: set {_strona} to 1 set {_prev} to true if {_strona} >= {_max}: set {_strona} to {_max} set {_next} to true set {_x} to chest inventory with 6 rows named "&8Rynek (&e%{_strona}%&7/&e%{_max}%&8)" set slots (integers between 45 and 53) of {_x} to gray stained glass pane named "&7" set {_list::*} to "Wszystko" and "Bloki" and "Mikstury" and "Narzedzia" and "Zbroje" and "Inne" loop {_list::*}: if {_sort} is loop-value: add "&3- &a%loop-value%" to {_lore::*} else: add "&3- &7%loop-value%" to {_lore::*} set slot 53 of {_x} to hopper named "&aSortowanie: &6&l%{_sort}%" with lore {_lore::*} set slot 45 of {_x} to end portal frame named "&5Twoje Przedmioty" set slot 46 of {_x} to ender chest named "&5Przedmioty Zwrócone" set {_l::*} to " &3- &eWzrastajaca" and " &3- &7Malejaca" if {_costsort} is true: set {_l::*} to " &3- &7Wzrastajaca" and " &3- &eMalejaca" if {@addons.anvil} is true: set slot 51 of {_x} to lectern named "&aSzukaj" with lore "&7Wyszukaj przedmiot po:" and "&7-Wszystko" and "&7-Sprzedający" and "&7-Opis" and "&7-Typ" and "&7-Nazwa" and "&7Jeżeli szukasz po typie użyj" and "&7angielskiej nazwy!" and "&7Np. diamond nie diament" and "&eKliknij, aby szukać!" set slot 52 of {_x} to gold ingot named "&aCena" with lore "&7Sortuj przedmioty wedlug ceny:" and {_l::*} and "" and "&eKliknij, aby zmienic!" if {_prev} is not set: set slot 48 of {_x} to arrow named "&aPoprzednia strona" if {_next} is not set: set slot 50 of {_x} to arrow named "&aNastepna strona" set {_c} to 0 loop {Rynek::*}: set {_NewList::%loop-value%.%loop-index%} to {RynekData::%loop-index%::Cost} set {_owner::%loop-value%::%{RynekData::%loop-index%::Cost}%} to {RynekData::%loop-index%::Owner} set {_item::%loop-value%::%{RynekData::%loop-index%::Cost}%} to loop-value if {_costsort} is false: set {_top::*} to sorted indices of {_NewList::*} in ascending order else: set {_top::*} to sorted indices of {_NewList::*} in descending order loop size of {Rynek::*} times: add 1 to {_n} set {_u} to {_top::%{_n}%} set {_split::*} to split {_u} at "." replace all ".%{_split::2}%" with "" in {_u} set {_b} to "%{_NewList::%{_u}%.%{_split::2}%}%" set {_p} to {_u} if {_b} is not set: set {_b} to "None" set {_p} to "0" add 1 to {_a} if {_a} > (45*{_strona})-45: set {_lore::*} to lore of {_item::%{_p}%::%{_b}%} set {_item} to {_item::%{_p}%::%{_b}%} named "&b%name of {_item::%{_p}%::%{_b}%} ? {_item::%{_p}%::%{_b}%}%" set {_amount_item::*} to uncolored name of {_item} split at " " if {_amount_item::1} parsed as number is set: set {_item} to {_amount_item::1} parsed as number of plain {_item} if uncolored {_item}'s name is "%{_item}'s type%": set {_item} to plain {_item} set {_item} to {_item} with lore {_lore::*} and "" and "&aSprzedawca: &6%{_owner::%{_p}%::%{_b}%}%" and "&aCena: &6%{_b}%$" and "" and "&aID:&f %{_split::2}%" and "&eKliknij, aby kupic!" if {_sort} is "Wszystko": if {_search} is not "None": if name of {_item} contains {_search}: set slot {_c} of {_x} to {_item} add 1 to {_c} else if "%{_item}'s lore%" contains {_search}: set slot {_c} of {_x} to {_item} add 1 to {_c} else if "%{_item}'s type%" contains {_search}: set slot {_c} of {_x} to {_item} add 1 to {_c} else: set slot {_c} of {_x} to {_item} add 1 to {_c} if {_sort} is "Bloki": if "%{_item::%{_p}%::%{_b}%}%" parsed as item is a block: set slot {_c} of {_x} to {_item} add 1 to {_c} if {_sort} is "Mikstury": if "%{_item::%{_p}%::%{_b}%}%" parsed as item is a potion: set slot {_c} of {_x} to {_item} add 1 to {_c} if {_sort} is "Narzedzia": if {_item::%{_p}%::%{_b}%} is pickaxe or axe or hoe or shovel or bow or crossbow: set slot {_c} of {_x} to {_item} add 1 to {_c} if {_sort} is "Zbroje": if {_item::%{_p}%::%{_b}%} is armour: set slot {_c} of {_x} to {_item} add 1 to {_c} if {_sort} is "Inne": if "%{_item::%{_p}%::%{_b}%}%" parsed as item is not a block: if "%{_item::%{_p}%::%{_b}%}%" parsed as item is not a potion: if {_item::%{_p}%::%{_b}%} is not pickaxe or axe or hoe or shovel or bow or crossbow or armour: set slot {_c} of {_x} to {_item} add 1 to {_c} else if {_item::%{_p}%::%{_b}%} is not set: set {_brak} to true if {_c} > 45-1: stop loop if {_c} = 0: set slot 22 of {_x} to barrier named "&cRynek jest pusty!" if {_brak} is true: # Pusty rynek set slot 22 of {_x} to barrier named "&cRynek jest pusty!" set slot 49 of {_x} to book named "&7Informacje: " with lore "&8» &7Komenda do wystawiania przedmiotów: &f/rynek wystaw " and "&8» &7Twój aktualny stan konta: &f%{Balance::%{_player}'s name%}%$" return {_x} function RynekMy(player: player, page: number): loop {Rynek::*}: if {RynekData::%loop-index%::Owner} is {_player}: add loop-value to {_MyItems::*} set {_max} to floor((size of {_MyItems::*}/45)-0.001)+1 set {_strona} to {_page} set {_x} to chest inventory with 6 rows named "&8Twoje przedmioty (&e%{_strona}%&7/&e%{_max}%&8)" if {_max} is 0: set {_brak} to true set {_max} to 1 set {_strona} to 1 if {_strona} <= 1: set {_strona} to 1 set {_prev} to true if {_strona} >= {_max}: set {_strona} to {_max} set {_next} to true set {_c} to 0 loop {Rynek::*}: if {RynekData::%loop-index%::Owner} is {_player}: add 1 to {_a} if {_a} > (45*{_strona})-45: set {_item} to loop-value set {_lore::*} to lore of loop-value set {_item} to {_item} named "&b%name of {_item} ? {_item}%" set {_amount_item::*} to uncolored name of {_item} split at " " if {_amount_item::1} parsed as number is set: set {_item} to {_amount_item::1} parsed as number of plain {_item} if uncolored {_item}'s name is "%{_item}'s type%": set {_item} to plain {_item} set slot {_c} of {_x} to {_item} with lore {_lore::*} and "" and "&aSprzedawca: &6Ty" and "&aCena: &6%{RynekData::%loop-index%::Cost}%$" and "" and "&eKliknij, aby usunąć z rynku!" add 1 to {_c} if {_c} is not set: set slot 22 of {_x} to barrier named "&4Nic jeszcze nie wystawiles!" set slots (integers between 45 and 53) of {_x} to light gray stained glass pane named "&7" if {_prev} is not set: set slot 45 of {_x} to book named "&aPoprzednia strona" if {_next} is not set: set slot 53 of {_x} to book named "&aNastepna strona" set slot 49 of {_x} to arrow named "&cPowrot" open {_x} for {_player} function ReturnItems(player: player, page: number): set {_max} to floor((size of {RynekData::ReturnStorage::%{_player}'s name%::*}/45)-0.001)+1 set {_strona} to {_page} set {_x} to chest inventory with 6 rows named "&8Twoje zwroty (&e%{_strona}%&7/&e%{_max}%&8)" if {_max} is 0: set {_brak} to true set {_max} to 1 set {_strona} to 1 if {_strona} <= 1: set {_strona} to 1 set {_prev} to true if {_strona} >= {_max}: set {_strona} to {_max} set {_next} to true set {_c} to 0 loop {RynekData::ReturnStorage::%{_player}'s name%::*}: add 1 to {_a} if {_a} > (45*{_strona})-45: set {_item} to loop-value set {_lore::*} to lore of loop-value set {_amount_item::*} to uncolored name of {_item} split at " " if {_amount_item::1} parsed as number is set: set {_item} to {_amount_item::1} parsed as number of plain {_item} if uncolored {_item}'s name is "%{_item}'s type%": set {_item} to plain {_item} set slot {_c} of {_x} to {_item} with lore {_lore::*} and "" and "&aWycofany Przez: &6%{RynekData::ReturnStorage_admin::%{_player}'s name%::%loop-index%}%" and "" and "&eKliknij, aby odebrać!" add 1 to {_c} if {_c} is not set: set slot 22 of {_x} to barrier named "&4Nie posiadasz zwrotów!" set slots (integers between 45 and 53) of {_x} to light gray stained glass pane named "&7" if {_prev} is not set: set slot 45 of {_x} to book named "&aPoprzednia strona" if {_next} is not set: set slot 53 of {_x} to book named "&aNastepna strona" set slot 49 of {_x} to arrow named "&cPowrot" open {_x} for {_player} command /rynek [] []: aliases: ah, aukcje trigger: if arg-1 is not set: open rynek(player, 1, "Wszystko", false, "None") to player else: if arg-1 is "szukaj" or "wyszukaj" or "search": open rynek(player, 1, "Wszystko", false, arg-2) to player else if arg-1 is "wystaw": if arg-2 is not set: send "%{@prefix.rynek}%&4Podaj cene itemu!" else: if player's tool is air: send "%{@prefix.rynek}%&4Nie mozesz wystawic powietrza!" else: send "%{@prefix.rynek}%&2Poprawnie dodano item na rynek!" add 1 to {ShopItemID} set {Rynek::%{ShopItemID}%} to player's tool set {RynekData::%{ShopItemID}%::Owner} to player's name set {RynekData::%{ShopItemID}%::Cost} to arg-2 set player's tool to air else: send "%{@prefix.rynek}%&4Poprawne użycie: /rynek wystaw " if player has permission "ecomony.admin": if arg-1 is "wyczysc": if {ekonomy.confirm_action_rynek} is not set: send "%{@prefix.rynek}%&4Zamierzasz wyczyścić bazę danych Rynku!%nl%Akcja ta nie może zostać cofnięta!%nl%Usunięte dane zostaną utracone na zawsze!%nl%Jeżeli chcesz kontynuować wpisz: &6/sklep wyczysc_confirm&4!%nl%Na potwierdzenie masz &630 sekund&4!" set {ekonomy.confirm_action_rynek} to true wait 30 seconds delete {ekonomy.confirm_action_rynek} else if arg-1 is "wyczysc_confirm": if {ekonomy.confirm_action_rynek} is not set: send "%{@prefix.rynek}%&4Nie możesz potwierdzić nie ropoczętej akcji!" else: delete {Rynek::*} delete {RynekData::*} delete {ShopItemID} send "%{@prefix.rynek}%&6Usunięto bazę danych!" else: open rynek(player, 1, "Wszystko", false, "None") to player on inventory click: event-inventory is not player's inventory if name of current inventory of player contains "&8Twoje przedmioty": cancel event if clicked slot is 49: open rynek(player, 1, "Wszystko", false, "None") to player if clicked slot is 45: if clicked slot is book: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" RynekMy(player, {_b::1} parsed as number -1) if clicked slot is 53: if clicked slot is book: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" RynekMy(player, {_b::1} parsed as number +1) if clicked slot > -1: if clicked slot < 45: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_a::*} to uncolored lore of clicked slot loop {_a::*}: if "%loop-value%" contains "Sprzedawca:": set {_a} to loop-value if "%loop-value%" contains "Cena": set {_b} to loop-value set {_a::*} to {_a} split at " " set {_b::*} to {_b} split at " " replace all "$" with "" in {_b::2} set {_c} to clicked slot delete {_c}'s lore set name of {_c} to "" loop {Rynek::*}: if loop-value is {_c}: if "%{_a::2}%" is "Ty": if "%{RynekData::%loop-index%::Cost}%" is "%{_b::2}%": if player has enough space for {Rynek::%loop-index%}: give {Rynek::%loop-index%} to player delete {Rynek::%loop-index%} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_l::*} to lore of slot 53 of current inventory of player send "%{@prefix.rynek}%&2Pomyślnie usunięto item z rynku!" RynekMy(player, {_b::1} parsed as number) stop else: send "%{@prefix.rynek}%&4Nie masz miejsca w ekwipunku na ten przedmiot!" stop if name of current inventory of player contains "&8Twoje zwroty": cancel event if clicked slot is 49: open rynek(player, 1, "Wszystko", false, "None") to player if clicked slot is 45: if clicked slot is book: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" ReturnItems(player, {_b::1} parsed as number -1) if clicked slot is 53: if clicked slot is book: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" ReturnItems(player, {_b::1} parsed as number +1) if clicked slot > -1: if clicked slot < 45: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_c} to clicked slot delete {_c}'s lore set name of {_c} to "" loop {RynekData::ReturnStorage::%player's name%::*}: if loop-value is {_c}: if player has enough space for {RynekData::ReturnStorage::%player's name%::%loop-index%}: give {RynekData::ReturnStorage::%player's name%::%loop-index%} to player delete {RynekData::ReturnStorage::%player's name%::%loop-index%} delete {RynekData::ReturnStorage_Admin::%player's name%::%loop-index%} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_l::*} to lore of slot 53 of current inventory of player send "%{@prefix.rynek}%&2Pomyślnie zwrócono przedmiot!" ReturnItems(player, {_b::1} parsed as number) stop else: send "%{@prefix.rynek}%&4Nie masz miejsca w ekwipunku na ten przedmiot!" stop if name of current inventory of player contains "&8Rynek": cancel event if clicked slot is 52: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_sort} to false set {_costsort::*} to lore of slot 52 of current inventory of player loop {_costsort::*}: if loop-value contains "&eWzrastajaca": set {_sort} to true set {_l::*} to lore of slot 53 of current inventory of player loop {_l::*}: if loop-value-1 contains "&3- &a": set {_current::*} to uncolored "Check%loop-value-1%" split at "- " open rynek(player, {_b::1} parsed as number, "%{_current::2} ? "Wszystko"%", {_sort}, "None") to player stop if clicked slot > -1: if clicked slot < 45: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_a::*} to uncolored lore of clicked slot loop {_a::*}: if "%loop-value%" contains "Sprzedawca:": set {_a} to loop-value if "%loop-value%" contains "Cena": set {_b} to loop-value set {_a::*} to {_a} split at " " set {_b::*} to {_b} split at " " replace all "$" with "" in {_b::2} set {_c} to clicked slot delete {_c}'s lore set name of {_c} to "" loop {Rynek::*}: if loop-index is not {_ID::2}: continue else if loop-index is {_ID::2}: if loop-value is {_c}: if player doesn't have permission "ekonomy.admin": if "%{RynekData::%loop-index%::Owner}%" is "%{_pname}%": if clicked slot is not barrier named "&4Nie mozesz kupic swojego przedmiotu!": set {_a} to clicked slot set clicked slot to barrier named "&4Nie mozesz kupic swojego przedmiotu!" wait 1.5 seconds set clicked slot to {_a} stop if "%{RynekData::%loop-index%::Cost}%" is "%{_b::2}%": if click type is right mouse button: if player has permission "ekonomy.admin": add {Rynek::%loop-index%} to {RynekData::ReturnStorage::%{RynekData::%loop-index%::Owner}%::*} add player's name to {RynekData::ReturnStorage_Admin::%{RynekData::%loop-index%::Owner}%::*} send "%{@prefix.rynek}%&4Admin &6%player's name%&4 wycofał Twój przedmiot ze sprzedaży!%nl%Możesz go odebrać w magazynie zwrotów!" to {RynekData::%loop-index%::Owner} send "%{@prefix.rynek}%&2Pomyślnie usunięto przedmiot z Rynku!" to player delete {Rynek::%loop-index%} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_l::*} to lore of slot 53 of current inventory of player set {_costsort::*} to lore of slot 52 of current inventory of player set {_sort} to true loop {_costsort::*}: if loop-value-2 contains "&eWzrastajaca": set {_sort} to false loop {_l::*}: if loop-value-2 contains "&3- &a": set {_current::*} to uncolored "Check%loop-value-2%" split at "- " open rynek(player, {_b::1} parsed as number, "%{_current::2} ? "Wszystko"%", {_sort}) to player stop stop if {Balance::%player's name%} >= {RynekData::%loop-index%::Cost}: if player has enough space for {Rynek::%loop-index%}: give {Rynek::%loop-index%} to player delete {Rynek::%loop-index%} remove {RynekData::%loop-index%::Cost} from {Balance::%player's name%} add {RynekData::%loop-index%::Cost} to {Balance::%{RynekData::%loop-index%::Owner}%} send "%{@prefix.rynek}%&2Zakupiono przedmiot od &6%{RynekData::%loop-index%::Owner}%!" send "%{@prefix.rynek}%&2Gracz &6%player's name%&2 zakupil twoj przedmiot!" to {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_l::*} to lore of slot 53 of current inventory of player set {_costsort::*} to lore of slot 52 of current inventory of player set {_sort} to true loop {_costsort::*}: if loop-value-2 contains "&eWzrastajaca": set {_sort} to false loop {_l::*}: if loop-value-2 contains "&3- &a": set {_current::*} to uncolored "Check%loop-value-2%" split at "- " open rynek(player, {_b::1} parsed as number, "%{_current::2} ? "Wszystko"%", {_sort}) to player stop stop else: send "%{@prefix.rynek}%&4Nie masz miejsca w ekwipunku na ten przedmiot!" stop else: send "%{@prefix.rynek}%&4Brakuje ci %{RynekData::%loop-index%::Cost} - {Balance::%player's name%}% $!" stop else: send "%{@prefix.rynek}%&cWystąpił nieoczekiwany błąd! Cena niezgodna z opisem!" dstop else: send "%{@prefix.rynek}%&cBłąd odczytu ID przedmiotu" stop if clicked slot is 45: RynekMy(player, 1) if clicked slot is 46: ReturnItems(player, 1) if clicked slot is 50: if clicked slot is arrow: set {_l::*} to lore of slot 53 of current inventory of player loop {_l::*}: if loop-value contains "&a": set {_x} to uncolored loop-value replace all "- " with "" in {_x} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_sort} to true set {_costsort::*} to lore of slot 52 of current inventory of player loop {_costsort::*}: if loop-value contains "&eWzrastajaca": set {_sort} to false open rynek(player, {_b::1} parsed as number +1, "%{_x}%", {_sort}, "None") to player if clicked slot is 48: if clicked slot is arrow: set {_l::*} to lore of slot 53 of current inventory of player loop {_l::*}: if loop-value contains "&a": set {_x} to uncolored loop-value replace all "- " with "" in {_x} set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_sort} to true set {_costsort::*} to lore of slot 52 of current inventory of player loop {_costsort::*}: if loop-value contains "&eWzrastajaca": set {_sort} to false open rynek(player, {_b::1} parsed as number -1, "%{_x}%", {_sort}, "None") to player if clicked slot is 53: set {_a::*} to uncolored name of current inventory of player split at "(" set {_b::*} to {_a::2} split at "/" set {_l::*} to lore of slot 53 of current inventory of player loop {_l::*}: if loop-value contains "&3- &a": set {_list::*} to "Wszystko" and "Bloki" and "Mikstury" and "Narzedzia" and "Zbroje" and "Inne" set {_check::*} to uncolored loop-value split at "- " loop {_list::*}: if {_next} is true: set {_correct} to loop-value-2 stop loop if loop-value-2 is {_check::2}: set {_next} to true set {_sort} to false set {_costsort::*} to lore of slot 52 of current inventory of player loop {_costsort::*}: if loop-value-2 contains "&eWzrastajaca": set {_sort} to true open rynek(player, 1, "%{_correct} ? "Wszystko"%", {_sort}, "None") to player on Skript load: if {@addons.anvil} is true: enable script "AnvilGuiSearch.sk" else: disable script "AnvilGuiSearch.sk"