# RynekBezTxt # Nazwa: RynekSK # Autor: naksu.reborn (Nick na discord), Hiri12 (Nick na skript.pl) on join: if {Balance::%player%} is not set: set {Balance::%player%} to 0 command /rynek [] []: aliases: ah, aukcje trigger: if arg-1 is not set: open rynek(player, 1, "Wszystko", false) to player else: if arg-1 is "wystaw": if arg-2 is not set: send "&4☹ <##D03535>Podaj cene itemu!" else: if player's tool is air: send "&4☹ <##D03535>Nie mozesz wystawic powietrza!" else: send "&2☺ <##5EC438>Poprawnie dodano item na rynek!" add 1 to {GlobalItemID} set {Rynek::%{GlobalItemID}%} to player's tool set {RynekData::%{GlobalItemID}%::Owner} to player set {RynekData::%{GlobalItemID}%::Cost} to arg-2 set player's tool to air else: send "&4☹ <##D03535>Poprawne użycie: /rynek wystaw " function rynek(player: player, page: number, sort: text, costsort: boolean) :: 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 sunflower named "&aSortowanie: &6&l%{_sort}%" with lore {_lore::*} set slot 45 of {_x} to end portal frame named "&5Twoje Przedmioty" set {_l::*} to " &3- &eWzrastajaca" and " &3- &7Malejaca" if {_costsort} is true: set {_l::*} to " &3- &7Wzrastajaca" and " &3- &eMalejaca" 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}%}%" with lore {_lore::*} and "" and "&aSprzedawca: &6%{_owner::%{_p}%::%{_b}%}%" and "&aCena: &6%{_b}%$" and "" and "&eKliknij, aby kupic!" if {_sort} is "Wszystko": 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 {_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}%}%$" return {_x} command /dajkasa [] []: permission: dajkasa.sk permission message: &cNie masz permisji! trigger: if arg 1 or arg 2 is not set: send "&4☹ <##D03535>Poprawne użycie: /dajkasa " stop add arg 2 to {Balance::%arg 1%} open rynek(arg 1, 1, "Wszystko", false) to arg 1 send "&2☺ <##5EC438>Poprawnie doładowano konto gracza %arg 1% o %arg 2%$" 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 slot {_c} of {_x} to loop-value named "&b%name of loop-value ? loop-value%" with lore "" 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 "&4☹ <##D03535>Nic 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} on inventory click: if name of current inventory of player contains "&8Twoje przedmioty": cancel event if clicked slot is 49: open rynek(player, 1, "Wszystko", false) 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 "&2☺ <##5EC438>Pomyślnie usunięto item z rynku!" RynekMy(player, {_b::1} parsed as number) stop else: send "&4☹ <##D03535>Nie 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}) 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-value is {_c}: if "%{RynekData::%loop-index%::Owner}%" is "%player%": if clicked slot is not barrier named "&4☹ <##D03535>Nie mozesz kupic swojego przedmiotu!": set {_a} to clicked slot set clicked slot to barrier named "&4☹ <##D03535>Nie mozesz kupic swojego przedmiotu!" wait 1.5 seconds set clicked slot to {_a} stop if "%{RynekData::%loop-index%::Owner}%" is "%{_a::2}%": if "%{RynekData::%loop-index%::Cost}%" is "%{_b::2}%": if {Balance::%player%} >= {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%} add {RynekData::%loop-index%::Cost} to {Balance::%{RynekData::%loop-index%::Owner}%} send "&2☺ <##5EC438>Zakupiono przedmiot od &6%{RynekData::%loop-index%::Owner}%!" send "&2☺ <##5EC438>Gracz &6%player%<##5EC438> 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 "&4☹ <##D03535>Nie masz miejsca w ekwipunku na ten przedmiot!" stop else: send "&4☹ <##D03535>Brakuje ci %{RynekData::%loop-index%::Cost}-{Balance::%player%}% Monet!" stop if clicked slot is 45: RynekMy(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}) 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}) 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}) to player