#
# ░██╗████████╗███████╗███╗░░░███╗░ ░██████╗░░█████╗░██████╗░██╗████████╗██╗░░░██╗░
# ░██║╚══██╔══╝██╔════╝████╗░████║░ ░██╔══██╗██╔══██╗██╔══██╗██║╚══██╔══╝╚██╗░██╔╝░
# ░██║░░░██║░░░█████╗░░██╔████╔██║░ ░██████╔╝███████║██████╔╝██║░░░██║░░░░╚████╔╝░░
# ░██║░░░██║░░░██╔══╝░░██║╚██╔╝██║░ ░██╔══██╗██╔══██║██╔══██╗██║░░░██║░░░░░╚██╔╝░░░
# ░██║░░░██║░░░███████╗██║░╚═╝░██║░ ░██║░░██║██║░░██║██║░░██║██║░░░██║░░░░░░██║░░░░
# ░╚═╝░░░╚═╝░░░╚══════╝╚═╝░░░░░╚═╝░ ░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░░╚═╝░░░░░░╚═╝░░░░
#
# ░░██████╗██╗░░░██╗░██████╗████████╗███████╗███╗░░░███╗░
# ░██╔════╝╚██╗░██╔╝██╔════╝╚══██╔══╝██╔════╝████╗░████║░
# ░╚█████╗░░╚████╔╝░╚█████╗░░░░██║░░░█████╗░░██╔████╔██║░
# ░░╚═══██╗░░╚██╔╝░░░╚═══██╗░░░██║░░░██╔══╝░░██║╚██╔╝██║░
# ░██████╔╝░░░██║░░░██████╔╝░░░██║░░░███████╗██║░╚═╝░██║░
# ░╚═════╝░░░░╚═╝░░░╚═════╝░░░░╚═╝░░░╚══════╝╚═╝░░░░░╚═╝░
#
# Wymagania:
# ● Skript 2.6
# ● Skquery
# ● MorkazSk
# ● skript-yaml
# ● GlowAPI
# ● PacketListenerApi
#
options:
version: 1.0
author: PolsatGraniePL
#========================================================
# CONFIG
#========================================================
# Wyświetla potrzebne informacje w celu naprawy błędów
debug-mode: false
# Czy item ma się świecić jak na screenie: https://imgur.com/a/lrzvIGI
item-glow-system: true
# Czy item na posiadać nad sobą nazwę z ilością oraz nazwą tak jak na screenie: https://imgur.com/a/bJ1mYP7
# (Jeżeli angielska nazwa nie pasuje możesz zmienić ją w pliku ItemNameAliases.yml)
item-display-name-system: true
# Czy po otwarciu nienazwanej skrzynki itemy mają zostać zamienione na itemy z rzadkością?
# screen: https://imgur.com/a/zdqfW2e
item-name-on-chest-open: true
# Określ lokalizację pliku ItemRarity.yml oraz ItemNameAliases.yml
ItemRarity-file-location: plugins/Skript/
#========================================================
on script load:
delete {ItemRarityType::*}
delete {ItemRarityDisable}
if "{@version}" is not text from "https://code.skript.pl/1BeeVrCe/raw":
IRSkriptWarnMessage("&7[&6Skript&7] &rSkrypt &6%script%.sk&r ma dostępną nową wersje! &8(&rAktualna: &6{@version}&r, nowa: &6%text from "https://code.skript.pl/1BeeVrCe/raw"%&8)")
else:
IRSkriptWarnMessage("&7[&6Skript&7] &rSkrypt &6%script%.sk&r jest aktualny!")
if plugins "SkQuery" or "MorkazSk" or "skript-yaml" or "GlowAPI" or "PacketListenerApi" is not enabled:
IRSkriptWarnMessage("&7[&6Skript&7] &cSkrypt &6%script%.sk&c został wyłączony i nie będzie działać przez brakujące pluginy!")
IRSkriptWarnMessage(" &7Brakujące pluginy:")
if plugin "SkQuery" is not enabled:
IRSkriptWarnMessage(" &8● &rSkQuery &8(&7click to download&8)")
if plugin "MorkazSk" is not enabled:
IRSkriptWarnMessage(" &8● &rMorkazSk &8(&7click to download&8)")
if plugin "skript-yaml" is not enabled:
IRSkriptWarnMessage(" &8● &rskript-yaml &8(&7click to download&8)")
if plugin "GlowAPI" is not enabled:
IRSkriptWarnMessage(" &8● &rGlowAPI &8(&7click to download&8)")
if plugin "PacketListenerApi" is not enabled:
IRSkriptWarnMessage(" &8● &rPacketListenerApi &8(&7click to download&8)")
set {ItemRarityDisable} to true
stop
#========================================================
# CONFIG V2
#========================================================
#
#
#
#Dostępne kolory:
# BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, PURPLE, YELLOW, WHITE
# &0 &1 &4 &3 &4 &5 &6 &7 &8 &9 &a &b &c &d &e &f
#
# W celu ododania nowej lini tak jak na tym screenshocie: https://imgur.com/a/PAd4zNM
# zamień np. "&7&lCOMMON" na "%nl%&7&lCOMMON" z dopiskiem %nl% w celu utworzenia nowej linijki
# Nazwa rzadkości
set {ItemRarityType::common} to "&7&lPOSPOLITY"
# Kolor podświetlania rzadkości podczas wyrzucenia
set {ItemRarityType::common-color} to "GRAY"
# Kolor nazwy itemu podczas wyrzucenia
set {ItemRarityType::common-name} to "&7"
set {ItemRarityType::uncommon} to "&a&lNIEPOSPOLITY"
set {ItemRarityType::uncommon-color} to "GREEN"
set {ItemRarityType::uncommon-name} to "&a"
set {ItemRarityType::rare} to "&9&lRZADKI"
set {ItemRarityType::rare-color} to "BLUE"
set {ItemRarityType::rare-name} to "&9"
set {ItemRarityType::epic} to "&5&lEPICKI"
set {ItemRarityType::epic-color} to "DARK_PURPLE"
set {ItemRarityType::epic-name} to "&5&l"
set {ItemRarityType::legendary} to "&6&lLEGENDARNY"
set {ItemRarityType::legendary-color} to "GOLD"
set {ItemRarityType::legendary-name} to "&6&l"
set {ItemRarityType::mythic} to "&c&lMITYCZNY"
set {ItemRarityType::mythic-color} to "RED"
set {ItemRarityType::mythic-name} to "&c&l"
#========================================================
# Pobieranie listy itemów z wersji 1.18.1
set {_DefaultMaterialsList::*} to text from "https://code.skript.pl/LhqC4svp/raw" split at " ,"
set {ItemRarityTypeList::*} to "common", "uncommon", "rare", "epic", "legendary" and "mythic"
set {ItemRarityTypeInventory::*} to "Chest", "Large Chest", "Furnace", "Item Hopper", "Ender Chest", "Shulker Box", "Barrel", "Smoker", "Blast Furnace", "Dispenser", "Dropper" and "Minecart with Chest"
set {ItemRarityNameType::*} to {ItemRarityType::common}, {ItemRarityType::uncommon}, {ItemRarityType::rare}, {ItemRarityType::epic}, {ItemRarityType::legendary} and {ItemRarityType::mythic}
load yaml "{@ItemRarity-file-location}ItemRarity.yml" as "{@ItemRarity-file-location}ItemRarity.yml"
load yaml "{@ItemRarity-file-location}ItemNameAliases.yml" as "{@ItemRarity-file-location}ItemNameAliases.yml"
if yaml path "aliases" from "{@ItemRarity-file-location}ItemNameAliases.yml" doesn't have value:
set yaml value "aliases.sponge" from "{@ItemRarity-file-location}ItemNameAliases.yml" to "gąbka"
set yaml value "aliases.stone block" from "{@ItemRarity-file-location}ItemNameAliases.yml" to "kamień"
set yaml value "aliases.grass block" from "{@ItemRarity-file-location}ItemNameAliases.yml" to "blok trawy"
save yaml "{@ItemRarity-file-location}ItemNameAliases.yml"
if yaml path "common" from "{@ItemRarity-file-location}ItemRarity.yml" doesn't have value:
set yaml list "common" from "{@ItemRarity-file-location}ItemRarity.yml" to {_DefaultMaterialsList::*}
set yaml list "uncommon" from "{@ItemRarity-file-location}ItemRarity.yml" to ""
set yaml list "rare" from "{@ItemRarity-file-location}ItemRarity.yml" to ""
set yaml list "epic" from "{@ItemRarity-file-location}ItemRarity.yml" to ""
set yaml list "legendary" from "{@ItemRarity-file-location}ItemRarity.yml" to ""
set yaml list "mythic" from "{@ItemRarity-file-location}ItemRarity.yml" to ""
save yaml "{@ItemRarity-file-location}ItemRarity.yml"
IRSkriptWarnMessage("&7[&6Skript&7] &rWgrano &6default&r config do skryptu &6%script%.sk&r.")
loop {ItemRarityTypeList::*}:
IRreloadConfig("%loop-value%")
IRSkriptWarnMessage("&7[&6Skript&7] &rPoprawnie załadowano wszystkie itemy w skrypcie &6%script%.sk&r.")
#========================================================
function IRSkriptWarnMessage(tekst: text):
send formatted "%{_tekst}%" to all ops
send "%{_tekst}%" to console
function IRreloadConfig(typ: text):
set {_} to yaml value "%{_typ}%" from "{@ItemRarity-file-location}ItemRarity.yml"
set {_X} to "%{_}%"
replace all "[" and "]" with "" in {_X}
set {ItemRarity::%{_typ}%::*} to "%{_X}%" split at ", "
function IRreloadEQ(gracz: player):
loop all items in {_gracz}'s inventory:
delete {_jest}
loop lore of loop-item:
if {ItemRarityNameType::*} contains loop-value-2:
set {_jest} to true
{_jest} is not set
loop {ItemRarityTypeList::*}:
if {ItemRarity::%loop-value-2%::*} contains "%type of loop-item%":
add "%{ItemRarityType::%loop-value-2%}%" to lore of loop-item
{@debug-mode} is true
broadcast "&8(&cIRreloadEQ - function plr inv&8) &r%{_gracz}%: %type of loop-item%"
function IRreloadEQchest(gracz: player):
loop all items in {_gracz}'s current inventory:
delete {_jest}
loop lore of loop-item:
if {ItemRarityNameType::*} contains loop-value-2:
set {_jest} to true
{_jest} is not set
loop {ItemRarityTypeList::*}:
if {ItemRarity::%loop-value-2%::*} contains "%type of loop-item%":
add "%{ItemRarityType::%loop-value-2%}%" to lore of loop-item
{@debug-mode} is true
broadcast "&8(&cIRreloadEQchest - function cr inv&8) &r%{_gracz}%: %type of loop-item%"
on item merge:
{ItemRarityDisable} is not set
{@item-display-name-system} is true
set {_z} to 10 first characters of uncolored "%future event-entity%" in lowercase
replace all "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "w", "y", "z", "x", "v", "q", "'" and " " with "" in {_z}
if "%{_z}%" is "":
set {_z} to "1"
loop {ItemRarityTypeList::*}:
if {ItemRarity::%loop-value%::*} contains "%type of event-item%":
if name of event-item is set:
set display name of future event-entity to "&8(&7%item amount of event-item + {_z} parsed as number%&8)%{ItemRarityType::%loop-value%-name}% %name of event-item%" in proper case
else:
set {_2} to yaml value "aliases.%type of event-item%" from "{@ItemRarity-file-location}ItemNameAliases.yml"
if {_2} is set:
set display name of future event-entity to "&8(&7%item amount of event-item + {_z} parsed as number%&8)%{ItemRarityType::%loop-value%-name}% %{_2}%" in proper case
else:
set display name of future event-entity to "&8(&7%item amount of event-item + {_z} parsed as number%&8)%{ItemRarityType::%loop-value%-name}% %type of event-item%" in proper case
on item spawn:
{ItemRarityDisable} is not set
{@item-display-name-system} is true
loop {ItemRarityTypeList::*}:
if {ItemRarity::%loop-value%::*} contains "%type of event-item%":
if name of event-item is set:
set display name of event-entity to "&8(&7%item amount of event-item%&8)%{ItemRarityType::%loop-value%-name}% %name of event-item%" in proper case
else:
set {_} to yaml value "aliases.%type of event-item%" from "{@ItemRarity-file-location}ItemNameAliases.yml"
if {_} is set:
set display name of event-entity to "&8(&7%item amount of event-item%&8)%{ItemRarityType::%loop-value%-name}% %{_}%" in proper case
else:
set display name of event-entity to "&8(&7%item amount of event-item%&8)%{ItemRarityType::%loop-value%-name}% %type of event-item%" in proper case
on item spawn:
{ItemRarityDisable} is not set
wait 1 tick
if "%lore of event-item%" is "":
set {_l} to ""
else:
set {_l} to "%lore of event-item%"
set {_t} to type of event-item
set {_a} to item amount of event-item
loop {ItemRarityTypeList::*}:
{@item-glow-system} is true
if {ItemRarity::%loop-value%::*} contains "%type of event-item%":
make event-entity glow with color "%{ItemRarityType::%loop-value%-color}%" for all players
loop lore of event-item:
if {ItemRarityNameType::*} contains loop-value:
stop
delete event-entity
loop {ItemRarityTypeList::*}:
if {ItemRarity::%loop-value%::*} contains "%type of event-item%":
drop {_a} of {_t} with lore "%{_l}%%{ItemRarityType::%loop-value%}%" at event-location
stop
broadcast "&7[&6Skript&7] &c&lNieznany item!%nl% &r""&6%type of event-item%&r"", dodaj go do listy itemów w &6{@ItemRarity-file-location}ItemRarity.yml &7(&6%script%.sk&7)"
loop all players in radius 2 around event-entity:
give event-item to loop-player
stop
{@debug-mode} is true
broadcast "&8(&cOn spawn item - event&8) &r%{_t}%"
on inventory click:
{ItemRarityDisable} is not set
wait 1 tick
IRreloadEQ(player)
on inventory open:
{ItemRarityDisable} is not set
{@item-name-on-chest-open} is true
wait 1 tick
{ItemRarityTypeInventory::*} contains name of player's current inventory
IRreloadEQchest(player)