# DISCORD: eeeeebcv (Modified & Optimized) # Zezwalam na modyfikację w celach własnych, zakaz publikowania jako swojego, zakaz kopiowania # Wersja: 2.1 (Dostosowana pod Skript 2.15.2, Skript-Holograms) #═══════════════════════════════════════════════════════════════════ #⚙️ CONFIG #═══════════════════════════════════════════════════════════════════ options: permisja: admin.perm nazwa: Skrzynia prefix: &8[&6YCHEST&8] # Blokada stawiania i typ klucza typ_klucza: tripwire hook of unbreaking 10 typ_klucza_antyplace: tripwire hook typ_skrzyni: light gray shulker box or lime shulker box or light blue shulker box or purple shulker box or yellow shulker box or chest # Hologramy (Skript-Holograms) hologram_linia1: &7ʟᴘᴍ ᴀʙʏ ᴘᴏᴅᴇᴊʀᴢᴇᴄ hologram_linia2: &7ᴘᴘᴍ ᴀʙʏ ᴏᴛᴡᴏʀᴢʏᴄ # Wiadomości i dźwięki noKeySound: entity.villager.no noKeyTitle: &cNie posiadasz klucza! noKeySubtitle: &7Zakup klucz na naszym discordzie sila_odpychania: 0.9 losowanie_dzwiek: block.note_block.harp losowanie_success_dzwiek: entity.item.pickup pitch_losowania: 0.1 empty_chest_message: &cSkrzynia jest pusta! Zwracam klucz ilosc_przesuniec: 10 czas_miedzy_przesuwaniem: 2 ticks keyall_title: &bDarmowe klucze! keyall_subtitle: &b%player% &7rozdał &6%{_ilosc}% &7x %{_nazwafind}% # JĘZYK KOMEND usuwanie: del ustawianie: set przenoszenie: move pomoc: help edytowanie: edit resetowanie: reset lista: list # OBRAMOWANIE GUI PODGLĄDU sloty_obramowanie_1: 0, 2, 4, 6, 8, 18, 26, 36, 38, 40, 42, 44 sloty_obramowanie_2: 1, 3, 5, 7, 9, 17, 27, 35, 37, 39, 41, 43 obramowanie_1: purple stained glass pane named "&7" obramowanie_2: magenta stained glass pane named "&7" #═══════════════════════════════════════════════════════════════════ #🔋 Ładowanie skryptu & Dynamiczny System Skrzyń #═══════════════════════════════════════════════════════════════════ on load: clear {yc::definicje::*} clear {yc::klucze_szukaj::*} # Tutaj definiujesz dowolną ilość skrzyń! ID -> Nazwa skrzyni -> Nazwa klucza # Możesz dopisać kolejne skrzynie (6, 7, 8...) w identyczny sposób. registerChest(1, "&7&lZwykła", "&7Zwykły klucz") registerChest(2, "&a&lRzadka", "&aRzadki klucz") registerChest(3, "&b&lBardzo rzadka", "&bBardzo rzadki klucz") registerChest(4, "&5&lEpicka", "&5Epicki klucz") registerChest(5, "&6&lLegendarna", "&6Legendarny klucz") function registerChest(id: integer, name: text, key: text): set {yc::definicje::%{_id}%::nazwa} to {_name} set {yc::definicje::%{_id}%::klucz} to {_key} set {_uncolored} to uncoloured {_key} set {yc::klucze_szukaj::%{_uncolored}%} to {_key} #═══════════════════════════════════════════════════════════════════ #💻 Komendy #═══════════════════════════════════════════════════════════════════ command /skrzynia [] []: aliases: yc, ychest permission: {@permisja} trigger: set {_loc} to location of target block if arg 1 is "{@ustawianie}": if arg 2 is not set: send "{@prefix} &cPodaj ID skrzyni!" stop if {yc::definicje::%arg 2%::nazwa} is not set: send "{@prefix} &cSkrzynia o ID %arg 2% nie istnieje w konfiguracji!" stop if target block is not {@typ_skrzyni}: send "{@prefix} &cMusisz patrzeć na prawidłowy blok skrzyni!" stop if {yc::skrzynie::%{_loc}%::id} is set: send "{@prefix} &bW tym miejscu istnieje już skrzynia!" stop set {yc::skrzynie::%{_loc}%::id} to arg 2 set {yc::lokacje::%arg 2%} to {_loc} # Skript-Holograms API delete hologram with id "yc_%{_loc}%" create hologram with id "yc_%{_loc}%" at block above target block append line "%{yc::definicje::%arg 2%::nazwa}% {@nazwa}" to hologram id "yc_%{_loc}%" append line "{@hologram_linia1}" to hologram id "yc_%{_loc}%" append line "{@hologram_linia2}" to hologram id "yc_%{_loc}%" send "{@prefix} &7Ustawiłeś skrzynię: %{yc::definicje::%arg 2%::nazwa}% &7na pozycjach: &b%x-coord of {_loc}%, %y-coord of {_loc}%, %z-coord of {_loc}%" else if arg 1 is "{@przenoszenie}": if arg 2 is not set: send "{@prefix} &cPodaj ID skrzyni, którą przenosisz!" stop if target block is not {@typ_skrzyni}: send "{@prefix} &cMusisz patrzeć na prawidłowy blok!" stop set {_stara_loc} to {yc::lokacje::%arg 2%} if {_stara_loc} is set: delete hologram id "yc_%{_stara_loc}%" delete {yc::skrzynie::%{_stara_loc}%::id} set {yc::skrzynie::%{_loc}%::id} to arg 2 set {yc::lokacje::%arg 2%} to {_loc} create hologram with id "yc_%{_loc}%" at block above target block append line "%{yc::definicje::%arg 2%::nazwa}% {@nazwa}" to hologram id "yc_%{_loc}%" append line "{@hologram_linia1}" to hologram id "yc_%{_loc}%" append line "{@hologram_linia2}" to hologram id "yc_%{_loc}%" send "{@prefix} &bPrzeniosłeś skrzynię na kordy: %x-coord of {_loc}%, %y-coord of {_loc}%, %z-coord of {_loc}%" else if arg 1 is "{@edytowanie}": if {yc::skrzynie::%{_loc}%::id} is not set: send "{@prefix} &cMusisz patrzeć na zarejestrowaną skrzynię!" stop set {-yc::edit::%player%} to {yc::skrzynie::%{_loc}%::id} editChest({yc::skrzynie::%{_loc}%::id}, player) else if arg 1 is "{@usuwanie}": if {yc::skrzynie::%{_loc}%::id} is set: set {_id} to {yc::skrzynie::%{_loc}%::id} delete hologram id "yc_%{_loc}%" delete {yc::lokacje::%{_id}%} delete {yc::skrzynie::%{_loc}%::id} send "{@prefix} &aPomyślnie usunięto skrzynię." else: send "{@prefix} &cMusisz patrzeć na aktywną skrzynię." else if arg 1 is "{@resetowanie}": loop {yc::lokacje::*}: delete hologram id "yc_%loop-value%" delete {yc::skrzynie::*} delete {yc::lokacje::*} send "{@prefix} &bUsunąłeś &nwszystkie &bpostawione skrzynie!" else if arg 1 is "{@lista}": send "{@prefix} &7Lista postawionych skrzyń:" loop {yc::lokacje::*}: set {_id} to {yc::skrzynie::%loop-value%::id} send "&eID: %loop-index% &7- %{yc::definicje::%{_id}%::nazwa}% &7- &b%x-coord of loop-value%, %y-coord of loop-value%, %z-coord of loop-value%" else if arg 1 is "{@pomoc}": send "&6Skrypt: {@prefix}" send "&6/skrzynia {@ustawianie} &e[ID] &8- &7ustawia skrzynie" send "&6/skrzynia {@edytowanie} &8- &7edytuje drop z poziomu bloku" send "&6/skrzynia {@przenoszenie} &e[ID] &8- &7przenosi skrzynie" send "&6/skrzynia {@usuwanie} &8- &7usuwa skrzynie na ktora patrzysz" send "&6/skrzynia {@resetowanie} &8- &7czysci mape ze skrzyn" send "&6/skrzynia {@lista} &8- &7lista kordow" send "&6/klucz [Gracz/All] [nazwa_klucza_z_configu] [ilosc]" send "&7Ustawianie szansy: &nPPM + SHIFT &7w trakcie &nedytowania skrzyni" else if arg 1 is "info": send "&6Autor oryginału: Alan_Jestem &8| &bOptymalizacja: eeeeebcv" send "&6Wersja: 2.1 (Skript 2.15.2)" command /klucz []: permission: {@permisja} trigger: set {_ilosc} to arg 3 set {_klucz_raw} to arg 2 set {_nazwafind} to {yc::klucze_szukaj::%{_klucz_raw}%} if {_nazwafind} is not set: send "{@prefix} &cNie znaleziono takiego klucza w bazie skryptu!" stop if arg 1 is "all": give {_ilosc} of {@typ_klucza} named {_nazwafind} to all players send title {@keyall_title} with subtitle {@keyall_subtitle} to all players else: set {_p} to arg 1 parsed as player if {_p} is online: give {_ilosc} of {@typ_klucza} named {_nazwafind} to {_p} send "{@prefix} &aDano &6%{_ilosc}%x %{_nazwafind}% &adlacz gracza &e%arg 1%" else: send "{@prefix} &cGracz %arg 1% jest offline." #═══════════════════════════════════════════════════════════════════ #📮 Otwieranie skrzyni (Interakcja) #═══════════════════════════════════════════════════════════════════ on right click on {@typ_skrzyni}: if {yc::skrzynie::%location of event-block%::id} is set: cancel event set {_id} to {yc::skrzynie::%location of event-block%::id} set {-yc::aktywna::%player%} to {_id} if player is sneaking: previewChest({_id}, player) else: losuj({_id}, player) on left click on {@typ_skrzyni}: if {yc::skrzynie::%location of event-block%::id} is set: cancel event set {_id} to {yc::skrzynie::%location of event-block%::id} set {-yc::aktywna::%player%} to {_id} previewChest({_id}, player) #═══════════════════════════════════════════════════════════════════ #⌚ FUNKCJE GUI & LOSOWANIA #═══════════════════════════════════════════════════════════════════ function previewChest(id: integer, p: player): set {_gui} to chest inventory with 5 rows named "%{yc::definicje::%{_id}%::nazwa}% {@nazwa}" if {@obramowanie_1} is not air: set slot ({@sloty_obramowanie_1}) of {_gui} to {@obramowanie_1} if {@obramowanie_2} is not air: set slot ({@sloty_obramowanie_2}) of {_gui} to {@obramowanie_2} # Bezpieczne parsowanie indeksów slotów dla starszych wersji Skript set {_slots} to "10,11,12,13,14,15,16,19,20,21,22,23,24,25,28,29,30,31,32,33,34" set {_slots::*} to {_slots} split at "," set {_index} to 1 loop {_slots::*}: set {_slotNum} to loop-value parsed as integer set {_item} to {yc::drop::%{_id}%::%{_index}%} if {_item} is set: set {_szansa} to 0 if {yc::drop::%{_id}%::%{_index}%::szansa} is set: set {_szansa} to {yc::drop::%{_id}%::%{_index}%::szansa} set slot {_slotNum} of {_gui} to {_item} with lore "&bSzansa na ten item to: %{_szansa}%%%" add 1 to {_index} set slot 41 of {_gui} to lime dye named "&aLosowanie z animacją" set slot 39 of {_gui} to red dye named "&cLosowanie bez animacji" open {_gui} to {_p} function editChest(id: integer, p: player): set {_gui} to chest inventory with 3 rows named "&6Edytujesz: %{yc::definicje::%{_id}%::nazwa}%" loop 27 times: set {_item} to {yc::drop::%{_id}%::%loop-value%} if {_item} is set: set {_szansa} to 0 if {yc::drop::%{_id}%::%loop-value%::szansa} is set: set {_szansa} to {yc::drop::%{_id}%::%loop-value%::szansa} set slot (loop-value - 1) of {_gui} to {_item} with lore "&bUstawiona szansa: %{_szansa}%%%" open {_gui} to {_p} function hasKey(id: integer, p: player) :: boolean: set {_req_key} to {yc::definicje::%{_id}%::klucz} if name of {_p}'s tool doesn't contain {_req_key}: push {_p} backwards at speed {@sila_odpychania} play sound "{@noKeySound}" to {_p} send title "{@noKeyTitle}" with subtitle "{@noKeySubtitle}" to {_p} send "&7Pamiętaj aby mieć klucz w ręce!" to {_p} return false return true function getDropPool(id: integer) :: items: loop 27 times: set {_item} to {yc::drop::%{_id}%::%loop-value%} if {_item} is set: set {_szansa} to 0 if {yc::drop::%{_id}%::%loop-value%::szansa} is set: set {_szansa} to {yc::drop::%{_id}%::%loop-value%::szansa} loop {_szansa} times: add {_item} to {_pool::*} return {_pool::*} function noAnimLosuj(id: integer, p: player): if hasKey({_id}, {_p}) is false: stop set {_pool::*} to getDropPool({_id}) if {_p} cannot hold 1 of stone: send "&cMasz pełny ekwipunek!" to {_p} stop if {_pool::*} is not set: send "{@empty_chest_message}" to {_p} stop remove 1 of {@typ_klucza} named {yc::definicje::%{_id}%::klucz} from {_p} set {_win} to random element out of {_pool::*} play sound "{@losowanie_success_dzwiek}" to {_p} give {_win} to {_p} if name of {_win} contains "Klucz": broadcast "&b%{_p}% &7wylosował %name of {_win}%" function losuj(id: integer, p: player): if hasKey({_id}, {_p}) is false: stop set {_pool::*} to getDropPool({_id}) if {_p} cannot hold 1 of stone: send "&cMasz pełny ekwipunek!" to {_p} stop if {_pool::*} is not set: send "{@empty_chest_message}" to {_p} stop remove 1 of {@typ_klucza} named {yc::definicje::%{_id}%::klucz} from {_p} set {_gui} to chest inventory with 3 rows named "&6Losowanie: %{yc::definicje::%{_id}%::nazwa}%" set slot (integers between 0 and 8) of {_gui} to orange stained glass pane named "&7" set slot (integers between 18 and 26) of {_gui} to orange stained glass pane named "&7" set slot 22 of {_gui} to hopper named "&bTwój drop" set slot 4 of {_gui} to hopper named "&bTwój drop" loop integers between 9 and 17: set slot loop-value of {_gui} to random element out of {_pool::*} open {_gui} to {_p} set {_pitch} to {@pitch_losowania} loop {@ilosc_przesuniec} times: wait {@czas_miedzy_przesuwaniem} if name of {_p}'s current inventory does not contain "Losowanie:": stop loop integers between 9 and 16: set slot loop-value-2 of {_gui} to slot (loop-value-2 + 1) of {_gui} set slot 17 of {_gui} to random element out of {_pool::*} play sound "{@losowanie_dzwiek}" with pitch {_pitch} to {_p} add 0.1 to {_pitch} wait 20 ticks set {_win} to slot 13 of {_gui} play sound "{@losowanie_success_dzwiek}" to {_p} give {_win} to {_p} if name of {_win} contains "Klucz": broadcast "&b%{_p}% &7wylosował %name of {_win}%" close {_p}'s inventory #═══════════════════════════════════════════════════════════════════ #🔒 Eventy zabezpieczające i zapisujące (Inventory click/close) #═══════════════════════════════════════════════════════════════════ on inventory close: set {_name} to uncoloured name of event-inventory if {_name} contains "Edytujesz:": set {_id} to {-yc::edit::%player%} loop 27 times: set {_item} to slot (loop-value - 1) of event-inventory if {_item} is not air: # Oczyszczanie lore przed zapisem set {_lore::*} to lore of {_item} set {_size} to size of {_lore::*} if {_lore::%{_size}%} contains "Ustawiona szansa:": clear line {_size} of lore of {_item} set {yc::drop::%{_id}%::%loop-value%} to {_item} else: delete {yc::drop::%{_id}%::%loop-value%} delete {yc::drop::%{_id}%::%loop-value%::szansa} if {-yc::editszansa::%player%} is not set: send "{@prefix} &bZapisano zmiany w dropie skrzyni." delete {-yc::edit::%player%} on inventory click: set {_name} to uncoloured name of event-inventory if name of event-inventory contains "{@nazwa}": if {_name} does not contain "Edytujesz:": cancel event if clicked slot is 41: losuj({-yc::aktywna::%player%}, player) if clicked slot is 39: noAnimLosuj({-yc::aktywna::%player%}, player) else: if click type is right mouse button with shift: cancel event set {-yc::editszansa::%player%} to (index of event-slot + 1) close player's inventory send "{@prefix} &bNapisz nową szansę dla tego itemu na czacie (0-100):" on chat: if {-yc::editszansa::%player%} is set: cancel event set {_msg} to message parsed as integer if {_msg} is set: if {_msg} is between 0 and 100: set {yc::drop::%{-yc::edit::%player%}%::%{-yc::editszansa::%player%}%::szansa} to {_msg} send "{@prefix} &aUstawiono szansę na: &e%{_msg}%%%" set {_id} to {-yc::edit::%player%} delete {-yc::editszansa::%player%} editChest({_id}, player) else: send "{@prefix} &cSzansa musi mieścić się w przedziale 0-100." else: send "{@prefix} &cPodaj prawidłową liczbę całkowitą!" on block place of {@typ_klucza_antyplace}: if name of player's tool contains "klucz" or "Klucz": cancel event